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