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