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