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