[Cocoa] Expand system-ui to include every item in the Core Text cascade list
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-06-15  Myles C. Maxfield  <mmaxfield@apple.com>
2
3         [Cocoa] Expand system-ui to include every item in the Core Text cascade list
4         https://bugs.webkit.org/show_bug.cgi?id=173043
5         <rdar://problem/21125708>
6
7         Reviewed by Simon Fraser.
8
9         The concept of the system font on Cocoa platforms represents the entire Core Text cascade list.
10         However, previously, WebKit only represented system-ui by pulling out the first item in the Core
11         Text cascade list. Instead, we should make all text rendered with "system-ui" match what the
12         platform would natively render.
13
14         Previously, we walked through the strings in the font-family property and looked them up one by
15         one. However, now we want to abstract this idea of a font family to possibly hold a
16         CTFontDescriptorRef instead of a string. This way, we expand a font-family list of ["fontA",
17         "system-ui", "fontB"] to ["fontA", ... a bunch of CTFontDescriptorRefs ..., "FontB"]. We can
18         then modify the consumer of this object to have two codepaths: the old string-based codepath,
19         and a new, platform-specific codepath which simply embeds the CTFontDesriptorRefs inside a Font
20         object.
21
22         We don't want to simply pull out the family name from each item in the Core Text fallback list
23         because that is a lossy translation. There is more information in these font descriptors which
24         cannot be represented by CSS. Therefore, we must keep the descriptors alive and add the new
25         codepath for them.
26
27         We also don't want to run the CSS font matching algorithm on each member of the Core Text
28         fallback list because it may yield different results from Core Text's font matching algorithm.
29         Our goal is to draw text as closely as possible to the system APIs. If we ran it, we may find
30         a font which is closer to the requested traits, but it would look out of place on the system.
31
32         This new codepath is only enabled on macOS High Sierra and iOS 11, because enabling it on all
33         operating systems would make fixing https://bugs.webkit.org/show_bug.cgi?id=173300 impossible.
34
35         Tests: fast/text/system-font-fallback-emoji.html
36                fast/text/system-font-fallback.html
37                fast/text/system-font-zero-size.html
38
39         * WebCore.xcodeproj/project.pbxproj:
40         * page/MemoryRelease.cpp:
41         (WebCore::releaseNoncriticalMemory):
42         * platform/graphics/FontCascadeFonts.cpp:
43         (WebCore::realizeNextFallback): The consumer of our new data type. Now uses WTF::visit().
44         (WebCore::FontCascadeFonts::realizeFallbackRangesAt): Now that the number of items to test
45         against the current character is larger than the number of strings in the font-family list,
46         we need to update the existing code to use the correct value.
47         * platform/graphics/FontDescription.cpp: Default implementation for non-Cocoa ports.
48         (WebCore::FontDescription::invalidateCaches):
49         (WebCore::FontCascadeDescription::effectiveFamilyCount):
50         (WebCore::FontCascadeDescription::effectiveFamilyAt):
51         * platform/graphics/FontDescription.h: Our new data type is a Variant of AtomicString and a
52         platform-specific class. Cocoa uses a class that holds a CTFontDescriptorRef and other ports
53         use an empty non-constructable class.
54         * platform/graphics/FontFamilySpecificationNull.h: Added. The empty non-constructable
55         class.
56         (WebCore::FontFamilySpecificationNull::fontRanges):
57         * platform/graphics/cocoa/FontCacheCoreText.cpp:
58         (WebCore::fontCacheRegisteredFontsChangedNotificationCallback):
59         (WebCore::FontCache::platformInit): Changing the system language will change the system font
60         fallback list, so we need to listen to this notification. This also matters for
61         FontCache::systemFallbackForCharacters(), so we should build off the same callback we are
62         already using for font installation.
63         (WebCore::invalidateFontCache):
64         * platform/graphics/cocoa/FontDescriptionCocoa.cpp: Added. The platform-specific creation of
65         our CTFontDescriptorRefs. We hold them cached in a SystemFontDatabase.
66         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::CoreTextCascadeListParameters):
67         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::isHashTableDeletedValue):
68         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::operator==):
69         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::hash):
70         (WebCore::SystemFontDatabase::singleton):
71         (WebCore::SystemFontDatabase::systemFontCascadeList):
72         (WebCore::SystemFontDatabase::clear):
73         (WebCore::SystemFontDatabase::SystemFontDatabase):
74         (WebCore::SystemFontDatabase::applyWeightAndItalics):
75         (WebCore::SystemFontDatabase::removeCascadeList):
76         (WebCore::SystemFontDatabase::computeCascadeList):
77         (WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::hash):
78         (WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::equal):
79         (WebCore::isSystemFontString):
80         (WebCore::systemFontParameters):
81         (WebCore::FontDescription::invalidateCaches):
82         (WebCore::FontCascadeDescription::effectiveFamilyCount): We don't store the result of this
83         because it would probably be a bad idea to increase the size of every single FontCascade just
84         in case it might ask for the system font. Most fonts never mention system-ui. Because it's so
85         rare, we can just recalculate the result of this as necessary. This shouldn't be slow because
86         the results are cached.
87         (WebCore::FontCascadeDescription::effectiveFamilyAt):
88         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp: Added.
89         (WebCore::FontFamilySpecificationCoreText::fontRanges): Create a FontRanges from a
90         CTFontDescriptorRef.
91         * platform/graphics/cocoa/FontFamilySpecificationCoreText.h: Added.
92         (WebCore::FontFamilySpecificationCoreText::FontFamilySpecificationCoreText):
93         * platform/graphics/ios/FontCacheIOS.mm:
94         (WebCore::platformFontWithFamilySpecialCase):
95         * platform/graphics/mac/FontCacheMac.mm:
96         (WebCore::platformFontWithFamilySpecialCase):
97
98 2017-06-15  David Kilzer  <ddkilzer@apple.com>
99
100         Revert: [iOS] Generate a simulated crash when the WebThread starts in MobileSafari
101         <https://webkit.org/b/173386>
102         <rdar://problem/32776426>
103
104         Revert r218347 and r218339 since we're going to take a different
105         approach to investigating a crash on the WebThread.
106
107         * WebCore.xcodeproj/project.pbxproj:
108         * platform/ios/CrashReporterSupportSoftLink.h: Remove.
109         * platform/ios/CrashReporterSupportSoftLink.mm: Remove.
110         * platform/ios/wak/WebCoreThread.mm:
111         (WebThreadEnable):
112         * platform/spi/ios/CrashReporterSupportSPI.h: Remove.
113
114 2017-06-15  Matt Lewis  <jlewis3@apple.com>
115
116         Unreviewed, rolling out r218365.
117
118         The revision caused API timeouts on all builds.
119
120         Reverted changeset:
121
122         "[WebRTC] Removing a MediaStreamTrack from a MediaStream
123         reports no recording to WebKit clients"
124         https://bugs.webkit.org/show_bug.cgi?id=173398
125         http://trac.webkit.org/changeset/218365
126
127 2017-06-15  Simon Fraser  <simon.fraser@apple.com>
128
129         Allow use of Layout* TextStream operators in WebKit2
130         https://bugs.webkit.org/show_bug.cgi?id=173440
131
132         Reviewed by Zalan Bujtas.
133
134         Export TextStream& operator<< for LayoutPoint, LayoutSize and LayoutRect so that
135         WebKit2 can log them.
136
137         Use #pragma once in these geometry headers.
138
139         * platform/graphics/FloatPoint.h:
140         * platform/graphics/FloatRect.h:
141         * platform/graphics/FloatSize.h:
142         * platform/graphics/IntPoint.h:
143         * platform/graphics/IntRect.h:
144         * platform/graphics/IntSize.h:
145         * platform/graphics/LayoutPoint.h:
146         * platform/graphics/LayoutRect.h:
147         * platform/graphics/LayoutSize.h:
148
149 2017-06-15  Antoine Quint  <graouts@apple.com>
150
151         Modern media controls tests error in Button.js
152         https://bugs.webkit.org/show_bug.cgi?id=173439
153
154         Reviewed by Dean Jackson.
155
156         Tests would sometime yield an error when commit() would be called and the _imageSource
157         ivar hadn't been set. To more safely commit the mask image when it's loaded, we now use
158         a markDirtyProperty() call and a commitProperty() override to ensure that we cover the
159         case where we want to commit the mask image, and for other commits not to have to worry
160         about the mask image being defined.
161
162         * Modules/modern-media-controls/controls/button.js:
163         (Button.prototype.commitProperty):
164         (Button.prototype._updateImage):
165         (Button.prototype.commit): Deleted.
166
167 2017-06-15  Jer Noble  <jer.noble@apple.com>
168
169         [WebRTC] Removing a MediaStreamTrack from a MediaStream reports no recording to WebKit clients
170         https://bugs.webkit.org/show_bug.cgi?id=173398
171         <rdar://problem/32592961>
172
173         Reviewed by Eric Carlson.
174
175         API Test: Tests/WebKit2/MediaStreamTrackDetached.mm
176
177         Move the definition of a MediaStream as a MediaProducer from the stream itself to its constituent
178         MediaStreamTracks. This ensures that, even if a MediaStreamTrack is removed from its stream, the
179         document (and thus the clients) are notified that media capture is still occurring.
180
181         Though MediaStream is no longer a MediaProducer, it still uses the MediaProducer's state concept
182         to determine when to fire events. However it's mediaState() implementation will be moved into
183         MediaStreamTrack, and will instead simply bitwise-or together each of it's track's mediaState().
184
185         The MediaStream notifies the document that its state has changed asynchronously, so do the same
186         for MediaStreamTrack (which reduces the number of calls to the client when changes all occur
187         during a single run loop).
188
189         Because the MediaStreamTrackPrivate may be started externally (not by the MediaStreamTrack directly),
190         add a new client method that notifies observers when the track has been started, and the
191         MediaStreamTrack will use this notification to update the document with it's new mediaState().
192
193         * Modules/mediastream/MediaStream.cpp:
194         (WebCore::MediaStream::MediaStream):
195         (WebCore::MediaStream::~MediaStream):
196         (WebCore::MediaStream::mediaState):
197         (WebCore::MediaStream::statusDidChange):
198         (WebCore::MediaStream::characteristicsChanged):
199         (WebCore::MediaStream::pageMutedStateDidChange): Deleted.
200         * Modules/mediastream/MediaStream.h:
201         * Modules/mediastream/MediaStreamTrack.cpp:
202         (WebCore::MediaStreamTrack::MediaStreamTrack):
203         (WebCore::MediaStreamTrack::~MediaStreamTrack):
204         (WebCore::MediaStreamTrack::pageMutedStateDidChange):
205         (WebCore::MediaStreamTrack::mediaState):
206         (WebCore::MediaStreamTrack::trackStarted):
207         (WebCore::MediaStreamTrack::configureTrackRendering):
208         (WebCore::MediaStreamTrack::stop):
209         (WebCore::MediaStreamTrack::document):
210         * Modules/mediastream/MediaStreamTrack.h:
211         (WebCore::MediaStreamTrack::source):
212         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
213         * platform/mediastream/MediaStreamPrivate.cpp:
214         (WebCore::MediaStreamPrivate::trackStarted):
215         * platform/mediastream/MediaStreamPrivate.h:
216         * platform/mediastream/MediaStreamTrackPrivate.cpp:
217         (WebCore::MediaStreamTrackPrivate::sourceStarted):
218         * platform/mediastream/MediaStreamTrackPrivate.h:
219         * platform/mediastream/RealtimeMediaSource.cpp:
220         (WebCore::RealtimeMediaSource::start):
221         * platform/mediastream/RealtimeMediaSource.h:
222
223 2017-06-15  Jonathan Bedard  <jbedard@apple.com>
224
225         Unreviewed build fix after r218336
226
227         * platform/spi/cocoa/PassKitSPI.h: Add missing #ifdefs for Internal builds.
228
229 2017-06-15  Antoine Quint  <graouts@apple.com>
230
231         Ensure we only log changes to the ScriptedAnimationController suspended state in debug builds
232         https://bugs.webkit.org/show_bug.cgi?id=173423
233
234         Reviewed by Tim Horton.
235
236         We added logging for when the suspended state of the scripted animation controller would change in
237         webkit.org/b/173326. It was meant to only be enabled in debug builds and we actually did the wrong
238         thing and enabled it in non-debug builds.
239
240         We also added a setting that wasn't used and that we are removing here.
241
242         * dom/ScriptedAnimationController.cpp:
243         (WebCore::ScriptedAnimationController::logSuspendCount):
244         * page/Settings.in:
245         * testing/InternalSettings.cpp:
246         (WebCore::InternalSettings::resetToConsistentState):
247         (WebCore::InternalSettings::shouldLogScritedAnimationControllerSuspensionChange): Deleted.
248         (WebCore::InternalSettings::setShouldLogScritedAnimationControllerSuspensionChange): Deleted.
249         * testing/InternalSettings.h:
250         * testing/InternalSettings.idl:
251
252 2017-06-15  David Kilzer  <ddkilzer@apple.com>
253
254         Build fix: [iOS] Generate a simulated crash when the WebThread starts in MobileSafari
255         <https://webkit.org/b/173386>
256         <rdar://problem/32776426>
257
258         * platform/ios/CrashReporterSupportSoftLink.h:
259         * platform/ios/CrashReporterSupportSoftLink.mm:
260         * platform/ios/wak/WebCoreThread.mm:
261         (WebThreadEnable): Log to the console on iOS Simulator.
262         * platform/spi/ios/CrashReporterSupportSPI.h:
263         - CrashReporterSupport.h is not available on iOS Simulator, so
264           restrict to iOS hardware only.
265
266 2017-06-15  Chris Dumez  <cdumez@apple.com>
267
268         Unreviewed, rolling out r218318.
269
270         Seems to have caused an 11% PLT regression. Rolling out to
271         confirm.
272
273         Reverted changeset:
274
275         "Don't always recalc the style of display: contents elements."
276         https://bugs.webkit.org/show_bug.cgi?id=172753
277         http://trac.webkit.org/changeset/218318
278
279 2017-06-15  Wenson Hsieh  <wenson_hsieh@apple.com>
280
281         Using -[WebItemProviderPasteboard setItemProviders:] to swap out item providers before a drop breaks item provider loading
282         https://bugs.webkit.org/show_bug.cgi?id=173338
283         <rdar://problem/32777720>
284
285         Reviewed by Tim Horton.
286
287         Currently, replacing the list of UIItemProviders right before a drop is handled results in
288         WebItemProviderPasteboard failing to load non-"public.content"-conformant items. This is because DragController
289         computes and sends to the UI process a list of UTIs to load (preferredTypeIdentifiers: one type identifier for
290         each item provider in WebItemProviderPasteboard). However, if the list of item providers changes immediately
291         before a drop is performed, WebItemProviderPasteboard will get into an inconsistent state where it has a
292         different number of preferred type identifiers to load than available item providers. This causes
293         WebItemProviderPasteboard to fail when choosing what type identifiers to load from each item provider.
294
295         To fix this, we instead have the web process propagate a list of supported type identifiers to the UI process,
296         which is a property of only the drop destination rather than both the destination and item providers. When
297         performing a drop, we then use the current item providers on WebItemProviderPasteboard to consult this list of
298         supported type identifiers to resolve our list of preferred type identifiers to load.
299
300         Globally renames updatePreferredTypeIdentifiers to updateSupportedTypeIdentifiers.
301
302         Tests:
303         DataInteractionTests.ExternalSourceOverrideDropFileUpload
304         DataInteractionTests.ExternalSourceOverrideDropInsertURL
305
306         * page/DragController.cpp:
307         (WebCore::DragController::dragEnteredOrUpdated):
308         (WebCore::DragController::updateSupportedTypeIdentifiersForDragHandlingMethod):
309         (WebCore::DragController::updatePreferredTypeIdentifiersForDragHandlingMethod): Deleted.
310         * page/DragController.h:
311         * page/mac/DragControllerMac.mm:
312         (WebCore::DragController::updateSupportedTypeIdentifiersForDragHandlingMethod):
313         (WebCore::DragController::updatePreferredTypeIdentifiersForDragHandlingMethod): Deleted.
314         * platform/DragData.h:
315         * platform/PasteboardStrategy.h:
316         * platform/PlatformPasteboard.h:
317         * platform/ios/AbstractPasteboard.h:
318         * platform/ios/PlatformPasteboardIOS.mm:
319         (WebCore::PlatformPasteboard::updateSupportedTypeIdentifiers):
320         (WebCore::PlatformPasteboard::updatePreferredTypeIdentifiers): Deleted.
321         * platform/ios/WebItemProviderPasteboard.mm:
322         (-[WebItemProviderPasteboard init]):
323         (-[WebItemProviderPasteboard updateSupportedTypeIdentifiers:]):
324         (-[WebItemProviderPasteboard setItemProviders:]):
325         (-[WebItemProviderPasteboard typeIsAppropriateForSupportedTypes:]):
326         (-[WebItemProviderPasteboard typeIdentifierToLoadForRegisteredTypeIdentfiers:]):
327
328         Add logic to resolve preferred type identifiers from an item providers list of registered type identifiers.
329         This formerly existed on DragData.
330
331         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
332         (-[WebItemProviderPasteboard updatePreferredTypeIdentifiers:]): Deleted.
333         * platform/mac/DragDataMac.mm:
334
335         Remove preferred type identifier resolution logic from DragData.
336
337         (WebCore::typeIsAppropriateForSupportedTypes): Deleted.
338         (WebCore::DragData::updatePreferredTypeIdentifiers): Deleted.
339
340 2017-06-15  Sam Weinig  <sam@webkit.org>
341
342         [WebIDL] Replace general inclusion of JSDOMConvert.h with inclusion of individual converter files to reduce unnecessary inclusion
343         https://bugs.webkit.org/show_bug.cgi?id=173392
344
345         Reviewed by Tim Horton.
346
347         Stop including the umbrella header JSDOMConvert.h in every generated bindings and 
348         instead only include the specific converter needed. Then, go around and add all the
349         now missing includes that used to be obtained transitively.
350
351         * Modules/indexeddb/IDBRequest.cpp:
352         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
353         * Modules/plugins/QuickTimePluginReplacement.mm:
354         * bindings/js/IDBBindingUtilities.cpp:
355         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
356         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
357         * bindings/js/JSCustomElementInterface.cpp:
358         * bindings/js/JSCustomElementRegistryCustom.cpp:
359         * bindings/js/JSDOMConvertBase.h:
360         * bindings/js/JSDOMConvertInterface.h:
361         * bindings/js/JSDOMConvertRecord.h:
362         * bindings/js/JSDOMConvertSequences.h:
363         * bindings/js/JSDOMConvertUnion.h:
364         * bindings/js/JSDOMGlobalObject.h:
365         * bindings/js/JSDOMWindowCustom.cpp:
366         * bindings/js/JSDOMWindowProperties.cpp:
367         * bindings/js/JSDocumentCustom.cpp:
368         * bindings/js/JSErrorHandler.cpp:
369         * bindings/js/JSEventListener.cpp:
370         * bindings/js/JSHTMLCanvasElementCustom.cpp:
371         * bindings/js/JSHTMLDocumentCustom.cpp:
372         * bindings/js/JSHistoryCustom.cpp:
373         * bindings/js/JSMessageEventCustom.cpp:
374         (WebCore::JSMessageEvent::data):
375         * bindings/js/JSMockContentFilterSettingsCustom.cpp:
376         * bindings/js/JSMutationCallback.cpp:
377         * bindings/js/JSXMLHttpRequestCustom.cpp:
378         (WebCore::JSXMLHttpRequest::retrieveResponse):
379         * bindings/js/ScriptGlobalObject.cpp:
380         * bindings/js/SerializedScriptValue.cpp:
381         * bindings/scripts/CodeGeneratorJS.pm:
382         (AddToIncludesForIDLType):
383         (GetJSCAttributesForAttribute):
384         (GenerateEnumerationHeader):
385         (GenerateEnumerationImplementation):
386         (GenerateEnumerationImplementationContent):
387         (GenerateEnumerationsImplementationContent):
388         (GenerateEnumerationHeaderContent):
389         (GenerateEnumerationsHeaderContent):
390         (GenerateDictionaryHeaderContent):
391         (GenerateDictionariesHeaderContent):
392         (GenerateDictionaryImplementationContent):
393         (GenerateDictionariesImplementationContent):
394         (GenerateHeader):
395         (GeneratePropertiesHashTable):
396         (GenerateOverloadDispatcher):
397         (GenerateImplementation):
398         (GenerateAttributeGetterDefinition):
399         (GenerateSerializerDefinition):
400         (GenerateDictionaryHeader):
401         (JSValueToNative):
402         (NativeToJSValueUsingReferences):
403         (NativeToJSValueUsingPointers):
404         (IsValidContextForNativeToJSValue):
405         (NativeToJSValue):
406         (GenerateConstructorDefinition):
407         (ComputeFunctionSpecial):
408         * bindings/scripts/test/JS/JSMapLike.cpp:
409         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
410         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
411         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
412         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
413         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
414         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp:
415         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
416         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
417         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
418         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
419         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
420         * bindings/scripts/test/JS/JSTestEventConstructor.h:
421         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
422         * bindings/scripts/test/JS/JSTestException.cpp:
423         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
424         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
425         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
426         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
427         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
428         * bindings/scripts/test/JS/JSTestInterface.cpp:
429         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
430         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
431         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
432         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
433         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
434         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
435         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
436         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
437         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
438         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
439         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
440         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
441         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
442         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
443         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
444         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
445         * bindings/scripts/test/JS/JSTestNode.cpp:
446         * bindings/scripts/test/JS/JSTestNode.h:
447         * bindings/scripts/test/JS/JSTestObj.cpp:
448         * bindings/scripts/test/JS/JSTestObj.h:
449         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
450         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
451         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
452         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
453         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.h:
454         * bindings/scripts/test/JS/JSTestSerialization.cpp:
455         * bindings/scripts/test/JS/JSTestSerialization.h:
456         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
457         * bindings/scripts/test/JS/JSTestSerializationInherit.h:
458         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
459         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
460         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
461         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
462         * bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
463         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.h:
464         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
465         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
466         * dom/MouseEvent.cpp:
467         * html/HTMLPlugInImageElement.cpp:
468
469 2017-06-14  David Kilzer  <ddkilzer@apple.com>
470
471         [iOS] Generate a simulated crash when the WebThread starts in MobileSafari
472         <https://webkit.org/b/173386>
473         <rdar://problem/32776426>
474
475         Reviewed by Andy Estes.
476
477         * WebCore.xcodeproj/project.pbxproj: Add new files to project.
478         * platform/ios/CrashReporterSupportSoftLink.h: Add.  The using
479         statement is so that we don't have to write
480         WebCore::SimulateCrash() in WebCoreThread.mm since it's
481         functions are not defined inside a WebCore namespace.  I also
482         kept the 'pid' argument despite the style checker warning
483         because it matches the internal method definition.
484         * platform/ios/CrashReporterSupportSoftLink.mm: Add.
485         * platform/ios/wak/WebCoreThread.mm: Sort headers.  Soft link to
486         CrashReporterSupport.framework.
487         (WebThreadEnable): Generate a simulated crash log if the
488         WebThread ever starts in MobileSafari.
489         * platform/spi/ios/CrashReporterSupportSPI.h: Add.  The header
490         isn't safe to include in C++ source, so wrap the import in
491         extern "C" macros.
492
493 2017-06-15  Jonathan Bedard  <jbedard@apple.com>
494
495         Build WebKit with High Sierra (Seed 1)
496         https://bugs.webkit.org/show_bug.cgi?id=173371
497
498         Reviewed by Andy Estes.
499
500         * crypto/CommonCryptoUtilities.h: Added ccRSAPSSPadding to CCAsymmetricPading enum.
501         * platform/spi/cocoa/AVKitSPI.h: Declare AVKit SPI used by WebKit in High Sierra.
502         (-[AVTouchBarPlaybackControlsControlling NS_ENUM]): Added AVTouchBarMediaSelectionOptionType
503         SPI used in WebPlaybackControlManager in High Sierra.
504         * platform/spi/cocoa/PassKitSPI.h: Declare PassKit SPI used by WebKit in High Sierra.
505         (NS_ERROR_ENUM): Added PKPaymentErrorCode used in WebPayment in High Sierra.
506
507 2017-06-15  Youenn Fablet  <youenn@apple.com>
508
509         RTCPeerConnection returns RTCSessionDescription where RTCSessionDescriptionInit would be appropriate
510         https://bugs.webkit.org/show_bug.cgi?id=173118
511         <rdar://problem/32746761>
512
513         Reviewed by Eric Carlson.
514
515         Test: webrtc/createOfferAnswer.html
516
517         Making the promise return a RTCSessionDescription::Init instead of a RTCSessionDescription.
518         This aligns with the spec and is more optimal.
519
520         * Modules/mediastream/PeerConnectionBackend.cpp:
521         (WebCore::PeerConnectionBackend::createOfferSucceeded):
522         (WebCore::PeerConnectionBackend::createAnswerSucceeded):
523         * Modules/mediastream/PeerConnectionBackend.h:
524         * Modules/mediastream/RTCSessionDescription.idl:
525
526 2017-06-15 Emilio Cobos Álvarez  <ecobos@igalia.com>
527
528         Don't always recalc the style of display: contents elements.
529         https://bugs.webkit.org/show_bug.cgi?id=172753
530
531         Reviewed by Antti Koivisto.
532
533         No new tests (no functionality change). This only removes an
534         inefficiency.
535
536         * dom/Element.cpp:
537         (WebCore::Element::existingComputedStyle):
538         * dom/Element.h:
539         * style/RenderTreeUpdater.cpp:
540         (WebCore::RenderTreeUpdater::updateRenderTree):
541         (WebCore::RenderTreeUpdater::updateElementRenderer):
542         * style/StyleTreeResolver.cpp:
543         (WebCore::Style::TreeResolver::resolveElement):
544         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
545         (WebCore::Style::shouldResolveElement):
546         (WebCore::Style::TreeResolver::resolveComposedTree):
547
548 2017-06-14  Antoine Quint  <graouts@apple.com>
549
550         Rebaseline media/modern-media-controls/media-documents
551         https://bugs.webkit.org/show_bug.cgi?id=173394
552
553         Reviewed by Dean Jackson.
554
555         We found two issues related to media documents while rebaselining the dedicated tests.
556
557         First, we needed to expose the --inline-controls-bar-height CSS variable to <video>
558         elements in media documents that are actually showing an audio UI. Previously we would
559         only expose the variable to <audio> elements.
560
561         Also, due to webkit.org/b/173387, we would fail to identify certain media documents as
562         video because the videoTracks weren't set yet when the "loadedmetadata" event would be
563         triggered. So now we also look at the videoWidth and videoHeight properties, which should
564         provide accurate information in the "loadedmetadata" event handler.
565
566         * Modules/modern-media-controls/controls/media-controls.css:
567         (:host(audio), :host(video.media-document.audio), *):
568         (:host(audio), *): Deleted.
569         * Modules/modern-media-controls/media/media-controller.js:
570         (MediaController.prototype.get isAudio):
571
572 2017-06-14  Zalan Bujtas  <zalan@apple.com>
573
574         animations-paused-in-background-page.html and animated-svg-image-removed-from-document-paused.html fail after r218284
575         https://bugs.webkit.org/show_bug.cgi?id=173393
576
577         Reviewed by Simon Fraser.
578
579         Testing cares really about whether the animation has initiated.  
580
581         * platform/graphics/Image.h:
582         (WebCore::Image::animationPending):
583         * testing/Internals.cpp:
584         (WebCore::Internals::isImageAnimating):
585
586 2017-06-14  Dean Jackson  <dino@apple.com>
587
588         Restrict filtered painting across cross-origin boundaries with transforms
589         https://bugs.webkit.org/show_bug.cgi?id=173388
590         <rdar://problem/27362159>
591
592         Reviewed by Simon Fraser.
593
594         Make sure all cases of LayerPaintingInfo maintain the security
595         flag. In this case there was only one new place, and since
596         everything is scalar, there was no need for a real copy constructor.
597
598         Test: http/tests/css/filters-on-iframes-transform.html
599
600         * rendering/RenderLayer.cpp:
601         (WebCore::RenderLayer::paintLayerByApplyingTransform): Make sure the cross
602         origin flag is used in the call to paint the layer children.
603         * rendering/RenderLayer.h: Fix some typos.
604
605 2017-06-14  Commit Queue  <commit-queue@webkit.org>
606
607         Unreviewed, rolling out r218285.
608         https://bugs.webkit.org/show_bug.cgi?id=173391
609
610         API test fails on iOS (Requested by alexchristensen on
611         #webkit).
612
613         Reverted changeset:
614
615         "Add SPI for immediate injection of user scripts"
616         https://bugs.webkit.org/show_bug.cgi?id=173342
617         http://trac.webkit.org/changeset/218285
618
619 2017-06-14  Jer Noble  <jer.noble@apple.com>
620
621         Video flashes black when switching back to a tab https://www.apple.com/homepod/
622         https://bugs.webkit.org/show_bug.cgi?id=173377
623
624         Reviewed by Eric Carlson.
625
626         Previously, we had set the background color of the video layer to black in order to make the rect
627         occupied by the HTMLMediaElement fully opaque. This worked around a graphics corruption bug. Since
628         then, the code in RenderVideo::foregroundIsKnownToBeOpaqueInRect(...) has been fixed to fully account
629         for whether the HTMLMediaElement has a valid frame to display, making the black layer background
630         unnecessary.
631
632         Remove all the instances where we were setting the background color of the video layer to black.
633
634         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
635         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
636         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
637         (WebCore::VideoFullscreenLayerManager::setVideoLayer):
638         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer):
639
640 2017-06-14  Matt Lewis  <jlewis3@apple.com>
641
642         Unreviewed, rolling out r218161.
643
644         Introduced bot API test failures and Layout Test Failures.
645
646         Reverted changeset:
647
648         "[Cocoa] Expand system-ui to include every item in the Core
649         Text cascade list"
650         https://bugs.webkit.org/show_bug.cgi?id=173043
651         http://trac.webkit.org/changeset/218161
652
653 2017-06-14  Alex Christensen  <achristensen@webkit.org>
654
655         Add SPI for immediate injection of user scripts
656         https://bugs.webkit.org/show_bug.cgi?id=173342
657         <rdar://problem/29202285>
658
659         Reviewed by Brady Eidson.
660
661         The new SPI is WKUserContentController._addUserScriptImmediately.
662         It is covered by new API tests.
663
664         * page/Frame.cpp:
665         (WebCore::Frame::injectUserScripts):
666         (WebCore::Frame::injectUserScriptImmediately):
667         Move injection functionality to allow us to call it directly from the new SPI.
668         * page/Frame.h:
669         * page/Page.cpp:
670         (WebCore::Page::forEachPage):
671         * page/Page.h:
672
673 2017-06-14  Zalan Bujtas  <zalan@apple.com>
674
675         Crash in WebCore::RenderStyle::colorIncludingFallback.
676         https://bugs.webkit.org/show_bug.cgi?id=173347
677         <rdar://problem/32675317>
678
679         Reviewed by Chris Dumez.
680
681         Starting an SVG image animation synchronously might trigger recursive style recalc.
682         We should kick off the animation on a zero timer to reduce callstack complexity. 
683
684         Test: svg/as-image/svg-css-animation.html
685
686         * loader/cache/CachedImage.cpp:
687         (WebCore::CachedImage::didAddClient):
688         * platform/graphics/Image.cpp:
689         (WebCore::Image::Image):
690         (WebCore::Image::startAnimationAsynchronously):
691         * platform/graphics/Image.h:
692
693 2017-06-14  Brady Eidson  <beidson@apple.com>
694
695         WKIconLoadingDelegate never gets asked about the default favicon if touch/touch-precomposed icons are in the <head>
696         <rdar://problem/32614328> and https://bugs.webkit.org/show_bug.cgi?id=173376
697
698         Reviewed by Alex Christensen.
699
700         Covered by new API test
701
702         * loader/DocumentLoader.cpp:
703         (WebCore::DocumentLoader::startIconLoading): Previously we applied the default favicon if the set of LinkIcons was empty.
704           Now, apply the default favicon if the set of LinkIcons contains no explicit favicon.
705
706 2017-06-14  Jer Noble  <jer.noble@apple.com>
707
708         Flaky Test: media/media-source/media-source-unnecessary-seek-seeked.html
709         https://bugs.webkit.org/show_bug.cgi?id=173344
710
711         Reviewed by Eric Carlson.
712
713         Separate the concept of "the page has asked us to seek" from "we have asked the
714         media player to seek". When the media engine tells us its ready state has changed
715         after the page has requested a seek, but before the media element has asked its
716         player to perform the seek, we were previously firing a seeked event. Now we'll
717         check this new ivar and see that we aren't expecting a seek to finish yet.
718
719         * html/HTMLMediaElement.cpp:
720         (WebCore::HTMLMediaElement::HTMLMediaElement):
721         (WebCore::HTMLMediaElement::setReadyState):
722         (WebCore::HTMLMediaElement::finishSeek):
723         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
724         * html/HTMLMediaElement.h:
725
726 2017-06-14  Matt Lewis  <jlewis3@apple.com>
727
728         Unreviewed, rolling out r218157.
729
730         This patch caused multiple API failures on iOS Simulator.
731
732         Reverted changeset:
733
734         "@font-face rules with invalid primary fonts never download
735         their secondary fonts"
736         https://bugs.webkit.org/show_bug.cgi?id=173138
737         http://trac.webkit.org/changeset/218157
738
739 2017-06-14  Chris Dumez  <cdumez@apple.com>
740
741         REGRESSION (r217997): mint.com header renders incorrectly when initially loaded
742         https://bugs.webkit.org/show_bug.cgi?id=173302
743         <rdar://problem/32731747>
744
745         Reviewed by Darin Adler.
746
747         r217997 updated ImplicitAnimation::reset() to not call updateStateMachine(AnimationStateInput::RestartAnimation)
748         if the compositeAnimation is suspended. If the compositeAnimation is suspended, we would call
749         updateStateMachine(AnimationStateInput::AnimationStateInput::PlayStatePaused), which was expected to be a no-op.
750         This was needed because otherwise, changing the style of the animated element would restart the animation
751         even though it was supposed to be suspended. One thing I did not realize is that calling
752         updateStateMachine(AnimationStateInput::AnimationStateInput::PlayStatePaused) on an animation that is already
753         in PausedNew state, will cause it to move to PausedWaitResponse state. This is an issue because upon resuming
754         we would call AnimationBase::updatePlayState(AnimPlayStatePlaying) which would return early because
755         AnimationBase::paused() would return false. To address the issue, we no longer call updateStateMachine(PlayStatePaused)
756         in ImplicitAnimation::reset() when the compositeAnimation is suspended, so that the animation stays in
757         PausedNew state until we resume. When we resume, AnimationBase::paused() returns false and we actually resume
758         the animation.
759
760         Tests:
761         fast/animation/css-animation-resuming-when-visible-with-style-change.html
762         fast/animation/css-animation-resuming-when-visible-with-style-change2.html
763
764         * page/animation/ImplicitAnimation.cpp:
765         (WebCore::ImplicitAnimation::reset):
766
767 2017-06-14  Miguel Gomez  <magomez@igalia.com>
768
769         REGRESSION(r216901): ImageDecoders: rendering of large images is broken since r216901
770         https://bugs.webkit.org/show_bug.cgi?id=172502
771
772         Reviewed by Carlos Garcia Campos.
773
774         When using GTK and WPE image decoders, the decoded frames are stored inside a Vector of
775         ImageFrames inside the decoders. These ImageFrames have and ImageBackingStore with the
776         pixels. When a NativeImagePtr is requested, a cairo surface is created from the data
777         in those ImageBackingStores, but the data keeps being owned by the backing stores. Due
778         to this, if the decoder that created the image gets destroyed, the backing stores for
779         the decoded frames get destroyed as well, causing the cairo surfaces that were using
780         that data to contain garbage (and potentially cause a crash).
781
782         To fix this, we change ImageBackingStore so the pixels are stored in a SharedBuffer. The
783         buffer will be reffed everytime a cairo surface is created with it, and the cairo surfaces
784         will unref the buffer when they are destroyed. This way, the pixel data won't be freed
785         while there are cairo surfaces using it.
786
787         No new tests, no behaviour change.
788
789         * platform/graphics/ImageBackingStore.h:
790         (WebCore::ImageBackingStore::setSize):
791         (WebCore::ImageBackingStore::ImageBackingStore):
792         * platform/image-decoders/cairo/ImageBackingStoreCairo.cpp:
793         (WebCore::ImageBackingStore::image):
794
795 2017-06-14  Zan Dobersek  <zdobersek@igalia.com>
796
797         [GStreamer] Align GstBus signal watch priorities with RunLoop dispatches
798         https://bugs.webkit.org/show_bug.cgi?id=173348
799
800         Reviewed by Carlos Garcia Campos.
801
802         When adding GstBus signal watches, use the gst_bus_add_signal_watch_full()
803         function to also specify the GLib priority that's used for the underlying
804         GSource object.
805
806         RunLoopSourcePriority::RunLoopDispatcher should be a good priority value
807         to use here, matching the RunLoop::dispatch() priority that's e.g. used
808         in the MainThreadNotifier class.
809
810         * platform/audio/gstreamer/AudioDestinationGStreamer.cpp:
811         (WebCore::AudioDestinationGStreamer::AudioDestinationGStreamer):
812         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
813         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
814         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
815         (WebCore::AppendPipeline::AppendPipeline):
816
817 2017-06-14  Eric Carlson  <eric.carlson@apple.com>
818
819         [MediaStream iOS] Back camera view rendered upside down when in portrait mode
820         https://bugs.webkit.org/show_bug.cgi?id=173346
821         <rdar://problem/32713675>
822
823         Reviewed by Youenn Fablet.
824
825         * platform/mediastream/mac/AVVideoCaptureSource.mm:
826         (WebCore::AVVideoCaptureSource::computeSampleRotation): Use different rotations for front and
827         back cameras when device is in portrait orientation.
828
829 2017-06-13  Chris Dumez  <cdumez@apple.com>
830
831         Event handlers should not be called in frameless documents
832         https://bugs.webkit.org/show_bug.cgi?id=173233
833
834         Reviewed by Sam Weinig.
835
836         As per the HTML specification [1], for event handlers on elements, we should use the
837         element's document to check if scripting is disabled [2]. Scripting is considered to
838         be disabled if the document has no browsing context (i.e. a frame in WebKit terms).
839
840         In JSLazyEventListener::initializeJSFunction(), instead of using the element's
841         document to do the checks, we would use the script execution context. In most cases,
842         a node's document and its script execution context are the same so this is not an
843         issue. However, if the node's document is a document created via JS, its nodes'
844         script execution context will be the document's context document (i.e the one that
845         created the document, see implementation of Node::scriptExecutionContext()). In those
846         cases, using the wrong document is an issue because the document's context document
847         (aka script execution context) may allow scripting but we still do not want to call
848         the event handler because its document is frameless.
849
850         This impacts documents created by JS, using the following APIs:
851         - DOMParser.parseFromHTML
852         - new Document()
853         - DOMImplementation.createDocument / createHTMLDocument
854         - XHRs whose responseType is Document.
855
856         [1] https://html.spec.whatwg.org/multipage/webappapis.html#getting-the-current-value-of-the-event-handler (step 1.1.)
857         [2] https://html.spec.whatwg.org/multipage/webappapis.html#concept-n-noscript
858
859         Tests: fast/events/event-handler-detached-document-dispatchEvent.html
860                fast/events/event-handler-detached-document.html
861
862         * bindings/js/JSLazyEventListener.cpp:
863         (WebCore::JSLazyEventListener::initializeJSFunction):
864
865 2017-06-13  Antoine Quint  <graouts@apple.com>
866
867         Rebaseline media/modern-media-controls/placard-support
868         https://bugs.webkit.org/show_bug.cgi?id=173340
869
870         Reviewed by Dean Jackson.
871
872         We make a source change to use a "placard" getter/setter to show or hide a placard, making it
873         more convenient to test whether a placard has been set.
874
875         * Modules/modern-media-controls/controls/inline-media-controls.js:
876         (InlineMediaControls.prototype.get placard):
877         (InlineMediaControls.prototype.set placard):
878         (InlineMediaControls.prototype.showPlacard): Deleted.
879         (InlineMediaControls.prototype.hidePlacard): Deleted.
880         * Modules/modern-media-controls/media/placard-support.js:
881         (PlacardSupport.prototype._updatePlacard):
882         (PlacardSupport):
883
884 2017-06-11  Antoine Quint  <graouts@apple.com>
885
886         Rebaseline media/modern-media-controls/fullscreen-support
887         https://bugs.webkit.org/show_bug.cgi?id=173199
888
889         Reviewed by Simon Fraser.
890
891         Test: media/modern-media-controls/fullscreen-support/fullscreen-support-press.html
892
893         We no longer need to track the "error" event for FullscreenSupport since we don't actually
894         enable or disable the fullscreen button when an error happens, instead the media controls
895         code will simply not present it since we'll be showing a placard instead.
896
897         * Modules/modern-media-controls/media/fullscreen-support.js:
898         (FullscreenSupport.prototype.get mediaEvents):
899
900 2017-06-13  Matt Rajca  <mrajca@apple.com>
901
902         WebsitePolicies: let clients select specific autoplay quirks
903         https://bugs.webkit.org/show_bug.cgi?id=173343
904
905         Reviewed by Alex Christensen.
906
907         Tests: Updated API tests accordingly to use new values.
908
909         Replace the 'allowsAutoplayQuirks' bool with an OptionSet so clients can selectively
910         pick auto-play quirks.
911
912         * dom/Document.cpp:
913         (WebCore::Document::processingUserGestureForMedia):
914         * html/HTMLMediaElement.cpp:
915         (WebCore::needsAutoplayPlayPauseEventsQuirk):
916         * loader/DocumentLoader.h:
917         (WebCore::DocumentLoader::allowedAutoplayQuirks):
918         (WebCore::DocumentLoader::setAllowedAutoplayQuirks):
919         (WebCore::DocumentLoader::allowsAutoplayQuirks): Deleted.
920         (WebCore::DocumentLoader::setAllowsAutoplayQuirks): Deleted.
921
922 2017-06-13  Zalan Bujtas  <zalan@apple.com>
923
924         Synchronous media query callbacks on nested frames could produced a detached FrameView.
925         https://bugs.webkit.org/show_bug.cgi?id=173330
926
927         Reviewed by Simon Fraser.
928
929         This patch fixes the crash when the nested frame's media query callback triggers navigation on the mainframe.
930         webkit.org/b/173329 is to track whether we should allow synchronous callback firing from FrameView::layout(). 
931
932         Covered by show-modal-dialog-during-execCommand.html.
933
934         * page/FrameView.cpp:
935         (WebCore::FrameView::layout):
936
937 2017-06-13  Chris Fleizach  <cfleizach@apple.com>
938
939         AX[macOS]: Expose Inline property as an accessibility attribute
940         https://bugs.webkit.org/show_bug.cgi?id=173131
941         <rdar://problem/32667686>
942
943         Reviewed by Joanmarie Diggs.
944
945         Expose whether a renderer is inline so that VoiceOver can make better use of that data when deciding what to output.
946
947         Test: accessibility/mac/inline-text-attribute.html
948
949         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
950         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
951
952 2017-06-13  Jon Davis  <jond@apple.com>
953
954         Update Subresource Integrity status to Supported In Preview
955         https://bugs.webkit.org/show_bug.cgi?id=173324
956
957         Reviewed by Sam Weinig.
958
959         * features.json:
960
961 2017-06-13  Antoine Quint  <graouts@apple.com>
962
963         Add logging for layout tests when rAF callbacks get suspended and resumed
964         https://bugs.webkit.org/show_bug.cgi?id=173326
965
966         Reviewed by Simon Fraser.
967
968         In order to help diagnose webkit.org/b/168409 we log the ScriptedAnimationController
969         suspend count when it changes and log the backtrace so that we may understand why it
970         fails to be set back to 0 when some modern-media-controls tests run.
971
972         * dom/ScriptedAnimationController.cpp:
973         (WebCore::ScriptedAnimationController::suspend):
974         (WebCore::ScriptedAnimationController::resume):
975         (WebCore::ScriptedAnimationController::logSuspendCount):
976         * dom/ScriptedAnimationController.h:
977         * page/Settings.in:
978         * testing/InternalSettings.cpp:
979         (WebCore::InternalSettings::resetToConsistentState):
980         (WebCore::InternalSettings::shouldLogScritedAnimationControllerSuspensionChange):
981         (WebCore::InternalSettings::setShouldLogScritedAnimationControllerSuspensionChange):
982         * testing/InternalSettings.h:
983         * testing/InternalSettings.idl:
984
985 2017-06-13  Jer Noble  <jer.noble@apple.com>
986
987         Crash when MSE backed media element changes src/srcObject during PiP
988         https://bugs.webkit.org/show_bug.cgi?id=173288
989
990         Reviewed by Alex Christensen.
991
992         Tear down the MediaPlayerPrivateMediaSourceAVFObjC's layers fully whe the player
993         is destroyed, which includes removing the player's AVSampleBufferDisplayLayer from
994         the HTMLMediaElement's fullscreen layer.
995
996         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
997         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::~MediaPlayerPrivateMediaSourceAVFObjC):
998
999 2017-06-13  Daniel Bates  <dabates@apple.com>
1000
1001         Implement W3C Secure Contexts Draft Specification
1002         https://bugs.webkit.org/show_bug.cgi?id=158121
1003         <rdar://problem/26012994>
1004
1005         Reviewed by Brent Fulgham.
1006
1007         Part 4
1008
1009         Adds runtime enabled feature flag, isSecureContextAttributeEnabled, to toggle exposing
1010         the global object property isSecureContext (defaults: true - expose the property).
1011
1012         Test: security/isSecureContext-disabled.html
1013
1014         * page/RuntimeEnabledFeatures.h:
1015         (WebCore::RuntimeEnabledFeatures::setIsSecureContextAttributeEnabled):
1016         (WebCore::RuntimeEnabledFeatures::isSecureContextAttributeEnabled):
1017         * page/WindowOrWorkerGlobalScope.idl:
1018
1019 2017-06-13  Jer Noble  <jer.noble@apple.com>
1020
1021         Protect lifetime of media element during HTMLMediaElement::notifyAboutPlaying()
1022         https://bugs.webkit.org/show_bug.cgi?id=173320
1023         <rdar://problem/32590276>
1024
1025         Reviewed by Brent Fulgham.
1026
1027         * html/HTMLMediaElement.cpp:
1028         (WebCore::HTMLMediaElement::notifyAboutPlaying):
1029
1030 2017-06-13  Youenn Fablet  <youenn@apple.com>
1031
1032         getReceivers() should return transceivers that have only an active receiver
1033         https://bugs.webkit.org/show_bug.cgi?id=173313
1034
1035         Reviewed by Alex Christensen.
1036
1037         Test: webrtc/video-receivers.html
1038
1039         Creating transceivers for receivers created from an offer.
1040         Setting these as recvonly.
1041
1042         * Modules/mediastream/RTCRtpTransceiver.h:
1043         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1044         (WebCore::LibWebRTCPeerConnectionBackend::videoReceiver):
1045         (WebCore::LibWebRTCPeerConnectionBackend::audioReceiver):
1046
1047 2017-06-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1048
1049         Unable to paste text that was copied from a page into the universal search field
1050         https://bugs.webkit.org/show_bug.cgi?id=173293
1051         <rdar://problem/32440918>
1052
1053         Reviewed by Ryosuke Niwa.
1054
1055         Vend "public.utf8-plain-text" and "public.utf16-plain-text" as additional representations on the pasteboard when
1056         copying both rich and plain web content in PlatformPasteboardIOS.mm. This is because UITextView no longer
1057         supports pasting "public.text" as text in iOS 11.
1058
1059         Tests:
1060         UIPasteboardTests.CopyPlainTextWritesConcreteTypes
1061         UIPasteboardTests.CopyRichTextWritesConcreteTypes
1062
1063         * platform/ios/PasteboardIOS.mm:
1064         (WebCore::Pasteboard::writePlainText):
1065         * platform/ios/PlatformPasteboardIOS.mm:
1066         (WebCore::PlatformPasteboard::write):
1067
1068 2017-06-13  Sam Weinig  <sam@webkit.org>
1069
1070         Rename JSDOMWindowShell to JSDOMWindowProxy to match the HTML5 spec.
1071         https://bugs.webkit.org/show_bug.cgi?id=80733
1072
1073         Reviewed by Chris Dumez.
1074
1075         Goodbye dear shell.
1076
1077         * CMakeLists.txt:
1078         * WebCore.xcodeproj/project.pbxproj:
1079         * bindings/js/DOMWrapperWorld.cpp:
1080         (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
1081         (WebCore::DOMWrapperWorld::clearWrappers):
1082         * bindings/js/DOMWrapperWorld.h:
1083         (WebCore::DOMWrapperWorld::didCreateWindowProxy):
1084         (WebCore::DOMWrapperWorld::didDestroyWindowProxy):
1085         (WebCore::DOMWrapperWorld::didCreateWindowShell): Deleted.
1086         (WebCore::DOMWrapperWorld::didDestroyWindowShell): Deleted.
1087         * bindings/js/JSBindingsAllInOne.cpp:
1088         * bindings/js/JSDOMWindowBase.cpp:
1089         (WebCore::JSDOMWindowBase::JSDOMWindowBase):
1090         (WebCore::JSDOMWindowBase::finishCreation):
1091         (WebCore::JSDOMWindowBase::willRemoveFromWindowProxy):
1092         (WebCore::JSDOMWindowBase::proxy):
1093         (WebCore::toJSDOMWindow):
1094         (WebCore::JSDOMWindowBase::willRemoveFromWindowShell): Deleted.
1095         (WebCore::JSDOMWindowBase::shell): Deleted.
1096         * bindings/js/JSDOMWindowBase.h:
1097         (WebCore::toJS):
1098         (WebCore::toJSDOMWindow):
1099         * bindings/js/JSDOMWindowCustom.cpp:
1100         (WebCore::JSDOMWindow::toWrapped):
1101         * bindings/js/JSDOMWindowCustom.h:
1102         * bindings/js/JSDOMWindowProperties.h:
1103         (WebCore::JSDOMWindowProperties::JSDOMWindowProperties):
1104         * bindings/js/JSDOMWindowProxy.cpp: Copied from WebCore/bindings/js/JSDOMWindowShell.cpp.
1105         (WebCore::JSDOMWindowProxy::JSDOMWindowProxy):
1106         (WebCore::JSDOMWindowProxy::finishCreation):
1107         (WebCore::JSDOMWindowProxy::destroy):
1108         (WebCore::JSDOMWindowProxy::setWindow):
1109         (WebCore::JSDOMWindowProxy::wrapped):
1110         (WebCore::JSDOMWindowProxy::toWrapped):
1111         (WebCore::toJS):
1112         (WebCore::toJSDOMWindowProxy):
1113         (WebCore::JSDOMWindowShell::JSDOMWindowShell): Deleted.
1114         (WebCore::JSDOMWindowShell::finishCreation): Deleted.
1115         (WebCore::JSDOMWindowShell::destroy): Deleted.
1116         (WebCore::JSDOMWindowShell::setWindow): Deleted.
1117         (WebCore::JSDOMWindowShell::wrapped): Deleted.
1118         (WebCore::JSDOMWindowShell::toWrapped): Deleted.
1119         (WebCore::toJSDOMWindowShell): Deleted.
1120         * bindings/js/JSDOMWindowProxy.h: Copied from WebCore/bindings/js/JSDOMWindowShell.h.
1121         (WebCore::JSDOMWindowProxy::create):
1122         (WebCore::toJSDOMWindowProxy):
1123         (WebCore::JSDOMWindowShell::window): Deleted.
1124         (WebCore::JSDOMWindowShell::create): Deleted.
1125         (WebCore::JSDOMWindowShell::createStructure): Deleted.
1126         (WebCore::JSDOMWindowShell::world): Deleted.
1127         (WebCore::toJSDOMWindowShell): Deleted.
1128         * bindings/js/JSDOMWindowShell.cpp: Removed.
1129         * bindings/js/JSDOMWindowShell.h: Removed.
1130         * bindings/js/JSEventTargetCustom.cpp:
1131         (WebCore::JSEventTarget::toWrapped):
1132         * bindings/js/JSHTMLDocumentCustom.cpp:
1133         (WebCore::JSHTMLDocument::open):
1134         * bindings/js/ScheduledAction.cpp:
1135         (WebCore::ScheduledAction::execute):
1136         * bindings/js/ScriptCachedFrameData.cpp:
1137         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
1138         (WebCore::ScriptCachedFrameData::restore):
1139         * bindings/js/ScriptController.cpp:
1140         (WebCore::collectGarbageAfterWindowProxyDestruction):
1141         (WebCore::ScriptController::~ScriptController):
1142         (WebCore::ScriptController::destroyWindowProxy):
1143         (WebCore::ScriptController::createWindowProxy):
1144         (WebCore::ScriptController::evaluateInWorld):
1145         (WebCore::ScriptController::loadModuleScriptInWorld):
1146         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
1147         (WebCore::ScriptController::evaluateModule):
1148         (WebCore::ScriptController::windowProxies):
1149         (WebCore::ScriptController::clearWindowProxiesNotMatchingDOMWindow):
1150         (WebCore::ScriptController::setDOMWindowForWindowProxy):
1151         (WebCore::ScriptController::initScript):
1152         (WebCore::ScriptController::setupModuleScriptHandlers):
1153         (WebCore::ScriptController::eventHandlerPosition):
1154         (WebCore::ScriptController::enableEval):
1155         (WebCore::ScriptController::disableEval):
1156         (WebCore::ScriptController::canAccessFromCurrentOrigin):
1157         (WebCore::ScriptController::attachDebugger):
1158         (WebCore::ScriptController::updateDocument):
1159         (WebCore::ScriptController::cacheableBindingRootObject):
1160         (WebCore::ScriptController::bindingRootObject):
1161         (WebCore::ScriptController::createRootObject):
1162         (WebCore::ScriptController::collectIsolatedContexts):
1163         (WebCore::ScriptController::windowScriptNPObject):
1164         (WebCore::ScriptController::jsObjectForPluginElement):
1165         (WebCore::ScriptController::cleanupScriptObjectsForPlugin):
1166         (WebCore::ScriptController::clearScriptObjects):
1167         (WebCore::ScriptController::executeIfJavaScriptURL):
1168         (WebCore::collectGarbageAfterWindowShellDestruction): Deleted.
1169         (WebCore::ScriptController::destroyWindowShell): Deleted.
1170         (WebCore::ScriptController::createWindowShell): Deleted.
1171         (WebCore::ScriptController::windowShells): Deleted.
1172         (WebCore::ScriptController::clearWindowShellsNotMatchingDOMWindow): Deleted.
1173         (WebCore::ScriptController::setDOMWindowForWindowShell): Deleted.
1174         * bindings/js/ScriptController.h:
1175         (WebCore::ScriptController::windowProxy):
1176         (WebCore::ScriptController::existingWindowProxy):
1177         (WebCore::ScriptController::globalObject):
1178         (WebCore::ScriptController::windowShell): Deleted.
1179         (WebCore::ScriptController::existingWindowShell): Deleted.
1180         * bindings/js/ScriptControllerMac.mm:
1181         (WebCore::ScriptController::windowScriptObject):
1182         * bindings/js/ScriptState.cpp:
1183         (WebCore::mainWorldExecState):
1184         * bindings/scripts/CodeGeneratorJS.pm:
1185         (GenerateHeader):
1186         (GenerateOverloadDispatcher):
1187         (GenerateImplementation):
1188         * bindings/scripts/test/JS/JSTestObj.cpp:
1189         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher):
1190         * loader/FrameLoader.cpp:
1191         (WebCore::FrameLoader::clear):
1192         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
1193         * page/Frame.cpp:
1194         * page/csp/ContentSecurityPolicy.cpp:
1195         (WebCore::ContentSecurityPolicy::didCreateWindowProxy):
1196         (WebCore::ContentSecurityPolicy::didCreateWindowShell): Deleted.
1197         * page/csp/ContentSecurityPolicy.h:
1198
1199 2017-06-13  Chris Dumez  <cdumez@apple.com>
1200
1201         Unreviewed, fix typo in variable introduced in r218108.
1202
1203         * page/cocoa/MemoryReleaseCocoa.mm:
1204         (WebCore::platformReleaseMemory):
1205         (WebCore::registerSQLiteMemoryPressureHandler):
1206
1207 2017-06-13  Joanmarie Diggs  <jdiggs@igalia.com>
1208
1209         AX: [ATK] Implement missing AtkRelation types
1210         https://bugs.webkit.org/show_bug.cgi?id=155494
1211
1212         Reviewed by Darin Adler.
1213
1214         Add methods for getting the element(s) which reference a particular element via an
1215         ARIA attribute. Then use those methods to identify and expose the expected reverse/
1216         reciprocal AtkRelationType and targets. Also add ATK support for aria-owns.
1217
1218         Use SpaceSplitString in AccessibilityObject::elementsFromAttribute() so that unexpected
1219         whitespace characters in an attribute's list of ids does not prevent the desired element
1220         from being found.
1221
1222         Lastly, change the return type of AccessibilityObject::identifierAttribute() from a String
1223         to a const AtomicString& for better efficiency.
1224
1225         Tests: accessibility/aria-owns.html
1226                accessibility/gtk/relation-types.html
1227
1228         * accessibility/AccessibilityObject.cpp:
1229         (WebCore::AccessibilityObject::identifierAttribute):
1230         (WebCore::AccessibilityObject::elementsFromAttribute):
1231         (WebCore::AccessibilityObject::ariaElementsReferencedByAttribute):
1232         (WebCore::AccessibilityObject::ariaControlsReferencingElements):
1233         (WebCore::AccessibilityObject::ariaDescribedByReferencingElements):
1234         (WebCore::AccessibilityObject::ariaFlowToReferencingElements):
1235         (WebCore::AccessibilityObject::ariaLabelledByReferencingElements):
1236         (WebCore::AccessibilityObject::ariaOwnsReferencingElements):
1237         * accessibility/AccessibilityObject.h:
1238         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1239         (setAtkRelationSetFromCoreObject):
1240
1241 2017-06-13  Gwang Yoon Hwang  <yoon@igalia.com>
1242
1243         [GStreamerGL] Release GstVideoFrame when there is a flush event from the pipeline
1244         https://bugs.webkit.org/show_bug.cgi?id=172427
1245
1246         Reviewed by Žan Doberšek.
1247
1248         Without GStreamerGL MediaPlayerPrivateGStreamer copies the video frame from
1249         the decoder's buffer to the texture to display a video. So it makes possible
1250         to release the GstSample when it got a flush start event to free the decoder's
1251         buffer to the decoder without side-effects.
1252
1253         Unlike the traditional way to render video, GStreamer GL does not copy a
1254         texture from the decoder to the texture mapper's buffer to draw video frame.
1255         It uses same GstMemory with the gst pipeline to manage the texture to prevent
1256         copy operations. So without releasing a layer buffer, there is no way to
1257         return GstMemory to the buffer pool.
1258
1259         This patch releases current GstSample when the player got the flush start
1260         event.  It destructs the platform layer buffer any time there is a flush start
1261         event.
1262
1263         However, it is not enough to release the GstMemory. The platform layer proxy
1264         should copy current buffer to show it to the compositor instead of a blank
1265         frame. It prevents flickerings until getting a new frame after handling flush
1266         events.
1267
1268         No new tests, there shouldn't be behavior changes
1269
1270         * platform/graphics/cairo/ImageBufferCairo.cpp:
1271         (WebCore::ImageBufferData::swapBuffersIfNeeded):
1272         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1273         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
1274         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
1275         (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink): Adds
1276         handler for the flush event.
1277         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1278         * platform/graphics/texmap/BitmapTextureGL.cpp:
1279         (WebCore::BitmapTextureGL::BitmapTextureGL):
1280         (WebCore::BitmapTextureGL::copyFromExternalTexture): Copies
1281         a external texture to the managed texture.
1282         * platform/graphics/texmap/BitmapTextureGL.h:
1283         (WebCore::BitmapTextureGL::create):
1284         To create the managed texture with specific format, this patch adds a
1285         optional parameter for a texture format.
1286         * platform/graphics/texmap/TextureMapper.h:
1287         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
1288         (WebCore::TextureMapperGC3DPlatformLayer::swapBuffersIfNeeded):
1289         * platform/graphics/texmap/TextureMapperGL.cpp:
1290         (WebCore::TextureMapperGL::createTexture):
1291         * platform/graphics/texmap/TextureMapperGL.h:
1292         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
1293         (WebCore::TextureMapperPlatformLayerBuffer::TextureMapperPlatformLayerBuffer):
1294         (WebCore::TextureMapperPlatformLayerBuffer::clone):
1295         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
1296         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
1297         (WebCore::TextureMapperPlatformLayerProxy::appendToUnusedBuffers): Added
1298         to schedule releasing unused buffers in main thread.
1299         (WebCore::TextureMapperPlatformLayerProxy::swapBuffer):
1300         (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
1301         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
1302
1303 2017-06-13  Youenn Fablet  <youenn@apple.com>
1304
1305         Filter SDP from ICE candidates in case of local ICE candidate filtering
1306         https://bugs.webkit.org/show_bug.cgi?id=173120
1307
1308         Reviewed by Eric Carlson.
1309
1310         Covered by updated test.
1311
1312         Adding filtering of local description in getters and createOffer promise.
1313
1314         * Modules/mediastream/MediaEndpointSessionDescription.cpp:
1315         (WebCore::MediaEndpointSessionDescription::toRTCSessionDescription):
1316         * Modules/mediastream/PeerConnectionBackend.cpp:
1317         (WebCore::PeerConnectionBackend::createOfferSucceeded):
1318         (WebCore::filterICECandidate):
1319         (WebCore::PeerConnectionBackend::filterSDP):
1320         * Modules/mediastream/PeerConnectionBackend.h:
1321         * Modules/mediastream/RTCSessionDescription.h:
1322         (WebCore::RTCSessionDescription::setSdp):
1323         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1324         (WebCore::LibWebRTCPeerConnectionBackend::currentLocalDescription):
1325         (WebCore::LibWebRTCPeerConnectionBackend::pendingLocalDescription):
1326         (WebCore::LibWebRTCPeerConnectionBackend::localDescription):
1327
1328 2017-06-12  Myles C. Maxfield  <mmaxfield@apple.com>
1329
1330         [iOS] [macOS] Stop soft-linking Core Text function in iOS 11 and macOS High Sierra
1331         https://bugs.webkit.org/show_bug.cgi?id=173289
1332
1333         Reviewed by Lucas Forschler.
1334
1335         No new tests because there is no behavior change.
1336
1337         * platform/graphics/ios/FontCacheIOS.mm:
1338         (WebCore::platformFontWithFamilySpecialCase):
1339         * platform/graphics/mac/FontCacheMac.mm:
1340         (WebCore::platformFontWithFamilySpecialCase):
1341
1342 2017-06-12  Myles C. Maxfield  <mmaxfield@apple.com>
1343
1344         [Cocoa] Expand system-ui to include every item in the Core Text cascade list
1345         https://bugs.webkit.org/show_bug.cgi?id=173043
1346         <rdar://problem/21125708>
1347
1348         Reviewed by Simon Fraser.
1349
1350         The concept of the system font on Cocoa platforms represents the entire Core Text cascade list.
1351         However, previously, WebKit only represented system-ui by pulling out the first item in the Core
1352         Text cascade list. Instead, we should make all text rendered with "system-ui" match what the
1353         platform would natively render.
1354
1355         Previously, we walked through the strings in the font-family property and looked them up one by
1356         one. However, now we want to abstract this idea of a font family to possibly hold a
1357         CTFontDescriptorRef instead of a string. This way, we expand a font-family list of ["fontA",
1358         "system-ui", "fontB"] to ["fontA", ... a bunch of CTFontDescriptorRefs ..., "FontB"]. We can
1359         then modify the consumer of this object to have two codepaths: the old string-based codepath,
1360         and a new, platform-specific codepath which simply embeds the CTFontDesriptorRefs inside a Font
1361         object.
1362
1363         We don't want to simply pull out the family name from each item in the Core Text fallback list
1364         because that is a lossy translation. There is more information in these font descriptors which
1365         cannot be represented by CSS. Therefore, we must keep the descriptors alive and add the new
1366         codepath for them.
1367
1368         We also don't want to run the CSS font matching algorithm on each member of the Core Text
1369         fallback list because it may yield different results from Core Text's font matching algorithm.
1370         Our goal is to draw text as closely as possible to the system APIs. If we ran it, we may find
1371         a font which is closer to the requested traits, but it would look out of place on the system.
1372
1373         Tests: fast/text/system-font-fallback-emoji.html
1374                fast/text/system-font-fallback.html
1375
1376         * WebCore.xcodeproj/project.pbxproj:
1377         * page/MemoryRelease.cpp:
1378         (WebCore::releaseNoncriticalMemory):
1379         * platform/graphics/FontCascadeFonts.cpp:
1380         (WebCore::realizeNextFallback): The consumer of our new data type. Now uses WTF::visit().
1381         (WebCore::FontCascadeFonts::realizeFallbackRangesAt): Now that the number of items to test
1382         against the current character is larger than the number of strings in the font-family list,
1383         we need to update the existing code to use the correct value.
1384         * platform/graphics/FontDescription.cpp: Default implementation for non-Cocoa ports.
1385         (WebCore::FontDescription::invalidateCaches):
1386         (WebCore::FontCascadeDescription::effectiveFamilyCount):
1387         (WebCore::FontCascadeDescription::effectiveFamilyAt):
1388         * platform/graphics/FontDescription.h: Our new data type is a Variant of AtomicString and a
1389         platform-specific class. Cocoa uses a class that holds a CTFontDescriptorRef and other ports
1390         use an empty non-constructable class.
1391         * platform/graphics/FontFamilySpecificationNull.h: Added. The empty non-constructable
1392         class.
1393         (WebCore::FontFamilySpecificationNull::fontRanges):
1394         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1395         (WebCore::FontCache::platformInit): Changing the system language will change the system font
1396         fallback list, so we need to listen to this notification. This also matters for
1397         FontCache::systemFallbackForCharacters(), so we should build off the same callback we are
1398         already using for font installation.
1399         (WebCore::invalidateFontCache):
1400         * platform/graphics/cocoa/FontDescriptionCocoa.cpp: Added. The platform-specific creation of
1401         our CTFontDescriptorRefs. We hold them cached in a SystemFontDatabase.
1402         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::CoreTextCascadeListParameters):
1403         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::isHashTableDeletedValue):
1404         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::operator==):
1405         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::hash):
1406         (WebCore::SystemFontDatabase::singleton):
1407         (WebCore::SystemFontDatabase::systemFontCascadeList):
1408         (WebCore::SystemFontDatabase::clear):
1409         (WebCore::SystemFontDatabase::SystemFontDatabase):
1410         (WebCore::SystemFontDatabase::applyWeightAndItalics):
1411         (WebCore::SystemFontDatabase::removeCascadeList):
1412         (WebCore::SystemFontDatabase::computeCascadeList):
1413         (WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::hash):
1414         (WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::equal):
1415         (WebCore::isSystemFontString):
1416         (WebCore::systemFontParameters):
1417         (WebCore::FontDescription::invalidateCaches):
1418         (WebCore::FontCascadeDescription::effectiveFamilyCount): We don't store the result of this
1419         because it would probably be a bad idea to increase the size of every single FontCascade just
1420         in case it might ask for the system font. Most fonts never mention system-ui. Because it's so
1421         rare, we can just recalculate the result of this as necessary. This shouldn't be slow because
1422         the results are cached.
1423         (WebCore::FontCascadeDescription::effectiveFamilyAt):
1424         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp: Added.
1425         (WebCore::FontFamilySpecificationCoreText::fontRanges): Create a FontRanges from a
1426         CTFontDescriptorRef.
1427         * platform/graphics/cocoa/FontFamilySpecificationCoreText.h: Added.
1428         (WebCore::FontFamilySpecificationCoreText::FontFamilySpecificationCoreText):
1429         * platform/graphics/ios/FontCacheIOS.mm: Delete the old handling for system-ui.
1430         (WebCore::platformFontWithFamilySpecialCase):
1431         (WebCore::baseSystemFontDescriptor): Deleted.
1432         (WebCore::systemFontModificationAttributes): Deleted.
1433         (WebCore::systemFontDescriptor): Deleted.
1434         * platform/graphics/mac/FontCacheMac.mm: Ditto.
1435         (WebCore::platformFontWithFamilySpecialCase):
1436         (WebCore::toNSFontWeight): Deleted.
1437
1438 2017-06-12  Daewoong Jang  <daewoong.jang@navercorp.com>
1439
1440         Remove WebCore::unloadModule and related data types
1441         https://bugs.webkit.org/show_bug.cgi?id=173231
1442
1443         Reviewed by Darin Adler.
1444
1445         * platform/FileSystem.h:
1446         (WebCore::PlatformModuleVersion::PlatformModuleVersion): Deleted.
1447         * platform/glib/FileSystemGlib.cpp:
1448         (WebCore::unloadModule): Deleted.
1449         * platform/win/FileSystemWin.cpp:
1450         (WebCore::unloadModule): Deleted.
1451
1452 2017-06-12  Jer Noble  <jer.noble@apple.com>
1453
1454         Unreviewed build fix; fix a misspelling in CoreMediaSoftLink.{h,cpp}.
1455
1456         * platform/cf/CoreMediaSoftLink.cpp:
1457         * platform/cf/CoreMediaSoftLink.h:
1458
1459 2017-06-12  Myles C. Maxfield  <mmaxfield@apple.com>
1460
1461         @font-face rules with invalid primary fonts never download their secondary fonts
1462         https://bugs.webkit.org/show_bug.cgi?id=173138
1463         <rdar://problem/32554450>
1464
1465         Reviewed by Simon Fraser.
1466
1467         We have logic in CSSFontAccessor::font() which disallows downloading a CSSFontFace if that CSSFontFace
1468         is already in the Succeeded state. However, it was possible for a succeeded CSSFontFace to still fail
1469         to create a font. In this situation, we wouldn't be able to use the downloaded font, and we wouldn't
1470         try to download the next item in the src: list because the CSSFontFace is succeeded.
1471
1472         This patch strengthens the meaning of the Succeeded state. Previously, it just meant that the bytes
1473         in the file were downloaded successfully. This patch extends this to also mean that the bytes in the
1474         file can be successfully interpreted as a font. This way, the CSSFontFace in the example above won't be
1475         set to the Succeeded state, so we will continue follow the src: list and download the secondary fonts.
1476
1477         This has an added benefit that the CSS Font Loading API's promises will be called more appropriately.
1478         The transition to the Succeeded state will trigger a resolve of the promise. Now, these promises will
1479         only be resolved if the fonts are actually parsed and understood by our text system.
1480
1481         Test: fast/text/font-fallback-invalid-load.html
1482
1483         * css/CSSFontFaceSource.cpp:
1484         (WebCore::CSSFontFaceSource::fontLoaded): Move to the failed state if we can't understand the font
1485         data. This is the crux of this patch.
1486         (WebCore::CSSFontFaceSource::font): This function should only be called if we are in the Succeeded
1487         state, which means now we know we should always be able to understand the bytes of the file. Therefore,
1488         we can change some if statements into ASSERT()s.
1489         * loader/cache/CachedSVGFont.cpp:
1490         (WebCore::CachedSVGFont::createFont): Ditto.
1491         (WebCore::CachedSVGFont::platformDataFromCustomData): Similarly to CSSFontFaceSource::fontLoaded(), this
1492         adds another check to our criteria for transitioning into the Succeeded state, which will guarantee that
1493         later we will always be able to create the font object.
1494
1495 2017-06-12  Chris Dumez  <cdumez@apple.com>
1496
1497         Add Arabic Kasra to list of blacklisted characters when puny-decoding URL
1498         https://bugs.webkit.org/show_bug.cgi?id=173283
1499         <rdar://problem/32725659>
1500
1501         Reviewed by Brent Fulgham.
1502
1503         Add Arabic Kasra to list of blacklisted characters when puny-decoding URL as
1504         it is almost invisible in the URL bar.
1505
1506         Test: fast/url/user-visible/arabic_kasra.html
1507
1508         * platform/mac/WebCoreNSURLExtras.mm:
1509         (WebCore::isLookalikeCharacter):
1510
1511 2017-06-12  Jer Noble  <jer.noble@apple.com>
1512
1513         Screen sleeps while doing WebRTC video
1514         https://bugs.webkit.org/show_bug.cgi?id=173278
1515
1516         Reviewed by Eric Carlson.
1517
1518         HTMLMediaElement triggers changing the sleep disabler token when the media engine
1519         says that its rate has changed; the MediaPlayerPrivateMediaStreamAVFObjC needs to
1520         notify its client (the HTMLMediaElement) that the rate has changed when the stream
1521         is played or paused.
1522
1523         Drive-by fix: Don't set a sleep disabler token (i.e., allow the system and display
1524         to sleep) if the stream is strictly local-capture.
1525
1526         * html/HTMLMediaElement.cpp:
1527         (WebCore::HTMLMediaElement::shouldDisableSleep):
1528         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1529         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play):
1530         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause):
1531
1532 2017-06-12  Jer Noble  <jer.noble@apple.com>
1533
1534         Seeking an MSE video will begin playing audio long before rendering video
1535         https://bugs.webkit.org/show_bug.cgi?id=173269
1536
1537         Reviewed by Eric Carlson.
1538
1539         Add a notification listener which will be messaged when a to-be-displayed sample
1540         is decoded to signal that the 'seeked' event should fire. Consolidate all the various
1541         flush methods to funnel into a single flushVideo().
1542
1543         * platform/cf/CoreMediaSoftLink.cpp:
1544         * platform/cf/CoreMediaSoftLink.h:
1545         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1546         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1547         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1548         (-[WebBufferConsumedContext initWithParent:buffer:]):
1549         (-[WebBufferConsumedContext dealloc]):
1550         (-[WebBufferConsumedContext parent]):
1551         (-[WebBufferConsumedContext buffer]):
1552         (WebCore::bufferWasConsumedCallback):
1553         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
1554         (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
1555         (WebCore::SourceBufferPrivateAVFObjC::flush):
1556         (WebCore::SourceBufferPrivateAVFObjC::flushVideo):
1557         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
1558         (WebCore::SourceBufferPrivateAVFObjC::bufferWasConsumed):
1559         (WebCore::SourceBufferPrivateAVFObjC::willSeek):
1560
1561 2017-06-12  Eric Carlson  <eric.carlson@apple.com>
1562
1563         [MediaStream iOS] Set audio session mode and options when capturing
1564         https://bugs.webkit.org/show_bug.cgi?id=173276
1565         <rdar://problem/32059254>
1566
1567         Reviewed by Jer Noble.
1568
1569         * platform/audio/ios/AudioSessionIOS.mm:
1570         (WebCore::AudioSession::setCategory): Set mode and options so the default output is to the speaker,
1571         and so audio will be routed to bluetooth when appropriate.
1572
1573 2017-06-12  Jeremy Jones  <jeremyj@apple.com>
1574
1575         Remove watchdog timer from WebVideoFullscreenInterfaceAVKit
1576         https://bugs.webkit.org/show_bug.cgi?id=173272
1577         rdar://problem/32260378
1578
1579         Reviewed by Jer Noble.
1580
1581         No new tests because no effect on DOM.
1582
1583         WebVideoFullscreenInterfaceAVKit's watchdog attempts to clean-up fullscreen if the page becomes unresponsive.
1584         However, it is just calling exitfullscreen(), which initiates the animation, but leaves the fullscreen window
1585         in place and doesn't initiate cleanup. This leaves the browser in an unusable state since all events will still
1586         be captured by the fullscren window.
1587
1588         This change uses the same method of hiding fullscreen window as switching tabs does. This will
1589         hide the fullscreen winodw and controller, leaving the browser available for interaction, and the page
1590         can take its time to properly cleanup the fullscreen window while hidden.
1591
1592         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1593         (WebVideoFullscreenInterfaceAVKit::watchdogTimerFired):
1594
1595 2017-06-12  Alex Christensen  <achristensen@webkit.org>
1596
1597         Modernize UserScript.h
1598         https://bugs.webkit.org/show_bug.cgi?id=173273
1599
1600         Reviewed by Tim Horton.
1601
1602         No change in behavior. Moved encoders to UserScript.h. Use more Rvalues.
1603
1604         * page/UserScript.h:
1605         (WebCore::UserScript::UserScript):
1606         (WebCore::UserScript::encode):
1607         (WebCore::UserScript::decode):
1608
1609 2017-06-12  Aaron Chu  <aaron_chu@apple.com>
1610
1611         AX: Video/Audio Player Controls missing group container.
1612         https://bugs.webkit.org/show_bug.cgi?id=171790
1613         <rdar://problem/32008994>
1614
1615         Reviewed by Antoine Quint.
1616
1617         Added aria-label to group controls in media controls.
1618
1619         * English.lproj/modern-media-controls-localized-strings.js:
1620         * Modules/modern-media-controls/controls/controls-bar.js:
1621         * Modules/modern-media-controls/controls/inline-media-controls.js:
1622         (InlineMediaControls):
1623         (InlineMediaControls.prototype.set shouldUseAudioLayout):
1624         (InlineMediaControls.prototype._updateBottomControlsBarLabel):
1625
1626 2017-06-12  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1627
1628         [Curl] Use SynchronousLoaderClient for platformLoadResourceSynchronously on WinCairo
1629         https://bugs.webkit.org/show_bug.cgi?id=173195
1630
1631         Reviewed by Alex Christensen.
1632
1633         * PlatformWinCairo.cmake:
1634         * platform/network/curl/ResourceHandleCurl.cpp:
1635         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1636         * platform/network/curl/SynchronousLoaderClientCurl.cpp: Added.
1637         (WebCore::SynchronousLoaderClient::didReceiveAuthenticationChallenge):
1638         (WebCore::SynchronousLoaderClient::platformBadResponseError):
1639
1640 2017-06-12  Eric Carlson  <eric.carlson@apple.com>
1641
1642         [MediaStream iOS] If a capturing tab is muted while it is in the background, it can not be unmuted
1643         https://bugs.webkit.org/show_bug.cgi?id=173268
1644         <rdar://problem/32259809>
1645
1646         Reviewed by Jer Noble.
1647
1648         No new tests, tested manually.
1649
1650         * Modules/mediastream/MediaStream.cpp:
1651         (WebCore::MediaStream::startProducingData): Mute the private stream if page capture is muted.
1652         (WebCore::MediaStream::mediaState): Set new interrupted state.
1653
1654         * dom/Document.cpp:
1655         (WebCore::Document::notifyMediaCaptureOfVisibilityChanged): Don't track "muted for visibility"
1656         state, let the source center deal with it.
1657         * dom/Document.h:
1658
1659         * page/MediaProducer.h: Add bits for interrupted audio and video capture.
1660
1661         * platform/mediastream/RealtimeMediaSource.cpp:
1662         (WebCore::RealtimeMediaSource::RealtimeMediaSource): Drive-by fix: delete m_suppressNotifications,
1663         it isn't used.
1664         (WebCore::RealtimeMediaSource::setInterrupted): New. Mute capture when an interruption begins,
1665         and unmute when it ends in an unmuted page.
1666         (WebCore::RealtimeMediaSource::setMuted): Do not unmute if interrupted.
1667         (WebCore::RealtimeMediaSource::settingsDidChange): Don't check m_suppressNotifications, it is
1668         never set.
1669         * platform/mediastream/RealtimeMediaSource.h:
1670
1671         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1672         (WebCore::RealtimeMediaSourceCenter::setVideoCapturePageState): Renamed from 
1673         setVideoCaptureMutedForPageVisibility.
1674         (WebCore::RealtimeMediaSourceCenter::setVideoCaptureMutedForPageVisibility): Deleted.
1675         * platform/mediastream/RealtimeMediaSourceCenter.h:
1676
1677         * platform/mediastream/mac/AVMediaCaptureSource.h:
1678         * platform/mediastream/mac/AVMediaCaptureSource.mm:
1679         (WebCore::AVMediaCaptureSource::stopProducingData): Clear m_interruption because the session
1680         has been deleted, so we will never get an "end interruption" notification.
1681         (WebCore::AVMediaCaptureSource::captureSessionIsRunningDidChange): Don't return early if
1682         the muted state needs to be updated.
1683         (WebCore::AVMediaCaptureSource::captureSessionEndInterruption): Return early if the session
1684         has been cleared.
1685         (WebCore::AVMediaCaptureSource::interrupted): New.
1686
1687         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1688         (WebCore::AVVideoCaptureSourceFactory::setVideoCapturePageState): Renamed from 
1689         setVideoCaptureMutedForPageVisibility.
1690         (WebCore::AVVideoCaptureSourceFactory::setVideoCaptureMutedForPageVisibility): Deleted.
1691
1692         * platform/mock/MockRealtimeVideoSource.cpp:
1693         (WebCore::MockRealtimeVideoSourceFactory::setVideoCapturePageState): Ditto.
1694         (WebCore::MockRealtimeVideoSourceFactory::setVideoCaptureMutedForPageVisibility): Deleted.
1695
1696 2017-06-12  Jiewen Tan  <jiewen_tan@apple.com>
1697
1698         [WebCrypto] Remove experimental feature flag of SubtleCrypto
1699         https://bugs.webkit.org/show_bug.cgi?id=173197
1700         <rdar://problem/32688148>
1701
1702         Reviewed by Brent Fulgham.
1703
1704         The SubtleCrypto implementation is no longer experimental and is ready for production use. We are therefore removing the runtime flag.
1705
1706         No tests.
1707
1708         * page/Crypto.idl:
1709         * page/RuntimeEnabledFeatures.h:
1710         (WebCore::RuntimeEnabledFeatures::setSubtleCryptoEnabled): Deleted.
1711         (WebCore::RuntimeEnabledFeatures::subtleCryptoEnabled): Deleted.
1712
1713 2017-06-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1714
1715         [iOS DnD] Allow the injected bundle to add client data when writing an image to the pasteboard
1716         https://bugs.webkit.org/show_bug.cgi?id=173238
1717         <rdar://problem/31943370>
1718
1719         Reviewed by Ryosuke Niwa and Tim Horton.
1720
1721         Add clientTypes and clientData to PasteboardImage, and call out to the injected bundle using
1722         getClientPasteboardDataForRange when writing a PasteboardImage. When generating item providers for dragging in
1723         the UI process in PlatformPasteboard, add any available client data as representations to the initialization
1724         list used to set the WebItemProviderPasteboard.
1725
1726         Test: DataInteraction.InjectedBundleImageElementData
1727
1728         * editing/ios/EditorIOS.mm:
1729         (WebCore::Editor::writeImageToPasteboard):
1730         * platform/Pasteboard.h:
1731         * platform/ios/PlatformPasteboardIOS.mm:
1732         (WebCore::PlatformPasteboard::writeObjectRepresentations):
1733
1734 2017-06-12  Sam Weinig  <sam@webkit.org>
1735
1736         [WebIDL] Re-implement GetOwnPropertySlot[ByIndex] generation to more closely follow WebIDL
1737         https://bugs.webkit.org/show_bug.cgi?id=173229
1738
1739         Reviewed by Chris Dumez.
1740
1741         * WebCore.xcodeproj/project.pbxproj:
1742         * CMakeLists.txt:
1743         * bindings/js/JSBindingsAllInOne.cpp:
1744         Remove JSHTMLFrameSetElementCustom.cpp which is no longer needed.
1745
1746         * bindings/js/JSDOMAbstractOperations.h:
1747         (WebCore::isVisibleNamedProperty):
1748         Add OverrideBuiltins enum as requested by a previous review (and I forgot address) and adopt it
1749         in isVisibleNamedProperty, switch to VMInquiry as we use elsewhere and add a missing FIXME.
1750
1751         (WebCore::accessVisibleNamedProperty):
1752         Add variation of isVisibleNamedProperty that takes a functor and returns either the value the
1753         functor returns, or std::nullopt. This allows getOwnPropertySlot to avoid doing two lookups for
1754         property, once in the named property visibility algorithm and again when it needs the value.
1755
1756         * bindings/js/JSDOMWindowBase.cpp:
1757         * bindings/js/JSDOMWindowBase.h:
1758         * bindings/js/JSDOMWindowShell.cpp:
1759         * bindings/js/JSDOMWindowShell.h:
1760         Standardize toJS functions to match generated code (have one that takes a reference, and does the
1761         cast, and one that takes a pointer, does a null check and calls the one that takes a reference).
1762         
1763         * bindings/js/JSHTMLDocumentCustom.cpp:
1764         (WebCore::JSHTMLDocument::getOwnPropertySlot):.
1765         Update to use the implementation namedItem (which is also used by the generated getOwnPropertySlotByIndex)
1766         and match the updated bindings rules. This cannot yet be generated due to the odd case of the 'open'
1767         property requiring custom treatment. I tried removing this, but it cause tests to fail in a way that indicated
1768         that accessing the lexical global object in the open implementation was not working correctly.
1769
1770         * bindings/js/JSHTMLFrameSetElementCustom.cpp: Removed.
1771         Now generated.
1772
1773         * bindings/scripts/CodeGeneratorJS.pm:
1774         (GenerateIndexedGetter):
1775         Add description from the spec and change to return the computed values rather than
1776         print them to the output array. This will be useful for some clients going forward,
1777         who only want the attributes.
1778
1779         (GenerateNamedGetter):
1780         Add description from the spec and change to return the computed values rather than
1781         print them to the output array. This will be useful for some clients going forward,
1782         who only want the attributes. Also greatly simplifies things as [CustomNamedGetter]s
1783         are no longer needed/supported and the exception / null value checks are performed
1784         elsewhere.
1785
1786         (GenerateNamedGetterLambda):
1787         This generates a lambda functor for use in accessVisibleNamedProperty(...). It
1788         handles calling the named getter implementation, and transforming the result into
1789         an one that can be reasoned about by accessVisibleNamedProperty, specifically,
1790         converting it from using IDL's notion of nullability to std::optional. 
1791
1792         (GenerateGetOwnPropertySlot):
1793         (GenerateGetOwnPropertySlotByIndex):
1794         Add spec annotations and use helper functions. 
1795
1796         (GenerateGetOwnPropertyNames):
1797         Add FIXME about supporting non-contiguous indices (should that ever come up)
1798         and use JSObject explicitly, rather than base, to get the default getOwnPropertyNames
1799         implementation.
1800
1801         (GeneratePut):
1802         Use JSObject explicitly, rather than base, to get the default put implementation.
1803
1804         (GeneratePutByIndex):
1805         Use JSObject explicitly, rather than base, to get the default putByIndex implementation.
1806
1807         (GenerateDefineOwnProperty):
1808         Use JSObject explicitly, rather than base, to get the default getOwnPropertySlot/defineOwnProperty
1809         implementations.
1810
1811         (GenerateDeletePropertyCommon):
1812         Adopt new OverrideBuiltins enum.
1813
1814         (GenerateDeletePropertyDefinition):
1815         Use JSObject explicitly, rather than base, to get the default deleteProperty implementation.
1816
1817         (GenerateDeletePropertyByIndexDefinition):
1818         Use JSObject explicitly, rather than base, to get the default deletePropertyByIndex implementation.
1819
1820         (InstanceOverridesGetOwnPropertySlot):
1821         Remove [CustomNamedGetter] use.
1822  
1823         (GenerateHeader):
1824         Remove [CustomNamedGetter] use and merge InstanceOverridesGetOwnPropertySlotByIndex into
1825         InstanceOverridesGetOwnPropertySlot. Specifying either [CustomGetOwnPropertySlot] or
1826         [CustomGetOwnPropertySlotByIndex] will now declare both hooks.
1827         
1828         (GenerateImplementation):
1829         Rename GenerateGetOwnPropertySlotBody/GenerateGetOwnPropertySlotByIndexBody to remove the 'Body',
1830         and predicate their generation purely on InstanceOverridesGetOwnPropertySlot as noted for the 
1831         reasons above.
1832
1833         (GenerateGetOwnPropertySlotBody): Deleted.
1834         (GenerateGetOwnPropertySlotBodyByIndex): Deleted.
1835         (InstanceOverridesGetOwnPropertySlotByIndex): Deleted.
1836
1837         * bindings/scripts/IDLAttributes.json:
1838         Remove [CustomNamedGetter].
1839
1840         * dom/ExceptionOr.h:
1841         (WebCore::ExceptionOr<ReturnType>::returnValue):
1842         Add a function to peek at the return value
1843
1844         * html/HTMLDocument.h:
1845         * html/HTMLDocument.cpp:
1846         (WebCore::HTMLDocument::clear):
1847         (WebCore::HTMLDocument::captureEvents):
1848         (WebCore::HTMLDocument::releaseEvents):
1849         Move clear up to be with the other obsolete no-op functions. Add spec annotations
1850         to clear up any confusion about why they are no-ops.
1851
1852         (WebCore::HTMLDocument::namedItem):
1853         Add implementation of namedItem based on the one that was in JSDOMHTMLDocumentCustom.cpp.
1854
1855         (WebCore::HTMLDocument::supportedPropertyNames):
1856         Add stub version of supportedPropertyNames with the algorithm we need to implement.
1857         I don't want to change behavior in this patch, and since we have not enumerated the
1858         properties of document in the past, I left this unimplemented for now.
1859
1860         * html/HTMLDocument.idl:
1861         Remove [CustomNamedGetter] and add named getter.
1862
1863         * html/HTMLFrameSetElement.h:
1864         * html/HTMLFrameSetElement.cpp:
1865         (WebCore::HTMLFrameSetElement::namedItem):
1866         Add named getter based on the implementation in JSHTMLFrameSetElementCustom.cpp.
1867
1868         (WebCore::HTMLFrameSetElement::supportedPropertyNames):
1869         As noted above, I don't want to change behavior with this change, so I have left this unimplemented
1870         for now. However, we may not want to implement it at all, as this named getter is not specified and
1871         at least Firefox does not support it.
1872
1873         * html/HTMLFrameSetElement.idl:
1874         Remove [CustomNamedGetter] and add named getter.
1875
1876         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1877         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
1878         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
1879         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
1880         * bindings/scripts/test/JS/JSTestInterface.cpp:
1881         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
1882         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
1883         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
1884         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
1885         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
1886         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
1887         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
1888         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
1889         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
1890         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
1891         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
1892         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
1893         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
1894         * bindings/scripts/test/JS/JSTestNode.cpp:
1895         * bindings/scripts/test/JS/JSTestObj.cpp:
1896         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1897         Update test results.
1898
1899         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: Removed.
1900         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h: Removed.
1901         * bindings/scripts/test/TestCustomNamedGetter.idl: Removed.
1902         Remove test of [CustomNamedGetter] which no longer exists. 
1903
1904 2017-06-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1905
1906         WebItemProviderPasteboard should call its completion block immediately after a synchronous load
1907         https://bugs.webkit.org/show_bug.cgi?id=173225
1908         <rdar://problem/32713144>
1909
1910         Reviewed by Tim Horton.
1911
1912         Ensures that a completion block passed to doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout: will be
1913         invoked immediately, if a synchronous timeout is specified and loading finishes before the synchronous timeout
1914         is reached. To do this, we first factor out the completion logic into a new block. If the synchronous timeout
1915         exists and dispatch_group_wait returns 0 (indicating that the dispatch group finished without hitting the
1916         wait timeout) we simply invoke the block and return early; otherwise, we will register the completion block
1917         using dispatch_group_notify.
1918
1919         Test: DataInteractionTests.WebItemProviderPasteboardLoading
1920
1921         * platform/ios/WebItemProviderPasteboard.mm:
1922         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
1923
1924 2017-06-12  Jeremy Jones  <jeremyj@apple.com>
1925
1926         WebAVPlayerController minTime and maxTime should be calculated properties to provide correct values when streaming.
1927         https://bugs.webkit.org/show_bug.cgi?id=173193
1928         rdar://problem/32684807
1929
1930         Reviewed by Jer Noble.
1931
1932         No new tests because no affect on the DOM. This only affects properties consumed to AVKit.
1933
1934         -minTime and -maxTime should be calculated properties so they supply the exptected values to AVKit while streaming.
1935
1936         * platform/ios/WebAVPlayerController.h:
1937         * platform/ios/WebAVPlayerController.mm:
1938         (-[WebAVPlayerController maxTime]):
1939         (+[WebAVPlayerController keyPathsForValuesAffectingMaxTime]):
1940         (-[WebAVPlayerController minTime]):
1941         (+[WebAVPlayerController keyPathsForValuesAffectingMinTime]):
1942         (-[WebAVPlayerController resetMediaState]):
1943         * platform/ios/WebPlaybackSessionInterfaceAVKit.mm:
1944         (WebCore::WebPlaybackSessionInterfaceAVKit::durationChanged):
1945
1946 2017-06-12  Chris Dumez  <cdumez@apple.com>
1947
1948         Call _sqlite3_purgeEligiblePagerCacheMemory() on memory pressure only if sqlite is initialized
1949         https://bugs.webkit.org/show_bug.cgi?id=173264
1950
1951         Reviewed by Ryosuke Niwa.
1952
1953         Call _sqlite3_purgeEligiblePagerCacheMemory() on memory pressure only if sqlite is initialized.
1954         Otherwise, not only is it no needed, it is also potentially unsafe.
1955
1956         * page/MemoryRelease.cpp:
1957         (WebCore::registerSQLiteMemoryPressureHandler):
1958         * page/MemoryRelease.h:
1959         * page/cocoa/MemoryReleaseCocoa.mm:
1960         (WebCore::platformReleaseMemory):
1961         (WebCore::registerSQLiteMemoryPressureHandler):
1962         * platform/sql/SQLiteDatabase.cpp:
1963         (WebCore::initializeSQLiteIfNecessary):
1964
1965 2017-06-12  Zan Dobersek  <zdobersek@igalia.com>
1966
1967         [GCrypt] Use utility functions in CryptoKeyEC, CryptoKeyRSA
1968         https://bugs.webkit.org/show_bug.cgi?id=173253
1969
1970         Reviewed by Michael Catanzaro.
1971
1972         Use the utility functions from the GCryptUtilities.h header instead
1973         of writing the same code in both CryptoKeyEC and CryptoKeyRSA
1974         implementations. The switches are straightforward, the only difference
1975         is that the GCryptUtilities functions return a std::optional<> object,
1976         meaning we have to address possibly invalid return value.
1977
1978         The mpiData() function is overloaded, making it possible to pass to it
1979         either a gcry_sexp_t or gcry_mpi_t object. Additionally, mpiLength()
1980         function is added, overloading again for gcry_sexp_t and gcry_mpi_t.
1981         This function is used from mpiData() as well as in CryptoKeyRSA when
1982         retrieving the RSA modulus length.
1983
1984         No new tests -- no changes in behavior.
1985
1986         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
1987         (WebCore::CryptoKeyEC::platformExportRaw):
1988         (WebCore::CryptoKeyEC::platformAddFieldElements):
1989         (WebCore::extractMPIData): Deleted.
1990         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
1991         (WebCore::getRSAModulusLength):
1992         (WebCore::getRSAKeyParameter):
1993         (WebCore::CryptoKeyRSA::exportData):
1994         (WebCore::getParameterMPIData): Deleted.
1995         * crypto/gcrypt/GCryptUtilities.h:
1996         (WebCore::mpiLength):
1997         (WebCore::mpiData):
1998
1999 2017-06-09  Ryosuke Niwa  <rniwa@webkit.org>
2000
2001         didMoveToNewDocument doesn't get called on an Attr inside a shadow tree
2002         https://bugs.webkit.org/show_bug.cgi?id=173133
2003
2004         Reviewed by Antti Koivisto.
2005
2006         The bug was caused by moveShadowTreeToNewDocument never calling didMoveToNewDocument on Attr nodes.
2007         Fixed the bug by using the same traversal code as moveTreeToNewScope in moveShadowTreeToNewDocument
2008         by extracting the traversal code as a templatized traverseSubtreeToUpdateTreeScope.
2009
2010         Also removed the code to increment the DOM tree version in moveTreeToNewScope. This code was there
2011         to invalidate the HTML collection caches which used to clear the cache whenever the DOM tree version
2012         changed before r122621 (five years ago! by me). Since we now eagerly invalidate each node list and
2013         HTML collection's caches via NodeListsNodeData::adoptTreeScope and NodeListsNodeData::adoptDocument.
2014
2015         Test: fast/dom/adopt-attr-with-shadow-tree.html
2016
2017         * dom/Node.cpp:
2018         (WebCore::moveNodeToNewDocument): Assert that the node had been adopted to a new document.
2019         (WebCore::traverseSubtreeToUpdateTreeScope): Extracted from moveTreeToNewScope.
2020         (WebCore::moveShadowTreeToNewDocument): Use traverseSubtreeToUpdateTreeScope to adopt each node
2021         to the new document.
2022         (WebCore::Node::moveTreeToNewScope): See above.
2023         * testing/Internals.cpp:
2024         (WebCore::Internals::referencingNodeCount): Added. Used in the newly added regression test.
2025         * testing/Internals.h:
2026         * testing/Internals.idl:
2027
2028 2017-06-11  Dan Bernstein  <mitz@apple.com>
2029
2030         [Mac] Unaligned pointers in static CMBufferCallbacks structs defined in WebCoreDecompressionSession.mm
2031         https://bugs.webkit.org/show_bug.cgi?id=173245
2032
2033         Reviewed by Sam Weinig.
2034
2035         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
2036         (WebCore::WebCoreDecompressionSession::enqueueSample): Prepend 4 bytes of padding to the
2037           structs so that the pointers are properly aligned.
2038
2039 2017-06-11  Tim Horton  <timothy_horton@apple.com>
2040
2041         REGRESSION (r217870): Null deref under PageOverlayController::uninstallPageOverlay using find in page
2042         https://bugs.webkit.org/show_bug.cgi?id=173196
2043         <rdar://problem/32686871>
2044
2045         Reviewed by Simon Fraser.
2046
2047         * page/TextIndicator.cpp:
2048         (WebCore::initializeIndicator):
2049         * page/TextIndicator.h:
2050         The change in r217870 had an expected but not thought-through side-effect
2051         that you cannot create a TextIndicator for far-off-screen elements. This
2052         is a problem for find-in-page, which uses TextIndicator to paint the yellow
2053         highlight before scrolling it into view.
2054
2055         Bring back TextIndicatorOptionDoNotClipToVisibleRect and revert to it for
2056         find in page, since it needs different behavior than something like
2057         drag and drop, which always operates on content near the visible viewport.
2058
2059 2017-06-10  Dan Bernstein  <mitz@apple.com>
2060
2061         Reverted r218056 because it made the IDE reindex constantly.
2062
2063         * Configurations/DebugRelease.xcconfig:
2064
2065 2017-06-10  Dan Bernstein  <mitz@apple.com>
2066
2067         [Xcode] With Xcode 9 developer beta, everything rebuilds when switching between command-line and IDE
2068         https://bugs.webkit.org/show_bug.cgi?id=173223
2069
2070         Reviewed by Sam Weinig.
2071
2072         The rebuilds were happening due to a difference in the compiler options that the IDE and
2073         xcodebuild were specifying. Only the IDE was passing the -index-store-path option. To make
2074         xcodebuild pass that option, too, set CLANG_INDEX_STORE_ENABLE to YES if it is unset, and
2075         specify an appropriate path in CLANG_INDEX_STORE_PATH.
2076
2077         * Configurations/DebugRelease.xcconfig:
2078
2079 2017-06-10  Dan Bernstein  <mitz@apple.com>
2080
2081         [macOS] REGRESSION: Link drag images blend into the background in Sierra and earlier
2082         https://bugs.webkit.org/show_bug.cgi?id=172933
2083         <rdar://problem/32580649>
2084
2085         Reviewed by Tim Horton.
2086
2087         * platform/mac/DragImageMac.mm:
2088         (WebCore::createDragImageForLink): When targeting macOS Sierra and earlier, give the link
2089           drag image a drop shadow that resembles the one that macOS High Sierra applies to drag
2090           image layers.
2091
2092 2017-06-10  Andy Estes  <aestes@apple.com>
2093
2094         [QuickLook] PreviewLoader needs to check if its ResourceLoader has reached the terminal state before calling didReceiveResponse() and friends
2095         https://bugs.webkit.org/show_bug.cgi?id=173190
2096         <rdar://problem/31360659>
2097
2098         Reviewed by Brady Eidson.
2099
2100         WebPreviewLoader's SubresourceLoader can reach a terminal state while data is loading from
2101         QLPreviewConverter (the user can cancel, for instance). We can't call functions like
2102         didReceiveResponse() in this state, because the loader no longer points to a CachedResource,
2103         leading to null pointer dereferences.
2104
2105         Fix this in WebPreviewLoader by checking if the SubresourceLoader is in a terminal state
2106         before calling didReceiveResponse(), didReceiveData(), didFinishLoading(), and didFail().
2107
2108         Fixes web process crashes in the QuickLook.CancelNavigationAfterResponse API test.
2109
2110         * loader/ios/PreviewLoader.mm:
2111         (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]):
2112         (-[WebPreviewLoader connection:didReceiveData:lengthReceived:]):
2113         (-[WebPreviewLoader connectionDidFinishLoading:]):
2114         (-[WebPreviewLoader connection:didFailWithError:]):
2115
2116 2017-06-09  Chris Dumez  <cdumez@apple.com>
2117
2118         Use WTF::Function instead of std::function in indexeddb code
2119         https://bugs.webkit.org/show_bug.cgi?id=173198
2120
2121         Reviewed by Sam Weinig.
2122
2123         Use WTF::Function instead of std::function in indexeddb code to avoid copying.
2124
2125         * Modules/indexeddb/IDBFactory.cpp:
2126         (WebCore::IDBFactory::getAllDatabaseNames):
2127         * Modules/indexeddb/IDBFactory.h:
2128         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2129         (WebCore::IDBClient::IDBConnectionProxy::getAllDatabaseNames):
2130         * Modules/indexeddb/client/IDBConnectionProxy.h:
2131         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2132         (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames):
2133         * Modules/indexeddb/client/IDBConnectionToServer.h:
2134         * Modules/indexeddb/client/TransactionOperation.h:
2135         (WebCore::IDBClient::TransactionOperation::doComplete):
2136         * Modules/indexeddb/server/IDBServer.cpp:
2137         (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince):
2138         (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesForOrigins):
2139         * Modules/indexeddb/server/IDBServer.h:
2140         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2141         (WebCore::IDBServer::UniqueIDBDatabase::storeCallbackOrFireError):
2142         (WebCore::IDBServer::UniqueIDBDatabase::createObjectStore):
2143         (WebCore::IDBServer::UniqueIDBDatabase::deleteObjectStore):
2144         (WebCore::IDBServer::UniqueIDBDatabase::renameObjectStore):
2145         (WebCore::IDBServer::UniqueIDBDatabase::clearObjectStore):
2146         (WebCore::IDBServer::UniqueIDBDatabase::createIndex):
2147         (WebCore::IDBServer::UniqueIDBDatabase::deleteIndex):
2148         (WebCore::IDBServer::UniqueIDBDatabase::renameIndex):
2149         (WebCore::IDBServer::UniqueIDBDatabase::putOrAdd):
2150         (WebCore::IDBServer::UniqueIDBDatabase::getRecord):
2151         (WebCore::IDBServer::UniqueIDBDatabase::getAllRecords):
2152         (WebCore::IDBServer::UniqueIDBDatabase::getCount):
2153         (WebCore::IDBServer::UniqueIDBDatabase::deleteRecord):
2154         (WebCore::IDBServer::UniqueIDBDatabase::openCursor):
2155         (WebCore::IDBServer::UniqueIDBDatabase::iterateCursor):
2156         (WebCore::IDBServer::UniqueIDBDatabase::commitTransaction):
2157         (WebCore::IDBServer::UniqueIDBDatabase::abortTransaction):
2158         (WebCore::IDBServer::UniqueIDBDatabase::activateTransactionInBackingStore):
2159         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2160
2161 2017-06-09  Dan Bernstein  <mitz@apple.com>
2162
2163         Tried to fix the build when targrting macOS 10.12 using the macOS 10.13 developer beta SDK.
2164
2165         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2166         (WebCore::MediaPlayerPrivateAVFoundationObjC::seekableTimeRangesLastModifiedTime):
2167         (WebCore::MediaPlayerPrivateAVFoundationObjC::liveUpdateInterval):
2168
2169 2017-06-09  Yoav Weiss  <yoav@yoav.ws>
2170
2171         [preload] Fix builds with ENABLE_VIDEO_TRACK set to false
2172         https://bugs.webkit.org/show_bug.cgi?id=173221
2173
2174         Reviewed by Chris Dumez.
2175
2176         https://bugs.webkit.org/show_bug.cgi?id=173047 introduced a build error for builds with video track support disabled.
2177         This fixes that build issue.
2178
2179         No new tests since there's no functional change.
2180
2181         * html/HTMLLinkElement.cpp:
2182         (WebCore::HTMLLinkElement::as):
2183
2184 2017-06-09  Ryosuke Niwa  <rniwa@webkit.org>
2185
2186         IsInShadowTreeFlag does not get updated for a non-container node
2187         https://bugs.webkit.org/show_bug.cgi?id=173084
2188
2189         Address Darin's review comment.
2190
2191         * dom/ContainerNodeAlgorithms.cpp:
2192         (WebCore::notifyNodeInsertedIntoDocument):
2193         (WebCore::notifyNodeInsertedIntoTree):
2194         (WebCore::notifyNodeRemovedFromDocument):
2195
2196 2017-06-09  Dan Bernstein  <mitz@apple.com>
2197
2198         Tried to fix the build when targrting macOS 10.12 using the macOS 10.13 developer beta SDK.
2199
2200         * platform/spi/mac/AVFoundationSPI.h:
2201
2202 2017-06-09  Brady Eidson  <beidson@apple.com>
2203
2204         Crash when IndexedDB's getAll is used inside a Web Worker.
2205         https://bugs.webkit.org/show_bug.cgi?id=172434
2206
2207         Reviewed by Andy Estes.
2208
2209         Test: storage/indexeddb/modern/worker-getall.html
2210
2211         * Modules/indexeddb/IDBGetAllResult.cpp:
2212         (WebCore::IDBGetAllResult::IDBGetAllResult): Add an isolated-copying constructor.
2213         (WebCore::IDBGetAllResult::isolatedCopy):
2214         * Modules/indexeddb/IDBGetAllResult.h:
2215         
2216         * Modules/indexeddb/shared/IDBResultData.cpp:
2217         (WebCore::IDBResultData::isolatedCopy): Actually copy the IDBGetAllResult.
2218
2219 2017-06-09  Chris Dumez  <cdumez@apple.com>
2220
2221         Unreviewed attempt to fix Mac build after r218039.
2222
2223         * loader/ResourceLoader.cpp:
2224         (WebCore::ResourceLoader::loadDataURL):
2225         * platform/network/DataURLDecoder.h:
2226
2227 2017-06-09  Chris Dumez  <cdumez@apple.com>
2228
2229         Use WTF::Function instead of std::function in DataURLDecoder
2230         https://bugs.webkit.org/show_bug.cgi?id=173194
2231
2232         Reviewed by Sam Weinig.
2233
2234         Use WTF::Function instead of std::function in DataURLDecoder to avoid copying.
2235
2236         * platform/network/DataURLDecoder.cpp:
2237         (WebCore::DataURLDecoder::DecodeTask::DecodeTask):
2238         (WebCore::DataURLDecoder::createDecodeTask):
2239         * platform/network/DataURLDecoder.h:
2240
2241 2017-06-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
2242
2243         Image should clear its ImageObserver* when CachedImage releases the last reference to its RefCounted<ImageObserver>
2244         https://bugs.webkit.org/show_bug.cgi?id=173077
2245
2246         Reviewed by Simon Fraser.
2247
2248         Before dereferencing ImageObserver, CachedImage::clearImage() should check
2249         whether it is the only object that holds a reference to this ImageObserver.
2250         And if this is true, m_image have to clear its raw pointer to the deleted
2251         ImageObserver by calling m_image->setImageObserver(nullptr).
2252
2253         * loader/cache/CachedImage.cpp:
2254         (WebCore::CachedImage::setBodyDataFrom):
2255         (WebCore::CachedImage::CachedImageObserver::CachedImageObserver):
2256         (WebCore::CachedImage::clearImage):
2257         * loader/cache/CachedImage.h:
2258
2259 2017-06-09  Daniel Bates  <dabates@apple.com>
2260
2261         Attempt to fix layout test failures following <https://trac.webkit.org/changeset/218028/webkit>
2262         (https://bugs.webkit.org/show_bug.cgi?id=158121)
2263         <rdar://problem/26012994>
2264
2265         For now, if we do not have a frame then consider the document a secure context. One way this can happen
2266         is the page accesses a frame that was removed from the document as demonstrated by the test:
2267         fast/dom/Window/property-access-on-cached-window-after-frame-removed.html. Treating a frameless
2268         document as a secure context also matches Blink's implementation:
2269         <https://chromium.googlesource.com/chromium/src/+/fc202b2b1174f5732f7b9e63a6c46fd01ac2be02/third_party/WebKit/Source/core/dom/Document.cpp#4079>.
2270
2271         * dom/Document.cpp:
2272         (WebCore::Document::isSecureContext):
2273
2274 2017-06-09  Ryan Haddad  <ryanhaddad@apple.com>
2275
2276         Unreviewed, rolling out r218003.
2277
2278         This change caused assertion failures in existing LayoutTests.
2279
2280         Reverted changeset:
2281
2282         "Image should clear its ImageObserver* when CachedImage
2283         releases the last reference to its RefCounted<ImageObserver>"
2284         https://bugs.webkit.org/show_bug.cgi?id=173077
2285         http://trac.webkit.org/changeset/218003
2286
2287 2017-06-09  Jiewen Tan  <jiewen_tan@apple.com>
2288
2289         [WebCrypto] Remove unsupported CryptoAlgorithmIdentifier
2290         https://bugs.webkit.org/show_bug.cgi?id=173128
2291         <rdar://problem/32666826>
2292
2293         Reviewed by Brent Fulgham.
2294
2295         This patch remove AES_CMAC, DH and CONCAT as they are not implemented and not recommended
2296         by the spec. Hence there is no plan to support them in short term.
2297
2298         No change of behaviour.
2299
2300         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
2301         (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt):
2302         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt):
2303         (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign):
2304         (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify):
2305         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest):
2306         (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey):
2307         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey):
2308         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits):
2309         (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey):
2310         (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey):
2311         * bindings/js/JSSubtleCryptoCustom.cpp:
2312         (WebCore::normalizeCryptoAlgorithmParameters):
2313         (WebCore::supportExportKeyThrow):
2314         * bindings/js/SerializedScriptValue.cpp:
2315         (WebCore::CloneSerializer::write):
2316         (WebCore::CloneDeserializer::read):
2317         * crypto/CryptoAlgorithmIdentifier.h:
2318         * crypto/keys/CryptoKeyAES.cpp:
2319         (WebCore::CryptoKeyAES::isValidAESAlgorithm):
2320
2321 2017-06-09  Daniel Bates  <dabates@apple.com>
2322
2323         Implement W3C Secure Contexts Draft Specification
2324         https://bugs.webkit.org/show_bug.cgi?id=158121
2325         <rdar://problem/26012994>
2326
2327         Reviewed by Alex Christensen.
2328
2329         Part 2
2330
2331         Implements the Secure Contexts spec., <https://w3c.github.io/webappsec-secure-contexts/> (Editor's
2332         Draft, 17 November 2016) except for the allow-secure-context sandbox flag and restrictions on window.opener
2333         as the former is at risk of being dropped from the specification and the latter is being discussed in
2334         <https://github.com/w3c/webappsec-secure-contexts/issues/42>. We are not making use of the Secure
2335         Contexts functionality at the moment. We will make use of it in a subsequent commit.
2336
2337         * dom/Document.cpp:
2338         (WebCore::Document::isSecureContext): Added,
2339         * dom/Document.h:
2340         * dom/ScriptExecutionContext.h:
2341         (WebCore::ScriptExecutionContext::isSecureContext): Deleted; moved to class SecurityContext.
2342         * dom/SecurityContext.h:
2343         * page/DOMWindow.cpp:
2344         (WebCore::DOMWindow::isSecureContext): Added.
2345         * page/DOMWindow.h:
2346         * page/SecurityOrigin.cpp:
2347         (WebCore::isLoopbackIPAddress): Convenience function to determine whether the host portion
2348         of the specified URL is a valid loopback address.
2349         (WebCore::shouldTreatAsPotentionallyTrustworthy): Implements the "Is origin potentially trustworthy?"
2350         algorithm from the Secure Context specification.
2351         (WebCore::SecurityOrigin::SecurityOrigin): Compute whether this origin is potentially trustworthy.
2352         Also, use C++ brace initialization syntax in member initialization list.
2353         * page/SecurityOrigin.h:
2354         (WebCore::SecurityOrigin::isPotentionallyTrustworthy): Added.
2355         * page/WindowOrWorkerGlobalScope.idl: Expose attribute isSecureContext. Fix style nit; remove
2356         period from a comment that is not meant to be a complete sentence.
2357         * workers/WorkerGlobalScope.cpp:
2358         (WebCore::WorkerGlobalScope::isSecureContext): Added.
2359         * workers/WorkerGlobalScope.h:
2360
2361 2017-06-09  Daniel Bates  <dabates@apple.com>
2362
2363         Implement W3C Secure Contexts Draft Specification
2364         https://bugs.webkit.org/show_bug.cgi?id=158121
2365         <rdar://problem/26012994>
2366
2367         Reviewed by Chris Dumez.
2368
2369         Part 1
2370
2371         Teach the bindings code generator to generate a runtime check for an interface, attribute or
2372         function annotated with the extended attribute [SecureContext]. For now, the runtime check
2373         (ScriptExecutionContext::isSecureContext()) always returns true. We will flesh out the
2374         implementation of this runtime check in a subsequent commit.
2375
2376         * bindings/scripts/CodeGeneratorJS.pm:
2377         (NeedsRuntimeCheck):
2378         (GenerateRuntimeEnableConditionalString):
2379         Generate a runtime check for an interface, attribute, or function that is annotated with
2380         the extended attribute [SecureContext].
2381
2382         * bindings/scripts/IDLAttributes.json: Update JSON now that we support SecureContext.
2383         * bindings/scripts/preprocess-idls.pl:
2384         (GenerateConstructorAttributes): Add the SecureContext extended attribute to a constructor,
2385         if applicable.
2386
2387         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2388         (WebCore::JSTestGenerateIsReachablePrototype::finishCreation):
2389         (WebCore::IDLAttribute<JSTestGenerateIsReachable>::cast):
2390         (WebCore::jsTestGenerateIsReachableASecretAttributeGetter):
2391         (WebCore::jsTestGenerateIsReachableASecretAttribute):
2392         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2393         (WebCore::JSTestGlobalObject::finishCreation):
2394         (WebCore::jsTestGlobalObjectInstanceFunctionCalculateSecretResultBody):
2395         (WebCore::jsTestGlobalObjectInstanceFunctionCalculateSecretResult):
2396         (WebCore::jsTestGlobalObjectInstanceFunctionGetSecretBooleanBody):
2397         (WebCore::jsTestGlobalObjectInstanceFunctionGetSecretBoolean):
2398         (WebCore::jsTestGlobalObjectInstanceFunctionTestFeatureGetSecretBooleanBody):
2399         (WebCore::jsTestGlobalObjectInstanceFunctionTestFeatureGetSecretBoolean):
2400         * bindings/scripts/test/JS/JSTestNode.cpp:
2401         (WebCore::JSTestNodePrototype::finishCreation):
2402         (WebCore::jsTestNodePrototypeFunctionCalculateSecretResultBody):
2403         (WebCore::jsTestNodePrototypeFunctionCalculateSecretResult):
2404         (WebCore::jsTestNodePrototypeFunctionGetSecretBooleanBody):
2405         (WebCore::jsTestNodePrototypeFunctionGetSecretBoolean):
2406         (WebCore::jsTestNodePrototypeFunctionTestFeatureGetSecretBooleanBody):
2407         (WebCore::jsTestNodePrototypeFunctionTestFeatureGetSecretBoolean):
2408         * bindings/scripts/test/JS/JSTestObj.cpp:
2409         (WebCore::JSTestObjPrototype::finishCreation):
2410         (WebCore::jsTestObjPrototypeFunctionCalculateSecretResultBody):
2411         (WebCore::jsTestObjPrototypeFunctionCalculateSecretResult):
2412         (WebCore::jsTestObjPrototypeFunctionGetSecretBooleanBody):
2413         (WebCore::jsTestObjPrototypeFunctionGetSecretBoolean):
2414         (WebCore::jsTestObjPrototypeFunctionTestFeatureGetSecretBooleanBody):
2415         (WebCore::jsTestObjPrototypeFunctionTestFeatureGetSecretBoolean):
2416         Update expected results.
2417
2418         * bindings/scripts/test/TestGenerateIsReachable.idl:
2419         * bindings/scripts/test/TestGlobalObject.idl:
2420         * bindings/scripts/test/TestNode.idl:
2421         * bindings/scripts/test/TestObj.idl:
2422         Add test cases.
2423
2424         * dom/ScriptExecutionContext.h:
2425         (WebCore::ScriptExecutionContext::isSecureContext): Added. For now, always returns true.
2426         We will implement this function in a subsequent commit.
2427
2428 2017-06-09  Jer Noble  <jer.noble@apple.com>
2429
2430         Media elements are allowed to continue to load media data after navigation
2431         https://bugs.webkit.org/show_bug.cgi?id=173179
2432
2433         Reviewed by Eric Carlson.
2434
2435         Deny media sessions the ability to load media data when suspended.  
2436
2437         * Modules/webaudio/AudioContext.cpp:
2438         (WebCore::AudioContext::isSuspended):
2439         * Modules/webaudio/AudioContext.h:
2440         * html/HTMLMediaElement.cpp:
2441         (WebCore::HTMLMediaElement::isSuspended):
2442         * html/HTMLMediaElement.h:
2443         * platform/audio/PlatformMediaSession.cpp:
2444         (WebCore::PlatformMediaSession::isSuspended):
2445         * platform/audio/PlatformMediaSession.h:
2446         (WebCore::PlatformMediaSessionClient::isSuspended):
2447         * platform/audio/PlatformMediaSessionManager.cpp:
2448         (WebCore::PlatformMediaSessionManager::sessionCanLoadMedia):
2449
2450 2017-06-09  Daniel Bates  <dabates@apple.com>
2451
2452         CSP: Apply img-src directive to favicon loads
2453         https://bugs.webkit.org/show_bug.cgi?id=172733
2454         <rdar://problem/32082654>
2455
2456         Reviewed by Brady Eidson.
2457
2458         Differentiate favicon requests from raw resources requests so that we can apply the Content
2459         Security Policy to favicon requests.
2460
2461         Tests: http/tests/security/contentSecurityPolicy/allow-favicon.html
2462                http/tests/security/contentSecurityPolicy/block-favicon.html
2463
2464         * inspector/InspectorPageAgent.cpp:
2465         (WebCore::InspectorPageAgent::cachedResourceContent): Keep our current behavior and treat a
2466         favicon resource analogous to a raw resource.
2467         (WebCore::InspectorPageAgent::cachedResourceType): Ditto.
2468         * loader/LinkLoader.cpp:
2469         (WebCore::createLinkPreloadResourceClient): Now that we differentiate between a favicon
2470         and a raw resource we add favicons to the list of unsupported <link as="..."> types. This
2471         makes the list of handled request destination types more closely match the list of valid types
2472         documented in <https://fetch.spec.whatwg.org/#concept-request-destination> (24 May 2017).
2473         * loader/ResourceLoadInfo.cpp:
2474         (WebCore::toResourceType): Keep our current behavior and treat a favicon resource analogous
2475         to a raw resource.
2476         * loader/SubresourceLoader.cpp:
2477         (WebCore::logResourceLoaded): Ditto.
2478         * loader/cache/CachedRawResource.cpp:
2479         (WebCore::CachedRawResource::CachedRawResource): Update for renaming.
2480         * loader/cache/CachedRawResource.h:
2481         (isType): Ditto.
2482         * loader/cache/CachedResource.cpp:
2483         (WebCore::CachedResource::defaultPriorityForResourceType): Keep our current behavior and treat
2484         a favicon resource analogous to a raw resource.
2485         * loader/cache/CachedResource.h:
2486         (WebCore::CachedResource::isMainOrMediaOrFaviconOrRawResource): Renamed; formerly named isMainOrMediaOrRawResource.
2487         Also return true if the this resource is a favicon.
2488         (WebCore::CachedResource::ignoreForRequestCount): Keep our current behavior and treat a
2489         favicon resource analogous to a raw resource.
2490         (WebCore::CachedResource::isMainOrMediaOrRawResource): Deleted; renamed to isMainOrMediaOrFaviconOrRawResource.
2491         * loader/cache/CachedResourceLoader.cpp:
2492         (WebCore::createResource): Keep our current behavior and treat a favicon resource analogous
2493         to a raw resource.
2494         (WebCore::CachedResourceLoader::requestFavicon): Added.
2495         (WebCore::contentTypeFromResourceType): Keep our current behavior and treat a favicon
2496         resource analogous to a raw resource.
2497         (WebCore::CachedResourceLoader::checkInsecureContent): Ditto.
2498         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy): Check if the favicon is
2499         allowed by the CSP of the page.
2500         (WebCore::CachedResourceLoader::determineRevalidationPolicy): Update for renaming.
2501         * loader/cache/CachedResourceLoader.h:
2502         * loader/icon/IconLoader.cpp:
2503         (WebCore::IconLoader::startLoading): Substitute call CachedResourceLoader::requestFavicon() for CachedResourceLoader::requestRawResource()
2504         and remove comment about ContentSecurityPolicyImposition::DoPolicyCheck being a placeholder. This is no longer the
2505         case. This resource request option is now meaningful as we want to apply the CSP of the page with respect to the
2506         request for the favicon.
2507
2508 2017-06-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2509
2510         [iOS DnD] Add a hook to perform two-step drops in editable content
2511         https://bugs.webkit.org/show_bug.cgi?id=172992
2512         <rdar://problem/32590174>
2513
2514         Reviewed by Tim Horton.
2515
2516         Adds hooks in DragController::concludeEditDrag to give the client layer a chance to perform custom handling when
2517         dropping in editable content.
2518         Tests:  DataInteractionTests.InjectedBundleOverridePerformTwoStepDrop
2519                 DataInteractionTests.InjectedBundleAllowPerformTwoStepDrop
2520
2521         * loader/EmptyClients.cpp:
2522         * page/DragController.cpp:
2523         (WebCore::DragController::concludeEditDrag):
2524         * page/EditorClient.h:
2525
2526 2017-06-09  Matthew Hanson  <matthew_hanson@apple.com>
2527
2528         Revert r217955. rdar://problem/21125708
2529
2530 2017-06-06 Konstantin Tokarev  <annulen@yandex.ru>
2531
2532         [MediaFoundation] Volume controls of different media elements should be independent
2533         https://bugs.webkit.org/show_bug.cgi?id=172967
2534
2535         Based on patch by Vitaly Slobodin <vitaliy.slobodin@gmail.com>
2536         Reviewed by Alex Christensen.
2537
2538         IMFSimpleAudioVolume interface controls master volume of the
2539         application. We should use IMFAudioStreamVolume interface instead.
2540
2541         No new tests needed.
2542
2543         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2544         (WebCore::MediaPlayerPrivateMediaFoundation::MediaPlayerPrivateMediaFoundation):
2545         (WebCore::MediaPlayerPrivateMediaFoundation::setAllChannelVolumes):
2546         (WebCore::MediaPlayerPrivateMediaFoundation::setVolume):
2547         (WebCore::MediaPlayerPrivateMediaFoundation::setMuted):
2548         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
2549
2550 2017-06-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
2551
2552         Image should clear its ImageObserver* when CachedImage releases the last reference to its RefCounted<ImageObserver>
2553         https://bugs.webkit.org/show_bug.cgi?id=173077
2554
2555         Reviewed by Simon Fraser.
2556
2557         Before dereferencing ImageObserver, CachedImage::clearImage() should check
2558         whether it is the only object that holds a reference to this ImageObserver.
2559         And if this is true, m_image have to clear its raw pointer to the deleted
2560         ImageObserver by calling m_image->setImageObserver(nullptr).
2561
2562         * loader/cache/CachedImage.cpp:
2563         (WebCore::CachedImage::setBodyDataFrom):
2564         (WebCore::CachedImage::CachedImageObserver::CachedImageObserver):
2565         (WebCore::CachedImage::clearImage):
2566         * loader/cache/CachedImage.h:
2567
2568 2017-06-09  Frederic Wang  <fwang@igalia.com>
2569
2570         Add flag allow-popups-to-escape-sandbox to iframe sandbox
2571         https://bugs.webkit.org/show_bug.cgi?id=158875
2572
2573         Reviewed by Chris Dumez.
2574
2575         This patch adds support for the iframe@allow-popups-to-escape-sandbox attribute.
2576         This allows to pass more W3C Web Platform tests.
2577
2578         Tests: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html
2579                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-2.html
2580
2581         * dom/SecurityContext.cpp: Add allow-popups-to-escape-sandbox flag.
2582         (WebCore::SecurityContext::isSupportedSandboxPolicy):
2583         (WebCore::SecurityContext::parseSandboxPolicy):
2584         * dom/SecurityContext.h: Ditto.
2585         * loader/FrameLoader.cpp:
2586         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): Do not force sandbox flags when we have allow-popups-to-escape-sandbox.
2587         (WebCore::createWindow): Ditto.
2588
2589 2017-06-09  Jer Noble  <jer.noble@apple.com>
2590
2591         [iOS] Video occasionally mixes with other system audio instead of interrupting
2592         https://bugs.webkit.org/show_bug.cgi?id=173127
2593
2594         Reviewed by Eric Carlson.
2595
2596         Tests: platform/mac/audio-session-category-video-track-change.html
2597
2598         When an HTMLMediaElement's tracks change their enabled state, make sure to update
2599         the PlatformMediaElement, for canProduceAudio() may have changed. 
2600
2601         * html/HTMLMediaElement.cpp:
2602         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
2603         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
2604         (PlatformMediaSessionManager::updateSessionState):
2605
2606         The rest of the changes in this revision are to allow the above to be testable.
2607
2608         * page/Settings.cpp:
2609         * page/Settings.h:
2610         * platform/audio/AudioSession.h:
2611         * platform/audio/mac/AudioSessionMac.cpp:
2612         (WebCore::AudioSession::category):
2613         (WebCore::AudioSession::setCategory):
2614         * testing/InternalSettings.cpp:
2615         (WebCore::InternalSettings::Backup::Backup):
2616         (WebCore::InternalSettings::Backup::restoreTo):
2617         (WebCore::InternalSettings::setShouldManageAudioSessionCategory):
2618         * testing/InternalSettings.h:
2619         * testing/InternalSettings.idl:
2620         * testing/Internals.cpp:
2621         (WebCore::Internals::audioSessionCategory):
2622         * testing/Internals.h:
2623         * testing/Internals.idl:
2624
2625 2017-06-09  Chris Dumez  <cdumez@apple.com>
2626
2627         CSS transitions added while page is not visible do not start when the page becomes visible
2628         https://bugs.webkit.org/show_bug.cgi?id=173166
2629         <rdar://problem/32250351>
2630
2631         Reviewed by Darin Adler.
2632
2633         CSS transitions added while page is not visible would not start when the page becomes
2634         visible. The issue was that when CompositeAnimation::updateTransitions() was called
2635         while the page is hidden (and animations are therefore suspended), it would not
2636         populate m_transations with ImplicitAnimation objects. We would therefore have later
2637         no transitions to resume when the page becomes visible later on. This patch updates
2638         CompositeAnimation::updateTransitions() to properly populate m_transitions and instead
2639         pause the ImplicitAnimation it creates if animations are currently suspended. This
2640         behavior is more consistent with the one of CompositeAnimation::updateKeyframeAnimations().
2641
2642         I also needed to update ImplicitAnimation::animate() to not restart a paused animation
2643         if the animation is currently paused. This is similar to what is done in
2644         KeyframeAnimation::animate(). Without this, the paused ImplicitAnimation we add to
2645         m_transition would incorrectly get unpaused while the page is still hidden and the
2646         animations are still supposed to be suspended. This issue was showing when running the
2647         test I am adding in this patch.
2648
2649         Test: fast/animation/css-animation-resuming-when-visible.html
2650
2651         * page/animation/CompositeAnimation.cpp:
2652         (WebCore::CompositeAnimation::updateTransitions):
2653         * page/animation/ImplicitAnimation.cpp:
2654         (WebCore::ImplicitAnimation::animate):
2655         (WebCore::ImplicitAnimation::reset):
2656         * page/animation/ImplicitAnimation.h:
2657
2658 2017-06-09  Yusuke Suzuki  <utatane.tea@gmail.com>
2659
2660         Unreviewed, Use FALLTHROUGH
2661
2662         * loader/LinkLoader.cpp:
2663         (WebCore::createLinkPreloadResourceClient):
2664
2665 2017-06-09  Eric Carlson  <eric.carlson@apple.com>
2666
2667         fast/mediastream/MediaStream-page-muted.html times out and asserts
2668         https://bugs.webkit.org/show_bug.cgi?id=170355
2669         <rdar://problem/31376041>
2670
2671         MediaStream and MediaStreamTrack need to prevent JS wrapper collection while it is possible
2672         to fire an event or event listeners won't be notified.
2673
2674         Reviewed by Chris Dumez.
2675
2676         Test: fast/mediastream/media-stream-wrapper-collected.html
2677
2678         * Modules/mediastream/MediaStream.cpp:
2679         (WebCore::MediaStream::MediaStream): Initialize ActiveDOMObject.
2680         (WebCore::MediaStream::stop): New.
2681         (WebCore::MediaStream::activeDOMObjectName): Ditto.
2682         (WebCore::MediaStream::canSuspendForDocumentSuspension): Ditto.
2683         (WebCore::MediaStream::hasPendingActivity): Ditto, prevent collection if there
2684         are registered event listeners.
2685         (WebCore::MediaStream::contextDestroyed): Deleted.
2686         * Modules/mediastream/MediaStream.h:
2687         * Modules/mediastream/MediaStream.idl:
2688
2689         * Modules/mediastream/MediaStreamTrack.cpp:
2690         (WebCore::MediaStreamTrack::hasPendingActivity): Prevent collection if there
2691         are registered event listeners.
2692         * Modules/mediastream/MediaStreamTrack.h:
2693
2694         * testing/Internals.cpp:
2695         (WebCore::Internals::removeMediaStreamTrack): stream.removeTrack doesn't generate a 'removetrack'
2696         event, so call private method that does.
2697         * testing/Internals.h:
2698         * testing/Internals.idl:
2699
2700 2017-06-09  Daewoong Jang  <daewoong.jang@navercorp.com>
2701
2702         [cURL] Remove a call to Windows API
2703         https://bugs.webkit.org/show_bug.cgi?id=172079
2704
2705         Reviewed by Yusuke Suzuki.
2706
2707         * platform/network/curl/CurlDownload.cpp:
2708         (WebCore::CurlDownload::moveFileToDestination):
2709         * platform/win/FileSystemWin.cpp:
2710         (WebCore::moveFile):
2711
2712 2017-06-09  Miguel Gomez  <magomez@igalia.com>
2713
2714         [GTK][WPE] Fix alpha premultiplying when using cairo to draw the video frames
2715         https://bugs.webkit.org/show_bug.cgi?id=173097
2716
2717         Reviewed by Carlos Garcia Campos.
2718
2719         We need to premultiply alpha when creating a cairo surface from a GStreamer video frame, if the frame
2720         has an alpha component. Currently this is wrongly done in VideoSinkGStreamer, as it assumes that every
2721         frame is going to be rendered with cairo, which is not the case when using accelerated compositing.
2722         The premultiply must happen inside ImageGStreamerCairo, which is where we know that the frame is
2723         going to be rendered with cairo, and where the premultiply can be performed when gstreamer-gl is
2724         enabled as well.
2725
2726         Covered by existent tests.
2727
2728         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
2729         (ImageGStreamer::ImageGStreamer):
2730         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
2731         (webkitVideoSinkRequestRender):
2732
2733 2017-06-09  Zan Dobersek  <zdobersek@igalia.com>
2734
2735         [WPE] Enable ENCRYPTED_MEDIA for build-webkit builds
2736         https://bugs.webkit.org/show_bug.cgi?id=173103
2737
2738         Reviewed by Xabier Rodriguez-Calvar.
2739
2740         * Modules/encryptedmedia/CDM.cpp:
2741         (WebCore::CDM::getSupportedCapabilitiesForAudioVideoType):
2742         Pass the ParsedContentType's mime type string to the explicit ContentType
2743         constructor and assign that to the MediaEngineSupportParameters' type
2744         member.
2745
2746 2017-06-08  Ryosuke Niwa  <rniwa@webkit.org>
2747
2748         Move TreeScope::adoptIfNeeded to Node and rename it to setTreeScopeRecursively
2749         https://bugs.webkit.org/show_bug.cgi?id=173129
2750
2751         Reviewed by Antti Koivisto.
2752
2753         Renamed TreeScope::adoptIfNeeded to setTreeScopeRecursively and moved to Node.
2754
2755         The old name was really confusing because due to the existence of Document::adoptNode, a DOM API,
2756         which removes the adopted node from its parent if there was one before adopting the node.
2757         Most confusingly, this function called TreeScope::adoptIfNeeded.
2758
2759         Also inlined the tree scope check to avoid calling to moveTreeToNewScope when there is nothing to do.
2760
2761         This patch effectively reverts r104528.
2762
2763         No new tests. Existing tests cover this.
2764
2765         * dom/Attr.cpp:
2766         (WebCore::Attr::detachFromElementWithValue):
2767         (WebCore::Attr::attachToElement):
2768         * dom/ContainerNode.cpp:
2769         (WebCore::ContainerNode::takeAllChildrenFrom):
2770         (WebCore::ContainerNode::insertBefore):
2771         (WebCore::ContainerNode::replaceChild):
2772         (WebCore::ContainerNode::removeBetween):
2773         (WebCore::ContainerNode::replaceAllChildren):
2774         (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck):
2775         (WebCore::ContainerNode::parserAppendChild):
2776         * dom/ContainerNodeAlgorithms.cpp:
2777         (WebCore::addChildNodesToDeletionQueue):
2778         * dom/Document.cpp:
2779         (WebCore::Document::adoptNode):
2780         * dom/Element.cpp:
2781         (WebCore::Element::ensureAttr):
2782         * dom/Node.cpp:
2783         (WebCore::DidMoveToNewDocumentAssertionScope): Added. The old assertion wasn't sufficient when
2784         HTMLTemplateElement made a recursive call to setTreeScopeRecursively.
2785         (WebCore::DidMoveToNewDocumentAssertionScope::DidMoveToNewDocumentAssertionScope):
2786         (WebCore::DidMoveToNewDocumentAssertionScope::~DidMoveToNewDocumentAssertionScope):
2787         (WebCore::DidMoveToNewDocumentAssertionScope::didRecieveCall):
2788         (WebCore::moveNodeToNewDocument): Moved from TreeScope. Calls to incrementReferencingNodeCount
2789         and decrementReferencingNodeCount to Node::didMoveToNewDocument. This function is now eliminated
2790         in a release build.
2791         (WebCore::moveShadowTreeToNewDocument): Moved from TreeScope.
2792         (WebCore::Node::moveTreeToNewScope): Ditto.
2793         (WebCore::Node::didMoveToNewDocument): See the description for moveNodeToNewDocument above.
2794         * dom/Node.h:
2795         (WebCore::Node::isParsingChildrenFinished): Moved to avoid having its own protected section.
2796         (WebCore::Node::setIsParsingChildrenFinished): Ditto.
2797         (WebCore::Node::clearIsParsingChildrenFinished): Ditto.
2798         (WebCore::Node::setTreeScopeRecursively): Moved from TreeScope::adoptIfNeeded.
2799         * dom/ShadowRoot.cpp:
2800         (WebCore::ShadowRoot::~ShadowRoot):
2801         * dom/TreeScope.cpp:
2802         (WebCore::TreeScope::adoptIfNeeded): Deleted.
2803         (WebCore::TreeScope::moveTreeToNewScope): Deleted.
2804         (WebCore::TreeScope::ensureDidMoveToNewDocumentWasCalled): Deleted.
2805         (WebCore::TreeScope::moveNodeToNewDocument): Deleted.
2806         (WebCore::TreeScope::moveShadowTreeToNewDocument): Deleted.
2807         * dom/TreeScope.h:
2808         * html/HTMLTemplateElement.cpp:
2809         (WebCore::HTMLTemplateElement::didMoveToNewDocument):
2810
2811 2017-06-09  Adrien Plazas  <aplazas@igalia.com>
2812
2813         [GTK] Add kinetic scrolling
2814         https://bugs.webkit.org/show_bug.cgi?id=155750
2815
2816         Reviewed by Carlos Garcia Campos.
2817
2818         Patch by Adrien Plazas and Yusuke Suzuki.
2819
2820         Add the ScrollAnimationKinetic scrolling animation allowing to perform momentum scrolling; it is based on GTK+'s
2821         GtkKineticScrolling type.
2822
2823         Add the notion of phase, momentum phase and swipe velocity to PlatformWheelEvent.
2824
2825         Depending on whether the scrolling ended normally or triggered a swipe, the scroll animator will either compute
2826         the swipe velocity from the previous scrolling events or use the one from the swipe gesture to initiate the
2827         momentum scrolling.
2828
2829         * PlatformGTK.cmake:
2830         * platform/PlatformWheelEvent.h:
2831         (WebCore::PlatformWheelEvent::setHasPreciseScrollingDeltas):
2832         (WebCore::PlatformWheelEvent::phase):
2833         (WebCore::PlatformWheelEvent::momentumPhase):
2834         (WebCore::PlatformWheelEvent::isTransitioningToMomentumScroll):
2835         * platform/ScrollAnimation.h:
2836         (WebCore::ScrollAnimation::scroll):
2837         (WebCore::ScrollAnimation::updateVisibleLengths):
2838         (WebCore::ScrollAnimation::setCurrentPosition):
2839         * platform/ScrollAnimationKinetic.cpp: Added.
2840         (WebCore::ScrollAnimationKinetic::PerAxisData::PerAxisData):
2841         (WebCore::ScrollAnimationKinetic::PerAxisData::animateScroll):
2842         (WebCore::ScrollAnimationKinetic::ScrollAnimationKinetic):
2843         (WebCore::ScrollAnimationKinetic::~ScrollAnimationKinetic):
2844         (WebCore::ScrollAnimationKinetic::stop):
2845         (WebCore::ScrollAnimationKinetic::start):
2846         (WebCore::ScrollAnimationKinetic::animationTimerFired):
2847         * platform/ScrollAnimationKinetic.h: Copied from Source/WebCore/platform/ScrollAnimation.h.
2848         * platform/gtk/PlatformWheelEventGtk.cpp:
2849         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
2850         (WebCore::PlatformWheelEvent::swipeVelocity):
2851         * platform/gtk/ScrollAnimatorGtk.cpp:
2852         (WebCore::ScrollAnimatorGtk::ScrollAnimatorGtk):
2853         (WebCore::ScrollAnimatorGtk::ensureSmoothScrollingAnimation):
2854         (WebCore::ScrollAnimatorGtk::scroll):
2855         (WebCore::ScrollAnimatorGtk::scrollToOffsetWithoutAnimation):
2856         (WebCore::ScrollAnimatorGtk::computeVelocity):
2857         (WebCore::ScrollAnimatorGtk::handleWheelEvent):
2858         (WebCore::ScrollAnimatorGtk::willEndLiveResize):
2859         (WebCore::ScrollAnimatorGtk::updatePosition):
2860         (WebCore::ScrollAnimatorGtk::didAddVerticalScrollbar):
2861         (WebCore::ScrollAnimatorGtk::didAddHorizontalScrollbar):
2862         * platform/gtk/ScrollAnimatorGtk.h:
2863
2864 2017-06-09  Zan Dobersek  <zdobersek@igalia.com>
2865
2866         [GCrypt] ECDSA signing results can be smaller than the EC key size
2867         https://bugs.webkit.org/show_bug.cgi?id=171535
2868
2869         Reviewed by Jiewen Tan.
2870
2871         The libgcrypt-based implementation of the ECDSA signing operation does not
2872         properly address the resulting `r` and `s` integers that do not potentially
2873         match the EC key in terms of size.
2874
2875         To address that, the retrieved MPI data for both integers is handled depending
2876         on the size of said data. Strictly requiring an amount of bytes that matches
2877         the key data size N, we simply take the last N bytes if the MPI data is equal
2878         or larger than N in size. If smaller, we first append enough zero bytes to the
2879         output Vector object before attaching the MPI data in whole so that the amount
2880         of appended bytes matches N.
2881
2882         No new tests -- covers an implementation detail that is not trivial to test,
2883         but can rely sufficiently on existing tests.
2884
2885         * crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
2886         (WebCore::extractECDSASignatureInteger):
2887         (WebCore::gcryptSign):
2888
2889 2017-06-09  Daewoong Jang  <daewoong.jang@navercorp.com>
2890
2891         Reduce compiler warnings
2892         https://bugs.webkit.org/show_bug.cgi?id=172078
2893
2894         Reviewed by Yusuke Suzuki.
2895
2896         * platform/network/curl/CookieJarCurl.cpp:
2897         (WebCore::addMatchingCurlCookie):
2898         (WebCore::getHostnamesWithCookies):
2899         (WebCore::deleteCookiesForHostnames):
2900         (WebCore::deleteCookiesForHostname): Deleted.
2901         * platform/network/curl/CurlDownload.cpp:
2902         (WebCore::CurlDownloadManager::downloadThread):
2903         (WebCore::CurlDownload::didReceiveHeader):
2904         * platform/network/curl/CurlDownload.h:
2905         (WebCore::CurlDownloadListener::didReceiveDataOfLength):
2906         * platform/network/curl/ResourceHandleCurl.cpp:
2907         (WebCore::WebCoreSynchronousLoader::didReceiveResponse):
2908         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
2909         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
2910         (WebCore::createCopy):
2911         (WebCore::SocketStreamHandleImpl::readData):
2912
2913 2017-06-09  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2914
2915         [GStreamer][EME] Remove the legacy code that was not even official and is deprecated
2916         https://bugs.webkit.org/show_bug.cgi?id=173096
2917
2918         Reviewed by Žan Doberšek.
2919
2920         We are removing the LEGACY_ENCRYPTED_MEDIA code that we was not
2921         official, is deprecated and we are not planning to support it
2922         anymore in any way.
2923
2924         This also helps implementing current ENCRYPTED_MEDIA in a cleaner
2925         way.
2926
2927         * platform/GStreamer.cmake:
2928         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
2929         * platform/graphics/gstreamer/GStreamerUtilities.h:
2930         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2931         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
2932         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2933         (WebCore::registerWebKitGStreamerElements):
2934         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
2935         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
2936         (WebCore::extractEventsAndSystemsFromMessage): Deleted.
2937         (WebCore::MediaPlayerPrivateGStreamerBase::needKey): Deleted.
2938         (WebCore::MediaPlayerPrivateGStreamerBase::setCDMSession): Deleted.
2939         (WebCore::MediaPlayerPrivateGStreamerBase::keyAdded): Deleted.
2940         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent): Deleted.
2941         (WebCore::MediaPlayerPrivateGStreamerBase::receivedGenerateKeyRequest): Deleted.
2942         (WebCore::keySystemIdToUuid): Deleted.
2943         (WebCore::MediaPlayerPrivateGStreamerBase::createSession): Deleted.
2944         (WebCore::MediaPlayerPrivateGStreamerBase::dispatchDecryptionKey): Deleted.
2945         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2946         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
2947         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h:
2948         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
2949         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
2950         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2951         (WebCore::AppendPipeline::AppendPipeline):
2952         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
2953         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
2954         (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
2955         (WebCore::appendPipelineElementMessageCallback): Deleted.
2956         (WebCore::AppendPipeline::dispatchPendingDecryptionKey): Deleted.
2957         (WebCore::AppendPipeline::dispatchDecryptionKey): Deleted.
2958         (WebCore::AppendPipeline::handleElementMessage): Deleted.
2959         * platform/graphics/gstreamer/mse/AppendPipeline.h:
2960         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2961         (WebCore::MediaPlayerPrivateGStreamerMSE::dispatchDecryptionKey): Deleted.
2962         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
2963
2964 2017-06-09  Aaron Chu  <aaron_chu@apple.com>
2965
2966         AX: Media Controls: Missing labels for the Time Labels.
2967         https://bugs.webkit.org/show_bug.cgi?id=171715
2968         <rdar://problem/32009214>
2969
2970         Reviewed by Antoine Quint.
2971
2972         Added aria-label to describe time labels in media controls.
2973
2974         * Modules/modern-media-controls/controls/slider.js:
2975         (Slider.prototype.set inputAccessibleLabel):
2976         (Slider.prototype._formatTime): Deleted.
2977         * Modules/modern-media-controls/controls/time-label.js:
2978         (TimeLabel.prototype.commitProperty):
2979         * Modules/modern-media-controls/main.js:
2980         (formatTimeToString):
2981
2982 2017-06-08  Carlos Garcia Campos  <cgarcia@igalia.com>
2983
2984         Unreviewed. Fix unused parameter warning after r217955.
2985
2986         * platform/graphics/FontFamilySpecificationNull.h:
2987         (WebCore::FontFamilySpecificationNull::fontRanges):
2988
2989 2017-06-08  Yoav Weiss  <yoav@yoav.ws>
2990
2991         [preload] Mandatory `as` value and related spec alignments
2992         https://bugs.webkit.org/show_bug.cgi?id=173047
2993
2994         Reviewed by Dean Jackson.
2995
2996         Align preload's implementation according to latest spec changes: `as` is mandatory and "fetch" replaces the previous empty `as` value,
2997         onerror no longer fires for invalid `as` values, and the IDL for `as` reflects only valid values, to enable feature detection.
2998
2999         Related standard discussions:
3000         https://github.com/w3c/preload/issues/80
3001         https://github.com/whatwg/fetch/pull/547
3002         https://github.com/whatwg/fetch/pull/549
3003         https://github.com/whatwg/html/pull/2588
3004
3005         No new tests but modified existing ones as well as their expectations.
3006
3007         * html/HTMLLinkElement.cpp: Add "enumerated attribute" reflection methods to `as`.
3008         (WebCore::HTMLLinkElement::setAs):
3009         (WebCore::HTMLLinkElement::as):
3010         * html/HTMLLinkElement.h:
3011         * html/HTMLLinkElement.idl:
3012         * loader/LinkLoader.cpp:
3013         (WebCore::LinkLoader::loadLinksFromHeader): preloadIfNeeded signature change.
3014         (WebCore::LinkLoader::resourceTypeFromAsAttribute): Replace the empty value by "fetch".
3015         (WebCore::LinkLoader::preloadIfNeeded): Change the signature, as a LinkLoaderClient is no longer needed, since we don't fire error
3016         events from inside the function.
3017         (WebCore::LinkLoader::loadLink): preloadIfNeeded signature change.
3018         * loader/LinkLoader.h: preloadIfNeeded signature change.
3019
3020 2017-06-08  Chris Dumez  <cdumez@apple.com>
3021
3022         [iOS] LowPowerModeNotifier notifies client on non-main thread
3023         https://bugs.webkit.org/show_bug.cgi?id=173115
3024         <rdar://problem/32644703>
3025
3026         Reviewed by Ryosuke Niwa.
3027
3028         Update iOS's implementation of the LowPowerModeNotifier to make sure
3029         we notify the client of low power mode changes on the main thread.
3030
3031         * platform/ios/LowPowerModeNotifierIOS.mm:
3032         (-[WebLowPowerModeObserver _didReceiveLowPowerModeChange]):
3033
3034 2017-06-08  Ryosuke Niwa  <rniwa@webkit.org>
3035
3036         Crash inside InsertNodeBeforeCommand via InsertParagraphSeparatorCommand
3037         https://bugs.webkit.org/show_bug.cgi?id=173085
3038         <rdar://problem/32575059>
3039
3040         Reviewed by Wenson Hsieh.
3041
3042         The crash was caused by the condition to check for special cases failing when visiblePos is null.
3043         Exit early in these extreme cases.
3044
3045         Also replaced the use of deprecatedNode and deprecatedEditingOffset to modern idioms.
3046
3047         Test: editing/inserting/insert-horizontal-rule-in-empty-document-crash.html
3048
3049         * editing/InsertParagraphSeparatorCommand.cpp:
3050         (WebCore::InsertParagraphSeparatorCommand::doApply):
3051
3052 2017-06-08  Ryosuke Niwa  <rniwa@webkit.org>
3053
3054         The tree scope of an Attr node inside a shadow tree does not updated upon detach.
3055         https://bugs.webkit.org/show_bug.cgi?id=173122
3056
3057         Reviewed by Chris Dumez.
3058
3059         The crash was caused by the tree scope of an Attr detached from an element inside a shadow root
3060         not getting updated.
3061
3062         Test: fast/dom/detaching-attr-node-in-shadow-tree-crash.html
3063
3064         * dom/Attr.cpp:
3065         (WebCore::Attr::~Attr): Added assertions.
3066         (WebCore::Attr::detachFromElementWithValue): Fixed the bug by adopting Attr to Document.
3067         (WebCore::Attr::attachToElement): Moved the adoptIfNeeded call here from attachAttributeNodeIfNeeded.
3068         * dom/Element.cpp:
3069         (WebCore::Element::attachAttributeNodeIfNeeded):
3070
3071 2017-06-08  Myles C. Maxfield  <mmaxfield@apple.com>
3072
3073         [Cocoa] Expand system-ui to include every item in the Core Text cascade list
3074         https://bugs.webkit.org/show_bug.cgi?id=173043
3075         <rdar://problem/21125708>
3076
3077         Reviewed by Simon Fraser.
3078
3079         The concept of the system font on Cocoa platforms represents the entire Core Text cascade list.
3080         However, previously, WebKit only represented system-ui by pulling out the first item in the Core
3081         Text cascade list. Instead, we should make all text rendered with "system-ui" match what the
3082         platform would natively render.
3083
3084         Previously, we walked through the strings in the font-family property and looked them up one by
3085         one. However, now we want to abstract this idea of a font family to possibly hold a
3086         CTFontDescriptorRef instead of a string. This way, we expand a font-family list of ["fontA",
3087         "system-ui", "fontB"] to ["fontA", ... a bunch of CTFontDescriptorRefs ..., "FontB"]. We can
3088         then modify the consumer of this object to have two codepaths: the old string-based codepath,
3089         and a new, platform-specific codepath which simply embeds the CTFontDesriptorRefs inside a Font
3090         object.
3091
3092         We don't want to simply pull out the family name from each item in the Core Text fallback list
3093         because that is a lossy translation. There is more information in these font descriptors which
3094         cannot be represented by CSS. Therefore, we must keep the descriptors alive and add the new
3095         codepath for them.
3096
3097         We also don't want to run the CSS font matching algorithm on each member of the Core Text
3098         fallback list because it may yield different results from Core Text's font matching algorithm.
3099         Our goal is to draw text as closely as possible to the system APIs. If we ran it, we may find
3100         a font which is closer to the requested traits, but it would look out of place on the system.
3101
3102         Tests: fast/text/system-font-fallback-emoji.html
3103                fast/text/system-font-fallback.html
3104
3105         * WebCore.xcodeproj/project.pbxproj:
3106         * page/MemoryRelease.cpp:
3107         (WebCore::releaseNoncriticalMemory):
3108         * platform/graphics/FontCascadeFonts.cpp:
3109         (WebCore::realizeNextFallback): The consumer of our new data type. Now uses WTF::visit().
3110         (WebCore::FontCascadeFonts::realizeFallbackRangesAt): Now that the number of items to test
3111         against the current character is larger than the number of strings in the font-family list,
3112         we need to update the existing code to use the correct value.
3113         * platform/graphics/FontDescription.cpp: Default implementation for non-Cocoa ports.
3114         (WebCore::FontDescription::invalidateCaches):
3115         (WebCore::FontCascadeDescription::effectiveFamilyCount):
3116         (WebCore::FontCascadeDescription::effectiveFamilyAt):
3117         * platform/graphics/FontDescription.h: Our new data type is a Variant of AtomicString and a
3118         platform-specific class. Cocoa uses a class that holds a CTFontDescriptorRef and other ports
3119         use an empty non-constructable class.
3120         * platform/graphics/FontFamilySpecificationNull.h: Added. The empty non-constructable
3121         class.
3122         (WebCore::FontFamilySpecificationNull::fontRanges):
3123         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3124         (WebCore::FontCache::platformInit): Changing the system language will change the system font
3125         fallback list, so we need to listen to this notification. This also matters for
3126         FontCache::systemFallbackForCharacters(), so we should build off the same callback we are
3127         already using for font installation.
3128         (WebCore::invalidateFontCache):
3129         * platform/graphics/cocoa/FontDescriptionCocoa.cpp: Added. The platform-specific creation of
3130         our CTFontDescriptorRefs. We hold them cached in a SystemFontDatabase.
3131         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::CoreTextCascadeListParameters):
3132         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::isHashTableDeletedValue):
3133         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::operator==):
3134         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::hash):
3135         (WebCore::SystemFontDatabase::singleton):
3136         (WebCore::SystemFontDatabase::systemFontCascadeList):
3137         (WebCore::SystemFontDatabase::clear):
3138         (WebCore::SystemFontDatabase::SystemFontDatabase):
3139         (WebCore::SystemFontDatabase::applyWeightAndItalics):
3140         (WebCore::SystemFontDatabase::computeCascadeList):
3141         (WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::hash):
3142         (WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::equal):
3143         (WebCore::isSystemFontString):
3144         (WebCore::systemFontParameters):
3145         (WebCore::FontDescription::invalidateCaches):
3146         (WebCore::FontCascadeDescription::effectiveFamilyCount): We don't store the result of this
3147         because it would probably be a bad idea to increase the size of every single FontCascade just
3148         in case it might ask for the system font. Most fonts never mention system-ui. Because it's so
3149         rare, we can just recalculate the result of this as necessary. This shouldn't be slow because
3150         the results are cached.
3151         (WebCore::FontCascadeDescription::effectiveFamilyAt):
3152         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp: Added.
3153         (WebCore::FontFamilySpecificationCoreText::fontRanges): Create a FontRanges from a
3154         CTFontDescriptorRef.
3155         * platform/graphics/cocoa/FontFamilySpecificationCoreText.h: Added.
3156         (WebCore::FontFamilySpecificationCoreText::FontFamilySpecificationCoreText):
3157         * platform/graphics/ios/FontCacheIOS.mm: Delete the old handling for system-ui.
3158         (WebCore::platformFontWithFamilySpecialCase):
3159         (WebCore::baseSystemFontDescriptor): Deleted.
3160         (WebCore::systemFontModificationAttributes): Deleted.
3161         (WebCore::systemFontDescriptor): Deleted.
3162         * platform/graphics/mac/FontCacheMac.mm: Ditto.
3163         (WebCore::platformFontWithFamilySpecialCase):
3164         (WebCore::toNSFontWeight): Deleted.
3165
3166 2017-06-08  Chris Dumez  <cdumez@apple.com>
3167
3168         Update Timer to take a WTF::Function instead of a std::function
3169         https://bugs.webkit.org/show_bug.cgi?id=173113
3170
3171         Reviewed by Brady Eidson.
3172
3173         Update Timer to take a WTF::Function instead of a std::function as we prefer
3174         to use WTF::Function in WebKit.
3175
3176         * platform/GenericTaskQueue.cpp:
3177         (WebCore::TaskDispatcher<Timer>::sharedTimer):
3178         * platform/Timer.h:
3179         (WebCore::Timer::Timer):
3180         (WebCore::DeferrableOneShotTimer::DeferrableOneShotTimer):
3181
3182 2017-06-08  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3183
3184         [WebRTC] enableMockMediaEndpoint() is only used for the OpenWebRTC backend.
3185         https://bugs.webkit.org/show_bug.cgi?id=173108
3186
3187         Reviewed by Eric Carlson.
3188
3189         Covered by existing tests.
3190
3191         * testing/Internals.cpp:
3192         (WebCore::Internals::Internals):
3193         (WebCore::Internals::enableMockMediaEndpoint):
3194         * testing/Internals.h:
3195
3196 2017-06-08  Antoine Quint  <graouts@apple.com>
3197
3198         [iOS] Buttons in top-left and bottom media controls bar are positioned too high
3199         https://bugs.webkit.org/show_bug.cgi?id=173111
3200         <rdar://problem/32650615>
3201
3202         Reviewed by Jon Lee.
3203
3204         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-button-padding.html
3205
3206         Since we use flex box to vertically center buttons in a buttons container, there is no
3207         need to offset the button due to padding in the y-axis.
3208
3209         * Modules/modern-media-controls/controls/buttons-container.css:
3210         (.ios .buttons-container button):
3211
3212 2017-06-08  Jeremy Jones  <jeremyj@apple.com>
3213
3214         Implement additional AVPlayerController interfaces for minTime and maxTime.
3215         https://bugs.webkit.org/show_bug.cgi?id=172396
3216         rdar://problem/30737452
3217
3218         Reviewed by Jer Noble.
3219
3220         No new tests because no change to DOM.
3221
3222         Add support for new HLS UI in AVKit.
3223
3224         This adds new properties (seekableTimeRangesLastModifiedTime, liveUpdateInterval, minTiming, maxTiming) to WebAVPlayerController.
3225         Plumb these properties from AVPlayer up to AVKit.
3226
3227         Switch WebPlaybackSessionModelMediaElement from updating seekableRangesChanged using timeupdate event to using progress event.
3228
3229         Enable progress events on iOS.
3230
3231         * html/HTMLMediaElement.cpp:
3232         (WebCore::HTMLMediaElement::HTMLMediaElement):
3233         (WebCore::HTMLMediaElement::loadResource):
3234         (WebCore::HTMLMediaElement::seekableTimeRangesLastModifiedTime):
3235         (WebCore::HTMLMediaElement::liveUpdateInterval):
3236         * html/HTMLMediaElement.h:
3237         * platform/cf/CoreMediaSoftLink.cpp:
3238         * platform/cf/CoreMediaSoftLink.h:
3239         * platform/cocoa/WebPlaybackSessionModel.h:
3240         (WebCore::WebPlaybackSessionModelClient::seekableRangesChanged):
3241         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
3242         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
3243         (WebCore::WebPlaybackSessionModelMediaElement::updateForEventName):
3244         (WebCore::WebPlaybackSessionModelMediaElement::observedEventNames):
3245         (WebCore::WebPlaybackSessionModelMediaElement::seekableTimeRangesLastModifiedTime):
3246         (WebCore::WebPlaybackSessionModelMediaElement::liveUpdateInterval):
3247         * platform/graphics/MediaPlayer.cpp:
3248         (WebCore::MediaPlayer::seekableTimeRangesLastModifiedTime):
3249         (WebCore::MediaPlayer::liveUpdateInterval):
3250         * platform/graphics/MediaPlayer.h:
3251         * platform/graphics/MediaPlayerPrivate.h:
3252         (WebCore::MediaPlayerPrivateInterface::seekableTimeRangesLastModifiedTime):
3253         (WebCore::MediaPlayerPrivateInterface::liveUpdateInterval):
3254         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3255         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3256         (WebCore::MediaPlayerPrivateAVFoundationObjC::seekableTimeRangesLastModifiedTime):
3257         (WebCore::MediaPlayerPrivateAVFoundationObjC::liveUpdateInterval):
3258         * platform/ios/WebAVPlayerController.h:
3259         * platform/ios/WebAVPlayerController.mm:
3260         (-[WebAVPlayerController init]):
3261         (-[WebAVPlayerController dealloc]):
3262         (-[WebAVPlayerController observeValueForKeyPath:ofObject:change:context:]):
3263         (-[WebAVPlayerController updateMinMaxTiming]):
3264         (-[WebAVPlayerController hasSeekableLiveStreamingContent]):
3265         (+[WebAVPlayerController keyPathsForValuesAffectingHasSeekableLiveStreamingContent]):
3266         (-[WebAVPlayerController resetMediaState]):
3267         * platform/ios/WebPlaybackSessionInterfaceAVKit.h:
3268         * platform/ios/WebPlaybackSessionInterfaceAVKit.mm:
3269         (WebCore::WebPlaybackSessionInterfaceAVKit::WebPlaybackSessionInterfaceAVKit):
3270         (WebCore::WebPlaybackSessionInterfaceAVKit::resetMediaState):
3271         (WebCore::WebPlaybackSessionInterfaceAVKit::seekableRangesChanged):
3272         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3273         (WebVideoFullscreenControllerContext::seekableRangesChanged):
3274         (WebVideoFullscreenControllerContext::seekableTimeRangesLastModifiedTime):
3275         (WebVideoFullscreenControllerContext::liveUpdateInterval):
3276         * platform/mac/WebPlaybackSessionInterfaceMac.h:
3277         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
3278         (WebCore::WebPlaybackSessionInterfaceMac::seekableRangesChanged):
3279         * platform/spi/cocoa/AVKitSPI.h:
3280         * platform/spi/mac/AVFoundationSPI.h:
3281
3282 2017-06-07  Dave Hyatt  <hyatt@apple.com>
3283
3284         Laili restaurant menu page does not display full menu
3285         https://bugs.webkit.org/show_bug.cgi?id=173062
3286         rdar://problem/32436486
3287
3288         Reviewed by Simon Fraser.
3289
3290         Percentage heights inside auto containing blocks were handled correctly by
3291         hasReplacedLogicalHeight, which checked hasAutoHeightOrContainingBlockWithAutoHeight
3292         properly. min-max-height were not handled properly though and need to do the same check.
3293         
3294         There is also now a quirk for iBooks to preserve the old behavior, since they depend
3295         on the old behavior to constrain the height of images to a page.
3296
3297         Test: fast/replaced/max-height-percent-inside-auto-block.html
3298
3299         * rendering/RenderBox.cpp:
3300         (WebCore::RenderBox::replacedMinMaxLogicalHeightComputesAsNone):
3301         Add a new helper that resolves min and max logical height values to none for
3302         replaced elements with percentage min/max heights inside auto containing blocks.
3303
3304         (WebCore::RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight):
3305         Change the min/max-height constraint function for replaced elements to call the
3306         new helper function.
3307
3308         * rendering/RenderBox.h:
3309         * rendering/RenderBoxModelObject.h:
3310         Move a function from private to protected so that RenderBox can access it.
3311
3312 2017-06-08  Tim Horton  <timothy_horton@apple.com>
3313
3314         Add a borderless mode to <attachment>, and make it respect its layout size
3315         https://bugs.webkit.org/show_bug.cgi?id=173079
3316         <rdar://problem/32491584>
3317
3318         Reviewed by Simon Fraser.
3319
3320         Tests: fast/attachment/attachment-borderless.html
3321                fast/attachment/attachment-respects-css-size.html
3322
3323         * css/CSSPrimitiveValueMappings.h:
3324         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3325         * css/CSSValueKeywords.in:
3326         * platform/ThemeTypes.h:
3327         * rendering/RenderAttachment.cpp:
3328         (WebCore::RenderAttachment::shouldDrawBorder):
3329         * rendering/RenderAttachment.h:
3330         * rendering/RenderTheme.cpp:
3331         (WebCore::RenderTheme::adjustStyle):
3332         (WebCore::RenderTheme::paint):
3333         Add "-webkit-appearance: borderless-attachment;" in addition to "attachment",
3334         so clients can specify the borderless appearance. This isn't specified as a
3335         CSS border because it's a very custom appearance that isn't achievable that way.
3336
3337         * rendering/RenderThemeIOS.mm:
3338         (WebCore::AttachmentInfo::AttachmentInfo):
3339         Use the layout size of the attachment, not the fixed size; we use the fixed
3340         size as our intrinsic size, so most attachments will still be that size,
3341         but if a client specifies a different size, we'll lay out correctly.
3342
3343 2017-06-08  Jer Noble  <jer.noble@apple.com>
3344
3345         YouTube audio stutters when page changes visibility.
3346         https://bugs.webkit.org/show_bug.cgi?id=173102
3347
3348         Reviewed by Eric Carlson.
3349
3350         Don't change renderers when the visibility changes; only use the decompression session
3351         when we were explicitly asked to paint into an accelerated surface.
3352
3353         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3354         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::acceleratedRenderingStateChanged):
3355
3356 2017-06-08  Jer Noble  <jer.noble@apple.com>
3357
3358         Clients of the WK2 C-API don't have their mediaContentTypesRequiringHardwareSupport setting initialized correctly.
3359         https://bugs.webkit.org/show_bug.cgi?id=173091
3360
3361         Reviewed by Eric Carlson.
3362
3363         Add a new default setting value, defined separately in Settings and SettingsCocoa.
3364
3365         * page/Settings.cpp:
3366         (WebCore::Settings::defaultMediaContentTypesRequiringHardwareSupport):
3367         * page/Settings.h:
3368         * page/cocoa/SettingsCocoa.mm:
3369         (WebCore::Settings::defaultMediaContentTypesRequiringHardwareSupport):
3370
3371 2017-06-08  Jer Noble  <jer.noble@apple.com>
3372
3373         Take the mediaContentTypesRequiringHardwareSupport Setting into account when answering HTMLMediaElement::canPlayType()
3374         https://bugs.webkit.org/show_bug.cgi?