008b672edb9c10c31b689bf20f023f07e3b68cc3
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-06-20  Myles C. Maxfield  <mmaxfield@apple.com>
2
3         [Cocoa] The system Japanese font cannot be italicized
4         https://bugs.webkit.org/show_bug.cgi?id=173300
5         <rdar://problem/31805407>
6
7         Reviewed by Ryosuke Niwa.
8
9         Items in the system font cascade list may lie about whether or not they support italics.
10         In order to get the truth, we need to use the physical font underlying the font in question,
11         because this one won't lie. Then, we can interrogate this physical font about its traits
12         in order to synthesize italics correctly.
13
14         Test: fast/text/system-font-japanese-synthetic-italic.html
15
16         * platform/graphics/cocoa/FontCacheCoreText.cpp:
17         (WebCore::lookupFallbackFont):
18         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
19         (WebCore::FontFamilySpecificationCoreText::fontRanges):
20
21 2017-06-20  Chris Dumez  <cdumez@apple.com>
22
23         Use WTF::Function instead of std::function in more places in WebCore/
24         https://bugs.webkit.org/show_bug.cgi?id=173583
25
26         Reviewed by Darin Adler.
27
28         Use WTF::Function instead of std::function in more places in WebCore/ to
29         reduce copying.
30
31         * page/Page.cpp:
32         * platform/HysteresisActivity.h:
33         (WebCore::HysteresisActivity::HysteresisActivity):
34         * platform/Logging.cpp:
35         (WebCore::registerNotifyCallback):
36         * platform/Logging.h:
37         * platform/MainThreadSharedTimer.cpp:
38         (WebCore::MainThreadSharedTimer::setFiredFunction):
39         * platform/MainThreadSharedTimer.h:
40         * platform/PlatformPasteboard.h:
41         * platform/ScopeGuard.h:
42         (WebCore::ScopeGuard::ScopeGuard):
43         (WebCore::ScopeGuard::enable):
44         * platform/ScrollAnimationSmooth.cpp:
45         (WebCore::ScrollAnimationSmooth::ScrollAnimationSmooth):
46         * platform/ScrollAnimationSmooth.h:
47         * platform/SharedTimer.h:
48         * platform/audio/PlatformMediaSessionManager.cpp:
49         (WebCore::PlatformMediaSessionManager::currentSessionsMatching):
50         * platform/audio/PlatformMediaSessionManager.h:
51         * platform/cf/MainThreadSharedTimerCF.cpp:
52         (WebCore::setupPowerObserver):
53         * platform/cf/RunLoopObserver.h:
54         (WebCore::RunLoopObserver::RunLoopObserver):
55         * platform/graphics/GraphicsContext.h:
56         * platform/graphics/GraphicsLayer.cpp:
57         (WebCore::GraphicsLayer::traverse):
58         * platform/graphics/GraphicsLayer.h:
59         * platform/graphics/MediaPlayer.cpp:
60         (WebCore::addMediaEngine):
61         * platform/graphics/MediaPlayer.h:
62         * platform/graphics/Path.h:
63         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
64         (WebCore::MediaPlayerPrivateAVFoundation::seekCompleted):
65         (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification):
66         (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
67         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
68         (WebCore::MediaPlayerPrivateAVFoundation::Notification::Notification):
69         (WebCore::MediaPlayerPrivateAVFoundation::Notification::function):
70         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
71         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
72         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
73         (WebCore::runWithoutAnimations):
74         * platform/graphics/cocoa/IOSurface.h:
75         * platform/graphics/cocoa/IOSurface.mm:
76         (WebCore::IOSurface::convertToFormat):
77         * platform/graphics/gstreamer/MainThreadNotifier.h:
78         * platform/graphics/gstreamer/MediaPlayerRequestInstallMissingPluginsCallback.h:
79         (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::create):
80         (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::MediaPlayerRequestInstallMissingPluginsCallback):
81         * platform/graphics/win/GraphicsContextDirect2D.cpp:
82         (WebCore::GraphicsContext::drawWithoutShadow):
83         (WebCore::GraphicsContext::drawWithShadow):
84         * platform/gtk/PasteboardHelper.cpp:
85         (WebCore::ClipboardSetData::ClipboardSetData):
86         (WebCore::PasteboardHelper::writeClipboardContents):
87         * platform/gtk/PasteboardHelper.h:
88         * platform/gtk/PlatformPasteboardGtk.cpp:
89         (WebCore::PlatformPasteboard::writeToClipboard):
90         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
91         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
92         (WebVideoFullscreenInterfaceAVKit::preparedToReturnToInline):
93         (WebVideoFullscreenInterfaceAVKit::fullscreenMayReturnToInline):
94         * platform/mac/PowerObserverMac.cpp:
95         (WebCore::PowerObserver::PowerObserver):
96         * platform/mac/PowerObserverMac.h:
97         * platform/mac/WebCoreNSURLExtras.mm:
98         (WebCore::isSecondLevelDomainNameAllowedByTLDRules):
99         * platform/mediastream/CaptureDeviceManager.cpp:
100         (CaptureDeviceManager::addCaptureDeviceChangedObserver):
101         * platform/mediastream/CaptureDeviceManager.h:
102         * platform/mediastream/RealtimeMediaSource.cpp:
103         (WebCore::RealtimeMediaSource::scheduleDeferredTask):
104         * platform/mediastream/RealtimeMediaSource.h:
105         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
106         (-[WebAVAudioSessionAvailableInputsListener initWithCallback:]):
107         * platform/mediastream/mac/CoreAudioCaptureSource.h:
108         * platform/mock/ScrollAnimatorMock.cpp:
109         (WebCore::ScrollAnimatorMock::ScrollAnimatorMock):
110         * platform/mock/ScrollAnimatorMock.h:
111         * platform/network/CookieStorage.h:
112         * platform/network/NetworkStateNotifier.cpp:
113         (WebCore::NetworkStateNotifier::addNetworkStateChangeListener):
114         * platform/network/NetworkStateNotifier.h:
115         * platform/network/NetworkStorageSession.cpp:
116         (WebCore::NetworkStorageSession::forEach):
117         * platform/network/NetworkStorageSession.h:
118         * platform/network/cf/CookieStorageCFNet.cpp:
119         (WebCore::cookieChangeCallbackMap):
120         (WebCore::startObservingCookieChanges):
121         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
122         (WebCore::callOnMainThreadAndWait):
123         * platform/network/mac/CookieStorageMac.mm:
124         (-[WebCookieStorageObjCAdapter startListeningForCookieChangeNotificationsWithCallback:]):
125         (WebCore::startObservingCookieChanges):
126         * platform/network/soup/CookieStorageSoup.cpp:
127         (WebCore::startObservingCookieChanges):
128         * platform/network/soup/SoupNetworkSession.cpp:
129         (WebCore::SoupNetworkSession::checkTLSErrors):
130         * platform/network/soup/SoupNetworkSession.h:
131         * platform/sql/SQLiteDatabase.cpp:
132         (WebCore::destroyCollationFunction):
133         (WebCore::callCollationFunction):
134         (WebCore::SQLiteDatabase::setCollationFunction):
135         * platform/sql/SQLiteDatabase.h:
136         * rendering/RenderLayerBacking.cpp:
137         (WebCore::traverseVisibleNonCompositedDescendantLayers):
138         * rendering/RenderListBox.cpp:
139         (WebCore::RenderListBox::paintItem):
140         * rendering/RenderListBox.h:
141         * rendering/line/BreakingContext.h:
142         (WebCore::BreakingContext::InlineIteratorHistory::push):
143         (WebCore::BreakingContext::InlineIteratorHistory::update):
144         * workers/Worker.cpp:
145         (WebCore::Worker::Worker):
146         * workers/WorkerRunLoop.cpp:
147
148 2017-06-20  Ryan Haddad  <ryanhaddad@apple.com>
149
150         Unreviewed, rolling out r218524.
151
152         This change broke internal builds.
153
154         Reverted changeset:
155
156         "[Cocoa] The system Japanese font cannot be italicized"
157         https://bugs.webkit.org/show_bug.cgi?id=173300
158         http://trac.webkit.org/changeset/218524
159
160 2017-06-20  Daniel Bates  <dabates@apple.com>
161
162         Have FrameLoadRequest takes a Frame& instead of a Frame*
163         https://bugs.webkit.org/show_bug.cgi?id=173614
164         <rdar://problem/32884890>
165
166         Reviewed by Brent Fulgham.
167
168         * loader/ContentFilter.cpp:
169         (WebCore::ContentFilter::handleProvisionalLoadFailure):
170         * loader/FrameLoadRequest.cpp:
171         (WebCore::FrameLoadRequest::FrameLoadRequest):
172         * loader/FrameLoadRequest.h:
173         * page/DragController.cpp:
174         (WebCore::DragController::performDragOperation):
175
176 2017-06-20  Daniel Bates  <dabates@apple.com>
177
178         Skip Content Security Policy check for a media request using standard schemes initiated from
179         an element in user agent shadow tree
180         https://bugs.webkit.org/show_bug.cgi?id=155505
181         <rdar://problem/25169452>
182
183         Reviewed by Brent Fulgham.
184
185         This change makes the following tests pass on iOS 11:
186             http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-video.html
187             http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-audio.html
188
189         * loader/MediaResourceLoader.cpp:
190         (WebCore::MediaResourceLoader::requestResource):
191         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
192         (WebCore::WebCoreAVFResourceLoader::startLoading):
193
194 2017-06-20  Andreas Kling  <akling@apple.com>
195
196         Remove no-op calls to purge SQLite caches on memory pressure.
197         <https://webkit.org/b/173604>
198
199         Reviewed by Chris Dumez.
200
201         The implementation of _sqlite3_purgeEligiblePagerCacheMemory() is empty
202         since a few releases ago, so there's no point in calling it.
203
204         * page/MemoryRelease.cpp:
205         (WebCore::registerMemoryReleaseNotifyCallbacks):
206         (WebCore::registerSQLiteMemoryPressureHandler): Deleted.
207         * page/MemoryRelease.h:
208         * page/cocoa/MemoryReleaseCocoa.mm:
209         (WebCore::platformReleaseMemory):
210         (WebCore::registerSQLiteMemoryPressureHandler): Deleted.
211         * platform/sql/SQLiteDatabase.cpp:
212         (WebCore::initializeSQLiteIfNecessary):
213
214 2017-06-20  Devin Rousso  <drousso@apple.com>
215
216         Web Inspector: add console messages for WebGL shader compile and program link errors/warnings
217         https://bugs.webkit.org/show_bug.cgi?id=143236
218         <rdar://problem/20352149>
219
220         Reviewed by Dean Jackson.
221
222         Test: fast/canvas/webgl/shader-compile-logging.html
223
224         * html/canvas/WebGLRenderingContextBase.h:
225         * html/canvas/WebGLRenderingContextBase.cpp:
226         (WebCore::WebGLRenderingContextBase::checkFramebufferStatus):
227         (WebCore::WebGLRenderingContextBase::compileShader):
228         (WebCore::WebGLRenderingContextBase::recycleContext):
229         (WebCore::WebGLRenderingContextBase::checkTextureCompleteness):
230         (WebCore::WebGLRenderingContextBase::printToConsole):
231         (WebCore::WebGLRenderingContextBase::maybeRestoreContext):
232         (WebCore::WebGLRenderingContextBase::synthesizeGLError):
233         (WebCore::WebGLRenderingContextBase::printGLErrorToConsole): Deleted.
234         (WebCore::WebGLRenderingContextBase::printWarningToConsole): Deleted.
235         (WebCore::WebGLRenderingContextBase::printGLWarningToConsole): Deleted.
236         Unify console logging helper functions to all follow the same path. Additionally, errors
237         now generate stack traces. Shader compilation errors are now logged as well.
238
239         * dom/Document.h:
240         * dom/Document.cpp:
241         (WebCore::Document::addConsoleMessage):
242         * dom/ScriptExecutionContext.h:
243         (WebCore::ScriptExecutionContext::AddConsoleMessageTask::AddConsoleMessageTask):
244         * page/PageConsoleClient.h:
245         * page/PageConsoleClient.cpp:
246         (WebCore::PageConsoleClient::addMessage):
247         * workers/WorkerGlobalScope.h:
248         Add new path for logging to the console that accepts a ConsoleMessage.
249
250 2017-06-20  Saam Barati  <sbarati@apple.com>
251
252         Unreviewed. Try to fix the build after r218594.
253
254         * dom/Document.h:
255
256 2017-06-20  Matt Lewis  <jlewis3@apple.com>
257
258         Unreviewed, rolling out r218530.
259
260         This revision caused multiple media stream test crashes on
261         Debug builds.
262
263         Reverted changeset:
264
265         "Merge MediaDevicesRequest and MediaDevicesEnumerationRequest
266         to tighten up code and object lifetime"
267         https://bugs.webkit.org/show_bug.cgi?id=173527
268         http://trac.webkit.org/changeset/218530
269
270 2017-06-19  Antoine Quint  <graouts@apple.com>
271
272         Media document experience with long-loading files is poor
273         https://bugs.webkit.org/show_bug.cgi?id=173575
274         <rdar://problem/32178119>
275
276         Reviewed by Dean Jackson.
277
278         In order to avoid showing media controls at a different size than that of the video when we've
279         received enough information to determine whether it's audio or video and what the video frame size
280         is, we do not show any UI until we have enough information to show the controls in their correct
281         initial state. This works well with local files and fast-loading files, but does not work well with
282         invalid files, which never load and fail to ever show any UI, and files that load slowly where there
283         is no visible feedback that content will be visible.
284
285         Instead, we now default to showing audio controls in their loading state, which provides a seamless
286         transition if we will be loading an audio file since the controls are initially in the correct state,
287         and at least provide feedback that data is loading even if we eventually transition to a video layout.
288
289         Additionally, we remove the invalid placard background in case the media is invalid, showing only the
290         crossed-out play icon in the center of the page in that state.
291
292         Tests: media/modern-media-controls/media-documents/media-document-invalid.html
293                media/modern-media-controls/media-documents/media-document-video-with-initial-audio-layout.html
294
295         * Modules/modern-media-controls/controls/media-document.css:
296         (:host(.media-document)): Remove "visibility: hidden" since we want the media controls to be visible
297         at all times.
298         (:host(.media-document.audio)): Add a little padding on the x-axis to ensure audio controls never snap
299         directly to the edges of the window.
300         (:host(.media-document.audio.iphone)): Remove the iPhone-specific styling since we moved it to the
301         general case.
302         (:host(.media-document.video.invalid) .placard): Remove the background from the invalid placard when
303         showing invalid media.
304         (:host(.media-document.ready)): Deleted.
305         * Modules/modern-media-controls/media/audio-support.js:
306         (AudioSupport.prototype.syncControl): Make sure we invalidate the media document layout when a media
307         document's media type changes.
308         * Modules/modern-media-controls/media/media-controller.js:
309         (MediaController): Instantiate the controls prior to creating the MediaDocumentController since the
310         MediaDocumentController will need to access the controls.
311         * Modules/modern-media-controls/media/media-document-controller.js:
312         (MediaDocumentController): Set the default layout for media controls for a media document to be audio
313         and in the waiting state.
314         (MediaDocumentController.prototype.layout): Toggle the "invalid", "audio" and "video" CSS classes for
315         the next possible commit to the DOM, provided we have established the media document's media type.
316         (MediaDocumentController.prototype.handleEvent): Deal with the "play" and "error" events to trigger
317         a layout.
318         (MediaDocumentController.prototype._mediaDocumentHasMetadata): Deleted.
319         (MediaDocumentController.prototype._mediaDocumentHasSize): Deleted.
320
321 2017-06-20  Daniel Bates  <dabates@apple.com>
322
323         NavigationAction has too many constructors
324         https://bugs.webkit.org/show_bug.cgi?id=173484
325
326         Reviewed by Brady Eidson.
327
328         A NavigationAction object is an immutable object that represents the details of a
329         navigation, including the type of a navigation (e.g. link click), what triggered
330         the navigation, and the external URL policy to use for the navigation. Over time
331         the number of NavigationAction constructor overloads (not including copy/move
332         constructors) has grown to 12 to support different combinations of details.
333         We can use default values to reduce the number of constructors to 2 (not including
334         copy/move constructors).
335
336         No behavior changed. So, no new tests.
337
338         * loader/FrameLoader.cpp:
339         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): Pass NavigationType::Other when
340         instantiating NavigationAction.
341         (WebCore::FrameLoader::loadDifferentDocumentItem): Fix order of arguments now that
342         the constructor overload that takes a NavigationType takes the Event* as the fourth argument,
343         not the third. Also, use C++11 brace initialization syntax when instantiating a NavigationAction.
344         (WebCore::createWindow):
345         * loader/NavigationAction.cpp: Remove unnecessary #include of header ScriptController.h.
346         Include header Event.h.
347         (WebCore::NavigationAction::NavigationAction):
348         * loader/NavigationAction.h: Forward declare class Event and remove #include of header Event.h.
349         Make copy constructor, copy assignment operator, move constructor, and move assignment operator
350         out-of-line to avoid the need to include header Event.h. Export the copy constructor so that it
351         can be used from WebKit on the Apple Windows port. Move ShouldOpenExternalURLsPolicy to be after
352         NavigationType to reduce the size of the class by 8 bytes.
353         (WebCore::NavigationAction::NavigationAction):
354         * loader/PolicyChecker.cpp: Include header Event.h.
355         * page/Performance.cpp: Ditto.
356         * replay/ReplayController.cpp: Ditto.
357
358 2017-06-20  Konstantin Tokarev  <annulen@yandex.ru>
359
360         Rename OrientationNotifer.h to OrientationNotifier.h
361         https://bugs.webkit.org/show_bug.cgi?id=173600
362
363         Reviewed by Youenn Fablet.
364
365         No new tests needed.
366
367         * WebCore.xcodeproj/project.pbxproj:
368         * dom/Document.h:
369         * platform/OrientationNotifier.h: Renamed from Source/WebCore/platform/OrientationNotifer.h.
370         * platform/mediastream/mac/AVVideoCaptureSource.h:
371         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
372         * testing/Internals.h:
373
374 2017-06-20  Konstantin Tokarev  <annulen@yandex.ru>
375
376         Remove excessive include directives from WTF
377         https://bugs.webkit.org/show_bug.cgi?id=173553
378
379         Reviewed by Saam Barati.
380
381         No new tests needed.
382
383         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h:
384         Added missing include directive.
385
386 2017-06-20  Konstantin Tokarev  <annulen@yandex.ru>
387
388         Remove excessive include directives from WebCore/dom
389         https://bugs.webkit.org/show_bug.cgi?id=173591
390
391         Reviewed by Darin Adler.
392
393         No new tests needed.
394
395         * bindings/js/JSCustomElementRegistryCustom.cpp:
396         * dom/Attr.h:
397         * dom/ChildListMutationScope.h:
398         * dom/ContainerNodeAlgorithms.cpp:
399         * dom/ContainerNodeAlgorithms.h:
400         * dom/CustomElementRegistry.h:
401         * dom/DOMRect.h:
402         * dom/DocumentMarkerController.h:
403         * dom/ElementIteratorAssertions.h:
404         * dom/ElementRareData.h:
405         * dom/EventContext.h:
406         * dom/EventDispatcher.h:
407         * dom/ExtensionStyleSheets.h:
408         * dom/GenericEventQueue.h:
409         * dom/LiveNodeList.h:
410         * dom/LoadableClassicScript.h:
411         * dom/LoadableScript.h:
412         * dom/MutationCallback.h:
413         * dom/NativeNodeFilter.h:
414         * dom/NodeRareData.h:
415         * dom/PromiseRejectionEvent.h:
416         * dom/PseudoElement.h:
417         * dom/Range.h:
418         * dom/RegisteredEventListener.h:
419         * dom/RejectedPromiseTracker.cpp:
420         * dom/ScopedEventQueue.h:
421         * dom/ScriptElement.h:
422         * dom/ScriptExecutionContext.h:
423         * dom/ScriptedAnimationController.cpp:
424         * dom/ScriptedAnimationController.h:
425         * dom/SelectorQuery.h:
426         * dom/StaticNodeList.h:
427         * dom/StaticRange.h:
428         * dom/default/PlatformMessagePortChannel.h:
429         * testing/Internals.cpp:
430         * workers/WorkerGlobalScope.h:
431
432 2017-06-20  Konstantin Tokarev  <annulen@yandex.ru>
433
434         Remove excessive include directives from WebCore/css
435         https://bugs.webkit.org/show_bug.cgi?id=173554
436
437         Reviewed by Alex Christensen.
438
439         No new tests needed.
440
441         * css/CSSComputedStyleDeclaration.h:
442         * css/CSSContentDistributionValue.h:
443         * css/CSSCursorImageValue.h:
444         * css/CSSFilterImageValue.h:
445         * css/CSSFontFace.h:
446         * css/CSSFontFeatureValue.h:
447         * css/CSSFontStyleRangeValue.h:
448         * css/CSSFontVariationValue.h:
449         * css/CSSImageGeneratorValue.h:
450         * css/CSSImageSetValue.h:
451         * css/CSSInheritedValue.h:
452         * css/CSSInitialValue.h:
453         * css/CSSKeyframeRule.cpp:
454         * css/CSSKeyframeRule.h:
455         * css/CSSLineBoxContainValue.h:
456         * css/CSSPrimitiveValue.h:
457         * css/CSSPrimitiveValueMappings.h:
458         * css/CSSPropertySourceData.h:
459         * css/CSSReflectValue.h:
460         * css/CSSRevertValue.h:
461         * css/CSSSelector.h:
462         * css/CSSStyleSheet.h:
463         * css/CSSToLengthConversionData.h:
464         * css/CSSUnsetValue.h:
465         * css/CSSValue.h:
466         * css/CSSValuePool.h:
467         * css/CSSVariableData.h:
468         * css/DeprecatedCSSOMCounter.h:
469         * css/DeprecatedCSSOMRGBColor.h:
470         * css/DeprecatedCSSOMRect.h:
471         * css/DeprecatedCSSOMValue.h:
472         * css/RuleSet.h:
473         * css/SelectorChecker.h:
474         * css/StyleBuilderConverter.h:
475         * css/StyleBuilderCustom.h:
476         * css/StyleProperties.h:
477         * css/StyleResolver.cpp:
478         * css/StyleResolver.h:
479         * css/StyleSheet.h:
480         * css/StyleSheetContents.h:
481         * css/ViewportStyleResolver.h:
482         * css/parser/CSSDeferredParser.h:
483         * css/parser/CSSParserIdioms.h:
484         * css/parser/CSSParserImpl.cpp:
485         * css/parser/CSSParserImpl.h:
486         * css/parser/CSSParserObserver.h:
487         * css/parser/CSSParserSelector.h:
488         * css/parser/CSSPropertyParserHelpers.h:
489         * css/parser/MediaQueryParser.cpp:
490         * css/parser/MediaQueryParser.h:
491         * css/parser/SizesAttributeParser.cpp:
492         * css/parser/SizesAttributeParser.h:
493         * html/BaseCheckableInputType.cpp:
494         * html/MediaController.cpp:
495         * html/track/TextTrack.cpp:
496         * html/track/TextTrackCue.cpp:
497         * html/track/VideoTrack.cpp:
498         * loader/TextTrackLoader.cpp:
499
500 2017-06-20  Miguel Gomez  <magomez@igalia.com>
501
502         [GTK] Layout Test fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html makes the subsequent test case flaky crash.
503         https://bugs.webkit.org/show_bug.cgi?id=173459
504
505         Reviewed by Carlos Garcia Campos.
506
507         When destructing the VideoTextureCopierGStreamer, ensure that there's a previous gl context before trying
508         to make it current again. There are situations where no previous context may exist, which can trigger a crash.
509         Also, add DefaultImageOrientation to the switch that handles the video frame possible orientations, as it's the
510         value used when no rotation needs to be performed, and it's currently triggering an assertion.
511
512         Covered by existent tests.
513
514         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
515         (WebCore::VideoTextureCopierGStreamer::~VideoTextureCopierGStreamer):
516         (WebCore::VideoTextureCopierGStreamer::updateTextureSpaceMatrix):
517
518 2017-06-19  Devin Rousso  <drousso@apple.com>
519
520         Web Inspector: create canvas content view and details sidebar panel
521         https://bugs.webkit.org/show_bug.cgi?id=138941
522         <rdar://problem/19051672>
523
524         Reviewed by Joseph Pecoraro.
525
526         Tests: inspector/canvas/requestContent.html
527                inspector/canvas/requestNode.html
528
529         * inspector/InspectorCanvasAgent.h:
530         * inspector/InspectorCanvasAgent.cpp:
531         (WebCore::InspectorCanvasAgent::requestNode):
532         Gets the node id of the backing canvas element.
533
534         (WebCore::InspectorCanvasAgent::requestContent):
535         Gets the current image content of the canvas.
536
537         (WebCore::InspectorCanvasAgent::frameNavigated):
538         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
539         Minor fixes from r218376 <https://webkit.org/b/172623>.
540
541         (WebCore::InspectorCanvasAgent::buildObjectForCanvas):
542         Optionally send the `nodeId` of the backing canvas element if it is available.
543
544         * inspector/InspectorInstrumentation.cpp:
545         (WebCore::InspectorInstrumentation::didCommitLoadImpl):
546
547 2017-06-19  Frederic Wang  <fwang@igalia.com>
548
549         [iOS] Always include frames in the scrolling tree when async frame scrolling is enabled
550         https://bugs.webkit.org/show_bug.cgi?id=173405
551
552         Reviewed by Simon Fraser.
553
554         Currently "async frame scrolling" is ignored on iOS. This commit changes that behavior to
555         align on macOS and is a preliminary step to implement iframe scrolling on iOS (bug 149264).
556
557         Test: compositing/iframes/compositing-for-scrollable-iframe.html
558               fast/scrolling/scrolling-tree-includes-frame.html
559
560         * rendering/RenderLayerCompositor.cpp:
561         (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame): Do not require
562         compositing when "async frame scrolling" is enabled on iOS.
563
564 2017-06-19  Frederic Wang  <fwang@igalia.com>
565
566         [Mac] Add an experimental feature setting for async frame scrolling
567         https://bugs.webkit.org/show_bug.cgi?id=173359
568
569         Reviewed by Simon Fraser.
570
571         The necessary work to use compositing for frames and include them in the scrolling tree on
572         macOS was performed in r217726 and r217730. ScrollingTreeIncludesFrames was used to
573         determine when this behavior should be enabled. However, this does not work well on iOS where
574         ScrollingTreeIncludesFrames defaults to true and really means "include the frames in the
575         scrolling tree when necessary". Hence we instead introduce a new "async frame scrolling"
576         switch to enable the behavior on macOS, which will also be used in a follow-up commit on iOS.
577         This new setting is also made an "experimental feature", so that it will be more convenient
578         for developer to try it.
579
580         Test: compositing/iframes/compositing-for-scrollable-iframe.html
581               fast/scrolling/scrolling-tree-includes-frame.html
582
583         * page/Settings.in: Declare new setting for async frame scrolling.
584         * page/scrolling/ScrollingCoordinator.cpp:
585         (WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView): Also include frames in
586         scrolling tree when async frame scrolling is enabled.
587         * rendering/RenderLayerCompositor.cpp:
588         (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame): Rely on async frame
589         scrolling to decide when compositing is needed.
590
591 2017-06-19  Zalan Bujtas  <zalan@apple.com>
592
593         AX: Remove redundant AXObjectCache::textChanged(RenderObject*).
594         https://bugs.webkit.org/show_bug.cgi?id=173579
595         <rdar://problem/32865367>
596
597         Reviewed by Antti Koivisto.
598
599         All calls go through textChanged(Node*) method.
600
601         * accessibility/AXObjectCache.cpp:
602         * accessibility/AXObjectCache.h:
603         (WebCore::AXObjectCache::getOrCreate):
604
605 2017-06-19  Darin Adler  <darin@apple.com>
606
607         Merge MediaDevicesRequest and MediaDevicesEnumerationRequest to tighten up code and object lifetime
608         https://bugs.webkit.org/show_bug.cgi?id=173527
609
610         Reviewed by Sam Weinig.
611
612         * CMakeLists.txt: Removed MediaDevicesRequest.cpp.
613
614         * Modules/mediastream/MediaDeviceInfo.cpp:
615         (WebCore::MediaDeviceInfo::MediaDeviceInfo): Removed unneeded ScriptExecutionContext.
616         (WebCore::MediaDeviceInfo::create): Ditto.
617         * Modules/mediastream/MediaDeviceInfo.h: Removed unnecessary derivation from
618         ContextDestructionObserver and ScriptExecutionContext arguments. Also removed
619         unused MediaDeviceInfoVector typedef.
620         * Modules/mediastream/MediaDeviceInfo.idl: Added ImplementationLacksVTable.
621
622         * Modules/mediastream/MediaDevices.cpp:
623         (WebCore::MediaDevices::enumerateDevices): Call MediaDevicesEnumerationRequest
624         directly here instead of going through MediaDevicesRequest.
625
626         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp: Moved code from
627         MediaDevicesRequest in here. Put the typical counts at the top of the file.
628         (WebCore::MediaDevicesEnumerationRequest::MediaDevicesEnumerationRequest):
629         Marked inline and changed to take a DOM promise directly rather than having
630         a separate class do the mapping to DOM promises.
631         (WebCore::MediaDevicesEnumerationRequest::start): Replaced the create function
632         with this. The caller doesn't actually keep a reference to the object.
633         Added a FIXME about the behavior, not new, where we neither resolve nor reject
634         the promise if there is no page object present. Updated to use the new version
635         of UserMediaController::from.
636         (WebCore::MediaDevicesEnumerationRequest::~MediaDevicesEnumerationRequest):
637         Added a FIXME about the issue that we don't resolve or reject the promise if
638         the client drops the last reference to the request without calling setDeviceInfo.
639         (WebCore::MediaDevicesEnumerationRequest::document): Added. Private helper.
640         Returns nullptr if the request is no longer active.
641         (WebCore::MediaDevicesEnumerationRequest::frame): Added. For use by a caller
642         that was getting to the frame. Uses the document function so it will return
643         nullptr if the request is no longer active.
644         (WebCore::MediaDevicesEnumerationRequest::userMediaDocumentOrigin): Changed
645         to do the work using the document function.
646         (WebCore::MediaDevicesEnumerationRequest::topLevelDocumentOrigin): Ditto.
647         (WebCore::MediaDevicesEnumerationRequest::contextDestroyed): Simplified. We
648         now can simply set a boolean when the context is destroyed, so there are no
649         side effects and the code is simpler.
650         (WebCore::removeAtypicalDevices): Renamed and tightened up the code a bit.
651         (WebCore::MediaDevicesEnumerationRequest::setDeviceInfo): Moved the code
652         here from MediaDevicesEnumerationRequest to pass the devices along.
653
654         * Modules/mediastream/MediaDevicesEnumerationRequest.h: Made the
655         ContextDestructionObserver use private inheritance. Cut down the includes
656         and removed various unneeded functions.
657
658         * Modules/mediastream/MediaDevicesRequest.cpp: Removed.
659         * Modules/mediastream/MediaDevicesRequest.h: Removed.
660
661         * Modules/mediastream/UserMediaController.cpp:
662         (WebCore::UserMediaController::UserMediaController): Use reference rather
663         than pointer for the client.
664         (WebCore::UserMediaController::~UserMediaController): Ditto.
665         (WebCore::provideUserMediaTo): Ditto.
666
667         * Modules/mediastream/UserMediaController.h:
668         Changed constructor to take a refeference, removed client function, and
669         changed data member to be a reference rather than a pointer.
670         (WebCore::UserMediaController::from): Take and return a reference rather
671         than taking a pointer that is checked for null.
672         (WebCore::UserMediaController::requestUserMediaAccess): Use reference.
673         (WebCore::UserMediaController::cancelUserMediaAccessRequest): Ditto.
674         (WebCore::UserMediaController::enumerateMediaDevices): Ditto.
675         (WebCore::UserMediaController::cancelMediaDevicesEnumerationRequest): Ditto.
676
677         * Modules/mediastream/UserMediaRequest.cpp:
678         (WebCore::UserMediaRequest::start): Updated to use the new version
679         of UserMediaController::from.
680
681         * WebCore.xcodeproj/project.pbxproj: Updated for file removals.
682
683         * testing/Internals.cpp: Removed unneeded include of UserMediaController.h.
684
685 2017-06-19  Sam Weinig  <sam@webkit.org>
686
687         [WebIDL] Move Touch related bindings in Document to their own IDL file
688         https://bugs.webkit.org/show_bug.cgi?id=173521
689
690         Reviewed by Alex Christensen.
691
692         Rather than #including in the middle of an IDL file, this moves the touch related
693         bindings in Document.idl to a new partial interface for Document in DocumentTouch.idl.
694         While here, remove the custom binding for createTouchList.
695
696         * CMakeLists.txt:
697         * DerivedSources.make:
698         * WebCore.xcodeproj/project.pbxproj:
699         Add new files.
700
701         * bindings/js/JSDocumentCustom.cpp:
702         (WebCore::JSDocument::createTouchList): Deleted.
703         Remove createTouchList. It can be generated now.
704
705         * dom/Document.cpp:
706         (WebCore::Document::createTouch): Deleted.
707         * dom/Document.h:
708         Move touch related bindings code to DocumentTouch.h/cpp.
709         Remove DocumentIOSForward as it is no longer needed.
710
711         * dom/Document.idl:
712         Move touch related bindings to DocumentTouch.idl
713         
714         * dom/DocumentTouch.h: Added.
715         * dom/DocumentTouch.cpp: Added.
716         (WebCore::DocumentTouch::createTouch):
717         Moved from Document.
718
719         (WebCore::DocumentTouch::createTouchList):
720         Added to aid generated binding.
721
722         * dom/DocumentTouch.idl: Added.
723         Moved operations from Document.h
724
725         * dom/TouchList.h:
726         (WebCore::TouchList::create):
727         (WebCore::TouchList::TouchList):
728         Added create that works with the bindings.
729
730         * dom/ios/TouchEvents.cpp:
731         Add DocumentTouchIOS.h and sort.
732
733 2017-06-19  Myles C. Maxfield  <mmaxfield@apple.com>
734
735         [Cocoa] The system Japanese font cannot be italicized
736         https://bugs.webkit.org/show_bug.cgi?id=173300
737         <rdar://problem/31805407>
738
739         Reviewed by Ryosuke Niwa.
740
741         Items in the system font cascade list may lie about whether or not they support italics.
742         In order to get the truth, we need to use the physical font underlying the font in question,
743         because this one won't lie. Then, we can interrogate this physical font about its traits
744         in order to synthesize italics correctly.
745
746         Test: fast/text/system-font-japanese-synthetic-italic.html
747
748         * platform/graphics/cocoa/FontCacheCoreText.cpp:
749         (WebCore::lookupFallbackFont):
750         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
751         (WebCore::FontFamilySpecificationCoreText::fontRanges):
752
753 2017-06-19  Daewoong Jang  <daewoong.jang@navercorp.com>
754
755         [cURL] Move file scope static variables into function scopes
756         https://bugs.webkit.org/show_bug.cgi?id=173567
757
758         Reviewed by Alex Christensen.
759
760         * platform/network/curl/SSLHandle.cpp:
761         (WebCore::allowedHosts):
762         (WebCore::allowedClientHosts):
763         (WebCore::allowsAnyHTTPSCertificateHosts):
764         (WebCore::addAllowedClientCertificate):
765         (WebCore::setSSLClientCertificate):
766         (WebCore::sslIgnoreHTTPSCertificate):
767         (WebCore::certVerifyCallback):
768
769 2017-06-19  Darin Adler  <darin@apple.com>
770
771         [Cocoa] implement URLSession:task:needNewBodyStream: delegate method
772         https://bugs.webkit.org/show_bug.cgi?id=173551
773         rdar://problem/32250512
774
775         Reviewed by Alex Christensen.
776
777         Covered by http/tests/misc/form-blob-challenge.html
778
779         * WebCore.xcodeproj/project.pbxproj: Removed NSURLRequestSPI.h.
780
781         * platform/network/cf/FormDataStreamCFNet.cpp:
782         (WebCore::createHTTPBodyCFReadStream): Factored this out from setHTTPBody.
783         (WebCore::setHTTPBody): Factored out the function above.
784         * platform/network/cf/FormDataStreamCFNet.h: Added createHTTPBodyCFReadStream.
785
786         * platform/network/cocoa/ResourceRequestCocoa.mm: Use CFNetworkSPI.h.
787         * platform/network/ios/ResourceRequestIOS.mm: Ditto.
788
789         * platform/network/mac/FormDataStreamMac.h: Added createHTTPBodyNSInputStream.
790         * platform/network/mac/FormDataStreamMac.mm:
791         (WebCore::createHTTPBodyNSInputStream): Added/
792
793         * platform/network/mac/ResourceHandleMac.mm: Use CFNetworkSPI.h.
794         * platform/network/mac/ResourceRequestMac.mm: Ditto.
795         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm: Ditto.
796         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: Ditto.
797
798         * platform/network/mac/WebCoreURLResponse.h: Moved SPI declarations from
799         here into CFNetworkSPI.h.
800
801         * platform/spi/cf/CFNetworkSPI.h: Use #pragma once, consolidated SPI that was
802         defined in scattered locations.
803
804         * platform/spi/cocoa/NSURLRequestSPI.h: Removed. Superceded by CFNetworkSPI.h.
805
806 2017-06-19  Brady Eidson  <beidson@apple.com>
807
808         Various IndexedDB crashes as an after effect of previous test.
809         <rdar://problem/31418761> and https://bugs.webkit.org/show_bug.cgi?id=170436
810
811         Reviewed by Chris Dumez.
812
813         No new test (No consistent test possible, in practice covered by all existing IDB tests)
814
815         This is timing related, where a UniqueIDBDatabase can be destroyed on the main thread while
816         it still has one task left to try to execute on the IDBServer thread.
817         
818         The background thread tasks don't Ref<> the UniqueIDBDatabase, so even though task execution
819         took a Ref<> protector, there was still a small window for a race.
820         
821         Should be closed up by making the background thread tasks themselves protect this.
822         
823         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
824         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask):
825         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply):
826         (WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTask):
827         (WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTaskReply):
828         * Modules/indexeddb/server/UniqueIDBDatabase.h:
829
830 2017-06-19  Sam Weinig  <sam@webkit.org>
831
832         [WebIDL] Add support for serializers that have members that are themselves serializers (or inherit being a serializer from a parent)
833         https://bugs.webkit.org/show_bug.cgi?id=173395
834
835         Reviewed by Simon Fraser.
836
837         Test: fast/css/DOMQuad-serialization.html
838
839         * bindings/scripts/CodeGenerator.pm:
840         (InheritsSerializable):
841         Helper to determine if an interface inherits from any interfaces
842         that are serializable. This is necessary because an attribute is
843         serializable even if its interface is not marked as serializable. 
844
845         (IsSerializableAttribute):
846         Check ancestor interfaces as well to determine serializability.
847
848         * bindings/scripts/CodeGeneratorJS.pm:
849         (GenerateSerializerDefinition):
850         Specialize attributes that are serializable interfaces to call its interfaces
851         serialize function, thus allowing nested objects to be serialized.
852
853         * dom/DOMQuad.idl:
854         Add serializer.
855
856         * bindings/scripts/test/JS/JSTestSerialization.cpp:
857         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: Added.
858         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.h: Added.
859         * bindings/scripts/test/TestSerialization.idl:
860         * bindings/scripts/test/TestSerializationIndirectInheritance.idl: Added.
861         Add and update tests.
862
863 2017-06-19  Commit Queue  <commit-queue@webkit.org>
864
865         Unreviewed, rolling out r218505.
866         https://bugs.webkit.org/show_bug.cgi?id=173563
867
868         "It would break internal builds" (Requested by youenn on
869         #webkit).
870
871         Reverted changeset:
872
873         "[WebRTC] Prevent capturing at unconventional resolutions when
874         using the SW encoder on Mac"
875         https://bugs.webkit.org/show_bug.cgi?id=172602
876         http://trac.webkit.org/changeset/218505
877
878 2017-06-19  Zalan Bujtas  <zalan@apple.com>
879
880         Opening certain mails brings up a mail that grows indefinitely.
881         https://bugs.webkit.org/show_bug.cgi?id=173562
882         <rdar://problem/32766579>
883
884         Reviewed by Tim Horton.
885
886         This reverts the logic where m_autoSizeContentSize always reflects the final layout's.
887         When the ICB's height is 100%, it causes infinite recursion.
888         See also webkit.org/b/173561.
889
890         * page/FrameView.cpp:
891         (WebCore::FrameView::autoSizeIfEnabled):
892
893 2017-06-19  Wenson Hsieh  <wenson_hsieh@apple.com>
894
895         [iOS DnD] Support .zip archives for file uploads via drag and drop
896         https://bugs.webkit.org/show_bug.cgi?id=173511
897         <rdar://problem/32521025>
898
899         Reviewed by Tim Horton.
900
901         Allows dropped .zip archives to be uploaded as files by accepting types conforming to either
902         "public.zip-archive" or "public.content" as potential file types. Initially, I opted to accept the more general
903         "public.data" type; however, this includes UTIs such as "public.url" that should not be represented as files, so
904         this is a more targeted fix that allows us to very easily add additional content types in the future by adding
905         more types to supportedFileUploadPasteboardTypes.
906
907         Tests:
908         DataInteractionTests.ExternalSourceZIPArchiveToUploadArea
909         DataInteractionTests.ExternalSourceZIPArchiveAndURLToSingleFileInput
910
911         * page/mac/DragControllerMac.mm:
912         (WebCore::DragController::updateSupportedTypeIdentifiersForDragHandlingMethod):
913         * platform/Pasteboard.h:
914         * platform/ios/PasteboardIOS.mm:
915         (WebCore::Pasteboard::read):
916         (WebCore::Pasteboard::supportedWebContentPasteboardTypes):
917         (WebCore::Pasteboard::supportedFileUploadPasteboardTypes):
918
919         Rename supportedPasteboardTypes to supportedWebContentPasteboardTypes, and also introduce
920         supportedFileUploadPasteboardTypes which returns an list of types, such that if a type conforms to any type in
921         this array, that type may be represented as a file. So far, this list contains "public.content" and
922         "public.zip-archive".
923
924         (WebCore::Pasteboard::types):
925         (WebCore::Pasteboard::supportedPasteboardTypes): Deleted.
926         * platform/ios/WebItemProviderPasteboard.mm:
927         (typeConformsToTypes):
928
929         Remove -typeIsAppropriateForSupportedTypes: and replace it with typeConformsToTypes. Use this both when
930         determining the number of files on the pasteboard, and when determining preferred UTIs to load when dropping.
931
932         (-[WebItemProviderPasteboard numberOfFiles]):
933         (-[WebItemProviderPasteboard typeIdentifierToLoadForRegisteredTypeIdentfiers:]):
934         (-[WebItemProviderPasteboard typeIsAppropriateForSupportedTypes:]): Deleted.
935         * platform/mac/DragDataMac.mm:
936         (WebCore::DragData::containsFiles):
937         * platform/mac/PasteboardMac.mm:
938         (WebCore::Pasteboard::supportedFileUploadPasteboardTypes):
939
940 2017-06-19  Sam Weinig  <sam@webkit.org>
941
942         [WebIDL] Remove custom binding for Document.getCSSCanvasContext()
943         https://bugs.webkit.org/show_bug.cgi?id=173516
944
945         Reviewed by Chris Dumez.
946
947         * bindings/js/JSDocumentCustom.cpp:
948         (WebCore::JSDocument::visitAdditionalChildren):
949         (WebCore::JSDocument::getCSSCanvasContext): Deleted.
950         * dom/Document.cpp:
951         (WebCore::Document::getCSSCanvasContext):
952         * dom/Document.h:
953         * dom/Document.idl:
954         Use a Variant to pass the context and type to the bindings.
955
956 2017-06-19  Youenn Fablet  <youenn@apple.com>
957
958         [WebRTC] Prevent capturing at unconventional resolutions when using the SW encoder on Mac
959         https://bugs.webkit.org/show_bug.cgi?id=172602
960         <rdar://problem/32407693>
961
962         Reviewed by Eric Carlson.
963
964         Test: platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html
965
966         Add internal API to switch on/off hardware H264 encoder.
967         Add checks for standard size. If using a software encoder and frame size is not standard,
968         the session is destroyed and no frame is sent at all.
969
970         Added tests based on captureStream.
971         Fixed the case of capturing a canvas which size is changing.
972
973         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
974         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized):
975         * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.h:
976         * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm:
977         (WebCore::H264VideoToolboxEncoder::setHardwareEncoderForWebRTCAllowed):
978         (WebCore::H264VideoToolboxEncoder::hardwareEncoderForWebRTCAllowed):
979         (WebCore::isUsingSoftwareEncoder):
980         (WebCore::H264VideoToolboxEncoder::CreateCompressionSession):
981         (isStandardFrameSize): Added.
982         (isUsingSoftwareEncoder): Added.
983         * testing/Internals.cpp:
984         (WebCore::Internals::setH264HardwareEncoderAllowed):
985         * testing/Internals.h:
986         * testing/Internals.idl:
987
988 2017-06-19  Brady Eidson  <beidson@apple.com>
989
990         Cleanup IconLoader stuff when a DocumentLoader detaches from its frame.
991         <rdar://problem/31418761> and https://bugs.webkit.org/show_bug.cgi?id=173473
992
993         Reviewed by Alex Christensen.
994
995         No new tests (No known change in behavior)
996
997         I discovered the need to make these changes here due to a transient bug
998         introduced in r218015 but already explicitly fixed in r218409.
999         
1000         This change adds an assert to guard against a detached DocumentLoader having active IconLoaders.
1001
1002         It also clears out all pending IconLoader and icon load decisions when stopLoading() is called, 
1003         as even attempting to start an icon load after detachment is a waste of cycles.
1004         
1005         * loader/DocumentLoader.cpp:
1006         (WebCore::DocumentLoader::stopLoading): Also explicitly clear all IconLoaders and icons pending
1007           load decision.
1008         (WebCore::DocumentLoader::finishedLoadingIcon): Assert that this DocumentLoader is not detached.
1009
1010 2017-06-19  Chris Dumez  <cdumez@apple.com>
1011
1012         Use WTF::Function instead of std::function in more places in WebCore/
1013         https://bugs.webkit.org/show_bug.cgi?id=173535
1014
1015         Reviewed by Antti Koivisto.
1016
1017         Use WTF::Function instead of std::function in more places in WebCore/ to avoid copying.
1018
1019         * accessibility/AccessibilityObject.cpp:
1020         (WebCore::AccessibilityObject::matchedParent):
1021         * accessibility/AccessibilityObject.h:
1022         * animation/DocumentAnimation.cpp:
1023         (WebCore::DocumentAnimation::getAnimations):
1024         * animation/DocumentAnimation.h:
1025         (WebCore::DocumentAnimation::getAnimations):
1026         * contentextensions/CombinedURLFilters.cpp:
1027         (WebCore::ContentExtensions::CombinedURLFilters::processNFAs):
1028         * contentextensions/CombinedURLFilters.h:
1029         * contentextensions/DFACombiner.cpp:
1030         (WebCore::ContentExtensions::DFACombiner::combineDFAs):
1031         * contentextensions/DFACombiner.h:
1032         * css/CSSCrossfadeValue.cpp:
1033         (WebCore::CSSCrossfadeValue::traverseSubresources):
1034         * css/CSSCrossfadeValue.h:
1035         * css/CSSFilterImageValue.cpp:
1036         (WebCore::CSSFilterImageValue::traverseSubresources):
1037         * css/CSSFilterImageValue.h:
1038         * css/CSSFontFaceSrcValue.cpp:
1039         (WebCore::CSSFontFaceSrcValue::traverseSubresources):
1040         * css/CSSFontFaceSrcValue.h:
1041         * css/CSSImageSetValue.cpp:
1042         (WebCore::CSSImageSetValue::traverseSubresources):
1043         * css/CSSImageSetValue.h:
1044         * css/CSSImageValue.cpp:
1045         (WebCore::CSSImageValue::traverseSubresources):
1046         * css/CSSImageValue.h:
1047         * css/CSSValue.cpp:
1048         (WebCore::CSSValue::traverseSubresources):
1049         * css/CSSValue.h:
1050         * css/CSSValueList.cpp:
1051         (WebCore::CSSValueList::traverseSubresources):
1052         * css/CSSValueList.h:
1053         * css/StyleProperties.cpp:
1054         (WebCore::StyleProperties::traverseSubresources):
1055         * css/StyleProperties.h:
1056         * css/StyleSheetContents.cpp:
1057         (WebCore::traverseSubresourcesInRules):
1058         (WebCore::StyleSheetContents::traverseSubresources):
1059         * css/StyleSheetContents.h:
1060         * dom/Element.cpp:
1061         (WebCore::Element::getAnimations):
1062         * editing/TextIterator.cpp:
1063         (WebCore::findPlainTextMatches):
1064         (WebCore::findClosestPlainText):
1065         (WebCore::findPlainText):
1066         * editing/mac/DictionaryLookup.h:
1067         * editing/mac/DictionaryLookup.mm:
1068         (WebCore::showPopupOrCreateAnimationController):
1069         (WebCore::DictionaryLookup::showPopup):
1070         (WebCore::DictionaryLookup::animationControllerForPopup):
1071         * fileapi/AsyncFileStream.cpp:
1072         (WebCore::AsyncFileStream::perform):
1073         (WebCore::AsyncFileStream::getSize):
1074         (WebCore::AsyncFileStream::openForRead):
1075         (WebCore::AsyncFileStream::read):
1076         * fileapi/AsyncFileStream.h:
1077         * html/HTMLMediaElement.cpp:
1078         (WebCore::HTMLMediaElement::waitForPreparedForInlineThen):
1079         (WebCore::HTMLMediaElement::setVideoFullscreenLayer):
1080         * html/HTMLMediaElement.h:
1081         (WebCore::HTMLMediaElement::waitForPreparedForInlineThen):
1082         (WebCore::HTMLMediaElement::setVideoFullscreenLayer):
1083         * loader/EmptyClients.cpp:
1084         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
1085         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1086         (WebCore::EmptyFrameLoaderClient::dispatchWillSubmitForm):
1087         * loader/FrameLoaderClient.h:
1088         * loader/archive/cf/LegacyWebArchive.cpp:
1089         (WebCore::LegacyWebArchive::create):
1090         * loader/archive/cf/LegacyWebArchive.h:
1091         * loader/cache/MemoryCache.cpp:
1092         (WebCore::MemoryCache::forEachResource):
1093         (WebCore::MemoryCache::forEachSessionResource):
1094         * loader/cache/MemoryCache.h:
1095         * page/DOMWindow.cpp:
1096         (WebCore::DOMWindow::createWindow):
1097         (WebCore::DOMWindow::showModalDialog):
1098         * page/DOMWindow.h:
1099         * page/FrameView.cpp:
1100         (WebCore::FrameView::applyRecursivelyWithVisibleRect):
1101         * page/FrameView.h:
1102         * page/Page.cpp:
1103         (WebCore::Page::forEachPage):
1104         (WebCore::Page::decrementNestedRunLoopCount):
1105         (WebCore::Page::whenUnnested):
1106         * page/Page.h:
1107         * page/WheelEventTestTrigger.cpp:
1108         (WebCore::WheelEventTestTrigger::clearAllTestDeferrals):
1109         (WebCore::WheelEventTestTrigger::setTestCallbackAndStartNotificationTimer):
1110         (WebCore::WheelEventTestTrigger::triggerTestTimerFired):
1111         * page/WheelEventTestTrigger.h:
1112         * page/WindowFeatures.cpp:
1113         (WebCore::processFeaturesString):
1114         * page/WindowFeatures.h:
1115         * page/cocoa/ResourceUsageOverlayCocoa.mm:
1116         (WebCore::RingBuffer::forEach):
1117         * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
1118         (WebCore::WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer):
1119         (WebCore::WebVideoFullscreenModelVideoElement::waitForPreparedForInlineThen):
1120         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
1121         (WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer):
1122         (WebVideoFullscreenModelVideoElement::waitForPreparedForInlineThen):
1123         * platform/graphics/MediaPlayer.cpp:
1124         (WebCore::MediaPlayer::setVideoFullscreenLayer):
1125         * platform/graphics/MediaPlayer.h:
1126         (WebCore::MediaPlayer::setVideoFullscreenLayer):
1127         * platform/graphics/MediaPlayerPrivate.h:
1128         (WebCore::MediaPlayerPrivateInterface::setVideoFullscreenLayer):
1129         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1130         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1131         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
1132         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1133         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1134         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
1135         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1136         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1137         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer):
1138         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h:
1139         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
1140         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer):
1141
1142 2017-06-19  Chris Dumez  <cdumez@apple.com>
1143
1144         Use WTF::Function instead of std::function in WebCore/Modules
1145         https://bugs.webkit.org/show_bug.cgi?id=173534
1146
1147         Reviewed by Alex Christensen.
1148
1149         Use WTF::Function instead of std::function in WebCore/Modules to avoid
1150         copying.
1151
1152         * Modules/applepay/PaymentCoordinatorClient.h:
1153         * Modules/encryptedmedia/CDM.h:
1154         * Modules/encryptedmedia/legacy/LegacyCDM.cpp:
1155         (WebCore::CDMFactory::CDMFactory):
1156         (WebCore::CDM::registerCDMFactory):
1157         * Modules/encryptedmedia/legacy/LegacyCDM.h:
1158         * Modules/mediasession/MediaSession.cpp:
1159         (WebCore::MediaSession::changeActiveMediaElements):
1160         (WebCore::MediaSession::safelyIterateActiveMediaElements):
1161         * Modules/mediasession/MediaSession.h:
1162         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1163         (WebCore::matchTransceiver):
1164         * Modules/mediastream/MediaStreamRegistry.cpp:
1165         (WebCore::MediaStreamRegistry::forEach):
1166         * Modules/mediastream/MediaStreamRegistry.h:
1167
1168 2017-06-19  Youenn Fablet  <youenn@apple.com>
1169
1170         A cloned MediaStreamTrack should mute independently other tracks using the same source
1171         https://bugs.webkit.org/show_bug.cgi?id=172831
1172         <rdar://problem/32518527>
1173
1174         Reviewed by Eric Carlson.
1175
1176         Test: webrtc/clone-audio-track.html
1177
1178         Move enabled handling in MediaStreamTrackPrivate instead of RealtimeMediaSource.
1179         Move WebRTC and WebAudio customers of RealtimeMediaSource to MediaStreamTrackPrivate.
1180         Move creation of WebAudio provider to MediaStreamTrackPrivate.
1181
1182         This allows changing some parameters of tracks having the same source independently.
1183         Using this for enabled track attribute.
1184
1185         We no longer stop generating frames in case track is disabled.
1186         This should be added back as an optimization in a follow-up.
1187
1188         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1189         (WebCore::LibWebRTCMediaEndpoint::addTrack):
1190         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1191         (WebCore::LibWebRTCPeerConnectionBackend::replaceTrack):
1192         * Modules/webaudio/MediaStreamAudioSource.cpp:
1193         * Modules/webaudio/MediaStreamAudioSource.h:
1194         * WebCore.xcodeproj/project.pbxproj:
1195         * platform/mediastream/MediaStreamTrackPrivate.cpp:
1196         (WebCore::MediaStreamTrackPrivate::create):
1197         (WebCore::MediaStreamTrackPrivate::~MediaStreamTrackPrivate):
1198         (WebCore::MediaStreamTrackPrivate::setEnabled):
1199         (WebCore::MediaStreamTrackPrivate::audioSourceProvider):
1200         (WebCore::MediaStreamTrackPrivate::videoSampleAvailable):
1201         (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
1202         * platform/mediastream/MediaStreamTrackPrivate.h:
1203         (WebCore::MediaStreamTrackPrivate::Observer::audioSamplesAvailable):
1204         * platform/mediastream/RealtimeMediaSource.cpp:
1205         (WebCore::RealtimeMediaSource::removeObserver):
1206         * platform/mediastream/RealtimeMediaSource.h:
1207         * platform/mediastream/mac/AVMediaCaptureSource.h:
1208         * platform/mediastream/mac/AVMediaCaptureSource.mm:
1209         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1210         (WebCore::CoreAudioCaptureSource::startProducingData):
1211         (WebCore::CoreAudioCaptureSource::stopProducingData):
1212         * platform/mediastream/mac/CoreAudioCaptureSource.h:
1213         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
1214         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
1215         (WebCore::MockRealtimeAudioSourceMac::render):
1216         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
1217         (WebCore::RealtimeIncomingAudioSource::~RealtimeIncomingAudioSource):
1218         (WebCore::RealtimeIncomingAudioSource::OnData):
1219         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
1220         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
1221         (WebCore::RealtimeIncomingVideoSource::pixelBufferFromVideoFrame):
1222         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1223         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
1224         (WebCore::RealtimeOutgoingAudioSource::setSource):
1225         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1226         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1227         (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
1228         (WebCore::RealtimeOutgoingVideoSource::setSource):
1229         (WebCore::RealtimeOutgoingVideoSource::initializeFromSource):
1230         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
1231         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
1232         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
1233         (WebCore::WebAudioSourceProviderAVFObjC::create):
1234         (WebCore::WebAudioSourceProviderAVFObjC::WebAudioSourceProviderAVFObjC):
1235         (WebCore::WebAudioSourceProviderAVFObjC::setClient):
1236         (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):
1237         * platform/mock/MockRealtimeVideoSource.cpp:
1238         (WebCore::MockRealtimeVideoSource::generateFrame):
1239         * platform/spi/cocoa/PassKitSPI.h:
1240
1241 2017-06-19  Sam Weinig  <sam@webkit.org>
1242
1243         [WebIDL] Properly model buffer source / typed arrays as their own IDL types
1244         https://bugs.webkit.org/show_bug.cgi?id=173513
1245
1246         Reviewed by Alex Christensen.
1247
1248         - Adds IDL type hierarchy for buffer source types.
1249         - Includes a special type, IDLArrayBufferView, which WebIDL defines as the union
1250           of DataView and all the typed array types, but we model as shared base class.
1251           This should not be observable, and allows us to avoid using a Variant for ArrayBufferView
1252           and instead use the existing base class.
1253         - Add builtin typedefs for BufferSource and DOMTimeStamp as defined in WebIDL. As noted
1254           above, rather than define a typedef of ArrayBufferView that maps to a union, we treat
1255           it as a special type.
1256
1257         * bindings/IDLTypes.h:
1258         Add type hierarchy for buffer source types.
1259         - IDLBufferSource is the root
1260         - IDLArrayBuffer, IDLArrayBufferView, IDLDataView, IDLTypedArray derive from it.
1261         - And then the specific typed array types derive from IDLTypedArray, and are defined
1262           in JSDOMConvertBufferSource so we don't have to include a ton of typed array includes
1263           in this file, as they cannot be forward declared.
1264
1265         * bindings/js/JSDOMConvertBufferSource.h:
1266         (WebCore::Detail::BufferSourceConverter::convert):
1267         (WebCore::Converter<IDLArrayBuffer>::convert):
1268         (WebCore::JSConverter<IDLArrayBuffer>::convert):
1269         (WebCore::Converter<IDLDataView>::convert):
1270         (WebCore::JSConverter<IDLDataView>::convert):
1271         (WebCore::Converter<IDLInt8Array>::convert):
1272         (WebCore::JSConverter<IDLInt8Array>::convert):
1273         (WebCore::Converter<IDLInt16Array>::convert):
1274         (WebCore::JSConverter<IDLInt16Array>::convert):
1275         (WebCore::Converter<IDLInt32Array>::convert):
1276         (WebCore::JSConverter<IDLInt32Array>::convert):
1277         (WebCore::Converter<IDLUint8Array>::convert):
1278         (WebCore::JSConverter<IDLUint8Array>::convert):
1279         (WebCore::Converter<IDLUint16Array>::convert):
1280         (WebCore::JSConverter<IDLUint16Array>::convert):
1281         (WebCore::Converter<IDLUint32Array>::convert):
1282         (WebCore::JSConverter<IDLUint32Array>::convert):
1283         (WebCore::Converter<IDLUint8ClampedArray>::convert):
1284         (WebCore::JSConverter<IDLUint8ClampedArray>::convert):
1285         (WebCore::Converter<IDLFloat32Array>::convert):
1286         (WebCore::JSConverter<IDLFloat32Array>::convert):
1287         (WebCore::Converter<IDLFloat64Array>::convert):
1288         (WebCore::JSConverter<IDLFloat64Array>::convert):
1289         (WebCore::Converter<IDLArrayBufferView>::convert):
1290         (WebCore::JSConverter<IDLArrayBufferView>::convert):
1291         Add native and javascript conversion for all the new types.
1292
1293         * bindings/js/JSDOMConvertUnion.h:
1294         Add support for steps 7, 8, and 9 of the union conversion algorithm now that
1295         buffer source types are properly modeled.
1296
1297         * bindings/js/JSSubtleCryptoCustom.cpp:
1298         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
1299         Replace use of now repurposed IDLBufferSource, with its definition, IDLUnion<IDLArrayBufferView, IDLArrayBuffer>.
1300
1301         * bindings/scripts/CodeGenerator.pm:
1302         (IsBufferSourceType):
1303         Renamed from IsTypedArrayType.
1304
1305         (IsNonPointerType): Deleted.
1306         Was only used by DumpRenderTree and WebKitTestRunner generators. They have 
1307         been switched to the equivalent IsPrimitiveType.
1308
1309         (IsTypedArrayType): Deleted.
1310         Renamed to IsBufferSourceType.
1311
1312         (IsRefPtrType): Deleted. Unused.
1313
1314         * bindings/scripts/CodeGeneratorJS.pm:
1315         (AddToIncludesForIDLType):
1316         (AddClassForwardIfNeeded):
1317         (GetArgumentExceptionFunction):
1318         (GetAttributeExceptionFunction):
1319         (PassArgumentExpression):
1320         (GenerateDefaultValue):
1321         (GenerateOverloadDispatcher):
1322         (ShouldPassArgumentByReference):
1323         (NativeToJSValueDOMConvertNeedsState):
1324         (NativeToJSValueDOMConvertNeedsGlobalObject):
1325         Update for rename of IsTypedArrayType -> IsBufferSourceType and remove specialized BufferSource
1326         condition.
1327
1328         (GetBaseIDLType):
1329         Add mappings for new buffer source types.
1330
1331         * bindings/scripts/IDLParser.pm:
1332         (Parse):
1333         Insert builtin typedefs to the typedef map before parsing.
1334
1335         (addBuiltinTypedefs):
1336         Generate typedefs for BufferSource and DOMTimeStamp as specified by WebIDL.
1337
1338         (applyTypedefs):
1339         Add support for applying typedefs to iterable and maplike, necessary now because BufferSource
1340         is used as the key to iterable in MediaKeyStatusMap.idl
1341
1342         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
1343         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
1344         * bindings/scripts/test/JS/JSTestObj.cpp:
1345         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1346         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1347         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
1348         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.h:
1349         Update test results.
1350
1351         * bindings/scripts/test/TestTypedefs.idl:
1352         Add tests for builtin typedefs.
1353
1354         * Modules/geolocation/Geoposition.idl:
1355         * dom/Event.idl:
1356         * fileapi/Blob.idl:
1357         * fileapi/File.idl:
1358         * page/FrameView.h:
1359         * xml/XMLHttpRequest.idl:
1360         Remove typedef for DOMTimeStamp and BufferSource which are now automatically included.
1361
1362 2017-06-19  Adrian Perez de Castro  <aperez@igalia.com>
1363
1364         Missing <functional> includes make builds fail with GCC 7.x
1365         https://bugs.webkit.org/show_bug.cgi?id=173544
1366
1367         Unreviewed gardening.
1368
1369         Fix compilation with GCC 7.
1370
1371         * Modules/mediastream/MediaStreamRegistry.h:
1372         * animation/DocumentAnimation.h:
1373         * page/WheelEventTestTrigger.h:
1374         * page/csp/ContentSecurityPolicy.h:
1375         * platform/Timer.h:
1376         * platform/graphics/gstreamer/MainThreadNotifier.h:
1377         * platform/network/NetworkStorageSession.h:
1378
1379 2017-06-19  Zan Dobersek  <zdobersek@igalia.com>
1380
1381         Unreviewed build fix after r218484.
1382
1383         Properly access the GCryptCipherOperation type (now CipherOperation)
1384         in the PAL::GCrypt namespace. This somehow worked in local builds.
1385
1386         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
1387         (WebCore::callOperation):
1388         (WebCore::gcryptAES_CTR):
1389
1390 2017-06-19  Zan Dobersek  <zdobersek@igalia.com>
1391
1392         [GCrypt] AES_CTR support
1393         https://bugs.webkit.org/show_bug.cgi?id=171420
1394
1395         Reviewed by Michael Catanzaro.
1396
1397         Implement AES_CTR support for build configurations that use libgcrypt.
1398
1399         Both encryption and decryption operations are handled in a single gcryptAES_CTR() function,
1400         with the specific operation being passed as the first argument. The appropriate AES
1401         algorithm is picked, and a gcry_cipher_hd_t object is created and has the given key set.
1402         This key will remain the same throughout the gcry_cipher_hd_t lifetime, even after
1403         gcry_cipher_reset() calls.
1404
1405         The encrypt/decrypt operation is wrapped into a helper lambda functor that accepts the
1406         given counter and input data. It resets the cipher object, sets the counter data, and
1407         performs the specified operation, returning the output data.
1408
1409         libgcrypt doesn't support setting counter data on a gcry_cipher_hd_t object with only
1410         part of that data being used as the actual counter, with the rest acting as a nonce, like
1411         the Web Crypto specification allows. We have to implement the support for that on our own.
1412
1413         We compute the number of blocks we'll be processing and the upper exclusive limit for the
1414         given counter length. We immediately bail if the counter limit is less than the computed
1415         block count, since that would mean that the counter values would be repeated.
1416
1417         We short-cut to a direct operation call if the counter length matches size of the counter
1418         data -- we don't have to adjust the counter data in any way if that's the case.
1419
1420         Otherwise we move counter data into the MPI format. The nonce and the actual counter MPIs
1421         can split out of the counter data MPI with the modulus operation and the counter limit MPI.
1422
1423         We take another shortcut straight to the operation call if we're able to determine that the
1424         'counter leeway' value, i.e. the difference between the initial counter MPI and the counter
1425         limit MPI, is larger or equal to the predicted block size -- if that's the case, the counter
1426         won't wrap around and change the nonce data.
1427
1428         In worst-case scenario the counter data will wrap around and we have to address that. The
1429         current implementation takes the slowest possible path for the moment, encrypting/decrypting
1430         each block separately. For each step the counter is combined with the nonce, the resulting
1431         MPI data retrieved and passed to the operation function, and the returned block output
1432         appended to the final output vector. The counter MPI is then incremented and ran through the
1433         modulus operation, limiting the MPI value to the previously-computed counter limit.
1434
1435         No new tests -- relevant tests are passing and are unskipped.
1436
1437         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
1438         (WebCore::callOperation):
1439         (WebCore::gcryptAES_CTR):
1440         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
1441         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
1442
1443 2017-05-14 Frederic Wang  <fwang@igalia.com>
1444
1445         Add heuristic to avoid flattening "fullscreen" iframes
1446         https://bugs.webkit.org/show_bug.cgi?id=171914
1447
1448         Reviewed by Simon Fraser.
1449
1450         Some authors implement fullscreen popups as out-of-flow iframes with size set to full viewport (using vw/vh CSS units).
1451         When iframe flattening is enabled, such iframes may unexpectedly become larger than the viewport.
1452         This commit adds a simple heuristic to avoid frame flattening in that case.
1453         It is experimented by introducing a "enable for non-fullscreen iframes" state for the frame
1454         flattening setting.
1455         The default frame flattening is still either disabled or (fully) enabled on all platforms.
1456         InternalSettings is also adjusted so that the tests can still set the frame flattening setting.
1457
1458         Test: fast/frames/flattening/iframe-flattening-fullscreen.html
1459
1460         * page/FrameView.cpp:
1461         (WebCore::FrameView::frameFlatteningEnabled): Use the frame flattening enum setting.
1462         * page/Settings.h: Define a frame flattening enum that includes a "enable for non-fullscreen
1463         iframes" state.
1464         * page/Settings.in: Redefine frame flattening using that enum.
1465         * rendering/RenderFrameSet.cpp:
1466         (WebCore::RenderFrameSet::flattenFrameSet): Use the frame flattening enum setting.
1467         * rendering/RenderIFrame.cpp:
1468         (WebCore::RenderIFrame::isFullScreenIFrame): Add a heuristic when partial frame flattening
1469         is enabled setting is enabled.
1470         There is not a strict comparison against the viewport size since authors may not exactly use
1471         100vw/100vh.
1472         Anyway, it is hard to do such comparison using the resolved width & height on RenderStyle.
1473         (WebCore::RenderIFrame::flattenFrame): Add a comment for the existing "zero size" heuristic.
1474         Use isFullScreenIFrame heuristic.
1475         * rendering/RenderView.cpp:
1476         (WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower): Use the frame flattening enum setting.
1477         * testing/InternalSettings.cpp:
1478         (WebCore::InternalSettings::Backup::Backup): Add backup for frame flattening.
1479         (WebCore::InternalSettings::Backup::restoreTo): Ditto.
1480         (WebCore::internalSettingsToWebCoreValue): Helper function to cast the frame flattening values.
1481         (WebCore::InternalSettings::setFrameFlattening): Redefine setFrameFlattening to accept an enum.
1482         * testing/InternalSettings.h: Define new enum & setter for frame flattening as well as a backup value.
1483         * testing/InternalSettings.idl: Define new enum & setter for frame flattening.
1484
1485 2017-06-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1486
1487         REGRESSION(r218253): Infinite animated gifs no longer loop
1488         https://bugs.webkit.org/show_bug.cgi?id=173464
1489
1490         Reviewed by Carlos Alberto Lopez Perez.
1491
1492         After the first loop iteration we keep rendering the same frame all the time, so it looks like if the animation
1493         stopped. This is because in r218253 we changed to use SharedBuffer instead of a Vector in ImageBackingStore, but
1494         we are not correctly copying the data in the copy constructor. We are using SharedBuffer::copy() that doesn't
1495         actually copy the data of the segments.
1496
1497         * platform/graphics/ImageBackingStore.h:
1498         (WebCore::ImageBackingStore::ImageBackingStore): Copy the data of the other SharedBuffer.
1499
1500 2017-06-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1501
1502         [GStreamer] MainThreadNotifier ASSERTION FAILED: m_boundThread == currentThread() in _WebKitWebSrcPrivate::~_WebKitWebSrcPrivate
1503         https://bugs.webkit.org/show_bug.cgi?id=152043
1504
1505         Reviewed by Xabier Rodriguez-Calvar.
1506
1507         Stop using a WeakPtr in MainThreadNotifier, because it's not thread safe, which causes a crash in debug builds when
1508         the notifier is destroyed in a different thread. Make MainThreadNotifier thread safe refcounted instead, and add
1509         an invalidate() method to mark it as invalid.
1510
1511         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
1512         (WebCore::InbandTextTrackPrivateGStreamer::handleSample):
1513         (WebCore::InbandTextTrackPrivateGStreamer::streamChanged):
1514         * platform/graphics/gstreamer/MainThreadNotifier.h:
1515         (WebCore::MainThreadNotifier::MainThreadNotifier): Deleted.
1516         (WebCore::MainThreadNotifier::notify): Deleted.
1517         (WebCore::MainThreadNotifier::cancelPendingNotifications): Deleted.
1518         (WebCore::MainThreadNotifier::addPendingNotification): Deleted.
1519         (WebCore::MainThreadNotifier::removePendingNotification): Deleted.
1520         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1521         (WebCore::MediaPlayerPrivateGStreamer::videoChangedCallback):
1522         (WebCore::MediaPlayerPrivateGStreamer::videoSinkCapsChangedCallback):
1523         (WebCore::MediaPlayerPrivateGStreamer::audioChangedCallback):
1524         (WebCore::MediaPlayerPrivateGStreamer::textChangedCallback):
1525         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1526         (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
1527         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
1528         (WebCore::MediaPlayerPrivateGStreamerBase::volumeChangedCallback):
1529         (WebCore::MediaPlayerPrivateGStreamerBase::muteChangedCallback):
1530         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
1531         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1532         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
1533         (WebCore::TrackPrivateBaseGStreamer::TrackPrivateBaseGStreamer):
1534         (WebCore::TrackPrivateBaseGStreamer::~TrackPrivateBaseGStreamer):
1535         (WebCore::TrackPrivateBaseGStreamer::disconnect):
1536         (WebCore::TrackPrivateBaseGStreamer::activeChangedCallback):
1537         (WebCore::TrackPrivateBaseGStreamer::tagsChanged):
1538         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
1539         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1540         (webkit_web_src_init):
1541         (webKitWebSrcDispose):
1542         (webKitWebSrcStop):
1543         (webKitWebSrcStart):
1544         (webKitWebSrcNeedData):
1545         (webKitWebSrcEnoughData):
1546         (webKitWebSrcSeek):
1547
1548 2017-06-18  Ryosuke Niwa  <rniwa@webkit.org>
1549
1550         Meter element doesn't respect the writing direction
1551         https://bugs.webkit.org/show_bug.cgi?id=173507
1552
1553         Reviewed by Sam Weinig.
1554
1555         The bug was caused by NSLevelIndicatorCell no longer using the value of baseWritingDirection
1556         to determine the direction of rendering in macOS Sierra and later. It instead relies on
1557         the value of userInterfaceLayoutDirection.
1558
1559         Fixed the bug by setting both values. Once we dropped the support for macOS El Capitan
1560         and earlier, we can remove the code to set baseWritingDirection.
1561
1562         Test: fast/dom/HTMLMeterElement/meter-rtl.html
1563
1564         * rendering/RenderThemeMac.mm:
1565         (WebCore::RenderThemeMac::levelIndicatorFor):
1566
1567 2017-06-18  Dewei Zhu  <dewei_zhu@apple.com>
1568
1569         Remove 'EditCommand::isEditCommandComposition'.
1570         https://bugs.webkit.org/show_bug.cgi?id=173525
1571
1572         Reviewed by Wenson Hsieh.
1573
1574         Should remove 'isEditCommandComposition' from 'EditCommand' for:
1575             1. 'EditCommandComposition' is no longer a subclass of EditCommand.
1576             2. 'isEditCommandComposition' is not used at all.
1577
1578         * editing/EditCommand.h:
1579         (WebCore::EditCommand::isCompositeEditCommand):
1580         (WebCore::EditCommand::isEditCommandComposition): Deleted.
1581
1582 2017-06-18  Chris Dumez  <cdumez@apple.com>
1583
1584         Crash when re-entering MediaDevicesEnumerationRequest::cancel()
1585         https://bugs.webkit.org/show_bug.cgi?id=173522
1586         <rdar://problem/31185739>
1587
1588         Reviewed by Darin Adler.
1589
1590         When a MediaDevicesRequest is started, it creates a MediaDevicesEnumerationRequest
1591         object and passes a completion handler to that MediaDevicesEnumerationRequest
1592         object. The completion handler holds a reference to the MediaDevicesRequest object
1593         so that its stays alive until the MediaDevicesEnumerationRequest either completes
1594         or is canceled. MediaDevicesRequest also holds a reference to the
1595         MediaDevicesEnumerationRequest object via its m_enumerationRequest data member.
1596
1597         When the document is destroyed, both MediaDevicesRequest::contextDestroyed() and
1598         MediaDevicesEnumerationRequest::contextDestroyed() gets called and the other is not
1599         pre-determined. If MediaDevicesEnumerationRequest::contextDestroyed() gets called
1600         first then it calls MediaDevicesEnumerationRequest::cancel(). Calling cancel() ends
1601         up destroying the completion handler. Destroying the completion handler ends up
1602         dereferencing and destroying the MediaDevicesRequest object. The MediaDevicesRequest
1603         destructor would call MediaDevicesEnumerationRequest::cancel() again, causing us to
1604         re-enter it and assign nullptr to the completion callback again. Re-entering
1605         std::function's operator=(nullptr_t) is not safe because of the way it is implemented
1606         as we end up trying to destroy the lambda twice and crashing. Using a WTF::Function
1607         instead fixes this particular issue because re-entering WTF::Function's operator=(nullptr_t)
1608         is safe.
1609
1610         However, this fix is not sufficient. Calling the MediaDevicesRequest destructor also
1611         dereferencing and destroys the MediaDevicesEnumerationRequest object. As a result,
1612         when MediaDevicesEnumerationRequest::contextDestroyed() returns from its call to cancel
1613         |this| is already dead when we call ContextDestructionObserver::contextDestroyed().
1614         To address this issue, we now protect |this| in MediaDevicesEnumerationRequest::contextDestroyed().
1615
1616         Test: fast/mediastream/destroy-document-while-enumerating-devices.html
1617
1618         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
1619         (WebCore::MediaDevicesEnumerationRequest::contextDestroyed):
1620         Protect |this| as the call to cancel() may destroy |this| before calling
1621         ContextDestructionObserver::contextDestroyed() otherwise.
1622
1623         * Modules/mediastream/MediaDevicesEnumerationRequest.h:
1624         Use WTF::Function instead of std::function for the completion handler as
1625         it is safer (in terms of re-entrency) and avoids unnecessary copying.
1626
1627         * Modules/mediastream/MediaDevicesRequest.cpp:
1628         (WebCore::MediaDevicesRequest::~MediaDevicesRequest):
1629         Stop calling MediaDevicesEnumerationRequest::cancel(). When the destructor
1630         is called, the MediaDevicesEnumerationRequest has either completed or been
1631         canceled so there is no need to cancel again. I added an assertion to
1632         make sure it is the case. This avoids re-entering
1633         MediaDevicesEnumerationRequest::cancel() is some cases, which was risky.
1634
1635         (WebCore::MediaDevicesRequest::start):
1636         Add comment for clarity and capture a Ref<> instead of a RefPtr<> now that
1637         we can since we use WTF::Function.
1638
1639 2017-06-18  Chris Dumez  <cdumez@apple.com>
1640
1641         Use WTF::Function instead of std::function in WTF/
1642         https://bugs.webkit.org/show_bug.cgi?id=173519
1643
1644         Reviewed by Sam Weinig.
1645
1646         Replace a few uses of std::function with WTF::Function in WebCore/
1647         as well. It was either this or including <functional> and I decided
1648         it made more sense to port the code.
1649
1650         * platform/graphics/FontSelectionAlgorithm.h:
1651         (WebCore::FontSelectionAlgorithm::iterateActiveCapabilitiesWithReturn):
1652         * platform/mediastream/MediaConstraints.cpp:
1653         (WebCore::StringConstraint::find):
1654         (WebCore::MediaTrackConstraintSetMap::forEach):
1655         (WebCore::MediaTrackConstraintSetMap::filter):
1656         (WebCore::MediaConstraints::isConstraintSet):
1657         * platform/mediastream/MediaConstraints.h:
1658         (WebCore::NumericConstraint::find):
1659         * platform/mediastream/RealtimeMediaSource.cpp:
1660         (WebCore::RealtimeMediaSource::applyConstraint):
1661
1662 2017-06-18  Jer Noble  <jer.noble@apple.com>
1663
1664         [MSE] Seeking or entering fullscreen can cause extreme CPU usage
1665         https://bugs.webkit.org/show_bug.cgi?id=173505
1666
1667         Reviewed by Tim Horton.
1668
1669         When support for painting MSE to WebGL was added in r217185, the implementation of
1670         SourceBufferPrivateAVFObjC::isReadyForMoreSamples() was modified to support asking
1671         the decompression session if it was ready. That change, however, caused an extreme
1672         performance regression in the normal playback path, where WebKit will effectively
1673         append samples endlessly to the AVSampleBufferDisplayLayer, which admirably enqueued
1674         each of them for decoding. Eventually, the cost of iterating over the CMBufferQueue
1675         overwhelmed the cost of decoding, and caused the extreme lag seen when seeking.
1676
1677         Make sure to property query the AVSampleBufferDisplayLayer for isReadyForMoreMediaData
1678         before enqueuing.
1679
1680         A previous version of this patch exposed some errors which caused failing tests:
1681
1682         In sourceBufferPrivateDidReceiveSample(), we were using local versions of
1683         presentationTimestamp and decodeTimestamp as keys to the decodeQueue; those local versions
1684         were floating point values (because MediaTime + float = float), but the sample itself uses
1685         non-floating point MediaTimes. This causes samples to be left in the queue when they should
1686         be removed.
1687
1688         In didBecomeReadyForMoreSamples(), we were getting spurious assertions when a
1689         AVSampleBufferDisplayLayer or a AVSampleBufferAudioRenderer would fire a callback from
1690         -requestMediaDataWhenReadyOnQueue:usingBlock: even after it had been told to
1691         -stopRequestingMediaData. Apparently it's expected behavior and so an ASSERT_NOT_REACHED is
1692         inappropriate here.
1693
1694         * Modules/mediasource/SourceBuffer.cpp:
1695         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
1696         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1697         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples):
1698         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples):
1699
1700
1701 2017-06-17  Zalan Bujtas  <zalan@apple.com>
1702
1703         Addressing post-review comment after r218456.
1704         https://bugs.webkit.org/show_bug.cgi?id=173509
1705
1706         Reviewed by Darin Adler.
1707
1708         * dom/Document.cpp:
1709         (WebCore::Document::destroyRenderTree):
1710
1711 2017-06-17  Chris Dumez  <cdumez@apple.com>
1712
1713         DOMQuad::getBounds() should return a Ref<>
1714         https://bugs.webkit.org/show_bug.cgi?id=173517
1715
1716         Reviewed by Simon Fraser.
1717
1718         DOMQuad::getBounds() should return a Ref<> as it cannot return
1719         null.
1720
1721         * dom/DOMQuad.cpp:
1722         (WebCore::DOMQuad::getBounds):
1723         * dom/DOMQuad.h:
1724
1725 2017-06-17  Simon Fraser  <simon.fraser@apple.com>
1726
1727         Implement DOMQuad
1728         https://bugs.webkit.org/show_bug.cgi?id=163534
1729
1730         Reviewed by Sam Weinig.
1731
1732         Implement DOMQuad per https://drafts.fxtf.org/geometry/#DOMQuad, other than serialization
1733         which requires some bindings changes.
1734
1735         web-platform-tests/css/geometry-1/DOMRect-001.html tests against an older version of the spec,
1736         so has some failures. DOMQuad-002.html passes, other than a NaN propagation issue that requires
1737         spec clarification.
1738
1739         * CMakeLists.txt:
1740         * DerivedSources.make:
1741         * WebCore.xcodeproj/project.pbxproj:
1742         * bindings/js/JSDOMQuadCustom.cpp: Added.
1743         (WebCore::JSDOMQuad::getBounds):
1744         * bindings/scripts/CodeGenerator.pm:
1745         (IsSerializableDOMType):
1746         (IsSerializableAttribute):
1747         * dom/DOMPoint.h:
1748         * dom/DOMQuad.cpp: Added.
1749         (WebCore::DOMQuad::DOMQuad):
1750         (WebCore::DOMQuad::getBounds):
1751         * dom/DOMQuad.h: Added.
1752         (WebCore::DOMQuad::create):
1753         (WebCore::DOMQuad::fromRect):
1754         (WebCore::DOMQuad::fromQuad):
1755         (WebCore::DOMQuad::p1):
1756         (WebCore::DOMQuad::p2):
1757         (WebCore::DOMQuad::p3):
1758         (WebCore::DOMQuad::p4):
1759         * dom/DOMQuad.idl: Added.
1760         * dom/DOMQuadInit.h: Added.
1761         * dom/DOMQuadInit.idl: Added.
1762
1763 2017-06-17  Chris Dumez  <cdumez@apple.com>
1764
1765         Use WTF::Function instead of std::function in WebKit2/
1766         https://bugs.webkit.org/show_bug.cgi?id=173504
1767
1768         Reviewed by Darin Adler.
1769
1770         Use WTF::Function instead of std::function in WebKit2/ to avoid
1771         unnecessary copying.
1772
1773         * Modules/applepay/PaymentCoordinator.cpp:
1774         (WebCore::PaymentCoordinator::canMakePaymentsWithActiveCard):
1775         (WebCore::PaymentCoordinator::openPaymentSetup):
1776         * Modules/applepay/PaymentCoordinator.h:
1777         * Modules/applepay/PaymentCoordinatorClient.h:
1778         * loader/EmptyClients.cpp:
1779         * loader/NetscapePlugInStreamLoader.cpp:
1780         (WebCore::NetscapePlugInStreamLoader::willSendRequest):
1781         * loader/NetscapePlugInStreamLoader.h:
1782         * loader/ResourceLoader.cpp:
1783         (WebCore::ResourceLoader::willSendRequest):
1784         * loader/ResourceLoader.h:
1785
1786 2017-06-17  Zalan Bujtas  <zalan@apple.com>
1787
1788         Demote the "we have navigated away" check to an assertion.
1789         https://bugs.webkit.org/show_bug.cgi?id=173509
1790
1791         Reviewed by Simon Fraser.
1792
1793         Now that the expected behavior is that the render tree can't get to the page cache, it's ok to assert.
1794         TODO: We should also have view() check removed at some point.
1795
1796         * dom/Document.cpp:
1797         (WebCore::Document::destroyRenderTree):
1798
1799 2017-06-17  Alex Christensen  <achristensen@webkit.org>
1800
1801         Fix CMake build
1802
1803         * PlatformMac.cmake:
1804         * bindings/js/ScriptGlobalObject.cpp:
1805
1806 2017-06-17  Commit Queue  <commit-queue@webkit.org>
1807
1808         Unreviewed, rolling out r218438.
1809         https://bugs.webkit.org/show_bug.cgi?id=173515
1810
1811         Caused imported/w3c/web-platform-tests/media-
1812         source/mediasource* tests to fail (Requested by smfr on
1813         #webkit).
1814
1815         Reverted changeset:
1816
1817         "[MSE] Seeking or entering fullscreen can cause extreme CPU
1818         usage"
1819         https://bugs.webkit.org/show_bug.cgi?id=173505
1820         http://trac.webkit.org/changeset/218438
1821
1822 2017-06-17  Antti Koivisto  <antti@apple.com>
1823
1824         Crash due to infinite recursion via FrameSelection::updateAppearanceAfterLayout
1825         https://bugs.webkit.org/show_bug.cgi?id=173468
1826
1827         Reviewed by Ryosuke Niwa.
1828
1829         Test: editing/selection/updateAppearanceAfterLayout-recursion.html
1830
1831         Calling FrameSelection::updateAppearanceAfterLayout() from Document::resolveStyle is unsafe
1832         because it may cause another call to resolveStyle. We have some cases where the style
1833         is still unclean when updateAppearanceAfterLayout() is called. This can lead to infinite
1834         recursion.
1835
1836         The test case is not the common stack seen in CrashTracer (couldn't quit replicate it) but
1837         the updateAppearanceAfterLayout/resolveStyle recursion is the same.
1838
1839         * dom/Document.cpp:
1840         (WebCore::Document::resolveStyle):
1841
1842             Normally selection appearance update is done in post-layout but not all style resolutions schedule a layout.
1843             Invoke it asynchronously in that case instead of the previous synchronous call.
1844
1845         * editing/FrameSelection.cpp:
1846         (WebCore::FrameSelection::FrameSelection):
1847         (WebCore::FrameSelection::updateAppearanceAfterLayout):
1848         (WebCore::FrameSelection::scheduleAppearanceUpdateAfterStyleChange):
1849         (WebCore::FrameSelection::appearanceUpdateTimerFired):
1850         (WebCore::FrameSelection::updateAppearanceAfterLayoutOrStyleChange):
1851         * editing/FrameSelection.h:
1852
1853 2017-06-17  Alex Christensen  <achristensen@webkit.org>
1854
1855         Fix Mac CMake build.
1856
1857         * PlatformMac.cmake:
1858
1859 2017-06-17  Ryosuke Niwa  <rniwa@webkit.org>
1860
1861         REGRESSION(r209495): materiauxlaverdure.com fails to load
1862         https://bugs.webkit.org/show_bug.cgi?id=173301
1863         <rdar://problem/32624850>
1864
1865         Reviewed by Antti Koivisto.
1866
1867         The bug was caused by WebKit wrapping CSS string values with single quotation marks instead of
1868         double quotation marks as spec'ed in https://drafts.csswg.org/cssom/#serialize-a-string and
1869         implemented in Firefox and Chrome.
1870
1871         The website eval's the computed value of the `content` CSS property with the value `'{name: "flat"}'`
1872         after stripping single quotation marks from both ends. Prior to r209495, WebKit serialized this CSS value
1873         in single quotations without escaping double quotations. After r209495, double quotations are escaped
1874         with backslashes as `'{name: \"flat\"}'`. As a result, `eval` is invoked with `{name: \"flat\"}`
1875         after stripping single quotations from both ends, which resulted in an exception.
1876
1877         Chrome and Firefox don't encounter this exception despite of the fact they escape double quotations
1878         as well because serialize with double quotations as `"{name: \"flat\"}"`. Because there is no code
1879         to strip double quotations, eval is invoked with the same string, resulting in the entire value as
1880         being parsed as string, instead of an object with a single key "name" with the value of "flat" as
1881         was the case in WebKit prior to r209495. While this behavior was most certainly not the intent of
1882         the website author, Chrome and Firefox don't encounter an exception and the website continues to work.
1883
1884         This patch aligns WebKit's behavior to that of the CSS OM specification, Firefox, and Chrome by
1885         serializing CSS string values using double quotation marks instead of single quotation marks.
1886
1887         Note: inline change log comments are added below for every call site of serializeString for clarity.
1888
1889         Test: fast/css/getPropertyValue-serialization-with-double-quotes.html
1890
1891         * css/CSSBasicShapes.cpp:
1892         (WebCore::buildPathString): Use double quotation marks in path(~) of shapes.
1893         * css/CSSMarkup.cpp:
1894         (WebCore::serializeString):
1895         (WebCore::serializeURL): Use double quotation marks to serialize URLs.
1896         (WebCore::serializeAsStringOrCustomIdent): Use double quotation marks to serialize strings. We still avoid
1897         using wrapping the value with double quotations when the value can be an identifier. See r209495.
1898         (WebCore::serializeFontFamily): Ditto for font-family names such as "San Francisco".
1899         * css/CSSMarkup.h:
1900         * css/CSSNamespaceRule.cpp:
1901         (WebCore::CSSNamespaceRule::cssText): Use double quotation marks to serialize namespace URIs.
1902         * css/CSSPrimitiveValue.cpp:
1903         (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText): Use double quotation marks to serialize
1904         the separators; e.g. counter(sectionNumber, ".") to produce "1.".
1905         * css/CSSSelector.cpp:
1906         (WebCore::CSSSelector::selectorText): Use double quotation marks to serialize attribute values.
1907         * css/parser/CSSParserToken.cpp:
1908         (WebCore::CSSParserToken::serialize): Use double quotation marks to serialize strings in @support.
1909         * editing/EditingStyle.cpp:
1910         (WebCore::StyleChange::extractTextStyles): Updated to strip double quotation marks in font family names to
1911         maintain the compatibility with old versions of Microsoft Outlook.
1912         * html/HTMLElement.cpp:
1913         (WebCore::HTMLElement::mapLanguageAttributeToLocale): Use double quotations marks to serialize the value
1914         of the lang content attribute. It doesn't matter which one is used here because it's only a temporary value
1915         only fed into the CSS parser to set the equivalent CSS value from the content attribute.
1916
1917 2017-06-16  Matt Baker  <mattbaker@apple.com>
1918
1919         Web Inspector: Instrument 2D/WebGL canvas contexts in the backend
1920         https://bugs.webkit.org/show_bug.cgi?id=172623
1921         <rdar://problem/32415986>
1922
1923         Reviewed by Devin Rousso and Joseph Pecoraro.
1924
1925         Test: inspector/canvas/create-canvas-contexts.html
1926
1927         * CMakeLists.txt:
1928         * WebCore.xcodeproj/project.pbxproj:
1929
1930         * dom/Document.cpp:
1931         (WebCore::Document::getCSSCanvasElement):
1932         Instrument creation of CSS canvases. This merely registers the canvas
1933         element with InspectorCanvasAgent and stores the name (identifier passed
1934         to getCSSCanvasContext) for later use. It isn't until the context is
1935         actually created that the frontend receives a notification.
1936
1937         * html/HTMLCanvasElement.cpp:
1938         (WebCore::HTMLCanvasElement::getContext2d):
1939         (WebCore::HTMLCanvasElement::getContextWebGL):
1940         Instrument creation of 2D and WebGL canvas contexts.
1941
1942         * inspector/InspectorAllInOne.cpp:
1943
1944         * inspector/InspectorCanvasAgent.cpp: Added.
1945         New backend agent for canvas inspection. Canvas creation and destruction
1946         are continuously monitored by the agent, regardless of the presence of
1947         a frontend. This is necessary since there is no way to retrieve the
1948         rendering contexts for with a given frame once they've been created.
1949
1950         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
1951         (WebCore::InspectorCanvasAgent::didCreateFrontendAndBackend):
1952         (WebCore::InspectorCanvasAgent::willDestroyFrontendAndBackend):
1953         (WebCore::InspectorCanvasAgent::discardAgent):
1954         Unregister canvas observers to prevent dangling agent pointer.
1955         (WebCore::InspectorCanvasAgent::enable):
1956         Dispatch events for existing canvases, now that the frontend exists.
1957         (WebCore::InspectorCanvasAgent::disable):
1958         (WebCore::InspectorCanvasAgent::frameNavigated):
1959         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas):
1960         Register the name/identifier associated with the CSS canvas, so that it
1961         can be retrieved and associated with the rendering context later.
1962
1963         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
1964         (WebCore::InspectorCanvasAgent::canvasDestroyed):
1965         Removes the canvas from the agent, and queues it for notifying the
1966         frontend during the next event loop.
1967
1968         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
1969         (WebCore::InspectorCanvasAgent::clearCanvasData):
1970         (WebCore::InspectorCanvasAgent::getCanvasEntry):
1971         (WebCore::InspectorCanvasAgent::buildObjectForCanvas):
1972         * inspector/InspectorCanvasAgent.h: Added.
1973
1974         * inspector/InspectorController.cpp:
1975         (WebCore::InspectorController::InspectorController):
1976
1977         * inspector/InspectorInstrumentation.cpp:
1978         (WebCore::InspectorInstrumentation::didCommitLoadImpl):
1979         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl):
1980         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
1981
1982         * inspector/InspectorInstrumentation.h:
1983         (WebCore::InspectorInstrumentation::didCreateCSSCanvas):
1984         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
1985         These instrumentation points should not fast return when no frontend
1986         is attached.
1987
1988         * inspector/InstrumentingAgents.cpp:
1989         (WebCore::InstrumentingAgents::reset):
1990
1991         * inspector/InstrumentingAgents.h:
1992         (WebCore::InstrumentingAgents::inspectorCanvasAgent):
1993         (WebCore::InstrumentingAgents::setInspectorCanvasAgent):
1994         Plumbing for the new agent.
1995
1996 2017-06-16  Antoine Quint  <graouts@apple.com>
1997
1998         Add a WebKit2 setting to control whether media documents should automatically enter fullscreen
1999         https://bugs.webkit.org/show_bug.cgi?id=173503
2000
2001         Reviewed by Tim Horton.
2002
2003         New WebCore setting to specify whether a media document should automatically enter fullscreen.
2004
2005         * page/Settings.in:
2006
2007 2017-06-16  Jer Noble  <jer.noble@apple.com>
2008
2009         [MSE] Seeking or entering fullscreen can cause extreme CPU usage
2010         https://bugs.webkit.org/show_bug.cgi?id=173505
2011
2012         Reviewed by Tim Horton.
2013
2014         When support for painting MSE to WebGL was added in r217185, the implementation of
2015         SourceBufferPrivateAVFObjC::isReadyForMoreSamples() was modified to support asking
2016         the decompression session if it was ready. That change, however, caused an extreme
2017         performance regression in the normal playback path, where WebKit will effectively
2018         append samples endlessly to the AVSampleBufferDisplayLayer, which admirably enqueued
2019         each of them for decoding. Eventually, the cost of iterating over the CMBufferQueue
2020         overwhelmed the cost of decoding, and caused the extreme lag seen when seeking.
2021
2022         Make sure to property query the AVSampleBufferDisplayLayer for isReadyForMoreMediaData
2023         before enqueuing.
2024
2025         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2026         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples):
2027
2028 2017-06-16  Sam Weinig  <sam@webkit.org>
2029
2030         [WebIDL] Remove custom bindings for HTMLDocument
2031         https://bugs.webkit.org/show_bug.cgi?id=173444
2032
2033         Reviewed by Darin Adler.
2034
2035         * bindings/js/JSDOMBindingSecurity.cpp:
2036         (WebCore::canAccessDocument):
2037         (WebCore::BindingSecurity::shouldAllowAccessToFrame):
2038         (WebCore::BindingSecurity::shouldAllowAccessToDOMWindow):
2039         * bindings/js/JSDOMWindowCustom.cpp:
2040         (WebCore::JSDOMWindow::showModalDialog):
2041         Pass ExecState by reference to window accessors.
2042
2043         * bindings/js/JSDOMWindowBase.cpp:
2044         (WebCore::incumbentDOMWindow):
2045         (WebCore::activeDOMWindow):
2046         (WebCore::firstDOMWindow):
2047         (WebCore::callerDocument):
2048         * bindings/js/JSDOMWindowBase.h:
2049         Pass ExecState by reference to window accessors and add callerDocument.
2050     
2051         * bindings/js/JSHTMLDocumentCustom.cpp:
2052         (WebCore::JSHTMLDocument::getOwnPropertySlot): Deleted.
2053         (WebCore::JSHTMLDocument::all): Deleted.
2054         (WebCore::JSHTMLDocument::setAll): Deleted.
2055         (WebCore::findCallingDocument): Deleted.
2056         (WebCore::JSHTMLDocument::open): Deleted.
2057         (WebCore::documentWrite): Deleted.
2058         (WebCore::JSHTMLDocument::write): Deleted.
2059         Remove custom bindings.
2060
2061         * bindings/scripts/CodeGeneratorJS.pm:
2062         (GenerateCallWith):
2063         Add support CallWith=CallerDocument
2064
2065         * bindings/scripts/IDLAttributes.json:
2066         Remove CallerWindow, which has not been supported for a while. CallerDocument, despite 
2067         having it's support removed in the past, was still listed, so keep it.
2068
2069         * bindings/scripts/test/JS/JSTestObj.cpp:
2070         Update test results.
2071
2072         * dom/DOMImplementation.cpp:
2073         (WebCore::DOMImplementation::createHTMLDocument):
2074         Update for new signature of Document.write().
2075
2076         * dom/Document.h:
2077         * dom/Document.idl:
2078         * dom/Document.cpp:
2079         (WebCore::Document::open):
2080         Add DOMWindow returning overload that calls through to the DOMWindow.
2081         Add return value and currently not utilized parameters to the Document returning overload.
2082         Update to return exceptions as specified.
2083
2084         (WebCore::Document::close):
2085         Update to return exceptions as specified.
2086
2087         (WebCore::Document::write):
2088         (WebCore::Document::writeln):
2089         Update to take a Vector<String> argument and the caller Document first
2090         as per convention and return exceptions as specified.
2091
2092         (WebCore::Document::bgColor):
2093         (WebCore::Document::setBgColor):
2094         (WebCore::Document::fgColor):
2095         (WebCore::Document::setFgColor):
2096         (WebCore::Document::alinkColor):
2097         (WebCore::Document::setAlinkColor):
2098         (WebCore::Document::linkColorForBindings):
2099         (WebCore::Document::setLinkColorForBindings):
2100         (WebCore::Document::vlinkColor):
2101         (WebCore::Document::setVlinkColor):
2102         (WebCore::Document::clear):
2103         (WebCore::Document::captureEvents):
2104         (WebCore::Document::releaseEvents):
2105         Move from HTMLDocument.
2106
2107         * html/HTMLDocument.cpp:
2108         (WebCore::HTMLDocument::bgColor): Deleted.
2109         (WebCore::HTMLDocument::setBgColor): Deleted.
2110         (WebCore::HTMLDocument::fgColor): Deleted.
2111         (WebCore::HTMLDocument::setFgColor): Deleted.
2112         (WebCore::HTMLDocument::alinkColor): Deleted.
2113         (WebCore::HTMLDocument::setAlinkColor): Deleted.
2114         (WebCore::HTMLDocument::linkColor): Deleted.
2115         (WebCore::HTMLDocument::setLinkColor): Deleted.
2116         (WebCore::HTMLDocument::vlinkColor): Deleted.
2117         (WebCore::HTMLDocument::setVlinkColor): Deleted.
2118         (WebCore::HTMLDocument::clear): Deleted.
2119         (WebCore::HTMLDocument::captureEvents): Deleted.
2120         (WebCore::HTMLDocument::releaseEvents): Deleted.
2121         * html/HTMLDocument.h:
2122         * html/HTMLDocument.idl:
2123         Moved operations and attributes to Document.
2124
2125         * inspector/DOMPatchSupport.cpp:
2126         (WebCore::DOMPatchSupport::patchDocument):
2127         Update for new signature of Document.write().
2128
2129         * page/DOMWindow.cpp:
2130         (WebCore::DOMWindow::postMessage):
2131         (WebCore::DOMWindow::focus):
2132         * page/DOMWindow.h:
2133         Use the term incumbentWindow, matching IDL, and so not to be confused
2134         with the callerWindow, which is slightly different.
2135
2136 2017-06-16  Daniel Bates  <dabates@apple.com>
2137
2138         Remove header OptionSet.h from FrameLoaderTypes.h
2139         https://bugs.webkit.org/show_bug.cgi?id=173489
2140
2141         Reviewed by Joseph Pecoraro.
2142
2143         Although the header FrameLoaderTypes.h defines exactly one enum class, ReloadOption, whose
2144         enumerators conform the power of two prerequisite for parameterizing an OptionSet for it
2145         FrameLoaderTypes.h does not actually make use of the functionality provided by header
2146         OptionSet.h. And not all source files that include FrameLoaderTypes.h need to use an OptionSet.
2147
2148         * loader/DocumentLoader.h: Include <wtf/OptionSet.h>.
2149         * loader/FrameLoader.h: Ditto.
2150         * loader/FrameLoaderTypes.h: Remove header <wtf/OptionSet.h>.
2151         * replay/UserInputBridge.h: Include <wtf/Forward.h>.
2152
2153 2017-06-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2154
2155         [iOS DnD] Upstream iOS drag and drop implementation into OpenSource WebKit
2156         https://bugs.webkit.org/show_bug.cgi?id=173366
2157         <rdar://problem/32767014>
2158
2159         Reviewed by Tim Horton.
2160
2161         Moves all drag and drop logic previously hidden behind WebKitAdditions into the open source repository, along
2162         with unit test pages in TestWebKitAPI. Also removes all #includes and #imports of dragging-related files in
2163         WebKitAdditions from the open source repository.
2164
2165         This initial upstreaming phase is only concerned with moving code out of WebKitAdditions, and attempts to
2166         preserve the code as-is, with the exception of trivial style changes so that the open source linter passes.
2167         Future patches will remove the DATA_INTERACTION feature flag altogether and unobscure all variable and function
2168         names referencing "data interaction".
2169
2170         No change in behavior from the internal build.
2171
2172         * Configurations/FeatureDefines.xcconfig:
2173         * page/ios/EventHandlerIOS.mm:
2174         (WebCore::EventHandler::createDraggingDataTransfer):
2175         (WebCore::EventHandler::eventLoopHandleMouseDragged):
2176         (WebCore::EventHandler::tryToBeginDataInteractionAtPoint):
2177         * platform/ios/DragImageIOS.mm:
2178         (WebCore::dragImageSize):
2179         (WebCore::scaleDragImage):
2180         (WebCore::createDragImageFromImage):
2181         (WebCore::deleteDragImage):
2182         (WebCore::createDragImageForLink):
2183         (WebCore::createDragImageIconForCachedImageFilename):
2184         (WebCore::platformAdjustDragImageForDeviceScaleFactor):
2185         (WebCore::createDragImageForSelection):
2186         (WebCore::dissolveDragImageToFraction):
2187         * platform/ios/PasteboardIOS.mm:
2188         (WebCore::Pasteboard::Pasteboard):
2189         (WebCore::Pasteboard::setDragImage):
2190         (WebCore::Pasteboard::createForDragAndDrop):
2191         * platform/mac/DragDataMac.mm:
2192         (WebCore::rtfPasteboardType):
2193         (WebCore::rtfdPasteboardType):
2194         (WebCore::stringPasteboardType):
2195         (WebCore::urlPasteboardType):
2196         (WebCore::htmlPasteboardType):
2197         (WebCore::colorPasteboardType):
2198         (WebCore::pdfPasteboardType):
2199         (WebCore::tiffPasteboardType):
2200         (WebCore::DragData::asFilenames):
2201         (WebCore::DragData::containsURL):
2202         (rtfPasteboardType): Deleted.
2203         (rtfdPasteboardType): Deleted.
2204         (stringPasteboardType): Deleted.
2205         (urlPasteboardType): Deleted.
2206         (htmlPasteboardType): Deleted.
2207         (colorPasteboardType): Deleted.
2208         (pdfPasteboardType): Deleted.
2209         (tiffPasteboardType): Deleted.
2210
2211 2017-06-16  Youenn Fablet  <youenn@apple.com>
2212
2213         addTransceiver should trigger mid generation in the SDP
2214         https://bugs.webkit.org/show_bug.cgi?id=173452
2215
2216         Reviewed by Alex Christensen.
2217
2218         Test: webrtc/video-addTransceiver.html
2219
2220         Adding support for recvonly SDP based on call to addTransceiver.
2221         Using offer_to_receive options of libwebrtc for that purpose.
2222
2223         Making sure that addTransceiver and using a real track afterwards is working too.
2224
2225         * Modules/mediastream/RTCPeerConnection.cpp:
2226         (WebCore::RTCPeerConnection::enqueueReplaceTrackTask): notify the backend that a track is added in case the sender has no track.
2227         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2228         (WebCore::LibWebRTCMediaEndpoint::shouldOfferAllowToReceiveAudio): Detect whether some audio mid should be recvonly.
2229         (WebCore::LibWebRTCMediaEndpoint::shouldOfferAllowToReceiveVideo): Detect whether some video mid should be recvonly.
2230         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
2231         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2232         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2233
2234 2017-06-16  Youenn Fablet  <youenn@apple.com>
2235
2236         WebCore::LibWebRTCMediaEndpoint::gatherStatsForLogging is crashing
2237         https://bugs.webkit.org/show_bug.cgi?id=173493
2238
2239         Reviewed by Eric Carlson.
2240
2241         Speculative preventive fix.
2242
2243         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2244         (WebCore::LibWebRTCMediaEndpoint::gatherStatsForLogging):
2245
2246 2017-06-16  Alex Christensen  <achristensen@webkit.org>
2247
2248         Show punycode to user if a URL has dotless i or j followed by diacritic dot
2249         https://bugs.webkit.org/show_bug.cgi?id=173431
2250
2251         Reviewed by Darin Adler.
2252
2253         Covered by new API tests.
2254
2255         * platform/mac/WebCoreNSURLExtras.mm:
2256         (WebCore::isLookalikeCharacter):
2257         (WebCore::allCharactersInIDNScriptWhiteList):
2258         (WebCore::createStringWithEscapedUnsafeCharacters):
2259
2260 2017-06-16  Youenn Fablet  <youenn@apple.com>
2261
2262         [iOS] Switching cameras in a WebRTC call makes black frames being sent
2263         https://bugs.webkit.org/show_bug.cgi?id=173486
2264
2265         Reviewed by Eric Carlson.
2266
2267         Test: webrtc/video-replace-muted-track.html
2268
2269         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
2270         (WebCore::RealtimeOutgoingVideoSource::updateBlackFramesSending):
2271         Ensuring the timer is stopped if needed.
2272         (WebCore::RealtimeOutgoingVideoSource::initializeFromSource):
2273         Calling updateBlackFramesSending to stop sending frame if needed.
2274
2275 2017-06-16  Youenn Fablet  <youenn@apple.com>
2276
2277         Remove replaceTrack restriction about video resolution
2278         https://bugs.webkit.org/show_bug.cgi?id=173490
2279
2280         Reviewed by Eric Carlson.
2281
2282         Covered by updated tests.
2283
2284         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
2285         (WebCore::RealtimeOutgoingVideoSource::setSource):
2286
2287 2017-06-16  Jeremy Jones  <jeremyj@apple.com>
2288
2289         Handle timeout of prepareForPictureInPictureStopWithCompletionHandler.
2290         https://bugs.webkit.org/show_bug.cgi?id=173462
2291         rdar://problem/32128170
2292
2293         Reviewed by Jer Noble.
2294
2295         No new tests because no effect on the DOM.
2296
2297         If WebVideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler doesn't respond fast enough,
2298         the caller will timeout and call will/didStopPictureInPicture.
2299
2300         This is getting fullscreen state confused.
2301
2302         This change keeps state consistent by handling will/didStopPictureInPicture possibly being called before
2303         prepareForPictureInPictureStopWithCompletionHandler calls its callback.
2304
2305         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
2306         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
2307         (WebVideoFullscreenInterfaceAVKit::willStopPictureInPicture):
2308         (WebVideoFullscreenInterfaceAVKit::didStopPictureInPicture):
2309         (WebVideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler):
2310         (WebVideoFullscreenInterfaceAVKit::watchdogTimerFired):
2311
2312 2017-06-16  Myles C. Maxfield  <mmaxfield@apple.com>
2313
2314         Make builds faster after r218371
2315         https://bugs.webkit.org/show_bug.cgi?id=173453
2316
2317         Reviewed by Tim Horton.
2318
2319         Remove #includes from .h files.
2320
2321         No new tests because there is no behavior change.
2322
2323         * CMakeLists.txt:
2324         * WebCore.xcodeproj/project.pbxproj: Add new .cpp file, and sort the project file
2325         * platform/graphics/FontFamilySpecificationNull.cpp: Copied from Source/WebCore/platform/graphics/FontFamilySpecificationNull.h.
2326         (WebCore::FontFamilySpecificationNull::fontRanges):
2327         * platform/graphics/FontFamilySpecificationNull.h:
2328         (WebCore::FontFamilySpecificationNull::fontRanges): Deleted.
2329         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
2330         (WebCore::FontFamilySpecificationCoreText::FontFamilySpecificationCoreText):
2331         (WebCore::FontFamilySpecificationCoreText::~FontFamilySpecificationCoreText):
2332         * platform/graphics/cocoa/FontFamilySpecificationCoreText.h:
2333         (WebCore::FontFamilySpecificationCoreText::FontFamilySpecificationCoreText): Deleted.
2334
2335 2017-06-16  Chris Dumez  <cdumez@apple.com>
2336
2337         [WK2] Add WKProcessPool SPI to efficiently reset all plugin load client policies
2338         https://bugs.webkit.org/show_bug.cgi?id=173472
2339         <rdar://problem/28858817>
2340
2341         Reviewed by Brady Eidson.
2342
2343         Add PluginLoadClientPolicyMaximum value to PluginLoadClientPolicy enumeration
2344         to facilitate input value validation on API side.
2345
2346         * plugins/PluginData.h:
2347
2348 2017-06-16  Jer Noble  <jer.noble@apple.com>
2349
2350         [iOS] Do not pause playing video when application resigns active state.
2351         https://bugs.webkit.org/show_bug.cgi?id=173474
2352
2353         Reviewed by Tim Horton.
2354
2355         Test: media/video-inactive-playback.html
2356
2357         Separate out the concept of "inactive" playback from "process background" playback.
2358         Move the implementation of applicationDidEnterBackground() from MediaSessionManagerIOS
2359         into it's superclass, PlatformMediaSessionManager, and add a new set of restrictions
2360         for "InactiveProcessPlaybackRestricted" and "SuspendedUnderLockPlaybackRestricted".
2361         Leave the default restriction set for iOS as "BackgroundProcessPlaybackRestricted" and
2362         "SuspendedUnderLockPlaybackRestricted", to preserve the existing behavior of suspending
2363         playback when switching apps or when locking the device.
2364
2365         * platform/audio/PlatformMediaSession.cpp:
2366         (WebCore::interruptionName):
2367         * platform/audio/PlatformMediaSession.h:
2368         * platform/audio/PlatformMediaSessionManager.cpp:
2369         (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive):
2370         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive):
2371         (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground):
2372         (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground):
2373         (WebCore::PlatformMediaSessionManager::applicationWillEnterBackground): Deleted.
2374         (WebCore::PlatformMediaSessionManager::applicationDidEnterForeground): Deleted.
2375         * platform/audio/PlatformMediaSessionManager.h:
2376         * platform/audio/ios/MediaSessionManagerIOS.h:
2377         * platform/audio/ios/MediaSessionManagerIOS.mm:
2378         (WebCore::MediaSessionManageriOS::resetRestrictions):
2379         (-[WebMediaSessionHelper applicationDidBecomeActive:]):
2380         (-[WebMediaSessionHelper applicationWillResignActive:]):
2381         (WebCore::MediaSessionManageriOS::applicationDidEnterBackground): Deleted.
2382         (WebCore::MediaSessionManageriOS::applicationWillEnterForeground): Deleted.
2383         * testing/Internals.cpp:
2384         (WebCore::Internals::applicationWillBecomeInactive):
2385         (WebCore::Internals::applicationDidBecomeActive):
2386         (WebCore::Internals::applicationWillEnterForeground):
2387         (WebCore::Internals::applicationDidEnterBackground):
2388         (WebCore::Internals::setMediaSessionRestrictions):
2389         (WebCore::Internals::applicationDidEnterForeground): Deleted.
2390         (WebCore::Internals::applicationWillEnterBackground): Deleted.
2391         * testing/Internals.h:
2392         * testing/Internals.idl:
2393
2394 2017-06-16  Alex Christensen  <achristensen@webkit.org>
2395
2396         REGRESSION (r213126): Sync XHR needs partition for cache and credentials
2397         https://bugs.webkit.org/show_bug.cgi?id=173496
2398         <rdar://problem/31943596>
2399
2400         Reviewed by Darin Adler.
2401
2402         Test: http/tests/security/sync-xhr-partition.html
2403
2404         * xml/XMLHttpRequest.cpp:
2405         (WebCore::XMLHttpRequest::createRequest):
2406
2407 2017-06-16  Commit Queue  <commit-queue@webkit.org>
2408
2409         Unreviewed, rolling out r218402 and r218404.
2410         https://bugs.webkit.org/show_bug.cgi?id=173494
2411
2412         Seems to have mysteriously broken the build in bizarre ways
2413         (Requested by thorton on #webkit).
2414
2415         Reverted changesets:
2416
2417         "Include a few widespread WTF headers in WebCorePrefix.h"
2418         https://bugs.webkit.org/show_bug.cgi?id=173481
2419         http://trac.webkit.org/changeset/218402
2420
2421         "Fix the Windows build after r218402"
2422         http://trac.webkit.org/changeset/218404
2423
2424 2017-06-16  Brady Eidson  <beidson@apple.com>
2425
2426         REGRESSION (r218015) IconLoaders for already-cached resources expect to be asynchronous, no longer are.
2427         <rdar://problem/32817519> and https://bugs.webkit.org/show_bug.cgi?id=173478
2428
2429         Reviewed by Daniel Bates.
2430
2431         Covered by API test.
2432
2433         Being synchronous is actually better as it's resolved another issue or two.
2434         But only if we can actually deliver the data without crashing first.
2435         So let's do that.
2436         
2437         * loader/DocumentLoader.cpp:
2438         (WebCore::DocumentLoader::didGetLoadDecisionForIcon): Put the IconLoader in the set of active icon loaders
2439           before actually starting the icon loading.
2440
2441 2017-06-16  Jeremy Jones  <jeremyj@apple.com>
2442
2443         Don't use WebCore Timer from code that runs in the UI process.
2444         https://bugs.webkit.org/show_bug.cgi?id=173460
2445         rdar://problem/32750731
2446
2447         Reviewed by Jer Noble.
2448
2449         If a WebCore Timer is fired from the WebKit2 UI process, it will
2450         create a web thread, which can cause a crash in this instance.
2451
2452         It was also causing the timer to be called back on the wrong thread.
2453
2454         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
2455         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
2456         (WebVideoFullscreenInterfaceAVKit::WebVideoFullscreenInterfaceAVKit):
2457
2458 2017-06-16  Timothy Horton  <timothy_horton@apple.com>
2459
2460         Fix the Windows build after r218402
2461
2462         * WebCorePrefix.h:
2463         I typed #import instead of #include on auto-pilot, and ... it mostly worked!
2464         Except Windows.
2465
2466 2017-06-16  Jeremy Jones  <jeremyj@apple.com>
2467
2468         Hide inline captions in fullscreen. Remove fullscreen captions when no longer needed.
2469         https://bugs.webkit.org/show_bug.cgi?id=173482
2470
2471         Reviewed by Eric Carlson.
2472
2473         Hide the inline captions while they are presenting to fullscreen.
2474         Remove the text track representation as soon as it is no longer needed.
2475         This allows the text track to render properly when returning to inline.
2476
2477         * html/shadow/MediaControlElements.cpp:
2478         (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation):
2479
2480 2017-06-16  Tim Horton  <timothy_horton@apple.com>
2481
2482         Include a few widespread WTF headers in WebCorePrefix.h
2483         https://bugs.webkit.org/show_bug.cgi?id=173481
2484
2485         Reviewed by Alex Christensen.
2486
2487         * WebCorePrefix.h:
2488         These are four of the headers that contribute the most pre-processed
2489         source to the WebCore build. They (and their dependents) change infrequently
2490         enough that a world rebuild of WebCore when they change seems like an
2491         acceptable tradeoff for the ~9% reduction in WebCore build time that I
2492         measure from this change.
2493
2494 2017-06-16  Antoine Quint  <graouts@apple.com>
2495
2496         REGRESSION: AirPlay placard is not shown when in fullscreen
2497         https://bugs.webkit.org/show_bug.cgi?id=173447
2498         <rdar://problem/32803773>
2499
2500         Reviewed by Jon Lee.
2501
2502         We only allowed a placard to be set on inline controls, but that was an oversight: placards
2503         should be displayed in fullscreen as well. As such, we move the "placard" property up from
2504         InlineMediaControls to MediaControls, and update the layout() logic in MacOSFullscreenMediaControls
2505         to display a placard.
2506
2507         Test: media/modern-media-controls/placard-support/placard-support-airplay-fullscreen.html
2508
2509         * Modules/modern-media-controls/controls/inline-media-controls.js:
2510         (InlineMediaControls):
2511         (InlineMediaControls.prototype.layout):
2512         (InlineMediaControls.prototype.get placard): Deleted.
2513         (InlineMediaControls.prototype.set placard): Deleted.
2514         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
2515         (MacOSFullscreenMediaControls.prototype.layout):
2516         * Modules/modern-media-controls/controls/media-controls.js:
2517         (MediaControls.prototype.get placard):
2518         (MediaControls.prototype.set placard):
2519         (MediaControls.prototype.placardPreventsControlsBarDisplay):
2520         (MediaControls.prototype.layout):
2521         * Modules/modern-media-controls/media/placard-support.js:
2522         (PlacardSupport.prototype._updatePlacard):
2523         (PlacardSupport):
2524
2525 2017-06-16  Jer Noble  <jer.noble@apple.com>
2526
2527         [WebRTC] Removing a MediaStreamTrack from a MediaStream reports no recording to WebKit clients
2528         https://bugs.webkit.org/show_bug.cgi?id=173398
2529         <rdar://problem/32592961>
2530
2531         Reviewed by Eric Carlson.
2532
2533         API Test: Tests/WebKit2/MediaStreamTrackDetached.mm
2534
2535         Move the definition of a MediaStream as a MediaProducer from the stream itself to its constituent
2536         MediaStreamTracks. This ensures that, even if a MediaStreamTrack is removed from its stream, the
2537         document (and thus the clients) are notified that media capture is still occurring.
2538
2539         Though MediaStream is no longer a MediaProducer, it still uses the MediaProducer's state concept
2540         to determine when to fire events. However it's mediaState() implementation will be moved into
2541         MediaStreamTrack, and will instead simply bitwise-or together each of it's track's mediaState().
2542
2543         The MediaStream notifies the document that its state has changed asynchronously, so do the same
2544         for MediaStreamTrack (which reduces the number of calls to the client when changes all occur
2545         during a single run loop).
2546
2547         Because the MediaStreamTrackPrivate may be started externally (not by the MediaStreamTrack directly),
2548         add a new client method that notifies observers when the track has been started, and the
2549         MediaStreamTrack will use this notification to update the document with it's new mediaState().
2550
2551         * Modules/mediastream/MediaStream.cpp:
2552         (WebCore::MediaStream::MediaStream):
2553         (WebCore::MediaStream::~MediaStream):
2554         (WebCore::MediaStream::mediaState):
2555         (WebCore::MediaStream::statusDidChange):
2556         (WebCore::MediaStream::characteristicsChanged):
2557         (WebCore::MediaStream::pageMutedStateDidChange): Deleted.
2558         * Modules/mediastream/MediaStream.h:
2559         * Modules/mediastream/MediaStreamTrack.cpp:
2560         (WebCore::MediaStreamTrack::MediaStreamTrack):
2561         (WebCore::MediaStreamTrack::~MediaStreamTrack):
2562         (WebCore::MediaStreamTrack::pageMutedStateDidChange):
2563         (WebCore::MediaStreamTrack::mediaState):
2564         (WebCore::MediaStreamTrack::trackStarted):
2565         (WebCore::MediaStreamTrack::configureTrackRendering):
2566         (WebCore::MediaStreamTrack::stop):
2567         (WebCore::MediaStreamTrack::document):
2568         * Modules/mediastream/MediaStreamTrack.h:
2569         (WebCore::MediaStreamTrack::source):
2570         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2571         * platform/mediastream/MediaStreamPrivate.cpp:
2572         (WebCore::MediaStreamPrivate::trackStarted):
2573         * platform/mediastream/MediaStreamPrivate.h:
2574         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2575         (WebCore::MediaStreamTrackPrivate::sourceStarted):
2576         * platform/mediastream/MediaStreamTrackPrivate.h:
2577         * platform/mediastream/RealtimeMediaSource.cpp:
2578         (WebCore::RealtimeMediaSource::start):
2579         * platform/mediastream/RealtimeMediaSource.h:
2580
2581 2017-06-16  Antoine Quint  <graouts@apple.com>
2582
2583         Backdrop blur missing in media controls bar on Sierra
2584         https://bugs.webkit.org/show_bug.cgi?id=173451
2585
2586         Reviewed by Simon Fraser.
2587
2588         On Sierra, we need to enforce a stacking context on controls bars to guarantee that
2589         the backdrop filters on the BackgroundTint are applied correctly.
2590
2591         Test: media/modern-media-controls/controls-bar/controls-bar-stacking-context.html
2592
2593         * Modules/modern-media-controls/controls/controls-bar.css:
2594         (.controls-bar):
2595
2596 2017-06-16  Matt Lewis  <jlewis3@apple.com>
2597
2598         Unreviewed, rolling out r218375.
2599
2600         The API test MediaStreamTrackDetached is still timing out
2601         after the patch
2602
2603         Reverted changeset:
2604
2605         "[WebRTC] Removing a MediaStreamTrack from a MediaStream
2606         reports no recording to WebKit clients"
2607         https://bugs.webkit.org/show_bug.cgi?id=173398
2608         http://trac.webkit.org/changeset/218375
2609
2610 2017-06-15  Simon Fraser  <simon.fraser@apple.com>
2611
2612         REGRESSION: Media control glyphs appear to invert colors when video is dragged
2613         https://bugs.webkit.org/show_bug.cgi?id=173455
2614         rdar://problem/32726887
2615
2616         Reviewed by Tim Horton.
2617
2618         Masks on composited layers were not correctly painted in drag images, because RenderLayer::paintLayerContents()
2619         failed to pass the PaintBehaviorFlattenCompositingLayers flag down through the mask drawing code, causing
2620         RenderBox::paintMaskImages() to fall into the composited mask code path.
2621
2622         Fix by making a local copy of PaintBehavior, and setting the PaintBehaviorFlattenCompositingLayers and PaintBehaviorSnapshotting
2623         bits on it as appropriate, and passing it into paintMaskForFragments() and paintChildClippingMaskForFragments(). This is similar
2624         to code above.
2625
2626         Can't test drag images.
2627
2628         * rendering/RenderLayer.cpp:
2629         (WebCore::RenderLayer::paintLayerContents):
2630         (WebCore::RenderLayer::paintMaskForFragments):
2631         (WebCore::RenderLayer::paintChildClippingMaskForFragments):
2632         * rendering/RenderLayer.h:
2633
2634 2017-06-16  Matt Lewis  <jlewis3@apple.com>
2635
2636         Unreviewed, rolling out r218376.
2637
2638         The patch cause multiple Layout Test Crashes.
2639
2640         Reverted changeset:
2641
2642         "Web Inspector: Instrument 2D/WebGL canvas contexts in the
2643         backend"
2644         https://bugs.webkit.org/show_bug.cgi?id=172623
2645         http://trac.webkit.org/changeset/218376
2646
2647 2017-06-16  Daniel Bates  <dabates@apple.com>
2648
2649         Use the term icon instead of favicon
2650         https://bugs.webkit.org/show_bug.cgi?id=173400
2651
2652         Reviewed by Alex Christensen.
2653
2654         * inspector/InspectorPageAgent.cpp:
2655         (WebCore::InspectorPageAgent::cachedResourceContent):
2656         (WebCore::InspectorPageAgent::cachedResourceType):
2657         * loader/LinkLoader.cpp:
2658         (WebCore::createLinkPreloadResourceClient):
2659         * loader/ResourceLoadInfo.cpp:
2660         (WebCore::toResourceType):
2661         * loader/SubresourceLoader.cpp:
2662         (WebCore::logResourceLoaded):
2663         * loader/cache/CachedRawResource.cpp:
2664         (WebCore::CachedRawResource::CachedRawResource):
2665         * loader/cache/CachedRawResource.h:
2666         (isType):
2667         * loader/cache/CachedResource.cpp:
2668         (WebCore::CachedResource::defaultPriorityForResourceType):
2669         * loader/cache/CachedResource.h:
2670         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource):
2671         (WebCore::CachedResource::ignoreForRequestCount):
2672         (WebCore::CachedResource::isMainOrMediaOrFaviconOrRawResource): Deleted.
2673         * loader/cache/CachedResourceLoader.cpp:
2674         (WebCore::createResource):
2675         (WebCore::CachedResourceLoader::requestIcon):
2676         (WebCore::contentTypeFromResourceType):
2677         (WebCore::CachedResourceLoader::checkInsecureContent):
2678         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy):
2679         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
2680         (WebCore::CachedResourceLoader::requestFavicon): Deleted.
2681         * loader/cache/CachedResourceLoader.h:
2682         * loader/icon/IconLoader.cpp:
2683         (WebCore::IconLoader::startLoading):
2684
2685 2017-06-16  Per Arne Vollan  <pvollan@apple.com>
2686
2687         WebKit does not honor closed caption stroke width.
2688         https://bugs.webkit.org/show_bug.cgi?id=173402
2689
2690         Reviewed by Eric Carlson.
2691
2692         WebKit currently has an upper limit on the stroke width returned from MACaptionAppearanceCopyFontDescriptorWithStrokeForStyle.
2693         Since only half the stroke is visible because the stroke is drawn before the fill, double the stroke width from
2694         MediaAccessibility to get the correct visual stroke width. Also, the stroke width returned from this function should not be
2695         interpreted as CSS points, but as CSS pixels.
2696
2697         * html/shadow/MediaControlElements.cpp:
2698         (WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
2699         * page/CaptionUserPreferencesMediaAF.cpp:
2700         (WebCore::CaptionUserPreferencesMediaAF::captionStrokeWidthForFont):
2701
2702 2017-06-16  Per Arne Vollan  <pvollan@apple.com>
2703
2704         [Win] WebKit renders scrollbar wrong at 125% scale.
2705         https://bugs.webkit.org/show_bug.cgi?id=173363
2706
2707         Reviewed by Darin Adler.
2708
2709         Scrollbars are drawn with the GDI function DrawThemeBackground. Sometimes, the GDI clip
2710         rectangle will be too small since we clamp a FloatRect to integer values when setting the
2711         GDI clip rectangle.
2712
2713         * platform/graphics/win/GraphicsContextWin.cpp:
2714         (WebCore::GraphicsContextPlatformPrivate::clip):
2715
2716 2017-06-15  Mark Lam  <mark.lam@apple.com>
2717
2718         Add a JSRunLoopTimer registry in VM.
2719         https://bugs.webkit.org/show_bug.cgi?id=173429
2720         <rdar://problem/31287961>
2721
2722         Reviewed by Filip Pizlo.
2723
2724         No new tests needed because:
2725         1. it's already covered: it was also originally discovered by our API tests while
2726            running on the iOS simulator. The test was intermittently failing on a debug
2727            build.
2728         2. the issue is racy (it depends on a JSRunLoopTimer firing at the right time).
2729            Hence, it's non trivial to write a better test than the one we already have.
2730
2731         * bindings/js/CommonVM.cpp:
2732         (WebCore::commonVMSlow):
2733
2734 2017-06-15  Antoine Quint  <graouts@apple.com>
2735
2736         REGRESSION: AirPlay button is incorrectly highlighted in inline and fullscreen
2737         https://bugs.webkit.org/show_bug.cgi?id=173446
2738
2739         Reviewed by Dean Jackson.
2740
2741         A button's color should be applied to its <picture> element, not the containing
2742         <button> element.
2743
2744         * Modules/modern-media-controls/controls/airplay-button.css:
2745         (button.airplay.on > picture):
2746         (button.airplay.on): Deleted.
2747
2748 2017-06-15  Matt Baker  <mattbaker@apple.com>
2749
2750         Web Inspector: Instrument 2D/WebGL canvas contexts in the backend
2751         https://bugs.webkit.org/show_bug.cgi?id=172623
2752         <rdar://problem/32415986>
2753
2754         Reviewed by Devin Rousso.
2755
2756         Test: inspector/canvas/create-canvas-contexts.html
2757
2758         * CMakeLists.txt:
2759         * WebCore.xcodeproj/project.pbxproj:
2760
2761         * dom/Document.cpp:
2762         (WebCore::Document::getCSSCanvasElement):
2763         Instrument creation of CSS canvases. This merely registers the canvas
2764         element with InspectorCanvasAgent and stores the name (identifier passed
2765         to getCSSCanvasContext) for later use. It isn't until the context is
2766         actually created that the frontend receives a notification.
2767
2768         * html/HTMLCanvasElement.cpp:
2769         (WebCore::HTMLCanvasElement::getContext2d):
2770         (WebCore::HTMLCanvasElement::getContextWebGL):
2771         Instrument creation of 2D and WebGL canvas contexts.
2772
2773         * inspector/InspectorAllInOne.cpp:
2774
2775         * inspector/InspectorCanvasAgent.cpp: Added.
2776         New backend agent for canvas inspection. Canvas creation and destruction
2777         are continuously monitored by the agent, regardless of the presence of
2778         a frontend. This is necessary since there is no way to retrieve the
2779         rendering contexts for with a given frame once they've been created.
2780
2781         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
2782         (WebCore::InspectorCanvasAgent::didCreateFrontendAndBackend):
2783         (WebCore::InspectorCanvasAgent::willDestroyFrontendAndBackend):
2784         (WebCore::InspectorCanvasAgent::discardAgent):
2785         Unregister canvas observers to prevent dangling agent pointer.
2786         (WebCore::InspectorCanvasAgent::enable):
2787         Dispatch events for existing canvases, now that the frontend exists.
2788         (WebCore::InspectorCanvasAgent::disable):
2789         (WebCore::InspectorCanvasAgent::frameNavigated):
2790         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas):
2791         Register the name/identifier associated with the CSS canvas, so that it
2792         can be retrieved and associated with the rendering context later.
2793
2794         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
2795         (WebCore::InspectorCanvasAgent::canvasDestroyed):
2796         Removes the canvas from the agent, and queues it for notifying the
2797         frontend during the next event loop.
2798
2799         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
2800         (WebCore::InspectorCanvasAgent::clearCanvasData):
2801         (WebCore::InspectorCanvasAgent::getCanvasEntry):
2802         (WebCore::InspectorCanvasAgent::buildObjectForCanvas):
2803         * inspector/InspectorCanvasAgent.h: Added.
2804
2805         * inspector/InspectorController.cpp:
2806         (WebCore::InspectorController::InspectorController):
2807
2808         * inspector/InspectorInstrumentation.cpp:
2809         (WebCore::InspectorInstrumentation::didCommitLoadImpl):
2810         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl):
2811         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
2812
2813         * inspector/InspectorInstrumentation.h:
2814         (WebCore::InspectorInstrumentation::didCreateCSSCanvas):
2815         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
2816         These instrumentation points should not fast return when no frontend
2817         is attached.
2818
2819         * inspector/InstrumentingAgents.cpp:
2820         (WebCore::InstrumentingAgents::reset):
2821
2822         * inspector/InstrumentingAgents.h:
2823         (WebCore::InstrumentingAgents::inspectorCanvasAgent):
2824         (WebCore::InstrumentingAgents::setInspectorCanvasAgent):
2825         Plumbing for the new agent.
2826
2827 2017-06-15  Jer Noble  <jer.noble@apple.com>
2828
2829         [WebRTC] Removing a MediaStreamTrack from a MediaStream reports no recording to WebKit clients
2830         https://bugs.webkit.org/show_bug.cgi?id=173398
2831         <rdar://problem/32592961>
2832
2833         Reviewed by Eric Carlson.
2834
2835         API Test: Tests/WebKit2/MediaStreamTrackDetached.mm
2836
2837         Move the definition of a MediaStream as a MediaProducer from the stream itself to its constituent
2838         MediaStreamTracks. This ensures that, even if a MediaStreamTrack is removed from its stream, the
2839         document (and thus the clients) are notified that media capture is still occurring.
2840
2841         Though MediaStream is no longer a MediaProducer, it still uses the MediaProducer's state concept
2842         to determine when to fire events. However it's mediaState() implementation will be moved into
2843         MediaStreamTrack, and will instead simply bitwise-or together each of it's track's mediaState().
2844
2845         The MediaStream notifies the document that its state has changed asynchronously, so do the same
2846         for MediaStreamTrack (which reduces the number of calls to the client when changes all occur
2847         during a single run loop).
2848
2849         Because the MediaStreamTrackPrivate may be started externally (not by the MediaStreamTrack directly),
2850         add a new client method that notifies observers when the track has been started, and the
2851         MediaStreamTrack will use this notification to update the document with it's new mediaState().
2852
2853         * Modules/mediastream/MediaStream.cpp:
2854         (WebCore::MediaStream::MediaStream):
2855         (WebCore::MediaStream::~MediaStream):
2856         (WebCore::MediaStream::mediaState):
2857         (WebCore::MediaStream::statusDidChange):
2858         (WebCore::MediaStream::characteristicsChanged):
2859         (WebCore::MediaStream::pageMutedStateDidChange): Deleted.
2860         * Modules/mediastream/MediaStream.h:
2861         * Modules/mediastream/MediaStreamTrack.cpp:
2862         (WebCore::MediaStreamTrack::MediaStreamTrack):
2863         (WebCore::MediaStreamTrack::~MediaStreamTrack):
2864         (WebCore::MediaStreamTrack::pageMutedStateDidChange):
2865         (WebCore::MediaStreamTrack::mediaState):
2866         (WebCore::MediaStreamTrack::trackStarted):
2867         (WebCore::MediaStreamTrack::configureTrackRendering):
2868         (WebCore::MediaStreamTrack::stop):
2869         (WebCore::MediaStreamTrack::document):
2870         * Modules/mediastream/MediaStreamTrack.h:
2871         (WebCore::MediaStreamTrack::source):
2872         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2873         * platform/mediastream/MediaStreamPrivate.cpp:
2874         (WebCore::MediaStreamPrivate::trackStarted):
2875         * platform/mediastream/MediaStreamPrivate.h:
2876         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2877         (WebCore::MediaStreamTrackPrivate::sourceStarted):
2878         * platform/mediastream/MediaStreamTrackPrivate.h:
2879         * platform/mediastream/RealtimeMediaSource.cpp:
2880         (WebCore::RealtimeMediaSource::start):
2881         * platform/mediastream/RealtimeMediaSource.h:
2882
2883 2017-06-15  Simon Fraser  <simon.fraser@apple.com>
2884
2885         Use WTFLogAlways for debug logging so that it shows up in device system logs
2886         https://bugs.webkit.org/show_bug.cgi?id=173450
2887
2888         Reviewed by Tim Horton.
2889
2890         If you want to showRenderTree() on-device, the result doesn't show in system log so you can't see it
2891         Switch to WTFLogAlways to fix this, for all the debug logging in WebCore.
2892         
2893         Also WKError () -> WKError() in the old WAK code, to allow for easier searching pending cleanup.
2894
2895         * Modules/webaudio/AudioContext.cpp:
2896         (WebCore::AudioContext::~AudioContext):
2897         * Modules/webaudio/AudioNode.cpp:
2898         (WebCore::AudioNode::~AudioNode):
2899         (WebCore::AudioNode::ref):
2900         (WebCore::AudioNode::finishDeref):
2901         (WebCore::AudioNode::printNodeCounts):
2902         * bridge/objc/objc_instance.mm:
2903         (ObjcInstance::invokeObjcMethod):
2904         * bridge/objc/objc_utility.mm:
2905         (JSC::Bindings::convertObjcValueToValue):
2906         * css/StyleProperties.cpp:
2907         (WebCore::StyleProperties::showStyle):
2908         * dom/DocumentMarkerController.cpp:
2909         (DocumentMarkerController::showMarkers):
2910         * dom/Node.cpp:
2911         (WebCore::Node::showNode):
2912         (WebCore::Node::showNodePathForThis):
2913         (WebCore::traverseTreeAndMark):
2914         * dom/Position.cpp:
2915         (WebCore::Position::debugPosition):
2916         (WebCore::Position::showAnchorTypeAndOffset):
2917         * dom/Range.cpp:
2918         (showTree):
2919         * editing/FrameSelection.cpp:
2920         (WebCore::FrameSelection::debugRenderer):
2921         * editing/VisiblePosition.cpp:
2922         (WebCore::VisiblePosition::debugPosition):
2923         * editing/VisibleSelection.cpp:
2924         (WebCore::VisibleSelection::debugPosition):
2925         * history/HistoryItem.cpp:
2926         (WebCore::HistoryItem::showTreeWithIndent):
2927         * html/parser/HTMLFormattingElementList.cpp:
2928         (WebCore::HTMLFormattingElementList::show):
2929         * inspector/DOMPatchSupport.cpp:
2930         (WebCore::DOMPatchSupport::dumpMap):
2931         * page/scrolling/ScrollingStateTree.cpp:
2932         (showScrollingStateTree):
2933         * platform/audio/ios/AudioDestinationIOS.cpp:
2934         (WebCore::AudioDestinationIOS::frameSizeChangedProc):
2935         * platform/graphics/GraphicsLayer.cpp:
2936         (showGraphicsLayerTree):
2937         * platform/graphics/displaylists/DisplayList.cpp:
2938         (WebCore::DisplayList::DisplayList::dump):
2939         * platform/ios/wak/WAKView.mm:
2940         (+[WAKView _wrapperForViewRef:]):
2941         (-[WAKView displayRect:]):
2942         (-[WAKView displayRectIgnoringOpacity:inContext:]):
2943         * platform/ios/wak/WKUtilities.c:
2944         (WKRelease):
2945         * platform/ios/wak/WKView.mm:
2946         (_WKViewSetViewContext):
2947         (WKViewGetBounds):
2948         (WKViewGetFrame):
2949         (_WKViewRecursivelyInvalidateGState):
2950         (WKViewSetFrameOrigin):
2951         (WKViewSetFrameSize):
2952         (WKViewGetWindow):
2953         (WKViewGetSubviews):
2954         (WKViewAddSubview):
2955         (WKViewRemoveFromSuperview):
2956         (WKViewFirstChild):
2957         (WKViewNextSibling):
2958         (WKViewTraverseNext):
2959         (WKViewGetVisibleRect):
2960         (WKViewConvertRectToSuperview):
2961         (WKViewConvertRectToBase):
2962         (WKViewConvertPointToSuperview):
2963         (WKViewConvertPointFromSuperview):
2964         (WKViewConvertPointToBase):
2965         (_WKViewGetAncestorViewsIncludingView):
2966         (WKViewConvertPointFromBase):
2967         (WKViewConvertRectFromSuperview):
2968         (WKViewConvertRectFromBase):
2969         (WKViewGetAutoresizingMask):
2970         (WKViewSetAutoresizingMask):
2971         * platform/text/TextEncodingRegistry.cpp:
2972         (WebCore::dumpTextEncodingNameMap):
2973         * rendering/CounterNode.cpp:
2974         (WebCore::showTreeAndMark):
2975         * rendering/InlineBox.cpp:
2976         (WebCore::InlineBox::showLineBox):
2977         * rendering/InlineTextBox.cpp:
2978         (WebCore::InlineTextBox::showLineBox):
2979         * rendering/RenderCounter.cpp:
2980         (showCounterRendererTree):
2981         * rendering/RenderLayer.cpp:
2982         (WebCore::showLayerTree):
2983         * rendering/RenderObject.cpp:
2984         (WebCore::showRenderTreeLegend):
2985         (WebCore::RenderObject::showRegionsInformation):
2986         (WebCore::RenderObject::showRenderObject):
2987         (WebCore::printRenderTreeForLiveDocuments):
2988         (WebCore::printLayerTreeForLiveDocuments):
2989         * rendering/SimpleLineLayoutFunctions.cpp:
2990         (WebCore::SimpleLineLayout::printPrefix):
2991         (WebCore::SimpleLineLayout::showLineLayoutForFlow):
2992         * rendering/svg/SVGResources.cpp:
2993         (WebCore::SVGResources::dump):
2994         * rendering/svg/SVGResourcesCycleSolver.cpp:
2995         (WebCore::SVGResourcesCycleSolver::resolveCycles):
2996         * rendering/svg/SVGTextLayoutAttributes.cpp:
2997         (WebCore::dumpSVGCharacterDataMapValue):
2998         (WebCore::SVGTextLayoutAttributes::dump):
2999         * rendering/svg/SVGTextLayoutEngine.cpp:
3000         (WebCore::dumpTextBoxes):
3001         (WebCore::SVGTextLayoutEngine::finishLayout):
3002
3003 2017-06-15  Myles C. Maxfield  <mmaxfield@apple.com>
3004
3005         Removing stray whitespace after r218371
3006         https://bugs.webkit.org/show_bug.cgi?id=173043
3007
3008         Unreviewed.
3009
3010         No new tests because there is no behavior change.
3011
3012         * platform/graphics/FontCascadeFonts.cpp:
3013         (WebCore::shouldIgnoreRotation):
3014         (WebCore::glyphDataForNonCJKCharacterWithGlyphOrientation):
3015         * platform/graphics/FontDescription.cpp:
3016         * platform/graphics/FontDescription.h:
3017         * platform/graphics/FontFamilySpecificationNull.h:
3018         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
3019         (WebCore::SystemFontDatabase::systemFontCascadeList):
3020         (WebCore::systemFontParameters):
3021         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
3022         (WebCore::FontFamilySpecificationCoreText::fontRanges):
3023         * platform/graphics/cocoa/FontFamilySpecificationCoreText.h:
3024
3025 2017-06-15  Myles C. Maxfield  <mmaxfield@apple.com>
3026
3027         [Cocoa] Expand system-ui to include every item in the Core Text cascade list
3028         https://bugs.webkit.org/show_bug.cgi?id=173043
3029         <rdar://problem/21125708>
3030
3031         Reviewed by Simon Fraser.
3032
3033         The concept of the system font on Cocoa platforms represents the entire Core Text cascade list.
3034         However, previously, WebKit only represented system-ui by pulling out the first item in the Core
3035         Text cascade list. Instead, we should make all text rendered with "system-ui" match what the
3036         platform would natively render.
3037
3038         Previously, we walked through the strings in the font-family property and looked them up one by
3039         one. However, now we want to abstract this idea of a font family to possibly hold a
3040         CTFontDescriptorRef instead of a string. This way, we expand a font-family list of ["fontA",
3041         "system-ui", "fontB"] to ["fontA", ... a bunch of CTFontDescriptorRefs ..., "FontB"]. We can
3042         then modify the consumer of this object to have two codepaths: the old string-based codepath,
3043         and a new, platform-specific codepath which simply embeds the CTFontDesriptorRefs inside a Font
3044         object.
3045
3046         We don't want to simply pull out the family name from each item in the Core Text fallback list
3047         because that is a lossy translation. There is more information in these font descriptors which
3048         cannot be represented by CSS. Therefore, we must keep the descriptors alive and add the new
3049         codepath for them.
3050
3051         We also don't want to run the CSS font matching algorithm on each member of the Core Text
3052         fallback list because it may yield different results from Core Text's font matching algorithm.
3053         Our goal is to draw text as closely as possible to the system APIs. If we ran it, we may find
3054         a font which is closer to the requested traits, but it would look out of place on the system.
3055
3056         This new codepath is only enabled on macOS High Sierra and iOS 11, because enabling it on all
3057         operating systems would make fixing https://bugs.webkit.org/show_bug.cgi?id=173300 impossible.
3058
3059         Tests: fast/text/system-font-fallback-emoji.html
3060                fast/text/system-font-fallback.html
3061                fast/text/system-font-zero-size.html
3062
3063         * WebCore.xcodeproj/project.pbxproj:
3064         * page/MemoryRelease.cpp:
3065         (WebCore::releaseNoncriticalMemory):
3066         * platform/graphics/FontCascadeFonts.cpp:
3067         (WebCore::realizeNextFallback): The consumer of our new data type. Now uses WTF::visit().
3068         (WebCore::FontCascadeFonts::realizeFallbackRangesAt): Now that the number of items to test
3069         against the current character is larger than the number of strings in the font-family list,
3070         we need to update the existing code to use the correct value.
3071         * platform/graphics/FontDescription.cpp: Default implementation for non-Cocoa ports.
3072         (WebCore::FontDescription::invalidateCaches):
3073         (WebCore::FontCascadeDescription::effectiveFamilyCount):
3074         (WebCore::FontCascadeDescription::effectiveFamilyAt):
3075         * platform/graphics/FontDescription.h: Our new data type is a Variant of AtomicString and a
3076         platform-specific class. Cocoa uses a class that holds a CTFontDescriptorRef and other ports
3077         use an empty non-constructable class.
3078         * platform/graphics/FontFamilySpecificationNull.h: Added. The empty non-constructable
3079         class.
3080         (WebCore::FontFamilySpecificationNull::fontRanges):
3081         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3082         (WebCore::fontCacheRegisteredFontsChangedNotificationCallback):
3083         (WebCore::FontCache::platformInit): Changing the system language will change the system font
3084         fallback list, so we need to listen to this notification. This also matters for
3085         FontCache::systemFallbackForCharacters(), so we should build off the same callback we are
3086         already using for font installation.
3087         (WebCore::invalidateFontCache):
3088         * platform/graphics/cocoa/FontDescriptionCocoa.cpp: Added. The platform-specific creation of
3089         our CTFontDescriptorRefs. We hold them cached in a SystemFontDatabase.
3090         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::CoreTextCascadeListParameters):
3091         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::isHashTableDeletedValue):
3092         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::operator==):
3093         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::hash):
3094         (WebCore::SystemFontDatabase::singleton):
3095         (WebCore::SystemFontDatabase::systemFontCascadeList):
3096         (WebCore::SystemFontDatabase::clear):
3097         (WebCore::SystemFontDatabase::SystemFontDatabase):
3098         (WebCore::SystemFontDatabase::applyWeightAndItalics):
3099         (WebCore::SystemFontDatabase::removeCascadeList):
3100         (WebCore::SystemFontDatabase::computeCascadeList):
3101         (WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::hash):
3102         (WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::equal):
3103         (WebCore::isSystemFontString):
3104         (WebCore::systemFontParameters):
3105         (WebCore::FontDescription::invalidateCaches):
3106         (WebCore::FontCascadeDescription::effectiveFamilyCount): We don't store the result of this
3107         because it would probably be a bad idea to increase the size of every single FontCascade just
3108         in case it might ask for the system font. Most fonts never mention system-ui. Because it's so
3109         rare, we can just recalculate the result of this as necessary. This shouldn't be slow because
3110         the results are cached.
3111         (WebCore::FontCascadeDescription::effectiveFamilyAt):
3112         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp: Added.
3113         (WebCore::FontFamilySpecificationCoreText::fontRanges): Create a FontRanges from a
3114         CTFontDescriptorRef.
3115         * platform/graphics/cocoa/FontFamilySpecificationCoreText.h: Added.
3116         (WebCore::FontFamilySpecificationCoreText::FontFamilySpecificationCoreText):
3117         * platform/graphics/ios/FontCacheIOS.mm:
3118         (WebCore::platformFontWithFamilySpecialCase):
3119         * platform/graphics/mac/FontCacheMac.mm:
3120         (WebCore::platformFontWithFamilySpecialCase):
3121
3122 2017-06-15  David Kilzer  <ddkilzer@apple.com>
3123
3124         Revert: [iOS] Generate a simulated crash when the WebThread starts in MobileSafari
3125         <https://webkit.org/b/173386>
3126         <rdar://problem/32776426>
3127
3128         Revert r218347 and r218339 since we're going to take a different
3129         approach to investigating a crash on the WebThread.
3130
3131         * WebCore.xcodeproj/project.pbxproj:
3132         * platform/ios/CrashReporterSupportSoftLink.h: Remove.
3133         * platform/ios/CrashReporterSupportSoftLink.mm: Remove.
3134         * platform/ios/wak/WebCoreThread.mm:
3135         (WebThreadEnable):
3136         * platform/spi/ios/CrashReporterSupportSPI.h: Remove.
3137
3138 2017-06-15  Matt Lewis  <jlewis3@apple.com>
3139
3140         Unreviewed, rolling out r218365.
3141
3142         The revision caused API timeouts on all builds.
3143
3144         Reverted changeset:
3145
3146         "[WebRTC] Removing a MediaStreamTrack from a MediaStream
3147         reports no recording to WebKit clients"
3148         https://bugs.webkit.org/show_bug.cgi?id=173398
3149         http://trac.webkit.org/changeset/218365
3150
3151 2017-06-15  Simon Fraser  <simon.fraser@apple.com>
3152
3153         Allow use of Layout* TextStream operators in WebKit2
3154         https://bugs.webkit.org/show_bug.cgi?id=173440
3155
3156         Reviewed by Zalan Bujtas.
3157
3158         Export TextStream& operator<< for LayoutPoint, LayoutSize and LayoutRect so that
3159         WebKit2 can log them.
3160
3161         Use #pragma once in these geometry headers.
3162
3163         * platform/graphics/FloatPoint.h:
3164         * platform/graphics/FloatRect.h:
3165         * platform/graphics/FloatSize.h:
3166         * platform/graphics/IntPoint.h:
3167         * platform/graphics/IntRect.h:
3168         * platform/graphics/IntSize.h:
3169         * platform/graphics/LayoutPoint.h:
3170         * platform/graphics/LayoutRect.h:
3171         * platform/graphics/LayoutSize.h:
3172
3173 2017-06-15  Antoine Quint  <graouts@apple.com>
3174
3175         Modern media controls tests error in Button.js
3176         https://bugs.webkit.org/show_bug.cgi?id=173439
3177
3178         Reviewed by Dean Jackson.
3179
3180         Tests would sometime yield an error when commit() would be called and the _imageSource
3181         ivar hadn't been set. To more safely commit the mask image when it's loaded, we now use
3182         a markDirtyProperty() call and a commitProperty() override to ensure that we cover the
3183         case where we want to commit the mask image, and for other commits not to have to worry
3184         about the mask image being defined.
3185
3186         * Modules/modern-media-controls/controls/button.js:
3187         (Button.prototype.commitProperty):
3188         (Button.prototype._updateImage):
3189         (Button.prototype.commit): Deleted.
3190
3191 2017-06-15  Jer Noble  <jer.noble@apple.com>
3192
3193         [WebRTC] Removing a MediaStreamTrack from a MediaStream reports no recording to WebKit clients
3194         https://bugs.webkit.org/show_bug.cgi?id=173398
3195         <rdar://problem/32592961>
3196
3197         Reviewed by Eric Carlson.
3198
3199         API Test: Tests/WebKit2/MediaStreamTrackDetached.mm
3200
3201         Move the definition of a MediaStream as a MediaProducer from the stream itself to its constituent
3202         MediaStreamTracks. This ensures that, even if a MediaStreamTrack is removed from its stream, the
3203         document (and thus the clients) are notified that media capture is still occurring.
3204
3205         Though MediaStream is no longer a MediaProducer, it still uses the MediaProducer's state concept
3206         to determine when to fire events. However it's mediaState() implementation will be moved into
3207         MediaStreamTrack, and will instead simply bitwise-or together each of it's track's mediaState().
3208
3209         The MediaStream notifies the document that its state has changed asynchronously, so do the same
3210         for MediaStreamTrack (which reduces the number of calls to the client when changes all occur
3211         during a single run loop).
3212
3213         Because the MediaStreamTrackPrivate may be started externally (not by the MediaStreamTrack directly),
3214         add a new client method that notifies observers when the track has been started, and the
3215         MediaStreamTrack will use this notification to update the document with it's new mediaState().
3216
3217         * Modules/mediastream/MediaStream.cpp:
3218         (WebCore::MediaStream::MediaStream):
3219         (WebCore::MediaStream::~MediaStream):
3220         (WebCore::MediaStream::mediaState):
3221         (WebCore::MediaStream::statusDidChange):
3222         (WebCore::MediaStream::characteristicsChanged):
3223         (WebCore::MediaStream::pageMutedStateDidChange): Deleted.
3224         * Modules/mediastream/MediaStream.h:
3225         * Modules/mediastream/MediaStreamTrack.cpp:
3226         (WebCore::MediaStreamTrack::MediaStreamTrack):
3227         (WebCore::MediaStreamTrack::~MediaStreamTrack):
3228         (WebCore::MediaStreamTrack::pageMutedStateDidChange):
3229         (WebCore::MediaStreamTrack::mediaState):
3230         (WebCore::MediaStreamTrack::trackStarted):
3231         (WebCore::MediaStreamTrack::configureTrackRendering):
3232         (WebCore::MediaStreamTrack::stop):
3233         (WebCore::MediaStreamTrack::document):
3234         * Modules/mediastream/MediaStreamTrack.h:
3235         (WebCore::MediaStreamTrack::source):
3236         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3237         * platform/mediastream/MediaStreamPrivate.cpp:
3238         (WebCore::MediaStreamPrivate::trackStarted):
3239         * platform/mediastream/MediaStreamPrivate.h:
3240         * platform/mediastream/MediaStreamTrackPrivate.cpp:
3241         (WebCore::MediaStreamTrackPrivate::sourceStarted):
3242         * platform/mediastream/MediaStreamTrackPrivate.h:
3243         * platform/mediastream/RealtimeMediaSource.cpp:
3244         (WebCore::RealtimeMediaSource::start):
3245         * platform/mediastream/RealtimeMediaSource.h:
3246
3247 2017-06-15  Jonathan Bedard  <jbedard@apple.com>
3248
3249         Unreviewed build fix after r218336
3250
3251         * platform/spi/cocoa/PassKitSPI.h: Add missing #ifdefs for Internal builds.
3252
3253 2017-06-15  Antoine Quint  <graouts@apple.com>
3254
3255         Ensure we only log changes to the ScriptedAnimationController suspended state in debug builds
3256         https://bugs.webkit.org/show_bug.cgi?id=173423
3257
3258         Reviewed by Tim Horton.
3259
3260         We added logging for when the suspended state of the scripted animation controller would change in
3261         webkit.org/b/173326. It was meant to only be enabled in debug builds and we actually did the wrong
3262         thing and enabled it in non-debug builds.
3263
3264         We also added a setting that wasn't used and that we are removing here.
3265
3266         * dom/ScriptedAnimationController.cpp:
3267         (WebCore::ScriptedAnimationController::logSuspendCount):
3268         * page/Settings.in:
3269         * testing/InternalSettings.cpp:
3270         (WebCore::InternalSettings::resetToConsistentState):
3271         (WebCore::InternalSettings::shouldLogScritedAnimationControllerSuspensionChange): Deleted.
3272         (WebCore::InternalSettings::setShouldLogScritedAnimationControllerSuspensionChange): Deleted.
3273         * testing/InternalSettings.h:
3274         * testing/InternalSettings.idl:
3275
3276 2017-06-15  David Kilzer  <ddkilzer@apple.com>
3277
3278         Build fix: [iOS] Generate a simulated crash when the WebThread starts in MobileSafari
3279         <https://webkit.org/b/173386>
3280         <rdar://problem/32776426>
3281
3282         * platform/ios/CrashReporterSupportSoftLink.h:
3283         * platform/ios/CrashReporterSupportSoftLink.mm:
3284         * platform/ios/wak/WebCoreThread.mm:
3285         (WebThreadEnable): Log to the console on iOS Simulator.
3286         * platform/spi/ios/CrashReporterSupportSPI.h:
3287         - CrashReporterSupport.h is not available on iOS Simulator, so
3288           restrict to iOS hardware only.
3289
3290 2017-06-15  Chris Dumez  <cdumez@apple.com>
3291
3292         Unreviewed, rolling out r218318.
3293
3294         Seems to have caused an 11% PLT regression. Rolling out to
3295         confirm.
3296
3297         Reverted changeset:
3298
3299         "Don't always recalc the style of display: contents elements."
3300         https://bugs.webkit.org/show_bug.cgi?id=172753
3301         http://trac.webkit.org/changeset/218318
3302
3303 2017-06-15  Wenson Hsieh  <wenson_hsieh@apple.com>
3304
3305         Using -[WebItemProviderPasteboard setItemProviders:] to swap out item providers before a drop breaks item provider loading
3306         https://bugs.webkit.org/show_bug.cgi?id=173338
3307         <rdar://problem/32777720>
3308
3309         Reviewed by Tim Horton.
3310
3311         Currently, replacing the list of UIItemProviders right before a drop is handled results in
3312         WebItemProviderPasteboard failing to load non-"public.content"-conformant items. This is because DragController
3313         computes and sends to the UI process a list of UTIs to load (preferredTypeIdentifiers: one type identifier for
3314         each item provider in WebItemProviderPasteboard). However, if the list of item providers changes immediately
3315         before a drop is performed, WebItemProviderPasteboard will get into an inconsistent state where it has a
3316         different number of preferred type identifiers to load than available item providers. This causes
3317         WebItemProviderPasteboard to fail when choosing what type identifiers to load from each item provider.
3318
3319         To fix this, we instead have the web process propagate a list of supported type identifiers to the UI process,
3320         which is a property of only the drop destination rather than both the destination and item providers. When
3321         performing a drop, we then use the current item providers on WebItemProviderPasteboard to consult this list of
3322         supported type identifiers to resolve our list of preferred type identifiers to load.
3323
3324         Globally renames updatePreferredTypeIdentifiers to updateSupportedTypeIdentifiers.
3325
3326         Tests:
3327         DataInteractionTests.ExternalSourceOverrideDropFileUpload
3328         DataInteractionTests.ExternalSourceOverrideDropInsertURL
3329
3330         * page/DragController.cpp:
3331         (WebCore::DragController::dragEnteredOrUpdated):
3332         (WebCore::DragController::updateSupportedTypeIdentifiersForDragHandlingMethod):
3333         (WebCore::DragController::updatePreferredTypeIdentifiersForDragHandlingMethod): Deleted.
3334         * page/DragController.h:
3335         * page/mac/DragControllerMac.mm:
3336         (WebCore::DragController::updateSupportedTypeIdentifiersForDragHandlingMethod):
3337         (WebCore::DragController::updatePreferredTypeIdentifiersForDragHandlingMethod): Deleted.
3338         * platform/DragData.h:
3339         * platform/PasteboardStrategy.h:
3340         * platform/PlatformPasteboard.h:
3341         * platform/ios/AbstractPasteboard.h:
3342         * platform/ios/PlatformPasteboardIOS.mm:
3343         (WebCore::PlatformPasteboard::updateSupportedTypeIdentifiers):
3344         (WebCore::PlatformPasteboard::updatePreferredTypeIdentifiers): Deleted.
3345         * platform/ios/WebItemProviderPasteboard.mm:
3346         (-[WebItemProviderPasteboard init]):
3347         (-[WebItemProviderPasteboard updateSupportedTypeIdentifiers:]):
3348         (-[WebItemProviderPasteboard setItemProviders:]):
3349         (-[WebItemProviderPasteboard typeIsAppropriateForSupportedTypes:]):
3350         (-[WebItemProviderPasteboard typeIdentifierToLoadForRegisteredTypeIdentfiers:]):
3351
3352         Add logic to resolve preferred type identifiers from an item providers list of registered type identifiers.
3353         This formerly existed on DragData.
3354
3355         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
3356         (-[WebItemProviderPasteboard updatePreferredTypeIdentifiers:]): Deleted.
3357         * platform/mac/DragDataMac.mm:
3358
3359         Remove preferred type identifier resolution logic from DragData.
3360
3361         (WebCore::typeIsAppropriateForSupportedTypes): Deleted.
3362         (WebCore::DragData::updatePreferredTypeIdentifiers): Deleted.
3363
3364 2017-06-15  Sam Weinig  <sam@webkit.org>
3365
3366         [WebIDL] Replace general inclusion of JSDOMConvert.h with inclusion of individual converter files to reduce unnecessary inclusion
3367         https://bugs.webkit.org/show_bug.cgi?id=173392
3368
3369         Reviewed by Tim Horton.
3370
3371         Stop including the umbrella header JSDOMConvert.h in every generated bindings and 
3372         instead only include the specific converter needed. Then, go around and add all the
3373         now missing includes that used to be obtained transitively.
3374
3375         * Modules/indexeddb/IDBRequest.cpp:
3376         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3377         * Modules/plugins/QuickTimePluginReplacement.mm:
3378         * bindings/js/IDBBindingUtilities.cpp:
3379         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
3380         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
3381         * bindings/js/JSCustomElementInterface.cpp:
3382         * bindings/js/JSCustomElementRegistryCustom.cpp:
3383         * bindings/js/JSDOMConvertBase.h:
3384         * bindings/js/JSDOMConvertInterface.h:
3385         * bindings/js/JSDOMConvertRecord.h:
3386         * bindings/js/JSDOMConvertSequences.h:
3387         * bindings/js/JSDOMConvertUnion.h:
3388         * bindings/js/JSDOMGlobalObject.h:
3389         * bindings/js/JSDOMWindowCustom.cpp:
3390         * bindings/js/JSDOMWindowProperties.cpp:
3391         * bindings/js/JSDocumentCustom.cpp:
3392         * bindings/js/JSErrorHandler.cpp:
3393         * bindings/js/JSEventListener.cpp:
3394         * bindings/js/JSHTMLCanvasElementCustom.cpp:
3395         * bindings/js/JSHTMLDocumentCustom.cpp:
3396         * bindings/js/JSHistoryCustom.cpp:
3397         * bindings/js/JSMessageEventCustom.cpp:
3398         (WebCore::JSMessageEvent::data):
3399         * bindings/js/JSMockContentFilterSettingsCustom.cpp:
3400         * bindings/js/JSMutationCallback.cpp:
3401         * bindings/js/JSXMLHttpRequestCustom.cpp:
3402         (WebCore::JSXMLHttpRequest::retrieveResponse):
3403         * bindings/js/ScriptGlobalObject.cpp:
3404         * bindings/js/SerializedScriptValue.cpp:
3405         * bindings/scripts/CodeGeneratorJS.pm:
3406         (AddToIncludesForIDLType):
3407         (GetJSCAttributesForAttribute):
3408         (GenerateEnumerationHeader):
3409         (GenerateEnumerationImplementation):
3410         (GenerateEnumerationImplementationContent):
3411         (GenerateEnumerationsImplementationContent):
3412         (GenerateEnumerationHeaderContent):
3413         (GenerateEnumerationsHeaderContent):
3414         (GenerateDictionaryHeaderContent):
3415         (GenerateDictionariesHeaderContent):
3416         (GenerateDictionaryImplementationContent):
3417         (GenerateDictionariesImplementationContent):
3418         (GenerateHeader):
3419         (GeneratePropertiesHashTable):
3420         (GenerateOverloadDispatcher):
3421         (GenerateImplementation):
3422         (GenerateAttributeGetterDefinition):
3423         (GenerateSerializerDefinition):
3424         (GenerateDictionaryHeader):
3425         (JSValueToNative):
3426         (NativeToJSValueUsingReferences):
3427         (NativeToJSValueUsingPointers):
3428         (IsValidContextForNativeToJSValue):
3429         (NativeToJSValue):
3430         (GenerateConstructorDefinition):
3431         (ComputeFunctionSpecial):
3432         * bindings/scripts/test/JS/JSMapLike.cpp:
3433         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
3434         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
3435         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
3436         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
3437         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
3438         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp:
3439         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
3440         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
3441         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
3442         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
3443         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
3444         * bindings/scripts/test/JS/JSTestEventConstructor.h:
3445         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
3446         * bindings/scripts/test/JS/JSTestException.cpp:
3447         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
3448         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
3449         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
3450         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
3451         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
3452         * bindings/scripts/test/JS/JSTestInterface.cpp:
3453         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
3454         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
3455         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
3456         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
3457         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
3458         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
3459         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
3460         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
3461         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
3462         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
3463         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
3464         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
3465         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
3466         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
3467         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
3468         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
3469         * bindings/scripts/test/JS/JSTestNode.cpp:
3470         * bindings/scripts/test/JS/JSTestNode.h:
3471         * bindings/scripts/test/JS/JSTestObj.cpp:
3472         * bindings/scripts/test/JS/JSTestObj.h:
3473         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
3474         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
3475         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
3476         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
3477         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.h:
3478         * bindings/scripts/test/JS/JSTestSerialization.cpp:
3479         * bindings/scripts/test/JS/JSTestSerialization.h:
3480         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
3481         * bindings/scripts/test/JS/JSTestSerializationInherit.h:
3482         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
3483         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
3484         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
3485         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
3486         * bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
3487         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.h:
3488         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3489         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
3490         * dom/MouseEvent.cpp:
3491         * html/HTMLPlugInImageElement.cpp:
3492
3493 2017-06-14  David Kilzer  <ddkilzer@apple.com>
3494
3495         [iOS] Generate a simulated crash when the WebThread starts in MobileSafari
3496         <https://webkit.org/b/173386>
3497         <rdar://problem/32776426>
3498
3499         Reviewed by Andy Estes.
3500
3501         * WebCore.xcodeproj/project.pbxproj: Add new files to project.
3502         * platform/ios/CrashReporterSupportSoftLink.h: Add.  The using
3503         statement is so that we don't have to write
3504         WebCore::SimulateCrash() in WebCoreThread.mm since it's
3505         functions are not defined inside a WebCore namespace.  I also
3506         kept the 'pid' argument despite the style checker warning
3507         because it matches the internal method definition.
3508         * platform/ios/CrashReporterSupportSoftLink.mm: Add.
3509         * platform/ios/wak/WebCoreThread.mm: Sort headers.  Soft link to
3510         CrashReporterSupport.framework.
3511         (WebThreadEnable): Generate a simulated crash log if the
3512         WebThread ever starts in MobileSafari.
3513         * platform/spi/ios/CrashReporterSupportSPI.h: Add.  The header
3514         isn't safe to include in C++ source, so wrap the import in
3515         extern "C" macros.
3516
3517 2017-06-15  Jonathan Bedard  <jbedard@apple.com>
3518
3519         Build WebKit with High Sierra (Seed 1)
3520         https://bugs.webkit.org/show_bug.cgi?id=173371
3521
3522         Reviewed by Andy Estes.
3523
3524         * crypto/CommonCryptoUtilities.h: Added ccRSAPSSPadding to CCAsymmetricPading enum.
3525         * platform/spi/cocoa/AVKitSPI.h: Declare AVKit SPI used by WebKit in High Sierra.
3526         (-[AVTouchBarPlaybackControlsControlling NS_ENUM]): Added AVTouchBarMediaSelectionOptionType
3527         SPI used in WebPlaybackControlManager in High Sierra.
3528         * platform/spi/cocoa/PassKitSPI.h: Declare PassKit SPI used by WebKit in High Sierra.
3529         (NS_ERROR_ENUM): Added PKPaymentErrorCode used in WebPayment in High Sierra.
3530
3531 2017-06-15  Youenn Fablet  <youenn@apple.com>
3532
3533         RTCPeerConnection returns RTCSessionDescription where RTCSessionDescriptionInit would be appropriate
3534         https://bugs.webkit.org/show_bug.cgi?id=173118
3535         <rdar://problem/32746761>
3536
3537         Reviewed by Eric Carlson.
3538
3539         Test: webrtc/createOfferAnswer.html
3540
3541         Making the promise return a RTCSessionDescription::Init instead of a RTCSessionDescription.
3542         This aligns with the spec and is more optimal.
3543
3544         * Modules/mediastream/PeerConnectionBackend.cpp:
3545         (WebCore::PeerConnectionBackend::createOfferSucceeded):
3546         (WebCore::PeerConnectionBackend::createAnswerSucceeded):
3547         * Modules/mediastream/PeerConnectionBackend.h:
3548         * Modules/mediastream/RTCSessionDescription.idl:
3549
3550 2017-06-15 Emilio Cobos Ãlvarez  <ecobos@igalia.com>
3551
3552         Don't always recalc the style of display: contents elements.
3553         https://bugs.webkit.org/show_bug.cgi?id=172753
3554
3555         Reviewed by Antti Koivisto.
3556
3557         No new tests (no functionality change). This only removes an
3558         inefficiency.
3559
3560         * dom/Element.cpp:
3561         (WebCore::Element::existingComputedStyle):
3562         * dom/Element.h:
3563         * style/RenderTreeUpdater.cpp:
3564         (WebCore::RenderTreeUpdater::updateRenderTree):
3565         (WebCore::RenderTreeUpdater::updateElementRenderer):
3566         * style/StyleTreeResolver.cpp:
3567         (WebCore::Style::TreeResolver::resolveElement):
3568         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
3569         (WebCore::Style::shouldResolveElement):
3570         (WebCore::Style::TreeResolver::resolveComposedTree):
3571
3572 2017-06-14  Antoine Quint  <graouts@apple.com>
3573
3574         Rebaseline media/modern-media-controls/media-documents
3575         https://bugs.webkit.org/show_bug.cgi?id=173394
3576
3577         Reviewed by Dean Jackson.
3578
3579         We found two issues related to media documents while rebaselining the dedicated tests.
3580
3581         First, we needed to expose the --inline-controls-bar-height CSS variable to <video>
3582         elements in media documents that are actually showing an audio UI. Previously we would
3583         only expose the variable to <audio> elements.
3584
3585         Also, due to webkit.org/b/173387, we would fail to identify certain media documents as
3586         video because the videoTracks weren't set yet when the "loadedmetadata" event would be
3587         triggered. So now we also look at the videoWidth and videoHeight properties, which should
3588         provide accurate information in the "loadedmetadata" event handler.
3589
3590         * Modules/modern-media-controls/controls/media-controls.css:
3591         (:host(audio), :host(video.media-document.audio), *):
3592         (:host(audio), *): Deleted.
3593         * Modules/modern-media-controls/media/media-controller.js:
3594         (MediaController.prototype.get isAudio):
3595
3596 2017-06-14  Zalan Bujtas  <zalan@apple.com>
3597
3598         animations-paused-in-background-page.html and animated-svg-image-removed-from-document-paused.html fail after r218284
3599         https://bugs.webkit.org/show_bug.cgi?id=173393
3600
3601         Reviewed by Simon Fraser.
3602
3603         Testing cares really about whether the animation has initiated.  
3604
3605         * platform/graphics/Image.h:
3606         (WebCore::Image::animationPending):
3607         * testing/Internals.cpp:
3608         (WebCore::Internals::isImageAnimating):
3609
3610 2017-06-14  Dean Jackson  <dino@apple.com>
3611
3612         Restrict filtered painting across cross-origin boundaries with transforms
3613         https://bugs.webkit.org/show_bug.cgi?id=173388
3614         <rdar://problem/27362159>
3615
3616         Reviewed by Simon Fraser.
3617
3618         Make sure all cases of LayerPaintingInfo maintain the security
3619         flag. In this case there was only one new place, and since
3620         everything is scalar, there was no need for a real copy constructor.
3621
3622         Test: http/tests/css/filters-on-iframes-transform.html
3623
3624         * rendering/RenderLayer.cpp:
3625         (WebCore::RenderLayer::paintLayerByApplyingTransform): Make sure the cross
3626         origin flag is used in the call to paint the layer children.
3627         * rendering/RenderLayer.h: Fix some typos.
3628
3629 2017-06-14  Commit Queue  <commit-queue@webkit.org>
3630
3631         Unreviewed, rolling out r218285.
3632         https://bugs.webkit.org/show_bug.cgi?id=173391
3633
3634         API test fails on iOS (Requested by alexchristensen on
3635         #webkit).
3636
3637         Reverted changeset:
3638
3639         "Add SPI for immediate injection of user scripts"
3640         https://bugs.webkit.org/show_bug.cgi?id=173342
3641         http://trac.webkit.org/changeset/218285
3642
3643 2017-06-14  Jer Noble  <jer.noble@apple.com>
3644
3645         Video flashes black when switching back to a tab https://www.apple.com/homepod/
3646         https://bugs.webkit.org/show_bug.cgi?id=173377
3647
3648         Reviewed by Eric Carlson.
3649
3650         Previously, we had set the background color of the video layer to black in order to make the rect
3651         occupied by the HTMLMediaElement fully opaque. This worked around a graphics corruption bug. Since
3652         then, the code in RenderVideo::foregroundIsKnownToBeOpaqueInRect(...) has been fixed to fully account
3653         for whether the HTMLMediaElement has a valid frame to display, making the black layer background
3654         unnecessary.
3655
3656         Remove all the instances where we were setting the background color of the video layer to black.
3657
3658         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3659         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
3660         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
3661         (WebCore::VideoFullscreenLayerManager::setVideoLayer):
3662         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer):
3663
3664 2017-06-14  Matt Lewis  <jlewis3@apple.com>
3665
3666         Unreviewed, rolling out r218161.
3667
3668         Introduced bot API test failures and Layout Test Failures.
3669
3670         Reverted changeset:
3671
3672         "[Cocoa] Expand system-ui to include every item in the Core
3673         Text cascade list"
3674         https://bugs.webkit.org/show_bug.cgi?id=173043
3675         http://trac.webkit.org/changeset/218161
3676
3677 2017-06-14  Alex Christensen  <achristensen@webkit.org>
3678
3679         Add SPI for immediate injection of user scripts
3680         https://bugs.webkit.org/show_bug.cgi?id=173342
3681         <rdar://problem/29202285>
3682
3683         Reviewed by Brady Eidson.
3684
3685         The new SPI is WKUserContentController._addUserScriptImmediately.
3686         It is covered by new API tests.
3687
3688         * page/Frame.cpp:
3689         (WebCore::Frame::injectUserScripts):
3690         (WebCore::Frame::injectUserScriptImmediately):
3691         Move injection functionality to allow us to call it directly from the new SPI.
3692         * page/Frame.h:
3693         * page/Page.cpp:
3694         (WebCore::Page::forEachPage):
3695         * page/Page.h:
3696
3697 2017-06-14  Zalan Bujtas  <zalan@apple.com>
3698
3699         Crash in WebCore::RenderStyle::colorIncludingFallback.
3700         https://bugs.webkit.org/show_bug.cgi?id=173347
3701         <rdar://problem/32675317>
3702
3703         Reviewed by Chris Dumez.
3704
3705         Starting an SVG image animation synchronously might trigger recursive style recalc.
3706         We should kick off the animation on a zero timer to reduce callstack complexity. 
3707
3708         Test: svg/as-image/svg-css-animation.html
3709
3710         * loader/cache/CachedImage.cpp:
3711         (WebCore::CachedImage::didAddClient):
3712         * platform/graphics/Image.cpp:
3713         (WebCore::Image::Image):
3714         (WebCore::Image::startAnimationAsynchronously):
3715         * platform/graphics/Image.h:
3716
3717 2017-06-14  Brady Eidson  <beidson@apple.com>
3718
3719         WKIconLoadingDelegate never gets asked about the default favicon if touch/touch-precomposed icons are in the <head>
3720         <rdar://problem/32614328> and https://bugs.webkit.org/show_bug.cgi?id=173376
3721
3722         Reviewed by Alex Christensen.
3723
3724         Covered by new API test
3725
3726         * loader/DocumentLoader.cpp:
3727         (WebCore::DocumentLoader::startIconLoading): Previously we applied the default favicon if the set of LinkIcons was empty.
3728           Now, apply the default favicon if the set of LinkIcons contains no explicit favicon.
3729
3730 2017-06-14  Jer Noble  <jer.noble@apple.com>
3731
3732         Flaky Test: media/media-source/media-source-unnecessary-seek-seeked.html
3733         https://bugs.webkit.org/show_bug.cgi?id=173344
3734
3735         Reviewed by Eric Carlson.
3736
3737         Separate the concept of "the page has asked us to seek" from "we have asked the
3738         media player to seek". When the media engine tells us its ready state has changed
3739         after the page has requested a seek, but before the media element has asked its
3740         player to perform the seek, we were previously firing a seeked event. Now we'll
3741         check this new ivar and see that we aren't expecting a seek to finish yet.
3742
3743         * html/HTMLMediaElement.cpp:
3744         (WebCore::HTMLMediaElement::HTMLMediaElement):
3745         (WebCore::HTMLMediaElement::setReadyState):
3746         (WebCore::HTMLMediaElement::finishSeek):
3747         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
3748         * html/HTMLMediaElement.h:
3749
3750 2017-06-14  Matt Lewis  <jlewis3@apple.com>
3751
3752         Unreviewed, rolling out r218157.
3753
3754         This patch caused multiple API failures on iOS Simulator.
3755
3756         Reverted changeset:
3757
3758         "@font-face rules with invalid primary fonts never download
3759         their secondary fonts"
3760         https://bugs.webkit.org/show_bug.cgi?id=173138
3761         http://trac.webkit.org/changeset/218157
3762
3763 2017-06-14  Chris Dumez  <cdumez@apple.com>
3764
3765         REGRESSION (r217997): mint.com header renders incorrectly when initially loaded
3766         https://bugs.webkit.org/show_bug.cgi?id=173302
3767         <rdar://problem/32731747>
3768
3769         Reviewed by Darin Adler.
3770
3771         r217997 updated ImplicitAnimation::reset() to not call updateStateMachine(AnimationStateInput::RestartAnimation)
3772         if the compositeAnimation is suspended. If the compositeAnimation is suspended, we would call
3773         updateStateMachine(AnimationStateInput::AnimationStateInput::PlayStatePaused), which was expected to be a no-op.
3774         This was needed because otherwise, changing the style of the animated element would restart the animation
3775         even though it was supposed to be suspended. One thing I did not realize is that calling
3776         updateStateMachine(AnimationStateInput::AnimationStateInput::PlayStatePaused) on an animation that is already
3777         in PausedNew state, will cause it to move to PausedWaitResponse state. This is an issue because upon resuming
3778         we would call AnimationBase::updatePlayState(AnimPlayStatePlaying) which would return early because
3779         AnimationBase::paused() would return false. To address the issue, we no longer call updateStateMachine(PlayStatePaused)
3780         in ImplicitAnimation::reset() when the compositeAnimation is suspended, so that the animation stays in
3781         PausedNew state until we resume. When we resume, AnimationBase::paused() returns false and we actually resume
3782         the animation.
3783
3784         Tests:
3785         fast/animation/css-animation-resuming-when-visible-with-style-change.html
3786         fast/animation/css-animation-resuming-when-visible-with-style-change2.html
3787
3788         * page/animation/ImplicitAnimation.cpp:
3789         (WebCore::ImplicitAnimation::reset):
3790
3791 2017-06-14  Miguel Gomez  <magomez@igalia.com>
3792
3793         REGRESSION(r216901): ImageDecoders: rendering of large images is broken since r216901
3794         https://bugs.webkit.org/show_bug.cgi?id=172502
3795
3796         Reviewed by Carlos Garcia Campos.
3797
3798         When using GTK and WPE image decoders, the decoded frames are stored inside a Vector of
3799         ImageFrames inside the decoders. These ImageFrames have and ImageBackingStore with the
3800         pixels. When a NativeImagePtr is requested, a cairo surface is created from the data
3801         in those ImageBackingStores, but the data keeps being owned by the backing stores. Due
3802         to this, if the decoder that created the image gets destroyed, the backing stores for
3803         the decoded frames get destroyed as well, causing the cairo surfaces that were using
3804         that data to contain garbage (and potentially cause a crash).
3805
3806         To fix this, we change ImageBackingStore so the pixels are stored in a SharedBuffer. The
3807         buffer will be reffed everytime a cairo surface is created with it, and the cairo surfaces
3808         will unref the buffer when they are destroyed. This way, the pixel data won't be freed
3809         while there are cairo surfaces using it.
3810
3811         No new tests, no behaviour change.
3812
3813         * platform/graphics/ImageBackingStore.h:
3814         (WebCore::ImageBackingStore::setSize):
3815         (WebCore::ImageBackingStore::ImageBackingStore):
3816         * platform/image-decoders/cairo/ImageBackingStoreCairo.cpp:
3817         (WebCore::ImageBackingStore::image):
3818
3819 2017-06-14  Zan Dobersek  <zdobersek@igalia.com>
3820
3821         [GStreamer] Align GstBus signal watch priorities with RunLoop dispatches
3822         https://bugs.webkit.org/show_bug.cgi?id=173348
3823
3824         Reviewed by Carlos Garcia Campos.
3825
3826         When adding GstBus signal watches, use the gst_bus_add_signal_watch_full()
3827         function to also specify the GLib priority that's used for the underlying
3828         GSource object.
3829
3830         RunLoopSourcePriority::RunLoopDispatcher should be a good priority value
3831         to use here, matching the RunLoop::dispatch() priority that's e.g. used
3832         in the MainThreadNotifier class.
3833
3834         * platform/audio/gstreamer/AudioDestinationGStreamer.cpp:
3835         (WebCore::AudioDestinationGStreamer::AudioDestinationGStreamer):
3836         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3837         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
3838         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3839         (WebCore::AppendPipeline::AppendPipeline):
3840
3841 2017-06-14  Eric Carlson  <eric.carlson@apple.com>
3842
3843         [MediaStream iOS] Back camera view rendered upside down when in portrait mode
3844         https://bugs.webkit.org/show_bug.cgi?id=173346
3845         <rdar://problem/32713675>
3846
3847         Reviewed by Youenn Fablet.
3848
3849         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3850         (WebCore::AVVideoCaptureSource::computeSampleRotation): Use different rotations for front and
3851         back cameras when device is in portrait orientation.
3852
3853 2017-06-13  Chris Dumez  <cdumez@apple.com>
3854
3855         Event handlers should not be called in frameless documents
3856         https://bugs.webkit.org/show_bug.cgi?id=173233
3857
3858         Reviewed by Sam Weinig.
3859
3860         As per the HTML specification [1], for event handlers on elements, we should use the
3861         element's document to check if scripting is disabled [2]. Scripting is considered to
3862         be disabled if the document has no browsing context (i.e. a frame in WebKit terms).
3863
3864         In JSLazyEventListener::initializeJSFunction(), instead of using the element's
3865         document to do the checks, we would use the script execution context. In most cases,
3866         a node's document and its script execution context are the same so this is not an
3867         issue. However, if the node's document is a document created via JS, its nodes'
3868         script execution context will be the document's context document (i.e the one that
3869         created the document, see implementation of Node::scriptExecutionContext()). In those
3870         cases, using the wrong document is an issue because the document's context document
3871         (aka script execution context) may allow scripting but we still do not want to call
3872         the event handler because its document is frameless.
3873
3874         This impacts documents created by JS, using the following APIs:
3875         - DOMParser.parseFromHTML
3876         - new Document()
3877         - DOMImplementation.createDocument / createHTMLDocument
3878         - XHRs whose responseType is Document.
3879
3880         [1] https://html.spec.whatwg.org/multipage/webappapis.html#getting-the-current-value-of-the-event-handler (step 1.1.)
3881         [2] https://html.spec.whatwg.org/multipage/webappapis.html#concept-n-noscript
3882
3883         Tests: fast/events/event-handler-detached-document-dispatchEvent.html
3884                fast/events/event-handler-detached-document.html
3885
3886         * bindings/js/JSLazyEventListener.cpp:
3887         (WebCore::JSLazyEventListener::initializeJSFunction):
3888
3889 2017-06-13  Antoine Quint  <graouts@apple.com>
3890
3891         Rebaseline media/modern-media-controls/placard-support
3892         https://bugs.webkit.org/show_bug.cgi?id=173340
3893
3894         Reviewed by Dean Jackson.
3895
3896         We make a source change to use a "placard" getter/setter to show or hide a placard, making it
3897         more convenient to test whether a placard has been set.
3898
3899         * Modules/modern-media-controls/controls/inline-media-controls.js:
3900         (InlineMediaControls.prototype.get placard):
3901         (InlineMediaControls.prototype.set placard):
3902         (InlineMediaControls.prototype.showPlacard): Deleted.
3903         (InlineMediaControls.prototype.hidePlacard): Deleted.
3904         * Modules/modern-media-controls/media/placard-support.js:
3905         (PlacardSupport.prototype._updatePlacard):
3906         (PlacardSupport):
3907
3908 2017-06-11  Antoine Quint  <graouts@apple.com>
3909
3910         Rebaseline media/modern-media-controls/fullscreen-support
3911         https://bugs.webkit.org/show_bug.cgi?id=173199
3912
3913         Reviewed by Simon Fraser.
3914
3915         Test: media/modern-media-controls/fullscreen-support/fullscreen-support-press.html
3916
3917         We no longer need to track the "error" event for FullscreenSupport since we don't actually
3918         enable or disable the fullscreen button when an error happens, instead the media controls
3919         code will simply not present it since we'll be showing a placard instead.
3920
3921         * Modules/modern-media-controls/media/fullscreen-support.js:
3922         (FullscreenSupport.prototype.get mediaEvents):
3923
3924 2017-06-13  Matt Rajca  <mrajca@apple.com>
3925
3926         WebsitePolicies: let clients select specific autoplay quirks
3927         https://bugs.webkit.org/show_bug.cgi?id=173343
3928
3929         Reviewed by Alex Christensen.
3930
3931         Tests: Updated API tests accordingly to use new values.
3932
3933         Replace the 'allowsAutoplayQuirks' bool with an OptionSet so clients can selectively
3934         pick auto-play quirks.
3935
3936         * dom/Document.cpp:
3937         (WebCore::Document::processingUserGestureForMedia):
3938         * html/HTMLMediaElement.cpp:
3939         (WebCore::needsAutoplayPlayPauseEventsQuirk):
3940         * loader/DocumentLoader.h:
3941         (WebCore::DocumentLoader::allowedAutoplayQuirks):
3942         (WebCore::DocumentLoader::setAllowedAutoplayQuirks):
3943         (WebCore::DocumentLoader::allowsAutoplayQuirks): Deleted.
3944         (WebCore::DocumentLoader::setAllowsAutoplayQuirks): Deleted.
3945
3946 2017-06-13  Zalan Bujtas  <zalan@apple.com>
3947
3948         Synchronous media query callbacks on nested frames could produced a detached FrameView.
3949         https://bugs.webkit.org/show_bug.cgi?id=173330
3950
3951         Reviewed by Simon Fraser.
3952
3953         This patch fixes the crash when the nested frame's media query callback triggers navigation on the mainframe.
3954         webkit.org/b/173329 is to track whether we should allow synchronous callback firing from FrameView::layout(). 
3955
3956         Covered by show-modal-dialog-during-execCommand.html.
3957
3958         * page/FrameView.cpp:
3959         (WebCore::FrameView::layout):
3960
3961 2017-06-13  Chris Fleizach  <cfleizach@apple.com>
3962
3963         AX[macOS]: Expose Inline property as an accessibility attribute
3964         https://bugs.webkit.org/show_bug.cgi?id=173131
3965         <rdar://problem/32667686>
3966
3967         Reviewed by Joanmarie Diggs.
3968
3969         Expose whether a renderer is inline so that VoiceOver can make better use of that data when deciding what to output.
3970