Resource Load Statistics: Change grandfathering default to one hour
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-05-24  John Wilander  <wilander@apple.com>
2
3         Resource Load Statistics: Change grandfathering default to one hour
4         https://bugs.webkit.org/show_bug.cgi?id=172524
5         <rdar://problem/32360462>
6
7         Reviewed by Brent Fulgham.
8
9         Covered by existing test.
10
11         * loader/ResourceLoadStatisticsStore.cpp:
12
13 2017-05-24  Jer Noble  <jer.noble@apple.com>
14
15         Rename DisplaySleepDisabler -> SleepDisabler
16         https://bugs.webkit.org/show_bug.cgi?id=172478
17
18         Reviewed by Sam Weinig.
19
20         Rename DisplaySleepDisabler to SleepDisabler so that different (i.e., non-Display) sleep types can be
21         added in a future change.
22
23         * WebCore.xcodeproj/project.pbxproj:
24         * html/HTMLMediaElement.cpp:
25         (WebCore::HTMLMediaElement::updateSleepDisabling):
26         * html/HTMLMediaElement.h:
27         * platform/SleepDisabler.cpp: Renamed from Source/WebCore/platform/DisplaySleepDisabler.cpp.
28         (WebCore::SleepDisabler::create):
29         (WebCore::SleepDisabler::SleepDisabler):
30         (WebCore::SleepDisabler::~SleepDisabler):
31         * platform/SleepDisabler.h: Renamed from Source/WebCore/platform/DisplaySleepDisabler.h.
32         * platform/cocoa/SleepDisablerCocoa.cpp: Renamed from Source/WebCore/platform/cocoa/DisplaySleepDisablerCocoa.cpp.
33         (WebCore::SleepDisabler::create):
34         (WebCore::SleepDisablerCocoa::SleepDisablerCocoa):
35         (WebCore::SleepDisablerCocoa::~SleepDisablerCocoa):
36         * platform/cocoa/SleepDisablerCocoa.h: Renamed from Source/WebCore/platform/cocoa/DisplaySleepDisablerCocoa.h.
37         * platform/mac/WebVideoFullscreenController.h:
38         * platform/mac/WebVideoFullscreenController.mm:
39         (-[WebVideoFullscreenController updatePowerAssertions]):
40         * CMakeLists.txt:
41         * PlatformMac.cmake:
42         * WebCore.order:
43
44 2017-05-24  Per Arne Vollan  <pvollan@apple.com>
45
46         [Win] Create unique network storage session for each DRT.
47         https://bugs.webkit.org/show_bug.cgi?id=172540
48
49         Reviewed by Brent Fulgham.
50
51         During layout testing, each DRT instance should have its own network storage session.
52
53         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
54         (WebCore::NetworkStorageSession::switchToNewTestingSession):
55
56 2017-05-24  Sam Weinig  <sam@webkit.org>
57
58         [WebIDL] Overloaded functions unnecessarily duplicate argument checks
59         https://bugs.webkit.org/show_bug.cgi?id=172481
60
61         Reviewed by Chris Dumez.
62
63         * bindings/scripts/CodeGeneratorJS.pm:
64         (GenerateHeader):
65         (GeneratePropertiesHashTable):
66         Update for rename of GetConditionalForFunctionConsideringOverloads.
67
68         (AreTypesDistinguishableForOverloadResolution):
69         Remove unnecessary subroutine isDictionary that can be replaced by
70         a direct call to $codeGenerator->IsDictionaryType().
71
72         (GetConditionalForFunctionConsideringOverloads):
73         Renamed from getConditionalForFunctionConsideringOverloads.
74
75         (GenerateOverloadDispatcher):
76         Renamed from GenerateOverloadedFunctionOrConstructor. Moved Constructor/Operation/LegacyCaller
77         specific code out, and into parameters.
78
79         (GenerateImplementation):
80         Moved operation generation out into its own subroutine.
81
82         (GenerateOperationDefinition): Added.
83         Moved from GenerateImplementation.
84
85         (GenerateLegacyCallerDefinitions):
86         Pass function name and signature to GenerateOverloadDispatcher.
87
88         (GenerateArgumentsCountCheck):
89         Don't generate an argument check if this is an overloaded function. The argument
90         checks happen in the overload dispatcher.
91
92         (NeedsExplicitPropagateExceptionCall):
93         (GenerateParametersCheck):
94         (GenerateImplementationFunctionCall):
95         Replace IsReturningPromise with more direct check.
96
97         (GenerateConstructorDefinitions):
98         Pass function name and signature to GenerateOverloadDispatcher.
99
100         (getConditionalForFunctionConsideringOverloads): Renamed to GetConditionalForFunctionConsideringOverloads.
101         (GenerateOverloadedFunctionOrConstructor): Renamed to GenerateOverloadDispatcher.
102         (IsReturningPromise): Deleted.
103
104         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
105         * bindings/scripts/test/JS/JSTestInterface.cpp:
106         * bindings/scripts/test/JS/JSTestObj.cpp:
107         * bindings/scripts/test/TestInterface.idl:
108         Update test results.
109
110 2017-05-24  Commit Queue  <commit-queue@webkit.org>
111
112         Unreviewed, rolling out r217319.
113         https://bugs.webkit.org/show_bug.cgi?id=172538
114
115         This patch broke iOS Simulator Debug build (Requested by fredw
116         on #webkit).
117
118         Reverted changeset:
119
120         "CoreAudioCaptureSource is ducking system sound"
121         https://bugs.webkit.org/show_bug.cgi?id=172512
122         http://trac.webkit.org/changeset/217319
123
124 2017-05-24  Antoine Quint  <graouts@apple.com>
125
126         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
127         https://bugs.webkit.org/show_bug.cgi?id=168409
128
129         Unreviewed.
130
131         Remove temporary logging which prevents performance bots from reporting useful data.
132
133         * page/Page.cpp:
134         (WebCore::Page::suspendScriptedAnimations):
135
136 2017-05-24  Javier Fernandez  <jfernandez@igalia.com>
137
138         [css-grid] Ignore collapsed tracks on content-distribution alignment
139         https://bugs.webkit.org/show_bug.cgi?id=172493
140
141         Reviewed by Manuel Rego Casasnovas.
142
143         The CSS Box Alignment spec states that we should ignore the collapsed
144         tracks when computing the Distribution Alignment space to assign to the
145         different grid tracks.
146
147         No new tests, just unskipping the web-platform-tests imported to verify this use case.
148
149         * rendering/RenderGrid.cpp:
150         (WebCore::RenderGrid::populateGridPositionsForDirection):
151
152 2017-05-24  Wenson Hsieh  <wenson_hsieh@apple.com>
153
154         Respect image UTIs when writing to item providers when beginning data interaction on an image
155         https://bugs.webkit.org/show_bug.cgi?id=172436
156         <rdar://problem/31786569>
157
158         Reviewed by Beth Dakin.
159
160         Previously, when beginning writing images to the WebItemProviderPasteboard, we would create a new UIImage and
161         use standard UIImage UIItemProviderWriting utilities to register the image to the pasteboard. This is lossy for
162         gifs, since UIImage doesn't inherently know how to represent gifs. Instead, register the raw image data directly
163         to the UTI type corresponding to the MIME type of the image, and use UIImage's item provider writing capability
164         as a fallback when the raw resourceData is unavailable.
165
166         Augments existing unit tests, and also adds a new unit test:
167         DataInteractionTests.ImageDoesNotUseElementSizeAsEstimatedSize
168
169         * platform/ios/PlatformPasteboardIOS.mm:
170         (WebCore::PlatformPasteboard::writeObjectRepresentations):
171
172 2017-05-23  Eric Carlson  <eric.carlson@apple.com>
173
174         CoreAudioCaptureSource is ducking system sound
175         https://bugs.webkit.org/show_bug.cgi?id=172512
176
177         Reviewed by Youenn Fablet.
178
179         Manual testing.
180
181         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
182         (WebCore::CoreAudioSharedUnit::setupAudioUnit):
183         (WebCore::CoreAudioSharedUnit::defaultOutputDevice):
184
185 2017-05-23  Said Abou-Hallawa  <sabouhallawa@apple.com>
186
187         [iOS] Speculative fix for a PLT regression
188         <rdar://problem/32361890>
189
190         Unreviewed.
191
192         Make sure CGImageSourceGetTypeWithData() is called with a buffer which is
193         32 bytes or more.
194
195         * platform/graphics/cg/ImageDecoderCG.cpp:
196         (WebCore::ImageDecoder::ImageDecoder):
197
198 2017-05-22  Jiewen Tan  <jiewen_tan@apple.com>
199
200         [WebCrypto] Support RSA-PSS
201         https://bugs.webkit.org/show_bug.cgi?id=170869
202         <rdar://problem/31640672>
203
204         Reviewed by Brent Fulgham.
205
206         This patch implements RSA-PSS according to the spec: https://www.w3.org/TR/WebCryptoAPI/#rsa-pss.
207         Supported operations include sign, verify, generateKey, importKey and exportKey.
208
209         Tests: crypto/subtle/rsa-pss-generate-export-key-jwk-sha1.html
210                crypto/subtle/rsa-pss-generate-export-key-jwk-sha224.html
211                crypto/subtle/rsa-pss-generate-export-key-jwk-sha256.html
212                crypto/subtle/rsa-pss-generate-export-key-jwk-sha384.html
213                crypto/subtle/rsa-pss-generate-export-key-jwk-sha512.html
214                crypto/subtle/rsa-pss-generate-export-key-pkcs8.html
215                crypto/subtle/rsa-pss-generate-export-key-spki.html
216                crypto/subtle/rsa-pss-generate-key.html
217                crypto/subtle/rsa-pss-import-jwk-private-key.html
218                crypto/subtle/rsa-pss-import-jwk-public-key-empty-usages.html
219                crypto/subtle/rsa-pss-import-jwk-public-key-sha1.html
220                crypto/subtle/rsa-pss-import-jwk-public-key-sha224.html
221                crypto/subtle/rsa-pss-import-jwk-public-key-sha256.html
222                crypto/subtle/rsa-pss-import-jwk-public-key-sha384.html
223                crypto/subtle/rsa-pss-import-jwk-public-key-sha512.html
224                crypto/subtle/rsa-pss-import-key-sign-large-salt.html
225                crypto/subtle/rsa-pss-import-key-sign.html
226                crypto/subtle/rsa-pss-import-key-verify.html
227                crypto/subtle/rsa-pss-import-pkcs8-key.html
228                crypto/subtle/rsa-pss-import-spki-key-empty-usages.html
229                crypto/subtle/rsa-pss-import-spki-key.html
230                crypto/workers/subtle/rsa-pss-import-key-sign.html
231                crypto/workers/subtle/rsa-pss-import-key-verify.html
232
233         * CMakeLists.txt:
234         * DerivedSources.make:
235         * PlatformGTK.cmake:
236         * WebCore.xcodeproj/project.pbxproj:
237         * bindings/js/JSSubtleCryptoCustom.cpp:
238         (WebCore::normalizeCryptoAlgorithmParameters):
239         * crypto/CryptoAlgorithmParameters.h:
240         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp: Added.
241         (WebCore::CryptoAlgorithmRSA_PSS::create):
242         (WebCore::CryptoAlgorithmRSA_PSS::identifier):
243         (WebCore::CryptoAlgorithmRSA_PSS::sign):
244         (WebCore::CryptoAlgorithmRSA_PSS::verify):
245         (WebCore::CryptoAlgorithmRSA_PSS::generateKey):
246         (WebCore::CryptoAlgorithmRSA_PSS::importKey):
247         (WebCore::CryptoAlgorithmRSA_PSS::exportKey):
248         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h: Added.
249         * crypto/mac/CryptoAlgorithmECDSAMac.cpp:
250         (WebCore::cryptoDigestAlgorithm): Deleted.
251         Extract function cryptoDigestAlgorithm to a separate file.
252         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
253         (WebCore::cryptoDigestAlgorithm): Deleted.
254         Extract function cryptoDigestAlgorithm to a separate file.
255         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp: Added.
256         (WebCore::signRSA_PSS):
257         (WebCore::verifyRSA_PSS):
258         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
259         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
260         * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
261         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
262         * crypto/mac/CryptoDigestAlgorithm.h: Added.
263         (WebCore::cryptoDigestAlgorithm):
264         Have cryptoDigestAlgorithm in a separate file.
265         * crypto/parameters/CryptoAlgorithmRsaPssParams.h: Added.
266         * crypto/parameters/RsaPssParams.idl: Added.
267
268 2017-05-23  Eric Carlson  <eric.carlson@apple.com>
269
270         [MediaStream] Allow transition from autoplay to play when a capture stream begins.
271         https://bugs.webkit.org/show_bug.cgi?id=172391
272         <rdar://problem/32304934>
273
274         Reviewed by Youenn Fablet.
275
276         Manual testing. Regression testing to be added as a follow-up.
277
278         * dom/Document.cpp:
279         (WebCore::Document::updateIsPlayingMedia): Call mediaStreamCaptureStateChanged when capture
280         state changes.
281         (WebCore::Document::registerForMediaStreamStateChangeCallbacks):
282         (WebCore::Document::unregisterForMediaStreamStateChangeCallbacks):
283         (WebCore::Document::mediaStreamCaptureStateChanged): Call all registered elements.
284         * dom/Document.h:
285         * html/HTMLMediaElement.cpp:
286         (WebCore::HTMLMediaElement::registerWithDocument): Register for capture state changes.
287         (WebCore::HTMLMediaElement::unregisterWithDocument): Unregister for capture state changes.
288         (WebCore::HTMLMediaElement::mediaStreamCaptureStateChanged): Attempt autoplay as necessary.
289         * html/HTMLMediaElement.h:
290
291 2017-05-15  Matt Rajca  <mrajca@apple.com>
292
293         Replace autoplay events that fire at navigation with a DidAutoplayMediaPastThreshold event.
294         https://bugs.webkit.org/show_bug.cgi?id=172138
295
296         Reviewed by Alex Christensen.
297
298         The current autoplay signals that are fired at navigation may not get delivered to the UIProcess if the WebPage is close()'ed around
299         this time. This patch simplifies this and just notifies clients if a media element has played past a threshold.
300
301         Updated API tests.
302
303         * html/HTMLMediaElement.cpp:
304         (WebCore::HTMLMediaElement::playbackProgressTimerFired):
305         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
306         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
307         (WebCore::HTMLMediaElement::userDidInterfereWithAutoplay):
308         * page/AutoplayEvent.h:
309
310 2017-05-23  Dean Jackson  <dino@apple.com>
311
312         checkGPUStatus needs to exercise instancing calls
313         https://bugs.webkit.org/show_bug.cgi?id=172520
314         <rdar://problem/23118395>
315
316         Reviewed by Brent Fulgham.
317
318         The checkGPUStatus method (formerly checkGPUStatusIfNecessary) was
319         not being called after the drawArrays/Elements instancing calls.
320
321         I also added a test case to exercise the recovery logic.
322
323         Test: fast/canvas/webgl/lose-context-on-status-failure.html
324
325         * html/canvas/WebGLRenderingContextBase.cpp:
326         (WebCore::WebGLRenderingContextBase::setFailNextGPUStatusCheck): Force
327         the next checkGPUStatus on the GC3D to fail.
328         * html/canvas/WebGLRenderingContextBase.h:
329         * platform/graphics/GraphicsContext3D.h: Rename a function, and make
330         the number of calls we wait before checking per instance, rather than
331         static (which might have meant we're only ever checking after one canvas on
332         a page with multiple contexts).
333         (WebCore::GraphicsContext3D::setFailNextGPUStatusCheck):
334         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
335         (WebCore::GraphicsContext3D::checkGPUStatus): Renamed.
336         (WebCore::GraphicsContext3D::checkGPUStatusIfNecessary): Deleted.
337         * platform/graphics/mac/GraphicsContext3DMac.mm:
338         (WebCore::GraphicsContext3D::checkGPUStatus): Improve the logic.
339         (WebCore::GraphicsContext3D::checkGPUStatusIfNecessary): Deleted.
340         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
341         (WebCore::GraphicsContext3D::clear):
342         (WebCore::GraphicsContext3D::drawArrays):
343         (WebCore::GraphicsContext3D::drawElements):
344         (WebCore::GraphicsContext3D::drawArraysInstanced): Add a call to checkGPUStatus.
345         (WebCore::GraphicsContext3D::drawElementsInstanced): Ditto.
346         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
347         (WebCore::GraphicsContext3D::checkGPUStatus):
348         (WebCore::GraphicsContext3D::checkGPUStatusIfNecessary): Deleted.
349         * testing/Internals.cpp: Implement the internal call to cause the next
350         check to fail.
351         (WebCore::Internals::failNextGPUStatusCheck):
352         * testing/Internals.h:
353         * testing/Internals.idl:
354
355 2017-05-23  Sam Weinig  <sam@webkit.org>
356
357         [WebIDL] Further cleanup enumeration handling
358         https://bugs.webkit.org/show_bug.cgi?id=172516
359
360         Reviewed by Chris Dumez.
361
362         * bindings/scripts/CodeGeneratorJS.pm:
363         (GeneratePut):
364         (GeneratePutByIndex):
365         (GenerateDictionaryImplementationContent):
366         (GenerateParametersCheck):
367         (GenerateCallbackImplementationContent):
368         Update now that JSValueToNative doesn't have a second return value.
369
370         (GenerateImplementation):
371         Add enumeration special casing to attribute setting code, where it is special
372         cased in the standard
373
374         (PassArgumentExpression):
375         Stop special casing enumerations.
376         
377         (IsValidContextForJSValueToNative):
378         Assert that enums are never passed to JSValueToNative in an attribute context.
379
380         (JSValueToNative):
381         Remove enumeration special case and second return value (which was always 1).
382
383         * bindings/scripts/test/JS/JSTestObj.cpp:
384         (WebCore::setJSTestObjEnumAttrFunction):
385         (WebCore::setJSTestObjImplementationEnumAttrFunction):
386         (WebCore::setJSTestObjAttributeWithReservedEnumTypeFunction):
387         Update results.
388
389 2017-05-22  Simon Fraser  <simon.fraser@apple.com>
390
391         Snapshotting via -renderInContext: should do synchronous image decodes
392         https://bugs.webkit.org/show_bug.cgi?id=172485
393         rdar://problem/32276146
394
395         Reviewed by Tim Horton.
396
397         When UIWebView clients snapshot the view via -renderInContext: on the UIView's layer,
398         WebKit should do synchronous image decodes so that the images show in the snapshot.
399
400         Fix by plumbing through a "snapshotting" paint behavior flag from two source locations:
401         WebSimpleLayer, used by compositing layers, and LegacyTileLayer, used for the WK1 tile cache.
402         On WebSimpleLayer the flag propagates through PlatformCALayer to GraphicsLayer, and on LegacyTileLayer
403         it sets some state on the WAKWindow, which is detected by -[WebFrame _paintBehaviorForDestinationContext:].
404         In both cases, the flag becomes PaintBehaviorSnapshotting which is passed down through painting
405         in PaintInfo.paintBehavior.
406
407         Fix code that was checking paintBehavior on the FrameView to just looking at PaintInfo.paintBehavior,
408         which required passing PaintInfo along in RenderImage::paintIntoRect().
409
410         We can't just use the PaintBehaviorFlattenCompositingLayers flag, because that triggers
411         a flattening paint of compositing layers, and we don't want that behavior for -renderInContext:,
412         since CoreAnimation calls -renderInContext: on each of our layers and we need to avoid double-painting.
413         So PaintBehaviorSnapshotting is now added to the call sites that also set PaintBehaviorFlattenCompositingLayers
414         in most cases.
415
416         Tested by SnapshotViaRenderInContext API test.
417
418         * html/shadow/MediaControlElements.cpp:
419         (WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
420         * page/FrameView.cpp:
421         (WebCore::FrameView::willPaintContents):
422         (WebCore::FrameView::paintContentsForSnapshot):
423         * page/PageOverlayController.cpp:
424         (WebCore::PageOverlayController::paintContents):
425         * page/PageOverlayController.h:
426         * page/mac/ServicesOverlayController.h:
427         * page/mac/ServicesOverlayController.mm:
428         (WebCore::ServicesOverlayController::Highlight::paintContents):
429         * platform/graphics/GraphicsLayer.cpp:
430         (WebCore::GraphicsLayer::paintGraphicsLayerContents):
431         * platform/graphics/GraphicsLayer.h:
432         * platform/graphics/GraphicsLayerClient.h:
433         (WebCore::GraphicsLayerClient::paintContents):
434         * platform/graphics/ca/GraphicsLayerCA.cpp:
435         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
436         (WebCore::GraphicsLayerCA::platformCALayerPaintContents):
437         * platform/graphics/ca/GraphicsLayerCA.h:
438         * platform/graphics/ca/PlatformCALayer.h:
439         * platform/graphics/ca/PlatformCALayerClient.h:
440         * platform/graphics/ca/TileCoverageMap.cpp:
441         (WebCore::TileCoverageMap::platformCALayerPaintContents):
442         * platform/graphics/ca/TileCoverageMap.h:
443         * platform/graphics/ca/TileGrid.cpp:
444         (WebCore::TileGrid::platformCALayerPaintContents):
445         * platform/graphics/ca/TileGrid.h:
446         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
447         (PlatformCALayer::drawLayerContents):
448         * platform/graphics/mac/WebLayer.mm:
449         (-[WebLayer drawInContext:]):
450         (-[WebSimpleLayer renderInContext:]):
451         (-[WebSimpleLayer drawInContext:]):
452         * platform/ios/LegacyTileCache.h: Use initializers.
453         * platform/ios/LegacyTileCache.mm:
454         (WebCore::LegacyTileCache::LegacyTileCache):
455         (WebCore::LegacyTileCache::drawWindowContent):
456         (WebCore::LegacyTileCache::drawLayer):
457         * platform/ios/LegacyTileLayer.h:
458         * platform/ios/LegacyTileLayer.mm:
459         (-[LegacyTileHostLayer renderInContext:]):
460         (-[LegacyTileLayer renderInContext:]):
461         (-[LegacyTileLayer drawInContext:]):
462         (+[LegacyTileLayer layerBeingPainted]): Deleted. There were no callers.
463         * platform/ios/wak/WAKView.mm:
464         (-[WAKView _drawRect:context:lockFocus:]): bool -> BOOL
465         * platform/ios/wak/WAKWindow.h:
466         * platform/ios/wak/WAKWindow.mm:
467         (-[WAKWindow setIsInSnapshottingPaint:]):
468         (-[WAKWindow isInSnapshottingPaint]):
469         * rendering/PaintPhase.h:
470         * rendering/RenderBox.cpp:
471         (WebCore::RenderBox::paintMaskImages):
472         * rendering/RenderBoxModelObject.cpp:
473         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
474         * rendering/RenderImage.cpp:
475         (WebCore::RenderImage::paintReplaced):
476         (WebCore::RenderImage::paintIntoRect):
477         * rendering/RenderImage.h:
478         * rendering/RenderLayer.cpp:
479         (WebCore::RenderLayer::paintLayerContents):
480         (WebCore::RenderLayer::paintForegroundForFragments):
481         * rendering/RenderLayerBacking.cpp:
482         (WebCore::RenderLayerBacking::paintContents):
483         * rendering/RenderLayerBacking.h:
484         * rendering/RenderLayerCompositor.cpp:
485         (WebCore::RenderLayerCompositor::paintContents):
486         * rendering/RenderLayerCompositor.h:
487         * rendering/RenderVideo.cpp:
488         (WebCore::RenderVideo::paintReplaced):
489
490 2017-05-23  Myles C. Maxfield  <mmaxfield@apple.com>
491
492         Remove dead ENABLE(FONT_LOAD_EVENTS) code
493         https://bugs.webkit.org/show_bug.cgi?id=172517
494
495         Rubber-stamped by Simon Fraser.
496
497         No new tests because there is no behavior change.
498
499         * CMakeLists.txt:
500         * Configurations/FeatureDefines.xcconfig:
501         * DerivedSources.cpp:
502         * DerivedSources.make:
503         * WebCore.xcodeproj/project.pbxproj:
504         * css/CSSAllInOne.cpp:
505         * css/CSSFontFaceLoadEvent.cpp: Removed.
506         * css/CSSFontFaceLoadEvent.h: Removed.
507         * css/CSSFontFaceLoadEvent.idl: Removed.
508         * dom/EventNames.in:
509         * page/FrameView.cpp:
510         (WebCore::FrameView::performPostLayoutTasks):
511         * page/RuntimeEnabledFeatures.h:
512         (WebCore::RuntimeEnabledFeatures::setFontLoadEventsEnabled): Deleted.
513         (WebCore::RuntimeEnabledFeatures::fontLoadEventsEnabled): Deleted.
514
515 2017-05-23  Chris Dumez  <cdumez@apple.com>
516
517         Unreviewed, roll out r215229
518
519         It caused CachedScripts in MemoryCache to be reused with different encodings
520         even though CachedScript potentially has already decoded data or cached hash
521         with a previous encoding.
522
523         * loader/TextResourceDecoder.cpp:
524         (WebCore::TextResourceDecoder::setEncoding):
525         * loader/TextResourceDecoder.h:
526         (WebCore::TextResourceDecoder::sawError):
527         (WebCore::TextResourceDecoder::encodingSet): Deleted.
528         * loader/cache/CachedCSSStyleSheet.cpp:
529         (WebCore::CachedCSSStyleSheet::setEncoding):
530         * loader/cache/CachedResource.cpp:
531         (WebCore::CachedResource::CachedResource):
532         * loader/cache/CachedResource.h:
533         (WebCore::CachedResource::hasUnknownEncoding):
534         (WebCore::CachedResource::setHasUnknownEncoding):
535         * loader/cache/CachedResourceLoader.cpp:
536         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
537
538 2017-05-23  Zalan Bujtas  <zalan@apple.com>
539
540         ASSERTION FAILED: !renderer().view().needsLayout() while running media/video-main-content-autoplay.html
541         https://bugs.webkit.org/show_bug.cgi?id=172476
542
543         Reviewed by Simon Fraser.
544
545         This patch decouples the layout call logic from the post layout task timer setup.
546         Just because we are switching over to asynchronous performPostLayoutTasks() it should not stop us from
547         running layout on a dirty tree (we could encounter a forced layout (which sets m_postLayoutTasksTimer active)
548         and a subsequent tree mutation during performPostLayoutTasks()). 
549
550         There are a few different ways to end up here:
551         root layout is done -> call performPostLayoutTasks() synchronously -> 
552         1. tree stays clean -> no action needed.
553         2. tree gets dirty -> setup performPostLayoutTasks timer -> run nested layout -> since m_postLayoutTasksTimer is active()
554         we don't try to run performPostLayoutTasks() while in the nested layout and we return with a clean tree.         
555
556         * page/FrameView.cpp:
557         (WebCore::FrameView::layout):
558
559 2017-05-23  Wenson Hsieh  <wenson_hsieh@apple.com>
560
561         Multiple links should be inserted separately when performing data interaction
562         https://bugs.webkit.org/show_bug.cgi?id=172489
563         <rdar://problem/31510832>
564
565         Reviewed by Dan Bernstein.
566
567         In WebContentReader, URLs are currently always inserted inline. When inserting multiple items, this causes
568         adjacent links to be inserted on a single line with no break, which is undesirable. To address this, when
569         appending links from additional items to the existing document fragment in WebContentReader, insert a new space
570         prior to inserting the anchor element.
571
572         New unit test: DataInteractionTests.ExternalSourceMultipleURLsToContentEditable
573
574         * editing/ios/EditorIOS.mm:
575         (WebCore::Editor::WebContentReader::addFragment):
576
577         Tweak to add all children of the new fragment, rather than just the first child.
578
579         (WebCore::Editor::WebContentReader::readURL):
580
581 2017-05-23  Sam Weinig  <sam@webkit.org>
582
583         [WebIDL] Remove some unnecessary specialization for enum types
584         https://bugs.webkit.org/show_bug.cgi?id=172482
585
586         Reviewed by Chris Dumez.
587
588         - Removes convertEnumeration template function and generated specialization.
589           convert<IDLEnumeration<T>> now does the entire check, and can have specialized
590           exceptions.
591         - Treats enums more like all other types, removing enum specific code in the
592           generator.
593
594         Also fixes some order of exception bugs as the convertEnumeration<T> implementations
595         were not correctly catching exceptions thrown in parseEnumeration<T>.
596
597         * bindings/js/JSDOMConvertEnumeration.h:
598         (WebCore::Converter<IDLEnumeration<T>>::convert):
599         Remove convertEnumeration and move implementation to convert. Add ExceptionThrower
600         parameter to retain argument conversion exception specialization and allow future
601         specialization for other contexts.
602
603         * bindings/js/JSSubtleCryptoCustom.cpp:
604         (WebCore::jsSubtleCryptoFunctionImportKeyPromise):
605         (WebCore::jsSubtleCryptoFunctionExportKeyPromise):
606         (WebCore::jsSubtleCryptoFunctionWrapKeyPromise):
607         (WebCore::jsSubtleCryptoFunctionUnwrapKeyPromise):
608         Switch from convertEnumeration<T> to convert<IDLEnumeration<T>>.
609
610         * bindings/scripts/CodeGeneratorJS.pm:
611         (GetArgumentExceptionFunction):
612         Add (really move from GenerateParametersCheck) enum specific argument conversion exception.
613
614         (PassArgumentExpression):
615         Allow the enum specific code for attributes to remain by explicitly checking the context.
616         Attribute setters use parseEnumeration<T> explicitly, as WebIDL mandates slightly different
617         behavior, specially that they don't throw.
618
619         (GenerateEnumerationImplementationContent):
620         (GenerateEnumerationHeaderContent):
621         Remove convertEnumeration<T>.
622
623         (GenerateParametersCheck):
624         Remove entire branch devoted to enums. The main parameter check is now mature enough
625         to handle them.
626
627         (JSValueToNative):
628         Like in PassArgumentExpression, we need to retain the specialize behavior for attributes.
629         Before, JSValueToNative was only called for enums with a context of IDLAttribute or IDLDictionaryMember,
630         but now that we use if IDLArguments as well, it makes more sense to make this check in terms
631         of the odd man out, IDLAttribute.
632
633         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
634         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
635         * bindings/scripts/test/JS/JSTestObj.cpp:
636         * bindings/scripts/test/JS/JSTestObj.h:
637         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
638         * bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
639         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp:
640         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.h:
641         Update test results.
642
643 2017-05-23  Romain Bellessort  <romain.bellessort@crf.canon.fr>
644
645         [Readable Streams API] Align respondInClosedState with spec
646         https://bugs.webkit.org/show_bug.cgi?id=172288
647
648         Reviewed by Chris Dumez.
649
650         Two changes are implemented in this patch:
651         - Change #1: An issue was reported to GH [1] while working on respondInClosedState 
652         implementation. This issue has now been fixed, and this patch aligns implementation 
653         with spec [2].
654         - Change #2: In addition, this patch also fixes a bug that went unnoticed as code 
655         is not yet reachable (usage of controller.@reader is not valid and is therefore 
656         replaced by controller.@controlledReadableStream.@reader).
657
658         [1] https://github.com/whatwg/streams/issues/686
659         [2] https://streams.spec.whatwg.org/#readable-byte-stream-controller-respond-in-closed-state
660
661         No added test as:
662         - Change #1 does not change behavior;
663         - Change #2 is not testable as the code is not yet reachable.
664
665         * Modules/streams/ReadableByteStreamInternals.js:
666         (readableByteStreamControllerRespondInClosedState): Aligned with spec.
667
668 2017-05-22 Emilio Cobos Álvarez  <ecobos@igalia.com>
669
670         Add a RuntimeEnabledFeature for display: contents, defaulted to false.
671         https://bugs.webkit.org/show_bug.cgi?id=171984
672
673         Reviewed by Antti Koivisto.
674
675         The "defaulted to false" is not only because there are spec issues,
676         but because I ran the WPT suite, and there was a fair amount of
677         crashes and messed render trees.
678
679         Tests: imported/w3c/web-platform-tests/innerText/getter.html
680
681         * css/StyleResolver.cpp:
682         (WebCore::StyleResolver::adjustRenderStyle):
683         * page/RuntimeEnabledFeatures.h:
684         (WebCore::RuntimeEnabledFeatures::setDisplayContentsEnabled):
685         (WebCore::RuntimeEnabledFeatures::displayContentsEnabled):
686
687 2017-05-22  Myles C. Maxfield  <mmaxfield@apple.com>
688
689         Update font-style's implementation in the font selection algorithm
690         https://bugs.webkit.org/show_bug.cgi?id=169453
691
692         Reviewed by Simon Fraser.
693
694         Previously, we were treating "font-style: oblique" exactly the same as "font-style: italic".
695         These values were parsed to the same internal data type. However, variation fonts may have two
696         distinct axes: 'slnt' and 'ital'. Therefore, we need to keep a bool of state which represents
697         which of these two axes we should be setting when we apply font variations. We can do this by
698         making the "font-style" parser a "custom" parser. The implementation of these custom functions
699         will set both the italic value on the FontDescription as well as this extra bool.
700
701         We don't, however, want to treat these values as distinct for the purposese of font selection.
702         The fact that we treat oblique fonts the same as italic fonts is a feature, not a bug. Therefore,
703         the font selection algorithm is not made aware of this distinction. This is why we don't want to
704         package up the bool and FontSelectionValue into a class: font selection only cares about the
705         FontSelectionValue, so conceptually they shouldn't be joined. (The FontSelectionValue already
706         exists within a collection of all the things font selection needs to know about.)
707
708         Now that there is this extra bit of state on the FontDescription, we can do a little better when
709         computing the result of getComputedStyle(). Previously, we were always returning "italic" even
710         when "oblique" was specified. Now, we can return the correct one. However, this extra bit of
711         state is not kept on the CSSFontFace (because it doesn't need to be), which means we can only
712         improve the computed style of an element, rather than the cssText of an @font-face rule.
713
714         Test: fast/text/font-style-parse.html
715
716         * css/CSSComputedStyleDeclaration.cpp:
717         (WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
718         (WebCore::fontStyleFromStyle):
719         (WebCore::fontShorthandValueForSelectionProperties):
720         * css/CSSComputedStyleDeclaration.h:
721         * css/CSSFontFaceSet.h:
722         * css/CSSProperties.json:
723         * css/FontFace.cpp:
724         (WebCore::FontFace::style):
725         * css/FontSelectionValueInlines.h:
726         (WebCore::fontStyleKeyword):
727         * css/StyleBuilderConverter.h:
728         (WebCore::StyleBuilderConverter::convertFontStyle): Deleted.
729         * css/StyleBuilderCustom.h:
730         (WebCore::StyleBuilderCustom::applyInitialFontStyle):
731         (WebCore::StyleBuilderCustom::applyInheritFontStyle):
732         (WebCore::StyleBuilderCustom::applyValueFontStyle):
733         * platform/graphics/FontCache.h:
734         (WebCore::FontDescriptionKey::makeFlagsKey):
735         * platform/graphics/FontDescription.cpp:
736         (WebCore::FontDescription::FontDescription):
737         * platform/graphics/FontDescription.h:
738         (WebCore::FontDescription::shouldUseItalicVariationAxis):
739         (WebCore::FontDescription::setShouldUseItalicVariationAxis):
740         (WebCore::FontDescription::operator==):
741         (WebCore::FontCascadeDescription::initialShouldUseItalicVariationAxis):
742         * platform/graphics/cocoa/FontCacheCoreText.cpp:
743         (WebCore::preparePlatformFont):
744         (WebCore::fontWithFamily):
745         (WebCore::FontCache::createFontPlatformData):
746         (WebCore::FontCache::systemFallbackForCharacters):
747         * platform/graphics/mac/FontCustomPlatformData.cpp:
748         (WebCore::FontCustomPlatformData::fontPlatformData):
749
750 2017-05-22  Myles C. Maxfield  <mmaxfield@apple.com>
751
752         Support calc() in font-variation-settings and font-feature-settings
753         https://bugs.webkit.org/show_bug.cgi?id=171032
754
755         Reviewed by David Hyatt.
756
757         Tests: css3/font-feature-settings-calc.html
758                fast/text/variations/calc.html
759
760         We can use the convenience functions in CSSPropertyParserHelpers.cpp.
761
762         * css/parser/CSSPropertyParser.cpp:
763         (WebCore::consumeFontFeatureTag):
764         (WebCore::consumeFontVariationTag):
765
766 2017-05-22  Michael Catanzaro  <mcatanzaro@igalia.com>
767
768         Unreviewed, attempt to fix test runner by removing Unicode character from stderr output
769         https://bugs.webkit.org/show_bug.cgi?id=168409
770
771         * page/Page.cpp:
772         (WebCore::Page::suspendScriptedAnimations):
773
774 2017-05-22  Said Abou-Hallawa  <sabouhallawa@apple.com>
775
776         Avoid moving to the second frame of an animated image before the first frame has finished decoding
777         https://bugs.webkit.org/show_bug.cgi?id=172461
778
779         Reviewed by Simon Fraser.
780
781         Sometimes the frameCount of an animated image gets changed when more data
782         is received. The problem is we may start decoding the image as if it were
783         a static large image and the decoding of this first frame finishes after 
784         the image starts animating.
785
786         * platform/graphics/BitmapImage.cpp:
787         (WebCore::BitmapImage::draw):
788         (WebCore::BitmapImage::imageFrameAvailableAtIndex):
789
790 2017-05-20  Alex Christensen  <achristensen@webkit.org>
791
792         REGRESSION(r215686): O(n^2) algorithm in CachedRawResource::addDataBuffer
793         https://bugs.webkit.org/show_bug.cgi?id=172406
794         <rdar://32109532>
795
796         Reviewed by Brady Eidson.
797
798         CachedRawResource::calculateIncrementalDataChunk was calling SharedBuffer::data each time the data
799         was appended to the SharedBuffer. This causes the data to be copied from two segments to one segment,
800         which causes the O(n^2) behavior I was worried about in r215686. These append/data/append/data calls
801         used to cause O(1) copies per byte which was amortized because of the exponential growth of the buffer.
802         After this change, there should be 0 copies per byte here, and instead a O(log(n)) binary search in the
803         call to std::upper_bound to find the next segment of data with a given starting location in the SharedBuffer.
804         We need to store the additional information of the offsets of the beginnings of the segments in a
805         SharedBuffer. This doesn't asymptotically increase our memory usage, but it does allow us to asymptotically
806         decrease the amount of time it takes to find data at a given offset in a SharedBuffer from O(n) to O(log(n)).
807
808         This allows us to complete http://speedtest.xfinity.com and new functionality in SharedBuffer is covered by API tests.
809
810         * loader/TextTrackLoader.cpp:
811         (WebCore::TextTrackLoader::processNewCueData):
812         * loader/cache/CachedRawResource.cpp:
813         (WebCore::CachedRawResource::calculateIncrementalDataChunk):
814         (WebCore::CachedRawResource::addDataBuffer):
815         (WebCore::CachedRawResource::finishLoading):
816         * loader/cache/CachedRawResource.h:
817         * platform/SharedBuffer.cpp:
818         (WebCore::SharedBuffer::SharedBuffer):
819         (WebCore::SharedBuffer::combineIntoOneSegment):
820         (WebCore::SharedBuffer::data):
821         (WebCore::SharedBuffer::getSomeData):
822         (WebCore::SharedBuffer::tryCreateArrayBuffer):
823         (WebCore::SharedBuffer::append):
824         (WebCore::SharedBuffer::clear):
825         (WebCore::SharedBuffer::copy):
826         (WebCore::SharedBuffer::internallyConsistent):
827         (WebCore::SharedBuffer::hintMemoryNotNeededSoon):
828         (WebCore::SharedBufferDataView::SharedBufferDataView):
829         (WebCore::SharedBufferDataView::size):
830         (WebCore::SharedBufferDataView::data):
831         * platform/SharedBuffer.h:
832         * platform/cf/SharedBufferCF.cpp:
833         (WebCore::SharedBuffer::createCFData):
834         (WebCore::SharedBuffer::hintMemoryNotNeededSoon):
835         (WebCore::SharedBuffer::append):
836         * platform/cocoa/SharedBufferCocoa.mm:
837         (WebCore::SharedBuffer::createNSData):
838         (WebCore::SharedBuffer::createCFData):
839         (WebCore::SharedBuffer::createNSDataArray):
840
841 2017-05-22  Chris Dumez  <cdumez@apple.com>
842
843         Resources in cached parsed stylesheets may bypass content blockers
844         https://bugs.webkit.org/show_bug.cgi?id=172468
845         <rdar://problem/31972693>
846
847         Reviewed by Geoffrey Garen.
848
849         Resources in cached parsed stylesheets could bypass content blockers when they were in the memory cache and
850         they did not need revalidation.
851
852         To address the issue, I made StyleSheetContents::subresourcesAllowReuse() to check content blockers.
853         If a subresource in the cached stylesheet is blocked, then we return false in subresourcesAllowReuse() and
854         the cached parsed stylesheet will not be used.
855
856         No new tests, not currently testable.
857
858         * css/StyleSheetContents.cpp:
859         (WebCore::StyleSheetContents::subresourcesAllowReuse):
860         * css/StyleSheetContents.h:
861         * html/HTMLLinkElement.cpp:
862         (WebCore::HTMLLinkElement::setCSSStyleSheet):
863         * loader/cache/CachedCSSStyleSheet.cpp:
864         (WebCore::CachedCSSStyleSheet::restoreParsedStyleSheet):
865         * loader/cache/CachedCSSStyleSheet.h:
866
867 2017-05-22  Chris Dumez  <cdumez@apple.com>
868
869         ASSERTION FAILED: tokens.find(item) == notFound in WebCore::DOMTokenList::replace
870         https://bugs.webkit.org/show_bug.cgi?id=172473
871
872         Reviewed by Ryosuke Niwa.
873
874         Fix bad assertion in DOMTokenList::replace(). If item == replacement, then the
875         assertion was wrong.
876
877         No new tests, unskipped existing test.
878
879         * html/DOMTokenList.cpp:
880         (WebCore::DOMTokenList::replace):
881
882 2017-05-22  Youenn Fablet  <youenn@apple.com>
883
884         Remove AVAudioCaptureSource
885         https://bugs.webkit.org/show_bug.cgi?id=172360
886
887         Reviewed by Sam Weinig.
888
889         No change of behavior, this class is no longer used by default as it does not support echo cancellation.
890
891         * WebCore.xcodeproj/project.pbxproj:
892         * page/Settings.cpp:
893         (WebCore::Settings::setMediaCaptureRequiresSecureConnection):
894         (WebCore::Settings::useAVFoundationAudioCapture): Deleted.
895         (WebCore::Settings::setUseAVFoundationAudioCapture): Deleted.
896         * page/Settings.h:
897         * platform/mediastream/mac/AVAudioCaptureSource.h: Removed.
898         * platform/mediastream/mac/AVAudioCaptureSource.mm: Removed.
899         * platform/mediastream/mac/AVCaptureDeviceManager.h:
900         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
901         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
902         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory):
903         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioCaptureDeviceManager):
904         (WebCore::RealtimeMediaSourceCenterMac::setUseAVFoundationAudioCapture): Deleted.
905         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
906
907 2017-05-22  Brian Burg  <bburg@apple.com>
908
909         Web Inspector: webkit reload policy should match default behavior
910         https://bugs.webkit.org/show_bug.cgi?id=171385
911         <rdar://problem/31871515>
912
913         Reviewed by Joseph Pecoraro.
914
915         Add an option to PageAgent.reload that tells the backend to use the old
916         behavior that revalidates unexpired cached subresources. This used by tests.
917
918         Covered by existing network/memory/disk cache tests.
919
920         * inspector/InspectorPageAgent.h:
921         * inspector/InspectorPageAgent.cpp:
922         (WebCore::InspectorPageAgent::reload):
923
924 2017-05-22  Yoav Weiss  <yoav@yoav.ws>
925
926         [preload] Add media and type attribute support.
927         https://bugs.webkit.org/show_bug.cgi?id=171720
928
929         Reviewed by Youenn Fablet.
930
931         Tests: http/wpt/preload/media-attribute.html
932                http/wpt/preload/type-attribute.html
933                http/tests/preload/viewport/meta-viewport-link-headers.php
934
935         * css/MediaQueryEvaluator.cpp: Move the mediaAttributeMatches code from HTMLResourcePreloader to a central location.
936         (WebCore::MediaQueryEvaluator::mediaAttributeMatches):
937         * css/MediaQueryEvaluator.h:
938         * html/HTMLImageElement.cpp:
939         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement): Use isSupportedImageOrSVGMIMEType() instead of checking SVG MIME type specifically.
940         * html/HTMLLinkElement.cpp:
941         (WebCore::HTMLLinkElement::process): Call loadLink() with the media and type attributes.
942         * html/parser/HTMLDocumentParser.cpp:
943         (WebCore::HTMLDocumentParser::pumpTokenizer): Trigger Link header based preload for links that have the media attribute.
944         * html/parser/HTMLPreloadScanner.cpp:
945         (WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest): Avoid preloading link resources with non-matching type.
946         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): Collect the type attribute for link resources.
947         * html/parser/HTMLResourcePreloader.cpp:
948         (WebCore::HTMLResourcePreloader::preload): Use MediaQueryEvaluator::mediaAttributeMatches instead of the local one.
949         (WebCore::mediaAttributeMatches): Deleted.
950         * loader/FrameLoader.cpp:
951         (WebCore::FrameLoader::receivedFirstData): Indicate that only link preloads with no media attribute should be loaded here.
952         * loader/LinkLoader.cpp:
953         (WebCore::LinkLoader::loadLinksFromHeader): Load only links with or without media attributes, according to mode. Also send media and
954         type attributes to preloadIfNeeded().
955         (WebCore::LinkLoader::isSupportedType): Check if the MIME type is supported for the CachedResource::Type.
956         (WebCore::LinkLoader::preloadIfNeeded): Get the media and type attributes and only trigger a preload if media matches and type is supported.
957         (WebCore::LinkLoader::loadLink): Pass along the media and type attributes.
958         * loader/LinkLoader.h:
959         * platform/MIMETypeRegistry.cpp:
960         (WebCore::MIMETypeRegistry::isSupportedImageOrSVGMIMEType): Check if MIME type is supported for an image, or is an SVG mime type.
961         (WebCore::MIMETypeRegistry::isSupportedStyleSheetMIMEType): Check if MIME type is supported for a stylesheet.
962         (WebCore::MIMETypeRegistry::isSupportedFontMIMEType): Check if MIME type is supported for a font.
963         (WebCore::MIMETypeRegistry::isSupportedTextTrackMIMEType): Check if MIME type is supported for a text track.
964         * platform/MIMETypeRegistry.h:
965
966 2017-05-22  Said Abou-Hallawa  <sabouhallawa@apple.com>
967
968         [CG] Use the SPI CGImageSourceGetTypeWithData() to get the typeIdentifierHint of an image
969         https://bugs.webkit.org/show_bug.cgi?id=172405
970
971         Reviewed by Simon Fraser.
972
973         Use CGImageSourceGetTypeWithData() to get the typeIdentifierHint which will
974         be passed to CGImageSourceCreateIncremental(). If data is insufficient to
975         guess typeIdentifierHint, that means the image size is still not available.
976         In this case, CachedImage::addIncrementalDataBuffer() will call error()
977         which will call clear() which will call Image::destroyDecodedData()
978         which will delete the current ImageDecoder and creates a new one. So we
979         don't need to check the return value insufficientData.
980
981         * platform/graphics/DecodingOptions.h: Fix the header file dependencies.
982         * platform/graphics/ImageSource.cpp:
983         (WebCore::ImageSource::ensureDecoderAvailable): No need for the URL parameter.
984         * platform/graphics/ImageTypes.h: Move a typedef from ImageDecoderCG.h to ImageTypes.h.
985         * platform/graphics/cg/ImageDecoderCG.cpp:
986         (WebCore::ImageDecoder::ImageDecoder): Pass the SharedBuffer data to the constructor.
987         * platform/graphics/cg/ImageDecoderCG.h:
988         (WebCore::ImageDecoder::create): No need for the URL argument.
989         * platform/graphics/win/ImageDecoderDirect2D.h:
990         (WebCore::ImageDecoder::create): Remove the URL argument from the function signature.
991         * platform/image-decoders/ImageDecoder.cpp:
992         (WebCore::ImageDecoder::create): Remove the URL argument from the function signature.
993         * platform/image-decoders/ImageDecoder.h:
994         * platform/spi/cg/ImageIOSPI.h: Add the prototype of CGImageSourceGetTypeWithData().
995
996 2017-05-22  Zalan Bujtas  <zalan@apple.com>
997
998         SameSizeAsInlineBox mismatch on ARMV7.
999         https://bugs.webkit.org/show_bug.cgi?id=172459
1000
1001         Reviewed by Simon Fraser.
1002
1003         Due to the ARMV7/i386 padding behaviour mismatch, forcing m_bitfields to be 32bits does not always
1004         produce the desired padding.
1005         Move the bool to the end of the member list and let m_deletionSentinel (4bytes) force
1006         padding.
1007
1008         * rendering/InlineBox.cpp:
1009         * rendering/InlineBox.h:
1010
1011 2017-05-22  Myles C. Maxfield  <mmaxfield@apple.com>
1012
1013         Enable the woff2-variations @font-face format identifier
1014         https://bugs.webkit.org/show_bug.cgi?id=172425
1015
1016         Reviewed by Andreas Kling.
1017
1018         We support woff2, and woff-variations, but not woff2-variations.
1019         https://github.com/w3c/csswg-drafts/commit/5c914a8a0382734bd420090a89bc19b32e6c302d
1020
1021         Test: fast/text/variations/font-face-format-woff2.html
1022
1023         * platform/graphics/mac/FontCustomPlatformData.cpp:
1024         (WebCore::FontCustomPlatformData::supportsFormat):
1025
1026 2017-05-22  Antoine Quint  <graouts@apple.com>
1027
1028         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
1029         https://bugs.webkit.org/show_bug.cgi?id=168409
1030
1031         Reviewed by Simon Fraser.
1032
1033         Remove all the custom logging code we wrote to diagnose why this specific test failed and instead
1034         log the backtrace when the ScriptedAnimationController gets suspended, which should allow us to
1035         identify which test actually leads to suspension and affects this particular test.
1036
1037         * Modules/modern-media-controls/controls/scheduler.js:
1038         (const.scheduler.new.prototype.scheduleLayout):
1039         (const.scheduler.new.prototype.unscheduleLayout):
1040         (const.scheduler.new.prototype._requestFrameIfNeeded):
1041         (const.scheduler.new.prototype._frameDidFire):
1042         (const.scheduler.new.prototype._layout):
1043         * dom/Document.cpp:
1044         (WebCore::Document::requestAnimationFrame):
1045         * dom/ScriptedAnimationController.cpp:
1046         (WebCore::ScriptedAnimationController::suspend):
1047         (WebCore::ScriptedAnimationController::resume):
1048         (WebCore::ScriptedAnimationController::addThrottlingReason):
1049         (WebCore::ScriptedAnimationController::removeThrottlingReason):
1050         (WebCore::ScriptedAnimationController::registerCallback):
1051         (WebCore::ScriptedAnimationController::cancelCallback):
1052         (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
1053         (WebCore::ScriptedAnimationController::scheduleAnimation):
1054         (WebCore::ScriptedAnimationController::dispatchLoggingEventIfRequired): Deleted.
1055         * dom/ScriptedAnimationController.h:
1056         * page/Page.cpp:
1057         (WebCore::Page::suspendScriptedAnimations):
1058         * page/Settings.in:
1059         * testing/InternalSettings.cpp:
1060         (WebCore::InternalSettings::resetToConsistentState):
1061         (WebCore::InternalSettings::shouldDispatchRequestAnimationFrameEvents): Deleted.
1062         (WebCore::InternalSettings::setShouldDispatchRequestAnimationFrameEvents): Deleted.
1063         * testing/InternalSettings.h:
1064         * testing/InternalSettings.idl:
1065
1066 2017-05-22  Emilio Cobos Álvarez  <ecobos@igalia.com>
1067
1068         Don't unconditionally reset TextIterator::m_handledChildren for display: contents nodes.
1069         https://bugs.webkit.org/show_bug.cgi?id=172443
1070
1071         This avoids an infinite hang when enabling display: contents in bug 171984.
1072
1073         Reviewed by Antti Koivisto.
1074
1075         No new tests. Relanding bug 171984 will add test coverage for this.
1076
1077         * editing/TextIterator.cpp:
1078         (WebCore::hasDisplayContents):
1079         (WebCore::fullyClipsContents):
1080         (WebCore::TextIterator::advance):
1081
1082 2017-05-22  Sam Weinig  <sam@webkit.org>
1083
1084         [WebIDL] Support callbacks with arbitrary return types
1085         https://bugs.webkit.org/show_bug.cgi?id=172407
1086
1087         Reviewed by Chris Dumez.
1088
1089         - Adds and adopts CallbackResult<> template class that encapsulates a return value
1090           and status from a javascript callback.
1091         - Updates NodeIterator/TreeWalker to explicitly propagate exceptions thrown from
1092           a JSNodeFilter, rather than relying on the JSNodeFilter to catch them (seemingly
1093           accidentally).
1094
1095         * CMakeLists.txt:
1096         * WebCore.xcodeproj/project.pbxproj:
1097         * bindings/js/JSBindingsAllInOne.cpp:
1098         Update file lists.
1099
1100         * Modules/geolocation/PositionCallback.h:
1101         * Modules/geolocation/PositionErrorCallback.h:
1102         * Modules/notifications/NotificationPermissionCallback.h:
1103         * Modules/webaudio/AudioBufferCallback.h:
1104         * Modules/webdatabase/DatabaseCallback.h:
1105         * dom/RequestAnimationFrameCallback.h:
1106         * dom/StringCallback.h:
1107         * dom/Traversal.cpp:
1108         * fileapi/BlobCallback.h:
1109         * html/VoidCallback.h:
1110         * page/IntersectionObserverCallback.h:
1111         * page/PerformanceObserverCallback.h:
1112         * css/MediaQueryListListener.h:
1113         * Modules/webdatabase/SQLStatement.h:
1114         * Modules/webdatabase/SQLStatementCallback.h:
1115         * Modules/webdatabase/SQLStatementErrorCallback.h:
1116         * Modules/webdatabase/SQLTransaction.cpp:
1117         * Modules/webdatabase/SQLTransactionCallback.h:
1118         * Modules/webdatabase/SQLTransactionErrorCallback.h:
1119         * inspector/InspectorDatabaseAgent.cpp:
1120         Adopt CallbackResult.
1121
1122         * Modules/webdatabase/SQLStatementErrorCallback.idl:
1123         Remove Custom extended attribute annotation.
1124
1125         * Modules/webdatabase/SQLStatement.cpp:
1126         (WebCore::SQLStatement::performCallback):
1127         Adopt CallbackResult, migrating logic from JSSQLStatementErrorCallbackCustom
1128         into the implementation, by way of the status enum.
1129
1130         * bindings/IDLTypes.h:
1131         Add IDLVoid type.
1132
1133         * bindings/js/JSNodeFilterCustom.cpp: Removed.
1134         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp: Removed.
1135         Remove now unneeded custom bindings.
1136
1137         * bindings/scripts/CodeGeneratorJS.pm:
1138         (GenerateIndexedGetter):
1139         (GenerateNamedGetter):
1140         (GenerateImplementation):
1141         (GenerateImplementationFunctionCall):
1142         Update for new NativeToJSValue arguments.
1143
1144         (GenerateCallbackHeaderContent):
1145         (GenerateCallbackImplementationContent):
1146         Remove requirement of only void return types and update return type to use CallbackFunction.
1147         Also adds necessary conversion of return value.
1148
1149         (GetBaseIDLType):
1150         Add void IDL type mapping.
1151
1152         (IsValidContextForJSValueToNative):
1153         Add operation as valid context, as that is what the callback return type's context is.
1154
1155         (NativeToJSValueUsingReferences):
1156         (NativeToJSValueUsingPointers):
1157         (NativeToJSValue):
1158         Rework NativeToJSValueUsingReferences/NativeToJSValueUsingPointers to take a global object reference
1159         accessor rather than a thisObject accessor, as a thisObject is not always available, and what the function
1160         actually wants is the global object.
1161
1162         * bindings/scripts/IDLAttributes.json:
1163         Add new RethrowException attribute to instruct the callback function to re-throw, rather than
1164         just report, exceptions thrown in the callback and SkipCallbackInvokeCheck which instructs the
1165         callback function to not check canInvokeCallback() before calling. These will both be needed to retain
1166         the behavior of NodeFilter, and should be investigated further.
1167
1168         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
1169         * bindings/scripts/test/JS/JSTestCallbackFunction.h:
1170         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp: Added.
1171         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.h: Added.
1172         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
1173         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
1174         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
1175         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
1176         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp: Added.
1177         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.h: Added.
1178         * bindings/scripts/test/TestCallbackFunction.idl:
1179         * bindings/scripts/test/TestCallbackInterface.idl:
1180         * bindings/scripts/test/TestVoidCallbackFunction.idl: Copied from Source/WebCore/bindings/scripts/test/TestCallbackFunction.idl.
1181         Update test results and add some additional test cases for callback functions and callback interface functions that return
1182         non-void and use the RethrowExceptions.
1183
1184         * dom/CallbackResult.h: Added.
1185         (WebCore::CallbackResult<ReturnType>::CallbackResult):
1186         (WebCore::CallbackResult<ReturnType>::type):
1187         (WebCore::CallbackResult<void>::CallbackResult):
1188         (WebCore::CallbackResult<void>::type):
1189         New class to encapsulate the return value and status of a callback function. Modeled loosely on
1190         ExceptionOr, but is simpler since it does not need to handle complex exception objects.
1191
1192         * dom/NativeNodeFilter.cpp:
1193         * dom/NativeNodeFilter.h:
1194         Adopt CallbackResult, matching other NodeFiltering code by using
1195         unsigned short rather than short, remove unused functions, and convert 
1196         condition member to a Ref, allowing us to get rid of the branch acceptNode.
1197
1198         * dom/NodeFilter.h:
1199         Adopt CallbackResult.
1200
1201         * dom/NodeFilter.idl:
1202         Replace Custom extended attribute with SkipCallbackInvokeCheck and RethrowException.
1203
1204         * dom/NodeFilterCondition.cpp:
1205         * dom/NodeFilterCondition.h:
1206         Modernize to take a Node reference and match other filtering code
1207         by returning an unsigned short.
1208
1209         * dom/Traversal.cpp:
1210         * dom/Traversal.h:
1211         Adopt CallbackResult and match other node filtering code by using unsigned short 
1212         rather than short.
1213
1214         * dom/NodeIterator.cpp:
1215         * dom/NodeIterator.h:
1216         * dom/NodeIterator.idl:
1217         * dom/TreeWalker.cpp:
1218         * dom/TreeWalker.h:
1219         * dom/TreeWalker.idl:
1220         Change functions that callout to javascript via the NodeFilter to 
1221         return ExceptionOr<Node>. Check the result of CallbackResult for a
1222         thrown exception, and bail, returning Exception { ExistingExceptionError }
1223         which acts as an indicator to the bindings that an exception was thrown.
1224         (In actuality, the specific exception code does not matter. All that matters
1225         is that an ExceptionOr<> is returned, which triggers, via overload, a path
1226         in toJS() that calls propagateException(), which in turn, checks to see if
1227         an exception is on the stack. But, having an explicit code here helps debugging).
1228
1229 2017-05-22  Simon Fraser  <simon.fraser@apple.com>
1230
1231         Support transform-box to switch sizing box in SVG
1232         https://bugs.webkit.org/show_bug.cgi?id=145783
1233
1234         Reviewed by Dean Jackson.
1235
1236         Add support for the CSS "transform-box" property, as described at
1237         <https://drafts.csswg.org/css-transforms/#transform-box>.
1238         
1239         This changes the behavior of percentage values in transform-origin in SVG.
1240         When these were added in r110532, percentage values in transform-origin were made
1241         relative to the bounding box, but absolute values relative to the view box.
1242         <https://github.com/w3c/csswg-drafts/issues/895> has concluded that this behavior
1243         is confusing. The new behavior is that, for SVG elements, both absolute and
1244         percentage values are relative to the reference box, which is specified by the
1245         new transform-box property.
1246
1247         The initial value for transform-box is border-box, with the svg.css UA stylesheet
1248         supplying a default of view-box for the relevant SVG elements per
1249         <https://www.w3.org/TR/SVG2/styling.html#UAStyleSheet>.
1250
1251         For non-SVG elements, the used value is always border-box, so there is no change
1252         in behavior.
1253
1254         Tests: fast/css/transform-box-parsing.html
1255                svg/transforms/svg-transform-box.html
1256
1257         * css/CSSComputedStyleDeclaration.cpp:
1258         (WebCore::ComputedStyleExtractor::propertyValue):
1259         * css/CSSPrimitiveValueMappings.h:
1260         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1261         (WebCore::CSSPrimitiveValue::operator TransformBox):
1262         * css/CSSProperties.json:
1263         * css/CSSValueKeywords.in:
1264         * css/parser/CSSPropertyParser.cpp:
1265         (WebCore::CSSPropertyParser::parseSingleValue):
1266         * css/svg.css:
1267         (*:not(svg),):
1268         (*): Deleted.
1269         (html|* > svg): Deleted.
1270         * page/animation/AnimationBase.cpp:
1271         (WebCore::AnimationBase::computeTransformedExtentViaTransformList):
1272         * rendering/style/RenderStyle.cpp:
1273         (WebCore::RenderStyle::applyTransform): The transformOriginX().isPercent() tests
1274         were added to support the weird "% values are relative to bounding box" in SVG. Now
1275         it's up to the caller to pass a non-zero origin when that matters, and
1276         SVGGraphicsElement::animatedLocalTransform() is the only caller that does so.
1277         * rendering/style/RenderStyle.h:
1278         (WebCore::RenderStyle::hasTransform):
1279         (WebCore::RenderStyle::transformBox):
1280         (WebCore::RenderStyle::setTransformBox):
1281         (WebCore::RenderStyle::initialTransformBox):
1282         * rendering/style/RenderStyleConstants.h:
1283         * rendering/style/StyleTransformData.cpp:
1284         (WebCore::StyleTransformData::StyleTransformData):
1285         (WebCore::StyleTransformData::operator==):
1286         * rendering/style/StyleTransformData.h:
1287         * svg/SVGGraphicsElement.cpp:
1288         (WebCore::SVGGraphicsElement::animatedLocalTransform): Consult the transform-box
1289         style to compute the reference box as the bounding box, or the view box.
1290
1291 2017-05-22  Chris Dumez  <cdumez@apple.com>
1292
1293         Add support for [LegacyWindowAlias] IDL extended attribute
1294         https://bugs.webkit.org/show_bug.cgi?id=172451
1295
1296         Reviewed by Sam Weinig.
1297
1298         Add support for [LegacyWindowAlias] IDL extended attribute as per:
1299         - https://heycam.github.io/webidl/#LegacyWindowAlias
1300
1301         Use it for our legacy window aliases, such as webKitURL.
1302
1303         No new tests, there should be no Web-exposed behavior change.
1304
1305         * bindings/scripts/IDLAttributes.json:
1306         * bindings/scripts/preprocess-idls.pl:
1307         (GenerateConstructorAttributes):
1308         * css/DOMMatrix.idl:
1309         * dom/MutationObserver.idl:
1310         * dom/XMLDocument.idl:
1311         * html/DOMURL.idl:
1312         * page/DOMWindow.idl:
1313
1314 2017-05-22  Jer Noble  <jer.noble@apple.com>
1315
1316         ASSERTION FAILED: m_boundThread == currentThread() in WTF::WeakReference<WebCore::WebCoreDecompressionSession>::clear()
1317         https://bugs.webkit.org/show_bug.cgi?id=172457
1318         <rdar://problem/32329436>
1319
1320         Reviewed by Eric Carlson.
1321
1322         Remove vestigal WeakPtrFactory that was entirely unused.
1323
1324         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
1325         (WebCore::WebCoreDecompressionSession::createWeakPtr): Deleted.
1326         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
1327         (WebCore::WebCoreDecompressionSession::WebCoreDecompressionSession):
1328
1329 2017-05-22  Antti Koivisto  <antti@apple.com>
1330
1331         Crash in WebCore::StyleRuleKeyframes::findKeyframeIndex
1332         https://bugs.webkit.org/show_bug.cgi?id=170756
1333         <rdar://problem/31573157>
1334
1335         Reviewed by Andreas Kling.
1336
1337         Using a malformed key with CSSKeyframesRule.findRule crashes because
1338         CSSParser::parseKeyframeKeyList returns null which is then dereferenced.
1339
1340         * css/CSSKeyframesRule.cpp:
1341         (WebCore::StyleRuleKeyframes::findKeyframeIndex): Null test.
1342
1343 2017-05-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1344
1345         Remove unused documentIsHandlingNonDefaultDrag plumbing for WebKit2
1346         https://bugs.webkit.org/show_bug.cgi?id=172453
1347
1348         Reviewed by Tim Horton.
1349
1350         Removes unused plumbing that was originally added to support file uploads. No new tests, since there is no
1351         change in behavior.
1352
1353         * page/DragController.h:
1354         (WebCore::DragController::documentIsHandlingNonDefaultDrag): Deleted.
1355
1356 2017-05-22  Jer Noble  <jer.noble@apple.com>
1357
1358         Media element thinks its hidden when in PiP mode and tab is backgrounded.
1359         https://bugs.webkit.org/show_bug.cgi?id=172221
1360
1361         Reviewed by Eric Carlson.
1362
1363         The element should not be considered hidden when in legacy fullscreen mode or PiP mode.
1364
1365         * html/HTMLMediaElement.cpp:
1366         (WebCore::HTMLMediaElement::visibilityStateChanged):
1367         (WebCore::HTMLMediaElement::fullscreenModeChanged):
1368
1369 2017-05-22  Zan Dobersek  <zdobersek@igalia.com>
1370
1371         NavigatorEME: null RefPtr<> dereference due to different calling conventions
1372         https://bugs.webkit.org/show_bug.cgi?id=172352
1373
1374         Reviewed by Carlos Garcia Campos.
1375
1376         * Modules/encryptedmedia/NavigatorEME.cpp:
1377         (WebCore::tryNextSupportedConfiguration): Avoid crashes when constructing
1378         the MediaKeySystemAccess::create() arguments that can occur for targets with
1379         calling conventions that might release the implementation RefPtr<> before it's
1380         dereferenced to retrieve the key system string. Simply acquire the reference
1381         to the key system String object before the MediaKeySystem::create() call
1382         expression that releases the problematic RefPtr<>.
1383
1384 2017-05-22  Gwang Yoon Hwang  <yoon@igalia.com>
1385
1386         [CoordinatedGraphics] Clear UpdateAtlases for each tests
1387         https://bugs.webkit.org/show_bug.cgi?id=172119
1388
1389         Reviewed by Carlos Garcia Campos.
1390
1391         * loader/EmptyClients.h:
1392         * page/ChromeClient.h:
1393         * testing/Internals.cpp:
1394         (WebCore::Internals::resetToConsistentState): Clears update atlases
1395         while resetting states of the test runner.
1396
1397 2017-05-22  Gwang Yoon Hwang  <yoon@igalia.com>
1398
1399         [CoordinatedGraphics] BitmapTexturePool does not release textures properly
1400         https://bugs.webkit.org/show_bug.cgi?id=172428
1401
1402         Reviewed by Žan Doberšek.
1403
1404         No new tests because no behavior change.
1405
1406         * platform/graphics/texmap/BitmapTexturePool.cpp:
1407         (WebCore::BitmapTexturePool::BitmapTexturePool):
1408         Use the RunLoopTimer instead of Timer, because BitmapTexturePool would
1409         run on the compositing thread in Coordinated Graphics case.
1410         (WebCore::BitmapTexturePool::releaseUnusedTexturesTimerFired):
1411         We should check not only the last used time but also the refcounts of the
1412         texture when selecting textures to remove.
1413         * platform/graphics/texmap/BitmapTexturePool.h:
1414         (WebCore::BitmapTexturePool::Entry::canBeReleased): Added.
1415
1416 2017-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
1417
1418         [WPE] Use surfaceless context for sharing and offscreen context if available
1419         https://bugs.webkit.org/show_bug.cgi?id=172268
1420
1421         Reviewed by Žan Doberšek.
1422
1423         Like GTK+ port does, WPE should use surfaceless contexts when possible, and only create a native offscreen
1424         context as a fallback. We don't need to do anything special in WPE port, just to make it consistent with the
1425         Wayland and X11 implementations. We should also avoid including EGL.h in headers, we added
1426         GLContextEGLWayland.cpp and GLContextEGLX11.cpp to avoid that. PlatformDisplayWPE::EGLOffscreenTarget is quite
1427         simple and only used by GLContextEGLWPE, so we could move it there like we do for Wayland and X11.
1428
1429         * platform/graphics/GLContext.h: Remove EGL header includes.
1430         * platform/graphics/egl/GLContextEGL.cpp:
1431         (WebCore::GLContextEGL::createWindowContext): Use createWindowSurfaceWPE() in WPE.
1432         (WebCore::GLContextEGL::createContext): Use createWPEContext in WPE.
1433         (WebCore::GLContextEGL::createSharingContext): Move the WPE code below to ensure we try
1434         createSurfacelessContext() first.
1435         * platform/graphics/egl/GLContextEGL.h:
1436         * platform/graphics/egl/GLContextEGLWPE.cpp:
1437         (WebCore::GLContextEGL::GLContextEGL): Add constructor for WPE that receives a struct wpe_renderer_backend_egl_offscreen_target*
1438         (WebCore::GLContextEGL::createWindowSurfaceWPE): Added implementation here because eglCreateWindowSurface needs
1439         the platform specific EGL includes and definitions.
1440         (WebCore::GLContextEGL::createWPEContext): Create a GLContext using WPE backend API directly here.
1441         (WebCore::GLContextEGL::destroyWPETarget): Add null check.
1442         * platform/graphics/wpe/PlatformDisplayWPE.cpp: Remove EGLOffscreenTarget.
1443         * platform/graphics/wpe/PlatformDisplayWPE.h:
1444
1445 2017-05-21  Michael Catanzaro  <mcatanzaro@igalia.com>
1446
1447         [GTK] Remove Firefox user agent quirk for Google domains
1448         https://bugs.webkit.org/show_bug.cgi?id=171941
1449
1450         Reviewed by Carlos Garcia Campos.
1451
1452         * platform/UserAgentQuirks.cpp:
1453         (WebCore::UserAgentQuirks::quirksForURL):
1454         (WebCore::UserAgentQuirks::stringForQuirk):
1455         (WebCore::urlRequiresFirefoxBrowser): Deleted.
1456         (WebCore::UserAgentQuirks::firefoxRevisionString): Deleted.
1457         * platform/UserAgentQuirks.h:
1458         * platform/gtk/UserAgentGtk.cpp:
1459         (WebCore::buildUserAgentString):
1460
1461 2017-05-21  Antti Koivisto  <antti@apple.com>
1462
1463         matchMedia('print').addListener() fires in WK1 but never in WK2 when printing (breaks printing Google maps, QuickLooks)
1464         https://bugs.webkit.org/show_bug.cgi?id=172361
1465         <rdar://problem/28777408>
1466
1467         Reviewed by Sam Weinig.
1468
1469         Test: fast/media/matchMedia-print.html
1470
1471         * page/FrameView.cpp:
1472         (WebCore::FrameView::layout):
1473
1474             Evaluate matchMedia queries unconditionally. No idea why it wasn't like that.
1475
1476         * testing/Internals.cpp:
1477         (WebCore::Internals::setPrinting):
1478
1479             Add testing support. The existing ways to do printing testing were unable to hit this bug as
1480             they had too much additional gunk.
1481
1482         * testing/Internals.h:
1483         * testing/Internals.idl:
1484
1485 2017-05-21  Zalan Bujtas  <zalan@apple.com>
1486
1487         Remove redundant FrameView ref in FrameView::performPostLayoutTasks
1488         https://bugs.webkit.org/show_bug.cgi?id=172422
1489
1490         Reviewed by Antti Koivisto.
1491
1492         This was added to protect FrameView from getting destroyed in updateEmbeddedObjects(), but r169475 changed
1493         the embedded object update to be asynchronous.  
1494
1495         * page/FrameView.cpp:
1496         (WebCore::FrameView::performPostLayoutTasks):
1497
1498 2017-05-20  Chris Dumez  <cdumez@apple.com>
1499
1500         Drop [NoInterfaceObject] from RTCDTMFSender and RTCStatsReport
1501         https://bugs.webkit.org/show_bug.cgi?id=172418
1502
1503         Reviewed by Youenn Fablet.
1504
1505         Drop [NoInterfaceObject] from RTCDTMFSender and RTCStatsReport to match the specification:
1506         - https://www.w3.org/TR/webrtc/#rtcdtmfsender
1507         - https://www.w3.org/TR/webrtc/#rtcstatsreport-object
1508
1509         Firefox exposes both RTCDTMFSender and RTCStatsReport. Chrome exposes RTCStatsReport only.
1510         RTCDTMFSender seems to be currently disabled at build time currently so the change to
1511         its interface does not currently impact Web-exposed behavior, only the change to the
1512         RTCStatsReport interface currently does.
1513
1514         No new tests, rebaselined existing test.
1515
1516         * Modules/mediastream/RTCDTMFSender.idl:
1517         * Modules/mediastream/RTCStatsReport.idl:
1518         Drop [NoInterfaceObject].
1519
1520         * Modules/mediastream/RTCIceCandidateEvent.cpp: Removed.
1521         * Modules/mediastream/RTCIceCandidateEvent.h: Removed.
1522         * Modules/mediastream/RTCIceCandidateEvent.idl: Removed.
1523         Drop class and IDL that are no longer used. They were not even part of any project files.
1524         RTCIceCandidateEvent has been renamed to RTCPeerConnectionIceEvent, which we support.
1525
1526 2017-05-20  Chris Dumez  <cdumez@apple.com>
1527
1528         Value for iterator property is wrong for maplike interfaces
1529         https://bugs.webkit.org/show_bug.cgi?id=172410
1530
1531         Reviewed by Sam Weinig.
1532
1533         Value for iterator property was wrong for maplike interfaces. The iterator property is
1534         supposed to have the same value as the 'entries' property but we were using the value
1535         of the 'values' property.
1536
1537         Specification:
1538         - https://heycam.github.io/webidl/#es-map-entries
1539         - https://heycam.github.io/webidl/#es-iterator
1540
1541         This impacts the iterator of the RTCStatsReport interface.
1542
1543         No new tests, updated existing test.
1544
1545         * bindings/scripts/CodeGeneratorJS.pm:
1546         (GenerateImplementation):
1547         * bindings/scripts/test/JS/JSMapLike.cpp:
1548         (WebCore::JSMapLikePrototype::finishCreation):
1549         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
1550         (WebCore::JSReadOnlyMapLikePrototype::finishCreation):
1551
1552 2017-05-20  Chris Dumez  <cdumez@apple.com>
1553
1554         Drop superfluous iterator property setting in addValueIterableMethods()
1555         https://bugs.webkit.org/show_bug.cgi?id=172409
1556
1557         Reviewed by Youenn Fablet.
1558
1559         Drop superfluous iterator setting in addValueIterableMethods(). The bindings already take care of
1560         adding the iterator property before calling addValueIterableMethods().
1561
1562         No new tests, no Web-facing behavior change.
1563
1564         * bindings/js/JSDOMIterator.cpp:
1565         (WebCore::addValueIterableMethods):
1566
1567 2017-05-20  Jer Noble  <jer.noble@apple.com>
1568
1569         [MSE][Mac] Support painting MSE video-element to canvas
1570         https://bugs.webkit.org/show_bug.cgi?id=125157
1571         <rdar://problem/23062016>
1572
1573         Reviewed by Eric Carlson.
1574
1575         Test: media/media-source/media-source-paint-to-canvas.html
1576
1577         In order to have access to decoded video data for painting, decode the encoded samples manually
1578         instead of adding them to the AVSampleBufferDisplayLayer. To facilitate doing so, add a new
1579         utility class WebCoreDecompressionSession, which can decode samples and store them.
1580
1581         For the purposes of this patch, to avoid double-decoding of video data and to avoid severe complication
1582         of our sample delivery pipeline, we will only support painting of decoded video samples when the video is
1583         not displayed in the DOM.
1584
1585         * Modules/mediasource/MediaSource.cpp:
1586         (WebCore::MediaSource::seekToTime): Always send waitForSeekCompleted() to give private a chance to delay seek completion.
1587         * Modules/mediasource/SourceBuffer.cpp:
1588         (WebCore::SourceBuffer::sourceBufferPrivateReenqueSamples): Added.
1589         * Modules/mediasource/SourceBuffer.h:
1590         * WebCore.xcodeproj/project.pbxproj:
1591         * platform/cf/CoreMediaSoftLink.cpp: Added new soft link macros.
1592         * platform/cf/CoreMediaSoftLink.h: Ditto.
1593         * platform/cocoa/CoreVideoSoftLink.cpp: Ditto.
1594         * platform/cocoa/CoreVideoSoftLink.h: Ditto.
1595         * platform/graphics/SourceBufferPrivateClient.h:
1596         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1597         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sampleBufferDisplayLayer): Simple accessor.
1598         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::decompressionSession): Ditto.
1599         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1600         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
1601         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load): Update whether we should be displaying in a layer or decompression session..
1602         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVisible): Ditto.
1603         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitForSeekCompleted): m_seeking is now an enum.
1604         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seeking): Ditto.
1605         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekCompleted): Ditto. If waiting for a video frame, delay completing seek.
1606         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::nativeImageForCurrentTime): Call updateLastImage() and return result.
1607         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastImage): Fetch the image for the current time.
1608         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paint): Pass to paintCurrentFrameInCanvas.
1609         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paintCurrentFrameInContext): Get a native image, and render it.
1610         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::acceleratedRenderingStateChanged): Create or destroy a layer or decompression session as appropriate.
1611         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer): Creates a layer.
1612         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer): Destroys a layer.
1613         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureDecompressionSession): Creates a decompression session.
1614         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyDecompressionSession): Destroys a decompression session.
1615         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame): If seek completion delayed, complete now. Ditto for ready state change.
1616         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setReadyState): If waiting for a video frame, delay ready state change.
1617         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addDisplayLayer): Deleted.
1618         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeDisplayLayer): Deleted.
1619         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
1620         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
1621         (WebCore::MediaSourcePrivateAVFObjC::hasVideo): Promote to a class function.
1622         (WebCore::MediaSourcePrivateAVFObjC::hasSelectedVideo): Return whether any of the active source buffers have video and are selected.
1623         (WebCore::MediaSourcePrivateAVFObjC::hasSelectedVideoChanged): Call setSourceBufferWithSelectedVideo().
1624         (WebCore::MediaSourcePrivateAVFObjC::setVideoLayer): Set (or clear) the layer on the selected buffer.
1625         (WebCore::MediaSourcePrivateAVFObjC::setDecompressionSession): Ditto for decompression session.
1626         (WebCore::MediaSourcePrivateAVFObjC::setSourceBufferWithSelectedVideo): Remove the layer and decompression session from the unselected
1627
1628                 buffer and add the decompression session or layer to the newly selected buffer.
1629         (WebCore::MediaSourcePrivateAVFObjCHasVideo): Deleted.
1630         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1631         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1632         (WebCore::SourceBufferPrivateAVFObjC::destroyRenderers): Clear the videoLayer and decompressionSession.
1633         (WebCore::SourceBufferPrivateAVFObjC::hasSelectedVideo): Return whether the buffer has a selected video track.
1634         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): The media player now manages the video layer and decompression session lifetimes.
1635         (WebCore::SourceBufferPrivateAVFObjC::flush): Flush the decompression session, if it exists.
1636         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Enqueue to the decompression session, if it exists.
1637         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples): As the decompression session, if it exists.
1638         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples): Tell the decompression session to stop requesting data, if it exists.
1639         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples): Request media data from the decompression session, if it exists.
1640         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer): Added.
1641         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): Added.
1642         * platform/graphics/cocoa/WebCoreDecompressionSession.h: Added.
1643         (WebCore::WebCoreDecompressionSession::create):
1644         (WebCore::WebCoreDecompressionSession::isInvalidated):
1645         (WebCore::WebCoreDecompressionSession::createWeakPtr):
1646         * platform/graphics/cocoa/WebCoreDecompressionSession.mm: Added.
1647         (WebCore::WebCoreDecompressionSession::WebCoreDecompressionSession): Register for media data requests.
1648         (WebCore::WebCoreDecompressionSession::invalidate):  Unregister for same.
1649         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaDataCallback): Pass to maybeBecomeReadyForMoreMediaData.
1650         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaData): Check in-flight decodes, and decoded frame counts.
1651         (WebCore::WebCoreDecompressionSession::enqueueSample): Pass the sample to be decoded on a background queue.
1652         (WebCore::WebCoreDecompressionSession::decodeSample): Decode the sample.
1653         (WebCore::WebCoreDecompressionSession::decompressionOutputCallback): Call handleDecompressionOutput.
1654         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput): Pass decoded sample to be enqueued on the main thread.
1655         (WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
1656         (WebCore::WebCoreDecompressionSession::enqueueDecodedSample): Enqueue the frame (if it's a displayed frame).
1657         (WebCore::WebCoreDecompressionSession::isReadyForMoreMediaData): Return whether we've hit our high water sample count.
1658         (WebCore::WebCoreDecompressionSession::requestMediaDataWhenReady):
1659         (WebCore::WebCoreDecompressionSession::stopRequestingMediaData): Unset the same.
1660         (WebCore::WebCoreDecompressionSession::notifyWhenHasAvailableVideoFrame): Set a callback to notify when a decoded frame has been enqueued.
1661         (WebCore::WebCoreDecompressionSession::imageForTime): Successively dequeue images until reaching one at or beyond the requested time.
1662         (WebCore::WebCoreDecompressionSession::flush): Synchronously empty the producer and consumer queues.
1663         (WebCore::WebCoreDecompressionSession::getDecodeTime): Utility method.
1664         (WebCore::WebCoreDecompressionSession::getPresentationTime): Ditto.
1665         (WebCore::WebCoreDecompressionSession::getDuration): Ditto.
1666         (WebCore::WebCoreDecompressionSession::compareBuffers): Ditto.
1667         * platform/cocoa/VideoToolboxSoftLink.cpp: Added.
1668         * platform/cocoa/VideoToolboxSoftLink.h: Added.
1669
1670 2017-05-19  Joseph Pecoraro  <pecoraro@apple.com>
1671
1672         WebAVStreamDataParserListener String leak
1673         https://bugs.webkit.org/show_bug.cgi?id=172395
1674
1675         Reviewed by Chris Dumez.
1676
1677         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1678         (-[WebAVStreamDataParserListener streamDataParser:didProvideMediaData:forTrackID:mediaType:flags:]):
1679         (-[WebAVStreamDataParserListener streamDataParser:didReachEndOfTrackWithTrackID:mediaType:]):
1680         Use an isolated String in a lambda used across threads.
1681
1682 2017-05-19  Chris Dumez  <cdumez@apple.com>
1683
1684         Consider not exposing webkitURL in workers
1685         https://bugs.webkit.org/show_bug.cgi?id=172166
1686
1687         Reviewed by Geoffrey Garen.
1688
1689         Drop webkitURL alias for URL in workers, to match other browsers. The risk should
1690         be low given that this only impacts workers, we expose URL to workers and Blink
1691         does not have this alias. We still support the webkitURL alias for URL on Window.
1692
1693         No new tests, rebaselined existing test.
1694
1695         * workers/WorkerGlobalScope.idl:
1696
1697 2017-05-19  Youenn Fablet  <youenn@apple.com>
1698
1699         Add RTCPeerConnection connection state change logging
1700         https://bugs.webkit.org/show_bug.cgi?id=172314
1701
1702         Reviewed by Eric Carlson.
1703
1704         No change of behavior.
1705         Adding some release logging of connection state changes.
1706
1707         * Modules/mediastream/RTCPeerConnection.cpp:
1708         (WebCore::rtcIceGatheringStateToString):
1709         (WebCore::RTCPeerConnection::updateIceGatheringState):
1710         (WebCore::rtcIceConnectionStateToString):
1711         (WebCore::RTCPeerConnection::updateIceConnectionState):
1712
1713 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
1714
1715         webkitSupportsFullscreen and webkitSupportsPresentationMode('fullscreen') disagree.
1716         https://bugs.webkit.org/show_bug.cgi?id=172329
1717         rdar://problem/32260891
1718
1719         Reviewed by Darin Adler.
1720
1721         Updated tests:
1722         * media/media-fullscreen-inline-expected.txt:
1723         * media/media-fullscreen-not-in-document-expected.txt:
1724         * media/media-fullscreen.js:
1725
1726         webkitSupportsPresentationMode('fullscreen') should delegate to webkitSupportsFullscreen.
1727         The additional mediaSession().fullscreenPermitted() check causes it to return false when
1728         not handling a user gesture, which isn't helpful to deciding to show a button in controls
1729         or not.
1730
1731         * html/HTMLVideoElement.cpp:
1732         (WebCore::HTMLVideoElement::webkitSupportsPresentationMode):
1733
1734 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
1735
1736         Prevent javascript interface from activating picture-in-picture for video elements that are showing capture camera on ios.
1737         https://bugs.webkit.org/show_bug.cgi?id=172328
1738
1739         Reviewed by Eric Carlson.
1740
1741         This change allows MediaPlayers to decide if they support pictureInPicture.
1742         And check this from supportsFullscreen().
1743
1744         In MediaPlayerPrivateMediaStreamAVFObjC disable pip if there is a capture video track.
1745         Elsewhere, leave it enabled.
1746
1747         * html/HTMLVideoElement.cpp:
1748         (WebCore::HTMLVideoElement::supportsFullscreen): Added Check.
1749         * platform/graphics/MediaPlayer.cpp:
1750         (WebCore::MediaPlayer::supportsPictureInPicture): Added.
1751         * platform/graphics/MediaPlayer.h:
1752         * platform/graphics/MediaPlayerPrivate.h:
1753         (WebCore::MediaPlayerPrivateInterface::supportsPictureInPicture): Added.
1754         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
1755         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1756         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1757         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1758         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::supportsPictureInPicture): Added
1759         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
1760         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
1761         (WebCore::MediaPlayerPrivateQTKit::supportsFullscreen): Deleted. Moved inline.
1762
1763 2017-05-19  Chris Dumez  <cdumez@apple.com>
1764
1765         Do not fire load event for SVGElements that are detached or in frameless documents
1766         https://bugs.webkit.org/show_bug.cgi?id=172289
1767         <rdar://problem/32275689>
1768
1769         Reviewed by Ryosuke Niwa.
1770
1771         We should not fire load event for SVGElements that are detached or in frameless
1772         documents.
1773
1774         Test: svg/load-event-detached.html
1775
1776         * svg/SVGElement.cpp:
1777         (WebCore::SVGElement::sendSVGLoadEventIfPossible):
1778
1779 2017-05-19  Chris Dumez  <cdumez@apple.com>
1780
1781         Option() named constructor is not per spec
1782         https://bugs.webkit.org/show_bug.cgi?id=172185
1783
1784         Reviewed by Sam Weinig.
1785
1786         Align the behavior of the Option() named constructor with the HTML specification:
1787         - https://html.spec.whatwg.org/#dom-option
1788
1789         In particular, we no longer create an empty Text child node if the input text is the empty string.
1790         This also aligns our behavior with Firefox.
1791
1792         Test: imported/w3c/web-platform-tests/html/semantics/forms/the-option-element/option-element-constructor.html
1793
1794         * html/HTMLOptionElement.cpp:
1795         (WebCore::HTMLOptionElement::createForJSConstructor):
1796         * html/HTMLOptionElement.h:
1797         * html/HTMLOptionElement.idl:
1798
1799 2017-05-19  Chris Dumez  <cdumez@apple.com>
1800
1801         URLSearchParams / Headers objects @@iterator is not as per Web IDL spec
1802         https://bugs.webkit.org/show_bug.cgi?id=172218
1803
1804         Reviewed by Youenn Fablet.
1805
1806         Both URLSearchParams and Headers interfaces are iterable as per their
1807         respective specification, and they both have a pair iterator:
1808         - https://url.spec.whatwg.org/#interface-urlsearchparams
1809         - https://fetch.spec.whatwg.org/#headers-class
1810
1811         As per the WebIDL specification for 'entries'[1], "If the interface has a pair
1812         iterator, then the Function object is the value of the @@iterator property",
1813         the value of @@iterator being defined at [2]. In WebKit, we were using
1814         different values/functions for 'entries' and @@iterator, although those
1815         functions were doing the same thing (and the right thing).
1816
1817         Also, as per [2], the name of the @@iterator function should be "entries",
1818         which I also implemented in this patch. Previously, we were using
1819         "[Symbol.Iterator]" as function name.
1820
1821         [1] https://heycam.github.io/webidl/#es-iterable-entries
1822         [2] https://heycam.github.io/webidl/#es-iterator
1823
1824         No new tests, rebaselined existing tests.
1825
1826         * bindings/scripts/CodeGeneratorJS.pm:
1827         (GenerateImplementation):
1828         (GenerateImplementationIterableFunctions):
1829         * bindings/scripts/test/JS/JSMapLike.cpp:
1830         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
1831         * bindings/scripts/test/JS/JSTestIterable.cpp:
1832         (WebCore::JSTestIterablePrototype::finishCreation):
1833         (WebCore::jsTestIterablePrototypeFunctionEntriesCaller):
1834         * bindings/scripts/test/JS/JSTestNode.cpp:
1835         (WebCore::JSTestNodePrototype::finishCreation):
1836         (WebCore::jsTestNodePrototypeFunctionEntriesCaller):
1837
1838 2017-05-19  Zalan Bujtas  <zalan@apple.com>
1839
1840         Redundant ellipsis box triggers ASSERT_WITH_SECURITY_IMPLICATION in InlineBox::parent().
1841         https://bugs.webkit.org/show_bug.cgi?id=172309
1842         <rdar://problem/32262357>
1843
1844         Reviewed by Simon Fraser.
1845
1846         This patch stops the redundant ellipsis box trigger ASSERT_WITH_SECURITY_IMPLICATION.
1847
1848         In RootInlineBox::placeEllipsis we construct an ellipsis box and append it to a static HashMap which
1849         keeps track of the ellipsis boxes on each line. However when the line already has an ellipsis, we
1850         re-use the existing one and this newly constructed (but redundant) box gets destroyed as we return from this function.
1851         In InlineBox's d'tor, we let the parent know that now it has a dangling child and we assert on it
1852         later, while accessing the children list. However this redundant ellipsis box was never added to the line,
1853         so the assertion hits incorrectly.
1854
1855         Test: fast/inline/redundant-ellipsis-triggers-assert-incorrectly.html
1856
1857         * rendering/EllipsisBox.cpp:
1858         (WebCore::EllipsisBox::EllipsisBox):
1859         * rendering/InlineBox.cpp: This needs 32bits padding.
1860         (WebCore::InlineBox::invalidateParentChildList):
1861         * rendering/InlineBox.h:
1862         * rendering/RootInlineBox.cpp:
1863         (WebCore::RootInlineBox::placeEllipsis):
1864
1865 2017-05-19  Matt Rajca  <mrajca@apple.com>
1866
1867         Inherit media user gestures from the top document when autoplay quirks are allowed.
1868         https://bugs.webkit.org/show_bug.cgi?id=172375
1869
1870         Reviewed by Eric Carlson.
1871
1872         Added API test.
1873
1874         * dom/Document.cpp:
1875         (WebCore::Document::processingUserGestureForMedia):
1876
1877 2017-05-19  Youenn Fablet  <youenn@apple.com>
1878
1879         Align MockRealtimeMediaSourceCenter with RealtimeMediaSourceCenter
1880         https://bugs.webkit.org/show_bug.cgi?id=172324
1881
1882         Reviewed by Eric Carlson.
1883
1884         No change of behavior.
1885         Remove most of MockRealtimeMediaSourceCenter implementation.
1886         Next step should be to remove it entirely and use the factory setters instead.
1887
1888         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1889         (WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter):
1890         (WebCore::RealtimeMediaSourceCenter::createMediaStream):
1891         (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices):
1892         (WebCore::RealtimeMediaSourceCenter::setDeviceEnabled):
1893         * platform/mediastream/RealtimeMediaSourceCenter.h:
1894         (WebCore::RealtimeMediaSourceCenter::supportedConstraints):
1895         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1896         (WebCore::RealtimeMediaSourceCenterMac::RealtimeMediaSourceCenterMac):
1897         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
1898         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1899         (WebCore::MockRealtimeMediaSourceCenter::MockCaptureDeviceManager::captureDevices):
1900         * platform/mock/MockRealtimeMediaSourceCenter.h:
1901
1902 2017-05-19  Zalan Bujtas  <zalan@apple.com>
1903
1904         Update SameSizeAsInlineBox with the correct InlineBoxBitfields bits.
1905         https://bugs.webkit.org/show_bug.cgi?id=172377
1906
1907         Reviewed by Tim Horton.
1908
1909         * rendering/InlineBox.cpp:
1910
1911 2017-05-19  Daniel Bates  <dabates@apple.com>
1912
1913         Bindings: Support runtime-enabled features in specific worlds
1914         https://bugs.webkit.org/show_bug.cgi?id=172235
1915
1916         Reviewed by Chris Dumez.
1917
1918         Currently a function, attribute, or interface can be annotated with either EnabledAtRuntime
1919         or EnabledForWorld (not both) to expose/conceal it depending on the state of a runtime
1920         feature flag or the DOM world associated with the running JavaScript code, respectively.
1921         Even though we do not have any functions, attributes, or interfaces that are annotated
1922         with both EnabledAtRuntime and EnabledForWorld at the time of writing, it seems reasonable
1923         to support such a combination of annotations. This also has the benefit of making it
1924         straightforward to support the extended attribute SecureContext by generalizing the logic
1925         that generates the code to expose/conceal a function, attribute, or interface.
1926
1927         * bindings/scripts/CodeGeneratorJS.pm:
1928         (GenerateRuntimeEnableConditionalString): Use an array to build up all the conjuncts in
1929         the conditional expression.
1930         (GenerateImplementation): Substitute GenerateRuntimeEnableConditionalString() and $runtimeEnableConditionalString
1931         for GetRuntimeEnableFunctionName() and $enable_function_result, respectively.
1932         (GetRuntimeEnableFunctionName): Deleted.
1933
1934         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1935          (WebCore::JSTestGlobalObject::finishCreation):
1936          (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabled):
1937          (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabledCaller):
1938          (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeaturesEnabled):
1939          (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeaturesEnabledCaller):
1940          Update expected results.
1941
1942          * bindings/scripts/test/JS/JSTestObj.cpp:
1943          (WebCore::JSTestObjPrototype::finishCreation):
1944          (WebCore::jsTestObjPrototypeFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabled):
1945          (WebCore::jsTestObjPrototypeFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabledCaller):
1946          Ditto.
1947
1948          * bindings/scripts/test/TestGlobalObject.idl: Added test cases.
1949          * bindings/scripts/test/TestObj.idl: Added test case.
1950
1951 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
1952
1953         Fix macos build after r217143
1954         https://bugs.webkit.org/show_bug.cgi?id=172380
1955
1956         unreviewed.
1957
1958         Remove reference to WebVideoFullscreenInterface for mac build.
1959
1960         * html/HTMLMediaElement.cpp:
1961         * platform/mac/WebVideoFullscreenInterfaceMac.h:
1962
1963 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
1964
1965         Remove defunct WebVideoFullscreenInterface
1966         https://bugs.webkit.org/show_bug.cgi?id=172254
1967
1968         Reviewed by Jon Lee.
1969
1970         No new tests because no behavior change.
1971
1972         WebVideoFullscreenInterface has long since been replaced by WebVideoFullscreenModelClient.
1973
1974         * WebCore.xcodeproj/project.pbxproj:
1975         * html/HTMLMediaElement.cpp:
1976         * html/HTMLVideoElement.cpp:
1977         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
1978         * platform/cocoa/WebVideoFullscreenInterface.h: Removed.
1979         * platform/cocoa/WebVideoFullscreenModel.h:
1980         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
1981         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1982         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
1983         * platform/mac/WebVideoFullscreenInterfaceMac.h:
1984
1985 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
1986
1987         HTMLVideoElement::webkitSupportsPresentationMode allowsPictureInPicture() check is redundant.
1988         https://bugs.webkit.org/show_bug.cgi?id=172330
1989         rdar://problem/32285443
1990
1991         Reviewed by Eric Carlson.
1992
1993         No new tests because no behavior change.
1994
1995         This removes a redundant call to allowsPictureInPicture() to make it
1996         more clear that webkitSupportsPresentationMode gives the same result as 
1997         webkitSupportsFullscreen(pipMode)
1998
1999         * html/HTMLVideoElement.cpp:
2000         (WebCore::HTMLVideoElement::webkitSupportsPresentationMode):
2001
2002 2017-05-19  Jeremy Jones  <jeremyj@apple.com>
2003
2004         [WebRTC] Remove PiP support for video elements that are showing camera capture
2005         https://bugs.webkit.org/show_bug.cgi?id=172336
2006
2007         Reviewed by Eric Carlson.
2008
2009         No new tests because no effect on the DOM. This just changes a value sent to the platform interface layer.
2010
2011         Ask video element if it supports picture-in-picture instead of asking the mediaSession directly.
2012         This allows the video element to give a more robust answer.
2013
2014         * html/HTMLVideoElement.h:
2015         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2016         (WebVideoFullscreenControllerContext::setUpFullscreen):
2017
2018 2017-05-18  Sam Weinig  <sam@webkit.org>
2019
2020         [WebIDL] Remove the need for the generator to know about native type mapping
2021         https://bugs.webkit.org/show_bug.cgi?id=172310
2022
2023         Reviewed by Darin Adler.
2024
2025         Replace the use of explicit typename to native type mappings in CodeGeneratorJS.pm
2026         with use of IDLTypes and Converter, which already need the mapping. This allows us
2027         to have the information in only one spot.
2028
2029         Also, callback generation to account for nullability and update the IDLs to correctly
2030         annotate only the types that need to be nullable. 
2031
2032         * Modules/geolocation/GeoNotifier.cpp:
2033         * Modules/geolocation/GeoNotifier.h:
2034         * Modules/geolocation/Geolocation.cpp:
2035         * Modules/geolocation/Geolocation.h:
2036         * Modules/geolocation/PositionCallback.idl:
2037         * Modules/geolocation/PositionErrorCallback.h:
2038         Use references where possible in the Geolocation code. It was almost possible
2039         to make PositionCallback take a non-nullable position, but some odd logic in
2040         Geolocation::makeCachedPositionCallbacks() implies that there is a path where
2041         passing null is possible, though it would assert. Added FIXME's to return to
2042         this in a follow up.
2043
2044         * Modules/webaudio/AudioBufferCallback.idl:
2045         Add nullable annotation and FIXME explaining that the latest spec splits the callback
2046         into two separate ones.
2047
2048         * Modules/webdatabase/Database.cpp:
2049         (WebCore::Database::runTransaction):
2050         * Modules/webdatabase/DatabaseCallback.h:
2051         * Modules/webdatabase/DatabaseManager.cpp:
2052         (WebCore::DatabaseManager::openDatabase):
2053         * Modules/webdatabase/SQLStatement.cpp:
2054         (WebCore::SQLStatement::performCallback):
2055         * Modules/webdatabase/SQLStatementCallback.h:
2056         * Modules/webdatabase/SQLStatementErrorCallback.h:
2057         * Modules/webdatabase/SQLTransaction.cpp:
2058         (WebCore::SQLTransaction::deliverTransactionCallback):
2059         (WebCore::SQLTransaction::deliverTransactionErrorCallback):
2060         * Modules/webdatabase/SQLTransactionCallback.h:
2061         * Modules/webdatabase/SQLTransactionErrorCallback.h:
2062         * inspector/InspectorDatabaseAgent.cpp:
2063         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp:
2064         (WebCore::JSSQLStatementErrorCallback::handleEvent):
2065         Update to pass callback parameters as references, since they are never null.
2066
2067         * bindings/IDLTypes.h:
2068         Add NullableParameterType to allow customization of nullable parameters (in much
2069         the same way we allow customization of the nullable implementation type).
2070
2071         * bindings/scripts/CodeGeneratorJS.pm:
2072         (GenerateDefaultValue):
2073         Use Converter<>::ReturnType{ } for default values rather than ${GetNativeType..}().
2074
2075         (GenerateHeader):
2076         Remove use of GetNativeType for toWrapped by using the impl type, since this will never
2077         be a complex type.
2078
2079         (GenerateImplementation):
2080         Simplify DOMJIT UnsafeToNative by merging two identical paths and using auto.
2081
2082         (GenerateParametersCheck):
2083         Rework parameter checks to use more specific variable names, make branches more clear,
2084         and use Converter<>::ReturnType rather than GetNativeType.
2085
2086         (GenerateCallbackHeaderContent):
2087         (GenerateCallbackImplementationContent):
2088         Switch to using typename ${IDLType}::ParameterType as the parameters for callback functions. Also
2089         add final and override to make sure the generated function matches the user provided base class.
2090         (GetNativeType): Deleted.
2091         (GetNativeInnerType): Deleted.
2092         (GetNativeTypeForCallbacks): Deleted.
2093         Remove native type mappings.
2094
2095         * css/MediaQueryListListener.h:
2096         * css/MediaQueryListListener.idl:
2097         * css/MediaQueryMatcher.cpp:
2098         Update MediaQueryListListener to take a non-nullable MediaQueryList.
2099         
2100         * dom/NativeNodeFilter.cpp:
2101         * dom/NativeNodeFilter.h:
2102         * dom/NodeFilter.h:
2103         * dom/NodeFilter.idl:
2104         * dom/NodeIterator.cpp:
2105         * dom/Traversal.cpp:
2106         * dom/Traversal.h:
2107         * dom/TreeWalker.cpp:
2108         * bindings/js/JSNodeFilterCustom.cpp:
2109         Update acceptNode to be non-nullable and pass the Node by reference.
2110
2111         * dom/StringCallback.cpp:
2112         * dom/StringCallback.h:
2113         Pass the ScriptExecutionContext by reference.
2114
2115         * page/IntersectionObserverCallback.h:
2116         Update to match new parameter types and pass IntersectionObserver by reference.
2117
2118         * page/PerformanceObserver.cpp:
2119         * page/PerformanceObserverCallback.h:
2120         Update to pass PerformanceObserverEntryList and PerformanceObserver by reference.
2121
2122         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
2123         * bindings/scripts/test/JS/JSTestCallbackFunction.h:
2124         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
2125         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
2126         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
2127         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
2128         * bindings/scripts/test/JS/JSTestObj.cpp:
2129         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2130         Update test results.
2131
2132         * bindings/scripts/test/TestCallbackInterface.idl:
2133         Update test to refer to actual interfaces as we now do lookup on these parameter 
2134         types rather than blindly assuming they are interfaces.
2135
2136 2017-05-19  Commit Queue  <commit-queue@webkit.org>
2137
2138         Unreviewed, rolling out r217098, r217111, r217113, and
2139         r217114.
2140         https://bugs.webkit.org/show_bug.cgi?id=172367
2141
2142         These changes broke the Windows build and introduced
2143         LayoutTest failures (Requested by ryanhaddad on #webkit).
2144
2145         Reverted changesets:
2146
2147         "[MSE][Mac] Support painting MSE video-element to canvas"
2148         https://bugs.webkit.org/show_bug.cgi?id=125157
2149         http://trac.webkit.org/changeset/217098
2150
2151         "[MSE][Mac] Support painting MSE video-element to canvas"
2152         https://bugs.webkit.org/show_bug.cgi?id=125157
2153         http://trac.webkit.org/changeset/217111
2154
2155         "Unreviewed build fix; add undefined functions and constants
2156         to the CoreMediaSoftLink.h, and use the"
2157         http://trac.webkit.org/changeset/217113
2158
2159         "[MSE][Mac] Support painting MSE video-element to canvas"
2160         https://bugs.webkit.org/show_bug.cgi?id=125157
2161         http://trac.webkit.org/changeset/217114
2162
2163 2017-05-19  Andy Estes  <aestes@apple.com>
2164
2165         REGRESSION (r217078): window.ApplePaySession is undefined on macOS Sierra
2166         https://bugs.webkit.org/show_bug.cgi?id=172344
2167
2168         Reviewed by Tim Horton.
2169
2170         r213673 mistakenly changed the ApplePaySession interface from being conditional on
2171         APPLE_PAY to being conditional on APPLE_PAY_DELEGATE, so when r217078 disabled
2172         APPLE_PAY_DELEGATE on Sierra and earlier it disabled ApplePaySession.
2173
2174         Fix this by reverting ApplePaySession to being conditional on APPLE_PAY.
2175
2176         Fixes http/tests/ssl/applepay/ApplePaySession.html
2177
2178         * Modules/applepay/ApplePaySession.idl:
2179
2180 2017-05-19  Chris Dumez  <cdumez@apple.com>
2181
2182         CSSOM insertRule() index argument is optional with default 0
2183         https://bugs.webkit.org/show_bug.cgi?id=172219
2184
2185         Reviewed by Sam Weinig.
2186
2187         Index parameter to CSSSupportsRule.insertRule() and CSSStyleSheet.insertRule() should
2188         be optional with a default value of 0, as per the latest specification:
2189         - https://github.com/w3c/csswg-drafts/commit/7949d41a2d86107f8ad4624c055b4b0c9c28ad0d
2190         - https://www.w3.org/Bugs/Public/show_bug.cgi?id=27384
2191
2192         Tests: imported/w3c/web-platform-tests/cssom/insertRule-charset-no-index.html
2193                imported/w3c/web-platform-tests/cssom/insertRule-import-no-index.html
2194                imported/w3c/web-platform-tests/cssom/insertRule-namespace-no-index.html
2195                imported/w3c/web-platform-tests/cssom/insertRule-no-index.html
2196
2197         * css/CSSStyleSheet.cpp:
2198         * css/CSSStyleSheet.h:
2199         * css/CSSStyleSheet.idl:
2200         * css/CSSSupportsRule.idl:
2201
2202 2017-05-19  Carlos Garcia Campos  <cgarcia@igalia.com>
2203
2204         [Threaded Compositor] Remove platform ifdefs from threaded compositor implementation
2205         https://bugs.webkit.org/show_bug.cgi?id=172265
2206
2207         Reviewed by Žan Doberšek.
2208
2209         Remove PlatformDisplayWPE::EGLTarget.
2210
2211         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
2212         * platform/graphics/wpe/PlatformDisplayWPE.h:
2213
2214 2017-05-19  Jer Noble  <jer.noble@apple.com>
2215
2216         Unreviewed build fix; add undefined functions and constants to the CoreMediaSoftLink.h, and use the
2217         correct (and previously soft-linked) method in WebCoreDecompressionSession.
2218
2219         * platform/cf/CoreMediaSoftLink.cpp:
2220         * platform/cf/CoreMediaSoftLink.h:
2221         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
2222         (WebCore::WebCoreDecompressionSession::imageForTime):
2223
2224 2017-05-19  Yusuke Suzuki  <utatane.tea@gmail.com>
2225
2226         [JSC][DFG][DOMJIT] Extend CheckDOM to CheckSubClass
2227         https://bugs.webkit.org/show_bug.cgi?id=172098
2228
2229         Reviewed by Saam Barati.
2230
2231         Add DOMJIT interface IDL attribute. Which allows us to define checkSubClassPatchpointFor${className}
2232         function for that ClassInfo. And we move CheckSubClass patchpoint implementation to ClassInfo's member
2233
2234         * CMakeLists.txt:
2235         * WebCore.xcodeproj/project.pbxproj:
2236         * bindings/js/JSDOMGlobalObject.cpp:
2237         * bindings/js/JSDOMWindowBase.cpp:
2238         * bindings/js/JSDOMWindowProperties.cpp:
2239         * bindings/js/JSDOMWindowShell.cpp:
2240         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
2241         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2242         * bindings/scripts/CodeGeneratorJS.pm:
2243         (GenerateHeader):
2244         (GenerateImplementation):
2245         (GenerateImplementationIterableFunctions):
2246         (GenerateConstructorHelperMethods):
2247         * bindings/scripts/IDLAttributes.json:
2248         * bindings/scripts/test/JS/JSInterfaceName.cpp:
2249         * bindings/scripts/test/JS/JSMapLike.cpp:
2250         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
2251         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2252         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
2253         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
2254         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
2255         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2256         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2257         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
2258         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2259         * bindings/scripts/test/JS/JSTestDOMJIT.h:
2260         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2261         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2262         * bindings/scripts/test/JS/JSTestException.cpp:
2263         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2264         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2265         * bindings/scripts/test/JS/JSTestInterface.cpp:
2266         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
2267         * bindings/scripts/test/JS/JSTestIterable.cpp:
2268         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2269         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
2270         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2271         * bindings/scripts/test/JS/JSTestNode.cpp:
2272         * bindings/scripts/test/JS/JSTestObj.cpp:
2273         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2274         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2275         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2276         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
2277         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2278         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
2279         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
2280         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2281         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2282         * bridge/c/CRuntimeObject.cpp:
2283         * bridge/c/c_instance.cpp:
2284         * bridge/objc/ObjCRuntimeObject.mm:
2285         * bridge/objc/objc_instance.mm:
2286         * bridge/objc/objc_runtime.mm:
2287         * bridge/runtime_array.cpp:
2288         * bridge/runtime_method.cpp:
2289         * bridge/runtime_object.cpp:
2290         * dom/Document.idl:
2291         * dom/DocumentFragment.idl:
2292         * dom/Element.idl:
2293         * dom/Event.idl:
2294         * dom/Node.idl:
2295         * domjit/JSDocumentDOMJIT.cpp:
2296         (WebCore::checkSubClassPatchpointForJSDocument):
2297         (WebCore::DocumentDocumentElementDOMJIT::checkDOM): Deleted.
2298         (WebCore::DocumentBodyDOMJIT::checkDOM): Deleted.
2299         * domjit/JSDocumentFragmentDOMJIT.cpp: Copied from Source/JavaScriptCore/runtime/JSMap.cpp.
2300         (WebCore::checkSubClassPatchpointForJSDocumentFragment):
2301         * domjit/JSElementDOMJIT.cpp: Copied from Source/JavaScriptCore/tools/JSDollarVM.cpp.
2302         (WebCore::checkSubClassPatchpointForJSElement):
2303         * domjit/JSEventDOMJIT.cpp: Copied from Source/JavaScriptCore/tools/JSDollarVM.cpp.
2304         (WebCore::checkSubClassPatchpointForJSEvent):
2305         * domjit/JSNodeDOMJIT.cpp:
2306         (WebCore::checkSubClassPatchpointForJSNode):
2307         (WebCore::NodeFirstChildDOMJIT::checkDOM): Deleted.
2308         (WebCore::NodeLastChildDOMJIT::checkDOM): Deleted.
2309         (WebCore::NodeNextSiblingDOMJIT::checkDOM): Deleted.
2310         (WebCore::NodePreviousSiblingDOMJIT::checkDOM): Deleted.
2311         (WebCore::NodeParentNodeDOMJIT::checkDOM): Deleted.
2312         (WebCore::NodeNodeTypeDOMJIT::checkDOM): Deleted.
2313         (WebCore::NodeOwnerDocumentDOMJIT::checkDOM): Deleted.
2314
2315 2017-05-18  Jer Noble  <jer.noble@apple.com>
2316
2317         [MSE][Mac] Support painting MSE video-element to canvas
2318         https://bugs.webkit.org/show_bug.cgi?id=125157
2319         <rdar://problem/23062016>
2320
2321         Reviewed by Eric Carlson.
2322
2323         Test: media/media-source/media-source-paint-to-canvas.html
2324
2325         In order to have access to decoded video data for painting, decode the encoded samples manually
2326         instead of adding them to the AVSampleBufferDisplayLayer. To facilitate doing so, add a new
2327         utility class WebCoreDecompressionSession, which can decode samples and store them.
2328
2329         For the purposes of this patch, to avoid double-decoding of video data and to avoid severe complication
2330         of our sample delivery pipeline, we will only support painting of decoded video samples when the video is
2331         not displayed in the DOM.
2332
2333         * Modules/mediasource/MediaSource.cpp:
2334         (WebCore::MediaSource::seekToTime): Always send waitForSeekCompleted() to give private a chance to delay seek completion.
2335         * Modules/mediasource/SourceBuffer.cpp:
2336         (WebCore::SourceBuffer::sourceBufferPrivateReenqueSamples): Added.
2337         * Modules/mediasource/SourceBuffer.h:
2338         * WebCore.xcodeproj/project.pbxproj:
2339         * platform/cf/CoreMediaSoftLink.cpp: Added new soft link macros.
2340         * platform/cf/CoreMediaSoftLink.h: Ditto.
2341         * platform/cocoa/CoreVideoSoftLink.cpp: Ditto.
2342         * platform/cocoa/CoreVideoSoftLink.h: Ditto.
2343         * platform/graphics/SourceBufferPrivateClient.h:
2344         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2345         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sampleBufferDisplayLayer): Simple accessor.
2346         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::decompressionSession): Ditto.
2347         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2348         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
2349         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load): Update whether we should be displaying in a layer or decompression session..
2350         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVisible): Ditto.
2351         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitForSeekCompleted): m_seeking is now an enum.
2352         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seeking): Ditto.
2353         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekCompleted): Ditto. If waiting for a video frame, delay completing seek.
2354         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::nativeImageForCurrentTime): Call updateLastImage() and return result.
2355         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastImage): Fetch the image for the current time.
2356         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paint): Pass to paintCurrentFrameInCanvas.
2357         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paintCurrentFrameInContext): Get a native image, and render it.
2358         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::acceleratedRenderingStateChanged): Create or destroy a layer or decompression session as appropriate.
2359         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer): Creates a layer.
2360         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer): Destroys a layer.
2361         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureDecompressionSession): Creates a decompression session.
2362         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyDecompressionSession): Destroys a decompression session.
2363         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame): If seek completion delayed, complete now. Ditto for ready state change.
2364         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setReadyState): If waiting for a video frame, delay ready state change.
2365         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addDisplayLayer): Deleted.
2366         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeDisplayLayer): Deleted.
2367         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
2368         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
2369         (WebCore::MediaSourcePrivateAVFObjC::hasVideo): Promote to a class function.
2370         (WebCore::MediaSourcePrivateAVFObjC::hasSelectedVideo): Return whether any of the active source buffers have video and are selected.
2371         (WebCore::MediaSourcePrivateAVFObjC::hasSelectedVideoChanged): Call setSourceBufferWithSelectedVideo().
2372         (WebCore::MediaSourcePrivateAVFObjC::setVideoLayer): Set (or clear) the layer on the selected buffer.
2373         (WebCore::MediaSourcePrivateAVFObjC::setDecompressionSession): Ditto for decompression session.
2374         (WebCore::MediaSourcePrivateAVFObjC::setSourceBufferWithSelectedVideo): Remove the layer and decompression session from the unselected
2375
2376                 buffer and add the decompression session or layer to the newly selected buffer.
2377         (WebCore::MediaSourcePrivateAVFObjCHasVideo): Deleted.
2378         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2379         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2380         (WebCore::SourceBufferPrivateAVFObjC::destroyRenderers): Clear the videoLayer and decompressionSession.
2381         (WebCore::SourceBufferPrivateAVFObjC::hasSelectedVideo): Return whether the buffer has a selected video track.
2382         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): The media player now manages the video layer and decompression session lifetimes.
2383         (WebCore::SourceBufferPrivateAVFObjC::flush): Flush the decompression session, if it exists.
2384         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Enqueue to the decompression session, if it exists.
2385         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples): As the decompression session, if it exists.
2386         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples): Tell the decompression session to stop requesting data, if it exists.
2387         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples): Request media data from the decompression session, if it exists.
2388         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer): Added.
2389         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): Added.
2390         * platform/graphics/cocoa/WebCoreDecompressionSession.h: Added.
2391         (WebCore::WebCoreDecompressionSession::create):
2392         (WebCore::WebCoreDecompressionSession::isInvalidated):
2393         (WebCore::WebCoreDecompressionSession::createWeakPtr):
2394         * platform/graphics/cocoa/WebCoreDecompressionSession.mm: Added.
2395         (WebCore::WebCoreDecompressionSession::WebCoreDecompressionSession): Register for media data requests.
2396         (WebCore::WebCoreDecompressionSession::invalidate):  Unregister for same.
2397         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaDataCallback): Pass to maybeBecomeReadyForMoreMediaData.
2398         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaData): Check in-flight decodes, and decoded frame counts.
2399         (WebCore::WebCoreDecompressionSession::enqueueSample): Pass the sample to be decoded on a background queue.
2400         (WebCore::WebCoreDecompressionSession::decodeSample): Decode the sample.
2401         (WebCore::WebCoreDecompressionSession::decompressionOutputCallback): Call handleDecompressionOutput.
2402         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput): Pass decoded sample to be enqueued on the main thread.
2403         (WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
2404         (WebCore::WebCoreDecompressionSession::enqueueDecodedSample): Enqueue the frame (if it's a displayed frame).
2405         (WebCore::WebCoreDecompressionSession::isReadyForMoreMediaData): Return whether we've hit our high water sample count.
2406         (WebCore::WebCoreDecompressionSession::requestMediaDataWhenReady):
2407         (WebCore::WebCoreDecompressionSession::stopRequestingMediaData): Unset the same.
2408         (WebCore::WebCoreDecompressionSession::notifyWhenHasAvailableVideoFrame): Set a callback to notify when a decoded frame has been enqueued.
2409         (WebCore::WebCoreDecompressionSession::imageForTime): Successively dequeue images until reaching one at or beyond the requested time.
2410         (WebCore::WebCoreDecompressionSession::flush): Synchronously empty the producer and consumer queues.
2411         (WebCore::WebCoreDecompressionSession::getDecodeTime): Utility method.
2412         (WebCore::WebCoreDecompressionSession::getPresentationTime): Ditto.
2413         (WebCore::WebCoreDecompressionSession::getDuration): Ditto.
2414         (WebCore::WebCoreDecompressionSession::compareBuffers): Ditto.
2415         * platform/cocoa/VideoToolboxSoftLink.cpp: Added.
2416         * platform/cocoa/VideoToolboxSoftLink.h: Added.
2417
2418 2017-05-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
2419
2420         [REGRESSION](r216901): Delete ImageDecoder if BitmapImage::destroyDecodedData() was called to destroy all the decoded frames
2421         https://bugs.webkit.org/show_bug.cgi?id=172325
2422
2423         Reviewed by Simon Fraser.
2424
2425         When calling BitmapImage::destroyDecodedData() with destroyAll = true, the
2426         current ImageDecoder has to be deleted regardless the current frame needs
2427         to be cached or not. This is true except when the image is animating.
2428         Creating a new ImageDecoder for the animated image will lead to decoding
2429         all the frames from frame-zero till the current frame.
2430
2431         Deleting the current ImageDecoder has the benefit of releasing its raster
2432         data. We also must delete the current ImageDecoder when the CachedImage
2433         switched its data SharedBuffer.
2434
2435         The fix is return the condition in BitmapImage::destroyDecodedData() to 
2436         be as it was before r216901.
2437
2438         * platform/graphics/BitmapImage.cpp:
2439         (WebCore::BitmapImage::destroyDecodedData):
2440
2441 2017-05-18  Ryan Haddad  <ryanhaddad@apple.com>
2442
2443         Unreviewed, rolling out r217079.
2444
2445         This change broke internal builds.
2446
2447         Reverted changeset:
2448
2449         "Redundant ellipsis box triggers
2450         ASSERT_WITH_SECURITY_IMPLICATION in InlineBox::parent()."
2451         https://bugs.webkit.org/show_bug.cgi?id=172309
2452         http://trac.webkit.org/changeset/217079
2453
2454 2017-05-18  Joseph Pecoraro  <pecoraro@apple.com>
2455
2456         Web Inspector: Release InjectedScripts when frontends close
2457         https://bugs.webkit.org/show_bug.cgi?id=172313
2458
2459         Reviewed by Andreas Kling.
2460
2461         * inspector/InspectorController.cpp:
2462         (WebCore::InspectorController::disconnectFrontend):
2463         Release inspector resources together, including discarding injected
2464         scripts so that they may be collected.
2465
2466         (WebCore::InspectorController::inspectedPageDestroyed):
2467         (WebCore::InspectorController::disconnectAllFrontends):
2468         Move the disconnect call inside of disconnectAllFrontends to establish
2469         a pattern of releasing web inspector resources together.
2470
2471 2017-05-18  Simon Fraser  <simon.fraser@apple.com>
2472
2473         Add a newline after the URL in showLayerTree output.
2474
2475         Reviewed by Zalan Bujtas.
2476
2477         * rendering/RenderLayer.cpp:
2478         (WebCore::showLayerTree):
2479
2480 2017-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2481
2482         Attachment drag preview should not have the attachment outline
2483         https://bugs.webkit.org/show_bug.cgi?id=172327
2484         <rdar://problem/32282831>
2485
2486         Reviewed by Tim Horton.
2487
2488         When creating a drag image for an attachment element, don't include borders around the attachment.
2489
2490         * page/DragController.cpp:
2491         (WebCore::DragController::startDrag):
2492         * rendering/RenderAttachment.h:
2493         * rendering/RenderThemeIOS.mm:
2494         (WebCore::RenderThemeIOS::paintAttachment):
2495
2496 2017-05-18  Youenn Fablet  <youenn@apple.com>
2497
2498         Make WebRTC logging happen in Release
2499         https://bugs.webkit.org/show_bug.cgi?id=172307
2500
2501         Reviewed by Eric Carlson.
2502
2503         No change of behavior.
2504         Move from LOG(WebRTC...) to RELEASE_LOG(WebRTC...).
2505
2506         * Modules/mediastream/PeerConnectionBackend.cpp:
2507         (WebCore::PeerConnectionBackend::createOfferSucceeded):
2508         (WebCore::PeerConnectionBackend::createOfferFailed):
2509         (WebCore::PeerConnectionBackend::createAnswerSucceeded):
2510         (WebCore::PeerConnectionBackend::createAnswerFailed):
2511         (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
2512         (WebCore::PeerConnectionBackend::setLocalDescriptionFailed):
2513         (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
2514         (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed):
2515         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
2516         (WebCore::PeerConnectionBackend::addIceCandidateFailed):
2517         (WebCore::PeerConnectionBackend::newICECandidate):
2518         (WebCore::PeerConnectionBackend::doneGatheringCandidates):
2519         * Modules/mediastream/RTCPeerConnection.cpp:
2520         (WebCore::RTCPeerConnection::queuedCreateOffer):
2521         (WebCore::RTCPeerConnection::queuedCreateAnswer):
2522         (WebCore::RTCPeerConnection::queuedSetLocalDescription):
2523         (WebCore::RTCPeerConnection::queuedSetRemoteDescription):
2524         (WebCore::RTCPeerConnection::queuedAddIceCandidate):
2525
2526 2017-05-18  Eric Carlson  <eric.carlson@apple.com>
2527
2528         [MediaStream] do not cache gUM permissions
2529         https://bugs.webkit.org/show_bug.cgi?id=172245
2530
2531         Reviewed by Youenn Fablet.
2532
2533         No new tests, updated fast/mediastream/MediaDevices-getUserMedia.html.
2534
2535         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2536         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): Add salt parameter.
2537         * platform/mediastream/RealtimeMediaSourceCenter.h:
2538
2539 2017-05-18  Zalan Bujtas  <zalan@apple.com>
2540
2541         Redundant ellipsis box triggers ASSERT_WITH_SECURITY_IMPLICATION in InlineBox::parent().
2542         https://bugs.webkit.org/show_bug.cgi?id=172309
2543         <rdar://problem/32262357>
2544
2545         Reviewed by Simon Fraser.
2546
2547         This patch stops the redundant ellipsis box trigger ASSERT_WITH_SECURITY_IMPLICATION.
2548
2549         In RootInlineBox::placeEllipsis we construct an ellipsis box and append it to a static HashMap which
2550         keeps track of the ellipsis boxes on each line. However when the line already has an ellipsis, we
2551         re-use the existing one and this newly constructed (but redundant) box gets destroyed as we return from this function.
2552         In InlineBox's d'tor, we let the parent know that now it has a dangling child and we assert on it
2553         later, while accessing the children list. However this redundant ellipsis box was never added to the line,
2554         so the assertion hits incorrectly.
2555
2556         Test: fast/inline/redundant-ellipsis-triggers-assert-incorrectly.html
2557
2558         * rendering/EllipsisBox.cpp:
2559         (WebCore::EllipsisBox::EllipsisBox):
2560         * rendering/InlineBox.cpp:
2561         (WebCore::InlineBox::invalidateParentChildList):
2562         * rendering/InlineBox.h:
2563         * rendering/RootInlineBox.cpp:
2564         (WebCore::RootInlineBox::placeEllipsis): Use the newly created ellipsis box instead.
2565
2566 2017-05-18  Andy Estes  <aestes@apple.com>
2567
2568         ENABLE(APPLE_PAY_DELEGATE) should be NO on macOS Sierra and earlier
2569         https://bugs.webkit.org/show_bug.cgi?id=172305
2570
2571         Reviewed by Anders Carlsson.
2572
2573         * Configurations/FeatureDefines.xcconfig:
2574
2575 2017-05-18  Dean Jackson  <dino@apple.com>
2576
2577         Transform misplaces element 50% of the time
2578         https://bugs.webkit.org/show_bug.cgi?id=172300
2579
2580         Reviewed by Simon Fraser.
2581
2582         A hardware-accelerated animation of the transform property
2583         requires layout to happen if it contains a translate operation
2584         using percentages, otherwise it may create an incorrect
2585         animation. The "50% of the time" comes in to play because
2586         the layout timer may sometimes fire before the animation
2587         timer. The test case contains a example that is much more
2588         likely to fail without this fix.
2589
2590         Test: animations/needs-layout.html
2591
2592         * page/animation/CSSAnimationController.cpp:
2593         (WebCore::CSSAnimationControllerPrivate::animationTimerFired): If
2594         we've been told that we need a layout, and we have one pending, then
2595         force it before doing the rest of the animation logic.
2596         (WebCore::CSSAnimationController::updateAnimations): Check if the
2597         CompositeAnimation depends on layout, and tell the private controller
2598         that it should check for the necessity of a layout as the animation
2599         timer fires.
2600
2601         * page/animation/CompositeAnimation.cpp:
2602         (WebCore::CompositeAnimation::animate): Ask the keyframes if this
2603         animation depends on layout.
2604
2605         * page/animation/CompositeAnimation.h:
2606         (WebCore::CompositeAnimation::hasAnimationThatDependsOnLayout):
2607         * page/animation/KeyframeAnimation.cpp:
2608         (WebCore::KeyframeAnimation::KeyframeAnimation):
2609         (WebCore::KeyframeAnimation::computeLayoutDependency): Look at all
2610         the keyframe properties for something that is a translation using
2611         percentages.
2612
2613         * page/animation/KeyframeAnimation.h:
2614
2615 2017-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2616
2617         Selection around attachment elements should not persist when beginning a drag
2618         https://bugs.webkit.org/show_bug.cgi?id=172319
2619         <rdar://problem/32283008>
2620
2621         Reviewed by Tim Horton.
2622
2623         When beginning to drag an attachment element, save and restore the visible selection when calling out to the
2624         injected bundle for additional data, and when creating the drag image.
2625
2626         Augmented an existing API test: DataInteractionTests.AttachmentElementItemProviders.
2627
2628         * page/DragController.cpp:
2629         (WebCore::DragController::startDrag):
2630
2631 2017-05-18  Daniel Bates  <dabates@apple.com>
2632
2633         Cleanup: Remove unused functions from RuntimeEnabledFeatures
2634         https://bugs.webkit.org/show_bug.cgi?id=172315
2635
2636         Reviewed by Jer Noble.
2637
2638         * page/RuntimeEnabledFeatures.cpp:
2639         (WebCore::RuntimeEnabledFeatures::htmlMediaElementEnabled): Deleted.
2640         (WebCore::RuntimeEnabledFeatures::htmlVideoElementEnabled): Deleted.
2641         (WebCore::RuntimeEnabledFeatures::htmlSourceElementEnabled): Deleted.
2642         (WebCore::RuntimeEnabledFeatures::mediaControllerEnabled): Deleted.
2643         (WebCore::RuntimeEnabledFeatures::mediaErrorEnabled): Deleted.
2644         (WebCore::RuntimeEnabledFeatures::timeRangesEnabled): Deleted.
2645         * page/RuntimeEnabledFeatures.h:
2646         (WebCore::RuntimeEnabledFeatures::setDOMIteratorEnabled): Deleted.
2647         (WebCore::RuntimeEnabledFeatures::domIteratorEnabled): Deleted.
2648         (WebCore::RuntimeEnabledFeatures::setGeolocationEnabled): Deleted.
2649         (WebCore::RuntimeEnabledFeatures::geolocationEnabled): Deleted.
2650
2651 2017-05-18  Daniel Bates  <dabates@apple.com>
2652
2653         Improve error message for Access-Control-Allow-Origin violation due to misconfigured server
2654         https://bugs.webkit.org/show_bug.cgi?id=162819
2655         <rdar://problem/28575938>
2656
2657         Reviewed by Joseph Pecoraro.
2658
2659         Inspired by Blink change:
2660         <https://src.chromium.org/viewvc/blink?view=revision&revision=163406>
2661
2662         At most one Access-Control-Allow-Origin header may be in an HTTP response. Improve the
2663         error message emitted on a CORS failure when Access-Control-Allow-Origin contains more
2664         than one origin, indicated by the presence of a ',', as a way to help web developers/server
2665         administrators differentiate between a misconfigured Access-Control-Allow-Origin header
2666         and a misconfigured server.
2667
2668         * loader/CrossOriginAccessControl.cpp:
2669         (WebCore::passesAccessControlCheck): Defined a local variable to hold the value of securityOrigin.toString()
2670         and referenced this variable throughout the code to avoid computing the stringified security
2671         origin more than once. Switched to using makeString() to concatenate error message when the
2672         origin of the page does not match the value of the Access-Control-Allow-Origin header.
2673
2674 2017-05-18  John Wilander  <wilander@apple.com>
2675
2676         Resource Load Statistics: Grandfather domains for existing data records
2677         https://bugs.webkit.org/show_bug.cgi?id=172155
2678         <rdar://problem/24913532>
2679
2680         Reviewed by Alex Christensen.
2681
2682         Test: http/tests/loading/resourceLoadStatistics/grandfathering.html
2683
2684         * loader/ResourceLoadObserver.cpp:
2685         (WebCore::ResourceLoadObserver::setGrandfathered):
2686         (WebCore::ResourceLoadObserver::isGrandfathered):
2687         (WebCore::ResourceLoadObserver::setMinimumTimeBetweeenDataRecordsRemoval):
2688         (WebCore::ResourceLoadObserver::setGrandfatheringTime):
2689             Functions for testing and configuration.
2690             ResourceLoadObserver::setMinimumTimeBetweeenDataRecordsRemoval() changed as a result of moving
2691             WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval() here.
2692         * loader/ResourceLoadObserver.h:
2693         * loader/ResourceLoadStatisticsStore.cpp:
2694         (WebCore::ResourceLoadStatisticsStore::createEncoderFromData):
2695         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
2696             Now contains endOfGrandfatheringTimestamp.
2697         (WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent):
2698             Now makes a call to m_grandfatherExistingWebsiteDataHandler().
2699         (WebCore::ResourceLoadStatisticsStore::setGrandfatherExistingWebsiteDataCallback):
2700         (WebCore::ResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval):
2701             Changed as a result of moving
2702             WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval() here.
2703         (WebCore::ResourceLoadStatisticsStore::setGrandfatheringTime):
2704         (WebCore::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
2705             Renamed since it now also takes grandfathering into account.
2706         (WebCore::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords):
2707             Fixed typo in local variable name.
2708         (WebCore::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore):
2709         (WebCore::ResourceLoadStatisticsStore::shouldRemoveDataRecords):
2710             Convenience function added.
2711         (WebCore::ResourceLoadStatisticsStore::dataRecordsBeingRemoved):
2712             Convenience function added.
2713         (WebCore::ResourceLoadStatisticsStore::dataRecordsWereRemoved):
2714             Convenience function added.
2715         (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction): Deleted.
2716             Replaced by ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor().
2717         * loader/ResourceLoadStatisticsStore.h:
2718
2719 2017-05-18  Daniel Bates  <dabates@apple.com>
2720
2721         Bindings: Require value for extended attributes EnabledAtRuntime and EnabledForWorld
2722         https://bugs.webkit.org/show_bug.cgi?id=172252
2723
2724         Reviewed by Sam Weinig.
2725
2726         According to Sam Weinig it is an anti-feature that EnabledAtRuntime can be specified
2727         without a value. We should make it require a value for the name of the RuntimeEnabledFeatures
2728         function to use in the generated code. For similar reasons we should also require
2729         a value for the extended attribute EnabledForWorld.
2730
2731         * Modules/websockets/WebSocket.idl: Substitute EnabledAtRuntime=WebSocket for EnabledAtRuntime.
2732         * bindings/scripts/CodeGeneratorJS.pm:
2733         (GetRuntimeEnableFunctionName):
2734         * html/HTMLAudioElement.idl: Substitute EnabledAtRuntime=Audio for EnabledAtRuntime.
2735         * page/RuntimeEnabledFeatures.cpp:
2736         (WebCore::RuntimeEnabledFeatures::audioEnabled):
2737         (WebCore::RuntimeEnabledFeatures::htmlAudioElementEnabled): Deleted. This function duplicated
2738         the functionality of RuntimeEnabledFeatures::audioEnabled(). Instead we explicitly
2739         write EnabledAtRuntime=Audio in HTMLAudioElement.idl to use RuntimeEnabledFeatures::audioEnabled()
2740         to determine whether to expose/conceal the HTMLAudioElement global constructor at runtime.
2741         * page/RuntimeEnabledFeatures.h:
2742
2743 2017-05-18  Jer Noble  <jer.noble@apple.com>
2744
2745         Allow nested timers to propagate user gestures so long as the total nested interval is less than 1s.
2746         https://bugs.webkit.org/show_bug.cgi?id=172173
2747
2748         Reviewed by Andy Estes.
2749
2750         Test: media/restricted-audio-playback-with-multiple-settimeouts.html
2751
2752         Store the current nested timer interval in DOMTimerFireState, and use that value to propagate the
2753         nested interval through multiple invocations of setTimeout().
2754
2755         Drive-by fix: instead of manually resetting the nesting level in DOMTimer::fired(), add the
2756         nesting level to the DOMTimerFireState, and reset the nesting level on the state's destruction.
2757         This fixes one place in DOMTimer::fire() where an early return lead to the timer's nesting level
2758         not being reset.
2759
2760         * page/DOMTimer.cpp:
2761         (WebCore::DOMTimerFireState::DOMTimerFireState):
2762         (WebCore::DOMTimerFireState::~DOMTimerFireState):
2763         (WebCore::DOMTimerFireState::nestedTimerInterval):
2764         (WebCore::shouldForwardUserGesture):
2765         (WebCore::userGestureTokenToForward):
2766         (WebCore::currentNestedTimerInterval):
2767         (WebCore::DOMTimer::DOMTimer):
2768         (WebCore::DOMTimer::fired):
2769         * page/DOMTimer.h:
2770
2771 2017-05-18  Youenn Fablet  <youenn@apple.com>
2772
2773         RealtimeOutgoingAudioSource should use the source sample rate
2774         https://bugs.webkit.org/show_bug.cgi?id=172297
2775
2776         Reviewed by Eric Carlson.
2777
2778         Covered by manual tests.
2779
2780         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
2781         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable): Using the audio source sample rate so that the converter does the right conversion.
2782
2783 2017-05-18  Andy Estes  <aestes@apple.com>
2784
2785         Add "countryCode" to ApplePayErrorContactField
2786         https://bugs.webkit.org/show_bug.cgi?id=172264
2787         <rdar://problem/32004909>
2788
2789         Reviewed by Anders Carlsson.
2790
2791         Added ApplePayError tests to http/tests/ssl/applepay/ApplePaySession.html
2792
2793         * Modules/applepay/ApplePayError.idl:
2794         * Modules/applepay/PaymentRequest.h:
2795
2796 2017-05-18  Daniel Bates  <dabates@apple.com>
2797
2798         Cleanup: Remove unnecessary call to AddToImplIncludes("RuntimeEnabledFeatures.h") in GenerateImplementation()
2799         https://bugs.webkit.org/show_bug.cgi?id=172236
2800
2801         Reviewed by Chris Dumez.
2802
2803         It is unnecessary for GenerateImplementation() to explicitly call AddToImplIncludes("RuntimeEnabledFeatures.h")
2804         to add the header RuntimeEnabledFeatures.h to the list of headers in the generated implementation
2805         as this header is added when GetRuntimeEnableFunctionName() is called. And GenerateImplementation()
2806         calls GetRuntimeEnableFunctionName().
2807
2808         No functionality changed. So, no new tests.
2809
2810         * bindings/scripts/CodeGeneratorJS.pm:
2811         (GenerateImplementation):
2812
2813 2017-05-18  Daniel Bates  <dabates@apple.com>
2814
2815         REGRESSION (r209608): Cross-origin plugin document opened in child window blocked by parent
2816         window CSP when object-src 'none' is set
2817         https://bugs.webkit.org/show_bug.cgi?id=172038
2818         <rdar://problem/32258262>
2819
2820         Reviewed by Andy Estes.
2821
2822         Fixes an issue where a cross-origin plugin document opened in a child window would inherit
2823         the Content Security Policy (CSP) of its opener. In particular, a cross-origin plugin
2824         document opened in a child window would be blocked when the CSP of its opener disallows
2825         plugins (e.g. object-source 'none').
2826
2827         Prior to r209608 a document opened in a child window never inherited the CSP from its opener
2828         and a plugin document loaded in a subframe would unconditionally inherit the CSP from its
2829         parent frame. So, a plugin document opened in a child window would be allowed to load
2830         regardless of whether its opener had a CSP that prevented plugins. Following r209608 a
2831         document opened in a child window would inherit its CSP from its opener if and only if it
2832         would inherit the security origin from its opener (e.g. about:blank) or was a plugin
2833         document. The latter condition makes plugin documents opened in a child window unconditionally
2834         inherit the CSP from their opener and is the cause of this bug. It seems reasonable to exempt
2835         cross-origin plugin documents opened in a child window from the CSP inheritance rule because
2836         such documents cannot compromise the origin of their opener. Same-origin plugin documents
2837         opened in a child window will continue to inherit the CSP from their opener because such
2838         documents can compromise the origin of their opener.
2839
2840         Tests: http/tests/security/contentSecurityPolicy/cross-origin-plugin-document-allowed-in-child-window.html
2841                http/tests/security/contentSecurityPolicy/plugin-blocked-in-about-blank-window.html
2842                http/tests/security/contentSecurityPolicy/same-origin-plugin-document-blocked-in-child-window.html
2843
2844         * dom/Document.cpp:
2845         (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner): Added.
2846         (WebCore::Document::initContentSecurityPolicy):
2847         * dom/Document.h:
2848
2849 2017-05-18  Keith Miller  <keith_miller@apple.com>
2850
2851         WebAssembly API: test with neutered inputs
2852         https://bugs.webkit.org/show_bug.cgi?id=163899
2853
2854         Reviewed by JF Bastien.
2855
2856         Make it not possible to transfer an ArrayBuffer that is backed by a
2857         wasm memory.
2858
2859         Test: workers/wasm-mem-post-message.html
2860
2861         * bindings/js/SerializedScriptValue.cpp:
2862         (WebCore::SerializedScriptValue::create):
2863
2864 2017-05-18  Commit Queue  <commit-queue@webkit.org>
2865
2866         Unreviewed, rolling out r217031, r217032, and r217037.
2867         https://bugs.webkit.org/show_bug.cgi?id=172293
2868
2869         cause linking errors in Windows (Requested by yusukesuzuki on
2870         #webkit).
2871
2872         Reverted changesets:
2873
2874         "[JSC][DFG][DOMJIT] Extend CheckDOM to CheckSubClass"
2875         https://bugs.webkit.org/show_bug.cgi?id=172098
2876         http://trac.webkit.org/changeset/217031
2877
2878         "Unreviewed, rebaseline for newly added ClassInfo"
2879         https://bugs.webkit.org/show_bug.cgi?id=172098
2880         http://trac.webkit.org/changeset/217032
2881
2882         "Unreviewed, fix debug and non-JIT build"
2883         https://bugs.webkit.org/show_bug.cgi?id=172098
2884         http://trac.webkit.org/changeset/217037
2885
2886 2017-05-18  Per Arne Vollan  <pvollan@apple.com>
2887
2888         Protect MediaDeviceRequest instance during context destruction.
2889         https://bugs.webkit.org/show_bug.cgi?id=172285
2890         <rdar://problem/30369017>
2891
2892         Reviewed by Brent Fulgham.
2893
2894         In MediaDevicesRequest::contextDestroyed(), the call to m_enumerationRequest->cancel() might
2895         end up deleting itself (MediaDevicesRequest). The std::function member m_completionHandler
2896         in MediaDevicesEnumerationRequest contains a captured variable of type
2897         RefPtr<MediaDevicesRequest>. When m_completionHandler is set to null in the cancel() method,
2898         the MediaDevicesRequest object will be deleted if the m_completionHandler member is holding
2899         the last reference.
2900
2901         No new tests, since I am unable to reproduce.
2902
2903         * Modules/mediastream/MediaDevicesRequest.cpp:
2904         (WebCore::MediaDevicesRequest::contextDestroyed):
2905
2906 2017-05-18  Antti Koivisto  <antti@apple.com>
2907
2908         Design mode should not affect UA shadow trees
2909         https://bugs.webkit.org/show_bug.cgi?id=171854
2910         <rdar://problem/32071037>
2911
2912         Reviewed by Zalan Bujtas.
2913
2914         Test: editing/deleting/search-shadow-tree-delete.html
2915
2916         * html/HTMLElement.cpp:
2917         (WebCore::HTMLElement::editabilityFromContentEditableAttr):
2918
2919             Ignore design mode for UA shadow trees.
2920
2921         * html/SearchInputType.cpp:
2922         (WebCore::SearchInputType::~SearchInputType):
2923         (WebCore::SearchInputType::createShadowSubtree):
2924         (WebCore::SearchInputType::resultsButtonElement):
2925         (WebCore::SearchInputType::cancelButtonElement):
2926         * html/SearchInputType.h:
2927
2928             Use RefPtr.
2929
2930 2017-05-18  Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
2931
2932         [GTK][GStreamer][MSE] Crash on youtube when MSE is enabled but gstreamer cant find the decoder element.
2933         https://bugs.webkit.org/show_bug.cgi?id=167120
2934
2935         Reviewed by Žan Doberšek.
2936
2937         This is because supportCodecs() doesn't check in runtime which plugins the player has.
2938         So, a static function which returns a map with the plugins has been created. That map is later
2939         used in the supportsCodecs() method to check if the requested codec matches any of the map.
2940
2941         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2942         (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements):
2943         The declaration is moved into this class.
2944         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2945         (WebCore::MediaPlayerPrivateGStreamer::isAvailable): This function calls the implementation of
2946         initializeGstreamerAndRegisterWebKitElements function.
2947         (WebCore::MediaPlayerPrivateGStreamer::load): Ditto
2948         (WebCore::mimeTypeSet): Ditto
2949         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: It is static type to expose
2950         initializeGStreamerAndRegisterWebKitElements() function to be called from internal function
2951         "which runs before MediaPlayerPrivateGStreamerBase initialization but needs to have GStreamer initialized".
2952         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2953         (WebCore::codecSet): It returns a map with the plugins has been created.
2954         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsCodecs): To check if the requested codec
2955         matches any of the map from codecSet().
2956
2957 2017-05-18  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2958
2959         [Readable Streams API] Align getDesiredSize with spec
2960         https://bugs.webkit.org/show_bug.cgi?id=172220
2961
2962         Reviewed by Chris Dumez.
2963
2964         Aligned implementation of getDesiredSize operation for both controllers:
2965         - https://streams.spec.whatwg.org/#readable-stream-default-controller-get-desired-size
2966         - https://streams.spec.whatwg.org/#readable-byte-stream-controller-get-desired-size
2967
2968         Implementation slightly differs from spec as queueTotalSize refactoring is not
2969         yet implemented, but behavior is now similar.
2970
2971         No new tests (already covered by WPT tests, corresponding expectations have been updated).
2972
2973         * Modules/streams/ReadableByteStreamInternals.js:
2974         (readableByteStreamControllerGetDesiredSize): Updated.
2975         * Modules/streams/ReadableStreamInternals.js:
2976         (readableStreamDefaultControllerGetDesiredSize): Updated.
2977
2978 2017-05-18  Tim Horton  <timothy_horton@apple.com>
2979
2980         More WebKit2 header cleanup
2981         https://bugs.webkit.org/show_bug.cgi?id=172214
2982
2983         Reviewed by Simon Fraser.
2984
2985         * Modules/mediastream/UserMediaController.cpp:
2986         * Modules/mediastream/UserMediaController.h:
2987
2988 2017-05-16  Yusuke Suzuki  <utatane.tea@gmail.com>
2989
2990         [JSC][DFG][DOMJIT] Extend CheckDOM to CheckSubClass
2991         https://bugs.webkit.org/show_bug.cgi?id=172098
2992
2993         Reviewed by Saam Barati.
2994
2995         Add DOMJIT interface IDL attribute. Which allows us to define checkSubClassPatchpoint function
2996         for that ClassInfo. And we move CheckSubClass patchpoint implementation to ClassInfo's member.
2997
2998         * CMakeLists.txt:
2999         * WebCore.xcodeproj/project.pbxproj:
3000         * bindings/js/JSDOMGlobalObject.cpp:
3001         * bindings/js/JSDOMWindowBase.cpp:
3002         * bindings/js/JSDOMWindowProperties.cpp:
3003         * bindings/js/JSDOMWindowShell.cpp:
3004         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
3005         * bindings/js/JSWorkerGlobalScopeBase.cpp:
3006         * bindings/scripts/CodeGeneratorJS.pm:
3007         (GenerateHeader):
3008         (GenerateImplementation):
3009         (GenerateImplementationIterableFunctions):
3010         (GenerateConstructorHelperMethods):
3011         * bindings/scripts/IDLAttributes.json:
3012         * bindings/scripts/test/JS/JSInterfaceName.cpp:
3013         * bindings/scripts/test/JS/JSMapLike.cpp:
3014         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
3015         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
3016         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
3017         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
3018         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
3019         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
3020         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
3021         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
3022         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
3023         * bindings/scripts/test/JS/JSTestDOMJIT.h:
3024         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
3025         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
3026         * bindings/scripts/test/JS/JSTestException.cpp:
3027         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
3028         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
3029         * bindings/scripts/test/JS/JSTestInterface.cpp:
3030         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
3031         * bindings/scripts/test/JS/JSTestIterable.cpp:
3032         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
3033         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
3034         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
3035         * bindings/scripts/test/JS/JSTestNode.cpp:
3036         * bindings/scripts/test/JS/JSTestObj.cpp:
3037         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
3038         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
3039         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
3040         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
3041         * bindings/scripts/test/JS/JSTestSerialization.cpp:
3042         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
3043         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
3044         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
3045         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3046         * bridge/c/CRuntimeObject.cpp:
3047         * bridge/c/c_instance.cpp:
3048         * bridge/objc/ObjCRuntimeObject.mm:
3049         * bridge/objc/objc_instance.mm:
3050         * bridge/objc/objc_runtime.mm:
3051         * bridge/runtime_array.cpp:
3052         * bridge/runtime_method.cpp:
3053         * bridge/runtime_object.cpp:
3054         * dom/Document.idl:
3055         * dom/DocumentFragment.idl:
3056         * dom/Element.idl:
3057         * dom/Event.idl:
3058         * dom/Node.idl:
3059         * domjit/JSDocumentDOMJIT.cpp:
3060         (WebCore::JSDocument::checkSubClassPatchpoint):
3061         (WebCore::DocumentDocumentElementDOMJIT::checkDOM): Deleted.
3062         (WebCore::DocumentBodyDOMJIT::checkDOM): Deleted.
3063         * domjit/JSDocumentFragmentDOMJIT.cpp: Copied from Source/JavaScriptCore/runtime/JSMap.cpp.
3064         (WebCore::JSDocumentFragment::checkSubClassPatchpoint):
3065         * domjit/JSElementDOMJIT.cpp: Copied from Source/JavaScriptCore/tools/JSDollarVM.cpp.
3066         (WebCore::JSElement::checkSubClassPatchpoint):
3067         * domjit/JSEventDOMJIT.cpp: Copied from Source/JavaScriptCore/tools/JSDollarVM.cpp.
3068         (WebCore::JSEvent::checkSubClassPatchpoint):
3069         * domjit/JSNodeDOMJIT.cpp:
3070         (WebCore::JSNode::checkSubClassPatchpoint):
3071         (WebCore::NodeFirstChildDOMJIT::checkDOM): Deleted.
3072         (WebCore::NodeLastChildDOMJIT::checkDOM): Deleted.
3073         (WebCore::NodeNextSiblingDOMJIT::checkDOM): Deleted.
3074         (WebCore::NodePreviousSiblingDOMJIT::checkDOM): Deleted.
3075         (WebCore::NodeParentNodeDOMJIT::checkDOM): Deleted.
3076         (WebCore::NodeNodeTypeDOMJIT::checkDOM): Deleted.
3077         (WebCore::NodeOwnerDocumentDOMJIT::checkDOM): Deleted.
3078
3079 2017-05-17  Youenn Fablet  <youenn@apple.com>
3080
3081         r216999 broke win build
3082         https://bugs.webkit.org/show_bug.cgi?id=172257
3083
3084         Unreviewed.
3085
3086         * testing/Internals.cpp:
3087         (WebCore::Internals::setPageVisibility): Moving setPageVisibility out of MEDIA_STREAM compilation flag.
3088
3089 2017-05-17  Andy Estes  <aestes@apple.com>
3090
3091         [Cocoa] errors are not propagated to PassKit when calling ApplePaySession.completePayment()
3092         https://bugs.webkit.org/show_bug.cgi?id=172253
3093         <rdar://problem/32258020>
3094
3095         Reviewed by Dan Bernstein.
3096
3097         In ApplePaySession::completePayment(), releaseReturnValue() was being called twice on the
3098         same convertedResult. Since the first call moved the errors vector out of convertedResult,
3099         the vector is empty in the second call. It's the second call that sends the result to the
3100         UI process, so we end up with an empty arary when we call PassKit's delegate completion
3101         handler.
3102
3103         * Modules/applepay/ApplePaySession.cpp:
3104         (WebCore::ApplePaySession::completePayment):
3105
3106 2017-05-17  Ryan Haddad  <ryanhaddad@apple.com>
3107
3108         Unreviewed, rolling out r217014.
3109
3110         This change caused mac-wk2 LayoutTests to exit early due to
3111         crashes.
3112
3113         Reverted changeset:
3114
3115         "Resource Load Statistics: Grandfather domains for existing
3116         data records"
3117         https://bugs.webkit.org/show_bug.cgi?id=172155
3118         http://trac.webkit.org/changeset/217014
3119
3120 2017-05-17  Zalan Bujtas  <zalan@apple.com>
3121
3122         Tighten TextIterator::handleTextNode run-renderer mapping logic.
3123         https://bugs.webkit.org/show_bug.cgi?id=172174
3124
3125         Reviewed by Antti Koivisto.
3126
3127         This patch ensure that when runs and renderers are getting out of sync
3128         we don't run into problems like webkit.org/b/172113 (where we end up
3129         using incorrect content start/end positions).
3130
3131         * editing/TextIterator.cpp:
3132         (WebCore::TextIterator::handleTextNode):
3133
3134 2017-05-17  John Wilander  <wilander@apple.com>
3135
3136         Resource Load Statistics: Grandfather domains for existing data records
3137         https://bugs.webkit.org/show_bug.cgi?id=172155
3138         <rdar://problem/24913532>
3139
3140         Reviewed by Alex Christensen.
3141
3142         Test: http/tests/loading/resourceLoadStatistics/grandfathering.html
3143
3144         * loader/ResourceLoadObserver.cpp:
3145         (WebCore::ResourceLoadObserver::setGrandfathered):
3146         (WebCore::ResourceLoadObserver::isGrandfathered):
3147         (WebCore::ResourceLoadObserver::setMinimumTimeBetweeenDataRecordsRemoval):
3148         (WebCore::ResourceLoadObserver::setGrandfatheringTime):
3149             Functions for testing and configuration.
3150             ResourceLoadObserver::setMinimumTimeBetweeenDataRecordsRemoval() changed as a result of moving
3151             WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval() here.
3152         * loader/ResourceLoadObserver.h:
3153         * loader/ResourceLoadStatisticsStore.cpp:
3154         (WebCore::ResourceLoadStatisticsStore::createEncoderFromData):
3155         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
3156             Now contains endOfGrandfatheringTimestamp.
3157         (WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent):
3158             Now makes a call to m_grandfatherExistingWebsiteDataHandler().
3159         (WebCore::ResourceLoadStatisticsStore::setGrandfatherExistingWebsiteDataCallback):
3160         (WebCore::ResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval):
3161             Changed as a result of moving
3162             WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval() here.
3163         (WebCore::ResourceLoadStatisticsStore::setGrandfatheringTime):
3164         (WebCore::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
3165             Renamed since it now also takes grandfathering into account.
3166         (WebCore::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords):
3167             Fixed typo in local variable name.
3168         (WebCore::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore):
3169         (WebCore::ResourceLoadStatisticsStore::shouldRemoveDataRecords):
3170             Convenience function added.
3171         (WebCore::ResourceLoadStatisticsStore::dataRecordsBeingRemoved):
3172             Convenience function added.
3173         (WebCore::ResourceLoadStatisticsStore::dataRecordsWereRemoved):
3174             Convenience function added.
3175         (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction): Deleted.
3176             Replaced by ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor().
3177         * loader/ResourceLoadStatisticsStore.h:
3178
3179 2017-05-17  Zalan Bujtas  <zalan@apple.com>
3180
3181         Debug ASSERT: WebCore::RenderImageResource::shutdown
3182         https://bugs.webkit.org/show_bug.cgi?id=172238
3183         <rdar://problem/30064601>
3184
3185         Reviewed by Simon Fraser.
3186
3187         While constructing new renderers, as part of the render tree update, we check if the insertion point is valid for them. 
3188         When this newly constructed child renderer can't be injected to a specific place, we destroy it right away.
3189         This assert was added with the assumption that the image resource object gets initialized
3190         (through RenderObject::initializeStyle) even when the renderer turns out to be invalid.
3191
3192         Test: fast/images/assert-when-insertion-point-is-incorrect.html
3193
3194         * rendering/RenderImageResource.cpp:
3195         (WebCore::RenderImageResource::RenderImageResource):
3196         (WebCore::RenderImageResource::shutdown):
3197         * rendering/RenderImageResource.h:
3198
3199 2017-05-17  Per Arne Vollan  <pvollan@apple.com>
3200
3201         Crash under WebCore::AudioSourceProviderAVFObjC::process().
3202         https://bugs.webkit.org/show_bug.cgi?id=172101
3203         rdar://problem/27446589
3204
3205         Reviewed by Jer Noble.
3206
3207         Calling the function MTAudioProcessingTapGetSourceAudio when the value of the
3208         MTAudioProcessingTapRef parameter is null, will lead to a null dereference.
3209         This can for example happen if MediaPlayerPrivateAVFoundationObjC::cancelLoad()
3210         is called on the main thread while MediaToolbox is calling the
3211         WebCore::AudioSourceProviderAVFObjC::processCallback function on a secondary
3212         thread. MediaPlayerPrivateAVFoundationObjC::cancelLoad() will then call
3213         AudioSourceProviderAVFObjC::setPlayerItem(nullptr), which will call
3214         AudioSourceProviderAVFObjC::destroyMix(), which will set m_tap to null. When
3215         AudioSourceProviderAVFObjC::process is called on the secondary thread, using
3216         the m_tap member in the call to MTAudioProcessingTapGetSourceAudio, the process
3217         will crash.
3218
3219         No new tests since I am not able to reproduce.
3220
3221         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
3222         (WebCore::AudioSourceProviderAVFObjC::initCallback):
3223         (WebCore::AudioSourceProviderAVFObjC::process):
3224
3225 2017-05-17  Chris Dumez  <cdumez@apple.com>
3226
3227         Setting URL.search to '' results in a stringified URL ending in '?'
3228         https://bugs.webkit.org/show_bug.cgi?id=162345
3229         <rdar://problem/31800441>
3230
3231         Reviewed by Alex Christensen.
3232
3233         As per the specification for the URL.search setter [1], if the given value is
3234         the empty string, then we should set the URL's query to null. We would
3235         previously set the URL's query to the empty string in this case. This aligns
3236         our behavior with Firefox and Chrome.
3237
3238         [1] https://url.spec.whatwg.org/#dom-url-search
3239
3240         No new tests, updated existing tests.
3241
3242         * html/URLUtils.h:
3243         (WebCore::URLUtils<T>::setSearch):
3244
3245 2017-05-17  Eric Carlson  <eric.carlson@apple.com>
3246
3247         [MediaStream] videoWidth and videoHeight should be set when 'loadedmetadata' event fires
3248         https://bugs.webkit.org/show_bug.cgi?id=172223
3249         <rdar://problem/31899755>
3250
3251         Reviewed by Jer Noble.
3252
3253         Test: fast/mediastream/get-user-media-on-loadedmetadata.html
3254
3255         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3256         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentReadyState): If a stream has
3257         a video track, return HaveNothing until we have a sample.
3258        
3259         * platform/mediastream/RealtimeMediaSource.h:
3260         * platform/mock/MockRealtimeAudioSource.cpp:
3261         (WebCore::MockRealtimeAudioSource::tick): Optionally delay the next sample.
3262         (WebCore::MockRealtimeAudioSource::delaySamples):
3263         * platform/mock/MockRealtimeAudioSource.h:
3264
3265         * platform/mock/MockRealtimeVideoSource.cpp:
3266         (WebCore::MockRealtimeVideoSource::delaySamples):
3267         (WebCore::MockRealtimeVideoSource::generateFrame): Optionally delay the next sample.
3268         * platform/mock/MockRealtimeVideoSource.h:
3269
3270         * testing/Internals.cpp:
3271         (WebCore::Internals::delayMediaStreamTrackSamples):
3272         * testing/Internals.h:
3273         * testing/Internals.idl:
3274
3275 2017-05-17  Youenn Fablet  <youenn@apple.com>
3276
3277         iOS WebRTC Media Capture should not allow camera capture from background tab
3278         https://bugs.webkit.org/show_bug.cgi?id=172200
3279
3280         Reviewed by Eric Carlson.
3281
3282         Test: platform/ios/mediastream/getUserMedia-disabled-in-background-tabs.html and manual tests.
3283
3284         Making Video Capture Factory aware of Document visibility changes.
3285         On iOS, muting/unmuting the current video source according Document visibility.
3286         Not using Document visibility change observer as factories are platform and cannot implement
3287         the visibility observer interface without moving the visibility observer interface.
3288
3289         Introducing internals API to switch on/off the page visibility.
3290
3291         * dom/Document.cpp:
3292         (WebCore::Document::visibilityStateChanged):
3293         (WebCore::Document::notifyVisibilityChangedToMediaCapture):
3294         * dom/Document.h:
3295         * platform/mediastream/RealtimeMediaSource.h:
3296         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
3297         (WebCore::RealtimeMediaSourceCenter::setVisibility):
3298         * platform/mediastream/RealtimeMediaSourceCenter.h:
3299         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3300         (WebCore::AVVideoCaptureSourceFactory::setVisibility):
3301         * testing/Internals.cpp:
3302         (WebCore::Internals::setPageVisibility):
3303         * testing/Internals.h:
3304         * testing/Internals.idl:
3305
3306 2017-05-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
3307
3308         When the image decoding thread makes a callOnMainThread(), ensure all the objects it needs are protected
3309         https://bugs.webkit.org/show_bug.cgi?id=171614
3310
3311         Reviewed by David Kilzer.
3312
3313         The asynchronous image decoding was designed to not block the main thread if
3314         the image is deleted. To achieve that we allow decoding the current frame
3315         even if it is not going to be used after closing the decoding queue. We 
3316         protect all the objects which the decoding thread uses. But when a frame
3317         finishes decoding the native image frame is cached on the main thread. Not
3318         all of the objects are protected when the callOnMainThread() is dispatched.
3319         The ImageFrameCache and the ImageDecoder objects are not protected.
3320
3321         This might lead to two kinds of crashes:
3322         1. A segfault inside the ImageDecoder trying to access one of its member
3323         2. A segfault inside the ImageFrameCache trying to access one of its frames
3324
3325         The fix is to protect the ImageFrameCache and the ImageDecoder when the
3326         decoding thread makes a callOnMainThread(). Also switch all the pointers
3327         the decoding threads protect to be ThreadSafeRefCounted.
3328
3329         * platform/graphics/ImageFrameCache.cpp:
3330         (WebCore::ImageFrameCache::startAsyncDecodingQueue):
3331         * platform/graphics/ImageFrameCache.h:
3332         * platform/graphics/cg/ImageDecoderCG.h:
3333         * platform/graphics/win/ImageDecoderDirect2D.h:
3334         * platform/image-decoders/ImageDecoder.h:
3335
3336 2017-05-17  Wenson Hsieh  <wenson_hsieh@apple.com>
3337
3338         A URL type is vended for a non-URL plain text string when starting data interaction
3339         https://bugs.webkit.org/show_bug.cgi?id=172228
3340         <rdar://problem/32166729>
3341
3342         Reviewed by Andy Estes.
3343
3344         Previously, when writing a plain text string to WebItemProviderPasteboard, we would write an NSString directly
3345         to the item provider by using built-in functionality in NSString+UIItemProvider. However, this causes plain
3346         strings such as "apple" to be considered URLs, since -[NSURL URLWithString:] creates a non-null NSURL. To fix
3347         this, we instead write the string as UTF8 data, for the UTI kUTTypeUTF8PlainText, if the plain text is not a
3348         URL. If the plain text is clearly a URL (determined by constructing a new WebCore URL with no base URL and the
3349         plaintext string as the absolute URL) then we additionally write an NSURL to the pasteboard.
3350
3351         2 new API tests:
3352         DataInteractionTests.SinglePlainTextWordTypeIdentifiers
3353         DataInteractionTests.SinglePlainTextURLTypeIdentifiers
3354
3355         * platform/ios/PlatformPasteboardIOS.mm:
3356         (WebCore::addRepresentationsForPlainText):
3357         (WebCore::PlatformPasteboard::writeObjectRepresentations):
3358
3359 2017-05-15  Jiewen Tan  <jiewen_tan@apple.com>
3360
3361         Replace CryptoOperationData with BufferSource for WebKitSubtleCrypto
3362         https://bugs.webkit.org/show_bug.cgi?id=172146
3363         <rdar://problem/32122256>
3364
3365         Reviewed by Brent Fulgham.
3366
3367         In this patch, we replaces CryptoOperationData with BufferSource for WebKitSubtleCrypto in
3368         the custom binding codes.
3369
3370         Test: crypto/webkitSubtle/import-export-raw-key-leak.html
3371
3372         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
3373         (WebCore::JSWebKitSubtleCrypto::encrypt):
3374         (WebCore::JSWebKitSubtleCrypto::decrypt):
3375         (WebCore::JSWebKitSubtleCrypto::sign):
3376         (WebCore::JSWebKitSubtleCrypto::verify):
3377         (WebCore::JSWebKitSubtleCrypto::digest):
3378         (WebCore::JSWebKitSubtleCrypto::importKey):
3379     &n