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