5f510499480a2879651b4b2bc6091ce2a7f1f732
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-05-28  Dan Bernstein  <mitz@apple.com>
2
3         [Xcode] ALWAYS_SEARCH_USER_PATHS is set to YES
4         https://bugs.webkit.org/show_bug.cgi?id=172691
5
6         Reviewed by Tim Horton.
7
8         * Configurations/Base.xcconfig: Set ALWAYS_SEARCH_USER_PATHS to NO.
9         * WebCore.xcodeproj/project.pbxproj: Added DateTimeChooser.h, DateTimeChooserClient.h,
10           PerformanceMark.h, PerformanceMeasure.h, SVGUnknownElement.h, and MathMLUnknownElement.h
11           to the WebCore target.
12
13 2017-05-28  Sam Weinig  <sam@webkit.org>
14
15         [WebIDL] @@iterator should only be accessed once when disambiguating a union type
16         https://bugs.webkit.org/show_bug.cgi?id=172684
17
18         Reviewed by Yusuke Suzuki.
19
20         WebIDL specifies that when determining if the value you are converting to a union
21         is a sequence, you must get the @@iterator property and, should it exist, use it
22         to iterate the sequence. While we correctly accessing the property to make the 
23         determination, we were not passing it into the sequence conversion code, and thus
24         the sequence conversion code re-accessed it, which is observable and wrong.
25
26         This patch pipes the @@iterator method through the sequence conversion code to avoid
27         this.
28
29         Test: js/dom/sequence-in-union-iterator-access.html
30
31         * bindings/js/JSDOMConvertSequences.h:
32         (WebCore::Detail::GenericSequenceConverter::convert):
33         (WebCore::Detail::NumericSequenceConverter::convertArray):
34         (WebCore::Detail::NumericSequenceConverter::convert):
35         (WebCore::Detail::SequenceConverter::convertArray):
36         (WebCore::Detail::SequenceConverter::convert):
37         (WebCore::Detail::SequenceConverter<IDLLong>::convert):
38         (WebCore::Detail::SequenceConverter<IDLFloat>::convert):
39         (WebCore::Detail::SequenceConverter<IDLUnrestrictedFloat>::convert):
40         (WebCore::Detail::SequenceConverter<IDLDouble>::convert):
41         (WebCore::Detail::SequenceConverter<IDLUnrestrictedDouble>::convert):
42         (WebCore::Converter<IDLSequence<T>>::convert):
43         (WebCore::Converter<IDLFrozenArray<T>>::convert):
44         Add variants of convert that take a JSObject* (sequence) / JSValue (iterator method)
45         rather than just the JSValue (sequence). To avoid too much duplication, split some
46         parts of SequenceConverter and NumericSequenceConverter up so they could be reused.
47
48         * bindings/js/JSDOMConvertUnion.h:
49         - Fix incorrect step 3 (WebIDL got updated at some point and we didn't notice) to remove
50           records.
51         - Update sequence and FrozenArray checking/conversion to get the iterator method and pass
52           it along, using the new ConditionalSequenceConverter helper which forwards to the new
53           sequence converters that accept the iterator method.
54
55 2017-05-27  Chris Dumez  <cdumez@apple.com>
56
57         imported/w3c/web-platform-tests/html/semantics/forms/form-control-infrastructure/form_attribute.html is crashing
58         https://bugs.webkit.org/show_bug.cgi?id=172472
59         <rdar://problem/32334831>
60
61         Reviewed by Ryosuke Niwa.
62
63         Fix assertion hit when running imported/w3c/web-platform-tests/html/semantics/forms/form-control-infrastructure/form_attribute.html.
64
65         When the form was removed from the document, A descendant would try to find a new form owner in the document. If the descendant had 
66         a form content attribute and there was another form in the document with this ID, then we would erroneously associate the descendant with
67         that other form, even though that descendant is being disconnected. This is because when the form with the given id is removed, we
68         notify the IdTargetObservers of the change. In this case, the form control is an IdTargetObserver and gets notified after
69         removedFrom() has been called on the form but *before* removedFrom() has been called on its descendant form control. As a result, the
70         form control still thinks it is in the tree (i.e. isConnected() wrongly returns true) and we make the wrong decision and try to
71         associate it with another form in the document.
72
73         To address the problem, we leverage the fact that when a form element is being removed, it already notifies its associated form
74         controls that it is being removed. When it does, we make sure to clear the control's id observer if the form is its ancestor.
75         The ID observer is no longer needed beyond this point since the control is now disconnected from the document, and the ID observer
76         callback would erroneously associate it with another form element in the document of the same ID because isConnected() still returns
77         true at that point.
78         As a result, the control's form owner is kept unchanged, which is the right thing to do here, since it is its ancestor, even
79         though both are detached.
80
81         Test: fast/dom/HTMLFormElement/form-removal-duplicate-id-crash.html
82
83         * dom/ContainerNode.h:
84         (WebCore::Node::rootNode):
85         Inline rootNode to avoid an extra function call in the fast path case. For the slow path, we now
86         call traverseToRootNode() to avoid duolicating logic.
87
88         * dom/Node.cpp:
89         (WebCore::Node::traverseToRootNode):
90         Add a traverseToRootNode() method which gets the root node by traversing the ancestors. This logic was duplicated in 3 places:
91         - Slow path in Node::rootNode()
92         - computeRootNode() in FormAssociatedElement.cpp
93         - findRoot() in HTMLFormElement.cpp
94         They are now consolidated in a single place to avoid duplication.
95
96         * dom/Node.h:
97         * html/FormAssociatedElement.cpp:
98         (WebCore::FormAssociatedElement::removedFrom):
99         Just simplify the logic a bit:
100         - Clear the id observer (i.e. m_formAttributeTargetObserver) no matter what. Since the element is no longer part of the document,
101           it is no longer needed. We would previously have checks that would basically avoid resetting m_formAttributeTargetObserver to
102           null if it is already null. Settign m_formAttributeTargetObserver to null is cheap so there is no reason for those checks. Those
103           checks were also confusing because they made it look like we would sometimes keep on id observer after being removed from the
104           document.
105         - Use new traverseToRootNode() utility function (no behavior change)
106         - Drop unnecessary |element| local variable
107
108         (WebCore::FormAssociatedElement::formOwnerRemovedFromTree):
109         - Rename to formOwnerRemovedFromTree() to make it clear that it is the element's form owner that is removed, and not just any form.
110         - As we traverse the tree up to find the root, also check if we find the form owner. If we do, clear the id observer since we are
111           effectively detached from the document and return early since there is no need to reset our form owner in this case.
112
113         * html/FormAssociatedElement.h:
114         * html/HTMLFormElement.cpp:
115         (WebCore::HTMLFormElement::removedFrom):
116         - Use new traverseToRootNode() utility function (no behavior change)
117
118 2017-05-27  Yusuke Suzuki  <utatane.tea@gmail.com>
119
120         [DOMJIT] Move DOMJIT patchpoint infrastructure out of domjit
121         https://bugs.webkit.org/show_bug.cgi?id=172260
122
123         Reviewed by Filip Pizlo.
124
125         * ForwardingHeaders/jit/Snippet.h: Renamed from Source/WebCore/ForwardingHeaders/domjit/DOMJITPatchpoint.h.
126         * ForwardingHeaders/jit/SnippetParams.h: Renamed from Source/WebCore/ForwardingHeaders/domjit/DOMJITPatchpointParams.h.
127         * bindings/scripts/CodeGeneratorJS.pm:
128         (GenerateHeader):
129         (GenerateImplementation):
130         * bindings/scripts/test/JS/JSTestDOMJIT.h:
131         * domjit/DOMJITCheckDOM.h:
132         (WebCore::DOMJIT::checkDOM):
133         * domjit/DOMJITHelpers.h:
134         (WebCore::DOMJIT::toWrapper):
135         * domjit/JSDocumentDOMJIT.cpp:
136         (WebCore::checkSubClassSnippetForJSDocument):
137         (WebCore::DocumentDocumentElementDOMJIT::callDOMGetter):
138         (WebCore::DocumentBodyDOMJIT::callDOMGetter):
139         (WebCore::checkSubClassPatchpointForJSDocument): Deleted.
140         * domjit/JSDocumentFragmentDOMJIT.cpp:
141         (WebCore::checkSubClassSnippetForJSDocumentFragment):
142         (WebCore::checkSubClassPatchpointForJSDocumentFragment): Deleted.
143         * domjit/JSElementDOMJIT.cpp:
144         (WebCore::checkSubClassSnippetForJSElement):
145         (WebCore::checkSubClassPatchpointForJSElement): Deleted.
146         * domjit/JSEventDOMJIT.cpp:
147         (WebCore::checkSubClassSnippetForJSEvent):
148         (WebCore::checkSubClassPatchpointForJSEvent): Deleted.
149         * domjit/JSNodeDOMJIT.cpp:
150         (WebCore::checkSubClassSnippetForJSNode):
151         (WebCore::createCallDOMGetterForOffsetAccess):
152         (WebCore::NodeFirstChildDOMJIT::callDOMGetter):
153         (WebCore::NodeLastChildDOMJIT::callDOMGetter):
154         (WebCore::NodeNextSiblingDOMJIT::callDOMGetter):
155         (WebCore::NodePreviousSiblingDOMJIT::callDOMGetter):
156         (WebCore::NodeParentNodeDOMJIT::callDOMGetter):
157         (WebCore::NodeNodeTypeDOMJIT::callDOMGetter):
158         (WebCore::NodeOwnerDocumentDOMJIT::callDOMGetter):
159         (WebCore::checkSubClassPatchpointForJSNode): Deleted.
160
161 2017-05-26  Simon Fraser  <simon.fraser@apple.com>
162
163         getComputedStyle returns percentage values for left / right / top / bottom
164         https://bugs.webkit.org/show_bug.cgi?id=29084
165
166         Reviewed by Zalan Bujtas.
167         
168         Fix getComputedStyle() to return pixel values for left / right / top / bottom, per spec.
169
170         This is mostly a merge of https://codereview.chromium.org/13871003/.
171
172         Behavior now matches Chrome and Firefox.
173
174         Test: fast/css/getComputedStyle/getComputedStyle-offsets.html
175
176         * css/CSSComputedStyleDeclaration.cpp:
177         (WebCore::getOffsetComputedLength):
178         (WebCore::getOffsetUsedStyleRelative):
179         (WebCore::getOffsetUsedStyleAbsolute):
180         (WebCore::positionOffsetValue):
181         (WebCore::positionOffsetValueIsRendererDependent):
182         (WebCore::isNonReplacedInline):
183         (WebCore::isLayoutDependent):
184         (WebCore::ComputedStyleExtractor::propertyValue):
185
186 2017-05-27  Zalan Bujtas  <zalan@apple.com>
187
188         enclosingIntRect returns a rect with -1 width/height when the input FloatRect overflows integer.
189         https://bugs.webkit.org/show_bug.cgi?id=172676
190
191         Reviewed by Simon Fraser.
192
193         Clamp integer values soon after the enclosing rectangle is resolved.
194
195         * platform/graphics/FloatRect.cpp:
196         (WebCore::enclosingIntRect):
197
198 2017-05-26  Joseph Pecoraro  <pecoraro@apple.com>
199
200         Simply some NSNumber usage
201         https://bugs.webkit.org/show_bug.cgi?id=172677
202
203         Reviewed by Sam Weinig.
204
205         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
206         (-[WebAccessibilityObjectWrapper _addAccessibilityObject:toTextMarkerArray:]):
207         (AXAttributeStringSetFont):
208         (AXAttributeStringSetStyle):
209         * accessibility/mac/AXObjectCacheMac.mm:
210         (WebCore::AXObjectCache::postTextStateChangePlatformNotification):
211         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
212         (AXAttributeStringSetStyle):
213         (AXAttributeStringSetSpelling):
214         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
215         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
216         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
217         * rendering/RenderThemeMac.mm:
218         (WebCore::RenderThemeMac::levelIndicatorFor):
219
220 2017-05-26  Youenn Fablet  <youenn@apple.com>
221
222         WebRTC stats should be in milliseconds
223         https://bugs.webkit.org/show_bug.cgi?id=172644
224
225         Reviewed by Eric Carlson.
226
227         Covered by updated tests.
228
229         * Modules/mediastream/RTCStatsReport.h:
230         * Modules/mediastream/RTCStatsReport.idl:
231         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
232         (WebCore::fillRTCStats):
233
234 2017-05-26  Sam Weinig  <sam@webkit.org>
235
236         [WebIDL] Overloaded functions should throw this object check exception before argument check exception
237         https://bugs.webkit.org/show_bug.cgi?id=172480
238
239         Reviewed by Chris Dumez.
240
241         - Codifies naming for both parts of the operation/attribute function implementation:
242           - The 'trampoline' which is the actual host function and simply calls IDLOperation,
243             IDLOperationReturningPromise or IDLAttribute.
244           - The 'body' which is where argument checking and calling into the implementation
245             takes place.
246         - Made it so all operations, including static ones, use the trampoline / body model,
247           simplifying code generation. The one exception is for overloaded operations, which
248           now have a trampoline and body for the dispatcher, and only bodies for all the 
249           overloads. This is what fixes the bug, since now that the dispatcher has a trampoline,
250           it can do the correct this object checking via IDLOperation / IDLOperationReturningPromise.
251         - Split out code generation for trampoline and body into separate subroutines and 
252           simplified their implementations.
253         - Changed GenerateOverloadDispatcher to only generate the body of the function, leaving it
254           up to the caller to generate the signature, braces and conditionals if needed.
255         - Made more subroutines take an output array and indent, in support of future endeavors
256           that will need that support.
257         - Remove unnecessary #includes of <runtime/Error.h>, which gets included already by virtue
258           of JSDOMExceptionHandling.h
259
260         Test: js/dom/overloaded-operation-exception-order.html
261
262         * bindings/js/JSDOMOperation.h:
263         * bindings/js/JSDOMOperationReturningPromise.h:
264         Add no-op static versions of the bouncer functions.
265
266         * bindings/scripts/CodeGeneratorJS.pm:
267         (GenerateOverloadDispatcher):
268         (GenerateOperationTrampolineDefinition):
269         (GenerateOperationBodyDefinition):
270         (GenerateOperationDefinition):
271         (GenerateSerializerDefinition):
272         (GenerateLegacyCallerDefinitions):
273         (GenerateLegacyCallerDefinition):
274         (GenerateArgumentsCountCheck):
275         (GenerateParametersCheck):
276         (GenerateImplementationFunctionCall):
277         (GenerateImplementationCustomFunctionCall):
278         (GenerateConstructorDefinitions):
279         (GenerateConstructorDefinition):
280
281         * bindings/scripts/test/JS/JSInterfaceName.cpp:
282         * bindings/scripts/test/JS/JSMapLike.cpp:
283         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
284         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
285         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
286         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
287         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
288         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
289         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
290         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
291         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
292         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
293         * bindings/scripts/test/JS/JSTestException.cpp:
294         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
295         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
296         * bindings/scripts/test/JS/JSTestInterface.cpp:
297         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
298         * bindings/scripts/test/JS/JSTestIterable.cpp:
299         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
300         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
301         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
302         * bindings/scripts/test/JS/JSTestNode.cpp:
303         * bindings/scripts/test/JS/JSTestObj.cpp:
304         * bindings/scripts/test/JS/JSTestObj.h:
305         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
306         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
307         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
308         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
309         * bindings/scripts/test/JS/JSTestSerialization.cpp:
310         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
311         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
312         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
313         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
314         Update test results.
315
316 2017-05-26  Brent Fulgham  <bfulgham@apple.com>
317
318         [WK2] Address thread safety issues with ResourceLoadStatistics
319         https://bugs.webkit.org/show_bug.cgi?id=172519
320         <rdar://problem/31707642>
321
322         Reviewed by Chris Dumez.
323
324         * loader/ResourceLoadObserver.cpp:
325         (WebCore::ResourceLoadObserver::setStatisticsQueue): Added.
326         (WebCore::ResourceLoadObserver::clearInMemoryStore): Only interact with the HashTable on the statistics queue.
327         (WebCore::ResourceLoadObserver::clearInMemoryAndPersistentStore): Ditto.
328         (WebCore::ResourceLoadObserver::logFrameNavigation): Ditto.
329         (WebCore::ResourceLoadObserver::logSubresourceLoading): Ditto.
330         (WebCore::ResourceLoadObserver::logWebSocketLoading): Ditto.
331         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution): Ditto.
332         (WebCore::ResourceLoadObserver::logUserInteraction): Ditto.
333         (WebCore::ResourceLoadObserver::clearUserInteraction): Protect HashTable while reading.
334         (WebCore::ResourceLoadObserver::hasHadUserInteraction): Ditto.
335         (WebCore::ResourceLoadObserver::setPrevalentResource): Ditto.
336         (WebCore::ResourceLoadObserver::isPrevalentResource): Ditto.
337         (WebCore::ResourceLoadObserver::clearPrevalentResource): Ditto.
338         (WebCore::ResourceLoadObserver::setGrandfathered): Ditto.
339         (WebCore::ResourceLoadObserver::isGrandfathered): Ditto.
340         (WebCore::ResourceLoadObserver::setSubframeUnderTopFrameOrigin): Only interact with the HashTable on the statistics queue.
341         (WebCore::ResourceLoadObserver::setSubresourceUnderTopFrameOrigin): Ditto.
342         (WebCore::ResourceLoadObserver::setSubresourceUniqueRedirectTo): Ditto.
343         (WebCore::ResourceLoadObserver::fireDataModificationHandler): ASSERT this is only called from the main thread, since this is
344         only meant to be used as part of the testing harness.
345         (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler): Ditto.
346         (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler): Ditto.
347         * loader/ResourceLoadObserver.h:
348         * loader/ResourceLoadStatisticsStore.cpp:
349         (WebCore::ResourceLoadStatisticsStore::isPrevalentResource): Protect HashTable while using it.
350         (WebCore::ResourceLoadStatisticsStore::ensureResourceStatisticsForPrimaryDomain): Ditto.
351         (WebCore::ResourceLoadStatisticsStore::setResourceStatisticsForPrimaryDomain): Ditto.
352         (WebCore::ResourceLoadStatisticsStore::createEncoderFromData): ASSERT this isn't being done on the main thread, and
353         protect HashTable while using it.
354         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder): Ditto.
355         (WebCore::ResourceLoadStatisticsStore::clearInMemory): Ditto.
356         (WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent): Ditto.
357         (WebCore::ResourceLoadStatisticsStore::statisticsForOrigin): Protect HashTable while using it.
358         (WebCore::ResourceLoadStatisticsStore::takeStatistics): Ditto.
359         (WebCore::ResourceLoadStatisticsStore::mergeStatistics): Ditto.
360         (WebCore::ResourceLoadStatisticsStore::setNotificationCallback): Use WTF::Function.
361         (WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback): Ditto.
362         (WebCore::ResourceLoadStatisticsStore::setWritePersistentStoreCallback): Ditto.
363         (WebCore::ResourceLoadStatisticsStore::setGrandfatherExistingWebsiteDataCallback): Ditto.
364         (WebCore::ResourceLoadStatisticsStore::fireDataModificationHandler): ASSERT this is not called on the main thread,
365         but dispatch the registered handler on the main thread.
366         (WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler): Ditto.
367         (WebCore::ResourceLoadStatisticsStore::processStatistics): ASSERT this isn't being done on the main thread, and
368         protect the HashTable while using it. Also switch to WTF::Function.
369         (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction): Make const correct.
370         (WebCore::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor): Protect HashTable while using it.
371         (WebCore::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords): Ditto.
372         (WebCore::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore): Ditto.
373         (WebCore::ResourceLoadStatisticsStore::shouldRemoveDataRecords): Make const correct. ASSERT this is not being called
374         on the main thread.
375         (WebCore::ResourceLoadStatisticsStore::dataRecordsBeingRemoved): ASSERT this is not being called on the main thread.
376         (WebCore::ResourceLoadStatisticsStore::dataRecordsWereRemoved): Ditto.
377         (WebCore::ResourceLoadStatisticsStore::statisticsLock): Added.
378         * loader/ResourceLoadStatisticsStore.h:
379
380 2017-05-26  Joseph Pecoraro  <pecoraro@apple.com>
381
382         JSContext Inspector: Improve the reliability of automatically pausing in auto-attach
383         https://bugs.webkit.org/show_bug.cgi?id=172664
384         <rdar://problem/32362933>
385
386         Reviewed by Matt Baker.
387
388         * inspector/InspectorController.h:
389         * page/PageDebuggable.cpp:
390         (WebCore::PageDebuggable::connect):
391         * page/PageDebuggable.h:
392         Pass an immediatelyPause boolean on to the controller.
393
394         * inspector/InspectorController.cpp:
395         (WebCore::InspectorController::connectFrontend):
396         (WebCore::InspectorController::disconnectFrontend):
397         (WebCore::InspectorController::disconnectAllFrontends):
398         Manage should immediately pause state.
399
400         (WebCore::InspectorController::frontendInitialized):
401         When initialized, trigger a pause if requested.
402
403 2017-05-26  Don Olmstead  <don.olmstead@am.sony.com>
404
405         [CMake] Consolidate CMake code related to FreeType
406         https://bugs.webkit.org/show_bug.cgi?id=172656
407
408         Reviewed by Michael Catanzaro.
409
410         No new tests. No change in behavior.
411
412         * PlatformGTK.cmake:
413         * PlatformWPE.cmake:
414         * platform/FreeType.cmake: Added.
415
416 2017-05-26  Sam Weinig  <sam@webkit.org>
417
418         [WebIDL] Another bindings cleanup pass, this time focusing on attributes
419         https://bugs.webkit.org/show_bug.cgi?id=172619
420
421         Reviewed by Chris Dumez.
422
423         - Moved attribute getter / setter generation into their own subroutines.
424         - As was done for operations, moved trampoline functions for attributes
425           below their implementation functions to avoid unseemly forward declaration.
426         - Changed to place the getter and setter for an attribute next to each other,
427           rather than having all the getters and then all the setters.
428         - Moved JSFoo::getConstructor and JSFoo::getNamedConstructor up to be with other
429           member functions.
430         - Fix an issue where we were generating a setJSFooConstructor function and not
431           installing it anywhere. Now we always generate either both the getter and setter
432           or neither for the constructor property. Also moved their definition to just above
433           all the attributes, rather than the odd placements of between the getters and
434           setters which is where they had been.
435         - Made InstanceNeedsVisitChildren a complete answer, rather than relying on some
436           loop of the attributes to update needsVisitChildren bit.
437         - Move use of passing conditionals when adding headers.
438
439         * bindings/scripts/CodeGeneratorJS.pm:
440         (InstanceNeedsVisitChildren):
441         (GenerateHeader):
442         (GenerateImplementation):
443         (GenerateAttributeGetterDefinition):
444         (GenerateAttributeSetterDefinition):
445         (NeedsConstructorProperty):
446
447         * bindings/scripts/test/JS/JSInterfaceName.cpp:
448         * bindings/scripts/test/JS/JSMapLike.cpp:
449         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
450         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
451         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
452         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
453         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
454         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
455         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
456         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
457         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
458         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
459         * bindings/scripts/test/JS/JSTestException.cpp:
460         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
461         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
462         * bindings/scripts/test/JS/JSTestInterface.cpp:
463         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
464         * bindings/scripts/test/JS/JSTestIterable.cpp:
465         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
466         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
467         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
468         * bindings/scripts/test/JS/JSTestNode.cpp:
469         * bindings/scripts/test/JS/JSTestObj.cpp:
470         * bindings/scripts/test/JS/JSTestObj.h:
471         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
472         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
473         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
474         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
475         * bindings/scripts/test/JS/JSTestSerialization.cpp:
476         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
477         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
478         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
479         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
480         Update test results.
481
482 2017-05-26  Don Olmstead  <don.olmstead@am.sony.com>
483
484         [CMake] Wrap CODE_GENERATOR_PREPROCESSOR_EXECUTABLE on Windows hosts
485         https://bugs.webkit.org/show_bug.cgi?id=172553
486
487         Reviewed by Brent Fulgham.
488
489         No new tests. No change in behavior.
490
491         * bindings/scripts/preprocessor.pm:
492         (applyPreprocessor): Use shellwords() instead of splitting
493         preprocessor command by space. Combine it back in open3() call on
494         Windows to work around Cygwin-specific issue.
495
496 2017-05-26  Wenson Hsieh  <wenson_hsieh@apple.com>
497
498         Unreviewed, fix the build using the latest SDK
499
500         Add deprecation guards around newly introduced (and deprecated) SPI.
501
502         * platform/ios/WebItemProviderPasteboard.mm:
503         (-[WebItemProviderPasteboard setItemsUsingRegistrationInfoLists:]):
504
505 2017-05-26  Beth Dakin  <bdakin@apple.com>
506
507         Media documents inside iframes should not get controls in the TouchBar unless the 
508         video is playing
509         https://bugs.webkit.org/show_bug.cgi?id=172620
510         -and corresponding-
511         rdar://problem/32165477
512
513         Reviewed by Jon Lee.
514
515         Media documents get to return early with true, but that should only apply to 
516         mainframe media documents. 
517         * html/MediaElementSession.cpp:
518         (WebCore::MediaElementSession::canShowControlsManager):
519
520 2017-05-26  Youenn Fablet  <youenn@apple.com>
521
522         Minor clean-up related to DocumentThreadableLoader redirections
523         https://bugs.webkit.org/show_bug.cgi?id=172647
524
525         Reviewed by Chris Dumez.
526
527         No change of behavior.
528
529         Decrementing m_options redirect count directly instead of using an
530         additional counter.
531
532         To compare whether two URLs are same-origin, use scheme+host+port check
533         as per the spec.
534         This is fine as only the initial origin may have specific rules and we
535         are using the scheme+host+port checks when already being gone to
536         another origin.
537
538         * loader/DocumentThreadableLoader.cpp:
539         (WebCore::DocumentThreadableLoader::redirectReceived):
540         * loader/DocumentThreadableLoader.h:
541         * loader/SubresourceLoader.cpp:
542         (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
543
544 2017-05-26  Youenn Fablet  <youenn@apple.com>
545
546         Fix memory leaks in MediaSampleAVFObjC::create
547         https://bugs.webkit.org/show_bug.cgi?id=172600
548
549         Reviewed by Eric Carlson.
550
551         No change of behavior.
552
553         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
554         (WebCore::MediaSampleAVFObjC::createImageSample):
555
556 2017-05-26  Manuel Rego Casasnovas  <rego@igalia.com>
557
558         [css-grid] Add support for orthogonal positioned grid items
559         https://bugs.webkit.org/show_bug.cgi?id=172591
560
561         Reviewed by Sergio Villar Senin.
562
563         This patch adds support for positioned grid items with orthogonal flows.
564         Basically it just needs to check if the item is orthogonal to use
565         the column or row offset as logical left or top depending on the case.
566
567         Tests: imported/w3c/web-platform-tests/css/css-grid-1/abspos/orthogonal-positioned-grid-items-***.html
568
569         * rendering/RenderGrid.cpp:
570         (WebCore::RenderGrid::layoutPositionedObject):
571
572 2017-05-25  Emilio Cobos Álvarez  <ecobos@igalia.com>
573
574         Don't reset m_hasDisplayContents on ElementRareData::resetComputedStyle.
575         https://bugs.webkit.org/show_bug.cgi?id=172503
576
577         Reviewed by Antti Koivisto.
578
579         We use that bit of information to determine whether we need to tear
580         down the renderers of a display: contents subtree, so better for it to
581         not change until the render tree is updated.
582
583         In practice, we may want to remove that bit and use ElementRareData's
584         RenderStyle instead (keeping it around as appropriate), to ensure they
585         don't go out of sync, but that's out of scope of this patch for now.
586
587         Tests: imported/w3c/web-platform-tests/css/css-display-3
588
589         * dom/ElementRareData.h:
590         (WebCore::ElementRareData::resetComputedStyle):
591
592 2017-05-25  Sam Weinig  <sam@webkit.org>
593
594         Fix MediaDeviceInfo's extended attributes so they make sense
595         https://bugs.webkit.org/show_bug.cgi?id=172629
596
597         Reviewed by Daniel Bates.
598
599         MediaDeviceInfo.idl had both a Constructor and NoInterfaceObject, which
600         doesn't really make sense. Either way, the spec says it should have 
601         neither, so remove both. And, while were there, add missing serializer.
602
603         Test: fast/mediastream/media-device-info.html
604
605         * Modules/mediastream/MediaDeviceInfo.idl:
606
607 2017-05-25  Chris Dumez  <cdumez@apple.com>
608
609         imported/w3c/web-platform-tests/html/semantics/forms/form-control-infrastructure/form_owner_and_table_2.html is crashing
610         https://bugs.webkit.org/show_bug.cgi?id=172628
611         <rdar://problem/32418707>
612
613         Reviewed by Sam Weinig.
614
615         In the event where a form is removed synchronously by a script during parsing,
616         FormAssociatedElement::m_formSetByParser may end up referring to a form that
617         is no longer in the document. As a result, we should make sure m_formSetByParser
618         is still connected in FormAssociatedElement::insertedInto() before we call
619         FormAssociatedElement::setForm(m_formSetByParser).
620
621         Test: fast/dom/HTMLFormElement/form-removed-during-parsing-crash.html
622
623         * html/FormAssociatedElement.cpp:
624         (WebCore::FormAssociatedElement::insertedInto):
625
626 2017-05-25  Zalan Bujtas  <zalan@apple.com>
627
628         Frame's composited content is visible when the frame has visibility: hidden.
629         https://bugs.webkit.org/show_bug.cgi?id=125565
630         <rdar://problem/32196849>
631
632         Reviewed by Simon Fraser.
633
634         Do not construct composited layers for hidden RenderWidgets (frameset, iframe, object).
635         Note that we still construct layers for the associated renderers as usual. 
636
637         Tests: compositing/visibility/frameset-visibility-hidden.html
638                compositing/visibility/iframe-visibility-hidden.html
639                compositing/visibility/object-visibility-hidden.html
640
641         * rendering/RenderLayerCompositor.cpp:
642         (WebCore::RenderLayerCompositor::requiresCompositingForPlugin):
643         (WebCore::RenderLayerCompositor::requiresCompositingForFrame):
644
645 2017-05-25  Yusuke Suzuki  <utatane.tea@gmail.com>
646
647         Unreviewed, build fix in GTK and WPE ports
648         https://bugs.webkit.org/show_bug.cgi?id=172580
649
650         Missing RenderSVGResourceMode declaration in SVGInlineTextBox.h.
651
652         * rendering/svg/SVGInlineTextBox.h:
653
654 2017-05-25  Simon Fraser  <simon.fraser@apple.com>
655
656         Use a typedef for SVG resource mode flags union
657         https://bugs.webkit.org/show_bug.cgi?id=172580
658
659         Reviewed by Sam Weinig.
660
661         Use an OptionSet<> for RenderSVGResourceModes flags, and use it in render
662         SVG resource classes.
663
664         * rendering/svg/RenderSVGResource.cpp:
665         (WebCore::requestPaintingResource):
666         (WebCore::RenderSVGResource::fillPaintingResource):
667         (WebCore::RenderSVGResource::strokePaintingResource):
668         * rendering/svg/RenderSVGResource.h:
669         (WebCore::RenderSVGResource::postApplyResource):
670         * rendering/svg/RenderSVGResourceClipper.cpp:
671         (WebCore::RenderSVGResourceClipper::applyResource):
672         * rendering/svg/RenderSVGResourceClipper.h:
673         * rendering/svg/RenderSVGResourceFilter.cpp:
674         (WebCore::RenderSVGResourceFilter::applyResource):
675         (WebCore::RenderSVGResourceFilter::postApplyResource):
676         * rendering/svg/RenderSVGResourceFilter.h:
677         * rendering/svg/RenderSVGResourceGradient.cpp:
678         (WebCore::RenderSVGResourceGradient::applyResource):
679         * rendering/svg/RenderSVGResourceGradient.h:
680         * rendering/svg/RenderSVGResourceMarker.h:
681         * rendering/svg/RenderSVGResourceMasker.cpp:
682         (WebCore::RenderSVGResourceMasker::applyResource):
683         * rendering/svg/RenderSVGResourceMasker.h:
684         * rendering/svg/RenderSVGResourcePattern.cpp:
685         (WebCore::RenderSVGResourcePattern::buildPattern):
686         (WebCore::RenderSVGResourcePattern::applyResource):
687         (WebCore::RenderSVGResourcePattern::postApplyResource):
688         * rendering/svg/RenderSVGResourcePattern.h:
689         * rendering/svg/RenderSVGResourceSolidColor.cpp:
690         (WebCore::RenderSVGResourceSolidColor::applyResource):
691         (WebCore::RenderSVGResourceSolidColor::postApplyResource):
692         * rendering/svg/RenderSVGResourceSolidColor.h:
693         * rendering/svg/RenderSVGShape.cpp:
694         (WebCore::RenderSVGShape::fillShape):
695         (WebCore::RenderSVGShape::strokeShape):
696         * rendering/svg/SVGInlineTextBox.cpp:
697         (WebCore::SVGInlineTextBox::SVGInlineTextBox):
698         (WebCore::SVGInlineTextBox::paintSelectionBackground):
699         (WebCore::SVGInlineTextBox::paint):
700         (WebCore::SVGInlineTextBox::acquirePaintingResource):
701         (WebCore::SVGInlineTextBox::releasePaintingResource):
702         (WebCore::SVGInlineTextBox::paintDecoration):
703         (WebCore::SVGInlineTextBox::paintDecorationWithStyle):
704         * rendering/svg/SVGInlineTextBox.h:
705         * rendering/svg/SVGRenderingContext.cpp:
706         (WebCore::SVGRenderingContext::~SVGRenderingContext):
707         (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
708         (WebCore::SVGRenderingContext::renderSubtreeToImageBuffer): Avoid needless IntPoint -> LayoutPoint
709         conversion.
710
711 2017-05-25  Chris Dumez  <cdumez@apple.com>
712
713         Regression(r215686): Videos sometimes do not load in iBooks
714         https://bugs.webkit.org/show_bug.cgi?id=172604
715         <rdar://problem/32003717>
716
717         Reviewed by Geoffrey Garen.
718
719         Before r215686, the loop would have a check at the beginning to check if the
720         dataRequest's currentOffset was greater than the buffer length and would
721         cause the function to return early.
722
723         This check was dropped in r215686, which caused us in some cases to call
724         finishLoading / stopLoading() after the loop, even though we did not have
725         enough data in the buffer to satisfy the data request.
726
727         To address the issue, we now return early after the loop if remainingLength
728         is greater than 0, meaning that we could not satisfy the request. This makes
729         sure we do not call finishLoading / stopLoading() prematurely.
730
731         Note that before r215686, the condition of the while loop was 
732         "while (remainingLength)" so the only way to get out of the loop was to:
733         1. Get remainingLength to 0, in which case we would fall through and
734            potentially call finishLoading / stopLoading() after the loop.
735         2. Fail the "(data->size() <= [dataRequest currentOffset] - responseOffset)"
736            check at the beginning of the loop, meaning that we ran out of data in
737            the buffer. This would cause us to return from the function, not fall
738            through, so we would not call finishLoading / stopLoading().
739
740         No new tests, I do not know how to write a test for this.
741
742         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
743         (WebCore::WebCoreAVFResourceLoader::fulfillRequestWithResource):
744
745 2017-05-25  Sam Weinig  <sam@webkit.org>
746
747         [WebIDL] Use the term 'operation' more consistently
748         https://bugs.webkit.org/show_bug.cgi?id=172601
749
750         Reviewed by Chris Dumez.
751
752         We were using the term 'operation', a WebIDL term for function-like
753         constructs, inconsistently in the code generator. Now, when we use
754         'operation' when referring to the IDL concept (usually the object the
755         parser produces) and 'function' when referring to code being generated.
756
757         * bindings/scripts/CodeGenerator.pm:
758         * bindings/scripts/IDLParser.pm:
759         * bindings/scripts/generate-bindings.pl:
760
761 2017-05-25  Jer Noble  <jer.noble@apple.com>
762
763         System sleeps while playing to wireless target, ending stream.
764         https://bugs.webkit.org/show_bug.cgi?id=172541
765
766         Reviewed by Eric Carlson.
767
768         API test: Tests/mac/MediaPlaybackSleepAssertion.mm
769
770         Keep the system from sleeping (but allow the display to sleep) while playing media to a wireless target.
771
772         Give the SleepDisabler a Type, either System or Display, which indicates what kind of sleep to disable.
773         Update HTMLMediaElement::shouldDisableSleep() to differentiate between a video which is playing locally,
774         one that is playing but not visible, and one that is playing remotely.
775
776         * html/HTMLMediaElement.cpp:
777         (WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged):
778         (WebCore::HTMLMediaElement::updateSleepDisabling):
779         (WebCore::HTMLMediaElement::shouldDisableSleep):
780         * html/HTMLMediaElement.h:
781         * platform/SleepDisabler.cpp:
782         (WebCore::SleepDisabler::create):
783         (WebCore::SleepDisabler::SleepDisabler):
784         * platform/SleepDisabler.h:
785         (WebCore::SleepDisabler::type):
786         * platform/cocoa/SleepDisablerCocoa.cpp:
787         (WebCore::SleepDisabler::create):
788         (WebCore::SleepDisablerCocoa::SleepDisablerCocoa):
789         (WebCore::SleepDisablerCocoa::~SleepDisablerCocoa):
790         * platform/cocoa/SleepDisablerCocoa.h:
791         * platform/mac/WebVideoFullscreenController.mm:
792         (-[WebVideoFullscreenController updatePowerAssertions]):
793         * platform/spi/cocoa/IOPMLibSPI.h:
794
795 2017-05-25  Chris Dumez  <cdumez@apple.com>
796
797         DocumentThreadableLoader::redirectReceived() should not rely on the resource's loader
798         https://bugs.webkit.org/show_bug.cgi?id=172578
799         <rdar://problem/30754582>
800
801         Reviewed by Youenn Fablet.
802
803         DocumentThreadableLoader::redirectReceived() should not rely on the resource's loader. The rest of the methods do not.
804         It is unsafe for it to rely on the resource's loader because it gets cleared when the load completes. A CachedRawresource
805         may be reused from the memory cache once its load has completed.
806
807         This would cause crashes in CachedRawResource::didAddClient() when replaying the redirects because it would call
808         DocumentThreadableLoader::redirectReceived() and potentially not have a loader anymore. To hit this exact code path,
809         you would need to make repeated XHR to a cacheable simple cross-origin resource that has cacheable redirect.
810
811         Test: http/tests/xmlhttprequest/cacheable-cross-origin-redirect-crash.html
812
813         * loader/DocumentThreadableLoader.cpp:
814         (WebCore::DocumentThreadableLoader::redirectReceived):
815         * loader/DocumentThreadableLoader.h:
816
817 2017-05-25  Zalan Bujtas  <zalan@apple.com>
818
819         ASSERTION FAILED: !needsStyleRecalc() || !document().childNeedsStyleRecalc()
820         https://bugs.webkit.org/show_bug.cgi?id=172576
821         <rdar://problem/32181979>
822
823         Reviewed by Brent Fulgham.
824
825         Ensure that we clean the subframe's document before start searching for a focusable element.
826
827         Covered by existing test.
828
829         * page/FocusController.cpp:
830         (WebCore::FocusController::findFocusableElementDescendingDownIntoFrameDocument):
831
832 2017-05-24  Jiewen Tan  <jiewen_tan@apple.com>
833
834         Crash on WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance + 1195
835         https://bugs.webkit.org/show_bug.cgi?id=172555
836         <rdar://problem/32004724>
837
838         Reviewed by Ryosuke Niwa.
839
840         setSelectionWithoutUpdatingAppearance could dispatch a synchronous focusin event,
841         which could invoke an event handler that deteles the frame. Therefore, add a
842         protector before the call.
843
844         Test: editing/selection/select-iframe-focusin-document-crash.html
845
846         * editing/FrameSelection.cpp:
847         (WebCore::FrameSelection::setSelection):
848
849 2017-05-25  Said Abou-Hallawa  <sabouhallawa@apple.com>
850
851         Ensure ImageFrameCache does not access its BitmapImage after it is deleted
852         https://bugs.webkit.org/show_bug.cgi?id=172563
853
854         Reviewed by Simon Fraser.
855
856         A crash may happen if the BitmapImage is deleted while the decoding thread
857         is still active. Once the current frame finishes decoding, the decoding
858         thread will make a callOnMainThread() which will access the deleted BitmapImage.
859
860         We need to ensure if BitmapImage is deleted, the raw pointer which references
861         it in ImageFrameCache is cleared. If this is done, nothing else is needed.
862         All all the accesses to container BitmapImage in ImageFrameCache are guarded
863         by checking m_image is not null.
864
865         * platform/graphics/BitmapImage.cpp:
866         (WebCore::BitmapImage::~BitmapImage): Make sure the decoding thread will
867         not have access to the deleted BitmapImage when it finishes decoding and
868         make its callOnMainThread().
869         (WebCore::BitmapImage::destroyDecodedData): Use the function new name.
870         (WebCore::BitmapImage::internalStartAnimation): Ditto.
871         * platform/graphics/ImageFrameCache.cpp:
872         (WebCore::ImageFrameCache::startAsyncDecodingQueue): Protect the sourceURL
873         for the decoding thread. ImageFrameCache::sourceURL() checks for the value
874         of m_image which now may change from the main thread.
875         * platform/graphics/ImageFrameCache.h:
876         (WebCore::ImageFrameCache::clearImage): Add a new function to clear the 
877         raw pointer m_image when its is deleted.
878         * platform/graphics/ImageSource.cpp:
879         (WebCore::ImageSource::resetData): Rename clear() to resetData() for better
880         code readability. This function deletes the ImageDecoder and creates a new
881         one if data is not null. The purpose is to delete the decoder raster data.
882         (WebCore::ImageSource::clear): Deleted.
883         * platform/graphics/ImageSource.h:
884         (WebCore::ImageSource::clearImage): Wrapper for the ImageFrameCache function.
885
886 2017-05-25  youenn fablet  <youenn@apple.com>
887
888         Add some release logging for media elements
889         https://bugs.webkit.org/show_bug.cgi?id=172581
890
891         Reviewed by Eric Carlson.
892
893         No change of behavior.
894
895          Adding logging for getUserMedia, video autoplay and incoming/outgoing webrtc video tracks.
896
897         * Modules/mediastream/UserMediaRequest.cpp:
898         (WebCore::UserMediaRequest::allow):
899         (WebCore::UserMediaRequest::deny):
900         * html/HTMLMediaElement.cpp:
901         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay):
902         * html/MediaElementSession.cpp:
903         (WebCore::MediaElementSession::playbackPermitted):
904         * platform/Logging.h:
905         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
906         (WebCore::RealtimeIncomingVideoSource::OnFrame):
907         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
908         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
909         (WebCore::RealtimeOutgoingVideoSource::sendOneBlackFrame):
910         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
911         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
912
913 2017-05-25  Sam Weinig  <sam@webkit.org>
914
915         [WebIDL] Do a pass of cleanup in the bindings generator
916         https://bugs.webkit.org/show_bug.cgi?id=172566
917
918         Reviewed by Chris Dumez.
919
920         - Split JSDOMBindingCaller.h into four new files to allow for less 
921           header inclusion (one includes a bunch of promise stuff that usually
922           isn't needed): 
923             - JSDOMCastedThisErrorBehavior (with shared casting enum)
924             - JSDOMAttribute (for attribute getting / setting)
925             - JSDOMOperation (for normal operations)
926             - JSDOMOperationReturningPromise (for operations returning promises, obviously).
927
928           In addition to separating the files, rename to be more consistent with modern
929           bindings conventions (new classes are IDLAttribute, IDLOperation, and 
930           IDLOperationReturningPromise) and simplify function names
931             - 'callOperation' becomes 'call'
932             - 'attribute' becomes 'get'
933             - 'setAttribute' becomes 'set'
934
935         - Remove extra generated trampoline function for operations returning promises
936           by making JSDOMOperationReturningPromise handle all the promise related overhead.
937
938         - Make [Custom] operations returning promises go through the normal IDLOperationReturningPromise
939           code path (simplifying JSReadableStreamSource and JSSubtleCrypto). Added [ReturnsOwnPromise]
940           extended attribute to allow some functions that want to retain specialized behavior to do so
941
942         - Swap order of trampoline and implementation of operation, to avoid the need for
943           a forward declaration and make reading more straightforward.
944
945         * WebCore.xcodeproj/project.pbxproj:
946         Add / remove files.
947
948         * bindings/js/JSDOMBindingCaller.h: Removed.
949
950         * bindings/js/JSDOMCastedThisErrorBehavior.h: Added.
951         Shared header for enum needed by JSDOMAttribute, JSDOMOperation and JSDOMOperationReturningPromise.
952
953         * bindings/js/JSDOMAttribute.h: Added.
954         * bindings/js/JSDOMOperation.h: Added.
955         * bindings/js/JSDOMOperationReturningPromise.h: Added.
956         Split out JSDOMBindingCaller implementations into own classes / files. Simplify
957         naming.
958     
959         * bindings/js/JSDOMPromiseDeferred.h:
960         (WebCore::callPromiseFunction):
961         Add a variant of callPromiseFunction that takes a lambda.
962
963         * bindings/js/JSEventTargetCustom.h:
964         (WebCore::IDLOperation<JSEventTarget>::call):
965         Update operation specialization to use new class.
966
967         * bindings/js/JSReadableStreamSourceCustom.cpp:
968         * bindings/js/JSSubtleCryptoCustom.cpp:
969         Simplify now that the callPromiseFunction is called for us.
970
971         * crypto/WebKitSubtleCrypto.idl:
972         * css/FontFace.idl:
973         * dom/CustomElementRegistry.idl:
974         Add [ReturnsOwnPromise] to retain custom promise behavior.
975
976         * bindings/scripts/CodeGeneratorJS.pm:
977         (GenerateHeader):
978         Update header generation to account for custom functions that return promises now
979         having a Ref<DeferredPromise>&& parameter.
980
981         (GenerateImplementation):
982         - Update for new naming of cast functions.
983         - Use AddToImplIncludes (and pass in conditional) rather than using $implIncludes
984           directly, #includes to be grouped correctly.
985         - Remove dead $inAppleCopyright code (it was moved to GenerateOperationDefinition 
986           earlier).
987
988         (GenerateOperationDefinition):
989         - Use $codeGenerator->IsPromiseType() rather than directly comparing to "Promise" string.
990         - Restructure code to allow trampoline (the code that calls IDLOperation) to come after
991           the main operation implementation (the part that calls into the impl).
992         - Support custom functions returning promises (and the [ReturnsOwnPromise] variant).
993
994         (GenerateImplementationIterableFunctions):
995         Update for name change to IDLOperation.
996
997         * bindings/scripts/IDLAttributes.json:
998         Add [ReturnsOwnPromise].
999
1000         * bindings/scripts/test/JS/JSInterfaceName.cpp:
1001         * bindings/scripts/test/JS/JSMapLike.cpp:
1002         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
1003         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1004         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
1005         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
1006         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
1007         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
1008         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
1009         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
1010         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1011         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1012         * bindings/scripts/test/JS/JSTestException.cpp:
1013         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
1014         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1015         * bindings/scripts/test/JS/JSTestInterface.cpp:
1016         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
1017         * bindings/scripts/test/JS/JSTestIterable.cpp:
1018         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
1019         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
1020         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1021         * bindings/scripts/test/JS/JSTestNode.cpp:
1022         * bindings/scripts/test/JS/JSTestObj.cpp:
1023         * bindings/scripts/test/JS/JSTestObj.h:
1024         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1025         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
1026         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1027         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
1028         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1029         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
1030         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
1031         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1032         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1033         Update test results.
1034
1035         * bindings/scripts/test/TestObj.idl:
1036         Add additional test cases for operations returning promises.
1037
1038 2017-05-25  Simon Fraser  <simon.fraser@apple.com>
1039
1040         Some <chrono> and ProgressTracker cleanup
1041         https://bugs.webkit.org/show_bug.cgi?id=172582
1042
1043         Reviewed by Sam Weinig.
1044
1045         Remove some unnecessary <chrono> includes.
1046         Convert some std::chrono to use MonotonicTime/Seconds.
1047         Clean up ProgressTracker.
1048         Some #pragma once.
1049
1050         * dom/Document.h:
1051         * loader/ProgressTracker.cpp:
1052         (WebCore::ProgressTracker::ProgressTracker):
1053         (WebCore::ProgressTracker::reset):
1054         (WebCore::ProgressTracker::progressStarted):
1055         (WebCore::ProgressTracker::finalProgressComplete):
1056         (WebCore::ProgressTracker::incrementProgress):
1057         * loader/ProgressTracker.h:
1058         * page/Settings.h:
1059         * platform/SearchPopupMenu.h:
1060         * platform/Timer.h:
1061         * platform/graphics/cg/IOSurfacePool.cpp:
1062         (WebCore::IOSurfacePool::markOlderSurfacesPurgeable):
1063         * platform/graphics/cg/IOSurfacePool.h:
1064         (WebCore::IOSurfacePool::CachedSurfaceDetails::resetLastUseTime):
1065         * platform/network/PlatformCookieJar.h:
1066
1067 2017-05-25  Joanmarie Diggs  <jdiggs@igalia.com>
1068
1069         [ATK] Expose doc-footnote ARIA role with ATK_ROLE_FOOTNOTE
1070         https://bugs.webkit.org/show_bug.cgi?id=172355
1071
1072         Reviewed by Chris Fleizach.
1073
1074         Add a new FootnoteRole accessibility role to WebCore and map it to
1075         ATK_ROLE_FOOTNOTE for WebKitGtk and NSAccessibilityGroupRole with
1076         a subrole of AXApplicationGroup for the Mac port.
1077
1078         No new tests because we already have coverage for this role.
1079         The existing test expectations were updated to reflect the
1080         new mapping of doc-footnote to ATK_ROLE_FOOTNOTE.
1081
1082         * accessibility/AccessibilityObject.cpp:
1083         (WebCore::initializeRoleMap):
1084         (WebCore::AccessibilityObject::computedRoleString):
1085         * accessibility/AccessibilityObject.h:
1086         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1087         (atkRole):
1088         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1089         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
1090         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1091         (createAccessibilityRoleMap):
1092         (-[WebAccessibilityObjectWrapper subrole]):
1093
1094 2017-05-25  youenn fablet  <youenn@apple.com>
1095
1096         [macOS WK2 Debug] Layout Test webrtc/video.html is crashing.
1097         https://bugs.webkit.org/show_bug.cgi?id=172560
1098         <rdar://problem/32392611>
1099
1100         Reviewed by Eric Carlson.
1101
1102         webrtc/multiple-video.html is no longer crashing.
1103
1104         Allow autoplay only from going to not capture to capture, and not the reverse.
1105         Renamed HTMLMediaElement::mediaStreamCaptureStateChanged to mediaStreamCaptureStarted.
1106
1107         * dom/Document.cpp:
1108         (WebCore::Document::mediaStreamCaptureStateChanged):
1109         * html/HTMLMediaElement.cpp:
1110         (WebCore::HTMLMediaElement::mediaStreamCaptureStateChanged): Deleted.
1111         * html/HTMLMediaElement.h:
1112         (WebCore::HTMLMediaElement::mediaStreamCaptureStarted):
1113
1114 2017-05-25  Dave Hyatt  <hyatt@apple.com>
1115
1116         Baseline of number inputs not right.
1117         https://bugs.webkit.org/show_bug.cgi?id=172237
1118
1119         Reviewed by Dean Jackson.
1120
1121         Added fast/forms/baseline-of-number-inputs.html
1122
1123         * css/html.css:
1124         (input::-webkit-inner-spin-button):
1125         * rendering/RenderSearchField.cpp:
1126         (WebCore::RenderSearchField::computeLogicalHeightLimit): Deleted.
1127         (WebCore::RenderSearchField::centerContainerIfNeeded): Deleted.
1128         * rendering/RenderSearchField.h:
1129         * rendering/RenderTextControlSingleLine.cpp:
1130         (WebCore::RenderTextControlSingleLine::centerRenderer):
1131         (WebCore::RenderTextControlSingleLine::layout):
1132         (WebCore::RenderTextControlSingleLine::computeLogicalHeightLimit): Deleted.
1133         * rendering/RenderTextControlSingleLine.h:
1134         (WebCore::RenderTextControlSingleLine::centerContainerIfNeeded): Deleted.
1135
1136 2017-05-25  Manuel Rego Casasnovas  <rego@igalia.com>
1137
1138         [css-grid] Fix behavior of positioned items without specific dimensions
1139         https://bugs.webkit.org/show_bug.cgi?id=172117
1140
1141         Reviewed by Sergio Villar Senin.
1142
1143         Currently positioned items that doesn't have specific dimensions
1144         are not properly sized. This patch fixes the issues with them.
1145
1146         The patch removes the extraInline|BlockOffsets from RenderBox,
1147         so now RenderGrid is responsible of setting the location of the positioned item.
1148         This will be useful to add alignment support for positioned items later.
1149         It also removes grid specific logic from RenderBox.
1150
1151         RenderBox::computeInlineStaticDistance() was modified too.
1152         The problem here was that the containing block of the positioned gird items
1153         is the grid area (and not the grid container). The method didn't know
1154         anything about grid, so it was using the grid container causing wrong values
1155         when resolving "auto" in both left and right offset properties.
1156
1157         Note that after this patch we match Chrome and Firefox behavior on these cases.
1158
1159         Test: fast/css-grid-layout/positioned-grid-items-sizing.html
1160
1161         * rendering/RenderBox.cpp:
1162         (WebCore::RenderBox::willBeDestroyed):
1163         (WebCore::computeInlineStaticDistance):
1164         (WebCore::RenderBox::computePositionedLogicalWidth):
1165         (WebCore::RenderBox::computePositionedLogicalHeight):
1166         * rendering/RenderBox.h:
1167         * rendering/RenderGrid.cpp:
1168         (WebCore::RenderGrid::layoutPositionedObject):
1169         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
1170
1171 2017-05-25  Claudio Saavedra  <csaavedra@igalia.com>
1172
1173         [WPE] Build fix after r217404
1174
1175         Unreviewed
1176
1177         * PlatformWPE.cmake: Include missing cairo cmake file.
1178
1179 2017-05-24  Chris Dumez  <cdumez@apple.com>
1180
1181         ResourceResponses for data URLs have their Source marked as Unknown
1182         https://bugs.webkit.org/show_bug.cgi?id=172573
1183         <rdar://problem/31786198>
1184
1185         Reviewed by Geoffrey Garen.
1186
1187         ResourceResponses for data URLs have their Source marked as Unknown.
1188
1189         Now set their source to Network to maintain previous behavior when
1190         we used to decode those data URLs on Network process side.
1191
1192         Test: fast/url/data-url-source.html
1193
1194         * loader/ResourceLoader.cpp:
1195         (WebCore::ResourceLoader::loadDataURL):
1196
1197 2017-05-24  Fujii Hironori  <Hironori.Fujii@sony.com>
1198
1199         [Win] An assertion fails if the custom cursor image isn't loaded yet
1200         https://bugs.webkit.org/show_bug.cgi?id=172209
1201
1202         Reviewed by Said Abou-Hallawa.
1203
1204         Test: fast/css/crash-on-custom-cursor-when-loading.html
1205
1206         A custom cursor image can be zero dimension if it is loading or
1207         decoding. Cursor::ensurePlatformCursor of Windows port should
1208         handle such case properly.
1209
1210         * platform/win/CursorWin.cpp:
1211         (WebCore::Cursor::ensurePlatformCursor): Load a stock cursor if
1212         the custom cursor image has zero dimension. Do not do null-check
1213         of the return value of createSharedCursor() because it never
1214         returns null.
1215
1216 2017-05-24  Don Olmstead  <don.olmstead@am.sony.com>
1217
1218         [CMake] Consolidate CMake code related to Cairo
1219         https://bugs.webkit.org/show_bug.cgi?id=172568
1220
1221         Reviewed by Alex Christensen.
1222
1223         No new tests. No change in behavior.
1224
1225         * PlatformGTK.cmake:
1226         * PlatformWPE.cmake:
1227         * PlatformWinCairo.cmake:
1228         * config.h:
1229         * platform/Cairo.cmake: Added.
1230         * platform/GStreamer.cmake:
1231         * platform/ImageDecoders.cmake:
1232
1233 2017-05-24  Said Abou-Hallawa  <sabouhallawa@apple.com>
1234
1235         REGRESSION (r206481): Don't assume frameCount() is larger than or equal to the size of the image frame cache
1236         https://bugs.webkit.org/show_bug.cgi?id=172552
1237
1238         Reviewed by Geoffrey Garen.
1239
1240         If an image with many cached ImageFrames is cached but its encoded data is
1241         freed, then the same image is reused, the encoded data will be fetched.
1242         But the initial frameCount() might be less than the current size of the
1243         ImageFrames cache.
1244
1245         This was causing an assertion in the debug build and crash in the release
1246         build. Vector::grow() does not handle the case where the new size is smaller
1247         than the current size safely.
1248
1249         * platform/graphics/ImageFrameCache.cpp:
1250         (WebCore::ImageFrameCache::growFrames):
1251
1252 2017-05-24  Sergey Shekyan  <shekyan@gmail.com>
1253
1254         navigator.webdriver should return false if the page is not controlled by automation
1255         https://bugs.webkit.org/show_bug.cgi?id=171997
1256
1257         Reviewed by Chris Dumez.
1258
1259         Per WebDriver Specification at https://www.w3.org/TR/webdriver/#interface
1260
1261         Test: js/dom/navigator-webdriver.html
1262         Rebaseled fast/dom/navigator-detached-no-crash.html
1263
1264         * Modules/webdriver/NavigatorWebDriver.cpp:
1265         (WebCore::NavigatorWebDriver::NavigatorWebDriver):
1266         (WebCore::NavigatorWebDriver::isControlledByAutomation):
1267         (WebCore::NavigatorWebDriver::from):
1268         (WebCore::NavigatorWebDriver::webdriver):
1269         (WebCore::JSNavigator::webdriver): Deleted.
1270         * Modules/webdriver/NavigatorWebDriver.h:
1271         * Modules/webdriver/NavigatorWebDriver.idl:
1272
1273 2017-05-24  Ryan Haddad  <ryanhaddad@apple.com>
1274
1275         Unreviewed, suppress deprecation warnings to fix the build.
1276
1277         * platform/graphics/mac/GraphicsContextMac.mm:
1278         (WebCore::linearRGBColorSpaceRef):
1279
1280 2017-05-24  Wenson Hsieh  <wenson_hsieh@apple.com>
1281
1282         Plumb additional image metadata to item providers when beginning data interaction on an image
1283         https://bugs.webkit.org/show_bug.cgi?id=172536
1284         <rdar://problem/32371300>
1285
1286         Reviewed by Beth Dakin.
1287
1288         Plumb suggestedName (the last path component of the image's source URL) and size (the actual size of the image)
1289         to item providers when beginning data interaction on an image.
1290
1291         Augments existing unit tests to cover these changes -- see DataInteractionTests.
1292
1293         * editing/ios/EditorIOS.mm:
1294         (WebCore::Editor::writeImageToPasteboard):
1295         * platform/Pasteboard.h:
1296         * platform/ios/PlatformPasteboardIOS.mm:
1297         (WebCore::PlatformPasteboard::writeObjectRepresentations):
1298         * platform/ios/WebItemProviderPasteboard.h:
1299         * platform/ios/WebItemProviderPasteboard.mm:
1300         (-[WebItemProviderRegistrationInfoList init]):
1301         (-[WebItemProviderPasteboard setItemsUsingRegistrationInfoLists:]):
1302         (temporaryFileURLForDataInteractionContent):
1303
1304 2017-05-24  Eric Carlson  <eric.carlson@apple.com>
1305
1306         CoreAudioCaptureSource is ducking system sound
1307         https://bugs.webkit.org/show_bug.cgi?id=172512
1308
1309         Reviewed by Youenn Fablet.
1310
1311         Manual testing.
1312
1313         * Configurations/WebCore.xcconfig: Adding CoreAudio as framework for iOS.
1314         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1315         (WebCore::CoreAudioSharedUnit::setupAudioUnit):
1316         (WebCore::CoreAudioSharedUnit::defaultOutputDevice):
1317         * platform/spi/cf/CoreAudioSPI.h: Added.
1318
1319 2017-05-24  John Wilander  <wilander@apple.com>
1320
1321         Resource Load Statistics: Change grandfathering default to one hour
1322         https://bugs.webkit.org/show_bug.cgi?id=172524
1323         <rdar://problem/32360462>
1324
1325         Reviewed by Brent Fulgham.
1326
1327         Covered by existing test.
1328
1329         * loader/ResourceLoadStatisticsStore.cpp:
1330
1331 2017-05-24  Jer Noble  <jer.noble@apple.com>
1332
1333         Rename DisplaySleepDisabler -> SleepDisabler
1334         https://bugs.webkit.org/show_bug.cgi?id=172478
1335
1336         Reviewed by Sam Weinig.
1337
1338         Rename DisplaySleepDisabler to SleepDisabler so that different (i.e., non-Display) sleep types can be
1339         added in a future change.
1340
1341         * WebCore.xcodeproj/project.pbxproj:
1342         * html/HTMLMediaElement.cpp:
1343         (WebCore::HTMLMediaElement::updateSleepDisabling):
1344         * html/HTMLMediaElement.h:
1345         * platform/SleepDisabler.cpp: Renamed from Source/WebCore/platform/DisplaySleepDisabler.cpp.
1346         (WebCore::SleepDisabler::create):
1347         (WebCore::SleepDisabler::SleepDisabler):
1348         (WebCore::SleepDisabler::~SleepDisabler):
1349         * platform/SleepDisabler.h: Renamed from Source/WebCore/platform/DisplaySleepDisabler.h.
1350         * platform/cocoa/SleepDisablerCocoa.cpp: Renamed from Source/WebCore/platform/cocoa/DisplaySleepDisablerCocoa.cpp.
1351         (WebCore::SleepDisabler::create):
1352         (WebCore::SleepDisablerCocoa::SleepDisablerCocoa):
1353         (WebCore::SleepDisablerCocoa::~SleepDisablerCocoa):
1354         * platform/cocoa/SleepDisablerCocoa.h: Renamed from Source/WebCore/platform/cocoa/DisplaySleepDisablerCocoa.h.
1355         * platform/mac/WebVideoFullscreenController.h:
1356         * platform/mac/WebVideoFullscreenController.mm:
1357         (-[WebVideoFullscreenController updatePowerAssertions]):
1358         * CMakeLists.txt:
1359         * PlatformMac.cmake:
1360         * WebCore.order:
1361
1362 2017-05-24  Per Arne Vollan  <pvollan@apple.com>
1363
1364         [Win] Create unique network storage session for each DRT.
1365         https://bugs.webkit.org/show_bug.cgi?id=172540
1366
1367         Reviewed by Brent Fulgham.
1368
1369         During layout testing, each DRT instance should have its own network storage session.
1370
1371         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1372         (WebCore::NetworkStorageSession::switchToNewTestingSession):
1373
1374 2017-05-24  Sam Weinig  <sam@webkit.org>
1375
1376         [WebIDL] Overloaded functions unnecessarily duplicate argument checks
1377         https://bugs.webkit.org/show_bug.cgi?id=172481
1378
1379         Reviewed by Chris Dumez.
1380
1381         * bindings/scripts/CodeGeneratorJS.pm:
1382         (GenerateHeader):
1383         (GeneratePropertiesHashTable):
1384         Update for rename of GetConditionalForFunctionConsideringOverloads.
1385
1386         (AreTypesDistinguishableForOverloadResolution):
1387         Remove unnecessary subroutine isDictionary that can be replaced by
1388         a direct call to $codeGenerator->IsDictionaryType().
1389
1390         (GetConditionalForFunctionConsideringOverloads):
1391         Renamed from getConditionalForFunctionConsideringOverloads.
1392
1393         (GenerateOverloadDispatcher):
1394         Renamed from GenerateOverloadedFunctionOrConstructor. Moved Constructor/Operation/LegacyCaller
1395         specific code out, and into parameters.
1396
1397         (GenerateImplementation):
1398         Moved operation generation out into its own subroutine.
1399
1400         (GenerateOperationDefinition): Added.
1401         Moved from GenerateImplementation.
1402
1403         (GenerateLegacyCallerDefinitions):
1404         Pass function name and signature to GenerateOverloadDispatcher.
1405
1406         (GenerateArgumentsCountCheck):
1407         Don't generate an argument check if this is an overloaded function. The argument
1408         checks happen in the overload dispatcher.
1409
1410         (NeedsExplicitPropagateExceptionCall):
1411         (GenerateParametersCheck):
1412         (GenerateImplementationFunctionCall):
1413         Replace IsReturningPromise with more direct check.
1414
1415         (GenerateConstructorDefinitions):
1416         Pass function name and signature to GenerateOverloadDispatcher.
1417
1418         (getConditionalForFunctionConsideringOverloads): Renamed to GetConditionalForFunctionConsideringOverloads.
1419         (GenerateOverloadedFunctionOrConstructor): Renamed to GenerateOverloadDispatcher.
1420         (IsReturningPromise): Deleted.
1421
1422         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1423         * bindings/scripts/test/JS/JSTestInterface.cpp:
1424         * bindings/scripts/test/JS/JSTestObj.cpp:
1425         * bindings/scripts/test/TestInterface.idl:
1426         Update test results.
1427
1428 2017-05-24  Commit Queue  <commit-queue@webkit.org>
1429
1430         Unreviewed, rolling out r217319.
1431         https://bugs.webkit.org/show_bug.cgi?id=172538
1432
1433         This patch broke iOS Simulator Debug build (Requested by fredw
1434         on #webkit).
1435
1436         Reverted changeset:
1437
1438         "CoreAudioCaptureSource is ducking system sound"
1439         https://bugs.webkit.org/show_bug.cgi?id=172512
1440         http://trac.webkit.org/changeset/217319
1441
1442 2017-05-24  Antoine Quint  <graouts@apple.com>
1443
1444         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
1445         https://bugs.webkit.org/show_bug.cgi?id=168409
1446
1447         Unreviewed.
1448
1449         Remove temporary logging which prevents performance bots from reporting useful data.
1450
1451         * page/Page.cpp:
1452         (WebCore::Page::suspendScriptedAnimations):
1453
1454 2017-05-24  Javier Fernandez  <jfernandez@igalia.com>
1455
1456         [css-grid] Ignore collapsed tracks on content-distribution alignment
1457         https://bugs.webkit.org/show_bug.cgi?id=172493
1458
1459         Reviewed by Manuel Rego Casasnovas.
1460
1461         The CSS Box Alignment spec states that we should ignore the collapsed
1462         tracks when computing the Distribution Alignment space to assign to the
1463         different grid tracks.
1464
1465         No new tests, just unskipping the web-platform-tests imported to verify this use case.
1466
1467         * rendering/RenderGrid.cpp:
1468         (WebCore::RenderGrid::populateGridPositionsForDirection):
1469
1470 2017-05-24  Wenson Hsieh  <wenson_hsieh@apple.com>
1471
1472         Respect image UTIs when writing to item providers when beginning data interaction on an image
1473         https://bugs.webkit.org/show_bug.cgi?id=172436
1474         <rdar://problem/31786569>
1475
1476         Reviewed by Beth Dakin.
1477
1478         Previously, when beginning writing images to the WebItemProviderPasteboard, we would create a new UIImage and
1479         use standard UIImage UIItemProviderWriting utilities to register the image to the pasteboard. This is lossy for
1480         gifs, since UIImage doesn't inherently know how to represent gifs. Instead, register the raw image data directly
1481         to the UTI type corresponding to the MIME type of the image, and use UIImage's item provider writing capability
1482         as a fallback when the raw resourceData is unavailable.
1483
1484         Augments existing unit tests, and also adds a new unit test:
1485         DataInteractionTests.ImageDoesNotUseElementSizeAsEstimatedSize
1486
1487         * platform/ios/PlatformPasteboardIOS.mm:
1488         (WebCore::PlatformPasteboard::writeObjectRepresentations):
1489
1490 2017-05-23  Eric Carlson  <eric.carlson@apple.com>
1491
1492         CoreAudioCaptureSource is ducking system sound
1493         https://bugs.webkit.org/show_bug.cgi?id=172512
1494
1495         Reviewed by Youenn Fablet.
1496
1497         Manual testing.
1498
1499         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1500         (WebCore::CoreAudioSharedUnit::setupAudioUnit):
1501         (WebCore::CoreAudioSharedUnit::defaultOutputDevice):
1502
1503 2017-05-23  Said Abou-Hallawa  <sabouhallawa@apple.com>
1504
1505         [iOS] Speculative fix for a PLT regression
1506         <rdar://problem/32361890>
1507
1508         Unreviewed.
1509
1510         Make sure CGImageSourceGetTypeWithData() is called with a buffer which is
1511         32 bytes or more.
1512
1513         * platform/graphics/cg/ImageDecoderCG.cpp:
1514         (WebCore::ImageDecoder::ImageDecoder):
1515
1516 2017-05-22  Jiewen Tan  <jiewen_tan@apple.com>
1517
1518         [WebCrypto] Support RSA-PSS
1519         https://bugs.webkit.org/show_bug.cgi?id=170869
1520         <rdar://problem/31640672>
1521
1522         Reviewed by Brent Fulgham.
1523
1524         This patch implements RSA-PSS according to the spec: https://www.w3.org/TR/WebCryptoAPI/#rsa-pss.
1525         Supported operations include sign, verify, generateKey, importKey and exportKey.
1526
1527         Tests: crypto/subtle/rsa-pss-generate-export-key-jwk-sha1.html
1528                crypto/subtle/rsa-pss-generate-export-key-jwk-sha224.html
1529                crypto/subtle/rsa-pss-generate-export-key-jwk-sha256.html
1530                crypto/subtle/rsa-pss-generate-export-key-jwk-sha384.html
1531                crypto/subtle/rsa-pss-generate-export-key-jwk-sha512.html
1532                crypto/subtle/rsa-pss-generate-export-key-pkcs8.html
1533                crypto/subtle/rsa-pss-generate-export-key-spki.html
1534                crypto/subtle/rsa-pss-generate-key.html
1535                crypto/subtle/rsa-pss-import-jwk-private-key.html
1536                crypto/subtle/rsa-pss-import-jwk-public-key-empty-usages.html
1537                crypto/subtle/rsa-pss-import-jwk-public-key-sha1.html
1538                crypto/subtle/rsa-pss-import-jwk-public-key-sha224.html
1539                crypto/subtle/rsa-pss-import-jwk-public-key-sha256.html
1540                crypto/subtle/rsa-pss-import-jwk-public-key-sha384.html
1541                crypto/subtle/rsa-pss-import-jwk-public-key-sha512.html
1542                crypto/subtle/rsa-pss-import-key-sign-large-salt.html
1543                crypto/subtle/rsa-pss-import-key-sign.html
1544                crypto/subtle/rsa-pss-import-key-verify.html
1545                crypto/subtle/rsa-pss-import-pkcs8-key.html
1546                crypto/subtle/rsa-pss-import-spki-key-empty-usages.html
1547                crypto/subtle/rsa-pss-import-spki-key.html
1548                crypto/workers/subtle/rsa-pss-import-key-sign.html
1549                crypto/workers/subtle/rsa-pss-import-key-verify.html
1550
1551         * CMakeLists.txt:
1552         * DerivedSources.make:
1553         * PlatformGTK.cmake:
1554         * WebCore.xcodeproj/project.pbxproj:
1555         * bindings/js/JSSubtleCryptoCustom.cpp:
1556         (WebCore::normalizeCryptoAlgorithmParameters):
1557         * crypto/CryptoAlgorithmParameters.h:
1558         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp: Added.
1559         (WebCore::CryptoAlgorithmRSA_PSS::create):
1560         (WebCore::CryptoAlgorithmRSA_PSS::identifier):
1561         (WebCore::CryptoAlgorithmRSA_PSS::sign):
1562         (WebCore::CryptoAlgorithmRSA_PSS::verify):
1563         (WebCore::CryptoAlgorithmRSA_PSS::generateKey):
1564         (WebCore::CryptoAlgorithmRSA_PSS::importKey):
1565         (WebCore::CryptoAlgorithmRSA_PSS::exportKey):
1566         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h: Added.
1567         * crypto/mac/CryptoAlgorithmECDSAMac.cpp:
1568         (WebCore::cryptoDigestAlgorithm): Deleted.
1569         Extract function cryptoDigestAlgorithm to a separate file.
1570         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
1571         (WebCore::cryptoDigestAlgorithm): Deleted.
1572         Extract function cryptoDigestAlgorithm to a separate file.
1573         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp: Added.
1574         (WebCore::signRSA_PSS):
1575         (WebCore::verifyRSA_PSS):
1576         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
1577         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
1578         * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
1579         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
1580         * crypto/mac/CryptoDigestAlgorithm.h: Added.
1581         (WebCore::cryptoDigestAlgorithm):
1582         Have cryptoDigestAlgorithm in a separate file.
1583         * crypto/parameters/CryptoAlgorithmRsaPssParams.h: Added.
1584         * crypto/parameters/RsaPssParams.idl: Added.
1585
1586 2017-05-23  Eric Carlson  <eric.carlson@apple.com>
1587
1588         [MediaStream] Allow transition from autoplay to play when a capture stream begins.
1589         https://bugs.webkit.org/show_bug.cgi?id=172391
1590         <rdar://problem/32304934>
1591
1592         Reviewed by Youenn Fablet.
1593
1594         Manual testing. Regression testing to be added as a follow-up.
1595
1596         * dom/Document.cpp:
1597         (WebCore::Document::updateIsPlayingMedia): Call mediaStreamCaptureStateChanged when capture
1598         state changes.
1599         (WebCore::Document::registerForMediaStreamStateChangeCallbacks):
1600         (WebCore::Document::unregisterForMediaStreamStateChangeCallbacks):
1601         (WebCore::Document::mediaStreamCaptureStateChanged): Call all registered elements.
1602         * dom/Document.h:
1603         * html/HTMLMediaElement.cpp:
1604         (WebCore::HTMLMediaElement::registerWithDocument): Register for capture state changes.
1605         (WebCore::HTMLMediaElement::unregisterWithDocument): Unregister for capture state changes.
1606         (WebCore::HTMLMediaElement::mediaStreamCaptureStateChanged): Attempt autoplay as necessary.
1607         * html/HTMLMediaElement.h:
1608
1609 2017-05-15  Matt Rajca  <mrajca@apple.com>
1610
1611         Replace autoplay events that fire at navigation with a DidAutoplayMediaPastThreshold event.
1612         https://bugs.webkit.org/show_bug.cgi?id=172138
1613
1614         Reviewed by Alex Christensen.
1615
1616         The current autoplay signals that are fired at navigation may not get delivered to the UIProcess if the WebPage is close()'ed around
1617         this time. This patch simplifies this and just notifies clients if a media element has played past a threshold.
1618
1619         Updated API tests.
1620
1621         * html/HTMLMediaElement.cpp:
1622         (WebCore::HTMLMediaElement::playbackProgressTimerFired):
1623         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
1624         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
1625         (WebCore::HTMLMediaElement::userDidInterfereWithAutoplay):
1626         * page/AutoplayEvent.h:
1627
1628 2017-05-23  Dean Jackson  <dino@apple.com>
1629
1630         checkGPUStatus needs to exercise instancing calls
1631         https://bugs.webkit.org/show_bug.cgi?id=172520
1632         <rdar://problem/23118395>
1633
1634         Reviewed by Brent Fulgham.
1635
1636         The checkGPUStatus method (formerly checkGPUStatusIfNecessary) was
1637         not being called after the drawArrays/Elements instancing calls.
1638
1639         I also added a test case to exercise the recovery logic.
1640
1641         Test: fast/canvas/webgl/lose-context-on-status-failure.html
1642
1643         * html/canvas/WebGLRenderingContextBase.cpp:
1644         (WebCore::WebGLRenderingContextBase::setFailNextGPUStatusCheck): Force
1645         the next checkGPUStatus on the GC3D to fail.
1646         * html/canvas/WebGLRenderingContextBase.h:
1647         * platform/graphics/GraphicsContext3D.h: Rename a function, and make
1648         the number of calls we wait before checking per instance, rather than
1649         static (which might have meant we're only ever checking after one canvas on
1650         a page with multiple contexts).
1651         (WebCore::GraphicsContext3D::setFailNextGPUStatusCheck):
1652         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
1653         (WebCore::GraphicsContext3D::checkGPUStatus): Renamed.
1654         (WebCore::GraphicsContext3D::checkGPUStatusIfNecessary): Deleted.
1655         * platform/graphics/mac/GraphicsContext3DMac.mm:
1656         (WebCore::GraphicsContext3D::checkGPUStatus): Improve the logic.
1657         (WebCore::GraphicsContext3D::checkGPUStatusIfNecessary): Deleted.
1658         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1659         (WebCore::GraphicsContext3D::clear):
1660         (WebCore::GraphicsContext3D::drawArrays):
1661         (WebCore::GraphicsContext3D::drawElements):
1662         (WebCore::GraphicsContext3D::drawArraysInstanced): Add a call to checkGPUStatus.
1663         (WebCore::GraphicsContext3D::drawElementsInstanced): Ditto.
1664         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
1665         (WebCore::GraphicsContext3D::checkGPUStatus):
1666         (WebCore::GraphicsContext3D::checkGPUStatusIfNecessary): Deleted.
1667         * testing/Internals.cpp: Implement the internal call to cause the next
1668         check to fail.
1669         (WebCore::Internals::failNextGPUStatusCheck):
1670         * testing/Internals.h:
1671         * testing/Internals.idl:
1672
1673 2017-05-23  Sam Weinig  <sam@webkit.org>
1674
1675         [WebIDL] Further cleanup enumeration handling
1676         https://bugs.webkit.org/show_bug.cgi?id=172516
1677
1678         Reviewed by Chris Dumez.
1679
1680         * bindings/scripts/CodeGeneratorJS.pm:
1681         (GeneratePut):
1682         (GeneratePutByIndex):
1683         (GenerateDictionaryImplementationContent):
1684         (GenerateParametersCheck):
1685         (GenerateCallbackImplementationContent):
1686         Update now that JSValueToNative doesn't have a second return value.
1687
1688         (GenerateImplementation):
1689         Add enumeration special casing to attribute setting code, where it is special
1690         cased in the standard
1691
1692         (PassArgumentExpression):
1693         Stop special casing enumerations.
1694         
1695         (IsValidContextForJSValueToNative):
1696         Assert that enums are never passed to JSValueToNative in an attribute context.
1697
1698         (JSValueToNative):
1699         Remove enumeration special case and second return value (which was always 1).
1700
1701         * bindings/scripts/test/JS/JSTestObj.cpp:
1702         (WebCore::setJSTestObjEnumAttrFunction):
1703         (WebCore::setJSTestObjImplementationEnumAttrFunction):
1704         (WebCore::setJSTestObjAttributeWithReservedEnumTypeFunction):
1705         Update results.
1706
1707 2017-05-22  Simon Fraser  <simon.fraser@apple.com>
1708
1709         Snapshotting via -renderInContext: should do synchronous image decodes
1710         https://bugs.webkit.org/show_bug.cgi?id=172485
1711         rdar://problem/32276146
1712
1713         Reviewed by Tim Horton.
1714
1715         When UIWebView clients snapshot the view via -renderInContext: on the UIView's layer,
1716         WebKit should do synchronous image decodes so that the images show in the snapshot.
1717
1718         Fix by plumbing through a "snapshotting" paint behavior flag from two source locations:
1719         WebSimpleLayer, used by compositing layers, and LegacyTileLayer, used for the WK1 tile cache.
1720         On WebSimpleLayer the flag propagates through PlatformCALayer to GraphicsLayer, and on LegacyTileLayer
1721         it sets some state on the WAKWindow, which is detected by -[WebFrame _paintBehaviorForDestinationContext:].
1722         In both cases, the flag becomes PaintBehaviorSnapshotting which is passed down through painting
1723         in PaintInfo.paintBehavior.
1724
1725         Fix code that was checking paintBehavior on the FrameView to just looking at PaintInfo.paintBehavior,
1726         which required passing PaintInfo along in RenderImage::paintIntoRect().
1727
1728         We can't just use the PaintBehaviorFlattenCompositingLayers flag, because that triggers
1729         a flattening paint of compositing layers, and we don't want that behavior for -renderInContext:,
1730         since CoreAnimation calls -renderInContext: on each of our layers and we need to avoid double-painting.
1731         So PaintBehaviorSnapshotting is now added to the call sites that also set PaintBehaviorFlattenCompositingLayers
1732         in most cases.
1733
1734         Tested by SnapshotViaRenderInContext API test.
1735
1736         * html/shadow/MediaControlElements.cpp:
1737         (WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
1738         * page/FrameView.cpp:
1739         (WebCore::FrameView::willPaintContents):
1740         (WebCore::FrameView::paintContentsForSnapshot):
1741         * page/PageOverlayController.cpp:
1742         (WebCore::PageOverlayController::paintContents):
1743         * page/PageOverlayController.h:
1744         * page/mac/ServicesOverlayController.h:
1745         * page/mac/ServicesOverlayController.mm:
1746         (WebCore::ServicesOverlayController::Highlight::paintContents):
1747         * platform/graphics/GraphicsLayer.cpp:
1748         (WebCore::GraphicsLayer::paintGraphicsLayerContents):
1749         * platform/graphics/GraphicsLayer.h:
1750         * platform/graphics/GraphicsLayerClient.h:
1751         (WebCore::GraphicsLayerClient::paintContents):
1752         * platform/graphics/ca/GraphicsLayerCA.cpp:
1753         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
1754         (WebCore::GraphicsLayerCA::platformCALayerPaintContents):
1755         * platform/graphics/ca/GraphicsLayerCA.h:
1756         * platform/graphics/ca/PlatformCALayer.h:
1757         * platform/graphics/ca/PlatformCALayerClient.h:
1758         * platform/graphics/ca/TileCoverageMap.cpp:
1759         (WebCore::TileCoverageMap::platformCALayerPaintContents):
1760         * platform/graphics/ca/TileCoverageMap.h:
1761         * platform/graphics/ca/TileGrid.cpp:
1762         (WebCore::TileGrid::platformCALayerPaintContents):
1763         * platform/graphics/ca/TileGrid.h:
1764         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
1765         (PlatformCALayer::drawLayerContents):
1766         * platform/graphics/mac/WebLayer.mm:
1767         (-[WebLayer drawInContext:]):
1768         (-[WebSimpleLayer renderInContext:]):
1769         (-[WebSimpleLayer drawInContext:]):
1770         * platform/ios/LegacyTileCache.h: Use initializers.
1771         * platform/ios/LegacyTileCache.mm:
1772         (WebCore::LegacyTileCache::LegacyTileCache):
1773         (WebCore::LegacyTileCache::drawWindowContent):
1774         (WebCore::LegacyTileCache::drawLayer):
1775         * platform/ios/LegacyTileLayer.h:
1776         * platform/ios/LegacyTileLayer.mm:
1777         (-[LegacyTileHostLayer renderInContext:]):
1778         (-[LegacyTileLayer renderInContext:]):
1779         (-[LegacyTileLayer drawInContext:]):
1780         (+[LegacyTileLayer layerBeingPainted]): Deleted. There were no callers.
1781         * platform/ios/wak/WAKView.mm:
1782         (-[WAKView _drawRect:context:lockFocus:]): bool -> BOOL
1783         * platform/ios/wak/WAKWindow.h:
1784         * platform/ios/wak/WAKWindow.mm:
1785         (-[WAKWindow setIsInSnapshottingPaint:]):
1786         (-[WAKWindow isInSnapshottingPaint]):
1787         * rendering/PaintPhase.h:
1788         * rendering/RenderBox.cpp:
1789         (WebCore::RenderBox::paintMaskImages):
1790         * rendering/RenderBoxModelObject.cpp:
1791         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
1792         * rendering/RenderImage.cpp:
1793         (WebCore::RenderImage::paintReplaced):
1794         (WebCore::RenderImage::paintIntoRect):
1795         * rendering/RenderImage.h:
1796         * rendering/RenderLayer.cpp:
1797         (WebCore::RenderLayer::paintLayerContents):
1798         (WebCore::RenderLayer::paintForegroundForFragments):
1799         * rendering/RenderLayerBacking.cpp:
1800         (WebCore::RenderLayerBacking::paintContents):
1801         * rendering/RenderLayerBacking.h:
1802         * rendering/RenderLayerCompositor.cpp:
1803         (WebCore::RenderLayerCompositor::paintContents):
1804         * rendering/RenderLayerCompositor.h:
1805         * rendering/RenderVideo.cpp:
1806         (WebCore::RenderVideo::paintReplaced):
1807
1808 2017-05-23  Myles C. Maxfield  <mmaxfield@apple.com>
1809
1810         Remove dead ENABLE(FONT_LOAD_EVENTS) code
1811         https://bugs.webkit.org/show_bug.cgi?id=172517
1812
1813         Rubber-stamped by Simon Fraser.
1814
1815         No new tests because there is no behavior change.
1816
1817         * CMakeLists.txt:
1818         * Configurations/FeatureDefines.xcconfig:
1819         * DerivedSources.cpp:
1820         * DerivedSources.make:
1821         * WebCore.xcodeproj/project.pbxproj:
1822         * css/CSSAllInOne.cpp:
1823         * css/CSSFontFaceLoadEvent.cpp: Removed.
1824         * css/CSSFontFaceLoadEvent.h: Removed.
1825         * css/CSSFontFaceLoadEvent.idl: Removed.
1826         * dom/EventNames.in:
1827         * page/FrameView.cpp:
1828         (WebCore::FrameView::performPostLayoutTasks):
1829         * page/RuntimeEnabledFeatures.h:
1830         (WebCore::RuntimeEnabledFeatures::setFontLoadEventsEnabled): Deleted.
1831         (WebCore::RuntimeEnabledFeatures::fontLoadEventsEnabled): Deleted.
1832
1833 2017-05-23  Chris Dumez  <cdumez@apple.com>
1834
1835         Unreviewed, roll out r215229
1836
1837         It caused CachedScripts in MemoryCache to be reused with different encodings
1838         even though CachedScript potentially has already decoded data or cached hash
1839         with a previous encoding.
1840
1841         * loader/TextResourceDecoder.cpp:
1842         (WebCore::TextResourceDecoder::setEncoding):
1843         * loader/TextResourceDecoder.h:
1844         (WebCore::TextResourceDecoder::sawError):
1845         (WebCore::TextResourceDecoder::encodingSet): Deleted.
1846         * loader/cache/CachedCSSStyleSheet.cpp:
1847         (WebCore::CachedCSSStyleSheet::setEncoding):
1848         * loader/cache/CachedResource.cpp:
1849         (WebCore::CachedResource::CachedResource):
1850         * loader/cache/CachedResource.h:
1851         (WebCore::CachedResource::hasUnknownEncoding):
1852         (WebCore::CachedResource::setHasUnknownEncoding):
1853         * loader/cache/CachedResourceLoader.cpp:
1854         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
1855
1856 2017-05-23  Zalan Bujtas  <zalan@apple.com>
1857
1858         ASSERTION FAILED: !renderer().view().needsLayout() while running media/video-main-content-autoplay.html
1859         https://bugs.webkit.org/show_bug.cgi?id=172476
1860
1861         Reviewed by Simon Fraser.
1862
1863         This patch decouples the layout call logic from the post layout task timer setup.
1864         Just because we are switching over to asynchronous performPostLayoutTasks() it should not stop us from
1865         running layout on a dirty tree (we could encounter a forced layout (which sets m_postLayoutTasksTimer active)
1866         and a subsequent tree mutation during performPostLayoutTasks()). 
1867
1868         There are a few different ways to end up here:
1869         root layout is done -> call performPostLayoutTasks() synchronously -> 
1870         1. tree stays clean -> no action needed.
1871         2. tree gets dirty -> setup performPostLayoutTasks timer -> run nested layout -> since m_postLayoutTasksTimer is active()
1872         we don't try to run performPostLayoutTasks() while in the nested layout and we return with a clean tree.         
1873
1874         * page/FrameView.cpp:
1875         (WebCore::FrameView::layout):
1876
1877 2017-05-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1878
1879         Multiple links should be inserted separately when performing data interaction
1880         https://bugs.webkit.org/show_bug.cgi?id=172489
1881         <rdar://problem/31510832>
1882
1883         Reviewed by Dan Bernstein.
1884
1885         In WebContentReader, URLs are currently always inserted inline. When inserting multiple items, this causes
1886         adjacent links to be inserted on a single line with no break, which is undesirable. To address this, when
1887         appending links from additional items to the existing document fragment in WebContentReader, insert a new space
1888         prior to inserting the anchor element.
1889
1890         New unit test: DataInteractionTests.ExternalSourceMultipleURLsToContentEditable
1891
1892         * editing/ios/EditorIOS.mm:
1893         (WebCore::Editor::WebContentReader::addFragment):
1894
1895         Tweak to add all children of the new fragment, rather than just the first child.
1896
1897         (WebCore::Editor::WebContentReader::readURL):
1898
1899 2017-05-23  Sam Weinig  <sam@webkit.org>
1900
1901         [WebIDL] Remove some unnecessary specialization for enum types
1902         https://bugs.webkit.org/show_bug.cgi?id=172482
1903
1904         Reviewed by Chris Dumez.
1905
1906         - Removes convertEnumeration template function and generated specialization.
1907           convert<IDLEnumeration<T>> now does the entire check, and can have specialized
1908           exceptions.
1909         - Treats enums more like all other types, removing enum specific code in the
1910           generator.
1911
1912         Also fixes some order of exception bugs as the convertEnumeration<T> implementations
1913         were not correctly catching exceptions thrown in parseEnumeration<T>.
1914
1915         * bindings/js/JSDOMConvertEnumeration.h:
1916         (WebCore::Converter<IDLEnumeration<T>>::convert):
1917         Remove convertEnumeration and move implementation to convert. Add ExceptionThrower
1918         parameter to retain argument conversion exception specialization and allow future
1919         specialization for other contexts.
1920
1921         * bindings/js/JSSubtleCryptoCustom.cpp:
1922         (WebCore::jsSubtleCryptoFunctionImportKeyPromise):
1923         (WebCore::jsSubtleCryptoFunctionExportKeyPromise):
1924         (WebCore::jsSubtleCryptoFunctionWrapKeyPromise):
1925         (WebCore::jsSubtleCryptoFunctionUnwrapKeyPromise):
1926         Switch from convertEnumeration<T> to convert<IDLEnumeration<T>>.
1927
1928         * bindings/scripts/CodeGeneratorJS.pm:
1929         (GetArgumentExceptionFunction):
1930         Add (really move from GenerateParametersCheck) enum specific argument conversion exception.
1931
1932         (PassArgumentExpression):
1933         Allow the enum specific code for attributes to remain by explicitly checking the context.
1934         Attribute setters use parseEnumeration<T> explicitly, as WebIDL mandates slightly different
1935         behavior, specially that they don't throw.
1936
1937         (GenerateEnumerationImplementationContent):
1938         (GenerateEnumerationHeaderContent):
1939         Remove convertEnumeration<T>.
1940
1941         (GenerateParametersCheck):
1942         Remove entire branch devoted to enums. The main parameter check is now mature enough
1943         to handle them.
1944
1945         (JSValueToNative):
1946         Like in PassArgumentExpression, we need to retain the specialize behavior for attributes.
1947         Before, JSValueToNative was only called for enums with a context of IDLAttribute or IDLDictionaryMember,
1948         but now that we use if IDLArguments as well, it makes more sense to make this check in terms
1949         of the odd man out, IDLAttribute.
1950
1951         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
1952         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
1953         * bindings/scripts/test/JS/JSTestObj.cpp:
1954         * bindings/scripts/test/JS/JSTestObj.h:
1955         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
1956         * bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
1957         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp:
1958         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.h:
1959         Update test results.
1960
1961 2017-05-23  Romain Bellessort  <romain.bellessort@crf.canon.fr>
1962
1963         [Readable Streams API] Align respondInClosedState with spec
1964         https://bugs.webkit.org/show_bug.cgi?id=172288
1965
1966         Reviewed by Chris Dumez.
1967
1968         Two changes are implemented in this patch:
1969         - Change #1: An issue was reported to GH [1] while working on respondInClosedState 
1970         implementation. This issue has now been fixed, and this patch aligns implementation 
1971         with spec [2].
1972         - Change #2: In addition, this patch also fixes a bug that went unnoticed as code 
1973         is not yet reachable (usage of controller.@reader is not valid and is therefore 
1974         replaced by controller.@controlledReadableStream.@reader).
1975
1976         [1] https://github.com/whatwg/streams/issues/686
1977         [2] https://streams.spec.whatwg.org/#readable-byte-stream-controller-respond-in-closed-state
1978
1979         No added test as:
1980         - Change #1 does not change behavior;
1981         - Change #2 is not testable as the code is not yet reachable.
1982
1983         * Modules/streams/ReadableByteStreamInternals.js:
1984         (readableByteStreamControllerRespondInClosedState): Aligned with spec.
1985
1986 2017-05-22 Emilio Cobos Álvarez  <ecobos@igalia.com>
1987
1988         Add a RuntimeEnabledFeature for display: contents, defaulted to false.
1989         https://bugs.webkit.org/show_bug.cgi?id=171984
1990
1991         Reviewed by Antti Koivisto.
1992
1993         The "defaulted to false" is not only because there are spec issues,
1994         but because I ran the WPT suite, and there was a fair amount of
1995         crashes and messed render trees.
1996
1997         Tests: imported/w3c/web-platform-tests/innerText/getter.html
1998
1999         * css/StyleResolver.cpp:
2000         (WebCore::StyleResolver::adjustRenderStyle):
2001         * page/RuntimeEnabledFeatures.h:
2002         (WebCore::RuntimeEnabledFeatures::setDisplayContentsEnabled):
2003         (WebCore::RuntimeEnabledFeatures::displayContentsEnabled):
2004
2005 2017-05-22  Myles C. Maxfield  <mmaxfield@apple.com>
2006
2007         Update font-style's implementation in the font selection algorithm
2008         https://bugs.webkit.org/show_bug.cgi?id=169453
2009
2010         Reviewed by Simon Fraser.
2011
2012         Previously, we were treating "font-style: oblique" exactly the same as "font-style: italic".
2013         These values were parsed to the same internal data type. However, variation fonts may have two
2014         distinct axes: 'slnt' and 'ital'. Therefore, we need to keep a bool of state which represents
2015         which of these two axes we should be setting when we apply font variations. We can do this by
2016         making the "font-style" parser a "custom" parser. The implementation of these custom functions
2017         will set both the italic value on the FontDescription as well as this extra bool.
2018
2019         We don't, however, want to treat these values as distinct for the purposese of font selection.
2020         The fact that we treat oblique fonts the same as italic fonts is a feature, not a bug. Therefore,
2021         the font selection algorithm is not made aware of this distinction. This is why we don't want to
2022         package up the bool and FontSelectionValue into a class: font selection only cares about the
2023         FontSelectionValue, so conceptually they shouldn't be joined. (The FontSelectionValue already
2024         exists within a collection of all the things font selection needs to know about.)
2025
2026         Now that there is this extra bit of state on the FontDescription, we can do a little better when
2027         computing the result of getComputedStyle(). Previously, we were always returning "italic" even
2028         when "oblique" was specified. Now, we can return the correct one. However, this extra bit of
2029         state is not kept on the CSSFontFace (because it doesn't need to be), which means we can only
2030         improve the computed style of an element, rather than the cssText of an @font-face rule.
2031
2032         Test: fast/text/font-style-parse.html
2033
2034         * css/CSSComputedStyleDeclaration.cpp:
2035         (WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
2036         (WebCore::fontStyleFromStyle):
2037         (WebCore::fontShorthandValueForSelectionProperties):
2038         * css/CSSComputedStyleDeclaration.h:
2039         * css/CSSFontFaceSet.h:
2040         * css/CSSProperties.json:
2041         * css/FontFace.cpp:
2042         (WebCore::FontFace::style):
2043         * css/FontSelectionValueInlines.h:
2044         (WebCore::fontStyleKeyword):
2045         * css/StyleBuilderConverter.h:
2046         (WebCore::StyleBuilderConverter::convertFontStyle): Deleted.
2047         * css/StyleBuilderCustom.h:
2048         (WebCore::StyleBuilderCustom::applyInitialFontStyle):
2049         (WebCore::StyleBuilderCustom::applyInheritFontStyle):
2050         (WebCore::StyleBuilderCustom::applyValueFontStyle):
2051         * platform/graphics/FontCache.h:
2052         (WebCore::FontDescriptionKey::makeFlagsKey):
2053         * platform/graphics/FontDescription.cpp:
2054         (WebCore::FontDescription::FontDescription):
2055         * platform/graphics/FontDescription.h:
2056         (WebCore::FontDescription::shouldUseItalicVariationAxis):
2057         (WebCore::FontDescription::setShouldUseItalicVariationAxis):
2058         (WebCore::FontDescription::operator==):
2059         (WebCore::FontCascadeDescription::initialShouldUseItalicVariationAxis):
2060         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2061         (WebCore::preparePlatformFont):
2062         (WebCore::fontWithFamily):
2063         (WebCore::FontCache::createFontPlatformData):
2064         (WebCore::FontCache::systemFallbackForCharacters):
2065         * platform/graphics/mac/FontCustomPlatformData.cpp:
2066         (WebCore::FontCustomPlatformData::fontPlatformData):
2067
2068 2017-05-22  Myles C. Maxfield  <mmaxfield@apple.com>
2069
2070         Support calc() in font-variation-settings and font-feature-settings
2071         https://bugs.webkit.org/show_bug.cgi?id=171032
2072
2073         Reviewed by David Hyatt.
2074
2075         Tests: css3/font-feature-settings-calc.html
2076                fast/text/variations/calc.html
2077
2078         We can use the convenience functions in CSSPropertyParserHelpers.cpp.
2079
2080         * css/parser/CSSPropertyParser.cpp:
2081         (WebCore::consumeFontFeatureTag):
2082         (WebCore::consumeFontVariationTag):
2083
2084 2017-05-22  Michael Catanzaro  <mcatanzaro@igalia.com>
2085
2086         Unreviewed, attempt to fix test runner by removing Unicode character from stderr output
2087         https://bugs.webkit.org/show_bug.cgi?id=168409
2088
2089         * page/Page.cpp:
2090         (WebCore::Page::suspendScriptedAnimations):
2091
2092 2017-05-22  Said Abou-Hallawa  <sabouhallawa@apple.com>
2093
2094         Avoid moving to the second frame of an animated image before the first frame has finished decoding
2095         https://bugs.webkit.org/show_bug.cgi?id=172461
2096
2097         Reviewed by Simon Fraser.
2098
2099         Sometimes the frameCount of an animated image gets changed when more data
2100         is received. The problem is we may start decoding the image as if it were
2101         a static large image and the decoding of this first frame finishes after 
2102         the image starts animating.
2103
2104         * platform/graphics/BitmapImage.cpp:
2105         (WebCore::BitmapImage::draw):
2106         (WebCore::BitmapImage::imageFrameAvailableAtIndex):
2107
2108 2017-05-20  Alex Christensen  <achristensen@webkit.org>
2109
2110         REGRESSION(r215686): O(n^2) algorithm in CachedRawResource::addDataBuffer
2111         https://bugs.webkit.org/show_bug.cgi?id=172406
2112         <rdar://32109532>
2113
2114         Reviewed by Brady Eidson.
2115
2116         CachedRawResource::calculateIncrementalDataChunk was calling SharedBuffer::data each time the data
2117         was appended to the SharedBuffer. This causes the data to be copied from two segments to one segment,
2118         which causes the O(n^2) behavior I was worried about in r215686. These append/data/append/data calls
2119         used to cause O(1) copies per byte which was amortized because of the exponential growth of the buffer.
2120         After this change, there should be 0 copies per byte here, and instead a O(log(n)) binary search in the
2121         call to std::upper_bound to find the next segment of data with a given starting location in the SharedBuffer.
2122         We need to store the additional information of the offsets of the beginnings of the segments in a
2123         SharedBuffer. This doesn't asymptotically increase our memory usage, but it does allow us to asymptotically
2124         decrease the amount of time it takes to find data at a given offset in a SharedBuffer from O(n) to O(log(n)).
2125
2126         This allows us to complete http://speedtest.xfinity.com and new functionality in SharedBuffer is covered by API tests.
2127
2128         * loader/TextTrackLoader.cpp:
2129         (WebCore::TextTrackLoader::processNewCueData):
2130         * loader/cache/CachedRawResource.cpp:
2131         (WebCore::CachedRawResource::calculateIncrementalDataChunk):
2132         (WebCore::CachedRawResource::addDataBuffer):
2133         (WebCore::CachedRawResource::finishLoading):
2134         * loader/cache/CachedRawResource.h:
2135         * platform/SharedBuffer.cpp:
2136         (WebCore::SharedBuffer::SharedBuffer):
2137         (WebCore::SharedBuffer::combineIntoOneSegment):
2138         (WebCore::SharedBuffer::data):
2139         (WebCore::SharedBuffer::getSomeData):
2140         (WebCore::SharedBuffer::tryCreateArrayBuffer):
2141         (WebCore::SharedBuffer::append):
2142         (WebCore::SharedBuffer::clear):
2143         (WebCore::SharedBuffer::copy):
2144         (WebCore::SharedBuffer::internallyConsistent):
2145         (WebCore::SharedBuffer::hintMemoryNotNeededSoon):
2146         (WebCore::SharedBufferDataView::SharedBufferDataView):
2147         (WebCore::SharedBufferDataView::size):
2148         (WebCore::SharedBufferDataView::data):
2149         * platform/SharedBuffer.h:
2150         * platform/cf/SharedBufferCF.cpp:
2151         (WebCore::SharedBuffer::createCFData):
2152         (WebCore::SharedBuffer::hintMemoryNotNeededSoon):
2153         (WebCore::SharedBuffer::append):
2154         * platform/cocoa/SharedBufferCocoa.mm:
2155         (WebCore::SharedBuffer::createNSData):
2156         (WebCore::SharedBuffer::createCFData):
2157         (WebCore::SharedBuffer::createNSDataArray):
2158
2159 2017-05-22  Chris Dumez  <cdumez@apple.com>
2160
2161         Resources in cached parsed stylesheets may bypass content blockers
2162         https://bugs.webkit.org/show_bug.cgi?id=172468
2163         <rdar://problem/31972693>
2164
2165         Reviewed by Geoffrey Garen.
2166
2167         Resources in cached parsed stylesheets could bypass content blockers when they were in the memory cache and
2168         they did not need revalidation.
2169
2170         To address the issue, I made StyleSheetContents::subresourcesAllowReuse() to check content blockers.
2171         If a subresource in the cached stylesheet is blocked, then we return false in subresourcesAllowReuse() and
2172         the cached parsed stylesheet will not be used.
2173
2174         No new tests, not currently testable.
2175
2176         * css/StyleSheetContents.cpp:
2177         (WebCore::StyleSheetContents::subresourcesAllowReuse):
2178         * css/StyleSheetContents.h:
2179         * html/HTMLLinkElement.cpp:
2180         (WebCore::HTMLLinkElement::setCSSStyleSheet):
2181         * loader/cache/CachedCSSStyleSheet.cpp:
2182         (WebCore::CachedCSSStyleSheet::restoreParsedStyleSheet):
2183         * loader/cache/CachedCSSStyleSheet.h:
2184
2185 2017-05-22  Chris Dumez  <cdumez@apple.com>
2186
2187         ASSERTION FAILED: tokens.find(item) == notFound in WebCore::DOMTokenList::replace
2188         https://bugs.webkit.org/show_bug.cgi?id=172473
2189
2190         Reviewed by Ryosuke Niwa.
2191
2192         Fix bad assertion in DOMTokenList::replace(). If item == replacement, then the
2193         assertion was wrong.
2194
2195         No new tests, unskipped existing test.
2196
2197         * html/DOMTokenList.cpp:
2198         (WebCore::DOMTokenList::replace):
2199
2200 2017-05-22  Youenn Fablet  <youenn@apple.com>
2201
2202         Remove AVAudioCaptureSource
2203         https://bugs.webkit.org/show_bug.cgi?id=172360
2204
2205         Reviewed by Sam Weinig.
2206
2207         No change of behavior, this class is no longer used by default as it does not support echo cancellation.
2208
2209         * WebCore.xcodeproj/project.pbxproj:
2210         * page/Settings.cpp:
2211         (WebCore::Settings::setMediaCaptureRequiresSecureConnection):
2212         (WebCore::Settings::useAVFoundationAudioCapture): Deleted.
2213         (WebCore::Settings::setUseAVFoundationAudioCapture): Deleted.
2214         * page/Settings.h:
2215         * platform/mediastream/mac/AVAudioCaptureSource.h: Removed.
2216         * platform/mediastream/mac/AVAudioCaptureSource.mm: Removed.
2217         * platform/mediastream/mac/AVCaptureDeviceManager.h:
2218         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
2219         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2220         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory):
2221         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioCaptureDeviceManager):
2222         (WebCore::RealtimeMediaSourceCenterMac::setUseAVFoundationAudioCapture): Deleted.
2223         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
2224
2225 2017-05-22  Brian Burg  <bburg@apple.com>
2226
2227         Web Inspector: webkit reload policy should match default behavior
2228         https://bugs.webkit.org/show_bug.cgi?id=171385
2229         <rdar://problem/31871515>
2230
2231         Reviewed by Joseph Pecoraro.
2232
2233         Add an option to PageAgent.reload that tells the backend to use the old
2234         behavior that revalidates unexpired cached subresources. This used by tests.
2235
2236         Covered by existing network/memory/disk cache tests.
2237
2238         * inspector/InspectorPageAgent.h:
2239         * inspector/InspectorPageAgent.cpp:
2240         (WebCore::InspectorPageAgent::reload):
2241
2242 2017-05-22  Yoav Weiss  <yoav@yoav.ws>
2243
2244         [preload] Add media and type attribute support.
2245         https://bugs.webkit.org/show_bug.cgi?id=171720
2246
2247         Reviewed by Youenn Fablet.
2248
2249         Tests: http/wpt/preload/media-attribute.html
2250                http/wpt/preload/type-attribute.html
2251                http/tests/preload/viewport/meta-viewport-link-headers.php
2252
2253         * css/MediaQueryEvaluator.cpp: Move the mediaAttributeMatches code from HTMLResourcePreloader to a central location.
2254         (WebCore::MediaQueryEvaluator::mediaAttributeMatches):
2255         * css/MediaQueryEvaluator.h:
2256         * html/HTMLImageElement.cpp:
2257         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement): Use isSupportedImageOrSVGMIMEType() instead of checking SVG MIME type specifically.
2258         * html/HTMLLinkElement.cpp:
2259         (WebCore::HTMLLinkElement::process): Call loadLink() with the media and type attributes.
2260         * html/parser/HTMLDocumentParser.cpp:
2261         (WebCore::HTMLDocumentParser::pumpTokenizer): Trigger Link header based preload for links that have the media attribute.
2262         * html/parser/HTMLPreloadScanner.cpp:
2263         (WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest): Avoid preloading link resources with non-matching type.
2264         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): Collect the type attribute for link resources.
2265         * html/parser/HTMLResourcePreloader.cpp:
2266         (WebCore::HTMLResourcePreloader::preload): Use MediaQueryEvaluator::mediaAttributeMatches instead of the local one.
2267         (WebCore::mediaAttributeMatches): Deleted.
2268         * loader/FrameLoader.cpp:
2269         (WebCore::FrameLoader::receivedFirstData): Indicate that only link preloads with no media attribute should be loaded here.
2270         * loader/LinkLoader.cpp:
2271         (WebCore::LinkLoader::loadLinksFromHeader): Load only links with or without media attributes, according to mode. Also send media and
2272         type attributes to preloadIfNeeded().
2273         (WebCore::LinkLoader::isSupportedType): Check if the MIME type is supported for the CachedResource::Type.
2274         (WebCore::LinkLoader::preloadIfNeeded): Get the media and type attributes and only trigger a preload if media matches and type is supported.
2275         (WebCore::LinkLoader::loadLink): Pass along the media and type attributes.
2276         * loader/LinkLoader.h:
2277         * platform/MIMETypeRegistry.cpp:
2278         (WebCore::MIMETypeRegistry::isSupportedImageOrSVGMIMEType): Check if MIME type is supported for an image, or is an SVG mime type.
2279         (WebCore::MIMETypeRegistry::isSupportedStyleSheetMIMEType): Check if MIME type is supported for a stylesheet.
2280         (WebCore::MIMETypeRegistry::isSupportedFontMIMEType): Check if MIME type is supported for a font.
2281         (WebCore::MIMETypeRegistry::isSupportedTextTrackMIMEType): Check if MIME type is supported for a text track.
2282         * platform/MIMETypeRegistry.h:
2283
2284 2017-05-22  Said Abou-Hallawa  <sabouhallawa@apple.com>
2285
2286         [CG] Use the SPI CGImageSourceGetTypeWithData() to get the typeIdentifierHint of an image
2287         https://bugs.webkit.org/show_bug.cgi?id=172405
2288
2289         Reviewed by Simon Fraser.
2290
2291         Use CGImageSourceGetTypeWithData() to get the typeIdentifierHint which will
2292         be passed to CGImageSourceCreateIncremental(). If data is insufficient to
2293         guess typeIdentifierHint, that means the image size is still not available.
2294         In this case, CachedImage::addIncrementalDataBuffer() will call error()
2295         which will call clear() which will call Image::destroyDecodedData()
2296         which will delete the current ImageDecoder and creates a new one. So we
2297         don't need to check the return value insufficientData.
2298
2299         * platform/graphics/DecodingOptions.h: Fix the header file dependencies.
2300         * platform/graphics/ImageSource.cpp:
2301         (WebCore::ImageSource::ensureDecoderAvailable): No need for the URL parameter.
2302         * platform/graphics/ImageTypes.h: Move a typedef from ImageDecoderCG.h to ImageTypes.h.
2303         * platform/graphics/cg/ImageDecoderCG.cpp:
2304         (WebCore::ImageDecoder::ImageDecoder): Pass the SharedBuffer data to the constructor.
2305         * platform/graphics/cg/ImageDecoderCG.h:
2306         (WebCore::ImageDecoder::create): No need for the URL argument.
2307         * platform/graphics/win/ImageDecoderDirect2D.h:
2308         (WebCore::ImageDecoder::create): Remove the URL argument from the function signature.
2309         * platform/image-decoders/ImageDecoder.cpp:
2310         (WebCore::ImageDecoder::create): Remove the URL argument from the function signature.
2311         * platform/image-decoders/ImageDecoder.h:
2312         * platform/spi/cg/ImageIOSPI.h: Add the prototype of CGImageSourceGetTypeWithData().
2313
2314 2017-05-22  Zalan Bujtas  <zalan@apple.com>
2315
2316         SameSizeAsInlineBox mismatch on ARMV7.
2317         https://bugs.webkit.org/show_bug.cgi?id=172459
2318
2319         Reviewed by Simon Fraser.
2320
2321         Due to the ARMV7/i386 padding behaviour mismatch, forcing m_bitfields to be 32bits does not always
2322         produce the desired padding.
2323         Move the bool to the end of the member list and let m_deletionSentinel (4bytes) force
2324         padding.
2325
2326         * rendering/InlineBox.cpp:
2327         * rendering/InlineBox.h:
2328
2329 2017-05-22  Myles C. Maxfield  <mmaxfield@apple.com>
2330
2331         Enable the woff2-variations @font-face format identifier
2332         https://bugs.webkit.org/show_bug.cgi?id=172425
2333
2334         Reviewed by Andreas Kling.
2335
2336         We support woff2, and woff-variations, but not woff2-variations.
2337         https://github.com/w3c/csswg-drafts/commit/5c914a8a0382734bd420090a89bc19b32e6c302d
2338
2339         Test: fast/text/variations/font-face-format-woff2.html
2340
2341         * platform/graphics/mac/FontCustomPlatformData.cpp:
2342         (WebCore::FontCustomPlatformData::supportsFormat):
2343
2344 2017-05-22  Antoine Quint  <graouts@apple.com>
2345
2346         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
2347         https://bugs.webkit.org/show_bug.cgi?id=168409
2348
2349         Reviewed by Simon Fraser.
2350
2351         Remove all the custom logging code we wrote to diagnose why this specific test failed and instead
2352         log the backtrace when the ScriptedAnimationController gets suspended, which should allow us to
2353         identify which test actually leads to suspension and affects this particular test.
2354
2355         * Modules/modern-media-controls/controls/scheduler.js:
2356         (const.scheduler.new.prototype.scheduleLayout):
2357         (const.scheduler.new.prototype.unscheduleLayout):
2358         (const.scheduler.new.prototype._requestFrameIfNeeded):
2359         (const.scheduler.new.prototype._frameDidFire):
2360         (const.scheduler.new.prototype._layout):
2361         * dom/Document.cpp:
2362         (WebCore::Document::requestAnimationFrame):
2363         * dom/ScriptedAnimationController.cpp:
2364         (WebCore::ScriptedAnimationController::suspend):
2365         (WebCore::ScriptedAnimationController::resume):
2366         (WebCore::ScriptedAnimationController::addThrottlingReason):
2367         (WebCore::ScriptedAnimationController::removeThrottlingReason):
2368         (WebCore::ScriptedAnimationController::registerCallback):
2369         (WebCore::ScriptedAnimationController::cancelCallback):
2370         (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
2371         (WebCore::ScriptedAnimationController::scheduleAnimation):
2372         (WebCore::ScriptedAnimationController::dispatchLoggingEventIfRequired): Deleted.
2373         * dom/ScriptedAnimationController.h:
2374         * page/Page.cpp:
2375         (WebCore::Page::suspendScriptedAnimations):
2376         * page/Settings.in:
2377         * testing/InternalSettings.cpp:
2378         (WebCore::InternalSettings::resetToConsistentState):
2379         (WebCore::InternalSettings::shouldDispatchRequestAnimationFrameEvents): Deleted.
2380         (WebCore::InternalSettings::setShouldDispatchRequestAnimationFrameEvents): Deleted.
2381         * testing/InternalSettings.h:
2382         * testing/InternalSettings.idl:
2383
2384 2017-05-22  Emilio Cobos Álvarez  <ecobos@igalia.com>
2385
2386         Don't unconditionally reset TextIterator::m_handledChildren for display: contents nodes.
2387         https://bugs.webkit.org/show_bug.cgi?id=172443
2388
2389         This avoids an infinite hang when enabling display: contents in bug 171984.
2390
2391         Reviewed by Antti Koivisto.
2392
2393         No new tests. Relanding bug 171984 will add test coverage for this.
2394
2395         * editing/TextIterator.cpp:
2396         (WebCore::hasDisplayContents):
2397         (WebCore::fullyClipsContents):
2398         (WebCore::TextIterator::advance):
2399
2400 2017-05-22  Sam Weinig  <sam@webkit.org>
2401
2402         [WebIDL] Support callbacks with arbitrary return types
2403         https://bugs.webkit.org/show_bug.cgi?id=172407
2404
2405         Reviewed by Chris Dumez.
2406
2407         - Adds and adopts CallbackResult<> template class that encapsulates a return value
2408           and status from a javascript callback.
2409         - Updates NodeIterator/TreeWalker to explicitly propagate exceptions thrown from
2410           a JSNodeFilter, rather than relying on the JSNodeFilter to catch them (seemingly
2411           accidentally).
2412
2413         * CMakeLists.txt:
2414         * WebCore.xcodeproj/project.pbxproj:
2415         * bindings/js/JSBindingsAllInOne.cpp:
2416         Update file lists.
2417
2418         * Modules/geolocation/PositionCallback.h:
2419         * Modules/geolocation/PositionErrorCallback.h:
2420         * Modules/notifications/NotificationPermissionCallback.h:
2421         * Modules/webaudio/AudioBufferCallback.h:
2422         * Modules/webdatabase/DatabaseCallback.h:
2423         * dom/RequestAnimationFrameCallback.h:
2424         * dom/StringCallback.h:
2425         * dom/Traversal.cpp:
2426         * fileapi/BlobCallback.h:
2427         * html/VoidCallback.h:
2428         * page/IntersectionObserverCallback.h:
2429         * page/PerformanceObserverCallback.h:
2430         * css/MediaQueryListListener.h:
2431         * Modules/webdatabase/SQLStatement.h:
2432         * Modules/webdatabase/SQLStatementCallback.h:
2433         * Modules/webdatabase/SQLStatementErrorCallback.h:
2434         * Modules/webdatabase/SQLTransaction.cpp:
2435         * Modules/webdatabase/SQLTransactionCallback.h:
2436         * Modules/webdatabase/SQLTransactionErrorCallback.h:
2437         * inspector/InspectorDatabaseAgent.cpp:
2438         Adopt CallbackResult.
2439
2440         * Modules/webdatabase/SQLStatementErrorCallback.idl:
2441         Remove Custom extended attribute annotation.
2442
2443         * Modules/webdatabase/SQLStatement.cpp:
2444         (WebCore::SQLStatement::performCallback):
2445         Adopt CallbackResult, migrating logic from JSSQLStatementErrorCallbackCustom
2446         into the implementation, by way of the status enum.
2447
2448         * bindings/IDLTypes.h:
2449         Add IDLVoid type.
2450
2451         * bindings/js/JSNodeFilterCustom.cpp: Removed.
2452         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp: Removed.
2453         Remove now unneeded custom bindings.
2454
2455         * bindings/scripts/CodeGeneratorJS.pm:
2456         (GenerateIndexedGetter):
2457         (GenerateNamedGetter):
2458         (GenerateImplementation):
2459         (GenerateImplementationFunctionCall):
2460         Update for new NativeToJSValue arguments.
2461
2462         (GenerateCallbackHeaderContent):
2463         (GenerateCallbackImplementationContent):
2464         Remove requirement of only void return types and update return type to use CallbackFunction.
2465         Also adds necessary conversion of return value.
2466
2467         (GetBaseIDLType):
2468         Add void IDL type mapping.
2469
2470         (IsValidContextForJSValueToNative):
2471         Add operation as valid context, as that is what the callback return type's context is.
2472
2473         (NativeToJSValueUsingReferences):
2474         (NativeToJSValueUsingPointers):
2475         (NativeToJSValue):
2476         Rework NativeToJSValueUsingReferences/NativeToJSValueUsingPointers to take a global object reference
2477         accessor rather than a thisObject accessor, as a thisObject is not always available, and what the function
2478         actually wants is the global object.
2479
2480         * bindings/scripts/IDLAttributes.json:
2481         Add new RethrowException attribute to instruct the callback function to re-throw, rather than
2482         just report, exceptions thrown in the callback and SkipCallbackInvokeCheck which instructs the
2483         callback function to not check canInvokeCallback() before calling. These will both be needed to retain
2484         the behavior of NodeFilter, and should be investigated further.
2485
2486         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
2487         * bindings/scripts/test/JS/JSTestCallbackFunction.h:
2488         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp: Added.
2489         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.h: Added.
2490         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
2491         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
2492         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
2493         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
2494         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp: Added.
2495         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.h: Added.
2496         * bindings/scripts/test/TestCallbackFunction.idl:
2497         * bindings/scripts/test/TestCallbackInterface.idl:
2498         * bindings/scripts/test/TestVoidCallbackFunction.idl: Copied from Source/WebCore/bindings/scripts/test/TestCallbackFunction.idl.
2499         Update test results and add some additional test cases for callback functions and callback interface functions that return
2500         non-void and use the RethrowExceptions.
2501
2502         * dom/CallbackResult.h: Added.
2503         (WebCore::CallbackResult<ReturnType>::CallbackResult):
2504         (WebCore::CallbackResult<ReturnType>::type):
2505         (WebCore::CallbackResult<void>::CallbackResult):
2506         (WebCore::CallbackResult<void>::type):
2507         New class to encapsulate the return value and status of a callback function. Modeled loosely on
2508         ExceptionOr, but is simpler since it does not need to handle complex exception objects.
2509
2510         * dom/NativeNodeFilter.cpp:
2511         * dom/NativeNodeFilter.h:
2512         Adopt CallbackResult, matching other NodeFiltering code by using
2513         unsigned short rather than short, remove unused functions, and convert 
2514         condition member to a Ref, allowing us to get rid of the branch acceptNode.
2515
2516         * dom/NodeFilter.h:
2517         Adopt CallbackResult.
2518
2519         * dom/NodeFilter.idl:
2520         Replace Custom extended attribute with SkipCallbackInvokeCheck and RethrowException.
2521
2522         * dom/NodeFilterCondition.cpp:
2523         * dom/NodeFilterCondition.h:
2524         Modernize to take a Node reference and match other filtering code
2525         by returning an unsigned short.
2526
2527         * dom/Traversal.cpp:
2528         * dom/Traversal.h:
2529         Adopt CallbackResult and match other node filtering code by using unsigned short 
2530         rather than short.
2531
2532         * dom/NodeIterator.cpp:
2533         * dom/NodeIterator.h:
2534         * dom/NodeIterator.idl:
2535         * dom/TreeWalker.cpp:
2536         * dom/TreeWalker.h:
2537         * dom/TreeWalker.idl:
2538         Change functions that callout to javascript via the NodeFilter to 
2539         return ExceptionOr<Node>. Check the result of CallbackResult for a
2540         thrown exception, and bail, returning Exception { ExistingExceptionError }
2541         which acts as an indicator to the bindings that an exception was thrown.
2542         (In actuality, the specific exception code does not matter. All that matters
2543         is that an ExceptionOr<> is returned, which triggers, via overload, a path
2544         in toJS() that calls propagateException(), which in turn, checks to see if
2545         an exception is on the stack. But, having an explicit code here helps debugging).
2546
2547 2017-05-22  Simon Fraser  <simon.fraser@apple.com>
2548
2549         Support transform-box to switch sizing box in SVG
2550         https://bugs.webkit.org/show_bug.cgi?id=145783
2551
2552         Reviewed by Dean Jackson.
2553
2554         Add support for the CSS "transform-box" property, as described at
2555         <https://drafts.csswg.org/css-transforms/#transform-box>.
2556         
2557         This changes the behavior of percentage values in transform-origin in SVG.
2558         When these were added in r110532, percentage values in transform-origin were made
2559         relative to the bounding box, but absolute values relative to the view box.
2560         <https://github.com/w3c/csswg-drafts/issues/895> has concluded that this behavior
2561         is confusing. The new behavior is that, for SVG elements, both absolute and
2562         percentage values are relative to the reference box, which is specified by the
2563         new transform-box property.
2564
2565         The initial value for transform-box is border-box, with the svg.css UA stylesheet
2566         supplying a default of view-box for the relevant SVG elements per
2567         <https://www.w3.org/TR/SVG2/styling.html#UAStyleSheet>.
2568
2569         For non-SVG elements, the used value is always border-box, so there is no change
2570         in behavior.
2571
2572         Tests: fast/css/transform-box-parsing.html
2573                svg/transforms/svg-transform-box.html
2574
2575         * css/CSSComputedStyleDeclaration.cpp:
2576         (WebCore::ComputedStyleExtractor::propertyValue):
2577         * css/CSSPrimitiveValueMappings.h:
2578         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2579         (WebCore::CSSPrimitiveValue::operator TransformBox):
2580         * css/CSSProperties.json:
2581         * css/CSSValueKeywords.in:
2582         * css/parser/CSSPropertyParser.cpp:
2583         (WebCore::CSSPropertyParser::parseSingleValue):
2584         * css/svg.css:
2585         (*:not(svg),):
2586         (*): Deleted.
2587         (html|* > svg): Deleted.
2588         * page/animation/AnimationBase.cpp:
2589         (WebCore::AnimationBase::computeTransformedExtentViaTransformList):
2590         * rendering/style/RenderStyle.cpp:
2591         (WebCore::RenderStyle::applyTransform): The transformOriginX().isPercent() tests
2592         were added to support the weird "% values are relative to bounding box" in SVG. Now
2593         it's up to the caller to pass a non-zero origin when that matters, and
2594         SVGGraphicsElement::animatedLocalTransform() is the only caller that does so.
2595         * rendering/style/RenderStyle.h:
2596         (WebCore::RenderStyle::hasTransform):
2597         (WebCore::RenderStyle::transformBox):
2598         (WebCore::RenderStyle::setTransformBox):
2599         (WebCore::RenderStyle::initialTransformBox):
2600         * rendering/style/RenderStyleConstants.h:
2601         * rendering/style/StyleTransformData.cpp:
2602         (WebCore::StyleTransformData::StyleTransformData):
2603         (WebCore::StyleTransformData::operator==):
2604         * rendering/style/StyleTransformData.h:
2605         * svg/SVGGraphicsElement.cpp:
2606         (WebCore::SVGGraphicsElement::animatedLocalTransform): Consult the transform-box
2607         style to compute the reference box as the bounding box, or the view box.
2608
2609 2017-05-22  Chris Dumez  <cdumez@apple.com>
2610
2611         Add support for [LegacyWindowAlias] IDL extended attribute
2612         https://bugs.webkit.org/show_bug.cgi?id=172451
2613
2614         Reviewed by Sam Weinig.
2615
2616         Add support for [LegacyWindowAlias] IDL extended attribute as per:
2617         - https://heycam.github.io/webidl/#LegacyWindowAlias
2618
2619         Use it for our legacy window aliases, such as webKitURL.
2620
2621         No new tests, there should be no Web-exposed behavior change.
2622
2623         * bindings/scripts/IDLAttributes.json:
2624         * bindings/scripts/preprocess-idls.pl:
2625         (GenerateConstructorAttributes):
2626         * css/DOMMatrix.idl:
2627         * dom/MutationObserver.idl:
2628         * dom/XMLDocument.idl:
2629         * html/DOMURL.idl:
2630         * page/DOMWindow.idl:
2631
2632 2017-05-22  Jer Noble  <jer.noble@apple.com>
2633
2634         ASSERTION FAILED: m_boundThread == currentThread() in WTF::WeakReference<WebCore::WebCoreDecompressionSession>::clear()
2635         https://bugs.webkit.org/show_bug.cgi?id=172457
2636         <rdar://problem/32329436>
2637
2638         Reviewed by Eric Carlson.
2639
2640         Remove vestigal WeakPtrFactory that was entirely unused.
2641
2642         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
2643         (WebCore::WebCoreDecompressionSession::createWeakPtr): Deleted.
2644         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
2645         (WebCore::WebCoreDecompressionSession::WebCoreDecompressionSession):
2646
2647 2017-05-22  Antti Koivisto  <antti@apple.com>
2648
2649         Crash in WebCore::StyleRuleKeyframes::findKeyframeIndex
2650         https://bugs.webkit.org/show_bug.cgi?id=170756
2651         <rdar://problem/31573157>
2652
2653         Reviewed by Andreas Kling.
2654
2655         Using a malformed key with CSSKeyframesRule.findRule crashes because
2656         CSSParser::parseKeyframeKeyList returns null which is then dereferenced.
2657
2658         * css/CSSKeyframesRule.cpp:
2659         (WebCore::StyleRuleKeyframes::findKeyframeIndex): Null test.
2660
2661 2017-05-22  Wenson Hsieh  <wenson_hsieh@apple.com>
2662
2663         Remove unused documentIsHandlingNonDefaultDrag plumbing for WebKit2
2664         https://bugs.webkit.org/show_bug.cgi?id=172453
2665
2666         Reviewed by Tim Horton.
2667
2668         Removes unused plumbing that was originally added to support file uploads. No new tests, since there is no
2669         change in behavior.
2670
2671         * page/DragController.h:
2672         (WebCore::DragController::documentIsHandlingNonDefaultDrag): Deleted.
2673
2674 2017-05-22  Jer Noble  <jer.noble@apple.com>
2675
2676         Media element thinks its hidden when in PiP mode and tab is backgrounded.
2677         https://bugs.webkit.org/show_bug.cgi?id=172221
2678
2679         Reviewed by Eric Carlson.
2680
2681         The element should not be considered hidden when in legacy fullscreen mode or PiP mode.
2682
2683         * html/HTMLMediaElement.cpp:
2684         (WebCore::HTMLMediaElement::visibilityStateChanged):
2685         (WebCore::HTMLMediaElement::fullscreenModeChanged):
2686
2687 2017-05-22  Zan Dobersek  <zdobersek@igalia.com>
2688
2689         NavigatorEME: null RefPtr<> dereference due to different calling conventions
2690         https://bugs.webkit.org/show_bug.cgi?id=172352
2691
2692         Reviewed by Carlos Garcia Campos.
2693
2694         * Modules/encryptedmedia/NavigatorEME.cpp:
2695         (WebCore::tryNextSupportedConfiguration): Avoid crashes when constructing
2696         the MediaKeySystemAccess::create() arguments that can occur for targets with
2697         calling conventions that might release the implementation RefPtr<> before it's
2698         dereferenced to retrieve the key system string. Simply acquire the reference
2699         to the key system String object before the MediaKeySystem::create() call
2700         expression that releases the problematic RefPtr<>.
2701
2702 2017-05-22  Gwang Yoon Hwang  <yoon@igalia.com>
2703
2704         [CoordinatedGraphics] Clear UpdateAtlases for each tests
2705         https://bugs.webkit.org/show_bug.cgi?id=172119
2706
2707         Reviewed by Carlos Garcia Campos.
2708
2709         * loader/EmptyClients.h:
2710         * page/ChromeClient.h:
2711         * testing/Internals.cpp:
2712         (WebCore::Internals::resetToConsistentState): Clears update atlases
2713         while resetting states of the test runner.
2714
2715 2017-05-22  Gwang Yoon Hwang  <yoon@igalia.com>
2716
2717         [CoordinatedGraphics] BitmapTexturePool does not release textures properly
2718         https://bugs.webkit.org/show_bug.cgi?id=172428
2719
2720         Reviewed by Žan Doberšek.
2721
2722         No new tests because no behavior change.
2723
2724         * platform/graphics/texmap/BitmapTexturePool.cpp:
2725         (WebCore::BitmapTexturePool::BitmapTexturePool):
2726         Use the RunLoopTimer instead of Timer, because BitmapTexturePool would
2727         run on the compositing thread in Coordinated Graphics case.
2728         (WebCore::BitmapTexturePool::releaseUnusedTexturesTimerFired):
2729         We should check not only the last used time but also the refcounts of the
2730         texture when selecting textures to remove.
2731         * platform/graphics/texmap/BitmapTexturePool.h:
2732         (WebCore::BitmapTexturePool::Entry::canBeReleased): Added.
2733
2734 2017-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2735
2736         [WPE] Use surfaceless context for sharing and offscreen context if available
2737         https://bugs.webkit.org/show_bug.cgi?id=172268
2738
2739         Reviewed by Žan Doberšek.
2740
2741         Like GTK+ port does, WPE should use surfaceless contexts when possible, and only create a native offscreen
2742         context as a fallback. We don't need to do anything special in WPE port, just to make it consistent with the
2743         Wayland and X11 implementations. We should also avoid including EGL.h in headers, we added
2744         GLContextEGLWayland.cpp and GLContextEGLX11.cpp to avoid that. PlatformDisplayWPE::EGLOffscreenTarget is quite
2745         simple and only used by GLContextEGLWPE, so we could move it there like we do for Wayland and X11.
2746
2747         * platform/graphics/GLContext.h: Remove EGL header includes.
2748         * platform/graphics/egl/GLContextEGL.cpp:
2749         (WebCore::GLContextEGL::createWindowContext): Use createWindowSurfaceWPE() in WPE.
2750         (WebCore::GLContextEGL::createContext): Use createWPEContext in WPE.
2751         (WebCore::GLContextEGL::createSharingContext): Move the WPE code below to ensure we try
2752         createSurfacelessContext() first.
2753         * platform/graphics/egl/GLContextEGL.h:
2754         * platform/graphics/egl/GLContextEGLWPE.cpp:
2755         (WebCore::GLContextEGL::GLContextEGL): Add constructor for WPE that receives a struct wpe_renderer_backend_egl_offscreen_target*
2756         (WebCore::GLContextEGL::createWindowSurfaceWPE): Added implementation here because eglCreateWindowSurface needs
2757         the platform specific EGL includes and definitions.
2758         (WebCore::GLContextEGL::createWPEContext): Create a GLContext using WPE backend API directly here.
2759         (WebCore::GLContextEGL::destroyWPETarget): Add null check.
2760         * platform/graphics/wpe/PlatformDisplayWPE.cpp: Remove EGLOffscreenTarget.
2761         * platform/graphics/wpe/PlatformDisplayWPE.h:
2762
2763 2017-05-21  Michael Catanzaro  <mcatanzaro@igalia.com>
2764
2765         [GTK] Remove Firefox user agent quirk for Google domains
2766         https://bugs.webkit.org/show_bug.cgi?id=171941
2767
2768         Reviewed by Carlos Garcia Campos.
2769
2770         * platform/UserAgentQuirks.cpp:
2771         (WebCore::UserAgentQuirks::quirksForURL):
2772         (WebCore::UserAgentQuirks::stringForQuirk):
2773         (WebCore::urlRequiresFirefoxBrowser): Deleted.
2774         (WebCore::UserAgentQuirks::firefoxRevisionString): Deleted.
2775         * platform/UserAgentQuirks.h:
2776         * platform/gtk/UserAgentGtk.cpp:
2777         (WebCore::buildUserAgentString):
2778
2779 2017-05-21  Antti Koivisto  <antti@apple.com>
2780
2781         matchMedia('print').addListener() fires in WK1 but never in WK2 when printing (breaks printing Google maps, QuickLooks)
2782         https://bugs.webkit.org/show_bug.cgi?id=172361
2783         <rdar://problem/28777408>
2784
2785         Reviewed by Sam Weinig.
2786
2787         Test: fast/media/matchMedia-print.html
2788
2789         * page/FrameView.cpp:
2790         (WebCore::FrameView::layout):
2791
2792             Evaluate matchMedia queries unconditionally. No idea why it wasn't like that.
2793
2794         * testing/Internals.cpp:
2795         (WebCore::Internals::setPrinting):
2796
2797             Add testing support. The existing ways to do printing testing were unable to hit this bug as
2798             they had too much additional gunk.
2799
2800         * testing/Internals.h:
2801         * testing/Internals.idl:
2802
2803 2017-05-21  Zalan Bujtas  <zalan@apple.com>
2804
2805         Remove redundant FrameView ref in FrameView::performPostLayoutTasks
2806         https://bugs.webkit.org/show_bug.cgi?id=172422
2807
2808         Reviewed by Antti Koivisto.
2809
2810         This was added to protect FrameView from getting destroyed in updateEmbeddedObjects(), but r169475 changed
2811         the embedded object update to be asynchronous.  
2812
2813         * page/FrameView.cpp:
2814         (WebCore::FrameView::performPostLayoutTasks):
2815
2816 2017-05-20  Chris Dumez  <cdumez@apple.com>
2817
2818         Drop [NoInterfaceObject] from RTCDTMFSender and RTCStatsReport
2819         https://bugs.webkit.org/show_bug.cgi?id=172418
2820
2821         Reviewed by Youenn Fablet.
2822
2823         Drop [NoInterfaceObject] from RTCDTMFSender and RTCStatsReport to match the specification:
2824         - https://www.w3.org/TR/webrtc/#rtcdtmfsender
2825         - https://www.w3.org/TR/webrtc/#rtcstatsreport-object
2826
2827         Firefox exposes both RTCDTMFSender and RTCStatsReport. Chrome exposes RTCStatsReport only.
2828         RTCDTMFSender seems to be currently disabled at build time currently so the change to
2829         its interface does not currently impact Web-exposed behavior, only the change to the
2830         RTCStatsReport interface currently does.
2831
2832         No new tests, rebaselined existing test.
2833
2834         * Modules/mediastream/RTCDTMFSender.idl:
2835         * Modules/mediastream/RTCStatsReport.idl:
2836         Drop [NoInterfaceObject].
2837
2838         * Modules/mediastream/RTCIceCandidateEvent.cpp: Removed.
2839         * Modules/mediastream/RTCIceCandidateEvent.h: Removed.
2840         * Modules/mediastream/RTCIceCandidateEvent.idl: Removed.
2841         Drop class and IDL that are no longer used. They were not even part of any project files.
2842         RTCIceCandidateEvent has been renamed to RTCPeerConnectionIceEvent, which we support.
2843
2844 2017-05-20  Chris Dumez  <cdumez@apple.com>
2845
2846         Value for iterator property is wrong for maplike interfaces
2847         https://bugs.webkit.org/show_bug.cgi?id=172410
2848
2849         Reviewed by Sam Weinig.
2850
2851         Value for iterator property was wrong for maplike interfaces. The iterator property is
2852         supposed to have the same value as the 'entries' property but we were using the value
2853         of the 'values' property.
2854
2855         Specification:
2856         - https://heycam.github.io/webidl/#es-map-entries
2857         - https://heycam.github.io/webidl/#es-iterator
2858
2859         This impacts the iterator of the RTCStatsReport interface.
2860
2861         No new tests, updated existing test.
2862
2863         * bindings/scripts/CodeGeneratorJS.pm:
2864         (GenerateImplementation):
2865         * bindings/scripts/test/JS/JSMapLike.cpp:
2866         (WebCore::JSMapLikePrototype::finishCreation):
2867         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
2868         (WebCore::JSReadOnlyMapLikePrototype::finishCreation):
2869
2870 2017-05-20  Chris Dumez  <cdumez@apple.com>
2871
2872         Drop superfluous iterator property setting in addValueIterableMethods()
2873         https://bugs.webkit.org/show_bug.cgi?id=172409
2874
2875         Reviewed by Youenn Fablet.
2876
2877         Drop superfluous iterator setting in addValueIterableMethods(). The bindings already take care of
2878         adding the iterator property before calling addValueIterableMethods().
2879
2880         No new tests, no Web-facing behavior change.
2881
2882         * bindings/js/JSDOMIterator.cpp:
2883         (WebCore::addValueIterableMethods):
2884
2885 2017-05-20  Jer Noble  <jer.noble@apple.com>
2886
2887         [MSE][Mac] Support painting MSE video-element to canvas
2888         https://bugs.webkit.org/show_bug.cgi?id=125157
2889         <rdar://problem/23062016>
2890
2891         Reviewed by Eric Carlson.
2892
2893         Test: media/media-source/media-source-paint-to-canvas.html
2894
2895         In order to have access to decoded video data for painting, decode the encoded samples manually
2896         instead of adding them to the AVSampleBufferDisplayLayer. To facilitate doing so, add a new
2897         utility class WebCoreDecompressionSession, which can decode samples and store them.
2898
2899         For the purposes of this patch, to avoid double-decoding of video data and to avoid severe complication
2900         of our sample delivery pipeline, we will only support painting of decoded video samples when the video is
2901         not displayed in the DOM.
2902
2903         * Modules/mediasource/MediaSource.cpp:
2904         (WebCore::MediaSource::seekToTime): Always send waitForSeekCompleted() to give private a chance to delay seek completion.
2905         * Modules/mediasource/SourceBuffer.cpp:
2906         (WebCore::SourceBuffer::sourceBufferPrivateReenqueSamples): Added.
2907         * Modules/mediasource/SourceBuffer.h:
2908         * WebCore.xcodeproj/project.pbxproj:
2909         * platform/cf/CoreMediaSoftLink.cpp: Added new soft link macros.
2910         * platform/cf/CoreMediaSoftLink.h: Ditto.
2911         * platform/cocoa/CoreVideoSoftLink.cpp: Ditto.
2912         * platform/cocoa/CoreVideoSoftLink.h: Ditto.
2913         * platform/graphics/SourceBufferPrivateClient.h:
2914         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2915         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sampleBufferDisplayLayer): Simple accessor.
2916         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::decompressionSession): Ditto.
2917         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2918         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
2919         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load): Update whether we should be displaying in a layer or decompression session..
2920         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVisible): Ditto.
2921         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitForSeekCompleted): m_seeking is now an enum.
2922         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seeking): Ditto.
2923         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekCompleted): Ditto. If waiting for a video frame, delay completing seek.
2924         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::nativeImageForCurrentTime): Call updateLastImage() and return result.
2925         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastImage): Fetch the image for the current time.
2926         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paint): Pass to paintCurrentFrameInCanvas.
2927         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paintCurrentFrameInContext): Get a native image, and render it.
2928         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::acceleratedRenderingStateChanged): Create or destroy a layer or decompression session as appropriate.
2929         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer): Creates a layer.
2930         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer): Destroys a layer.
2931         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureDecompressionSession): Creates a decompression session.
2932         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyDecompressionSession): Destroys a decompression session.
2933         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame): If seek completion delayed, complete now. Ditto for ready state change.
2934         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setReadyState): If waiting for a video frame, delay ready state change.
2935         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addDisplayLayer): Deleted.
2936         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeDisplayLayer): Deleted.
2937         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
2938         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
2939         (WebCore::MediaSourcePrivateAVFObjC::hasVideo): Promote to a class function.
2940         (WebCore::MediaSourcePrivateAVFObjC::hasSelectedVideo): Return whether any of the active source buffers have video and are selected.
2941         (WebCore::MediaSourcePrivateAVFObjC::hasSelectedVideoChanged): Call setSourceBufferWithSelectedVideo().
2942         (WebCore::MediaSourcePrivateAVFObjC::setVideoLayer): Set (or clear) the layer on the selected buffer.
2943         (WebCore::MediaSourcePrivateAVFObjC::setDecompressionSession): Ditto for decompression session.
2944         (WebCore::MediaSourcePrivateAVFObjC::setSourceBufferWithSelectedVideo): Remove the layer and decompression session from the unselected
2945
2946                 buffer and add the decompression session or layer to the newly selected buffer.
2947         (WebCore::MediaSourcePrivateAVFObjCHasVideo): Deleted.
2948         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2949         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2950         (WebCore::SourceBufferPrivateAVFObjC::destroyRenderers): Clear the videoLayer and decompressionSession.
2951         (WebCore::SourceBufferPrivateAVFObjC::hasSelectedVideo): Return whether the buffer has a selected video track.
2952         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): The media player now manages the video layer and decompression session lifetimes.
2953         (WebCore::SourceBufferPrivateAVFObjC::flush): Flush the decompression session, if it exists.
2954         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Enqueue to the decompression session, if it exists.
2955         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples): As the decompression session, if it exists.
2956         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples): Tell the decompression session to stop requesting data, if it exists.
2957         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples): Request media data from the decompression session, if it exists.
2958         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer): Added.
2959         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): Added.
2960         * platform/graphics/cocoa/WebCoreDecompressionSession.h: Added.
2961         (WebCore::WebCoreDecompressionSession::create):
2962         (WebCore::WebCoreDecompressionSession::isInvalidated):
2963         (WebCore::WebCoreDecompressionSession::createWeakPtr):
2964         * platform/graphics/cocoa/WebCoreDecompressionSession.mm: Added.
2965         (WebCore::WebCoreDecompressionSession::WebCoreDecompressionSession): Register for media data requests.
2966         (WebCore::WebCoreDecompressionSession::invalidate):  Unregister for same.
2967         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaDataCallback): Pass to maybeBecomeReadyForMoreMediaData.
2968         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaData): Check in-flight decodes, and decoded frame counts.
2969         (WebCore::WebCoreDecompressionSession::enqueueSample): Pass the sample to be decoded on a background queue.
2970         (WebCore::WebCoreDecompressionSession::decodeSample): Decode the sample.
2971         (WebCore::WebCoreDecompressionSession::decompressionOutputCallback): Call handleDecompressionOutput.
2972         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput): Pass decoded sample to be enqueued on the main thread.
2973         (WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
2974         (WebCore::WebCoreDecompressionSession::enqueueDecodedSample): Enqueue the frame (if it's a displayed frame).
2975         (WebCore::WebCoreDecompressionSession::isReadyForMoreMediaData): Return whether we've hit our high water sample count.
2976         (WebCore::WebCoreDecompressionSession::requestMediaDataWhenReady):
2977         (WebCore::WebCoreDecompressionSession::stopRequestingMediaData): Unset the same.
2978         (WebCore::WebCoreDecompressionSession::notifyWhenHasAvailableVideoFrame): Set a callback to notify when a decoded frame has been enqueued.
2979         (WebCore::WebCoreDecompressionSession::imageForTime): Successively dequeue images until reaching one at or beyond the requested time.
2980         (WebCore::WebCoreDecompressionSession::flush): Synchronously empty the producer and consumer queues.
2981         (WebCore::WebCoreDecompressionSession::getDecodeTime): Utility method.
2982         (WebCore::WebCoreDecompressionSession::getPresentationTime): Ditto.
2983         (WebCore::WebCoreDecompressionSession::getDuration): Ditto.
2984         (WebCore::WebCoreDecompressionSession::compareBuffers): Ditto.
2985         * platform/cocoa/VideoToolboxSoftLink.cpp: Added.
2986         * platform/cocoa/VideoToolboxSoftLink.h: Added.
2987
2988 2017-05-19  Joseph Pecoraro  <pecoraro@apple.com>
2989
2990         WebAVStreamDataParserListener String leak
2991         https://bugs.webkit.org/show_bug.cgi?id=172395
2992
2993         Reviewed by Chris Dumez.
2994
2995         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2996         (-[WebAVStreamDataParserListener streamDataParser:didProvideMediaData:forTrackID:mediaType:flags:]):
2997         (-[WebAVStreamDataParserListener streamDataParser:didReachEndOfTrackWithTrackID:mediaType:]):
2998         Use an isolated String in a lambda used across threads.
2999
3000 2017-05-19  Chris Dumez  <cdumez@apple.com>
3001
3002         Consider not exposing webkitURL in workers
3003         https://bugs.webkit.org/show_bug.cgi?id=172166
3004
3005         Reviewed by Geoffrey Garen.
3006
3007         Drop webkitURL alias for URL in workers, to match other browsers. The risk should
3008         be low given that this only impacts workers, we expose URL to workers and Blink
3009         does not have this alias. We still support the webkitURL alias for URL on Window.
3010
3011         No new tests, rebaselined existing test.
3012
3013         * workers/WorkerGlobalScope.idl:
3014
3015 2017-05-19  Youenn Fablet  <youenn@apple.com>
3016
3017         Add RTCPeerConnection connection state change logging
3018         https://bugs.webkit.org/show_bug.cgi?id=172314
3019
3020         Reviewed by Eric Carlson.
3021
3022         No change of behavior.
3023         Adding some release logging of connection state changes.
3024
3025         * Modules/mediastream/RTCPeerConnection.cpp:
3026         (WebCore::rtcIceGatheringStateToString):
3027         (WebCore::RTCPeerConnection::updateIceGatheringState):
3028         (WebCore::rtcIceConnectionStateToString):
3029         (WebCore::RTCPeerConnection::updateIceConnectionState):
3030
3031 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
3032
3033         webkitSupportsFullscreen and webkitSupportsPresentationMode('fullscreen') disagree.
3034         https://bugs.webkit.org/show_bug.cgi?id=172329
3035         rdar://problem/32260891
3036
3037         Reviewed by Darin Adler.
3038
3039         Updated tests:
3040         * media/media-fullscreen-inline-expected.txt:
3041         * media/media-fullscreen-not-in-document-expected.txt:
3042         * media/media-fullscreen.js:
3043
3044         webkitSupportsPresentationMode('fullscreen') should delegate to webkitSupportsFullscreen.
3045         The additional mediaSession().fullscreenPermitted() check causes it to return false when
3046         not handling a user gesture, which isn't helpful to deciding to show a button in controls
3047         or not.
3048
3049         * html/HTMLVideoElement.cpp:
3050         (WebCore::HTMLVideoElement::webkitSupportsPresentationMode):
3051
3052 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
3053
3054         Prevent javascript interface from activating picture-in-picture for video elements that are showing capture camera on ios.
3055         https://bugs.webkit.org/show_bug.cgi?id=172328
3056
3057         Reviewed by Eric Carlson.
3058
3059         This change allows MediaPlayers to decide if they support pictureInPicture.
3060         And check this from supportsFullscreen().
3061
3062         In MediaPlayerPrivateMediaStreamAVFObjC disable pip if there is a capture video track.
3063         Elsewhere, leave it enabled.
3064
3065         * html/HTMLVideoElement.cpp:
3066         (WebCore::HTMLVideoElement::supportsFullscreen): Added Check.
3067         * platform/graphics/MediaPlayer.cpp:
3068         (WebCore::MediaPlayer::supportsPictureInPicture): Added.
3069         * platform/graphics/MediaPlayer.h:
3070         * platform/graphics/MediaPlayerPrivate.h:
3071         (WebCore::MediaPlayerPrivateInterface::supportsPictureInPicture): Added.
3072         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
3073         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3074         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3075         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3076         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::supportsPictureInPicture): Added
3077         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
3078         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
3079         (WebCore::MediaPlayerPrivateQTKit::supportsFullscreen): Deleted. Moved inline.
3080
3081 2017-05-19  Chris Dumez  <cdumez@apple.com>
3082
3083         Do not fire load event for SVGElements that are detached or in frameless documents
3084         https://bugs.webkit.org/show_bug.cgi?id=172289
3085         <rdar://problem/32275689>
3086
3087         Reviewed by Ryosuke Niwa.
3088
3089         We should not fire load event for SVGElements that are detached or in frameless
3090         documents.
3091
3092         Test: svg/load-event-detached.html
3093
3094         * svg/SVGElement.cpp:
3095         (WebCore::SVGElement::sendSVGLoadEventIfPossible):
3096
3097 2017-05-19  Chris Dumez  <cdumez@apple.com>
3098
3099         Option() named constructor is not per spec
3100         https://bugs.webkit.org/show_bug.cgi?id=172185
3101
3102         Reviewed by Sam Weinig.
3103
3104         Align the behavior of the Option() named constructor with the HTML specification:
3105         - https://html.spec.whatwg.org/#dom-option
3106
3107         In particular, we no longer create an empty Text child node if the input text is the empty string.
3108         This also aligns our behavior with Firefox.
3109
3110         Test: imported/w3c/web-platform-tests/html/semantics/forms/the-option-element/option-element-constructor.html
3111
3112         * html/HTMLOptionElement.cpp:
3113         (WebCore::HTMLOptionElement::createForJSConstructor):
3114         * html/HTMLOptionElement.h:
3115         * html/HTMLOptionElement.idl:
3116
3117 2017-05-19  Chris Dumez  <cdumez@apple.com>
3118
3119         URLSearchParams / Headers objects @@iterator is not as per Web IDL spec
3120         https://bugs.webkit.org/show_bug.cgi?id=172218
3121
3122         Reviewed by Youenn Fablet.
3123
3124         Both URLSearchParams and Headers interfaces are iterable as per their
3125         respective specification, and they both have a pair iterator:
3126         - https://url.spec.whatwg.org/#interface-urlsearchparams
3127         - https://fetch.spec.whatwg.org/#headers-class
3128
3129         As per the WebIDL specification for 'entries'[1], "If the interface has a pair
3130         iterator, then the Function object is the value of the @@iterator property",
3131         the value of @@iterator being defined at [2]. In WebKit, we were using
3132         different values/functions for 'entries' and @@iterator, although those
3133         functions were doing the same thing (and the right thing).
3134
3135         Also, as per [2], the name of the @@iterator function should be "entries",
3136         which I also implemented in this patch. Previously, we were using
3137         "[Symbol.Iterator]" as function name.
3138
3139         [1] https://heycam.github.io/webidl/#es-iterable-entries
3140         [2] https://heycam.github.io/webidl/#es-iterator
3141
3142         No new tests, rebaselined existing tests.
3143
3144         * bindings/scripts/CodeGeneratorJS.pm:
3145         (GenerateImplementation):
3146         (GenerateImplementationIterableFunctions):
3147         * bindings/scripts/test/JS/JSMapLike.cpp:
3148         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
3149         * bindings/scripts/test/JS/JSTestIterable.cpp:
3150         (WebCore::JSTestIterablePrototype::finishCreation):
3151         (WebCore::jsTestIterablePrototypeFunctionEntriesCaller):
3152         * bindings/scripts/test/JS/JSTestNode.cpp:
3153         (WebCore::JSTestNodePrototype::finishCreation):
3154         (WebCore::jsTestNodePrototypeFunctionEntriesCaller):
3155
3156 2017-05-19  Zalan Bujtas  <zalan@apple.com>
3157
3158         Redundant ellipsis box triggers ASSERT_WITH_SECURITY_IMPLICATION in InlineBox::parent().
3159         https://bugs.webkit.org/show_bug.cgi?id=172309
3160         <rdar://problem/32262357>
3161
3162         Reviewed by Simon Fraser.
3163
3164         This patch stops the redundant ellipsis box trigger ASSERT_WITH_SECURITY_IMPLICATION.
3165
3166         In RootInlineBox::placeEllipsis we construct an ellipsis box and append it to a static HashMap which
3167         keeps track of the ellipsis boxes on each line. However when the line already has an ellipsis, we
3168         re-use the existing one and this newly constructed (but redundant) box gets destroyed as we return from this function.
3169         In InlineBox's d'tor, we let the parent know that now it has a dangling child and we assert on it
3170         later, while accessing the children list. However this redundant ellipsis box was never added to the line,
3171         so the assertion hits incorrectly.
3172
3173         Test: fast/inline/redundant-ellipsis-triggers-assert-incorrectly.html
3174
3175         * rendering/EllipsisBox.cpp:
3176         (WebCore::EllipsisBox::EllipsisBox):
3177         * rendering/InlineBox.cpp: This needs 32bits padding.
3178         (WebCore::InlineBox::invalidateParentChildList):
3179         * rendering/InlineBox.h:
3180         * rendering/RootInlineBox.cpp:
3181         (WebCore::RootInlineBox::placeEllipsis):
3182
3183 2017-05-19  Matt Rajca  <mrajca@apple.com>
3184
3185         Inherit media user gestures from the top document when autoplay quirks are allowed.
3186         https://bugs.webkit.org/show_bug.cgi?id=172375
3187
3188         Reviewed by Eric Carlson.
3189
3190         Added API test.
3191
3192         * dom/Document.cpp:
3193         (WebCore::Document::processingUserGestureForMedia):
3194
3195 2017-05-19  Youenn Fablet  <youenn@apple.com>
3196
3197         Align MockRealtimeMediaSourceCenter with RealtimeMediaSourceCenter
3198         https://bugs.webkit.org/show_bug.cgi?id=172324
3199
3200         Reviewed by Eric Carlson.
3201
3202         No change of behavior.
3203         Remove most of MockRealtimeMediaSourceCenter implementation.
3204         Next step should be to remove it entirely and use the factory setters instead.
3205
3206         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
3207         (WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter):
3208         (WebCore::RealtimeMediaSourceCenter::createMediaStream):
3209         (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices):
3210         (WebCore::RealtimeMediaSourceCenter::setDeviceEnabled):
3211         * platform/mediastream/RealtimeMediaSourceCenter.h:
3212         (WebCore::RealtimeMediaSourceCenter::supportedConstraints):
3213         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
3214         (WebCore::RealtimeMediaSourceCenterMac::RealtimeMediaSourceCenterMac):
3215         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
3216         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
3217         (WebCore::MockRealtimeMediaSourceCenter::MockCaptureDeviceManager::captureDevices):
3218         * platform/mock/MockRealtimeMediaSourceCenter.h:
3219
3220 2017-05-19  Zalan Bujtas  <zalan@apple.com>
3221
3222         Update SameSizeAsInlineBox with the correct InlineBoxBitfields bits.
3223         https://bugs.webkit.org/show_bug.cgi?id=172377
3224
3225         Reviewed by Tim Horton.
3226
3227         * rendering/InlineBox.cpp:
3228
3229 2017-05-19  Daniel Bates  <dabates@apple.com>
3230
3231         Bindings: Support runtime-enabled features in specific worlds
3232         https://bugs.webkit.org/show_bug.cgi?id=172235
3233
3234         Reviewed by Chris Dumez.
3235
3236         Currently a function, attribute, or interface can be annotated with either EnabledAtRuntime
3237         or EnabledForWorld (not both) to expose/conceal it depending on the state of a runtime
3238         feature flag or the DOM world associated with the running JavaScript code, respectively.
3239         Even though we do not have any functions, attributes, or interfaces that are annotated
3240         with both EnabledAtRuntime and EnabledForWorld at the time of writing, it seems reasonable
3241         to support such a combination of annotations. This also has the benefit of making it
3242         straightforward to support the extended attribute SecureContext by generalizing the logic
3243         that generates the code to expose/conceal a function, attribute, or interface.
3244
3245         * bindings/scripts/CodeGeneratorJS.pm:
3246         (GenerateRuntimeEnableConditionalString): Use an array to build up all the conjuncts in
3247         the conditional expression.
3248         (GenerateImplementation): Substitute GenerateRuntimeEnableConditionalString() and $runtimeEnableConditionalString
3249         for GetRuntimeEnableFunctionName() and $enable_function_result, respectively.
3250         (GetRuntimeEnableFunctionName): Deleted.
3251
3252         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
3253          (WebCore::JSTestGlobalObject::finishCreation):
3254          (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabled):
3255          (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabledCaller):
3256          (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeaturesEnabled):
3257          (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeaturesEnabledCaller):
3258          Update expected results.
3259
3260          * bindings/scripts/test/JS/JSTestObj.cpp:
3261          (WebCore::JSTestObjPrototype::finishCreation):
3262          (WebCore::jsTestObjPrototypeFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabled):
3263          (WebCore::jsTestObjPrototypeFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabledCaller):
3264          Ditto.
3265
3266          * bindings/scripts/test/TestGlobalObject.idl: Added test cases.
3267          * bindings/scripts/test/TestObj.idl: Added test case.
3268
3269 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
3270
3271         Fix macos build after r217143
3272         https://bugs.webkit.org/show_bug.cgi?id=172380
3273
3274         unreviewed.
3275
3276         Remove reference to WebVideoFullscreenInterface for mac build.
3277
3278         * html/HTMLMediaElement.cpp:
3279         * platform/mac/WebVideoFullscreenInterfaceMac.h:
3280
3281 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
3282
3283         Remove defunct WebVideoFullscreenInterface
3284         https://bugs.webkit.org/show_bug.cgi?id=172254
3285
3286         Reviewed by Jon Lee.
3287
3288         No new tests because no behavior change.
3289
3290         WebVideoFullscreenInterface has long since been replaced by WebVideoFullscreenModelClient.
3291
3292         * WebCore.xcodeproj/project.pbxproj:
3293         * html/HTMLMediaElement.cpp:
3294         * html/HTMLVideoElement.cpp:
3295         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
3296         * platform/cocoa/WebVideoFullscreenInterface.h: Removed.
3297         * platform/cocoa/WebVideoFullscreenModel.h:
3298         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
3299         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3300         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
3301         * platform/mac/WebVideoFullscreenInterfaceMac.h:
3302
3303 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
3304
3305         HTMLVideoElement::webkitSupportsPresentationMode allowsPictureInPicture() check is redundant.
3306         https://bugs.webkit.org/show_bug.cgi?id=172330
3307         rdar://problem/32285443
3308
3309         Reviewed by Eric Carlson.
3310
3311         No new tests because no behavior change.
3312
3313         This removes a redundant call to allowsPictureInPicture() to make it
3314         more clear that webkitSupportsPresentationMode gives the same result as 
3315         webkitSupportsFullscreen(pipMode)
3316
3317         * html/HTMLVideoElement.cpp:
3318         (WebCore::HTMLVideoElement::webkitSupportsPresentationMode):
3319
3320 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
3321
3322         [WebRTC] Remove PiP support for video elements that are showing camera capture
3323         https://bugs.webkit.org/show_bug.cgi?id=172336
3324
3325         Reviewed by Eric Carlson.
3326
3327         No new tests because no effect on the DOM. This just changes a value sent to the platform interface layer.
3328
3329         Ask video element if it supports picture-in-picture instead of asking the mediaSession directly.
3330         This allows the video element to give a more robust answer.
3331
3332         * html/HTMLVideoElement.h:
3333         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3334         (WebVideoFullscreenControllerContext::setUpFullscreen):
3335
3336 2017-05-18  Sam Weinig  <sam@webkit.org>
3337
3338         [WebIDL] Remove the need for the generator to know about native type mapping
3339         https://bugs.webkit.org/show_bug.cgi?id=172310
3340
3341         Reviewed by Darin Adler.
3342
3343         Replace the use of explicit typename to native type mappings in CodeGeneratorJS.pm
3344         with use of IDLTypes and Converter, which already need the mapping. This allows us
3345         to have the information in only one spot.
3346
3347         Also, callback generation to account for nullability and update the IDLs to correctly
3348         annotate only the types that need to be nullable. 
3349
3350         * Modules/geolocation/GeoNotifier.cpp:
3351         * Modules/geolocation/GeoNotifier.h:
3352         * Modules/geolocation/Geolocation.cpp:
3353         * Modules/geolocation/Geolocation.h:
3354         * Modules/geolocation/PositionCallback.idl:
3355         * Modules/geolocation/PositionErrorCallback.h:
3356         Use references where possible in the Geolocation code. It was almost possible
3357         to make PositionCallback take a non-nullable position, but some odd logic in
3358         Geolocation::makeCachedPositionCallbacks() implies that there is a path where
3359         passing null is possible, though it would assert. Added FIXME's to return to
3360         this in a follow up.
3361
3362         * Modules/webaudio/AudioBufferCallback.idl:
3363         Add nullable annotation and FIXME explaining that the latest spec splits the callback
3364         into two separate ones.
3365
3366         * Modules/webdatabase/Database.cpp:
3367         (WebCore::Database::runTransaction):
3368         * Modules/webdatabase/DatabaseCallback.h:
3369         * Modules/webdatabase/DatabaseManager.cpp:
3370         (WebCore::DatabaseManager::openDatabase):
3371         * Modules/webdatabase/SQLStatement.cpp:
3372         (WebCore::SQLStatement::performCallback):
3373         * Modules/webdatabase/SQLStatementCallback.h:
3374         * Modules/webdatabase/SQLStatementErrorCallback.h:
3375         * Modules/webdatabase/SQLTransaction.cpp:
3376         (WebCore::SQLTransaction::deliverTransactionCallback):
3377         (WebCore::SQLTransaction::deliverTransactionErrorCallback):
3378         * Modules/webdatabase/SQLTransactionCallback.h:
3379         * Modules/webdatabase/SQLTransactionErrorCallback.h:
3380         * inspector/InspectorDatabaseAgent.cpp:
3381         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp:
3382         (WebCore::JSSQLStatementErrorCallback::handleEvent):
3383         Update to pass callback parameters as references, since they are never null.
3384
3385         * bindings/IDLTypes.h:
3386         Add NullableParameterType to allow customization of nullable parameters (in much
3387         the same way we allow customization of the nullable implementation type).
3388
3389         * bindings/scripts/CodeGeneratorJS.pm:
3390         (GenerateDefaultValue):
3391         Use Converter<>::ReturnType{ } for default values rather than ${GetNativeType..}().
3392
3393         (GenerateHeader):
3394         Remove use of GetNativeType for toWrapped by using the impl type, since this will never
3395         be a complex type.
3396
3397         (GenerateImplementation):
3398         Simplify DOMJIT UnsafeToNative by merging two identical paths and using auto.
3399
3400         (GenerateParametersCheck):
3401         Rework parameter checks to use more specific variable names, make branches more clear,
3402         and use Converter<>::ReturnType rather than GetNativeType.
3403
3404         (GenerateCallbackHeaderContent):
3405         (GenerateCallbackImplementationContent):
3406         Switch to using typename ${IDLType}::ParameterType as the parameters for callback functions. Also
3407         add final and override to make sure the generated function matches the user provided base class.
3408         (GetNativeType): Deleted.
3409         (GetNativeInnerType): Deleted.
3410         (GetNativeTypeForCallbacks): Deleted.
3411         Remove native type mappings.
3412
3413         * css/MediaQueryListListener.h:
3414         * css/MediaQueryListListener.idl:
3415         * css/MediaQueryMatcher.cpp:
3416         Update MediaQueryListListener to take a non-nullable MediaQueryList.
3417         
3418         * dom/NativeNodeFilter.cpp:
3419         * dom/NativeNodeFilter.h:
3420         * dom/NodeFilter.h:
3421         * dom/NodeFilter.idl:
3422         * dom/NodeIterator.cpp:
3423         * dom/Traversal.cpp:
3424         * dom/Traversal.h:
3425         * dom/TreeWalker.cpp:
3426         * bindings/js/JSNodeFilterCustom.cpp:
3427         Update acceptNode to be non-nullable and pass the Node by reference.
3428
3429         * dom/StringCallback.cpp:
3430         * dom/StringCallback.h:
3431         Pass the ScriptExecutionContext by reference.
3432
3433         * page/IntersectionObserverCallback.h:
3434         Update to match new parameter types and pass IntersectionObserver by reference.
3435
3436         * page/PerformanceObserver.cpp:
3437         * page/PerformanceObserverCallback.h:
3438         Update to pass PerformanceObserverEntryList and PerformanceObserver by reference.
3439
3440         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
3441         * bindings/scripts/test/JS/JSTestCallbackFunction.h:
3442         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
3443         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
3444         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
3445         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
3446         * bindings/scripts/test/JS/JSTestObj.cpp:
3447         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3448         Update test results.
3449
3450         * bindings/scripts/test/TestCallbackInterface.idl:
3451         Update test to refer to actual interfaces as we now do lookup on these parameter 
3452         types rather than blindly assuming they are interfaces.
3453
3454 2017-05-19  Commit Queue  <commit-queue@webkit.org>
3455
3456         Unreviewed, rolling out r217098, r217111, r217113, and
3457         r217114.
3458         https://bugs.webkit.org/show_bug.cgi?id=172367
3459
3460         These changes broke the Windows build and introduced
3461         LayoutTest failures (Requested by ryanhaddad on #webkit).
3462
3463         Reverted changesets:
3464
3465         "[MSE][Mac] Support painting MSE video-element to canvas"
3466         https://bugs.webkit.org/show_bug.cgi?id=125157
3467         http://trac.webkit.org/changeset/217098
3468
3469         "[MSE][Mac] Support painting MSE video-element to canvas"
3470         https://bugs.webkit.org/show_bug.cgi?id=125157
3471         http://trac.webkit.org/changeset/217111
3472
3473         "Unreviewed build fix; add undefined functions and constants
3474         to the CoreMediaSoftLink.h, and use the"
3475         http://trac.webkit.org/changeset/217113
3476
3477         "[MSE][Mac] Support painting MSE video-element to canvas"
3478         https://bugs.webkit.org/show_bug.cgi?id=125157
3479         http://trac.webkit.org/changeset/217114
3480
3481 2017-05-19  Andy Estes  <aestes@apple.com>
3482
3483         REGRESSION (r217078): window.ApplePaySession is undefined on macOS Sierra
3484         https://bugs.webkit.org/show_bug.cgi?id=172344
3485
3486         Reviewed by Tim Horton.
3487
3488         r213673 mistakenly changed the ApplePaySession interface from being conditional on
3489         APPLE_PAY to being conditional on APPLE_PAY_DELEGATE, so when r217078 disabled
3490         APPLE_PAY_DELEGATE on Sierra and earlier it disabled ApplePaySession.
3491
3492         Fix this by reverting ApplePaySession to being conditional on APPLE_PAY.
3493
3494         Fixes http/tests/ssl/applepay/ApplePaySession.html
3495
3496         * Modules/applepay/ApplePaySession.idl:
3497
3498 2017-05-19  Chris Dumez  <cdumez@apple.com>
3499
3500         CSSOM insertRule() index argument is optional with default 0
3501         https://bugs.webkit.org/show_bug.cgi?id=172219
3502
3503         Reviewed by Sam Weinig.
3504
3505         Index parameter to CSSSupportsRule.insertRule() and CSSStyleSheet.insertRule() should
3506         be optional with a default value of 0, as per the latest specification:
3507         - https://github.com/w3c/csswg-drafts/commit/7949d41a2d86107f8ad4624c055b4b0c9c28ad0d
3508         - https://www.w3.org/Bugs/Public/show_bug.cgi?id=27384
3509
3510         Tests: imported/w3c/web-platform-tests/cssom/insertRule-charset-no-index.html
3511                imported/w3c/web-platform-tests/cssom/insertRule-import-no-index.html
3512                imported/w3c/web-platform-tests/cssom/insertRule-namespace-no-index.html
3513                imported/w3c/web-platform-tests/cssom/insertRule-no-index.html
3514
3515         * css/CSSStyleSheet.cpp:
3516         * css/CSSStyleSheet.h:
3517         * css/CSSStyleSheet.idl:
3518         * css/CSSSupportsRule.idl:
3519
3520 2017-05-19  Carlos Garcia Campos  <cgarcia@igalia.com>
3521
3522         [Threaded Compositor] Remove platform ifdefs from threaded compositor implementation
3523         https://bugs.webkit.org/show_bug.cgi?id=172265
3524
3525         Reviewed by Žan Doberšek.
3526
3527         Remove PlatformDisplayWPE::EGLTarget.
3528
3529         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
3530         * platform/graphics/wpe/PlatformDisplayWPE.h:
3531
3532 2017-05-19  Jer Noble  <jer.noble@apple.com>
3533
3534         Unreviewed build fix; add undefined functions and constants to the CoreMediaSoftLink.h, and use the
3535         correct (and previously soft-linked) method in WebCoreDecompressionSession.
3536
3537         * platform/cf/CoreMediaSoftLink.cpp:
3538         * platform/cf/CoreMediaSoftLink.h:
3539         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
3540         (WebCore::WebCoreDecompressionSession::imageForTime):
3541
3542 2017-05-19  Yusuke Suzuki  <utatane.tea@gmail.com>
3543
3544         [JSC][DFG][DOMJIT] Extend CheckDOM to CheckSubClass
3545         https://bugs.webkit.org/show_bug.cgi?id=172098
3546
3547         Reviewed by Saam Barati.
3548
3549         Add DOMJIT interface IDL attribute. Which allows us to define checkSubClassPatchpointFor${className}
3550         function for that ClassInfo. And we move CheckSubClass patchpoint implementation to ClassInfo's member
3551
3552         * CMakeLists.txt:
3553         * WebCore.xcodeproj/project.pbxproj:
3554         * bindings/js/JSDOMGlobalObject.cpp:
3555         * bindings/js/JSDOMWindowBase.cpp:
3556         * bindings/js/JSDOMWindowProperties.cpp:
3557         * bindings/js/JSDOMWindowShell.cpp:
3558         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
3559         * bindings/js/JSWorkerGlobalScopeBase.cpp:
3560         * bindings/scripts/CodeGeneratorJS.pm:
3561         (GenerateHeader):
3562         (GenerateImplementation):
3563         (GenerateImplementationIterableFunctions):
3564         (GenerateConstructorHelperMethods):
3565         * bindings/scripts/IDLAttributes.json:
3566         * bindings/scripts/test/JS/JSInterfaceName.cpp:
3567         * bindings/scripts/test/JS/JSMapLike.cpp:
3568         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
3569         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
3570         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
3571         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
3572         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
3573         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
3574         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
3575         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
3576         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
3577         * bindings/scripts/test/JS/JSTestDOMJIT.h:
3578         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
3579         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
3580         * bindings/scripts/test/JS/JSTestException.cpp:
3581         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
3582         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
3583         * bindings/scripts/test/JS/JSTestInterface.cpp:
3584         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
3585         * bindings/scripts/test/JS/JSTestIterable.cpp:
3586         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
3587         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
3588         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
3589         * bindings/scripts/test/JS/JSTestNode.cpp:
3590         * bindings/scripts/test/JS/JSTestObj.cpp:
3591         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
3592         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
3593         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
3594         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
3595         * bindings/scripts/test/JS/JSTestSerialization.cpp:
3596         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
3597         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
3598         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
3599         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3600         * bridge/c/CRuntimeObject.cpp:
3601         * bridge/c/c_instance.cpp:
3602         * bridge/objc/ObjCRuntimeObject.mm:
3603         * bridge/objc/objc_instance.mm:
3604         * bridge/objc/objc_runtime.mm:
3605         * bridge/runtime_array.cpp:
3606         * bridge/runtime_method.cpp:
3607         * bridge/runtime_object.cpp:
3608         * dom/Document.idl:
3609         * dom/DocumentFragment.idl:
3610         * dom/Element.idl:
3611         * dom/Event.idl:
3612         * dom/Node.idl:
3613         * domjit/JSDocumentDOMJIT.cpp:
3614         (WebCore::checkSubClassPatchpointForJSDocument):
3615         (WebCore::DocumentDocumentElementDOMJIT::checkDOM): Deleted.
3616         (WebCore::DocumentBodyDOMJIT::checkDOM): Deleted.
3617         * domjit/JSDocumentFragmentDOMJIT.cpp: Copied from Source/JavaScriptCore/runtime/JSMap.cpp.
3618         (WebCore::checkSubClassPatchpointForJSDocumentFragment):
3619         * domjit/JSElementDOMJIT.cpp: Copied from Source/JavaScriptCore/tools/JSDollarVM.cpp.
3620         (WebCore::checkSubClassPatchpointForJSElement):
3621         * domjit/JSEventDOMJIT.cpp: Copied from Source/JavaScriptCore/tools/JSDollarVM.cpp.
3622         (WebCore::checkSubClassPatchpointForJSEvent):
3623         * domjit/JSNodeDOMJIT.cpp:
3624         (WebCore::checkSubClassPatchpointForJSNode):
3625         (WebCore::NodeFirstChildDOMJIT::checkDOM): Deleted.
3626         (WebCore::NodeLastChildDOMJIT::checkDOM): Deleted.
3627         (WebCore::NodeNextSiblingDOMJIT::checkDOM): Deleted.
3628         (WebCore::NodePreviousSiblingDOMJIT::checkDOM): Deleted.
3629         (WebCore::NodeParentNodeDOMJIT::checkDOM): Deleted.
3630         (WebCore::NodeNodeTypeDOMJIT::checkDOM): Deleted.
3631         (WebCore::NodeOwnerDocumentDOMJIT::checkDOM): Deleted.
3632
3633 2017-05-18  Jer Noble  <jer.noble@apple.com>
3634
3635         [MSE][Mac] Support painting MSE video-element to canvas
3636         https://bugs.webkit.org/show_bug.cgi?id=125157
3637         <rdar://problem/23062016>
3638
3639         Reviewed by Eric Carlson.
3640
3641         Test: media/media-source/media-source-paint-to-canvas.html
3642
3643         In order to have access to decoded video data for painting, decode the encoded samples manually
3644         instead of adding them to the AVSampleBufferDisplayLayer. To facilitate doing so, add a new
3645         utility class WebCoreDecompressionSession, which can decode samples and store them.
3646
3647         For the purposes of this patch, to avoid double-decoding of video data and to avoid severe complication
3648         of our sample delivery pipeline, we will only support painting of decoded video samples when the video is
3649         not displayed in the DOM.
3650
3651         * Modules/mediasource/MediaSource.cpp:
3652         (WebCore::MediaSource::seekToTime): Always send waitForSeekCompleted() to give private a chance to delay seek completion.
3653         * Modules/mediasource/SourceBuffer.cpp:
3654         (WebCore::SourceBuffer::sourceBufferPrivateReenqueSamples): Added.
3655         * Modules/mediasource/SourceBuffer.h:
3656         * WebCore.xcodeproj/project.pbxproj:
3657         * platform/cf/CoreMediaSoftLink.cpp: Added new soft link macros.
3658         * platform/cf/CoreMediaSoftLink.h: Ditto.
3659         * platform/cocoa/CoreVideoSoftLink.cpp: Ditto.
3660         * platform/cocoa/CoreVideoSoftLink.h: Ditto.
3661         * platform/graphics/SourceBufferPrivateClient.h:
3662         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3663         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sampleBufferDisplayLayer): Simple accessor.
3664         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::decompressionSession): Ditto.
3665         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3666         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
3667         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load): Update whether we should be displaying in a layer or decompression session..
3668         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVisible): Ditto.
3669         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitForSeekCompleted): m_seeking is now an enum.
3670         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seeking): Ditto.
3671         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekCompleted): Ditto. If waiting for a video frame, delay completing seek.
3672         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::nativeImageForCurrentTime): Call updateLastImage() and return result.
3673         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastImage): Fetch the image for the current time.
3674         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paint): Pass to paintCurrentFrameInCanvas.
3675         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paintCurrentFrameInContext): Get a native image, and render it.
3676         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::acceleratedRenderingStateChanged): Create or destroy a layer or decompression session as appropriate.
3677         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer): Creates a layer.
3678         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer): Destroys a layer.
3679         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureDecompressionSession): Creates a decompression session.
3680         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyDecompressionSession): Destroys a decompression session.
3681         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame): If seek completion delayed, complete now. Ditto for ready state change.
3682         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setReadyState): If waiting for a video frame, delay ready state change.
3683         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addDisplayLayer): Deleted.
3684         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeDisplayLayer): Deleted.
3685         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
3686         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
3687         (WebCore::MediaSourcePrivateAVFObjC::hasVideo): Promote to a class function.
3688         (WebCore::MediaSourcePrivateAVFObjC::hasSelectedVideo): Return whether any of the active source buffers have video and are selected.
3689         (WebCore::MediaSourcePrivateAVFObjC::hasSelectedVideoChanged): Call setSourceBufferWithSelectedVideo().
3690         (WebCore::MediaSourcePrivateAVFObjC::setVideoLayer): Set (or clear) the layer on the selected buffer.
3691         (WebCore::MediaSourcePrivateAVFObjC::setDecompressionSession): Ditto for decompression session.
3692         (WebCore::MediaSourcePrivateAVFObjC::setSourceBufferWithSelectedVideo): Remove the layer and decompression session from the unselected
3693
3694                 buffer and add the decompression session or layer to the newly selected buffer.
3695         (WebCore::MediaSourcePrivateAVFObjCHasVideo): Deleted.
3696         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
3697         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3698         (WebCore::SourceBufferPrivateAVFObjC::destroyRenderers): Clear the videoLayer and decompressionSession.
3699         (WebCore::SourceBufferPrivateAVFObjC::hasSelectedVideo): Return whether the buffer has a selected video track.
3700         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): The media player now manages the video layer and decompression session lifetimes.
3701         (WebCore::SourceBufferPrivateAVFObjC::flush): Flush the decompression session, if it exists.
3702         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Enqueue to the decompression session, if it exists.
3703         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples): As the decompression session, if it exists.
3704         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples): Tell the decompression session to stop requesting data, if it exists.
3705         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples): Request media data from the decompression session, if it exists.
3706         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer): Added.
3707         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): Added.
3708         * platform/graphics/cocoa/WebCoreDecompressionSession.h: Added.
3709         (WebCore::WebCoreDecompressionSession::create):
3710         (WebCore::WebCoreDecompressionSession::isInvalidated):
3711         (WebCore::WebCoreDecompressionSession::createWeakPtr):
3712         * platform/graphics/cocoa/WebCoreDecompressionSession.mm: Added.
3713         (WebCore::WebCoreDecompressionSession::WebCoreDecompressionSession): Register for media data requests.
3714         (WebCore::WebCoreDecompressionSession::invalidate):  Unregister for same.
3715         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaDataCallback): Pass to maybeBecomeReadyForMoreMediaData.
3716         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaData): Check in-flight decodes, and decoded frame counts.
3717         (WebCore::WebCoreDecompressionSession::enqueueSample): Pass the sample to be decoded on a background queue.
3718         (WebCore::WebCoreDecompressionSession::decodeSample): Decode the sample.
3719         (WebCore::WebCoreDecompressionSession::decompressionOutputCallback): Call handleDecompressionOutput.
3720         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput): Pass decoded sample to be enqueued on the main thread.
3721         (WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
3722         (WebCore::WebCoreDecompressionSession::enqueueDecodedSample): Enqueue the frame (if it's a displayed frame).
3723         (WebCore::WebCoreDecompressionSession::isReadyForMoreMediaData): Return whether we've hit our high water sample count.
3724         (WebCore::WebCoreDecompressionSession::requestMediaDataWhenReady):
3725         (WebCore::WebCoreDecompressionSession::stopRequestingMediaData): Unset the same.
3726         (WebCore::WebCoreDecompressionSession::notifyWhenHasAvailableVideoFrame): Set a callback to notify when a decoded frame has been enqueued.
3727         (WebCore::WebCoreDecompressionSession::imageForTime): Successively dequeue images until reaching one at or beyond the requested time.
3728         (WebCore::WebCoreDecompressionSession::flush): Synchronously empty the producer and consumer queues.
3729         (WebCore::WebCoreDecompressionSession::getDecodeTime): Utility method.
3730         (WebCore::WebCoreDecompressionSession::getPresentationTime): Ditto.
3731         (WebCore::WebCoreDecompressionSession::getDuration): Ditto.
3732         (WebCore::WebCoreDecompressionSession::compareBuffers): Ditto.
3733         * platform/cocoa/VideoToolboxSoftLink.cpp: Added.
3734         * platform/cocoa/VideoToolboxSoftLink.h: Added.
3735
3736 2017-05-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
3737
3738         [REGRESSION](r216901): Delete ImageDecoder if BitmapImage::destroyDecodedData() was called to destroy all the decoded frames
3739         https://bugs.webkit.org/show_bug.cgi?id=172325
3740
3741         Reviewed by Simon Fraser.
3742
3743         When calling BitmapImage::destroyDecodedData() with destroyAll = true, the
3744         current ImageDecoder has to be deleted regardless the current frame needs
3745         to be cached or not. This is true except when the image is animating.
3746         Creating a new ImageDecoder for the animated image will lead to decoding
3747         all the frames from frame-zero till the current frame.
3748
3749         Deleting the current ImageDecoder has the benefit of releasing its raster
3750         data. We also must delete the current ImageDecoder when the CachedImage
3751         switched its data SharedBuffer.
3752
3753         The fix is return the condition in BitmapImage::destroyDecodedData() to 
3754         be as it was before r216901.
3755
3756         * platform/graphics/BitmapImage.cpp:
3757         (WebCore::BitmapImage::destroyDecodedData):
3758
3759 2017-05-18  Ryan Haddad  <ryanhaddad@apple.com>
3760
3761         Unreviewed, rolling out r217079.
3762
3763         This change broke internal builds.
3764
3765         Reverted changeset:
3766
3767         "Redundant ellipsis box triggers
3768         ASSERT_WITH_SECURITY_IMPLICATION in InlineBox::parent()."
3769         https://bugs.webkit.org/show_bug.cgi?id=172309
3770         http://trac.webkit.org/changeset/217079
3771
3772 2017-05-18  Joseph Pecoraro  <pecoraro@apple.com>
3773
3774         Web Inspector: Release InjectedScripts when frontends close
3775         https://bugs.webkit.org/show_bug.cgi?id=172313
3776
3777         Reviewed by Andreas Kling.
3778
3779         * inspector/InspectorController.cpp:
3780         (WebCore::InspectorController::disconnectFrontend):
3781         Release inspector resources together, including discarding injected
3782         scripts so that they may be collected.
3783
3784         (WebCore::InspectorController::inspectedPageDestroyed):
3785         (WebCore::InspectorController::disconnectAllFrontends):
3786         Move the disconnect call inside of disconnectAllFrontends to establish
3787         a pattern of releasing web inspector resources together.
3788
3789 2017-05-18  Simon Fraser  <simon.fraser@apple.com>
3790
3791         Add a newline after the URL in showLayerTree output.
3792
3793         Reviewed by Zalan Bujtas.
3794
3795         * rendering/RenderLayer.cpp:
3796         (WebCore::showLayerTree):
3797
3798 2017-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
3799
3800         Attachment drag preview should not have the attachment outline
3801         https://bugs.webkit.org/show_bug.cgi?id=172327
3802         <rdar://problem/32282831>
3803
3804         Reviewed by Tim Horton.
3805
3806         When creating a drag image for an attachment element, don't include borders around the attachment.
3807
3808         * page/DragController.cpp:
3809         (WebCore::DragController::startDrag):
3810         * rendering/RenderAttachment.h:
3811         * rendering/RenderThemeIOS.mm:
3812         (WebCore::RenderThemeIOS::paintAttachment):
3813
3814 2017-05-18  Youenn Fablet  <youenn@apple.com>
3815
3816         Make WebRTC logging happen in Release
3817         https://bugs.webkit.org/show_bug.cgi?id=172307
3818
3819         Reviewed by Eric Carlson.
3820
3821         No change of behavior.
3822         Move from LOG(WebRTC...) to RELEASE_LOG(WebRTC...).
3823
3824         * Modules/mediastream/PeerConnectionBackend.cpp:
3825         (WebCore::PeerConnectionBackend::createOfferSucceeded):
3826         (WebCore::PeerConnectionBackend::createOfferFailed):
3827         (WebCore::PeerConnectionBackend::createAnswerSucceeded):
3828         (WebCore::PeerConnectionBackend::createAnswerFailed):
3829         (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
3830         (WebCore::PeerConnectionBackend::setLocalDescriptionFailed):
3831         (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
3832         (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed):
3833         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
3834         (WebCore::PeerConnectionBackend::addIceCandidateFailed):
3835         (WebCore::PeerConnectionBackend::newICECandidate):
3836         (WebCore::PeerConnectionBackend::doneGatheringCandidates):
3837         * Modules/mediastream/RTCPeerConnection.cpp:
3838         (WebCore::RTCPeerConnection::queuedCreateOffer):
3839         (WebCore::RTCPeerConnection::queuedCreateAnswer):
3840         (WebCore::RTCPeerConnection::queuedSetLocalDescription):
3841         (WebCore::RTCPeerConnection::queuedSetRemoteDescription):
3842         (WebCore::RTCPeerConnection::queuedAddIceCandidate):
3843
3844 2017-05-18  Eric Carlson  <eric.carlson@apple.com>
3845
3846         [MediaStream] do not cache gUM permissions
3847         https://bugs.webkit.org/show_bug.cgi?id=172245
3848
3849         Reviewed by Youenn Fablet.
3850
3851         No new tests, updated fast/mediastream/MediaDevices-getUserMedia.html.
3852
3853         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
3854         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): Add salt parameter.
3855         * platform/mediastream/RealtimeMediaSourceCenter.h:
3856
3857 2017-05-18  Zalan Bujtas  <zalan@apple.com>
3858
3859         Redundant ellipsis box triggers ASSERT_WITH_SECURITY_IMPLICATION in InlineBox::parent().
3860         https://bugs.webkit.org/show_bug.cgi?id=172309
3861         <rdar://problem/32262357>
3862
3863         Reviewed by Simon Fraser.
3864
3865         This patch stops the redundant ellipsis box trigger ASSERT_WITH_SECURITY_IMPLICATION.
3866
3867         In RootInlineBox::placeEllipsis we construct an ellipsis box and append it to a static HashMap which
3868         keeps track of the ellipsis boxes on each line. However when the line already has an ellipsis, we
3869         re-use the existing one and this newly constructed (but redundant) box gets destroyed as we return from this function.
3870         In InlineBox's d'tor, we let the parent know that now it has a dangling child and we assert on it
3871         later, while accessing the children list. However this redundant ellipsis box was never added to the line,
3872         so the assertion hits incorrectly.
3873
3874         Test: fast/inline/redundant-ellipsis-triggers-assert-incorrectly.html
3875
3876         * rendering/EllipsisBox.cpp:
3877         (WebCore::EllipsisBox::EllipsisBox):
3878         * rendering/InlineBox.cpp:
3879         (WebCore::InlineBox::invalidateParentChildList):
3880         * rendering/InlineBox.h:
3881         * rendering/RootInlineBox.cpp:
3882         (WebCore::RootInlineBox::placeEllipsis): Use the newly created ellipsis box instead.
3883
3884 2017-05-18  Andy Estes  <aestes@apple.com>
3885
3886         ENABLE(APPLE_PAY_DELEGATE) should be NO on macOS Sierra and earlier
3887         https://bugs.webkit.org/show_bug.cgi?id=172305
3888
3889         Reviewed by Anders Carlsson.
3890
3891         * Configurations/FeatureDefines.xcconfig:
3892
3893 2017-05-18  Dean Jackson  <dino@apple.com>
3894
3895         Transform misplaces element 50% of the time
3896         https://bugs.webkit.org/show_bug.cgi?id=172300
3897
3898         Reviewed by Simon Fraser.
3899
3900         A hardware-accelerated animation of the transform property
3901         requires layout to happen if it contains a translate operation
3902         using percentages, otherwise it may create an incorrect
3903         animation. The "50% of the time" comes in to play because
3904         the layout timer may sometimes fire before the animation
3905         timer. The test case contains a example that is much more
3906         likely to fail without this fix.
3907
3908         Test: animations/needs-layout.html
3909
3910         * page/animation/CSSAnimationController.cpp:
3911         (WebCore::CSSAnimationControllerPrivate::animationTimerFired): If
3912         we've been told that we need a layout, and we have one pending, then
3913         force it before doing the rest of the animation logic.
3914         (WebCore::CSSAnimationController::updateAnimations): Check if the
3915         CompositeAnimation depends on layout, and tell the private controller
3916         that it should check for the necessity of a layout as the animation
3917         timer fires.
3918
3919         * page/animation/CompositeAnimation.cpp:
3920         (WebCore::CompositeAnimation::animate): Ask the keyframes if this
3921         animation depends on layout.
3922
3923         * page/animation/CompositeAnimation.h:
3924         (WebCore::CompositeAnimation::hasAnimationThatDependsOnLayout):
3925         * page/animation/KeyframeAnimation.cpp:
3926         (WebCore::KeyframeAnimation::KeyframeAnimation):
3927         (WebCore::KeyframeAnimation::computeLayoutDependency): Look at all
3928         the keyframe properties for something that is a translation using
3929         percentages.
3930
3931         * page/animation/KeyframeAnimation.h:
3932
3933 2017-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
3934
3935         Selection around attachment elements should not persist when beginning a drag
3936         https://bugs.webkit.org/show_bug.cgi?id=172319
3937         <rdar://problem/32283008>
3938
3939         Reviewed by Tim Horton.
3940
3941         When beginning to drag an attachment element, save and restore the visible selection when calling out to the
3942         injected bundle for additional data, and when creating the drag image.
3943
3944         Augmented an existing API test: DataInteractionTests.AttachmentElementItemProviders.
3945