8ff5f8cd95bbab020693dcb88935d81dc27de13a
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-06-09  Daniel Bates  <dabates@apple.com>
2
3         CSP: Apply img-src directive to favicon loads
4         https://bugs.webkit.org/show_bug.cgi?id=172733
5         <rdar://problem/32082654>
6
7         Reviewed by Brady Eidson.
8
9         Differentiate favicon requests from raw resources requests so that we can apply the Content
10         Security Policy to favicon requests.
11
12         Tests: http/tests/security/contentSecurityPolicy/allow-favicon.html
13                http/tests/security/contentSecurityPolicy/block-favicon.html
14
15         * inspector/InspectorPageAgent.cpp:
16         (WebCore::InspectorPageAgent::cachedResourceContent): Keep our current behavior and treat a
17         favicon resource analogous to a raw resource.
18         (WebCore::InspectorPageAgent::cachedResourceType): Ditto.
19         * loader/LinkLoader.cpp:
20         (WebCore::createLinkPreloadResourceClient): Now that we differentiate between a favicon
21         and a raw resource we add favicons to the list of unsupported <link as="..."> types. This
22         makes the list of handled request destination types more closely match the list of valid types
23         documented in <https://fetch.spec.whatwg.org/#concept-request-destination> (24 May 2017).
24         * loader/ResourceLoadInfo.cpp:
25         (WebCore::toResourceType): Keep our current behavior and treat a favicon resource analogous
26         to a raw resource.
27         * loader/SubresourceLoader.cpp:
28         (WebCore::logResourceLoaded): Ditto.
29         * loader/cache/CachedRawResource.cpp:
30         (WebCore::CachedRawResource::CachedRawResource): Update for renaming.
31         * loader/cache/CachedRawResource.h:
32         (isType): Ditto.
33         * loader/cache/CachedResource.cpp:
34         (WebCore::CachedResource::defaultPriorityForResourceType): Keep our current behavior and treat
35         a favicon resource analogous to a raw resource.
36         * loader/cache/CachedResource.h:
37         (WebCore::CachedResource::isMainOrMediaOrFaviconOrRawResource): Renamed; formerly named isMainOrMediaOrRawResource.
38         Also return true if the this resource is a favicon.
39         (WebCore::CachedResource::ignoreForRequestCount): Keep our current behavior and treat a
40         favicon resource analogous to a raw resource.
41         (WebCore::CachedResource::isMainOrMediaOrRawResource): Deleted; renamed to isMainOrMediaOrFaviconOrRawResource.
42         * loader/cache/CachedResourceLoader.cpp:
43         (WebCore::createResource): Keep our current behavior and treat a favicon resource analogous
44         to a raw resource.
45         (WebCore::CachedResourceLoader::requestFavicon): Added.
46         (WebCore::contentTypeFromResourceType): Keep our current behavior and treat a favicon
47         resource analogous to a raw resource.
48         (WebCore::CachedResourceLoader::checkInsecureContent): Ditto.
49         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy): Check if the favicon is
50         allowed by the CSP of the page.
51         (WebCore::CachedResourceLoader::determineRevalidationPolicy): Update for renaming.
52         * loader/cache/CachedResourceLoader.h:
53         * loader/icon/IconLoader.cpp:
54         (WebCore::IconLoader::startLoading): Substitute call CachedResourceLoader::requestFavicon() for CachedResourceLoader::requestRawResource()
55         and remove comment about ContentSecurityPolicyImposition::DoPolicyCheck being a placeholder. This is no longer the
56         case. This resource request option is now meaningful as we want to apply the CSP of the page with respect to the
57         request for the favicon.
58
59 2017-06-09  Wenson Hsieh  <wenson_hsieh@apple.com>
60
61         [iOS DnD] Add a hook to perform two-step drops in editable content
62         https://bugs.webkit.org/show_bug.cgi?id=172992
63         <rdar://problem/32590174>
64
65         Reviewed by Tim Horton.
66
67         Adds hooks in DragController::concludeEditDrag to give the client layer a chance to perform custom handling when
68         dropping in editable content.
69         Tests:  DataInteractionTests.InjectedBundleOverridePerformTwoStepDrop
70                 DataInteractionTests.InjectedBundleAllowPerformTwoStepDrop
71
72         * loader/EmptyClients.cpp:
73         * page/DragController.cpp:
74         (WebCore::DragController::concludeEditDrag):
75         * page/EditorClient.h:
76
77 2017-06-09  Matthew Hanson  <matthew_hanson@apple.com>
78
79         Revert r217955. rdar://problem/21125708
80
81 2017-06-06 Konstantin Tokarev  <annulen@yandex.ru>
82
83         [MediaFoundation] Volume controls of different media elements should be independent
84         https://bugs.webkit.org/show_bug.cgi?id=172967
85
86         Based on patch by Vitaly Slobodin <vitaliy.slobodin@gmail.com>
87         Reviewed by Alex Christensen.
88
89         IMFSimpleAudioVolume interface controls master volume of the
90         application. We should use IMFAudioStreamVolume interface instead.
91
92         No new tests needed.
93
94         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
95         (WebCore::MediaPlayerPrivateMediaFoundation::MediaPlayerPrivateMediaFoundation):
96         (WebCore::MediaPlayerPrivateMediaFoundation::setAllChannelVolumes):
97         (WebCore::MediaPlayerPrivateMediaFoundation::setVolume):
98         (WebCore::MediaPlayerPrivateMediaFoundation::setMuted):
99         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
100
101 2017-06-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
102
103         Image should clear its ImageObserver* when CachedImage releases the last reference to its RefCounted<ImageObserver>
104         https://bugs.webkit.org/show_bug.cgi?id=173077
105
106         Reviewed by Simon Fraser.
107
108         Before dereferencing ImageObserver, CachedImage::clearImage() should check
109         whether it is the only object that holds a reference to this ImageObserver.
110         And if this is true, m_image have to clear its raw pointer to the deleted
111         ImageObserver by calling m_image->setImageObserver(nullptr).
112
113         * loader/cache/CachedImage.cpp:
114         (WebCore::CachedImage::setBodyDataFrom):
115         (WebCore::CachedImage::CachedImageObserver::CachedImageObserver):
116         (WebCore::CachedImage::clearImage):
117         * loader/cache/CachedImage.h:
118
119 2017-06-09  Frederic Wang  <fwang@igalia.com>
120
121         Add flag allow-popups-to-escape-sandbox to iframe sandbox
122         https://bugs.webkit.org/show_bug.cgi?id=158875
123
124         Reviewed by Chris Dumez.
125
126         This patch adds support for the iframe@allow-popups-to-escape-sandbox attribute.
127         This allows to pass more W3C Web Platform tests.
128
129         Tests: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html
130                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-2.html
131
132         * dom/SecurityContext.cpp: Add allow-popups-to-escape-sandbox flag.
133         (WebCore::SecurityContext::isSupportedSandboxPolicy):
134         (WebCore::SecurityContext::parseSandboxPolicy):
135         * dom/SecurityContext.h: Ditto.
136         * loader/FrameLoader.cpp:
137         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): Do not force sandbox flags when we have allow-popups-to-escape-sandbox.
138         (WebCore::createWindow): Ditto.
139
140 2017-06-09  Jer Noble  <jer.noble@apple.com>
141
142         [iOS] Video occasionally mixes with other system audio instead of interrupting
143         https://bugs.webkit.org/show_bug.cgi?id=173127
144
145         Reviewed by Eric Carlson.
146
147         Tests: platform/mac/audio-session-category-video-track-change.html
148
149         When an HTMLMediaElement's tracks change their enabled state, make sure to update
150         the PlatformMediaElement, for canProduceAudio() may have changed. 
151
152         * html/HTMLMediaElement.cpp:
153         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
154         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
155         (PlatformMediaSessionManager::updateSessionState):
156
157         The rest of the changes in this revision are to allow the above to be testable.
158
159         * page/Settings.cpp:
160         * page/Settings.h:
161         * platform/audio/AudioSession.h:
162         * platform/audio/mac/AudioSessionMac.cpp:
163         (WebCore::AudioSession::category):
164         (WebCore::AudioSession::setCategory):
165         * testing/InternalSettings.cpp:
166         (WebCore::InternalSettings::Backup::Backup):
167         (WebCore::InternalSettings::Backup::restoreTo):
168         (WebCore::InternalSettings::setShouldManageAudioSessionCategory):
169         * testing/InternalSettings.h:
170         * testing/InternalSettings.idl:
171         * testing/Internals.cpp:
172         (WebCore::Internals::audioSessionCategory):
173         * testing/Internals.h:
174         * testing/Internals.idl:
175
176 2017-06-09  Chris Dumez  <cdumez@apple.com>
177
178         CSS transitions added while page is not visible do not start when the page becomes visible
179         https://bugs.webkit.org/show_bug.cgi?id=173166
180         <rdar://problem/32250351>
181
182         Reviewed by Darin Adler.
183
184         CSS transitions added while page is not visible would not start when the page becomes
185         visible. The issue was that when CompositeAnimation::updateTransitions() was called
186         while the page is hidden (and animations are therefore suspended), it would not
187         populate m_transations with ImplicitAnimation objects. We would therefore have later
188         no transitions to resume when the page becomes visible later on. This patch updates
189         CompositeAnimation::updateTransitions() to properly populate m_transitions and instead
190         pause the ImplicitAnimation it creates if animations are currently suspended. This
191         behavior is more consistent with the one of CompositeAnimation::updateKeyframeAnimations().
192
193         I also needed to update ImplicitAnimation::animate() to not restart a paused animation
194         if the animation is currently paused. This is similar to what is done in
195         KeyframeAnimation::animate(). Without this, the paused ImplicitAnimation we add to
196         m_transition would incorrectly get unpaused while the page is still hidden and the
197         animations are still supposed to be suspended. This issue was showing when running the
198         test I am adding in this patch.
199
200         Test: fast/animation/css-animation-resuming-when-visible.html
201
202         * page/animation/CompositeAnimation.cpp:
203         (WebCore::CompositeAnimation::updateTransitions):
204         * page/animation/ImplicitAnimation.cpp:
205         (WebCore::ImplicitAnimation::animate):
206         (WebCore::ImplicitAnimation::reset):
207         * page/animation/ImplicitAnimation.h:
208
209 2017-06-09  Yusuke Suzuki  <utatane.tea@gmail.com>
210
211         Unreviewed, Use FALLTHROUGH
212
213         * loader/LinkLoader.cpp:
214         (WebCore::createLinkPreloadResourceClient):
215
216 2017-06-09  Eric Carlson  <eric.carlson@apple.com>
217
218         fast/mediastream/MediaStream-page-muted.html times out and asserts
219         https://bugs.webkit.org/show_bug.cgi?id=170355
220         <rdar://problem/31376041>
221
222         MediaStream and MediaStreamTrack need to prevent JS wrapper collection while it is possible
223         to fire an event or event listeners won't be notified.
224
225         Reviewed by Chris Dumez.
226
227         Test: fast/mediastream/media-stream-wrapper-collected.html
228
229         * Modules/mediastream/MediaStream.cpp:
230         (WebCore::MediaStream::MediaStream): Initialize ActiveDOMObject.
231         (WebCore::MediaStream::stop): New.
232         (WebCore::MediaStream::activeDOMObjectName): Ditto.
233         (WebCore::MediaStream::canSuspendForDocumentSuspension): Ditto.
234         (WebCore::MediaStream::hasPendingActivity): Ditto, prevent collection if there
235         are registered event listeners.
236         (WebCore::MediaStream::contextDestroyed): Deleted.
237         * Modules/mediastream/MediaStream.h:
238         * Modules/mediastream/MediaStream.idl:
239
240         * Modules/mediastream/MediaStreamTrack.cpp:
241         (WebCore::MediaStreamTrack::hasPendingActivity): Prevent collection if there
242         are registered event listeners.
243         * Modules/mediastream/MediaStreamTrack.h:
244
245         * testing/Internals.cpp:
246         (WebCore::Internals::removeMediaStreamTrack): stream.removeTrack doesn't generate a 'removetrack'
247         event, so call private method that does.
248         * testing/Internals.h:
249         * testing/Internals.idl:
250
251 2017-06-09  Daewoong Jang  <daewoong.jang@navercorp.com>
252
253         [cURL] Remove a call to Windows API
254         https://bugs.webkit.org/show_bug.cgi?id=172079
255
256         Reviewed by Yusuke Suzuki.
257
258         * platform/network/curl/CurlDownload.cpp:
259         (WebCore::CurlDownload::moveFileToDestination):
260         * platform/win/FileSystemWin.cpp:
261         (WebCore::moveFile):
262
263 2017-06-09  Miguel Gomez  <magomez@igalia.com>
264
265         [GTK][WPE] Fix alpha premultiplying when using cairo to draw the video frames
266         https://bugs.webkit.org/show_bug.cgi?id=173097
267
268         Reviewed by Carlos Garcia Campos.
269
270         We need to premultiply alpha when creating a cairo surface from a GStreamer video frame, if the frame
271         has an alpha component. Currently this is wrongly done in VideoSinkGStreamer, as it assumes that every
272         frame is going to be rendered with cairo, which is not the case when using accelerated compositing.
273         The premultiply must happen inside ImageGStreamerCairo, which is where we know that the frame is
274         going to be rendered with cairo, and where the premultiply can be performed when gstreamer-gl is
275         enabled as well.
276
277         Covered by existent tests.
278
279         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
280         (ImageGStreamer::ImageGStreamer):
281         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
282         (webkitVideoSinkRequestRender):
283
284 2017-06-09  Zan Dobersek  <zdobersek@igalia.com>
285
286         [WPE] Enable ENCRYPTED_MEDIA for build-webkit builds
287         https://bugs.webkit.org/show_bug.cgi?id=173103
288
289         Reviewed by Xabier Rodriguez-Calvar.
290
291         * Modules/encryptedmedia/CDM.cpp:
292         (WebCore::CDM::getSupportedCapabilitiesForAudioVideoType):
293         Pass the ParsedContentType's mime type string to the explicit ContentType
294         constructor and assign that to the MediaEngineSupportParameters' type
295         member.
296
297 2017-06-08  Ryosuke Niwa  <rniwa@webkit.org>
298
299         Move TreeScope::adoptIfNeeded to Node and rename it to setTreeScopeRecursively
300         https://bugs.webkit.org/show_bug.cgi?id=173129
301
302         Reviewed by Antti Koivisto.
303
304         Renamed TreeScope::adoptIfNeeded to setTreeScopeRecursively and moved to Node.
305
306         The old name was really confusing because due to the existence of Document::adoptNode, a DOM API,
307         which removes the adopted node from its parent if there was one before adopting the node.
308         Most confusingly, this function called TreeScope::adoptIfNeeded.
309
310         Also inlined the tree scope check to avoid calling to moveTreeToNewScope when there is nothing to do.
311
312         This patch effectively reverts r104528.
313
314         No new tests. Existing tests cover this.
315
316         * dom/Attr.cpp:
317         (WebCore::Attr::detachFromElementWithValue):
318         (WebCore::Attr::attachToElement):
319         * dom/ContainerNode.cpp:
320         (WebCore::ContainerNode::takeAllChildrenFrom):
321         (WebCore::ContainerNode::insertBefore):
322         (WebCore::ContainerNode::replaceChild):
323         (WebCore::ContainerNode::removeBetween):
324         (WebCore::ContainerNode::replaceAllChildren):
325         (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck):
326         (WebCore::ContainerNode::parserAppendChild):
327         * dom/ContainerNodeAlgorithms.cpp:
328         (WebCore::addChildNodesToDeletionQueue):
329         * dom/Document.cpp:
330         (WebCore::Document::adoptNode):
331         * dom/Element.cpp:
332         (WebCore::Element::ensureAttr):
333         * dom/Node.cpp:
334         (WebCore::DidMoveToNewDocumentAssertionScope): Added. The old assertion wasn't sufficient when
335         HTMLTemplateElement made a recursive call to setTreeScopeRecursively.
336         (WebCore::DidMoveToNewDocumentAssertionScope::DidMoveToNewDocumentAssertionScope):
337         (WebCore::DidMoveToNewDocumentAssertionScope::~DidMoveToNewDocumentAssertionScope):
338         (WebCore::DidMoveToNewDocumentAssertionScope::didRecieveCall):
339         (WebCore::moveNodeToNewDocument): Moved from TreeScope. Calls to incrementReferencingNodeCount
340         and decrementReferencingNodeCount to Node::didMoveToNewDocument. This function is now eliminated
341         in a release build.
342         (WebCore::moveShadowTreeToNewDocument): Moved from TreeScope.
343         (WebCore::Node::moveTreeToNewScope): Ditto.
344         (WebCore::Node::didMoveToNewDocument): See the description for moveNodeToNewDocument above.
345         * dom/Node.h:
346         (WebCore::Node::isParsingChildrenFinished): Moved to avoid having its own protected section.
347         (WebCore::Node::setIsParsingChildrenFinished): Ditto.
348         (WebCore::Node::clearIsParsingChildrenFinished): Ditto.
349         (WebCore::Node::setTreeScopeRecursively): Moved from TreeScope::adoptIfNeeded.
350         * dom/ShadowRoot.cpp:
351         (WebCore::ShadowRoot::~ShadowRoot):
352         * dom/TreeScope.cpp:
353         (WebCore::TreeScope::adoptIfNeeded): Deleted.
354         (WebCore::TreeScope::moveTreeToNewScope): Deleted.
355         (WebCore::TreeScope::ensureDidMoveToNewDocumentWasCalled): Deleted.
356         (WebCore::TreeScope::moveNodeToNewDocument): Deleted.
357         (WebCore::TreeScope::moveShadowTreeToNewDocument): Deleted.
358         * dom/TreeScope.h:
359         * html/HTMLTemplateElement.cpp:
360         (WebCore::HTMLTemplateElement::didMoveToNewDocument):
361
362 2017-06-09  Adrien Plazas  <aplazas@igalia.com>
363
364         [GTK] Add kinetic scrolling
365         https://bugs.webkit.org/show_bug.cgi?id=155750
366
367         Reviewed by Carlos Garcia Campos.
368
369         Patch by Adrien Plazas and Yusuke Suzuki.
370
371         Add the ScrollAnimationKinetic scrolling animation allowing to perform momentum scrolling; it is based on GTK+'s
372         GtkKineticScrolling type.
373
374         Add the notion of phase, momentum phase and swipe velocity to PlatformWheelEvent.
375
376         Depending on whether the scrolling ended normally or triggered a swipe, the scroll animator will either compute
377         the swipe velocity from the previous scrolling events or use the one from the swipe gesture to initiate the
378         momentum scrolling.
379
380         * PlatformGTK.cmake:
381         * platform/PlatformWheelEvent.h:
382         (WebCore::PlatformWheelEvent::setHasPreciseScrollingDeltas):
383         (WebCore::PlatformWheelEvent::phase):
384         (WebCore::PlatformWheelEvent::momentumPhase):
385         (WebCore::PlatformWheelEvent::isTransitioningToMomentumScroll):
386         * platform/ScrollAnimation.h:
387         (WebCore::ScrollAnimation::scroll):
388         (WebCore::ScrollAnimation::updateVisibleLengths):
389         (WebCore::ScrollAnimation::setCurrentPosition):
390         * platform/ScrollAnimationKinetic.cpp: Added.
391         (WebCore::ScrollAnimationKinetic::PerAxisData::PerAxisData):
392         (WebCore::ScrollAnimationKinetic::PerAxisData::animateScroll):
393         (WebCore::ScrollAnimationKinetic::ScrollAnimationKinetic):
394         (WebCore::ScrollAnimationKinetic::~ScrollAnimationKinetic):
395         (WebCore::ScrollAnimationKinetic::stop):
396         (WebCore::ScrollAnimationKinetic::start):
397         (WebCore::ScrollAnimationKinetic::animationTimerFired):
398         * platform/ScrollAnimationKinetic.h: Copied from Source/WebCore/platform/ScrollAnimation.h.
399         * platform/gtk/PlatformWheelEventGtk.cpp:
400         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
401         (WebCore::PlatformWheelEvent::swipeVelocity):
402         * platform/gtk/ScrollAnimatorGtk.cpp:
403         (WebCore::ScrollAnimatorGtk::ScrollAnimatorGtk):
404         (WebCore::ScrollAnimatorGtk::ensureSmoothScrollingAnimation):
405         (WebCore::ScrollAnimatorGtk::scroll):
406         (WebCore::ScrollAnimatorGtk::scrollToOffsetWithoutAnimation):
407         (WebCore::ScrollAnimatorGtk::computeVelocity):
408         (WebCore::ScrollAnimatorGtk::handleWheelEvent):
409         (WebCore::ScrollAnimatorGtk::willEndLiveResize):
410         (WebCore::ScrollAnimatorGtk::updatePosition):
411         (WebCore::ScrollAnimatorGtk::didAddVerticalScrollbar):
412         (WebCore::ScrollAnimatorGtk::didAddHorizontalScrollbar):
413         * platform/gtk/ScrollAnimatorGtk.h:
414
415 2017-06-09  Zan Dobersek  <zdobersek@igalia.com>
416
417         [GCrypt] ECDSA signing results can be smaller than the EC key size
418         https://bugs.webkit.org/show_bug.cgi?id=171535
419
420         Reviewed by Jiewen Tan.
421
422         The libgcrypt-based implementation of the ECDSA signing operation does not
423         properly address the resulting `r` and `s` integers that do not potentially
424         match the EC key in terms of size.
425
426         To address that, the retrieved MPI data for both integers is handled depending
427         on the size of said data. Strictly requiring an amount of bytes that matches
428         the key data size N, we simply take the last N bytes if the MPI data is equal
429         or larger than N in size. If smaller, we first append enough zero bytes to the
430         output Vector object before attaching the MPI data in whole so that the amount
431         of appended bytes matches N.
432
433         No new tests -- covers an implementation detail that is not trivial to test,
434         but can rely sufficiently on existing tests.
435
436         * crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
437         (WebCore::extractECDSASignatureInteger):
438         (WebCore::gcryptSign):
439
440 2017-06-09  Daewoong Jang  <daewoong.jang@navercorp.com>
441
442         Reduce compiler warnings
443         https://bugs.webkit.org/show_bug.cgi?id=172078
444
445         Reviewed by Yusuke Suzuki.
446
447         * platform/network/curl/CookieJarCurl.cpp:
448         (WebCore::addMatchingCurlCookie):
449         (WebCore::getHostnamesWithCookies):
450         (WebCore::deleteCookiesForHostnames):
451         (WebCore::deleteCookiesForHostname): Deleted.
452         * platform/network/curl/CurlDownload.cpp:
453         (WebCore::CurlDownloadManager::downloadThread):
454         (WebCore::CurlDownload::didReceiveHeader):
455         * platform/network/curl/CurlDownload.h:
456         (WebCore::CurlDownloadListener::didReceiveDataOfLength):
457         * platform/network/curl/ResourceHandleCurl.cpp:
458         (WebCore::WebCoreSynchronousLoader::didReceiveResponse):
459         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
460         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
461         (WebCore::createCopy):
462         (WebCore::SocketStreamHandleImpl::readData):
463
464 2017-06-09  Xabier Rodriguez Calvar  <calvaris@igalia.com>
465
466         [GStreamer][EME] Remove the legacy code that was not even official and is deprecated
467         https://bugs.webkit.org/show_bug.cgi?id=173096
468
469         Reviewed by Žan Doberšek.
470
471         We are removing the LEGACY_ENCRYPTED_MEDIA code that we was not
472         official, is deprecated and we are not planning to support it
473         anymore in any way.
474
475         This also helps implementing current ENCRYPTED_MEDIA in a cleaner
476         way.
477
478         * platform/GStreamer.cmake:
479         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
480         * platform/graphics/gstreamer/GStreamerUtilities.h:
481         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
482         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
483         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
484         (WebCore::registerWebKitGStreamerElements):
485         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
486         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
487         (WebCore::extractEventsAndSystemsFromMessage): Deleted.
488         (WebCore::MediaPlayerPrivateGStreamerBase::needKey): Deleted.
489         (WebCore::MediaPlayerPrivateGStreamerBase::setCDMSession): Deleted.
490         (WebCore::MediaPlayerPrivateGStreamerBase::keyAdded): Deleted.
491         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent): Deleted.
492         (WebCore::MediaPlayerPrivateGStreamerBase::receivedGenerateKeyRequest): Deleted.
493         (WebCore::keySystemIdToUuid): Deleted.
494         (WebCore::MediaPlayerPrivateGStreamerBase::createSession): Deleted.
495         (WebCore::MediaPlayerPrivateGStreamerBase::dispatchDecryptionKey): Deleted.
496         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
497         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
498         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h:
499         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
500         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
501         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
502         (WebCore::AppendPipeline::AppendPipeline):
503         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
504         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
505         (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
506         (WebCore::appendPipelineElementMessageCallback): Deleted.
507         (WebCore::AppendPipeline::dispatchPendingDecryptionKey): Deleted.
508         (WebCore::AppendPipeline::dispatchDecryptionKey): Deleted.
509         (WebCore::AppendPipeline::handleElementMessage): Deleted.
510         * platform/graphics/gstreamer/mse/AppendPipeline.h:
511         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
512         (WebCore::MediaPlayerPrivateGStreamerMSE::dispatchDecryptionKey): Deleted.
513         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
514
515 2017-06-09  Aaron Chu  <aaron_chu@apple.com>
516
517         AX: Media Controls: Missing labels for the Time Labels.
518         https://bugs.webkit.org/show_bug.cgi?id=171715
519         <rdar://problem/32009214>
520
521         Reviewed by Antoine Quint.
522
523         Added aria-label to describe time labels in media controls.
524
525         * Modules/modern-media-controls/controls/slider.js:
526         (Slider.prototype.set inputAccessibleLabel):
527         (Slider.prototype._formatTime): Deleted.
528         * Modules/modern-media-controls/controls/time-label.js:
529         (TimeLabel.prototype.commitProperty):
530         * Modules/modern-media-controls/main.js:
531         (formatTimeToString):
532
533 2017-06-08  Carlos Garcia Campos  <cgarcia@igalia.com>
534
535         Unreviewed. Fix unused parameter warning after r217955.
536
537         * platform/graphics/FontFamilySpecificationNull.h:
538         (WebCore::FontFamilySpecificationNull::fontRanges):
539
540 2017-06-08  Yoav Weiss  <yoav@yoav.ws>
541
542         [preload] Mandatory `as` value and related spec alignments
543         https://bugs.webkit.org/show_bug.cgi?id=173047
544
545         Reviewed by Dean Jackson.
546
547         Align preload's implementation according to latest spec changes: `as` is mandatory and "fetch" replaces the previous empty `as` value,
548         onerror no longer fires for invalid `as` values, and the IDL for `as` reflects only valid values, to enable feature detection.
549
550         Related standard discussions:
551         https://github.com/w3c/preload/issues/80
552         https://github.com/whatwg/fetch/pull/547
553         https://github.com/whatwg/fetch/pull/549
554         https://github.com/whatwg/html/pull/2588
555
556         No new tests but modified existing ones as well as their expectations.
557
558         * html/HTMLLinkElement.cpp: Add "enumerated attribute" reflection methods to `as`.
559         (WebCore::HTMLLinkElement::setAs):
560         (WebCore::HTMLLinkElement::as):
561         * html/HTMLLinkElement.h:
562         * html/HTMLLinkElement.idl:
563         * loader/LinkLoader.cpp:
564         (WebCore::LinkLoader::loadLinksFromHeader): preloadIfNeeded signature change.
565         (WebCore::LinkLoader::resourceTypeFromAsAttribute): Replace the empty value by "fetch".
566         (WebCore::LinkLoader::preloadIfNeeded): Change the signature, as a LinkLoaderClient is no longer needed, since we don't fire error
567         events from inside the function.
568         (WebCore::LinkLoader::loadLink): preloadIfNeeded signature change.
569         * loader/LinkLoader.h: preloadIfNeeded signature change.
570
571 2017-06-08  Chris Dumez  <cdumez@apple.com>
572
573         [iOS] LowPowerModeNotifier notifies client on non-main thread
574         https://bugs.webkit.org/show_bug.cgi?id=173115
575         <rdar://problem/32644703>
576
577         Reviewed by Ryosuke Niwa.
578
579         Update iOS's implementation of the LowPowerModeNotifier to make sure
580         we notify the client of low power mode changes on the main thread.
581
582         * platform/ios/LowPowerModeNotifierIOS.mm:
583         (-[WebLowPowerModeObserver _didReceiveLowPowerModeChange]):
584
585 2017-06-08  Ryosuke Niwa  <rniwa@webkit.org>
586
587         Crash inside InsertNodeBeforeCommand via InsertParagraphSeparatorCommand
588         https://bugs.webkit.org/show_bug.cgi?id=173085
589         <rdar://problem/32575059>
590
591         Reviewed by Wenson Hsieh.
592
593         The crash was caused by the condition to check for special cases failing when visiblePos is null.
594         Exit early in these extreme cases.
595
596         Also replaced the use of deprecatedNode and deprecatedEditingOffset to modern idioms.
597
598         Test: editing/inserting/insert-horizontal-rule-in-empty-document-crash.html
599
600         * editing/InsertParagraphSeparatorCommand.cpp:
601         (WebCore::InsertParagraphSeparatorCommand::doApply):
602
603 2017-06-08  Ryosuke Niwa  <rniwa@webkit.org>
604
605         The tree scope of an Attr node inside a shadow tree does not updated upon detach.
606         https://bugs.webkit.org/show_bug.cgi?id=173122
607
608         Reviewed by Chris Dumez.
609
610         The crash was caused by the tree scope of an Attr detached from an element inside a shadow root
611         not getting updated.
612
613         Test: fast/dom/detaching-attr-node-in-shadow-tree-crash.html
614
615         * dom/Attr.cpp:
616         (WebCore::Attr::~Attr): Added assertions.
617         (WebCore::Attr::detachFromElementWithValue): Fixed the bug by adopting Attr to Document.
618         (WebCore::Attr::attachToElement): Moved the adoptIfNeeded call here from attachAttributeNodeIfNeeded.
619         * dom/Element.cpp:
620         (WebCore::Element::attachAttributeNodeIfNeeded):
621
622 2017-06-08  Myles C. Maxfield  <mmaxfield@apple.com>
623
624         [Cocoa] Expand system-ui to include every item in the Core Text cascade list
625         https://bugs.webkit.org/show_bug.cgi?id=173043
626         <rdar://problem/21125708>
627
628         Reviewed by Simon Fraser.
629
630         The concept of the system font on Cocoa platforms represents the entire Core Text cascade list.
631         However, previously, WebKit only represented system-ui by pulling out the first item in the Core
632         Text cascade list. Instead, we should make all text rendered with "system-ui" match what the
633         platform would natively render.
634
635         Previously, we walked through the strings in the font-family property and looked them up one by
636         one. However, now we want to abstract this idea of a font family to possibly hold a
637         CTFontDescriptorRef instead of a string. This way, we expand a font-family list of ["fontA",
638         "system-ui", "fontB"] to ["fontA", ... a bunch of CTFontDescriptorRefs ..., "FontB"]. We can
639         then modify the consumer of this object to have two codepaths: the old string-based codepath,
640         and a new, platform-specific codepath which simply embeds the CTFontDesriptorRefs inside a Font
641         object.
642
643         We don't want to simply pull out the family name from each item in the Core Text fallback list
644         because that is a lossy translation. There is more information in these font descriptors which
645         cannot be represented by CSS. Therefore, we must keep the descriptors alive and add the new
646         codepath for them.
647
648         We also don't want to run the CSS font matching algorithm on each member of the Core Text
649         fallback list because it may yield different results from Core Text's font matching algorithm.
650         Our goal is to draw text as closely as possible to the system APIs. If we ran it, we may find
651         a font which is closer to the requested traits, but it would look out of place on the system.
652
653         Tests: fast/text/system-font-fallback-emoji.html
654                fast/text/system-font-fallback.html
655
656         * WebCore.xcodeproj/project.pbxproj:
657         * page/MemoryRelease.cpp:
658         (WebCore::releaseNoncriticalMemory):
659         * platform/graphics/FontCascadeFonts.cpp:
660         (WebCore::realizeNextFallback): The consumer of our new data type. Now uses WTF::visit().
661         (WebCore::FontCascadeFonts::realizeFallbackRangesAt): Now that the number of items to test
662         against the current character is larger than the number of strings in the font-family list,
663         we need to update the existing code to use the correct value.
664         * platform/graphics/FontDescription.cpp: Default implementation for non-Cocoa ports.
665         (WebCore::FontDescription::invalidateCaches):
666         (WebCore::FontCascadeDescription::effectiveFamilyCount):
667         (WebCore::FontCascadeDescription::effectiveFamilyAt):
668         * platform/graphics/FontDescription.h: Our new data type is a Variant of AtomicString and a
669         platform-specific class. Cocoa uses a class that holds a CTFontDescriptorRef and other ports
670         use an empty non-constructable class.
671         * platform/graphics/FontFamilySpecificationNull.h: Added. The empty non-constructable
672         class.
673         (WebCore::FontFamilySpecificationNull::fontRanges):
674         * platform/graphics/cocoa/FontCacheCoreText.cpp:
675         (WebCore::FontCache::platformInit): Changing the system language will change the system font
676         fallback list, so we need to listen to this notification. This also matters for
677         FontCache::systemFallbackForCharacters(), so we should build off the same callback we are
678         already using for font installation.
679         (WebCore::invalidateFontCache):
680         * platform/graphics/cocoa/FontDescriptionCocoa.cpp: Added. The platform-specific creation of
681         our CTFontDescriptorRefs. We hold them cached in a SystemFontDatabase.
682         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::CoreTextCascadeListParameters):
683         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::isHashTableDeletedValue):
684         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::operator==):
685         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::hash):
686         (WebCore::SystemFontDatabase::singleton):
687         (WebCore::SystemFontDatabase::systemFontCascadeList):
688         (WebCore::SystemFontDatabase::clear):
689         (WebCore::SystemFontDatabase::SystemFontDatabase):
690         (WebCore::SystemFontDatabase::applyWeightAndItalics):
691         (WebCore::SystemFontDatabase::computeCascadeList):
692         (WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::hash):
693         (WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::equal):
694         (WebCore::isSystemFontString):
695         (WebCore::systemFontParameters):
696         (WebCore::FontDescription::invalidateCaches):
697         (WebCore::FontCascadeDescription::effectiveFamilyCount): We don't store the result of this
698         because it would probably be a bad idea to increase the size of every single FontCascade just
699         in case it might ask for the system font. Most fonts never mention system-ui. Because it's so
700         rare, we can just recalculate the result of this as necessary. This shouldn't be slow because
701         the results are cached.
702         (WebCore::FontCascadeDescription::effectiveFamilyAt):
703         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp: Added.
704         (WebCore::FontFamilySpecificationCoreText::fontRanges): Create a FontRanges from a
705         CTFontDescriptorRef.
706         * platform/graphics/cocoa/FontFamilySpecificationCoreText.h: Added.
707         (WebCore::FontFamilySpecificationCoreText::FontFamilySpecificationCoreText):
708         * platform/graphics/ios/FontCacheIOS.mm: Delete the old handling for system-ui.
709         (WebCore::platformFontWithFamilySpecialCase):
710         (WebCore::baseSystemFontDescriptor): Deleted.
711         (WebCore::systemFontModificationAttributes): Deleted.
712         (WebCore::systemFontDescriptor): Deleted.
713         * platform/graphics/mac/FontCacheMac.mm: Ditto.
714         (WebCore::platformFontWithFamilySpecialCase):
715         (WebCore::toNSFontWeight): Deleted.
716
717 2017-06-08  Chris Dumez  <cdumez@apple.com>
718
719         Update Timer to take a WTF::Function instead of a std::function
720         https://bugs.webkit.org/show_bug.cgi?id=173113
721
722         Reviewed by Brady Eidson.
723
724         Update Timer to take a WTF::Function instead of a std::function as we prefer
725         to use WTF::Function in WebKit.
726
727         * platform/GenericTaskQueue.cpp:
728         (WebCore::TaskDispatcher<Timer>::sharedTimer):
729         * platform/Timer.h:
730         (WebCore::Timer::Timer):
731         (WebCore::DeferrableOneShotTimer::DeferrableOneShotTimer):
732
733 2017-06-08  Carlos Alberto Lopez Perez  <clopez@igalia.com>
734
735         [WebRTC] enableMockMediaEndpoint() is only used for the OpenWebRTC backend.
736         https://bugs.webkit.org/show_bug.cgi?id=173108
737
738         Reviewed by Eric Carlson.
739
740         Covered by existing tests.
741
742         * testing/Internals.cpp:
743         (WebCore::Internals::Internals):
744         (WebCore::Internals::enableMockMediaEndpoint):
745         * testing/Internals.h:
746
747 2017-06-08  Antoine Quint  <graouts@apple.com>
748
749         [iOS] Buttons in top-left and bottom media controls bar are positioned too high
750         https://bugs.webkit.org/show_bug.cgi?id=173111
751         <rdar://problem/32650615>
752
753         Reviewed by Jon Lee.
754
755         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-button-padding.html
756
757         Since we use flex box to vertically center buttons in a buttons container, there is no
758         need to offset the button due to padding in the y-axis.
759
760         * Modules/modern-media-controls/controls/buttons-container.css:
761         (.ios .buttons-container button):
762
763 2017-06-08  Jeremy Jones  <jeremyj@apple.com>
764
765         Implement additional AVPlayerController interfaces for minTime and maxTime.
766         https://bugs.webkit.org/show_bug.cgi?id=172396
767         rdar://problem/30737452
768
769         Reviewed by Jer Noble.
770
771         No new tests because no change to DOM.
772
773         Add support for new HLS UI in AVKit.
774
775         This adds new properties (seekableTimeRangesLastModifiedTime, liveUpdateInterval, minTiming, maxTiming) to WebAVPlayerController.
776         Plumb these properties from AVPlayer up to AVKit.
777
778         Switch WebPlaybackSessionModelMediaElement from updating seekableRangesChanged using timeupdate event to using progress event.
779
780         Enable progress events on iOS.
781
782         * html/HTMLMediaElement.cpp:
783         (WebCore::HTMLMediaElement::HTMLMediaElement):
784         (WebCore::HTMLMediaElement::loadResource):
785         (WebCore::HTMLMediaElement::seekableTimeRangesLastModifiedTime):
786         (WebCore::HTMLMediaElement::liveUpdateInterval):
787         * html/HTMLMediaElement.h:
788         * platform/cf/CoreMediaSoftLink.cpp:
789         * platform/cf/CoreMediaSoftLink.h:
790         * platform/cocoa/WebPlaybackSessionModel.h:
791         (WebCore::WebPlaybackSessionModelClient::seekableRangesChanged):
792         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
793         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
794         (WebCore::WebPlaybackSessionModelMediaElement::updateForEventName):
795         (WebCore::WebPlaybackSessionModelMediaElement::observedEventNames):
796         (WebCore::WebPlaybackSessionModelMediaElement::seekableTimeRangesLastModifiedTime):
797         (WebCore::WebPlaybackSessionModelMediaElement::liveUpdateInterval):
798         * platform/graphics/MediaPlayer.cpp:
799         (WebCore::MediaPlayer::seekableTimeRangesLastModifiedTime):
800         (WebCore::MediaPlayer::liveUpdateInterval):
801         * platform/graphics/MediaPlayer.h:
802         * platform/graphics/MediaPlayerPrivate.h:
803         (WebCore::MediaPlayerPrivateInterface::seekableTimeRangesLastModifiedTime):
804         (WebCore::MediaPlayerPrivateInterface::liveUpdateInterval):
805         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
806         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
807         (WebCore::MediaPlayerPrivateAVFoundationObjC::seekableTimeRangesLastModifiedTime):
808         (WebCore::MediaPlayerPrivateAVFoundationObjC::liveUpdateInterval):
809         * platform/ios/WebAVPlayerController.h:
810         * platform/ios/WebAVPlayerController.mm:
811         (-[WebAVPlayerController init]):
812         (-[WebAVPlayerController dealloc]):
813         (-[WebAVPlayerController observeValueForKeyPath:ofObject:change:context:]):
814         (-[WebAVPlayerController updateMinMaxTiming]):
815         (-[WebAVPlayerController hasSeekableLiveStreamingContent]):
816         (+[WebAVPlayerController keyPathsForValuesAffectingHasSeekableLiveStreamingContent]):
817         (-[WebAVPlayerController resetMediaState]):
818         * platform/ios/WebPlaybackSessionInterfaceAVKit.h:
819         * platform/ios/WebPlaybackSessionInterfaceAVKit.mm:
820         (WebCore::WebPlaybackSessionInterfaceAVKit::WebPlaybackSessionInterfaceAVKit):
821         (WebCore::WebPlaybackSessionInterfaceAVKit::resetMediaState):
822         (WebCore::WebPlaybackSessionInterfaceAVKit::seekableRangesChanged):
823         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
824         (WebVideoFullscreenControllerContext::seekableRangesChanged):
825         (WebVideoFullscreenControllerContext::seekableTimeRangesLastModifiedTime):
826         (WebVideoFullscreenControllerContext::liveUpdateInterval):
827         * platform/mac/WebPlaybackSessionInterfaceMac.h:
828         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
829         (WebCore::WebPlaybackSessionInterfaceMac::seekableRangesChanged):
830         * platform/spi/cocoa/AVKitSPI.h:
831         * platform/spi/mac/AVFoundationSPI.h:
832
833 2017-06-07  Dave Hyatt  <hyatt@apple.com>
834
835         Laili restaurant menu page does not display full menu
836         https://bugs.webkit.org/show_bug.cgi?id=173062
837         rdar://problem/32436486
838
839         Reviewed by Simon Fraser.
840
841         Percentage heights inside auto containing blocks were handled correctly by
842         hasReplacedLogicalHeight, which checked hasAutoHeightOrContainingBlockWithAutoHeight
843         properly. min-max-height were not handled properly though and need to do the same check.
844         
845         There is also now a quirk for iBooks to preserve the old behavior, since they depend
846         on the old behavior to constrain the height of images to a page.
847
848         Test: fast/replaced/max-height-percent-inside-auto-block.html
849
850         * rendering/RenderBox.cpp:
851         (WebCore::RenderBox::replacedMinMaxLogicalHeightComputesAsNone):
852         Add a new helper that resolves min and max logical height values to none for
853         replaced elements with percentage min/max heights inside auto containing blocks.
854
855         (WebCore::RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight):
856         Change the min/max-height constraint function for replaced elements to call the
857         new helper function.
858
859         * rendering/RenderBox.h:
860         * rendering/RenderBoxModelObject.h:
861         Move a function from private to protected so that RenderBox can access it.
862
863 2017-06-08  Tim Horton  <timothy_horton@apple.com>
864
865         Add a borderless mode to <attachment>, and make it respect its layout size
866         https://bugs.webkit.org/show_bug.cgi?id=173079
867         <rdar://problem/32491584>
868
869         Reviewed by Simon Fraser.
870
871         Tests: fast/attachment/attachment-borderless.html
872                fast/attachment/attachment-respects-css-size.html
873
874         * css/CSSPrimitiveValueMappings.h:
875         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
876         * css/CSSValueKeywords.in:
877         * platform/ThemeTypes.h:
878         * rendering/RenderAttachment.cpp:
879         (WebCore::RenderAttachment::shouldDrawBorder):
880         * rendering/RenderAttachment.h:
881         * rendering/RenderTheme.cpp:
882         (WebCore::RenderTheme::adjustStyle):
883         (WebCore::RenderTheme::paint):
884         Add "-webkit-appearance: borderless-attachment;" in addition to "attachment",
885         so clients can specify the borderless appearance. This isn't specified as a
886         CSS border because it's a very custom appearance that isn't achievable that way.
887
888         * rendering/RenderThemeIOS.mm:
889         (WebCore::AttachmentInfo::AttachmentInfo):
890         Use the layout size of the attachment, not the fixed size; we use the fixed
891         size as our intrinsic size, so most attachments will still be that size,
892         but if a client specifies a different size, we'll lay out correctly.
893
894 2017-06-08  Jer Noble  <jer.noble@apple.com>
895
896         YouTube audio stutters when page changes visibility.
897         https://bugs.webkit.org/show_bug.cgi?id=173102
898
899         Reviewed by Eric Carlson.
900
901         Don't change renderers when the visibility changes; only use the decompression session
902         when we were explicitly asked to paint into an accelerated surface.
903
904         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
905         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::acceleratedRenderingStateChanged):
906
907 2017-06-08  Jer Noble  <jer.noble@apple.com>
908
909         Clients of the WK2 C-API don't have their mediaContentTypesRequiringHardwareSupport setting initialized correctly.
910         https://bugs.webkit.org/show_bug.cgi?id=173091
911
912         Reviewed by Eric Carlson.
913
914         Add a new default setting value, defined separately in Settings and SettingsCocoa.
915
916         * page/Settings.cpp:
917         (WebCore::Settings::defaultMediaContentTypesRequiringHardwareSupport):
918         * page/Settings.h:
919         * page/cocoa/SettingsCocoa.mm:
920         (WebCore::Settings::defaultMediaContentTypesRequiringHardwareSupport):
921
922 2017-06-08  Jer Noble  <jer.noble@apple.com>
923
924         Take the mediaContentTypesRequiringHardwareSupport Setting into account when answering HTMLMediaElement::canPlayType()
925         https://bugs.webkit.org/show_bug.cgi?id=173092
926
927         Reviewed by Eric Carlson.
928
929         Pass the value of mediaContentTypesRequiringHardwareSupport into the MediaPlayer when querying canPlayType().
930         Then, use the existing code in AVAssetTrackUtilities to know whether to bail out early from the codec check.
931
932         Drive-by fix: FourCC was converting String -> FourCC in reverse.
933
934         * html/HTMLMediaElement.cpp:
935         (WebCore::HTMLMediaElement::canPlayType):
936         * platform/graphics/FourCC.cpp:
937         (WebCore::FourCC::fromString):
938         * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.h:
939         * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm:
940         (WebCore::contentTypesToCodecs):
941         (WebCore::codecsMeetHardwareDecodeRequirements):
942         (WebCore::contentTypeMeetsHardwareDecodeRequirements):
943         (WebCore::assetTrackMeetsHardwareDecodeRequirements):
944         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
945         (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsType):
946         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
947         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::supportsType):
948
949 2017-06-08  Chris Dumez  <cdumez@apple.com>
950
951         ASSERTION FAILED: !m_isolatedWorld->isNormal() || m_wrapper || !m_jsFunction on webrtc/ephemeral-certificates-and-cnames.html
952         https://bugs.webkit.org/show_bug.cgi?id=173039
953         <rdar://problem/32600412>
954
955         Reviewed by Youenn Fablet.
956
957         RTCPeerConnection was an ActiveDOMObject but failed to override ActiveDOMObject::hasPendingActivity()
958         to make sure its JS wrapper stays alive as long as it needs to. In this patch, we override
959         ActiveDOMObject::hasPendingActivity() and have it return true if !m_isStopped. I believe this is
960         the right thing to do to keep the wrapper alive as long as the connection is not closed.
961         RTCPeerConnection::close() closes the connection and then posts a task to call
962         RTCPeerConnection::doStop(), setting m_isStopped to true.
963
964         No new tests, already covered by webrtc/ephemeral-certificates-and-cnames.html which
965         was a flaky crash.
966
967         * Modules/mediastream/RTCPeerConnection.cpp:
968         (WebCore::RTCPeerConnection::canSuspendForDocumentSuspension):
969         (WebCore::RTCPeerConnection::hasPendingActivity):
970         * Modules/mediastream/RTCPeerConnection.h:
971
972 2017-06-08  Miguel Gomez  <magomez@igalia.com>
973
974         [GTK][WPE][GSTREAMER_GL] Change the colorspace used by the video frames provided by GStreamer
975         https://bugs.webkit.org/show_bug.cgi?id=173050
976
977         Reviewed by Žan Doberšek.
978
979         We are currently requesting RGBA as the color format of the video frames to gstreamer. This is a problem
980         because when those frames are rendered with the CPU, the R and B components are swapped as cairo expects
981         ARGB and GStreamer delivers ABGR.
982
983         In order to fix this without performing color conversions on the CPU, what we do is change the format
984         used by GStreamer for the video frames. We do that taking into account the endianness used. So with
985         little endian we will use BGRx or BGRA and with big endian xRGB or ARGB. Thanks to this, when downloading
986         the frames to the CPU they will automatically be turned into the ARGB expected by cairo. Also, when
987         rendering the frames using OpenGL, we indicate that the color space needs to be converted to the RGBA
988         expected by the destination texture (but this color conversion is performed by the GPU so there's no
989         penalty).
990
991         Covered by existent tests.
992
993         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
994         (WebCore::GstVideoFrameHolder::GstVideoFrameHolder):
995         (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture):
996         (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
997         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL):
998         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
999         (WebCore::VideoTextureCopierGStreamer::VideoTextureCopierGStreamer):
1000         (WebCore::VideoTextureCopierGStreamer::updateColorConversionMatrix):
1001         (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
1002         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h:
1003         * platform/graphics/texmap/TextureMapperGL.cpp:
1004         (WebCore::colorSpaceMatrixForFlags):
1005         * platform/graphics/texmap/TextureMapperGL.h:
1006
1007 2017-06-07  Ryosuke Niwa  <rniwa@webkit.org>
1008
1009         IsInShadowTreeFlag does not get updated for a non-container node
1010         https://bugs.webkit.org/show_bug.cgi?id=173084
1011
1012         Reviewed by Antti Koivisto.
1013
1014         insertedInto and removedFrom were only called on ContainerNode nodes when they're not connected to a document.
1015         As a result IsInShadowTreeFlag could have gotten out-of-date when a node was inserted or removed from a shadow root
1016         which is not connected to a document.
1017
1018         Fixed this inconsistency by always falling insertedInto and removedFrom on all nodes.
1019
1020         * dom/ContainerNodeAlgorithms.cpp:
1021         (WebCore::notifyNodeInsertedIntoDocument): Merged notifyDescendantInsertedIntoDocument. Now takes a Node instead
1022         of a ContainerNode.
1023         (WebCore::notifyNodeInsertedIntoTree): Merged notifyDescendantInsertedIntoTree. Now takes a Node instead of
1024         a ContainerNode.
1025         (WebCore::notifyChildNodeInserted): Always call notifyNodeInsertedIntoTree on an inserted node.
1026         (WebCore::notifyNodeRemovedFromDocument): Now takes a Node instead of a ContainerNode.
1027         (WebCore::notifyNodeRemovedFromTree): Ditto.
1028         (WebCore::notifyChildNodeRemoved): Always call notifyNodeRemovedFromTree on an inserted node.
1029         (WebCore::addChildNodesToDeletionQueue): Directly call adoptIfNeeded on document() since onwerDocument() only returns
1030         nullptr on a Document node but this function is never called on a root node and Document can only be a root node.
1031         Also assert that a node not put into the deletion queue is no longer in a document or a shadow tree.
1032
1033         * dom/Node.cpp:
1034         (WebCore::Node::insertedInto): Removed the assertion that's no longer true.
1035         (WebCore::Node::removedFrom): Ditto.
1036
1037 2017-06-07  Carlos Garcia Campos  <cgarcia@igalia.com>
1038
1039         [WPE] Enable resource usage
1040         https://bugs.webkit.org/show_bug.cgi?id=173054
1041
1042         Reviewed by Žan Doberšek.
1043
1044         Add resource usage linux files to the compilation.
1045
1046         * PlatformWPE.cmake:
1047
1048 2017-06-07  Jer Noble  <jer.noble@apple.com>
1049
1050         [Web Audio] createScriptProcessor throws IndexSizeError for valid arguments
1051         https://bugs.webkit.org/show_bug.cgi?id=173022
1052
1053         Reviewed by Sam Weinig.
1054
1055         Updated test: webaudio/javascriptaudionode.html
1056
1057         The Web Audio spec (<https://webaudio.github.io/web-audio-api/>, 06 June 2017) defines a default behavior when
1058         clients pass in a value of 0 for bufferSize to the createScriptProcessor() method.
1059
1060         * Modules/webaudio/AudioContext.cpp:
1061         (WebCore::AudioContext::createScriptProcessor):
1062         * Modules/webaudio/AudioContext.idl:
1063         * Modules/webaudio/ScriptProcessorNode.cpp:
1064         (WebCore::ScriptProcessorNode::create):
1065         * Modules/webaudio/ScriptProcessorNode.h:
1066
1067 2017-06-07  Chris Dumez  <cdumez@apple.com>
1068
1069         CSSStyleRule.style / CSSPageRule.style / CSSKeyframeRule.style should be settable
1070         https://bugs.webkit.org/show_bug.cgi?id=164537
1071         <rdar://problem/29181773>
1072
1073         Reviewed by Sam Weinig.
1074
1075         CSSStyleRule.style / CSSPageRule.style / CSSKeyframeRule.style should be settable
1076         as per:
1077         - https://drafts.csswg.org/cssom/#the-cssstylerule-interface
1078         - https://drafts.csswg.org/cssom/#the-csspagerule-interface
1079         - https://drafts.csswg.org/css-animations/#interface-csskeyframerule
1080
1081         Tests:
1082         http/wpt/cssom/CSSPageRule.html
1083         imported/w3c/web-platform-tests/cssom/CSSKeyframeRule.html
1084         imported/w3c/web-platform-tests/cssom/CSSStyleRule.html
1085         imported/w3c/web-platform-tests/cssom/interfaces.html
1086
1087         * css/CSSKeyframeRule.idl:
1088         * css/CSSPageRule.idl:
1089         * css/CSSStyleRule.idl:
1090
1091 2017-06-07  Sam Weinig  <sam@webkit.org>
1092
1093         [WebIDL] Split up attribute generation to match operation generation
1094         https://bugs.webkit.org/show_bug.cgi?id=173072
1095
1096         Reviewed by Chris Dumez.
1097
1098         * bindings/js/JSDOMAttribute.h:
1099         (WebCore::IDLAttribute::setStatic):
1100         (WebCore::IDLAttribute::getStatic):
1101         Add static variants of get/set matching the one in IDLOperation.
1102
1103         * bindings/scripts/CodeGeneratorJS.pm:
1104         (GetFullyQualifiedImplementationCallName):
1105         Factor out duplicate code to compute the qualified name for a function call.
1106
1107         (AddAdditionalArgumentsForImplementationCall):
1108         Factor out duplicate code to compute the some standard arguments for a function
1109         call. We may want to merge this with GenerateCallWith.
1110
1111         (GenerateHeader):
1112         Update for new signature of HasCustom... subroutines.
1113         
1114         (GenerateImplementation):
1115         Pass @implContent to more helper generators to continue propagating the idiom.
1116
1117         (GenerateAttributeGetterBodyDefinition):
1118         (GenerateAttributeGetterTrampolineDefinition):
1119         (GenerateAttributeGetterDefinition):
1120         (GenerateAttributeSetterBodyDefinition):
1121         (GenerateAttributeSetterTrampolineDefinition):
1122         (GenerateAttributeSetterDefinition):
1123         Split attribute getter and setter generation up by having separate subroutines 
1124         to generate the trampoline and body. Also, make all attributes, even static ones
1125         use a trampoline to simplify the code. Static attributes got through a no-op 
1126         trampoline, that gets compiled away. Also adopt GetFullyQualifiedImplementationCallName
1127         and AddAdditionalArgumentsForImplementationCall to reduce duplication.
1128
1129         (GenerateOperationBodyDefinition):
1130         (GenerateOperationDefinition):
1131         Adopt $outputArray idiom and adopt GetFullyQualifiedImplementationCallName
1132         and AddAdditionalArgumentsForImplementationCall to reduce duplication
1133
1134         (GenerateParametersCheck):
1135         Adopt GetFullyQualifiedImplementationCallName and AddAdditionalArgumentsForImplementationCall 
1136         to reduce duplication.
1137
1138         (HasCustomGetter):
1139         (HasCustomSetter):
1140         (HasCustomMethod):
1141         Convert HasCustom... subroutines to take an IDLAttribute rather than the extended
1142         attributes, matching other predicates
1143
1144         * bindings/scripts/test/JS/JSTestInterface.cpp:
1145         * bindings/scripts/test/JS/JSTestObj.cpp:
1146         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1147         Update test results.
1148
1149 2017-06-07  Youenn Fablet  <youenn@apple.com>
1150
1151         RTCTrackEvent.track should be found in RTCTrackEvent.streams[0]
1152         https://bugs.webkit.org/show_bug.cgi?id=173074
1153
1154         Reviewed by Eric Carlson.
1155
1156         Covered by updated test.
1157
1158         * Modules/mediastream/MediaStream.cpp:
1159         (WebCore::MediaStream::addTrackFromPlatform):
1160
1161 2017-06-07  Devin Rousso  <drousso@apple.com>
1162
1163         Web Inspector: Add ContextMenu item to log WebSocket object to console
1164         https://bugs.webkit.org/show_bug.cgi?id=172878
1165
1166         Reviewed by Joseph Pecoraro.
1167
1168         Test: http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html
1169
1170         * inspector/InspectorNetworkAgent.h:
1171         * inspector/InspectorNetworkAgent.cpp:
1172         (WebCore::InspectorNetworkAgent::InspectorNetworkAgent):
1173         (WebCore::InspectorNetworkAgent::webSocketForRequestId):
1174         (WebCore::webSocketAsScriptValue):
1175         (WebCore::InspectorNetworkAgent::resolveWebSocket):
1176         Loops over the static allActiveWebSockets to find one with the given requestId. If found, it
1177         will create a RemoteObject wrapper for it and send it back to the inspector.
1178
1179 2017-06-07  Devin Rousso  <drousso@apple.com>
1180
1181         Web Inspector: Allow user to choose stylesheet when creating new rules
1182         https://bugs.webkit.org/show_bug.cgi?id=172487
1183
1184         Reviewed by Joseph Pecoraro.
1185
1186         New test: inspector/css/add-rule.html
1187
1188         * inspector/InspectorStyleSheet.cpp:
1189         (WebCore::InspectorStyleSheet::addRule):
1190         Reparse the content when a new rule is added to a non-inspector origin stylesheet.
1191
1192 2017-06-07  Youenn Fablet  <youenn@apple.com>
1193
1194         getUserMedia is prompting too often
1195         https://bugs.webkit.org/show_bug.cgi?id=172859
1196         <rdar://problem/32589950>
1197
1198         Reviewed by Eric Carlson.
1199
1200         Tests: fast/mediastream/getUserMedia-grant-persistency-reload.html
1201                fast/mediastream/getUserMedia-grant-persistency.html
1202
1203         * loader/FrameLoaderClient.h:
1204         * page/Frame.cpp:
1205         (WebCore::Frame::setDocument): Allows notifying of change of main frame document.
1206         UIProcess will use that to remove unneeded previously granted gum permission.
1207
1208 2017-06-07  Chris Dumez  <cdumez@apple.com>
1209
1210         Align <col span>/<colgroup span> limits with the latest HTML specification
1211         https://bugs.webkit.org/show_bug.cgi?id=173049
1212
1213         Reviewed by Daniel Bates.
1214
1215         Align <col span>/<colgroup span> limits with the latest HTML specification after:
1216         - https://github.com/whatwg/html/issues/2705
1217         - https://github.com/whatwg/html/pull/2734
1218
1219         In particular, col / colspan's span attribute is now clamped to the [1, 1000] range.
1220
1221         Test: imported/w3c/web-platform-tests/html/semantics/tabular-data/processing-model-1/col-span-limits.html
1222
1223         [1] https://html.spec.whatwg.org/#dom-colgroup-span
1224         [2] https://html.spec.whatwg.org/#clamped-to-the-range
1225         [3] https://github.com/whatwg/html/pull/2734/files
1226
1227         * html/HTMLTableColElement.cpp:
1228         (WebCore::HTMLTableColElement::parseAttribute):
1229         As per [1][2], the span attribute should be clamped to the range [1, 1000] with a default value of 1 (on getting).
1230
1231         (WebCore::HTMLTableColElement::setSpan):
1232         As per [2], on setting, we should behave the same as setting a regular reflected unsigned integer when an attribute
1233         is clamped to a range. Therefore, we now call limitToOnlyHTMLNonNegative() instead of
1234         limitToOnlyHTMLNonNegativeNumbersGreaterThanZero(). We used to call limitToOnlyHTMLNonNegativeNumbersGreaterThanZero()
1235         because the value used to be limited to only non-negative numbers greater than zero with fallback before [3]. Without
1236         this change, "col.span = 0" would set the content attribute to 1 instead of 0, which would be wrong.
1237
1238 2017-06-07  Jer Noble  <jer.noble@apple.com>
1239
1240         Exempt exclusively wall-powered devices from hardware codec requirement
1241         https://bugs.webkit.org/show_bug.cgi?id=173009
1242
1243         Reviewed by Eric Carlson.
1244
1245         * WebCore.xcodeproj/project.pbxproj:
1246         * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm:
1247         (WebCore::systemHasBattery):
1248         (WebCore::assetTrackMeetsHardwareDecodeRequirements):
1249         * platform/spi/cocoa/IOPSLibSPI.h: Added.
1250
1251 2017-06-07  Jer Noble  <jer.noble@apple.com>
1252
1253         Refactoring: MediaEngineSupportParameters should take a ContentType rather than separate type & codecs strings
1254         https://bugs.webkit.org/show_bug.cgi?id=173038
1255
1256         Reviewed by Eric Carlson.
1257
1258         * Modules/encryptedmedia/CDM.cpp:
1259         (WebCore::CDM::getSupportedCapabilitiesForAudioVideoType):
1260         * Modules/mediasource/MediaSource.cpp:
1261         (WebCore::MediaSource::addSourceBuffer):
1262         (WebCore::MediaSource::isTypeSupported):
1263         * dom/DOMImplementation.cpp:
1264         (WebCore::DOMImplementation::createDocument):
1265         * html/HTMLMediaElement.cpp:
1266         (WebCore::HTMLMediaElement::canPlayType):
1267         (WebCore::HTMLMediaElement::selectNextSourceChild):
1268         * platform/ContentType.cpp:
1269         (WebCore::ContentType::codecsParameter):
1270         (WebCore::ContentType::profilesParameter):
1271         (WebCore::ContentType::containerType):
1272         (WebCore::simplifyWhitespace):
1273         (WebCore::ContentType::codecs):
1274         (WebCore::ContentType::profiles):
1275         (WebCore::ContentType::type): Deleted.
1276         * platform/ContentType.h:
1277         * platform/graphics/MediaPlayer.cpp:
1278         (WebCore::bestMediaEngineForSupportParameters):
1279         (WebCore::MediaPlayer::load):
1280         (WebCore::MediaPlayer::nextBestMediaEngine):
1281         (WebCore::MediaPlayer::loadWithNextMediaEngine):
1282         (WebCore::MediaPlayer::supportsType):
1283         (WebCore::MediaPlayer::networkStateChanged):
1284         (WebCore::codecs): Deleted.
1285         * platform/graphics/MediaPlayer.h:
1286         (WebCore::MediaPlayer::contentMIMEType):
1287         (WebCore::MediaPlayer::contentTypeCodecs):
1288         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
1289         (WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystemAndMimeType):
1290         (WebCore::CDMPrivateMediaSourceAVFObjC::supportsMIMEType):
1291         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
1292         (WebCore::MediaPlayerPrivateAVFoundationCF::supportsType):
1293         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1294         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
1295         (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsType):
1296         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1297         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::supportsType):
1298         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
1299         (WebCore::MediaSourcePrivateAVFObjC::addSourceBuffer):
1300         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1301         (WebCore::MediaPlayerPrivateGStreamer::supportsType):
1302         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1303         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType):
1304         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
1305         (WebCore::MediaPlayerPrivateQTKit::supportsType):
1306         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1307         (WebCore::MediaPlayerPrivateMediaFoundation::supportsType):
1308         * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
1309         (WebCore::MockMediaPlayerMediaSource::supportsType):
1310         * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
1311         (WebCore::MockMediaSourcePrivate::addSourceBuffer):
1312
1313 2017-06-07  Ryosuke Niwa  <rniwa@webkit.org>
1314
1315         Use a dedicated node flag to identify a Document node
1316         https://bugs.webkit.org/show_bug.cgi?id=173037
1317
1318         Reviewed by Chris Dumez.
1319
1320         Address Antti's review comment. We don't need a new Node flg.
1321
1322         * dom/Node.h:
1323         (WebCore::Node::isDocumentNode):
1324
1325 2017-06-07  Jon Davis  <jond@apple.com>
1326
1327         Update feature status for features Supported In Preview
1328         https://bugs.webkit.org/show_bug.cgi?id=173071
1329
1330         Reviewed by Darin Adler.
1331
1332         Updated WebAssembly.
1333
1334         * features.json:
1335
1336 2017-06-07  Sam Weinig  <sam@webkit.org>
1337
1338         [WebIDL] PutForwards is not implemented to spec as illustrated by the WPT WebIDL/ecmascript-binding/put-forwards.html
1339         https://bugs.webkit.org/show_bug.cgi?id=172956
1340
1341         Reviewed by Chris Dumez.
1342
1343         Implements step 3.5.9 of https://heycam.github.io/webidl/#dfn-attribute-setter.
1344
1345         * bindings/scripts/CodeGeneratorJS.pm:
1346         (GenerateAttributeSetterDefinition):
1347         Implement [PutForwards] to spec, which involves using JSC get/set rather than calling
1348         directly into the implementation.
1349
1350         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
1351         * bindings/scripts/test/JS/JSTestObj.cpp:
1352         Update test results.
1353
1354 2017-06-07  Jer Noble  <jer.noble@apple.com>
1355
1356         Clean-up: RenderElement.h includes headers it doesn't use
1357         https://bugs.webkit.org/show_bug.cgi?id=173046
1358
1359         Reviewed by Andy Estes.
1360
1361         Remove a couple of unneeded includes from RenderElement.h, and then clean up all the
1362         follow-on compile errors that causes. Mostly, these errors are fixed by including the
1363         correct headers at the point of use; otherwise, they're solved by forward-declaring types
1364         and in one case by moving default constructors implementation to the cpp file from the header.
1365
1366         * css/parser/SizesAttributeParser.cpp:
1367         * editing/cocoa/EditorCocoa.mm:
1368         * platform/mac/PasteboardMac.mm:
1369         * rendering/InlineIterator.h:
1370         (WebCore::embedCharFromDirection):
1371         * rendering/RenderBoxModelObject.h:
1372         * rendering/RenderElement.cpp:
1373         * rendering/RenderElement.h:
1374         * rendering/RenderIterator.h:
1375         * rendering/RenderLineBreak.cpp:
1376         * rendering/RenderQuote.cpp:
1377         * rendering/RenderText.h:
1378         * rendering/SimpleLineLayoutPagination.cpp:
1379         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
1380         * rendering/TextAutoSizing.cpp:
1381         * rendering/style/RenderStyle.cpp:
1382         * rendering/style/RenderStyle.h:
1383         * style/RenderTreeUpdater.cpp:
1384         * style/StyleResolveForDocument.cpp:
1385         * style/StyleTreeResolver.cpp:
1386
1387 2017-06-07  Youenn Fablet  <youenn@apple.com>
1388
1389         Add WebRTC stats logging
1390         https://bugs.webkit.org/show_bug.cgi?id=173045
1391
1392         Reviewed by Eric Carlson.
1393
1394         No change of behavior.
1395
1396         Do release logging of WebRTC stats once remote description is set.
1397         Do logging every second for the first 30 seconds.
1398         After 30 seconds, do release logging of these stats every 5 seconds.
1399
1400         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1401         (WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint):
1402         (WebCore::LibWebRTCMediaEndpoint::stop):
1403         (WebCore::LibWebRTCMediaEndpoint::gatherStatsForLogging):
1404         (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
1405         (WebCore::LibWebRTCMediaEndpoint::startLoggingStats):
1406         (WebCore::LibWebRTCMediaEndpoint::stopLoggingStats):
1407         (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription):
1408
1409 2017-06-07  Per Arne Vollan  <pvollan@apple.com>
1410
1411         Support removal of authentication data through the Website data store API.
1412         https://bugs.webkit.org/show_bug.cgi?id=171217
1413
1414         Reviewed by Brady Eidson.
1415
1416         Add support to remove and fetch credential data through the Website data store API.
1417
1418         Test: http/tests/loading/basic-auth-remove-credentials.html
1419
1420         * platform/network/CredentialStorage.h:
1421         (WebCore::CredentialStorage::originsWithCredentials):
1422
1423 2017-06-07  Per Arne Vollan  <pvollan@apple.com>
1424
1425         AudioSourceProviderAVFObjC::m_tap member access is not thread safe.
1426         https://bugs.webkit.org/show_bug.cgi?id=172263
1427
1428         Reviewed by Darin Adler.
1429
1430         It it possible that the main thread will modify the m_tap member by calling
1431         AudioSourceProviderAVFObjC::destroyMix(), while m_tap is being read on a secondary
1432         thread under AudioSourceProviderAVFObjC::processCallback(). Instead of accessing
1433         the m_tap member on the secondary thread, we can use the same MTAudioProcessingTapRef
1434         provided by MediaToolbox in the callback. We assume the tap ref is retained by
1435         MediaToolbox, so it should be safe to use even if the the m_tap member is set to null.
1436
1437         Covered by existing tests.
1438
1439         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
1440         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
1441         (WebCore::AudioSourceProviderAVFObjC::processCallback):
1442         (WebCore::AudioSourceProviderAVFObjC::process):
1443
1444 2017-06-07  Zan Dobersek  <zdobersek@igalia.com>
1445
1446         [GCrypt] RSA-PSS support
1447         https://bugs.webkit.org/show_bug.cgi?id=172856
1448
1449         Reviewed by Jiewen Tan.
1450
1451         Implement RSA-PSS support for Web Crypto API in ports that use libgcrypt.
1452
1453         For the signing operation, the digest algorithm is determined and used to
1454         compute the hash of the passed-in data. The given salt length and hash results
1455         are embedded into a data s-expression, specifying PSS as the preferred type of
1456         padding. This s-expression and the provided key are then passed to the
1457         gcry_pk_sign() call which computes the signature. The MPI data of this signature
1458         is retrieved and its size validated before being passed to the success callback.
1459
1460         For the verification operation, the hash of the passed-in data is computed as
1461         before, embedding it into a data s-expression along with the specified salt
1462         length. The passed-in signature data is embedded into a sig-val s-expression.
1463         The two s-expressions are passed to the gcry_pk_verify() call along with the
1464         key. If the returned error code for this operation is GPG_ERR_NO_ERROR the
1465         verification is deemed successful, while in case of any other error code (which
1466         might indicate a verification failure or an operation error) we simply signal
1467         that the verification step failed (and not that it possibly errored out).
1468
1469         No new tests -- covered by existing tests.
1470
1471         * PlatformGTK.cmake: Add the new build targets.
1472         * PlatformWPE.cmake: Ditto.
1473         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp: Added.
1474         (WebCore::gcryptSign):
1475         (WebCore::gcryptVerify):
1476         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
1477         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
1478         * crypto/gcrypt/CryptoAlgorithmRegistryGCrypt.cpp:
1479         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Register the RSA-PSS algorithm.
1480
1481 2017-06-07  Ryosuke Niwa  <rniwa@webkit.org>
1482
1483         Merge TreeScopeAdopter into TreeScope
1484         https://bugs.webkit.org/show_bug.cgi?id=173040
1485
1486         Reviewed by Antti Koivisto.
1487
1488         Merged TreeScopeAdopter into TreeScope since it's used by TreeScope::adoptIfNeeded.
1489
1490         Most of code changes are for didMoveToNewDocument taking the new document as an argument,
1491         which is used by ShadowRoot::didMoveToNewDocument to update its document scope.
1492
1493         No new tests since there should be no behavioral change.
1494
1495         * CMakeLists.txt:
1496         * WebCore.xcodeproj/project.pbxproj:
1497         * dom/Element.cpp:
1498         (WebCore::Element::didMoveToNewDocument):
1499         * dom/Element.h:
1500         * dom/Node.cpp:
1501         (WebCore::Node::didMoveToNewDocument): Moved the code to moves the node lists and node iterators here
1502         from TreeScopeAdopter::moveNodeToNewDocument.
1503         * dom/Node.h:
1504         * dom/ShadowRoot.cpp:
1505         (WebCore::ShadowRoot::didMoveToNewDocument): Moved the code to update the document scope here
1506         from TreeScopeAdopter::moveNodeToNewDocument.
1507         * dom/ShadowRoot.h:
1508         * dom/TreeScope.cpp:
1509         (WebCore::TreeScope::adoptIfNeeded):
1510         (WebCore::TreeScope::moveTreeToNewScope): Moved from TreeScopeAdopter. Now takes the old tree scope and
1511         the new tree scope as arguments (they used to be members of TreeScopeAdopter). Also merged updateTreeScope
1512         into this function.
1513         (WebCore::TreeScope::ensureDidMoveToNewDocumentWasCalled): Moved from TreeScopeAdopter.
1514         (WebCore::TreeScope::moveNodeToNewDocument): Ditto. The code to adopt node lists and node iterators have
1515         been moved to Node::didMoveToNewDocument.
1516         (WebCore::TreeScope::moveShadowTreeToNewDocument): Moved from TreeScopeAdopter.
1517         * dom/TreeScope.h:
1518         (WebCore::TreeScope::ensureDidMoveToNewDocumentWasCalled):
1519         * dom/TreeScopeAdopter.cpp: Removed.
1520         * dom/TreeScopeAdopter.h: Removed.
1521         * html/HTMLFieldSetElement.cpp:
1522         (WebCore::HTMLFieldSetElement::didMoveToNewDocument):
1523         * html/HTMLFieldSetElement.h:
1524         * html/HTMLFormControlElement.cpp:
1525         (WebCore::HTMLFormControlElement::didMoveToNewDocument):
1526         * html/HTMLFormControlElement.h:
1527         * html/HTMLFormElement.cpp:
1528         (WebCore::HTMLFormElement::didMoveToNewDocument):
1529         * html/HTMLFormElement.h:
1530         * html/HTMLImageElement.cpp:
1531         (WebCore::HTMLImageElement::didMoveToNewDocument):
1532         * html/HTMLImageElement.h:
1533         * html/HTMLInputElement.cpp:
1534         (WebCore::HTMLInputElement::didMoveToNewDocument): Grouped related function calls on new/old documents.
1535         * html/HTMLInputElement.h:
1536         * html/HTMLMediaElement.cpp:
1537         (WebCore::HTMLMediaElement::didMoveToNewDocument):
1538         * html/HTMLMediaElement.h:
1539         * html/HTMLObjectElement.cpp:
1540         (WebCore::HTMLObjectElement::didMoveToNewDocument):
1541         * html/HTMLObjectElement.h:
1542         * html/HTMLPictureElement.cpp:
1543         (WebCore::HTMLPictureElement::didMoveToNewDocument):
1544         * html/HTMLPictureElement.h:
1545         * html/HTMLPlugInImageElement.cpp:
1546         (WebCore::HTMLPlugInImageElement::didMoveToNewDocument):
1547         * html/HTMLPlugInImageElement.h:
1548         * html/HTMLTemplateElement.cpp:
1549         (WebCore::HTMLTemplateElement::didMoveToNewDocument):
1550         * html/HTMLTemplateElement.h:
1551         * html/HTMLVideoElement.cpp:
1552         (WebCore::HTMLVideoElement::didMoveToNewDocument):
1553         * html/HTMLVideoElement.h:
1554         * html/ImageDocument.cpp:
1555         (WebCore::ImageDocumentElement::didMoveToNewDocument):
1556         * svg/SVGImageElement.cpp:
1557         (WebCore::SVGImageElement::didMoveToNewDocument):
1558         * svg/SVGImageElement.h:
1559         * svg/SVGSVGElement.cpp:
1560         (WebCore::SVGSVGElement::didMoveToNewDocument):
1561         * svg/SVGSVGElement.h:
1562
1563 2017-06-06  Ryosuke Niwa  <rniwa@webkit.org>
1564
1565         Use a dedicated node flag to identify a Document node
1566         https://bugs.webkit.org/show_bug.cgi?id=173037
1567
1568         Reviewed by Chris Dumez.
1569
1570         Use a Node flag to identify a Document node instead of checking this == document() which loads TreeScope.
1571
1572         * dom/Document.h:
1573         (WebCore::Node::isDocumentNode): Deleted.
1574         * dom/Node.h:
1575         (WebCore::Node::isDocumentNode):
1576
1577 2017-06-06  Dan Bernstein  <mitz@apple.com>
1578
1579         Fixed building with the macOS 10.13 Apple Internal SDK when targeting macOS 10.12.
1580
1581         * platform/spi/cocoa/PassKitSPI.h:
1582
1583 2017-06-06  Chris Dumez  <cdumez@apple.com>
1584
1585         Unreviewed, rolling out r214974.
1586
1587         Causes some tabs to start using a huge amount of CPU after 8
1588         minutes in the background
1589
1590         Reverted changeset:
1591
1592         "Make inactive web processes behave as though under memory
1593         pressure."
1594         https://bugs.webkit.org/show_bug.cgi?id=170042
1595         http://trac.webkit.org/changeset/214974
1596
1597 2017-06-06  Tim Horton  <timothy_horton@apple.com>
1598
1599         Crash trying to drag the entire text of a long book out of Mail compose view
1600         https://bugs.webkit.org/show_bug.cgi?id=173042
1601         <rdar://problem/32382059>
1602
1603         Reviewed by Simon Fraser.
1604
1605         Creating a TextIndicator that is hundreds of thousands of pixels tall
1606         is not a good idea. We introduced TextIndicatorOptionDoNotClipToVisibleRect
1607         so that (for example) an image that overhangs the edge of the page would
1608         contain the entire image, instead of just the visible fragment.
1609         Instead, rename this option to ExpandClipBeyondVisibleRect, and make it
1610         not unclip *entirely*, but expand the clip significantly (50% in each direction)
1611         beyond the bounds of the current visible rect. Also, make use of exposed
1612         area information for this clipping; otherwise, clients with very large views
1613         inside scrollable areas (like Mail) would still try to create large TextIndicators.
1614
1615         * page/TextIndicator.cpp:
1616         (WebCore::initializeIndicator):
1617         * page/TextIndicator.h:
1618
1619 2017-06-06  Chris Dumez  <cdumez@apple.com>
1620
1621         RELEASE_ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values)) hit in convertEnumerationToJS<WebCore::History::ScrollRestoration>()
1622         https://bugs.webkit.org/show_bug.cgi?id=173033
1623         <rdar://problem/32591099>
1624
1625         Reviewed by Simon Fraser.
1626
1627         History::scrollRestoration() was returning a bad value because HistoryItem::m_shouldRestoreScrollPosition
1628         was initialized from FrameState::shouldRestoreScrollPosition member, which was not initialized when
1629         restored from the legacy session restore API.
1630
1631         Tests: WebKit2.RestoreSessionStateContainingScrollRestoration* API tests.
1632
1633         * bindings/scripts/CodeGeneratorJS.pm:
1634         (GenerateEnumerationImplementationContent):
1635         Drop the RELEASE_ASSERT that was added to debug this and use the regular debug ASSERT.
1636
1637         * history/HistoryItem.cpp:
1638         (WebCore::HistoryItem::setShouldRestoreScrollPosition):
1639         Make sure we notify that the HistoryItem has changed when setShouldRestoreScrollPosition()
1640         is called.
1641
1642 2017-06-06  Darin Adler  <darin@apple.com>
1643
1644         Update to slightly stricter rules for custom element names from more recent standard draft
1645         https://bugs.webkit.org/show_bug.cgi?id=173019
1646
1647         Reviewed by Ryosuke Niwa.
1648
1649         * bindings/js/JSCustomElementRegistryCustom.cpp:
1650         (WebCore::validateCustomElementNameAndThrowIfNeeded): Add more error strings for various error cases.
1651
1652         * dom/Document.cpp:
1653         (WebCore::isPotentialCustomElementNameCharacter): Added. Implements the PCENChar production
1654         from the standard by listing all the ranges exactly as they appear in the standard.
1655         (WebCore::Document::validateCustomElementName): Added a check that the first character is
1656         a lowercase ASCII letter. Added a check that all characters are potential custom element
1657         name characters.
1658
1659         * dom/Document.h: Update the CustomElementNameValidationStatus with new values for
1660         the various new error cases.  Not sure that validateCustomElementName really belongs
1661         in the Document class in the first place. Also seems that the error strings could be
1662         in validateCustomElementName rather than in a separate bindings function, obviating
1663         the need for the enum.
1664
1665 2017-06-06  Yoav Weiss  <yoav@yoav.ws>
1666
1667         [preload] Conditional support for media preloading and align media `as` values.
1668         https://bugs.webkit.org/show_bug.cgi?id=172501
1669
1670         Reviewed by Dean Jackson.
1671
1672         As discussed at https://bugs.webkit.org/show_bug.cgi?id=171720#c11 media preloading may not work
1673         since the backend may not reuse such resources properly.
1674         This patch makes support for media preloading conditional on a setting, in order to avoid double downloads in these cases.
1675         It also aligns the media `as` values to the spec, and splitting them into "video" and "audio".
1676
1677         No new tests but related tests were modified to remove media preloading tests as the setting is off by default.
1678
1679         * loader/LinkLoader.cpp:
1680         (WebCore::LinkLoader::resourceTypeFromAsAttribute): Make handling of MediaResource conditional on setting. Align `as` values to spec.
1681         (WebCore::createLinkPreloadResourceClient): Make handling of MediaResource conditional on setting.
1682         (WebCore::LinkLoader::isSupportedType): Make handling of MediaResource conditional on setting.
1683         * page/RuntimeEnabledFeatures.h: Added a media preloading preference.
1684         (WebCore::RuntimeEnabledFeatures::setMediaPreloadingEnabled):
1685         (WebCore::RuntimeEnabledFeatures::mediaPreloadingEnabled):
1686         * page/Settings.in: Added a media preloading preference.
1687
1688 2017-06-06  Don Olmstead  <don.olmstead@am.sony.com>
1689
1690         [WebCore] Enable REQUEST_ANIMATION_FRAME_TIMER for all ports
1691         https://bugs.webkit.org/show_bug.cgi?id=172780
1692
1693         Reviewed by Alex Christensen.
1694
1695         No new tests. No change in behavior.
1696
1697         * dom/ScriptedAnimationController.cpp:
1698         (WebCore::ScriptedAnimationController::ScriptedAnimationController):
1699         (WebCore::ScriptedAnimationController::addThrottlingReason):
1700         (WebCore::ScriptedAnimationController::removeThrottlingReason):
1701         (WebCore::ScriptedAnimationController::isThrottled):
1702         (WebCore::ScriptedAnimationController::interval):
1703         (WebCore::ScriptedAnimationController::scheduleAnimation):
1704         (WebCore::ScriptedAnimationController::displayRefreshFired):
1705         * dom/ScriptedAnimationController.h:
1706         * loader/EmptyClients.h:
1707         * page/Chrome.cpp:
1708         (WebCore::Chrome::scheduleAnimation): Deleted.
1709         * page/Chrome.h:
1710         * page/ChromeClient.h:
1711         * platform/Curl.cmake: Added.
1712         * platform/ScrollAnimationSmooth.cpp:
1713         (WebCore::ScrollAnimationSmooth::ScrollAnimationSmooth):
1714         (WebCore::ScrollAnimationSmooth::stop):
1715         (WebCore::ScrollAnimationSmooth::animationTimerFired):
1716         (WebCore::ScrollAnimationSmooth::startNextTimer):
1717         (WebCore::ScrollAnimationSmooth::animationTimerActive):
1718         (WebCore::ScrollAnimationSmooth::serviceAnimation): Deleted.
1719         * platform/ScrollAnimationSmooth.h:
1720
1721 2017-06-06  Darin Adler  <darin@apple.com>
1722
1723         Cut down use of WTF_ARRAY_LENGTH
1724         https://bugs.webkit.org/show_bug.cgi?id=172997
1725
1726         Reviewed by Chris Dumez.
1727
1728         * contentextensions/NFAToDFA.cpp: Remove unused SetTransitions class.
1729
1730         * dom/Document.cpp:
1731         (WebCore::Document::~Document): Use modern for loop instead of WTF_ARRAY_LENGTH.
1732         * dom/make_names.pl:
1733         (printDefinitions): Ditto.
1734         (printFactoryCppFile): Ditto.
1735         (printWrapperFactoryCppFile): Ditto.
1736
1737         * platform/URL.cpp:
1738         (WebCore::portAllowed): Use std::is_sorted, std::begin, and std::end
1739         in sort assertion to greatly streamline it and eliminate use of WTF_ARRAY_LENGTH.
1740         Also allow the sort assertion to run every time; slightly optimizing debug builds
1741         was not worth having the code be messy.
1742
1743         * platform/URLParser.cpp:
1744         (WebCore::URLParser::appendNumberToASCIIBuffer): Use std::end instead of
1745         WTF_ARRAY_LENGTH.
1746
1747         * platform/graphics/FontCascade.cpp: Make fontFamiliesWithInvalidCharWidth be
1748         a constant array rather than a non-constant array to constant strings.
1749         (WebCore::FontCascade::hasValidAverageCharWidth): Streamline the hash table
1750         initialization to avoid heap allocation and use a modern for loop instead of
1751         WTF_ARRAY_LENGTH.
1752
1753         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
1754         (WebCore::disableComponentsOnce): Use a modern for loop instead of WTF_ARRAY_LENGTH.
1755         * platform/network/CacheValidation.cpp:
1756         (WebCore::shouldUpdateHeaderAfterRevalidation): Ditto. Also use the
1757         startsWithIgnoringASCIICase function rather than the version that folds
1758         arbitrary Unicode case.
1759
1760         * platform/text/TextEncodingRegistry.cpp:
1761         (WebCore::pruneBlacklistedCodecs): Use modern for loops to make the code considerably
1762         easier to read and avoid WTF_ARRAY_LENGTH.
1763
1764         * platform/text/mac/LocaleMac.mm:
1765         (WebCore::LocaleMac::monthLabels): Use modern for loop instead of WTF_ARRAY_LENGTH.
1766         (WebCore::LocaleMac::shortMonthLabels): Ditto.
1767         * rendering/RenderCombineText.cpp:
1768         (WebCore::RenderCombineText::combineText): Ditto.
1769
1770 2017-06-06  Isaac Devine  <isaac@devinesystems.co.nz>
1771
1772         Allow FileReader to open files multiple times
1773
1774         If multiple file readers open files they are prevented by default due to
1775         Windows' file locking.
1776
1777         Allow FileReader to open multiple files for reading at the same time on wincairo
1778         https://bugs.webkit.org/show_bug.cgi?id=172632
1779
1780         Reviewed by Darin Adler.
1781
1782         * platform/win/FileSystemWin.cpp:
1783         (WebCore::openFile): Use the appropriate sharing options to allow multiple opens
1784
1785 2017-06-06  Beth Dakin  <bdakin@apple.com>
1786
1787         Netflix seeking quirk should also apply to Now Playing, and should always use the 
1788         livestream UI
1789         https://bugs.webkit.org/show_bug.cgi?id=173030
1790         -and corresponding-
1791         rdar://problem/32228660
1792
1793         Reviewed by Darin Adler.
1794
1795         This patch rolls out much of https://trac.webkit.org/changeset/217791/webkit in 
1796         favor of an approach that can be used to apply the quirk to Now Playing in 
1797         addition to Touch Bar. This patch also changes the UI in both Touch Bar and Now 
1798         Playing to match live stream UI, which means there is no playhead. This hopefully 
1799         makes it less confusing that taps on the timeline will have no effect. 
1800
1801         supportsSeeking() should return false for Netflix. That function needs to be 
1802         public now.
1803         * html/HTMLMediaElement.cpp:
1804         (WebCore::needsSeekingSupportQuirk):
1805         (WebCore::HTMLMediaElement::supportsSeeking):
1806         * html/HTMLMediaElement.h:
1807
1808         Here is where we get the desired result in Now Playing. Make sure the 
1809         currentSession supportsSeeking() before relying on the time and duration info for 
1810         the sake of Now Playing. 
1811         * platform/audio/mac/MediaSessionManagerMac.mm:
1812         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo):
1813
1814         We can roll out allowsTouchBarScrubbing() and rely on supportsSeeking().
1815         * platform/cocoa/WebPlaybackSessionModel.h:
1816         (WebCore::WebPlaybackSessionModelClient::mutedChanged):
1817         (WebCore::WebPlaybackSessionModelClient::allowsTouchBarScrubbingChanged): Deleted.
1818         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
1819         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
1820         (WebCore::WebPlaybackSessionModelMediaElement::updateForEventName):
1821
1822         And here is where we get the desired result for Touch Bar. Make sure the the media 
1823         element supportsSeeking() before relying on the duration. 
1824         (WebCore::WebPlaybackSessionModelMediaElement::duration):
1825
1826         We can roll out allowsTouchBarScrubbing() and rely on supportsSeeking().
1827         (WebCore::WebPlaybackSessionModelMediaElement::allowsTouchBarScrubbing): Deleted.
1828         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1829         * platform/mac/WebPlaybackControlsManager.h:
1830
1831         Currently the Touch Bar live stream UI lets you seek, which results in broken 
1832         behavior on real live streams and on Netflix. Prevent that by preventing scrubbing 
1833         for NaN and infinite durations.
1834         * platform/mac/WebPlaybackControlsManager.mm:
1835         (-[WebPlaybackControlsManager canBeginTouchBarScrubbing]):
1836
1837         We can roll out allowsTouchBarScrubbing() and rely on supportsSeeking().
1838         * platform/mac/WebPlaybackSessionInterfaceMac.h:
1839         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
1840         (WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager):
1841         (WebCore::WebPlaybackSessionInterfaceMac::allowsTouchBarScrubbingChanged): Deleted.
1842
1843 2017-06-06  Konstantin Tokarev  <annulen@yandex.ru>
1844
1845         Add missing <functional> includes
1846         https://bugs.webkit.org/show_bug.cgi?id=173017
1847
1848         Patch by Thiago Macieira <thiago.macieira@intel.com>
1849         Reviewed by Yusuke Suzuki.
1850
1851         This patch fixes compilation with GCC 7.
1852
1853         No new tests needed.
1854
1855         * css/CSSValue.h:
1856         * css/StyleSheetContents.h:
1857         * loader/NetscapePlugInStreamLoader.h:
1858         * loader/ResourceLoader.h:
1859
1860 2017-06-06  Konstantin Tokarev  <annulen@yandex.ru>
1861
1862         Fix compilation with !ENABLE(SVG_FONTS)
1863         https://bugs.webkit.org/show_bug.cgi?id=172731
1864
1865         Reviewed by Darin Adler.
1866
1867         No new tests needed.
1868
1869         * css/CSSFontFaceSource.cpp:
1870         (WebCore::CSSFontFaceSource::load):
1871
1872 2017-06-06  Zalan Bujtas  <zalan@apple.com>
1873
1874         Safari doesn't load newest The Order of the Stick comic.
1875         https://bugs.webkit.org/show_bug.cgi?id=172949
1876         <rdar://problem/32389730>
1877
1878         Reviewed by Antti Koivisto.
1879
1880         As part of the table layout, RenderTableSection::layoutRows calls the RenderTableCell's layout() directly
1881         (skipping the RenderTableRow parent). If during this call the RenderTableCell (or any of its descendant) marks the ancestor
1882         chain dirty, this dirty flag on the RenderTableRows will never be cleared and we'll end up early returning from RenderTableSection::paint.
1883         For certain type of float objects, we need to invalidate the line layout path during layout (and we mark the ancestors dirty).
1884         This patch takes a conservative approach and marks the ancestors dirty only when the renderer is not dirty yet, but
1885         as part of webkit.org/b/172947 we should revisit and validate whether the setNeedsLayout() is required at all.
1886
1887         Test: fast/table/floating-table-sibling-is-invisible.html
1888
1889         * rendering/RenderBlockFlow.cpp:
1890         (WebCore::RenderBlockFlow::invalidateLineLayoutPath):
1891
1892 2017-06-06  Emilio Cobos Álvarez  <ecobos@igalia.com>
1893
1894         [css-conditional] The one-string version of CSS.supports should be wrapped in implied parentheses.
1895         https://bugs.webkit.org/show_bug.cgi?id=172906
1896
1897         Reviewed by Darin Adler.
1898
1899         From https://drafts.csswg.org/css-conditional/#the-css-interface:
1900
1901         > When invoked with a single conditionText argument, it must return
1902         > true if conditionText, when either parsed and evaluated as a
1903         > supports_condition or parsed as a declaration, wrapped in implied
1904         > parentheses, and evaluated as a supports_condition, would return
1905         > true.
1906
1907         Note the "wrapped in implied parentheses" bit.
1908
1909         Gecko is fixing it in https://bugzil.la/1338486, and Blink in
1910         https://crbug.com/729403.
1911
1912         Tests: css3/supports-dom-api.html
1913                imported/w3c/web-platform-tests/cssom/CSS.html
1914
1915         * css/parser/CSSParser.cpp:
1916         (WebCore::CSSParser::parseSupportsCondition):
1917         * css/parser/CSSParserImpl.cpp:
1918         (WebCore::CSSParserImpl::consumeSupportsRule):
1919         * css/parser/CSSSupportsParser.cpp:
1920         (WebCore::CSSSupportsParser::supportsCondition):
1921         * css/parser/CSSSupportsParser.h:
1922
1923 2017-06-06  Joseph Pecoraro  <pecoraro@apple.com>
1924
1925         Move Resource Timing / User Timing from experimental features into main preferences
1926         https://bugs.webkit.org/show_bug.cgi?id=172950
1927
1928         Reviewed by Darin Adler.
1929
1930         * features.json:
1931         Graduate some features from In Development to Supported.
1932
1933 2017-06-06  Adrian Perez de Castro  <aperez@igalia.com>
1934
1935         [GTK][Wayland] Do not pass value of $DISPLAY to wl_display_connect()
1936         https://bugs.webkit.org/show_bug.cgi?id=172993
1937
1938         Reviewed by Žan Doberšek.
1939
1940         No new tests needed.
1941
1942         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
1943         (WebCore::PlatformDisplayWayland::create): Instead of using the "DISPLAY" environment variable (meant for X11),
1944         pass a null pointer to "wl_display_connect()". This function checks the value of the "WAYLAND_DISPLAY" environment
1945         variable itself and therefore we do not need to pass it ourselves.
1946
1947 2017-06-06  Antoine Quint  <graouts@apple.com>
1948
1949         Rebaseline and enable media/modern-media-controls/airplay-support
1950         https://bugs.webkit.org/show_bug.cgi?id=172980
1951
1952         Reviewed by Eric Carlson.
1953
1954         Fixing a small issue in the modern media controls code which would yield
1955         an error when manually creating a MediaController without a MediaControlsHost.
1956
1957         * Modules/modern-media-controls/media/media-controller.js:
1958         (MediaController.prototype.get isAudio):
1959
1960 2017-06-06  Antoine Quint  <graouts@apple.com>
1961
1962         Update modern media controls testing utilities
1963         https://bugs.webkit.org/show_bug.cgi?id=172976
1964         <rdar://problem/32588432>
1965
1966         Reviewed by Eric Carlson.
1967
1968         Stop logging an error when we're not able to load UI Strings since UI strings
1969         are not defined in the majority of modern-media-controls tests as we load the
1970         code directly from the modern-media-controls module and can't reach into the
1971         English.lproj directory, nor is it necessary.
1972
1973         * Modules/modern-media-controls/main.js:
1974         (UIString):
1975
1976 2017-06-06  Carlos Garcia Campos  <cgarcia@igalia.com>
1977
1978         [GStreamer] Use the same draw timer and mutex when AC disabled or building without OpenGL
1979         https://bugs.webkit.org/show_bug.cgi?id=172923
1980
1981         Reviewed by Michael Catanzaro.
1982
1983         We have two different paths to do the same. When building without OpenGL, the VideoRenderRequestScheduler has
1984         its own timer and we need to add ifdefs to handle that. But when building with OpenGL we still support
1985         non-accelerated rendering that does the same than the VideoRenderRequestScheduler timer, but using the media
1986         player timer instead. We can simplify the code and remove more ifdefs by using the media player timer and mutex
1987         in all cases for non-accelerated rendering.
1988
1989         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1990         (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
1991         (WebCore::MediaPlayerPrivateGStreamerBase::repaint):
1992         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
1993         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
1994         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1995         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
1996         (VideoRenderRequestScheduler::start):
1997         (VideoRenderRequestScheduler::stop):
1998         (VideoRenderRequestScheduler::requestRender):
1999         (VideoRenderRequestScheduler::VideoRenderRequestScheduler): Deleted.
2000         (VideoRenderRequestScheduler::render): Deleted.
2001
2002 2017-06-05  Antoine Quint  <graouts@apple.com>
2003
2004         Update media controls to match latest design specs
2005         https://bugs.webkit.org/show_bug.cgi?id=172932
2006
2007         Reviewed by Dean Jackson.
2008
2009         The media controls specs have changed and we now implement them. The main controls bar now
2010         appears to be floating, with a rounded corners and a margin around it. Some of the controls
2011         it used to contain now may appear outside of it. Specifically, the fullscreen and
2012         picture-in-picture buttons now are displayed in a dedicated controls bar in the top-left
2013         corner and the mute button, on iOS (where we don't support changing the volume when inline),
2014         is displayed in the top right corner.
2015
2016         Another small UI improvement is that we display an activity indicator when we are waiting
2017         for data to initiate or resume playback instead of showing the elapsed time label. We also
2018         make displaying the scrubber more important than displaying other controls, except for the
2019         play/pause button, when width becomes scarce. Finally, we no longer use a speci layer type
2020         for the controls bar backgrounds, we now use the same "backdrop-filter" and tint overlay
2021         on both macOS and iOS.
2022
2023         Since this work had previously been done through WebKitAdditions, we remove the specific
2024         build phase code that we added for this purpose and are now only ever looking for media
2025         controls code in the WebCore source tree.
2026
2027         * Modules/modern-media-controls/controls/activity-indicator.css: Added.
2028         (.activity-indicator):
2029         (.activity-indicator > div):
2030         (.activity-indicator > .ne):
2031         (.activity-indicator > .e):
2032         (.activity-indicator > .se):
2033         (.activity-indicator > .s):
2034         (.activity-indicator > .sw):
2035         (.activity-indicator > .w):
2036         (.activity-indicator > .nw):
2037         (@keyframes activity-indicator-pulse):
2038         (to):
2039         * Modules/modern-media-controls/controls/airplay-button.js:
2040         * Modules/modern-media-controls/controls/auto-hide-controller.js: Added.
2041         (AutoHideController):
2042         (AutoHideController.prototype.get fadesWhileIdle):
2043         (AutoHideController.prototype.set fadesWhileIdle):
2044         (AutoHideController.prototype.handleEvent):
2045         (AutoHideController.prototype.gestureRecognizerStateDidChange):
2046         (AutoHideController.prototype.mediaControlsFadedStateDidChange):
2047         (AutoHideController.prototype.mediaControlsBecameInvisible):
2048         (AutoHideController.prototype._cancelNonEnforcedAutoHideTimer):
2049         (AutoHideController.prototype._cancelAutoHideTimer):
2050         (AutoHideController.prototype._resetAutoHideTimer):
2051         (AutoHideController.prototype._autoHideTimerFired):
2052         * Modules/modern-media-controls/controls/background-click-delegate-notifier.js: Added.
2053         (BackgroundClickDelegateNotifier):
2054         (BackgroundClickDelegateNotifier.prototype.handleEvent):
2055         * Modules/modern-media-controls/controls/background-tint.css:
2056         (.background-tint,):
2057         (.background-tint > .blur):
2058         (.background-tint > .tint):
2059         * Modules/modern-media-controls/controls/button.css:
2060         (button):
2061         (button > picture):
2062         (button.skip-back > picture,):
2063         (button.on > picture):
2064         (button:active > picture):
2065         (button.corner):
2066         (button.center,):
2067         (button.center):
2068         (button.small-center):
2069         (button.center > .background-tint,):
2070         (button.center > picture,):
2071         (button.center:active > picture,):
2072         * Modules/modern-media-controls/controls/button.js:
2073         (Button.prototype.get iconName):
2074         (Button.prototype.set iconName):
2075         (Button.prototype.get on):
2076         (Button.prototype.set on):
2077         (Button.prototype.get style):
2078         (Button.prototype.set style):
2079         (Button.prototype.get scaleFactor):
2080         (Button.prototype.set scaleFactor):
2081         (Button.prototype.handleEvent):
2082         (Button.prototype.commit):
2083         (Button.prototype._loadImage):
2084         (Button.prototype._imageSourceDidLoad):
2085         (Button.prototype._updateImage):
2086         (Button.prototype._updateImageMetrics):
2087         (Button):
2088         * Modules/modern-media-controls/controls/buttons-container.css:
2089         (.buttons-container):
2090         (.ios .buttons-container button):
2091         * Modules/modern-media-controls/controls/buttons-container.js:
2092         * Modules/modern-media-controls/controls/controls-bar.css:
2093         (.controls-bar):
2094         (.controls-bar.faded): Deleted.
2095         * Modules/modern-media-controls/controls/controls-bar.js:
2096         (ControlsBar.prototype.get children):
2097         (ControlsBar.prototype.set children):
2098         (ControlsBar.prototype.commitProperty):
2099         (ControlsBar.prototype.get userInteractionEnabled): Deleted.
2100         (ControlsBar.prototype.set userInteractionEnabled): Deleted.
2101         (ControlsBar.prototype.get fadesWhileIdle): Deleted.
2102         (ControlsBar.prototype.set fadesWhileIdle): Deleted.
2103         (ControlsBar.prototype.get visible): Deleted.
2104         (ControlsBar.prototype.set visible): Deleted.
2105         (ControlsBar.prototype.get faded): Deleted.
2106         (ControlsBar.prototype.set faded): Deleted.
2107         (ControlsBar.prototype.handleEvent): Deleted.
2108         (ControlsBar.prototype.gestureRecognizerStateDidChange): Deleted.
2109         (ControlsBar.prototype._cancelNonEnforcedAutoHideTimer): Deleted.
2110         (ControlsBar.prototype._cancelAutoHideTimer): Deleted.
2111         (ControlsBar.prototype._resetAutoHideTimer): Deleted.
2112         (ControlsBar.prototype._autoHideTimerFired): Deleted.
2113         * Modules/modern-media-controls/controls/fullscreen-button.js:
2114         * Modules/modern-media-controls/controls/icon-button.css: Removed.
2115         * Modules/modern-media-controls/controls/icon-button.js: Removed.
2116         * Modules/modern-media-controls/controls/icon-service.js:
2117         (const.iconService.new.IconService.prototype.imageForIconAndLayoutTraits):
2118         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconAndLayoutTraits):
2119         (const.iconService.new.IconService):
2120         (const.iconService.new.IconService.prototype.imageForIconNameAndLayoutTraits): Deleted.
2121         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconNameAndLayoutTraits): Deleted.
2122         * Modules/modern-media-controls/controls/inline-layout-support.js: Removed.
2123         * Modules/modern-media-controls/controls/inline-media-controls.css: Added.
2124         (.media-controls.inline > .controls-bar):
2125         (.media-controls.inline > .controls-bar.top-left):
2126         (.media-controls.inline.audio > .controls-bar):
2127         (.media-controls.inline > .controls-bar > *):
2128         (.media-controls.inline > button.mute):
2129         (.media-controls.inline > button.play-pause.corner):
2130         (.media-controls.inline.audio > button.play-pause.corner):
2131         (.media-controls.inline > .controls-bar button):
2132         (.media-controls.inline button.start.center > picture,):
2133         (.media-controls.inline button.start.small-center > picture,):
2134         (.media-controls.inline .time-control,):
2135         * Modules/modern-media-controls/controls/inline-media-controls.js: Added.
2136         (InlineMediaControls):
2137         (InlineMediaControls.prototype.set shouldUseAudioLayout):
2138         (InlineMediaControls.prototype.set shouldUseSingleBarLayout):
2139         (InlineMediaControls.prototype.get showsStartButton):
2140         (InlineMediaControls.prototype.set showsStartButton):
2141         (InlineMediaControls.prototype.showPlacard):
2142         (InlineMediaControls.prototype.hidePlacard):
2143         (InlineMediaControls.prototype.layout):
2144         (InlineMediaControls.prototype.commitProperty):
2145         (InlineMediaControls.prototype.get preferredMuteButtonStyle):
2146         (InlineMediaControls.prototype._topLeftContainerButtons):
2147         (InlineMediaControls.prototype._leftContainerButtons):
2148         (InlineMediaControls.prototype._rightContainerButtons):
2149         (InlineMediaControls.prototype._droppableButtons):
2150         * Modules/modern-media-controls/controls/ios-inline-media-controls.css: Removed.
2151         * Modules/modern-media-controls/controls/ios-inline-media-controls.js:
2152         (IOSInlineMediaControls.prototype.get showsStartButton):
2153         (IOSInlineMediaControls.prototype.set showsStartButton):
2154         (IOSInlineMediaControls.prototype.gestureRecognizerStateDidChange):
2155         (IOSInlineMediaControls.prototype._pinchGestureRecognizerStateDidChange):
2156         (IOSInlineMediaControls.prototype._tapGestureRecognizerStateDidChange):
2157         (IOSInlineMediaControls):
2158         (IOSInlineMediaControls.prototype.layout): Deleted.
2159         (IOSInlineMediaControls.prototype.layoutTraitsDidChange): Deleted.
2160         * Modules/modern-media-controls/controls/layout-item.js:
2161         * Modules/modern-media-controls/controls/layout-node.js:
2162         (LayoutNode.prototype.commitProperty):
2163         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css: Removed.
2164         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
2165         (.media-controls.mac.fullscreen .buttons-container.left):
2166         (.media-controls.mac.fullscreen .buttons-container.center):
2167         (.media-controls.mac.fullscreen .time-control):
2168         (.media-controls.mac.fullscreen > .controls-bar .status-label):
2169         (.media-controls.mac.fullscreen > .controls-bar > .background-tint > div): Deleted.
2170         (.media-controls.mac.fullscreen .volume.slider): Deleted.
2171         (.media-controls.mac.fullscreen button.volume-down): Deleted.
2172         (.media-controls.mac.fullscreen button.volume-up): Deleted.
2173         (.media-controls.mac.fullscreen button.rewind): Deleted.
2174         (.media-controls.mac.fullscreen button.play-pause): Deleted.
2175         (.media-controls.mac.fullscreen button.forward): Deleted.
2176         (.media-controls.mac.fullscreen .time-label): Deleted.
2177         (.media-controls.mac.fullscreen .scrubber): Deleted.
2178         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
2179         (MacOSFullscreenMediaControls.prototype.handleEvent):
2180         (MacOSFullscreenMediaControls.prototype.layout):
2181         (MacOSFullscreenMediaControls.prototype._handleMousedown):
2182         (MacOSFullscreenMediaControls.prototype._handleMousemove):
2183         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
2184         (.media-controls.mac.inline .volume-slider-container):
2185         (.media-controls.mac.inline.audio .volume-slider-container):
2186         (.media-controls.mac.inline .volume-slider-container > .background-tint):
2187         (.media-controls.mac.inline .volume-slider-container > .background-tint > div):
2188         (.media-controls.mac.inline .volume-slider-container > .slider):
2189         (.media-controls.mac.inline > .controls-bar): Deleted.
2190         (.media-controls.mac.inline > .controls-bar > *): Deleted.
2191         (.media-controls.mac.inline > button.start > div): Deleted.
2192         (.media-controls.mac.inline > .controls-bar button): Deleted.
2193         (.media-controls.mac.inline button.play-pause): Deleted.
2194         (.media-controls.mac.inline button.skip-back): Deleted.
2195         (.media-controls.mac.inline .scrubber.slider): Deleted.
2196         (.media-controls.mac.inline button.mute): Deleted.
2197         (.media-controls.mac.inline button.airplay): Deleted.
2198         (.media-controls.mac.inline button.pip): Deleted.
2199         (.media-controls.mac.inline button.tracks): Deleted.
2200         (.media-controls.mac.inline button.fullscreen): Deleted.
2201         (.media-controls.mac.inline .time-label,): Deleted.
2202         (.media-controls.mac.inline .volume.slider): Deleted.
2203         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
2204         (MacOSInlineMediaControls.prototype.layout):
2205         (MacOSInlineMediaControls.prototype.get preferredMuteButtonStyle):
2206         (MacOSInlineMediaControls.prototype.handleEvent):
2207         (MacOSInlineMediaControls.prototype.layoutTraitsDidChange): Deleted.
2208         * Modules/modern-media-controls/controls/macos-media-controls.js: Removed.
2209         * Modules/modern-media-controls/controls/media-controls.css:
2210         (:host(audio)):
2211         (*):
2212         (:host(audio), *):
2213         (.media-controls-container):
2214         (.media-controls):
2215         (.media-controls > *):
2216         (.media-controls.shows-tracks-panel > .controls-bar,):
2217         (.media-controls.faded > *:not(.placard)):
2218         (.media-controls .time-label,):
2219         * Modules/modern-media-controls/controls/media-controls.js:
2220         (MediaControls.prototype.get visible):
2221         (MediaControls.prototype.set visible):
2222         (MediaControls.prototype.get faded):
2223         (MediaControls.prototype.set faded):
2224         (MediaControls.prototype.showTracksPanel):
2225         (MediaControls.prototype.hideTracksPanel):
2226         (MediaControls.prototype.isPointInControls):
2227         (MediaControls.prototype.handleEvent):
2228         (MediaControls.prototype.commitProperty):
2229         (MediaControls.prototype.get layoutTraits): Deleted.
2230         (MediaControls.prototype.set layoutTraits): Deleted.
2231         (MediaControls.prototype.get showsStartButton): Deleted.
2232         (MediaControls.prototype.set showsStartButton): Deleted.
2233         (MediaControls.prototype.get placard): Deleted.
2234         (MediaControls.prototype.get showsPlacard): Deleted.
2235         (MediaControls.prototype.showPlacard): Deleted.
2236         (MediaControls.prototype.hidePlacard): Deleted.
2237         (MediaControls.prototype.controlsBarVisibilityDidChange): Deleted.
2238         (MediaControls.prototype.controlsBarFadedStateDidChange): Deleted.
2239         (MediaControls.prototype.layoutTraitsDidChange): Deleted.
2240         (MediaControls.prototype.layout): Deleted.
2241         (MediaControls.prototype._invalidateChildren): Deleted.
2242         * Modules/modern-media-controls/controls/media-document.css:
2243         (:host(.media-document)):
2244         (:host(.media-document.audio.mac)):
2245         * Modules/modern-media-controls/controls/mute-button.js:
2246         * Modules/modern-media-controls/controls/pip-button.js:
2247         * Modules/modern-media-controls/controls/placard.css:
2248         (.placard):
2249         (.placard .container):
2250         (.placard button):
2251         (.placard button > picture):
2252         (.placard .icon): Deleted.
2253         * Modules/modern-media-controls/controls/placard.js:
2254         (Placard.):
2255         (Placard.prototype.layout):
2256         * Modules/modern-media-controls/controls/play-pause-button.js:
2257         (PlayPauseButton):
2258         (PlayPauseButton.prototype.commit):
2259         * Modules/modern-media-controls/controls/scheduler.js:
2260         (const.scheduler.new.prototype.scheduleLayout):
2261         (const.scheduler.new.prototype.unscheduleLayout):
2262         (const.scheduler.new.prototype._requestFrameIfNeeded):
2263         (const.scheduler.new.prototype._frameDidFire):
2264         (const.scheduler.new.prototype._layout):
2265         * Modules/modern-media-controls/controls/scrubber.js: Removed.
2266         * Modules/modern-media-controls/controls/seek-button.js:
2267         * Modules/modern-media-controls/controls/skip-back-button.js:
2268         * Modules/modern-media-controls/controls/skip-forward-button.js: Added.
2269         (SkipForwardButton):
2270         * Modules/modern-media-controls/controls/slider.css:
2271         (.slider):
2272         (.slider > .custom-slider,):
2273         (.slider > .custom-slider):
2274         (.slider > .custom-slider > *):
2275         (.slider > .custom-slider > .fill):
2276         (.slider > .custom-slider > .track):
2277         (.slider > .custom-slider > .primary):
2278         (.slider > .custom-slider > .secondary):
2279         (.slider > .custom-slider > .knob):
2280         (.slider > input):
2281         (.slider > input::-webkit-slider-thumb):
2282         (.slider.disabled > input,):
2283         (.ios .slider > input):
2284         (.ios .slider > input::-webkit-slider-runnable-track):
2285         (.ios .slider > input::-webkit-slider-thumb):
2286         (.slider > canvas,): Deleted.
2287         (.slider > canvas): Deleted.
2288         * Modules/modern-media-controls/controls/slider.js:
2289         (Slider.prototype.set inputAccessibleLabel):
2290         (Slider.prototype.get disabled):
2291         (Slider.prototype.set disabled):
2292         (Slider.prototype.get secondaryValue):
2293         (Slider.prototype.set secondaryValue):
2294         (Slider.prototype._formatTime):
2295         (Slider.prototype.commitProperty):
2296         (Slider.prototype.commit):
2297         (Slider.prototype.draw): Deleted.
2298         (addRoundedRect): Deleted.
2299         * Modules/modern-media-controls/controls/start-button.css: Removed.
2300         * Modules/modern-media-controls/controls/start-button.js: Removed.
2301         * Modules/modern-media-controls/controls/status-label.css:
2302         (.status-label):
2303         * Modules/modern-media-controls/controls/status-label.js:
2304         (StatusLabel.prototype.get enabled):
2305         (StatusLabel.prototype.set enabled): Deleted.
2306         * Modules/modern-media-controls/controls/text-tracks.css:
2307         (video::-webkit-media-text-track-container):
2308         (video::-webkit-media-text-track-container.visible-controls-bar):
2309         (video::-webkit-media-text-track-container.visible-controls-bar.compact-controls-bar): Deleted.
2310         * Modules/modern-media-controls/controls/time-control.js:
2311         (TimeControl.prototype.set duration):
2312         (TimeControl.prototype.set currentTime):
2313         (TimeControl.prototype.get loading):
2314         (TimeControl.prototype.set loading):
2315         (TimeControl.prototype.get minimumWidth):
2316         (TimeControl.prototype.get idealMinimumWidth):
2317         (TimeControl.prototype.layout):
2318         (TimeControl.prototype._performIdealLayout):
2319         (TimeControl.prototype.get useSixDigitsForTimeLabels): Deleted.
2320         (TimeControl.prototype.set useSixDigitsForTimeLabels): Deleted.
2321         (TimeControl.prototype.get isSufficientlyWide): Deleted.
2322         * Modules/modern-media-controls/controls/time-label.css:
2323         (.time-label):
2324         * Modules/modern-media-controls/controls/time-label.js:
2325         (TimeLabel.prototype.setValueWithNumberOfDigits):
2326         (TimeLabel.prototype.commitProperty):
2327         (TimeLabel.prototype._formattedTime):
2328         (doubleDigits):
2329         (TimeLabel.prototype.set value): Deleted.
2330         * Modules/modern-media-controls/controls/tracks-button.js:
2331         * Modules/modern-media-controls/controls/tracks-panel.css:
2332         (.tracks-panel > .scrollable-container):
2333         (.tracks-panel section):
2334         (.tracks-panel section > h3):
2335         (.tracks-panel > .background-tint > div,): Deleted.
2336         * Modules/modern-media-controls/controls/volume-down-button.js:
2337         * Modules/modern-media-controls/controls/volume-slider.css: Removed.
2338         * Modules/modern-media-controls/controls/volume-slider.js: Removed.
2339         * Modules/modern-media-controls/controls/volume-up-button.js:
2340         * Modules/modern-media-controls/gesture-recognizers/gesture-recognizer.js:
2341         (GestureRecognizer.prototype.gestureBegan):
2342         (GestureRecognizer.prototype._removeTrackingListeners):
2343         * Modules/modern-media-controls/gesture-recognizers/tap.js:
2344         (TapGestureRecognizer.prototype.touchesMoved):
2345         * Modules/modern-media-controls/images/iOS/Airplay.svg: Added.
2346         * Modules/modern-media-controls/images/iOS/EnterFullscreen.svg: Added.
2347         * Modules/modern-media-controls/images/iOS/MediaSelector.svg: Added.
2348         * Modules/modern-media-controls/images/iOS/MiniPipIn.svg: Added.
2349         * Modules/modern-media-controls/images/iOS/Mute.svg: Added.
2350         * Modules/modern-media-controls/images/iOS/Pause.svg: Added.
2351         * Modules/modern-media-controls/images/iOS/PipIn.svg: Added.
2352         * Modules/modern-media-controls/images/iOS/Play.svg: Added.
2353         * Modules/modern-media-controls/images/iOS/SkipBack15.svg: Added.
2354         * Modules/modern-media-controls/images/iOS/SkipForward15.svg: Added.
2355         * Modules/modern-media-controls/images/iOS/VolumeHi.svg: Added.
2356         * Modules/modern-media-controls/images/iOS/airplay@1x.png: Removed.
2357         * Modules/modern-media-controls/images/iOS/airplay@2x.png: Removed.
2358         * Modules/modern-media-controls/images/iOS/enter-fullscreen@1x.png: Removed.
2359         * Modules/modern-media-controls/images/iOS/enter-fullscreen@2x.png: Removed.
2360         * Modules/modern-media-controls/images/iOS/enter-fullscreen@3x.png: Removed.
2361         * Modules/modern-media-controls/images/iOS/interval-skip-back@1x.png: Removed.
2362         * Modules/modern-media-controls/images/iOS/interval-skip-back@2x.png: Removed.
2363         * Modules/modern-media-controls/images/iOS/interval-skip-back@3x.png: Removed.
2364         * Modules/modern-media-controls/images/iOS/pause@1x.png: Removed.
2365         * Modules/modern-media-controls/images/iOS/pause@2x.png: Removed.
2366         * Modules/modern-media-controls/images/iOS/pause@3x.png: Removed.
2367         * Modules/modern-media-controls/images/iOS/pip-in@1x.png: Removed.
2368         * Modules/modern-media-controls/images/iOS/pip-in@2x.png: Removed.
2369         * Modules/modern-media-controls/images/iOS/pip-in@3x.png: Removed.
2370         * Modules/modern-media-controls/images/iOS/play@1x.png: Removed.
2371         * Modules/modern-media-controls/images/iOS/play@2x.png: Removed.
2372         * Modules/modern-media-controls/images/iOS/play@3x.png: Removed.
2373         * Modules/modern-media-controls/images/iOS/slider-thumb@2x.png: Removed.
2374         * Modules/modern-media-controls/images/iOS/start@1x.png: Removed.
2375         * Modules/modern-media-controls/images/iOS/start@2x.png: Removed.
2376         * Modules/modern-media-controls/images/iOS/start@3x.png: Removed.
2377         * Modules/modern-media-controls/images/macOS/Airplay-fullscreen.svg: Added.
2378         * Modules/modern-media-controls/images/macOS/Airplay.svg: Added.
2379         * Modules/modern-media-controls/images/macOS/EnterFullscreen.svg: Added.
2380         * Modules/modern-media-controls/images/macOS/ExitFullscreen.svg: Added.
2381         * Modules/modern-media-controls/images/macOS/Forward.svg: Added.
2382         * Modules/modern-media-controls/images/macOS/MediaSelector-fullscreen.svg: Added.
2383         * Modules/modern-media-controls/images/macOS/MediaSelector.svg: Added.
2384         * Modules/modern-media-controls/images/macOS/Mute.svg: Added.
2385         * Modules/modern-media-controls/images/macOS/Pause.svg: Added.
2386         * Modules/modern-media-controls/images/macOS/PipIn-fullscreen.svg: Added.
2387         * Modules/modern-media-controls/images/macOS/PipIn.svg: Added.
2388         * Modules/modern-media-controls/images/macOS/Play.svg: Added.
2389         * Modules/modern-media-controls/images/macOS/Rewind.svg: Added.
2390         * Modules/modern-media-controls/images/macOS/SkipBack15.svg: Added.
2391         * Modules/modern-media-controls/images/macOS/SkipForward15.svg: Added.
2392         * Modules/modern-media-controls/images/macOS/VolumeHi.svg: Added.
2393         * Modules/modern-media-controls/images/macOS/VolumeLo.svg: Added.
2394         * Modules/modern-media-controls/images/macOS/airplay-compact@1x.png: Removed.
2395         * Modules/modern-media-controls/images/macOS/airplay-compact@2x.png: Removed.
2396         * Modules/modern-media-controls/images/macOS/airplay-fullscreen@1x.png: Removed.
2397         * Modules/modern-media-controls/images/macOS/airplay-fullscreen@2x.png: Removed.
2398         * Modules/modern-media-controls/images/macOS/airplay@1x.png: Removed.
2399         * Modules/modern-media-controls/images/macOS/airplay@2x.png: Removed.
2400         * Modules/modern-media-controls/images/macOS/enter-fullscreen-compact@1x.png: Removed.
2401         * Modules/modern-media-controls/images/macOS/enter-fullscreen-compact@2x.png: Removed.
2402         * Modules/modern-media-controls/images/macOS/enter-fullscreen@1x.png: Removed.
2403         * Modules/modern-media-controls/images/macOS/enter-fullscreen@2x.png: Removed.
2404         * Modules/modern-media-controls/images/macOS/exit-fullscreen@1x.png: Removed.
2405         * Modules/modern-media-controls/images/macOS/exit-fullscreen@2x.png: Removed.
2406         * Modules/modern-media-controls/images/macOS/forward@1x.png: Removed.
2407         * Modules/modern-media-controls/images/macOS/forward@2x.png: Removed.
2408         * Modules/modern-media-controls/images/macOS/interval-skip-back-compact@1x.png: Removed.
2409         * Modules/modern-media-controls/images/macOS/interval-skip-back-compact@2x.png: Removed.
2410         * Modules/modern-media-controls/images/macOS/interval-skip-back@1x.png: Removed.
2411         * Modules/modern-media-controls/images/macOS/interval-skip-back@2x.png: Removed.
2412         * Modules/modern-media-controls/images/macOS/media-selection-compact@1x.png: Removed.
2413         * Modules/modern-media-controls/images/macOS/media-selection-compact@2x.png: Removed.
2414         * Modules/modern-media-controls/images/macOS/media-selection-fullscreen@1x.png: Removed.
2415         * Modules/modern-media-controls/images/macOS/media-selection-fullscreen@2x.png: Removed.
2416         * Modules/modern-media-controls/images/macOS/media-selection@1x.png: Removed.
2417         * Modules/modern-media-controls/images/macOS/media-selection@2x.png: Removed.
2418         * Modules/modern-media-controls/images/macOS/pause-compact@1x.png: Removed.
2419         * Modules/modern-media-controls/images/macOS/pause-compact@2x.png: Removed.
2420         * Modules/modern-media-controls/images/macOS/pause-fullscreen@1x.png: Removed.
2421         * Modules/modern-media-controls/images/macOS/pause-fullscreen@2x.png: Removed.
2422         * Modules/modern-media-controls/images/macOS/pause@1x.png: Removed.
2423         * Modules/modern-media-controls/images/macOS/pause@2x.png: Removed.
2424         * Modules/modern-media-controls/images/macOS/pip-in-compact@1x.png: Removed.
2425         * Modules/modern-media-controls/images/macOS/pip-in-compact@2x.png: Removed.
2426         * Modules/modern-media-controls/images/macOS/pip-in-fullscreen@1x.png: Removed.
2427         * Modules/modern-media-controls/images/macOS/pip-in-fullscreen@2x.png: Removed.
2428         * Modules/modern-media-controls/images/macOS/pip-in@1x.png: Removed.
2429         * Modules/modern-media-controls/images/macOS/pip-in@2x.png: Removed.
2430         * Modules/modern-media-controls/images/macOS/play-compact@1x.png: Removed.
2431         * Modules/modern-media-controls/images/macOS/play-compact@2x.png: Removed.
2432         * Modules/modern-media-controls/images/macOS/play-fullscreen@1x.png: Removed.
2433         * Modules/modern-media-controls/images/macOS/play-fullscreen@2x.png: Removed.
2434         * Modules/modern-media-controls/images/macOS/play@1x.png: Removed.
2435         * Modules/modern-media-controls/images/macOS/play@2x.png: Removed.
2436         * Modules/modern-media-controls/images/macOS/rewind@1x.png: Removed.
2437         * Modules/modern-media-controls/images/macOS/rewind@2x.png: Removed.
2438         * Modules/modern-media-controls/images/macOS/scale-to-fill@1x.png: Removed.
2439         * Modules/modern-media-controls/images/macOS/scale-to-fill@2x.png: Removed.
2440         * Modules/modern-media-controls/images/macOS/scale-to-fit@1x.png: Removed.
2441         * Modules/modern-media-controls/images/macOS/scale-to-fit@2x.png: Removed.
2442         * Modules/modern-media-controls/images/macOS/start@1x.png: Removed.
2443         * Modules/modern-media-controls/images/macOS/start@2x.png: Removed.
2444         * Modules/modern-media-controls/images/macOS/volume-compact@1x.png: Removed.
2445         * Modules/modern-media-controls/images/macOS/volume-compact@2x.png: Removed.
2446         * Modules/modern-media-controls/images/macOS/volume-down-fullscreen@1x.png: Removed.
2447         * Modules/modern-media-controls/images/macOS/volume-down-fullscreen@2x.png: Removed.
2448         * Modules/modern-media-controls/images/macOS/volume-mute-compact@1x.png: Removed.
2449         * Modules/modern-media-controls/images/macOS/volume-mute-compact@2x.png: Removed.
2450         * Modules/modern-media-controls/images/macOS/volume-mute@1x.png: Removed.
2451         * Modules/modern-media-controls/images/macOS/volume-mute@2x.png: Removed.
2452         * Modules/modern-media-controls/images/macOS/volume-up-fullscreen@1x.png: Removed.
2453         * Modules/modern-media-controls/images/macOS/volume-up-fullscreen@2x.png: Removed.
2454         * Modules/modern-media-controls/images/macOS/volume@1x.png: Removed.
2455         * Modules/modern-media-controls/images/macOS/volume@2x.png: Removed.
2456         * Modules/modern-media-controls/js-files:
2457         * Modules/modern-media-controls/main.js:
2458         (UIString):
2459         (formatTimeByUnit):
2460         * Modules/modern-media-controls/media/audio-support.js: Added.
2461         (AudioSupport.prototype.get control):
2462         (AudioSupport.prototype.get mediaEvents):
2463         (AudioSupport.prototype.get tracksToMonitor):
2464         (AudioSupport.prototype.syncControl):
2465         (AudioSupport):
2466         * Modules/modern-media-controls/media/controls-visibility-support.js:
2467         (ControlsVisibilitySupport.prototype._updateControls):
2468         (ControlsVisibilitySupport):
2469         * Modules/modern-media-controls/media/fullscreen-support.js:
2470         (FullscreenSupport.prototype.buttonWasPressed):
2471         (FullscreenSupport.prototype.syncControl):
2472         (FullscreenSupport):
2473         (FullscreenSupport.prototype.iOSInlineMediaControlsRecognizedPinchInGesture): Deleted.
2474         * Modules/modern-media-controls/media/media-controller.js:
2475         (MediaController):
2476         (MediaController.prototype.get isAudio):
2477         (MediaController.prototype.get isYouTubeEmbedWithTitle):
2478         (MediaController.prototype.get isFullscreen):
2479         (MediaController.prototype.get layoutTraits):
2480         (MediaController.prototype.iOSInlineMediaControlsRecognizedTapGesture):
2481         (MediaController.prototype.iOSInlineMediaControlsRecognizedPinchInGesture):
2482         (MediaController.prototype._updateControlsIfNeeded):
2483         (MediaController.prototype._updateTextTracksClassList):
2484         (MediaController.prototype.controlsBarFadedStateDidChange): Deleted.
2485         * Modules/modern-media-controls/media/media-document-controller.js:
2486         (MediaDocumentController.prototype._mediaDocumentHasMetadata):
2487         * Modules/modern-media-controls/media/placard-support.js:
2488         (PlacardSupport.prototype._updatePlacard):
2489         (PlacardSupport):
2490         * Modules/modern-media-controls/media/scrubbing-support.js:
2491         (ScrubbingSupport.prototype.get mediaEvents):
2492         (ScrubbingSupport.prototype.syncControl):
2493         (ScrubbingSupport):
2494         * Modules/modern-media-controls/media/skip-back-support.js:
2495         * Modules/modern-media-controls/media/skip-forward-support.js: Added.
2496         (SkipForwardSupport.prototype.get control):
2497         (SkipForwardSupport.prototype.get mediaEvents):
2498         (SkipForwardSupport.prototype.buttonWasPressed):
2499         (SkipForwardSupport.prototype.syncControl):
2500         (SkipForwardSupport):
2501         * Modules/modern-media-controls/media/start-support.js:
2502         (StartSupport):
2503         (StartSupport.prototype.handleEvent):
2504         (StartSupport.prototype._shouldShowStartButton):
2505         (StartSupport.prototype.get control): Deleted.
2506         (StartSupport.prototype.syncControl): Deleted.
2507         * Modules/modern-media-controls/media/status-support.js:
2508         (StatusSupport.prototype.get mediaEvents):
2509         (StatusSupport.prototype.syncControl):
2510         (StatusSupport):
2511         * Modules/modern-media-controls/media/time-control-support.js: Renamed from Source/WebCore/Modules/modern-media-controls/media/time-labels-support.js.
2512         (TimeControlSupport.prototype.syncControl):
2513         (TimeControlSupport):
2514         * Modules/modern-media-controls/media/tracks-support.js:
2515         (TracksSupport.prototype.syncControl):
2516         * WebCore.xcodeproj/project.pbxproj:
2517
2518 2017-06-05  Wenson Hsieh  <wenson_hsieh@apple.com>
2519
2520         Refactor -[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:] to check readable types
2521         https://bugs.webkit.org/show_bug.cgi?id=172891
2522         <rdar://problem/32204540>
2523
2524         Reviewed by Darin Adler.
2525
2526         Tweaks some logic in PlatformPasteboardIOS and WebItemProviderPasteboard to correctly construct objects in
2527         -valuesForPasteboardType:inItemSet:. Previously, we have a hard-coded map of UTI type to Class in the form of
2528         static helpers titled is{RichText, String, URL, Image, Color}Type in WebItemProviderPasteboard. We would use
2529         these functions to determine whether an NSAttributedString, NSString, NSURL, UIImage or UIColor should be
2530         constructed using the loaded item provider data. This is incorrect for some UTIs, such as public.html, which
2531         cannot actually be used to construct an NSAttributedString -- this caused -valuesForPasteboardType:inItemSet: to
2532         always return nil when attempting to create an object corresponding to public.html.
2533
2534         To fix this, we refactor -valuesForPasteboardType:inItemSet: to instead iterate through UIItemProviderReading-
2535         conformant classes in search for a class that can be created for the given UTI type. If no such class exists, we
2536         then fall back to custom WebKit handling of the dropped UTI type, which so far only includes reading an NSString
2537         with public.plain-text if the UTI is public.html (i.e. reading the HTML source from loaded item provider data).
2538
2539         Covered by 2 new API tests:
2540         DataInteractionTests.ExternalSourceHTMLToContentEditable
2541         DataInteractionTests.ExternalSourceAttributedStringToContentEditable
2542
2543         * platform/ios/PlatformPasteboardIOS.mm:
2544         (WebCore::PlatformPasteboard::stringForType):
2545         (WebCore::PlatformPasteboard::readString):
2546
2547         In some cases, -[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:] may now return an
2548         NSAttributedString when an NSString was previously created. This adjusts for that possibility by returning just
2549         the plain text, -[NSAttributedString string], if the read object was an NSAttributedString.
2550
2551         * platform/ios/WebItemProviderPasteboard.mm:
2552         (allLoadableClasses):
2553         (classForTypeIdentifier):
2554         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
2555
2556         See description above for more details.
2557
2558         (isRichTextType): Deleted.
2559         (isStringType): Deleted.
2560         (isURLType): Deleted.
2561         (isColorType): Deleted.
2562         (isImageType): Deleted.
2563
2564         Removes these heuristics that attempt to "guess" the best UIItemProviderReading class to try and load for a
2565         given UTI type.
2566
2567         * rendering/RenderText.cpp:
2568         (WebCore::RenderText::draggedContentRangesBetweenOffsets):
2569
2570         Adds a nil check to fix a debug assertion hit when running DataInteractionTests.
2571
2572 2017-06-05  Dan Bernstein  <mitz@apple.com>
2573
2574         Build fix for macOS 10.12
2575
2576         * platform/spi/cocoa/AVKitSPI.h:
2577
2578 2017-06-05  Dan Bernstein  <mitz@apple.com>
2579
2580         Tried to fix the build when targrting macOS 10.12 using the macOS 10.13 developer beta SDK.
2581
2582         * platform/mac/WebPlaybackControlsManager.h:
2583         * platform/mac/WebPlaybackControlsManager.mm:
2584         (-[WebPlaybackControlsManager togglePictureInPicture]):
2585
2586 2017-06-05  Dan Bernstein  <mitz@apple.com>
2587
2588         Tried to fix the build when targrting macOS 10.12 using the macOS 10.13 developer beta SDK.
2589
2590         * platform/spi/cocoa/AVKitSPI.h:
2591
2592 2017-06-05  Konstantin Tokarev  <annulen@yandex.ru>
2593
2594         Unreviewed, fix missing semicolon in r217795
2595
2596         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2597         (WebCore::calculateNaturalSize):
2598
2599 2017-06-05  Jer Noble  <jer.noble@apple.com>
2600
2601         Allow clients to specify a list of codecs which should require hardware decode support.
2602         https://bugs.webkit.org/show_bug.cgi?id=172787
2603
2604         Reviewed by Alex Christensen.
2605
2606         Add a new setting, checked by HTMLMediaElement, which allows MediaPlayerPrivate implementation
2607         to require that the specified codecs have hardware support. This requirement will be supported
2608         in the normal media loading path and the MSE path on Cocoa ports.
2609
2610         * WebCore.xcodeproj/project.pbxproj:
2611         * html/HTMLMediaElement.cpp:
2612         (WebCore::HTMLMediaElement::mediaCodecsRequiringHardwareSupport):
2613         * html/HTMLMediaElement.h:
2614         * page/Settings.cpp:
2615         (WebCore::Settings::setMediaCodecsRequiringHardwareSupport):
2616         * page/Settings.h:
2617         (WebCore::Settings::mediaCodecsRequiringHardwareSupport):
2618         * platform/cocoa/VideoToolboxSoftLink.cpp:
2619         * platform/cocoa/VideoToolboxSoftLink.h:
2620         * platform/graphics/MediaPlayer.h:
2621         (WebCore::MediaPlayerClient::mediaCodecsRequiringHardwareSupport):
2622         * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.h: Added.
2623         * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm: Added.
2624         (WebCore::assetTrackMeetsHardwareDecodeRequirements):
2625         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2626         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2627         (WebCore::MediaPlayerPrivateAVFoundationObjC::checkPlayability):
2628         (WebCore::MediaPlayerPrivateAVFoundationObjC::assetStatus):
2629         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2630         (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset):
2631
2632 2017-06-05  Dan Bernstein  <mitz@apple.com>
2633
2634         Tried to fix the build when targrting macOS 10.12 using the macOS 10.13 developer beta SDK.
2635
2636         * platform/mac/WebPlaybackControlsManager.mm:
2637         (-[WebPlaybackControlsManager togglePictureInPicture]):
2638
2639 2017-06-05  Dan Bernstein  <mitz@apple.com>
2640
2641         Tried to fix the build when targrting macOS 10.12 using the macOS 10.13 developer beta SDK.
2642
2643         * platform/spi/mac/AVFoundationSPI.h:
2644
2645 2017-06-05  Dan Bernstein  <mitz@apple.com>
2646
2647         Tried to fix the build when targrting macOS 10.12 using the macOS 10.13 developer beta SDK.
2648
2649         * platform/spi/cocoa/IOSurfaceSPI.h:
2650
2651 2017-06-05  Konstantin Tokarev  <annulen@yandex.ru>
2652
2653         Fix MediaPlayerPrivateMediaFoundation::naturalSize
2654         https://bugs.webkit.org/show_bug.cgi?id=172908
2655
2656         Reviewed by Alex Christensen.
2657
2658         MediaPlayerPrivateMediaFoundation::naturalSize should return size of
2659         video frame corrected by PAR, not size of video element.
2660
2661         No new tests needed.
2662
2663         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2664         (WebCore::MediaPlayerPrivateMediaFoundation::load):
2665         (WebCore::MediaPlayerPrivateMediaFoundation::naturalSize):
2666         (WebCore::MediaPlayerPrivateMediaFoundation::setNaturalSize):
2667         (WebCore::calculateNaturalSize):
2668         (WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::setMediaType):
2669         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
2670
2671 2017-06-05  Zalan Bujtas  <zalan@apple.com>
2672
2673         Destroy the associated renderer subtree when display: contents node is deleted.
2674         https://bugs.webkit.org/show_bug.cgi?id=172920
2675         <rdar://problem/32446045>
2676
2677         Reviewed by Antti Koivisto.
2678
2679         Since display: contents node does not create a renderer, we need to explicitly check
2680         and distinguish it from the display: none case.
2681
2682         Covered by existing tests.
2683
2684         * dom/ContainerNode.cpp:
2685         (WebCore::destroyRenderTreeIfNeeded):
2686         * dom/Node.cpp:
2687         (WebCore::Node::~Node): Promote ASSERT(!renderer()) to ASSERT_WITH_SECURITY_IMPLICATION.
2688         * dom/Text.cpp:
2689         (WebCore::Text::~Text): Redundant assert. Text is a Node.
2690
2691 2017-06-05  Beth Dakin  <bdakin@apple.com>
2692
2693         Modify Netflix controlsManager quirk to prevent only scrubbing
2694         https://bugs.webkit.org/show_bug.cgi?id=172881
2695         -and corresponding-
2696         rdar://problem/32228660
2697
2698         Reviewed by Andy Estes.
2699
2700         Instead of preventing Netflix from getting a controlsManager at all, this patch 
2701         ONLY prevents touch bar scrubbing from working. This means that Netflix will now 
2702         get controls in the TouchBar, it means that the play/pause and PiP buttons will be 
2703         functional, and it means that the timeline will accurately represent the current 
2704         time, BUT users will not be able to use the timeline to scrub the video. This also 
2705         allows Netflix to work with other MediaRemote clients such as AirPods.
2706
2707         Remove the quirk code from here, since this is no longer the right place to test 
2708         if the MediaElement is hosted at Netflix.
2709         * html/HTMLMediaElement.cpp:
2710         (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager):
2711         (WebCore::needsPlaybackControlsManagerQuirk): Deleted.
2712
2713         Pass around a new bool allowsTouchBarScrubbing.
2714         * platform/cocoa/WebPlaybackSessionModel.h:
2715         (WebCore::WebPlaybackSessionModelClient::allowsTouchBarScrubbingChanged):
2716         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
2717
2718         Here’s where we check if we need quirky behavior.
2719         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
2720         (WebCore::WebPlaybackSessionModelMediaElement::updateForEventName):
2721         (WebCore::WebPlaybackSessionModelMediaElement::allowsTouchBarScrubbing):
2722
2723         Return the bool we have plumbed through tracking whether the current site 
2724         allowsTouchBarScrubbing from the existing delegate method 
2725         canBeginTouchBarScrubbing. We will always return NO for video elements on Netflix, 
2726         and this will prevent users from be able to scrub with the TouchBar on Netflix.
2727         * platform/mac/WebPlaybackControlsManager.h:
2728         * platform/mac/WebPlaybackControlsManager.mm:
2729         (-[WebPlaybackControlsManager canBeginTouchBarScrubbing]):
2730
2731         More plumbing.
2732         * platform/mac/WebPlaybackSessionInterfaceMac.h:
2733         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2734         (WebCore::WebPlaybackSessionInterfaceMac::allowsTouchBarScrubbingChanged):
2735         (WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager):
2736
2737 2017-06-05  Carlos Garcia Campos  <cgarcia@igalia.com>
2738
2739         [GStreamer] Deadlock in MediaPlayerPrivateGStreamer::changePipelineState, web process often locks up on seeking in a youtube video that has already fully buffered
2740         https://bugs.webkit.org/show_bug.cgi?id=170003
2741
2742         Reviewed by Michael Catanzaro.
2743
2744         When video sink is requested to render a frame, the GstBaseSink preroll mutex is taken. Then WebKit media player
2745         schedules a repaint in the main thread, taking the draw mutex and waiting on draw condition. It can happen that
2746         before the repaint is done in the main thread, a pause is requested in the main thread, causing a change state
2747         from PLAYING to PAUSE. When the change state reaches the video sink gst_base_sink_change_state() tries to get
2748         the preroll mutex. This causes a deadlock because the main thread is waiting to get the preroll mutex, but the
2749         other thread is waiting for the main thread to do the repaint. GStreamer handles this case by calling unlock()
2750         on the video sink before trying to get the preroll mutex, but the media player doesn't cancel the pending
2751         repaint when using coordinated graphics. This patch adds a new signal to WebKitVideoSink "repaint-cancelled" to
2752         notify the media player to cancel the pending prepaint.
2753
2754         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2755         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint): Release the draw mutex and notify the condition.
2756         (WebCore::MediaPlayerPrivateGStreamerBase::repaintCancelledCallback): Call cancelRepaint().
2757         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink): Connect to WebKitVideoSink::repaint-cancelled.
2758         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2759         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
2760         (webkitVideoSinkRepaintCancelled): Emit WebKitVideoSink::repaint-cancelled.
2761         (webkitVideoSinkUnlock): Call webkitVideoSinkRepaintCancelled().
2762         (webkitVideoSinkStop): Ditto.
2763         (webkit_video_sink_class_init): Add WebKitVideoSink::repaint-cancelled signal.
2764
2765 2017-06-05  Carlos Garcia Campos  <cgarcia@igalia.com>
2766
2767         [GStreamer] Cleanup ifdefs in MediaPlayerPrivateGStreamerBase
2768         https://bugs.webkit.org/show_bug.cgi?id=172918
2769
2770         Reviewed by Michael Catanzaro.
2771
2772         The code in MediaPlayerPrivateGStreamerBase is quite difficult to follow with all the ifdefs for the
2773         possibilities when rendering. Some of them are even dead code now that all ports using GStreamer are using also
2774         coordinated graphics.
2775
2776         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2777         (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
2778         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
2779         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
2780         (WebCore::MediaPlayerPrivateGStreamerBase::repaint):
2781         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
2782         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2783         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
2784         (VideoRenderRequestScheduler::VideoRenderRequestScheduler):
2785         (VideoRenderRequestScheduler::stop):
2786         (VideoRenderRequestScheduler::requestRender):
2787         (webkitVideoSinkRequestRender):
2788
2789 2017-06-05  Carlos Garcia Campos  <cgarcia@igalia.com>
2790
2791         Unreviewed. Fix compile warning when building GTK+ port without OpenGL.
2792
2793         * platform/graphics/texmap/BitmapTexturePool.cpp:
2794         (WebCore::BitmapTexturePool::createTexture):
2795
2796 2017-06-05  Miguel Gomez  <magomez@igalia.com>
2797
2798         [GTK][WPE] Do not force video sample's buffer release when the platformLayerProxy is inactive
2799         https://bugs.webkit.org/show_bug.cgi?id=172916
2800
2801         Reviewed by Carlos Garcia Campos.
2802
2803         When MediaPlayerPrivateGStreamerBase's plarformLayerProxy was inactive, a copy of the video sample
2804         was being done (without the buffer) and set, causing the sample's buffer to get freed. This was done
2805         to avoid stalling the gstreamer pipeline in situations where the video was set to display:none, as the
2806         platformLayerProxy would keep all the available buffers. But this can't happen nowadays as setting
2807         the video to display:none invalidates the proxy, causing it to release the references to the
2808         gstreamer buffers it's using. Also, the current code is causing a crash when using gstreamer-gl and
2809         the video is hidden but its contents are being painted through webgl or an accelerated canvas. So,
2810         remove this sample copy as it's not necessary anymore.
2811
2812         Covered by existent tests.
2813
2814         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2815         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
2816
2817 2017-06-05  Miguel Gomez  <magomez@igalia.com>
2818
2819         [GTK][WPE] Fix the condition to decide whether the MediaPlayer can be rendered accelerated
2820         https://bugs.webkit.org/show_bug.cgi?id=172852
2821
2822         Reviewed by Michael Catanzaro.
2823
2824         Before this change, in order to determine whether the MediaPlayer rendering could be accelerated we
2825         needed the player to have a renderer or it would return false. The renderer was needed in order to
2826         access the RenderLayerCompositor and check whether the chrome would be overwriting the accelerated
2827         compositing setting. But we don't have that option in WebKitGTK+ or WPE, so we can just check the
2828         accelerated compositing setting directly.
2829
2830         Another problems with the approach before this change is that accelerated rendering was being disabled
2831         when the video element was not visible, as there's no video renderer. Due to this, cases where the video
2832         is painted through an accelerated canvas or webgl would not be using hardware accelerated copies.
2833
2834         Covered by existent tests.
2835
2836         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2837         (WebCore::MediaPlayerPrivateGStreamerBase::acceleratedRenderingStateChanged):
2838
2839 2017-06-04  Simon Fraser  <simon.fraser@apple.com>
2840
2841         Percentages are calculated wrong in SVG transform CSS property
2842         https://bugs.webkit.org/show_bug.cgi?id=172901
2843
2844         Reviewed by Zalan Bujtas.
2845         
2846         The code added in r217236 was just fetching viewBox(), but that can be empty.
2847         SVGLengthContext::determineViewport() does the correct thing to get
2848         the appropriate viewport.
2849
2850         Test: svg/transforms/percent-transform-values-viewbox.html
2851
2852         * svg/SVGGraphicsElement.cpp:
2853         (WebCore::SVGGraphicsElement::animatedLocalTransform):
2854
2855 2017-06-04  Eric Carlson  <eric.carlson@apple.com>
2856
2857         [MediaStream] Page capture state not reported correctly
2858         https://bugs.webkit.org/show_bug.cgi?id=172897
2859         <rdar://problem/32493318>
2860
2861         Reviewed by Youenn Fablet.
2862
2863         Test: fast/mediastream/media-stream-track-muted.html
2864
2865         * Modules/mediastream/MediaStream.cpp:
2866         (WebCore::MediaStream::mediaState): Test for audio and video mute on the tracks.
2867         (WebCore::MediaStream::characteristicsChanged): Call statusDidChange when m_mediaState
2868         changes instead of m_muted, so the page is informed when just audio or video mute state
2869         changes.
2870         * Modules/mediastream/MediaStream.h:
2871
2872         * testing/Internals.cpp:
2873         (WebCore::Internals::setMediaStreamTrackMuted): New.
2874         * testing/Internals.h:
2875         * testing/Internals.idl:
2876
2877 2017-06-03  Darin Adler  <darin@apple.com>
2878
2879         Streamline handling of attributes, using references as much as possible
2880         https://bugs.webkit.org/show_bug.cgi?id=172899
2881
2882         Reviewed by Chris Dumez.
2883
2884         * accessibility/AccessibilityNodeObject.cpp:
2885         (WebCore::AccessibilityNodeObject::valueForRange): Use reference to value of
2886         attribute instead of copy to avoid reference count churn.
2887         (WebCore::AccessibilityNodeObject::maxValueForRange): Ditto.
2888         (WebCore::AccessibilityNodeObject::minValueForRange): Ditto.
2889         * accessibility/AccessibilitySVGElement.cpp:
2890         (WebCore::AccessibilitySVGElement::childElementWithMatchingLanguage): Ditto.
2891         (WebCore::AccessibilitySVGElement::accessibilityDescription): Ditto.
2892         * css/PropertySetCSSStyleDeclaration.cpp:
2893         (WebCore::StyleAttributeMutationScope::StyleAttributeMutationScope): Ditto.
2894
2895         * editing/cocoa/DataDetection.mm:
2896         (WebCore::DataDetection::shouldCancelDefaultAction): Use the
2897         equalLettersIgnoringASCIICase function instead of using
2898         both equalIgnoringASCIICase and convertToASCIILowercase.
2899
2900         * html/HTMLAudioElement.cpp:
2901         (WebCore::HTMLAudioElement::HTMLAudioElement): Marked this inline since we
2902         want it inlined the one place it's used.
2903         (WebCore::HTMLAudioElement::create): Use auto and named the local variable
2904         just element.
2905         (WebCore::HTMLAudioElement::createForJSConstructor): Call create rather than
2906         repeating the code from create. Use setAttributeWithoutSynchronization directly
2907         rather than calling helper functions. Removed unneeded null check;
2908         setAttributeWithoutSynchronization handles null by removing the attribute.
2909         * html/HTMLAudioElement.h: Changed src argument of createForJSConstructor to
2910         take AtomicString since that is what we need for an attribute value.
2911         * html/HTMLAudioElement.idl: Use [AtomicString] for src argument.
2912
2913         * html/HTMLElement.cpp:
2914         (WebCore::HTMLElement::directionality): Use reference to value of
2915         attribute instead of copy to avoid reference count churn.
2916         (WebCore::HTMLElement::shouldAutocorrect): Ditto.
2917
2918         * html/HTMLImageElement.cpp:
2919         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement): Call the new
2920         parsedMediaAttribute instead of the old mediaQuerySet function. Other than the
2921         name, the only change is that the result is now a const pointer.
2922
2923         * html/HTMLInputElement.cpp:
2924         (WebCore::HTMLInputElement::updateType): Removed unnecessary local variable,
2925         resulting in code that is slightly cleaner and possibly eliminating reference
2926         count chrun.
2927
2928         * html/HTMLMediaElement.cpp:
2929         (WebCore::HTMLMediaElement::setSrc): Deleted.
2930         (WebCore::HTMLMediaElement::selectNextSourceChild): Use parsedMediaAttribute and
2931         removed rendudant direct check of whether mediaAttr is present. Changed logging to
2932         get the media attribute directly rather than with a helper function. Changed type
2933         to get the type attribute directly rather than with a helper function.
2934         (WebCore::HTMLMediaElement::sourceWasAdded): Take a reference rather than a pointer.
2935         (WebCore::HTMLMediaElement::sourceWasRemoved): Ditto.
2936         (WebCore::HTMLMediaElement::doesHaveAttribute): Use reference to value of
2937         attribute instead of copy to avoid reference count churn.
2938         * html/HTMLMediaElement.h: Updated for the above.
2939
2940         * html/HTMLSourceElement.cpp:
2941         (WebCore::HTMLSourceElement::insertedInto): Pass reference instead of pointer.
2942         (WebCore::HTMLSourceElement::removedFrom): Ditto.
2943         (WebCore::HTMLSourceElement::setSrc): Deleted.
2944         (WebCore::HTMLSourceElement::media): Deleted.
2945         (WebCore::HTMLSourceElement::setMedia): Deleted.
2946         (WebCore::HTMLSourceElement::type): Deleted.
2947         (WebCore::HTMLSourceElement::setType): Deleted.
2948         (WebCore::HTMLSourceElement::parseAttribute): Clear out m_cachedParsedMediaAttribute.
2949         This makes the parsing be lazy. The old code would parse the attribute value to make
2950         a MediaQuerySet here, but we do it in parsedMediaAttribute now.
2951         (WebCore::HTMLSourceElement::parsedMediaAttribute): Added. Creates a MediaQuerySet
2952         if needed, and returns it or null.
2953         * html/HTMLSourceElement.h: Removed include of MediaList.h. Removed unneeded media,
2954         type, setSrc, setMedia, and setType functions. Replaced the mediaQuerySet function
2955         with the parsedMediaAttribute, which returns a const pointer rather than non-const,
2956         and is also non-inline because it lazily creates the MediaQuerySet as needed. Replaced
2957         m_mediaQuerySet with m_cachedParsedMediaAttribute.
2958         * html/HTMLSourceElement.idl: Use [Reflect] for both type and media.
2959
2960         * html/MediaDocument.cpp: Modernize the MediaDocumentParser constructor.
2961         (WebCore::MediaDocumentParser::createDocumentStructure): Instead of setSrc, use
2962         setAttributeWithoutSynchronization for the src attribute just as we do for all the
2963         other attributes of the newly created video element.
2964
2965         * html/MediaElementSession.cpp:
2966         (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled): Use reference to
2967         value of attribute instead of copy to avoid reference count churn.
2968         * loader/FrameLoader.cpp:
2969         (WebCore::FrameLoader::defaultSubstituteDataForURL): Ditto.
2970         * rendering/RenderThemeIOS.mm:
2971         (WebCore::getAttachmentProgress): Ditto.
2972         * rendering/RenderThemeMac.mm:
2973         (WebCore::AttachmentLayout::layOutSubtitle): Ditto.
2974         (WebCore::RenderThemeMac::paintAttachment): Ditto.
2975         * svg/SVGHKernElement.cpp:
2976         (WebCore::SVGHKernElement::buildHorizontalKerningPair): Ditto.
2977         * svg/SVGVKernElement.cpp:
2978         (WebCore::SVGVKernElement::buildVerticalKerningPair): Ditto.
2979         * svg/animation/SVGSMILElement.cpp:
2980         (WebCore::SVGSMILElement::buildPendingResource): Ditto. Also use parentElement
2981         instead of writing out code that does exactly what it does.
2982
2983 2017-06-03  Sam Weinig  <sam@webkit.org>
2984
2985         Can't use Object.defineProperty() to add an item to a DOMStringMap or Storage
2986         https://bugs.webkit.org/show_bug.cgi?id=172687
2987
2988         Reviewed by Darin Adler.
2989
2990         - Adds support for generating the defineOwnProperty ClassInfo method table hook
2991           to add support for Object.defineProperty(). The implementation follows WebIDL
2992           section 3.9.3 [[DefineOwnProperty]].
2993           (https://heycam.github.io/webidl/#legacy-platform-object-defineownproperty)
2994         - Adds support for generating named setters in addition to the already supported
2995           indexed setters as much of the required work was needed to make defineOwnProperty
2996           work for those properties. This patch does not aim to follow WebIDL faithfully,
2997           but rather to generate as close to the custom code as possible. A follow up 
2998           change will attempt to match WebIDL more closely (which will also require changes
2999           to [[GetOwnPropertySlot]]).
3000         - Removes the need for custom bindings in DOMStringMap, HTMLOptionsCollection and
3001           HTMLSelectElement. Gets us one function away from supporting Storage.
3002         - Tidies up generated headers a bit by grouping all the ClassInfo method table hooks
3003           together.
3004         - Removes support for CustomIndexedSetter, which is no longer used.
3005
3006         Test: js/dom/legacy-platform-object-defineOwnProperty.html
3007
3008         * CMakeLists.txt:
3009         * WebCore.xcodeproj/project.pbxproj:
3010         * bindings/js/JSBindingsAllInOne.cpp:
3011         Removed now unneeded custom bindings.
3012
3013         * bindings/js/JSDOMStringMapCustom.cpp: Removed.
3014         * bindings/js/JSHTMLOptionsCollectionCustom.cpp: Removed.
3015         * bindings/js/JSHTMLSelectElementCustom.cpp: Removed.
3016         * bindings/js/JSHTMLSelectElementCustom.h: Removed.
3017         * bindings/js/JSStorageCustom.cpp:
3018         (WebCore::JSStorage::putDelegate): Deleted.
3019         Remove more code that is now generated.
3020
3021         * bindings/scripts/CodeGeneratorJS.pm:
3022         (GenerateIndexedGetter):
3023         - Add missing check for indexed setter operation when determining if the property should be ReadOnly.
3024         - Add support for custom implementation name, matching GenerateNamedGetter.
3025         - Convert to taking an outputArray and indent to allow more flexibility going forward.
3026
3027         (GenerateNamedGetter):
3028         - Add missing check for named setter operation when determining if the property should be ReadOnly.
3029         - Convert to taking an outputArray and indent to allow more flexibility going forward.
3030
3031         (GenerateGetOwnPropertySlotBody):
3032         - Convert to taking an outputArray and indent to allow more flexibility going forward.
3033         - Take over responsibility for checking and bailing if CustomGetOwnPropertySlot is set.
3034
3035         (GenerateGetOwnPropertySlotBodyByIndex):
3036         - Convert to taking an outputArray and indent to allow more flexibility going forward.
3037         - Take over responsibility for checking and bailing if CustomGetOwnPropertySlotByIndex is set.
3038
3039         (GenerateGetOwnPropertyNames):
3040         - Convert to taking an outputArray and indent to allow more flexibility going forward.
3041         - Take over responsibility for checking and bailing if CustomEnumerateProperty is set.
3042
3043         (GenerateInvokeIndexedPropertySetter):
3044         Added. Implements the 'invoke an indexed property setter' algorithm (https://heycam.github.io/webidl/#invoke-indexed-setter)
3045
3046         (GenerateInvokeNamedPropertySetter):
3047         Added. Implements the 'invoke a named property setter' algorithm (https://heycam.github.io/webidl/#invoke-named-setter)
3048
3049         (GeneratePut):
3050         (GeneratePutByIndex):
3051         - Convert to taking an outputArray and indent to allow more flexibility going forward.
3052         - Take over responsibility for checking and bailing if CustomPut is set.
3053         - Adds support for CEReactions.
3054         - Adopts GenerateInvokeIndexedPropertySetter and GenerateInvokeNamedPropertySetter to
3055           simplify code.
3056         - Removes support for CustomIndexedSetter, which is no longer used.
3057         - Replaces use direct checking of OverrideBuiltins with check if any interface it inherits
3058           has it, which is how it is specified to work.
3059
3060         (GenerateIsUnforgeablePropertyName):
3061         Added. Helper subroutine to generate a function that compares a property name
3062         agains all the property names defined as Unforgeable on the interface. Used by
3063         GenerateDefineOwnProperty.
3064
3065         (GenerateDefineOwnProperty):
3066         Added. Implements section 3.9.3 [[DefineOwnProperty]] (https://heycam.github.io/webidl/#legacy-platform-object-defineownproperty)
3067         Adds support for CEReactions.
3068
3069         (GenerateDeletePropertyCommon):
3070         Switch from getting OverrideBuiltins directly off the interface to using InheritsExtendedAttribute.
3071
3072         (GenerateNamedDeleterDefinition):
3073         Switch signature to match peer generators.
3074
3075         (InstanceOverridesGetOwnPropertySlot):
3076         Update for rename of JSCustomGetOwnPropertySlotAndDescriptor to CustomGetOwnPropertySlotAndDescriptor.
3077
3078         (InstanceOverridesGetOwnPropertySlotByIndex):
3079         Added. Like InstanceOverridesGetOwnPropertySlot, but checks for the new CustomGetOwnPropertySlotByIndex 
3080         rather than CustomGetOwnPropertySlot.
3081
3082         (InstanceOverridesGetOwnPropertyNames):
3083         Added. Moves complex predicate out of line.
3084
3085         (InstanceOverridesPut):
3086         Removes now unused CustomIndexedSetter, and adds CustomPutFunction, which used to be checked separately.
3087
3088         (InstanceOverridesDefineOwnProperty):
3089         Added.
3090
3091         (GenerateHeader):
3092         - Moves more structure flags together.
3093         - Simplifies predicates and moves the ClassInfo method table hooks together.
3094
3095         (GenerateImplementation):
3096         - Moves the ClassInfo method table hooks together
3097         - Adds call to GenerateDefineOwnProperty.
3098
3099         (GenerateLegacyCallerDefinitions):
3100         Simplify bail condition to match other generators.
3101
3102         (GeneratePrototypeDeclaration):
3103         Update for new extended attribute names.
3104
3105         (InstanceOverridesCall): 
3106         Renamed from IsCallable for consistency.
3107         
3108         (HasComplexGetOwnProperty): 
3109         Deleted. Unused.
3110         
3111         (InstanceOverridesPutImplementation): 
3112         Deleted. Unused.
3113         
3114         (InstanceOverridesPutDeclaration): 
3115         Deleted. Unused.
3116         
3117         (IsCallable): 
3118         Renamed, for consistency, to InstanceOverridesCall .
3119
3120         * bindings/scripts/IDLAttributes.json:
3121         Renames a few of the extended attributes to remove the JS prefix. This time
3122         around I only did the ones in the area I was working, but we should probably
3123         remove most of the rest.
3124     
3125         * css/CSSStyleDeclaration.idl:
3126         Update for JSCustomGetOwnPropertySlotAndDescriptor -> CustomGetOwnPropertySlotAndDescriptor rename.
3127
3128         * dom/DOMStringMap.idl:
3129         Remove CustomNamedSetter and add uncomment out the setter.
3130
3131         * dom/DatasetDOMStringMap.cpp:
3132         (WebCore::DatasetDOMStringMap::setNamedItem):
3133         (WebCore::DatasetDOMStringMap::setItem): Deleted.
3134         * dom/DatasetDOMStringMap.h:
3135         Rename setItem to setNamedItem, which is what the generator expects.
3136
3137         * dom/Node.idl:
3138         Update for JSCustomPushEventHandlerScope -> CustomPushEventHandlerScope rename.
3139
3140         * html/HTMLAppletElement.idl:
3141         * html/HTMLEmbedElement.idl:
3142         * html/HTMLObjectElement.idl:
3143         Update for JSCustomGetOwnPropertySlotAndDescriptor -> CustomGetOwnPropertySlotAndDescriptor rename.
3144
3145         * html/HTMLCollection.cpp:
3146         (WebCore::HTMLCollection::isSupportedPropertyName):
3147         * html/HTMLCollection.h:
3148         Add isSupportedPropertyName function which is used by the bindings and is now needed.
3149
3150         * html/HTMLElement.idl:
3151         Update for JSCustomPushEventHandlerScope -> CustomPushEventHandlerScope rename.
3152
3153         * html/HTMLOptionsCollection.h:
3154         (WebCore::HTMLOptionsCollection::setItem):
3155         Add setItem() implementation which just forwards to the select element. Also, add 
3156         a type alias to make the implementations of item and namedItem less verbose.
3157
3158         * html/HTMLOptionsCollection.idl:
3159         Remove CustomIndexedSetter and uncomment the setter.
3160
3161         * html/HTMLSelectElement.idl:
3162         Remove CustomIndexedSetter and uncomment the setter. Also, reformat
3163         to match the WHATWG spec.
3164
3165         * page/DOMWindow.idl:
3166         Update for JSCustomDefineOwnProperty -> CustomDefineOwnProperty rename. Add 
3167         CustomGetOwnPropertySlotByIndex which is now needed to remove some unsound
3168         assumptions the generator was making.
3169
3170         * page/Location.idl:
3171         Update for removal of JS prefix from a bunch of extended attributes.
3172
3173         * page/UserMessageHandlersNamespace.idl:
3174         Update for JSCustomGetOwnPropertySlotAndDescriptor -> CustomGetOwnPropertySlotAndDescriptor rename.
3175
3176         * storage/Storage.idl:
3177         Remove CustomNamedSetter and uncomment the setter.
3178
3179         * bindings/scripts/test/JS/JSInterfaceName.h:
3180         * bindings/scripts/test/JS/JSTestEventTarget.h:
3181         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: Added.
3182         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.h: Added.
3183         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: Added.
3184         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.h: Added.
3185         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: Added.
3186         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.h: Added.
3187         * bindings/scripts/test/JS/JSTestInterface.cpp:
3188         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: Added.
3189         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.h: Added.
3190         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: Added.
3191         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.h: Added.
3192         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: Added.
3193         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.h: Added.
3194         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h:
3195         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h:
3196         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
3197         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h:
3198         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h:
3199         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: Added.
3200         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.h: Added.
3201         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: Added.
3202         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.h: Added.
3203         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: Added.
3204         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.h: Added.
3205         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: Added.
3206         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.h: Added.
3207         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: Added.
3208         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.h: Added.
3209         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: Added.
3210         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.h: Added.
3211         * bindings/scripts/test/JS/JSTestObj.cpp:
3212         * bindings/scripts/test/JS/JSTestObj.h:
3213         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
3214         * bindings/scripts/test/TestIndexedSetterNoIdentifier.idl: Added.
3215         * bindings/scripts/test/TestIndexedSetterThrowingException.idl: Added.
3216         * bindings/scripts/test/TestIndexedSetterWithIdentifier.idl: Added.
3217         * bindings/scripts/test/TestNamedAndIndexedSetterNoIdentifier.idl: Added.
3218         * bindings/scripts/test/TestNamedAndIndexedSetterThrowingException.idl: Added.
3219         * bindings/scripts/test/TestNamedAndIndexedSetterWithIdentifier.idl: Added.
3220         * bindings/scripts/test/TestNamedDeleterWithIdentifier.idl:
3221         * bindings/scripts/test/TestNamedSetterNoIdentifier.idl: Added.
3222         * bindings/scripts/test/TestNamedSetterThrowingException.idl: Added.
3223         * bindings/scripts/test/TestNamedSetterWithIdentifier.idl: Added.
3224         * bindings/scripts/test/TestNamedSetterWithOverrideBuiltins.idl: Added.
3225         * bindings/scripts/test/TestNamedSetterWithUnforgableProperties.idl: Added.
3226         * bindings/scripts/test/TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.idl: Added.
3227         Added new tests and updated some results.
3228
3229 2017-06-04  Simon Fraser  <simon.fraser@apple.com>
3230
3231         Object bounding box wrong for some paths
3232         https://bugs.webkit.org/show_bug.cgi?id=172866
3233
3234         Reviewed by Tim Horton.
3235         
3236         RenderSVGShape::calculateObjectBoundingBox() should use boundingRect()
3237         rather than fastBoundingRect(), because the latter includes control points.
3238
3239         Covered by existing tests.
3240
3241         * rendering/svg/RenderSVGShape.cpp:
3242         (WebCore::RenderSVGShape::calculateObjectBoundingBox):
3243
3244 2017-06-04  Konstantin Tokarev  <annulen@yandex.ru>
3245
3246         Fix build of Windows-specific code with ICU 59.1
3247         https://bugs.webkit.org/show_bug.cgi?id=172729
3248
3249         Reviewed by Darin Adler.
3250
3251         Fix conversions from WTF::String to wchar_t* and vice versa.
3252         No new tests needed.
3253
3254         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
3255         (WebCore::mimeTypeCache):
3256         (WebCore::MediaPlayerPrivateMediaFoundation::startCreateMediaSource):
3257
3258 2017-06-04  Chris Dumez  <cdumez@apple.com>
3259
3260         Implement DOMMatrixReadOnly.transformPoint()
3261         https://bugs.webkit.org/show_bug.cgi?id=172900
3262
3263         Reviewed by Simon Fraser.
3264
3265         Implement DOMMatrixReadOnly.transformPoint():
3266         - https://drafts.fxtf.org/geometry/#dommatrixreadonly
3267         - https://drafts.fxtf.org/geometry/#dom-dommatrixreadonly-transformpoint
3268
3269         Test: imported/blink/fast/dom/geometry-interfaces-dom-matrix-transformPoint.html
3270
3271         * css/DOMMatrixReadOnly.cpp:
3272         (WebCore::DOMMatrixReadOnly::transformPoint):
3273         * css/DOMMatrixReadOnly.h:
3274         * css/DOMMatrixReadOnly.idl:
3275
3276 2017-06-04  Zan Dobersek  <zdobersek@igalia.com>
3277
3278         [GCrypt] Improve comments in AES, PBKDF2, RSA-SSA algorithm implementations
3279         https://bugs.webkit.org/show_bug.cgi?id=172894
3280
3281         Reviewed by Michael Catanzaro.
3282
3283         Add or improve code comments in libgcrypt implementations for the AES_CBC,
3284         AES_GCM, AES_KW, PBKDF2 and RSA-SSA algorithms.
3285
3286         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp: Add generic comments that
3287         describe each operation that's performed.
3288         (WebCore::gcryptEncrypt):
3289         (WebCore::gcryptDecrypt):
3290         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp: Ditto.
3291         (WebCore::gcryptEncrypt):
3292         (WebCore::gcryptDecrypt):
3293         * crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp: Ditto.
3294         (WebCore::gcryptWrapKey):
3295         (WebCore::gcryptUnwrapKey):
3296         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp: Ditto.
3297         (WebCore::gcryptDeriveBits):
3298         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
3299         (WebCore::gcryptVerify): Align the verification results comment with the
3300         one that's used in the ECDSA implementation.
3301
3302 2017-06-03  Chris Dumez  <cdumez@apple.com>
3303
3304         Implement DOMMatrix's fromFloat32Array / fromFloat64Array & toFloat32Array / toFloat64Array
3305         https://bugs.webkit.org/show_bug.cgi?id=172898
3306
3307         Reviewed by Sam Weinig.
3308
3309         Implement DOMMatrix's fromFloat32Array / fromFloat64Array & toFloat32Array / toFloat64Array
3310         as per:
3311         - https://drafts.fxtf.org/geometry/#dommatrixreadonly
3312
3313         Test: http/wpt/geometry/DOMMatrix-from-to-typed-arrays.html
3314
3315         * css/DOMMatrix.cpp:
3316         (WebCore::DOMMatrix::fromFloat32Array):
3317         (WebCore::DOMMatrix::fromFloat64Array):
3318         * css/DOMMatrix.h:
3319         * css/DOMMatrix.idl:
3320         * css/DOMMatrixReadOnly.cpp:
3321         (WebCore::DOMMatrixReadOnly::fromFloat32Array):
3322         (WebCore::DOMMatrixReadOnly::fromFloat64Array):
3323         (WebCore::DOMMatrixReadOnly::toFloat32Array):
3324         (WebCore::DOMMatrixReadOnly::toFloat64Array):
3325         * css/DOMMatrixReadOnly.h:
3326         * css/DOMMatrixReadOnly.idl:
3327
3328 2017-06-03  Simon Fraser  <simon.fraser@apple.com>
3329
3330         Implement DOMPointReadOnly.matrixTransform()
3331         https://bugs.webkit.org/show_bug.cgi?id=172896
3332
3333         Reviewed by Chris Dumez.
3334
3335         DOMPointReadOnly.matrixTransform() creates the matrix or throws, then uses
3336         a new function in TransformationMatrix to map x,y,z,w through the matrix.
3337
3338         Test: http/wpt/geometry/DOMPoint-003.html
3339
3340         * CMakeLists.txt:
3341         * WebCore.xcodeproj/project.pbxproj:
3342         * css/DOMMatrixReadOnly.h:
3343         (WebCore::DOMMatrixReadOnly::transformationMatrix):
3344         * dom/DOMPointReadOnly.cpp: Copied from Source/WebCore/dom/DOMPointReadOnly.idl.
3345         (WebCore::DOMPointReadOnly::matrixTransform):
3346         * dom/DOMPointReadOnly.h:
3347         * dom/DOMPointReadOnly.idl:
3348         * platform/graphics/transforms/TransformationMatrix.cpp:
3349         (WebCore::TransformationMatrix::map4ComponentPoint):
3350         * platform/graphics/transforms/TransformationMatrix.h:
3351
3352 2017-06-03  Myles C. Maxfield  <mmaxfield@apple.com>
3353
3354         Cleanup arguments to preparePlatformFont() and fontWithFamily() in FontCacheCoreText.cpp
3355         https://bugs.webkit.org/show_bug.cgi?id=172886
3356
3357         Reviewed by Simon Fraser.
3358
3359         The number of arguments is getting out of control.
3360
3361         No new tests because there is no behavior change.
3362
3363         * platform/graphics/FontCache.h:
3364         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3365         (WebCore::preparePlatformFont):
3366         (WebCore::fontWithFamily):
3367         (WebCore::FontCache::createFontPlatformData):
3368         (WebCore::FontCache::systemFallbackForCharacters):
3369         * platform/graphics/mac/FontCacheMac.mm:
3370         (WebCore::platformFontWithFamilySpecialCase):
3371         * platform/graphics/mac/FontCustomPlatformData.cpp:
3372         (WebCore::FontCustomPlatformData::fontPlatformData):
3373         * platform/spi/cocoa/CoreTextSPI.h:
3374
3375 2017-06-03  Yusuke Suzuki  <utatane.tea@gmail.com>
3376
3377         Script modules should be able to import data urls
3378         https://bugs.webkit.org/show_bug.cgi?id=171594
3379
3380         Reviewed by Youenn Fablet.
3381
3382         Tests: js/dom/classic-script-with-data-url.html
3383                js/dom/modules/module-script-with-data-url.html
3384
3385         Script tag resources should have SameOriginDataURLFlag::Set to load data URLs
3386         since script tags should treat data URLs as same origin.
3387
3388         * bindings/js/CachedScriptFetcher.cpp:
3389         (WebCore::CachedScriptFetcher::requestScriptWithCache):
3390
3391 2017-06-03  Simon Fraser  <simon.fraser@apple.com>
3392
3393         Sort the project file.
3394
3395         * WebCore.xcodeproj/project.pbxproj:
3396
3397 2017-06-03  Zan Dobersek  <zdobersek@igalia.com>
3398
3399         [GCrypt] Gather SUBTLE_CRYPTO utility functions in a single header
3400         https://bugs.webkit.org/show_bug.cgi?id=172870
3401
3402         Reviewed by Jiewen Tan.
3403
3404         Gather the helper functions used across different source files
3405         for libgcrypt-backed SUBTLE_CRYPTO implementations in a single
3406         header file.
3407
3408         * crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
3409         (WebCore::hashCryptoDigestAlgorithm): Deleted.
3410         (WebCore::hashAlgorithmName): Deleted.
3411         (WebCore::mpiData): Deleted.
3412         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
3413         (WebCore::gcryptDeriveBits):
3414         (WebCore::macAlgorithmForHashFunction): Deleted.
3415         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
3416         (WebCore::gcryptDeriveBits):
3417         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp:
3418         (WebCore::mpiData): Deleted.
3419         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
3420         (WebCore::hashCryptoDigestAlgorithm): Deleted.
3421         (WebCore::hashAlgorithmName): Deleted.
3422         (WebCore::mpiData): Deleted.
3423         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
3424         (WebCore::hashAlgorithmName): Deleted.
3425         (WebCore::mpiData): Deleted.
3426         * crypto/gcrypt/GCryptUtilities.h: Added.
3427         (WebCore::hashAlgorithmName):
3428         (WebCore::hmacAlgorithm):
3429         (WebCore::digestAlgorithm):
3430         (WebCore::hashCryptoDigestAlgorithm):
3431         (WebCore::mpiData):
3432
3433 2017-06-03  Zan Dobersek  <zdobersek@igalia.com>
3434
3435         [GCrypt] Fix PK verification for ECDSA
3436         https://bugs.webkit.org/show_bug.cgi?id=172857
3437
3438         Reviewed by Michael Catanzaro.
3439
3440         No new tests -- covered by existing tests.
3441
3442         * crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
3443         (WebCore::gcryptVerify): Return `true` if the verification succeeded or `false`
3444         in any other case, avoiding spilling information about the exact cause of
3445         verification failure.
3446
3447 2017-06-02  Zalan Bujtas  <zalan@apple.com>
3448
3449         Cleanup FrameView::autoSizeIfEnabled.
3450         https://bugs.webkit.org/show_bug.cgi?id=172889
3451         <rdar://problem/32550783>
3452
3453         Reviewed by Tim Horton.
3454
3455         This patch ensures that we always have a clean tree (and a valid and current document size) when
3456         setting m_autoSizeContentSize. 
3457
3458         * page/FrameView.cpp:
3459         (WebCore::FrameView::autoSizeIfEnabled):
3460
3461 2017-06-02  Wenson Hsieh  <wenson_hsieh@apple.com>
3462
3463         REGRESSION(r216212): RenderReplaced::paint() should not save and restore the context unless it has to
3464         https://bugs.webkit.org/show_bug.cgi?id=172883
3465         <rdar://problem/32548614>
3466
3467         Reviewed by Tim Horton.
3468
3469         After implementing dragged content fading, RenderReplace::paint is now always guarded by unnecessary calls to
3470         GraphicsContext::save and GraphicsContext::restore, even when there is no dragged content being rendered. To
3471         address this, we initialize our GraphicsContextStateSaver with saveAndRestore = false, indicating that we don't
3472         want to immediately try and save the context.
3473
3474         If we are in a dragged content range, we will then call GraphicsContextStateSaver::save, which saves the
3475         graphics context and also causes the GraphicsContextStateSaver to eventually try and restore() when it is
3476         destroyed. Otherwise, in the common codepath where the renderer is not in a dragged content range, the
3477         constructor and destructor of GraphicsContextStateSaver will be no-ops with respect to saving and restoring the
3478         graphics context.
3479
3480         * rendering/RenderReplaced.cpp:
3481         (WebCore::RenderReplaced::paint):
3482
3483 2017-06-02  Myles C. Maxfield  <mmaxfield@apple.com>
3484
3485         REGRESSION(r213464): [iOS] Fonts get too bold when the "Bold Text" accessibility setting is enabled
3486         https://bugs.webkit.org/show_bug.cgi?id=172737
3487
3488         Reviewed by Simon Fraser.
3489
3490         Revert the part of r213464 which changed how we calculate the weights of system fonts.
3491
3492         Add an InternalSetting to trigger our mock of the accessbility "Bold Text" setting. We can't
3493         use the real setting, so instead we just ask for bold fonts instead of regular fonts when this
3494         setting is true.
3495
3496         Tests: fast/text/accessibility-bold-system-font.html
3497                fast/text/accessibility-bold-system-font-2.html
3498
3499         * platform/graphics/FontCache.h:
3500         (WebCore::FontCache::shouldMockBoldSystemFontForAccessibility):
3501         (WebCore::FontCache::setShouldMockBoldSystemFontForAccessibility):
3502         * platform/graphics/ios/FontCacheIOS.mm:
3503         (WebCore::platformFontWithFamilySpecialCase):
3504         * rendering/RenderTheme.h:
3505         (WebCore::RenderTheme::shouldMockBoldSystemFontForAccessibility):
3506         (WebCore::RenderTheme::setShouldMockBoldSystemFontForAccessibility):
3507         * rendering/RenderThemeIOS.h:
3508         * rendering/RenderThemeIOS.mm:
3509         (WebCore::cssWeightOfSystemFont):
3510         (WebCore::RenderThemeIOS::updateCachedSystemFontDescription):
3511         * testing/InternalSettings.cpp:
3512         (WebCore::InternalSettings::Backup::Backup):
3513         (WebCore::InternalSettings::Backup::restoreTo):
3514         (WebCore::InternalSettings::setShouldMockBoldSystemFontForAccessibility):
3515         * testing/InternalSettings.h:
3516         * testing/InternalSettings.idl:
3517
3518 2017-06-02  Brady Eidson  <beidson@apple.com>
3519
3520         Prevent scheme handlers from handling all built-in URL schemes.
3521         <rdar://problem/32404790> and https://bugs.webkit.org/show_bug.cgi?id=172869
3522
3523         Reviewed by Andy Estes.
3524
3525         Covered by API test.
3526
3527         This patch refactors SchemeRegistry to keep a base, constant set of each of the special
3528         URL schemes that WebKit knows about by default.
3529         
3530         It then exposes that list through a new method to support WK2 API.
3531
3532         * platform/SchemeRegistry.cpp:
3533         (WebCore::allBuiltinSchemes):
3534         (WebCore::builtinLocalURLSchemes):
3535         (WebCore::localURLSchemes):
3536         (WebCore::builtinSecureSchemes):
3537         (WebCore::secureSchemes):
3538         (WebCore::builtinSchemesWithUniqueOrigins):
3539         (WebCore::schemesWithUniqueOrigins):
3540         (WebCore::builtinEmptyDocumentSchemes):
3541         (WebCore::emptyDocumentSchemes):
3542         (WebCore::builtinCanDisplayOnlyIfCanRequestSchemes):
3543         (WebCore::canDisplayOnlyIfCanRequestSchemes):
3544         (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsLocal):
3545         (WebCore::builtinCORSEnabledSchemes):
3546         (WebCore::CORSEnabledSchemes):
3547         (WebCore::SchemeRegistry::isBuiltinScheme):
3548         * platform/SchemeRegistry.h:
3549
3550 2017-06-02  Simon Fraser  <simon.fraser@apple.com>
3551
3552         All scroll peformance logging should happen in the UI process
3553         https://bugs.webkit.org/show_bug.cgi?id=172874
3554         rdar://problem/24474830
3555
3556         Reviewed by Tim Horton.
3557
3558         Printing to stdout from the WebProcess doesn't show up anywhere in non-development builds,
3559         so we have to log from the UI process.
3560
3561         Achieve this by adding a PerformanceLoggingClient to Page which forwards messages to
3562         WebPageProxy, which prints them with the same format they had before. Some plumbing through
3563         PlatformCALayerClient and GraphicsLayerClient is required to get messages from TileControllers
3564         through to something that can get to Page.
3565
3566         * WebCore.xcodeproj/project.pbxproj:
3567         * page/Page.cpp:
3568         (WebCore::Page::Page):
3569         (WebCore::Page::~Page):
3570         * page/Page.h:
3571         (WebCore::Page::performanceLoggingClient):
3572         * page/PageConfiguration.cpp:
3573         * page/PageConfiguration.h:
3574         * page/PerformanceLoggingClient.cpp: Added.
3575         (WebCore::PerformanceLoggingClient::synchronousScrollingReasonsAsString):
3576         * page/PerformanceLoggingClient.h: Added.
3577         (WebCore::PerformanceLoggingClient::~PerformanceLoggingClient):
3578         * page/scrolling/AsyncScrollingCoordinator.cpp:
3579         (WebCore::AsyncScrollingCoordinator::reportExposedUnfilledArea):
3580         (WebCore::AsyncScrollingCoordinator::reportSynchronousScrollingReasonsChanged):
3581         * page/scrolling/AsyncScrollingCoordinator.h:
3582         * page/scrolling/ScrollingTree.h:
3583         (WebCore::ScrollingTree::reportSynchronousScrollingReasonsChanged):
3584         (WebCore::ScrollingTree::reportExposedUnfilledArea):
3585         * page/scrolling/ThreadedScrollingTree.cpp:
3586         (WebCore::ThreadedScrollingTree::reportSynchronousScrollingReasonsChanged):
3587         (WebCore::ThreadedScrollingTree::reportExposedUnfilledArea):
3588         * page/scrolling/ThreadedScrollingTree.h:
3589         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
3590         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3591         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
3592         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
3593         (WebCore::ScrollingTreeFrameScrollingNodeMac::exposedUnfilledArea):
3594         (WebCore::ScrollingTreeFrameScrollingNodeMac::logExposedUnfilledArea): Deleted.
3595         (WebCore::logThreadedScrollingMode): Deleted.
3596         * platform/graphics/GraphicsLayerClient.h:
3597         (WebCore::GraphicsLayerClient::logFilledVisibleFreshTile):
3598         * platform/graphics/ca/GraphicsLayerCA.cpp:
3599         (WebCore::GraphicsLayerCA::platformCALayerLogFilledVisibleFreshTile):
3600         * platform/graphics/ca/GraphicsLayerCA.h:
3601         * platform/graphics/ca/PlatformCALayerClient.h:
3602         (WebCore::PlatformCALayerClient::platformCALayerLogFilledVisibleFreshTile):
3603         * platform/graphics/ca/TileController.cpp:
3604         (WebCore::TileController::logFilledVisibleFreshTile):
3605         * platform/graphics/ca/TileController.h:
3606         * platform/graphics/ca/TileGrid.cpp:
3607         (WebCore::TileGrid::platformCALayerPaintContents):
3608         * platform/graphics/ca/TileGrid.h:
3609         * rendering/RenderLayerBacking.cpp:
3610         (WebCore::RenderLayerBacking::logFilledVisibleFreshTile):
3611         * rendering/RenderLayerBacking.h:
3612
3613 2017-06-02  Eric Carlson  <eric.carlson@apple.com>
3614
3615         [MediaStream iOS] Cleanup video muting/unmuting when tab visibility changes
3616         https://bugs.webkit.org/show_bug.cgi?id=172858
3617
3618         Reviewed by Youenn Fablet.
3619
3620         Test: platform/ios/mediastream/video-muted-in-background-tab.html
3621
3622         * dom/Document.cpp:
3623         (WebCore::Document::visibilityStateChanged): Call notifyMediaCaptureOfVisibilityChanged.
3624         (WebCore::Document::notifyMediaCaptureOfVisibilityChanged): Renamed from notifyVisibilityChangedToMediaCapture.
3625         Set m_videoCaptureMutedForVisibilityChange when capture is muted because the document is hidden,
3626         and clear it when visibility changes when capture is disabled. Don't unmute when the document
3627         becomes visible unless this m_videoCaptureMutedForVisibilityChange is still true.
3628         (WebCore::Document::notifyVisibilityChangedToMediaCapture): Deleted.
3629         * dom/Document.h:
3630
3631         * platform/mediastream/RealtimeMediaSource.h:
3632         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
3633         (WebCore::RealtimeMediaSourceCenter::setVideoCaptureMutedForPageVisibility): Renamed from
3634         setVisibility.
3635         (WebCore::RealtimeMediaSourceCenter::setVisibility): Deleted.
3636         * platform/mediastream/RealtimeMediaSourceCenter.h:
3637
3638         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3639         (WebCore::AVVideoCaptureSourceFactory::setVideoCaptureMutedForPageVisibility): Ditto.
3640         (WebCore::AVVideoCaptureSourceFactory::setVisibility): Deleted.
3641
3642         * platform/mock/MockRealtimeVideoSource.cpp:
3643         (WebCore::MockRealtimeVideoSourceFactory::setVideoCaptureMutedForPageVisibility): Ditto.
3644         (WebCore::MockRealtimeVideoSourceFactory::setVisibility): Deleted.
3645
3646 2017-06-02  Frederic Wang  <fwang@igalia.com>
3647
3648         [Mac] Include frames in the scrolling tree when ScrollingTreeIncludesFrames=true
3649         https://bugs.webkit.org/show_bug.cgi?id=172825
3650
3651         Reviewed by Simon Fraser.
3652
3653         This commit generalizes RenderLayerCompositor/ScrollingCoordinator so that it handles the
3654         case of non-main frames. When ScrollingTreeIncludesFrames=true, all the frames will appear
3655         in the scrolling tree on Mac WK2.
3656
3657         Test: fast/scrolling/scrolling-tree-includes-frame.html
3658
3659         * page/scrolling/ScrollingCoordinator.cpp:
3660         (WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView): Do not to restrict to the
3661         main frame.
3662         * rendering/RenderLayerCompositor.cpp:
3663         (WebCore::RenderLayerCompositor::updateBacking): Do not to restrict to the main frame.
3664         (WebCore::RenderLayerCompositor::useCoordinatedScrollingForLayer): Make this function a class
3665         member so it can call hasCoordinatedScrolling and no longer needs a RenderView parameter.
3666         (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus): Do not to restrict to the
3667         main frame.
3668         * rendering/RenderLayerCompositor.h: Introduce useCoordinatedScrollingForLayer.
3669
3670 2017-06-02  Don Olmstead  <don.olmstead@am.sony.com>
3671
3672         [WebCore] DragImageRef should correspond to USE(CAIRO)
3673         https://bugs.webkit.org/show_bug.cgi?id=172863
3674
3675         Reviewed by Carlos Alberto Lopez Perez.
3676
3677         No new tests. No change in behavior.
3678
3679         * platform/DragImage.h:
3680
3681 2017-06-02  Frederic Wang  <fwang@igalia.com>
3682
3683         [Mac] Use compositing for frames when ScrollingTreeIncludesFrames=true
3684         https://bugs.webkit.org/show_bug.cgi?id=172851
3685
3686         Reviewed by Simon Fraser.
3687
3688         When fast frame scrolling is supported on mac (bug 171667), scrollable frames will require
3689         special composited layer. This commit enables that on mac but only when
3690         ScrollingTreeIncludesFrames=true, so that the default behavior is unchanged.
3691
3692         Test: compositing/iframes/compositing-for-scrollable-iframe.html
3693
3694         * rendering/RenderLayerCompositor.cpp:
3695         (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame): Do not enable frame
3696         compositing when ScrollingTreeIncludesFrames=false.
3697         Rename ScrollableInnerFrameTrigger to ScrollableNonMainFrameTrigger.
3698         * page/ChromeClient.h: Rename ScrollableInnerFrameTrigger.
3699
3700 2017-06-02  Simon Fraser  <simon.fraser@apple.com>
3701
3702         Get <chrono> out of StdLibExtras.h
3703         https://bugs.webkit.org/show_bug.cgi?id=172744
3704
3705         Reviewed by Zalan Bujtas.
3706
3707         Only bring in <chrono> and namespace std::literals::chrono_literals when necessary.
3708
3709         * fileapi/FileReader.cpp:
3710         * inspector/InspectorOverlay.cpp:
3711         * loader/CrossOriginPreflightResultCache.cpp:
3712         * loader/cache/CachedResource.cpp:
3713         (WebCore::CachedResource::freshnessLifetime):
3714         * page/ResourceUsageThread.cpp:
3715         (WebCore::ResourceUsageThread::threadBody):
3716         * page/cocoa/MemoryReleaseCocoa.mm:
3717         (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
3718         * platform/network/CacheValidation.cpp:
3719         (WebCore::computeFreshnessLifetimeForHTTPFamily):
3720         * platform/network/CacheValidation.h:
3721
3722 2017-06-02  Andy Estes  <aestes@apple.com>
3723
3724         [Cocoa] Add a "supportedCountries" property to ApplePayPaymentRequest
3725         https://bugs.webkit.org/show_bug.cgi?id=172832
3726         <rdar://problem/30735544>
3727
3728         Reviewed by Alex Christensen.
3729
3730         Test: http/tests/ssl/applepay/ApplePaySessionV3.html
3731
3732         * Modules/applepay/ApplePayPaymentRequest.h:
3733         * Modules/applepay/ApplePayPaymentRequest.idl:
3734         * Modules/applepay/ApplePaySession.cpp:
3735         (WebCore::convertAndValidate):
3736         * Modules/applepay/PaymentRequest.h:
3737         (WebCore::PaymentRequest::supportedCountries):
3738         (WebCore::PaymentRequest::setSupportedCountries):
3739         * Modules/applepay/PaymentRequestValidator.cpp:
3740         (WebCore::PaymentRequestValidator::validate):
3741         * platform/spi/cocoa/PassKitSPI.h:
3742
3743 2017-06-02  Devin Rousso  <drousso@apple.com>
3744
3745         Web Inspector: Should see active Web Sockets when opening Web Inspector
3746         https://bugs.webkit.org/show_bug.cgi?id=172312
3747
3748         Reviewed by Joseph Pecoraro.
3749
3750         Test: http/tests/websocket/tests/hybi/inspector/before-load.html
3751
3752         * Modules/websockets/WebSocket.h:
3753         * Modules/websockets/WebSocket.cpp:
3754         (WebCore::WebSocket::WebSocket):
3755         (WebCore::WebSocket::~WebSocket):
3756         (WebCore::WebSocket::allActiveWebSockets):
3757         (WebCore::WebSocket::allActiveWebSocketsMutex):
3758         (WebCore::WebSocket::channel):
3759         (WebCore::WebSocket::eventTargetInterface):
3760         Add a static set of all WebSocket objects and provide getters to access web socket metadata.
3761
3762         * Modules/websockets/ThreadableWebSocketChannel.h:
3763         (WebCore::ThreadableWebSocketChannel::isWebSocketChannel):
3764         * Modules/websockets/WebSocketChannel.h:
3765         * Modules/websockets/WebSocketChannel.cpp:
3766         (WebCore::WebSocketChannel::isWebSocketChannel):
3767         (WebCore::WebSocketChannel::identifier):
3768         (WebCore::WebSocketChannel::clientHandshakeRequest):
3769         (WebCore::WebSocketChannel::serverHandshakeResponse):
3770         (WebCore::WebSocketChannel::handshakeMode):
3771         (WebCore::WebSocketChannel::isType):
3772         Provide getters to access web socket metadata.
3773
3774         * inspector/InspectorNetworkAgent.cpp:
3775         (WebCore::InspectorNetworkAgent::enable):
3776         Loops over the static set of all WebSocket objects and sends events for each to the frontend.
3777
3778 2017-06-02  Chris Dumez  <cdumez@apple.com>
3779
3780         Unreviewed, fix linking errors on iOS after r217712.
3781
3782         * platform/OrientationNotifer.h:
3783         (WebCore::OrientationNotifier::Observer::setNotifier):
3784
3785 2017-06-02  Chris Dumez  <cdumez@apple.com>
3786
3787         Crash under OrientationNotifier::Observer::setNotifier()
3788         https://bugs.webkit.org/show_bug.cgi?id=172847
3789         <rdar://problem/32519127>
3790
3791         Reviewed by Youenn Fablet.
3792
3793         Update OrientationNotifier::Observer::setNotifier() to unregister itself from
3794         its current notifier if it already has one. This is needed because
3795         Internals::setCameraMediaStreamTrackOrientation() may be used to override the
3796         notifier of an observer. If we override the notifier without unregistering
3797         the observer from its previous notifier, then the previous notifier will not
3798         get notified when the observer gets destroyed.
3799
3800         No new tests, already covered by webrtc/video-rotation.html that is currently
3801         failing on some bots.
3802
3803         * platform/OrientationNotifer.h:
3804         (WebCore::OrientationNotifier::Observer::setNotifier):
3805
3806 2017-06-02  Javier Fernandez  <jfernandez@igalia.com>
3807
3808         [css-grid] Logical margin incorrectly applied during the tracks sizing algorithm of auto tracks
3809         https://bugs.webkit.org/show_bug.cgi?id=172836
3810
3811         Reviewed by Manuel Rego Casasnovas.
3812
3813         When computing min-content and max-content of the content-sized tracks
3814         we are using the marginIntrinsicLogicalWidthForChild function, which
3815         uses the grid's writing-mode to determine wether to use the child's
3816         margin width or height. This is not correct when the grid item is
3817         orthogonal.
3818
3819         This patch changes how we compute the tracks width so we use always
3820         the item's marginLogicalWidth, which depends only on its own writing
3821         mode.
3822
3823         Test: fast/css-grid-layout/grid-track-sizing-with-margins-and-orthogonal-flows.html
3824
3825         * rendering/GridTrackSizingAlgorithm.cpp:
3826         (WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild):
3827         (WebCore::GridTrackSizingAlgorithmStrategy::maxContentForChild):
3828
3829 2017-06-02  Emilio Cobos Álvarez  <ecobos@igalia.com>
3830
3831         Invalidate the shadow subtree style when slotted pseudo rules are present.
3832         https://bugs.webkit.org/show_bug.cgi?id=172822
3833
3834         Reviewed by Antti Koivisto.
3835
3836         No new tests, this is tested by
3837         fast/shadow-dom/css-scoping-slot-with-id.html, once we don't force an
3838         Inherit style change for slots. I could add some more tests for stuff
3839         with descendant combinators and similar I guess, though.
3840
3841         * style/AttributeChangeInvalidation.cpp:
3842         (WebCore::Style::AttributeChangeInvalidation::invalidateStyle):
3843         * style/ClassChangeInvalidation.cpp:
3844         (WebCore::Style::ClassChangeInvalidation::invalidateStyle):
3845         * style/IdChangeInvalidation.cpp:
3846         (WebCore::Style::IdChangeInvalidation::invalidateStyle):
3847
3848 2017-06-02  Miguel Gomez  <magomez@igalia.com>
3849
3850         [GTK+][WPE] Allow TextureMapperShaderProgram to perform colorspace conversions with the source texture pixels
3851         https://bugs.webkit.org/show_bug.cgi?id=172749
3852
3853         Reviewed by Žan Doberšek.
3854
3855         Currently TextureMapperGL is only able to paint properly textures that are in RGBA format. There are
3856         situations where we will want it to be able to handle other formats (for example BGRA for gstreamer-gl).
3857         To make this possible without having to perform the color conversion in the CPU, we add a new color
3858         conversion matrix to TextureMapperShaderProgram. This matrix will perform the color space conversion
3859         in the GPU, just after sampling the source texture.
3860
3861         Also, add a new flag to TextureMapperGL to indicate that a color conversion is required to handle a
3862         texture. This flag will be set to the TextureMapperPlatformLayerBuffers as required, and TextureMapperGL
3863         will set the appropriate color space matrix to the shader. Initially only the flag for BGRA->RGBA conversion
3864         is defined, but support for new transformations can be added as needed.
3865
3866         VideoTextureCopierGStreamer also uses the TextureMapperShaderProgram to perform texture sampling, but for
3867         the moment it just sets an identity matrix because when using gstreamer-gl, the format of the video frames
3868         is RGBA. This will be changed soon to use BGRA.
3869
3870         No new tests.
3871
3872         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
3873         (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
3874         * platform/graphics/texmap/TextureMapperGL.cpp:
3875         (WebCore::colorSpaceMatrixForFlags):
3876         (WebCore::TextureMapperGL::drawTexturedQuadWithProgram):
3877         * platform/graphics/texmap/TextureMapperGL.h:
3878         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
3879         * platform/graphics/texmap/TextureMapperShaderProgram.h:
3880
3881 2017-06-02  Javier Fernandez  <jfernandez@igalia.com>
3882
3883         [css-grid] Margin wrong applied when stretching an orthogonal item in fixed size track
3884         https://bugs.webkit.org/show_bug.cgi?id=172590
3885
3886         Reviewed by Sergio Villar Senin.
3887
3888         We need to consider orthogonality when using the item's logical margin to
3889         compute the available space for stretching.
3890
3891         The issue this patch fixes is only reproducible when the grid layout logic
3892         is executed several times, since probably the item doesn't need to be
3893         laid out again. In such cases, we just get the cached logical margins
3894         but we were not taking orthogonality into account.
3895
3896         Test: fast/css-grid-layout/grid-item-stretching-must-not-depend-on-previous-layouts.html
3897
3898         * rendering/RenderGrid.cpp:
3899         (WebCore::RenderGrid::layoutBlock):
3900         (WebCore::RenderGrid::marginLogicalSizeForChild):
3901         (WebCore::RenderGrid::availableAlignmentSpaceForChildBeforeStretching):
3902         * rendering/RenderGrid.h:
3903
3904 2017-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3905
3906         [GTK] Cache RenderThemeGadget hierarchies for rendering themed elements with GTK+ 3.20+
3907         https://bugs.webkit.org/show_bug.cgi?id=162673
3908
3909         Reviewed by Michael Catanzaro.
3910
3911         Because of the way the new theming system works in GTK+ >= 3.20 we are currently creating a gadget hierarchy
3912         every time we need to render a styled element or get layout information about it. That's happening on every
3913         repaint, and it's specially problematic for overlay scrollbar indicators that fade in/out when shown/hidden. We
3914         need to cache the gadgets and simply apply the state before every paint or layout query. When using GtkWidgetPath,
3915         calling gtk_style_context_save() breaks the gadget hierarchy, and style classes need to be set when building the
3916         GtkWidgetPath. That means we can't cache RenderThemeGadgets, call save, apply style classes and state, and then
3917         call restore. We need to cache gadget hierarchies with fixed style classes. Fortunately, setting the state does
3918         work, so we don't need to also cache a different hierarchy for every possible state. For example, for the
3919         particular case of scrollbars we would cache VerticalScrollbarRight, VerticalScrollbarLeft, HorizontalScrollbar,
3920         VerticalScrollIndicatorRight, VerticalScrollIndicatorLeft and HorizontalScrollIndicator. In practice, we will
3921         only have 4 of those at the same time in the cache.