No audio output for MediaStream-backed audio elements on iOS
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-04-03  Jer Noble  <jer.noble@apple.com>
2
3         No audio output for MediaStream-backed audio elements on iOS
4         https://bugs.webkit.org/show_bug.cgi?id=170427
5
6         Reviewed by Eric Carlson.
7
8         The logic for setting the output timestamp offset in AudioSampleDataSource was reversed; instead of
9         subtracting out the timestamp of the first pull request, it effectively doubled it.
10
11         * platform/audio/mac/AudioSampleDataSource.mm:
12         (WebCore::AudioSampleDataSource::pullSamplesInternal):
13
14 2017-04-03  Dave Hyatt  <hyatt@apple.com>
15
16         Japanese fonts in vertical text should support synthesized italics
17         https://bugs.webkit.org/show_bug.cgi?id=169301
18
19         Reviewed by Simon Fraser.
20
21         Updated test in fast/text/international.
22
23         * platform/graphics/Font.cpp:
24         (WebCore::Font::nonSyntheticItalicFont): Deleted.
25         * platform/graphics/Font.h:
26         Removed the non-synthetic italic font member, since it's not used.
27
28         * platform/graphics/FontCascadeFonts.cpp:
29         (WebCore::glyphDataForNonCJKCharacterWithGlyphOrientation):
30         Patched to ensure that a text-orientation-fallback font data is always
31         returned in the synthetic oblique case, so that non-CJK and CJK are
32         guaranteed to be broken up so that their slants can be applied differently.
33
34         (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
35         (WebCore::FontCascadeFonts::glyphDataForNormalVariant):
36         (WebCore::glyphDataForCJKCharacterWithoutSyntheticItalic): Deleted.
37         Patched to no longer turn off synthetic oblique for CJK.
38
39         * platform/graphics/cocoa/FontCascadeCocoa.mm:
40         (WebCore::FontCascade::drawGlyphs):
41         Apply the correct italic transform to CJK when in vertical text.
42
43 2017-04-03  Chris Dumez  <cdumez@apple.com>
44
45         REGRESSION (r206744): CSS background-image in style attribute ignored when using createHTMLDocument method of DOM parsing
46         https://bugs.webkit.org/show_bug.cgi?id=170285
47         <rdar://problem/31378543>
48
49         Reviewed by Andy Estes.
50
51         r206744 caused up to stop trying to resolve relative URLs when trying to load an image
52         referred to by CSS. We already try to resolve the relative URL when parsing the CSS
53         property so this will usually work fine. However, in the case when the CSS property
54         is parsed in detached document and then moved to another document, we will not have
55         the complete URL.
56
57         Test: fast/images/background-image-relative-url-changes-document.html
58
59         * css/CSSImageValue.cpp:
60         (WebCore::CSSImageValue::loadImage):
61
62 2017-04-03  Jeremy Jones  <jeremyj@apple.com>
63
64         Do not set WebAVPlayerLayerView background to black in fullscreen.
65         https://bugs.webkit.org/show_bug.cgi?id=170132
66         rdar://problem/30839278
67
68         Reviewed by Tim Horton.
69
70         No new tests because no behavior change.
71
72         The black background on WebAVPlayerLayerView interferes with the fullscreen animation
73         and has been removed.
74
75         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
76         (WebVideoFullscreenInterfaceAVKit::enterFullscreen):
77         (WebVideoFullscreenInterfaceAVKit::enterFullscreenStandard):
78
79 2017-04-03  Antti Koivisto  <antti@apple.com>
80
81         REGRESSION (r207669): FileMaker Pro Help pages do not render correctly
82         https://bugs.webkit.org/show_bug.cgi?id=170402
83         <rdar://problem/31004344>
84
85         Reviewed by Simon Fraser.
86
87         If a new stylesheet load is started from the load event the document.styleSheets does not
88         always reflect the already loaded stylesheets.
89
90         Test: fast/css/document-stylesheets-dynamic.html
91
92         * style/StyleScope.cpp:
93         (WebCore::Style::Scope::updateActiveStyleSheets):
94
95             Remove an old optimization where we would not update active stylesheets if there were pending
96             (head) stylesheet loads and they had not been updated already.
97             This is probably not a valuable optimization anymore with the new lazy stylesheet update strategy.
98
99         * style/StyleScope.h:
100
101 2017-04-03  Anders Carlsson  <andersca@apple.com>
102
103         Tweak ApplePaySession API
104         https://bugs.webkit.org/show_bug.cgi?id=170409
105         rdar://problem/31405459
106
107         Reviewed by Tim Horton.
108
109         Rename "address" to "addressLines". Add "postalAddress". Reorder the ApplePayError constructor parameters.
110
111         * Modules/applepay/ApplePayError.cpp:
112         (WebCore::ApplePayError::create):
113         (WebCore::ApplePayError::ApplePayError):
114         * Modules/applepay/ApplePayError.h:
115         * Modules/applepay/ApplePayError.idl:
116         * Modules/applepay/PaymentRequest.h:
117
118 2017-04-03  Zan Dobersek  <zdobersek@igalia.com>
119
120         [GCrypt] Implement CryptoKeyEC::keySizeInBits(), ::platformGeneratePair()
121         https://bugs.webkit.org/show_bug.cgi?id=170345
122
123         Reviewed by Michael Catanzaro.
124
125         Start implementing the libgcrypt-based platform bits of CryptoKeyEC.
126
127         Implement keySizeInBits() by returning the appropriate size for this
128         object's curve type. An assertion is added to ensure that this size
129         matches the one that's returned by gcry_pk_get_nbits() for this
130         object's EC key as represented by the m_platformKey gcry_sexp_t object.
131
132         Implement platformGeneratePair() by constructing a genkey s-expression
133         that requests a generation of an EC key for the specified curve type.
134         The s-expression is then passed to gcry_pk_genkey(), and the public
135         and private key data is then retrieved from the returned s-expression
136         upon success and used to create the public and private CryptoKeyEC
137         objects.
138
139         The PlatformECKey type alias is changed to match gcry_sexp_t. The
140         CryptoKeyEC destructor releases the gcry_sexp_t object through
141         a PAL::GCrypt::HandleDeleter<gcry_sexp_t> instance.
142
143         The method definitions in the CryptoKeyECGCrypt.cpp file are also
144         sorted to match the declaration order in the header.
145
146         No new tests -- current ones cover this sufficiently, but are not yet
147         enabled due to other missing platform-specific SUBTLE_CRYPTO
148         implementations.
149
150         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
151         (WebCore::curveSize):
152         (WebCore::curveName):
153         (WebCore::CryptoKeyEC::~CryptoKeyEC):
154         (WebCore::CryptoKeyEC::keySizeInBits):
155         (WebCore::CryptoKeyEC::platformGeneratePair):
156         (WebCore::CryptoKeyEC::platformImportSpki):
157         (WebCore::CryptoKeyEC::platformImportPkcs8):
158         (WebCore::CryptoKeyEC::platformExportRaw):
159         (WebCore::CryptoKeyEC::platformAddFieldElements):
160         (WebCore::CryptoKeyEC::platformExportSpki):
161         * crypto/keys/CryptoKeyEC.h:
162
163 2017-04-03  Zan Dobersek  <zdobersek@igalia.com>
164
165         [GCrypt] Implement AES_KW support
166         https://bugs.webkit.org/show_bug.cgi?id=170274
167
168         Reviewed by Michael Catanzaro.
169
170         Implement the CryptoAlgorithmAES_KW::platform{Wrap,Unwrap}Key()
171         functionality for configurations that use libgcrypt. This is done
172         by leveraging the gcry_cipher_* APIs for the AES algorithm that's
173         deducted appropriately from the key size and the AESWRAP cipher mode.
174
175         No new tests -- current ones cover this sufficiently, but are not yet
176         enabled due to other missing platform-specific SUBTLE_CRYPTO
177         implementations.
178
179         * crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:
180         (WebCore::gcryptWrapKey):
181         (WebCore::gcryptUnwrapKey):
182         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
183         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
184
185 2017-04-03  Zan Dobersek  <zdobersek@igalia.com>
186
187         [GCrypt] Implement AES_GCM support
188         https://bugs.webkit.org/show_bug.cgi?id=170271
189
190         Reviewed by Michael Catanzaro.
191
192         Implement the CryptoAlgorithmAES_GCM::platform{Encrypt,Decrypt}
193         functionality for configurations that use libgcrypt. This is done
194         by leveraging the gcry_cipher_* APIs for the AES algorithm that's
195         deducted appropriately from the key size and the GCM cipher mode.
196
197         No new tests -- current ones cover this sufficiently, but are not yet
198         enabled due to other missing platform-specific SUBTLE_CRYPTO
199         implementations.
200
201         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
202         (WebCore::gcryptEncrypt):
203         (WebCore::gcryptDecrypt):
204         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
205         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
206
207 2017-04-03  Zan Dobersek  <zdobersek@igalia.com>
208
209         [GCrypt] Implement PBKDF2 support
210         https://bugs.webkit.org/show_bug.cgi?id=170270
211
212         Reviewed by Michael Catanzaro.
213
214         Implement the CryptoAlgorithmPBKDF2::platformDeriveBits() functionality
215         for configurations that use libgcrypt. This is done by leveraging the
216         gcry_kdf_derive() API, using GCRY_KDF_PBKDF2 as the preferred KDF
217         along with the properly deducted SHA algorithm.
218
219         No new tests -- current ones cover this sufficiently, but are not yet
220         enabled due to other missing platform-specific SUBTLE_CRYPTO
221         implementations.
222
223         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
224         (WebCore::gcryptDeriveBits):
225         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
226
227 2017-04-01  Simon Fraser  <simon.fraser@apple.com>
228
229         Clean up touch event handler registration when moving nodes between documents
230         https://bugs.webkit.org/show_bug.cgi?id=170384
231         rdar://problem/30816694
232
233         Reviewed by Chris Dumez.
234
235         Make sure that Node::didMoveToNewDocument() does the correct unregistration on the
236         old document, and registration on the new document for nodes with touch event listeners,
237         and gesture event listeners. Touch "handler" nodes (those for overflow and sliders) are
238         already correctly moved via renderer-related teardown.
239
240         Add assertions that fire when removal was not complete.
241
242         Use references in more places.
243
244         Tests: fast/events/touch/ios/gesture-node-move-between-documents.html
245                fast/events/touch/ios/overflow-node-move-between-documents.html
246                fast/events/touch/ios/slider-node-move-between-documents.html
247                fast/events/touch/ios/touch-node-move-between-documents.html
248
249         * dom/EventNames.h:
250         (WebCore::EventNames::gestureEventNames):
251         * dom/Node.cpp:
252         (WebCore::Node::willBeDeletedFrom):
253         (WebCore::Node::didMoveToNewDocument):
254         (WebCore::tryAddEventListener):
255         (WebCore::tryRemoveEventListener):
256         * html/shadow/SliderThumbElement.cpp:
257         (WebCore::SliderThumbElement::registerForTouchEvents):
258         (WebCore::SliderThumbElement::unregisterForTouchEvents):
259         * rendering/RenderLayer.cpp:
260         (WebCore::RenderLayer::registerAsTouchEventListenerForScrolling):
261         (WebCore::RenderLayer::unregisterAsTouchEventListenerForScrolling):
262
263 2017-04-03  Youenn Fablet  <youenn@apple.com>
264
265         captureStream is getting black frames with webgl canvas
266         https://bugs.webkit.org/show_bug.cgi?id=170325
267
268         Reviewed by Dean Jackson.
269
270         Test: fast/mediastream/captureStream/canvas3d.html
271
272         Changing the webgl context to save buffers in case the canvas is captured.
273         Adding a canvas changed notification in case of clear.
274         In the future, we might want to change this notification and do it when endPaint or similar is called.
275
276         Adding an Internals API to grab the RGBA equivalent of the next track frame.
277         For that purpose, adding a bunch of WEBCORE_EXPORT.
278
279         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
280         (WebCore::CanvasCaptureMediaStreamTrack::Source::Source): Adding constraints support so that track settings
281         getter actually transmits the width and height of the source.
282         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged): ensuring webgl canvas context keep their drawing buffer.
283         * Modules/mediastream/MediaStreamTrack.h:
284         * bindings/js/JSDOMGuardedObject.h:
285         * bindings/js/JSDOMPromise.h:
286         (WebCore::DeferredPromise::resolve):
287         (WebCore::DeferredPromise::reject):
288         * dom/ActiveDOMCallback.h:
289         * html/HTMLCanvasElement.cpp:
290         (WebCore::HTMLCanvasElement::captureStream):
291         * html/ImageData.h:
292         * html/ImageData.idl:
293         * html/canvas/WebGLRenderingContext.cpp:
294         (WebCore::WebGLRenderingContext::clear): ensuring canvas observers get notified in case of clear calls.
295         * html/canvas/WebGLRenderingContextBase.h:
296         (WebCore::WebGLRenderingContextBase::preserveDrawingBuffer): Added to allow canvas capture to update this property.
297         * platform/MediaSample.h:
298         (WebCore::MediaSample::getRGBAImageData): Added for internals API.
299         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
300         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
301         (WebCore::MediaSampleAVFObjC::getRGBAImageData):
302         * platform/graphics/cv/PixelBufferConformerCV.cpp:
303         (WebCore::PixelBufferConformerCV::convert): Helper routine for getRGBAImageData.
304         * platform/graphics/cv/PixelBufferConformerCV.h:
305         * platform/mediastream/RealtimeMediaSourceSettings.h:
306         (WebCore::RealtimeMediaSourceSettings::setSupportedConstraints):
307         (WebCore::RealtimeMediaSourceSettings::setSupportedConstraits): Deleted.
308         * platform/mediastream/mac/AVMediaCaptureSource.mm:
309         (WebCore::AVMediaCaptureSource::initializeSettings):
310         * platform/mediastream/openwebrtc/RealtimeAudioSourceOwr.h:
311         * platform/mediastream/openwebrtc/RealtimeVideoSourceOwr.h:
312         * platform/mock/MockRealtimeMediaSource.cpp:
313         (WebCore::MockRealtimeMediaSource::initializeSettings):
314         * testing/Internals.cpp:
315         (WebCore::Internals::grabNextMediaStreamTrackFrame):
316         (WebCore::Internals::videoSampleAvailable):
317         * testing/Internals.h:
318         * testing/Internals.idl:
319
320 2017-04-03  Per Arne Vollan  <pvollan@apple.com>
321
322         Implement stroke-miterlimit.
323         https://bugs.webkit.org/show_bug.cgi?id=169078
324
325         Reviewed by Dean Jackson.
326
327         Support stroke-miterlimit for text rendering, see https://drafts.fxtf.org/paint/.
328
329         Tests: fast/css/stroke-miterlimit-default.html
330                fast/css/stroke-miterlimit-large.html
331                fast/css/stroke-miterlimit-zero.html
332
333         * css/CSSComputedStyleDeclaration.cpp:
334         (WebCore::ComputedStyleExtractor::propertyValue):
335         * css/CSSProperties.json:
336         * css/SVGCSSComputedStyleDeclaration.cpp:
337         (WebCore::ComputedStyleExtractor::svgPropertyValue):
338         * rendering/TextPaintStyle.cpp:
339         (WebCore::computeTextPaintStyle):
340         (WebCore::updateGraphicsContext):
341         * rendering/TextPaintStyle.h:
342         * rendering/style/RenderStyle.cpp:
343         (WebCore::RenderStyle::diff):
344         * rendering/style/RenderStyle.h:
345         (WebCore::RenderStyle::strokeMiterLimit):
346         (WebCore::RenderStyle::setStrokeMiterLimit):
347         (WebCore::RenderStyle::initialStrokeMiterLimit):
348         (WebCore::RenderStyle::setStrokeDashOffset):
349         * rendering/style/RenderStyleConstants.cpp:
350         * rendering/style/RenderStyleConstants.h:
351         * rendering/style/SVGRenderStyle.cpp:
352         (WebCore::SVGRenderStyle::diff):
353         * rendering/style/SVGRenderStyle.h:
354         (WebCore::SVGRenderStyle::initialStrokeDashArray):
355         (WebCore::SVGRenderStyle::strokeDashArray):
356         (WebCore::SVGRenderStyle::initialStrokeMiterLimit): Deleted.
357         (WebCore::SVGRenderStyle::strokeMiterLimit): Deleted.
358         (WebCore::SVGRenderStyle::setStrokeMiterLimit): Deleted.
359         * rendering/style/SVGRenderStyleDefs.cpp:
360         (WebCore::StyleStrokeData::StyleStrokeData):
361         (WebCore::StyleStrokeData::operator==):
362         * rendering/style/SVGRenderStyleDefs.h:
363         * rendering/style/StyleRareInheritedData.cpp:
364         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
365         (WebCore::StyleRareInheritedData::operator==):
366         * rendering/style/StyleRareInheritedData.h:
367         * rendering/svg/RenderSVGShape.cpp:
368         (WebCore::RenderSVGShape::hasSmoothStroke):
369         * rendering/svg/SVGRenderSupport.cpp:
370         (WebCore::SVGRenderSupport::applyStrokeStyleToContext):
371         * rendering/svg/SVGRenderTreeAsText.cpp:
372         (WebCore::writeStyle):
373
374 2017-04-03  Alejandro G. Castro  <alex@igalia.com>
375
376         [OWR] Fix class structure for the OWR mock classes after last modifications
377         https://bugs.webkit.org/show_bug.cgi?id=170173
378
379         Reviewed by Youenn Fablet.
380
381         In case of OWR MockRealtimeMediaSource inherits from
382         RealtimeMediaSourceOwr, so we have to change some of the function
383         interfaces.
384
385         * platform/mock/MockRealtimeMediaSource.h:
386
387 2017-04-02  Alexey Proskuryakov  <ap@apple.com>
388
389         Build fix for
390         Add missing text styles
391         https://bugs.webkit.org/show_bug.cgi?id=170295
392
393         * rendering/RenderThemeIOS.mm:
394         (WebCore::RenderThemeIOS::cachedSystemFontDescription):
395         (WebCore::RenderThemeIOS::updateCachedSystemFontDescription):
396
397 2017-04-01  Zalan Bujtas  <zalan@apple.com>
398
399         Long Arabic text in ContentEditable with css white-space=pre hangs Safari
400         https://bugs.webkit.org/show_bug.cgi?id=170245
401
402         Reviewed by Myles C. Maxfield.
403
404         While searching for mid-word break, we measure the text by codepoints in a loop until the accumulated width > available width.
405         When we see that the accumulated width for the individual codepoints overflows, we join the codepoints and re-measure them.
406         These 2 widths could be considerably different for number of reasons (ligatures is a prime example). When we figure that
407         the run still fits, we go back to the main loop (since we are not supposed to wrap the line here) and take the next codepoint.
408         However this time we start the measurement from the last whitespace, so we end up remeasuring a potentially long chuck of text
409         until we hit the wrapping point. This is way too expensive.
410         This patch changes the logic so that we just go back to measuring individual codepoints until we hit the constrain again.  
411
412         Covered by existing tests.
413
414         * rendering/line/BreakingContext.h:
415         (WebCore::BreakingContext::handleText): canUseSimpleFontCodePath() is just to mitigate the potential risk of regression and
416         complex text is more likely to fall into this category. 
417
418 2017-04-01  Jon Lee  <jonlee@apple.com>
419
420         Add missing text styles
421         https://bugs.webkit.org/show_bug.cgi?id=170295
422         rdar://problem/30219503
423
424         Reviewed by Dean Jackson.
425
426         Updated existing test to include new text styles.
427
428         * css/CSSValueKeywords.in: Add title0 and title4.
429         * platform/spi/cocoa/CoreTextSPI.h:
430         * rendering/RenderThemeIOS.mm:
431         (WebCore::RenderThemeIOS::cachedSystemFontDescription):
432         (WebCore::RenderThemeIOS::updateCachedSystemFontDescription):
433
434 2017-04-01  Dan Bernstein  <mitz@apple.com>
435
436         [iOS] <input type=file> label should be specified using plural rules
437         https://bugs.webkit.org/show_bug.cgi?id=170388
438
439         Reviewed by Alexey Proskuryakov.
440
441         * English.lproj/Localizable.strings: Updated using update-webkit-localizable-strings.
442
443         * English.lproj/Localizable.stringsdict: Added an entry for the new key "%lu photo(s) and
444           %lu video(s)", with plural rules covering all the different combinations in English.
445           Other localizations may specify additional combinations as needed.
446
447 2017-04-01  Alexey Proskuryakov  <ap@apple.com>
448
449         Rolling back <https://trac.webkit.org/r214697>, as it made WebKit2.DataDetectionReferenceDate time out.
450
451         Was REGRESSION (r202472): Data Detection overwrites existing links in detected ranges
452         https://bugs.webkit.org/show_bug.cgi?id=170365
453
454         * editing/cocoa/DataDetection.mm:
455         (WebCore::searchForLinkRemovingExistingDDLinks):
456
457 2017-04-01  Chris Dumez  <cdumez@apple.com>
458
459         We should pause silent WebAudio rendering in background tabs
460         https://bugs.webkit.org/show_bug.cgi?id=170299
461         <rdar://problem/31289132>
462
463         Reviewed by Eric Carlson.
464
465         We should pause silent WebAudio rendering in background tabs since it uses CPU and is
466         not observable by the user. Such silent WebAudio rendering seems to be used by
467         doubleclick ads.
468
469         Test: webaudio/silent-audio-interrupted-in-background.html
470
471         * Modules/webaudio/AudioContext.cpp:
472         (WebCore::AudioContext::lazyInitialize):
473         (WebCore::AudioContext::uninitialize):
474         Have AudioContext register / unregister itself with the Document to get
475         visibility change notifications, similarly to what HTMLMediaElement was
476         already doing.
477
478         (WebCore::AudioContext::visibilityStateChanged):
479         Begin / End session interruption whenever the page visiblity changes.
480
481         * Modules/webaudio/AudioContext.h:
482         * WebCore.xcodeproj/project.pbxproj:
483
484         * dom/Document.cpp:
485         (WebCore::Document::registerForVisibilityStateChangedCallbacks):
486         (WebCore::Document::unregisterForVisibilityStateChangedCallbacks):
487         (WebCore::Document::visibilityStateChanged):
488         * dom/Document.h:
489         * dom/Element.h:
490         * dom/VisibilityChangeClient.h: Added.
491         (WebCore::VisibilityChangeClient::~VisibilityChangeClient):
492         * html/HTMLMediaElement.h:
493         Introduce a new VisibilityChangeClient interface and have both AudioContext
494         and HTMLMediaElement subclass it. Previously, the visibilityStateChanged()
495         function was on Element but this prevented AudioContext from registering
496         itself since AudioContext is not an Element.
497
498 2017-04-01  Dan Bernstein  <mitz@apple.com>
499
500         [Cocoa] A couple of UI strings use three periods instead of an ellipsis
501         https://bugs.webkit.org/show_bug.cgi?id=170386
502
503         Reviewed by Tim Horton.
504
505         * English.lproj/Localizable.strings: Updated using update-webkit-localizable-strings.
506
507         * platform/LocalizedStrings.cpp:
508         (WebCore::mediaElementLoadingStateText): Changed "Loading..." to "Loading…".
509
510         * platform/cocoa/LocalizedStringsCocoa.mm:
511         (WebCore::contextMenuItemTagStyles): Changed "Styles..." to "Styles…".
512
513 2017-04-01  Dan Bernstein  <mitz@apple.com>
514
515         Localizable strings files are out of date
516         https://bugs.webkit.org/show_bug.cgi?id=170383
517
518         Reviewed by Tim Horton.
519
520         Ran update-webkit-localizable-strings.
521
522         * English.lproj/Localizable.strings:
523
524 2017-04-01  Dan Bernstein  <mitz@apple.com>
525
526         [Xcode] In engineering builds, linker warns about libwebrtc.dylib’s install name being invalid
527         https://bugs.webkit.org/show_bug.cgi?id=170385
528
529         Reviewed by Tim Horton.
530
531         * Configurations/DebugRelease.xcconfig: Set WK_RELOCATABLE_FRAMEWORKS to YES like we do
532           in some other projects’ DebugRelease.xcconfig. Engineering builds are always relocatable.
533         * Configurations/WebCore.xcconfig: When WebCore is relocatable, tell the linker that it’s
534           not going to be in the shared cache, even if its install name implies that it might be.
535
536 2017-04-01  Alexey Proskuryakov  <ap@apple.com>
537
538         Rolling back http://trac.webkit.org/r214663 - memory corruption
539
540         * Modules/streams/ReadableByteStreamInternals.js:
541         (cloneArrayBuffer):
542         * bindings/js/JSDOMGlobalObject.cpp:
543         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
544         * bindings/js/StructuredClone.cpp:
545         (WebCore::structuredCloneArrayBuffer):
546         (WebCore::cloneArrayBufferImpl): Deleted.
547         (WebCore::cloneArrayBuffer): Deleted.
548         * bindings/js/StructuredClone.h:
549         * bindings/js/WebCoreBuiltinNames.h:
550         * testing/Internals.cpp:
551         (WebCore::markerTypeFrom):
552         (WebCore::Internals::resetToConsistentState):
553         (WebCore::Internals::isLoadingFromMemoryCache):
554         (WebCore::Internals::setImageFrameDecodingDuration):
555         (WebCore::deferredStyleRulesCountForList):
556         (WebCore::deferredGroupRulesCountForList):
557         (WebCore::deferredKeyframesRulesCountForList):
558         (WebCore::Internals::eventThrottlingBehaviorOverride):
559         (WebCore::Internals::enableMockSpeechSynthesizer):
560         (WebCore::Internals::rangeForDictionaryLookupAtLocation):
561         (WebCore::Internals::nodesFromRect):
562         (WebCore::Internals::layerIDForElement):
563         (WebCore::Internals::setElementUsesDisplayListDrawing):
564         (WebCore::Internals::setElementTracksDisplayListReplay):
565         (WebCore::Internals::styleRecalcCount):
566         (WebCore::Internals::compositingUpdateCount):
567         (WebCore::Internals::setCaptionDisplayMode):
568         (WebCore::Internals::endMediaSessionInterruption):
569         (WebCore::Internals::postRemoteControlCommand):
570         (WebCore::appendOffsets):
571         (WebCore::Internals::scrollSnapOffsets):
572         (WebCore::Internals::setShowAllPlugins):
573         (WebCore::Internals::cloneArrayBuffer): Deleted.
574         * testing/Internals.h:
575         * testing/Internals.idl:
576
577 2017-03-31  Zalan Bujtas  <zalan@apple.com>
578
579         <table>: Including <caption>, <thead> or <tbody> causes clipping across page breaks
580         https://bugs.webkit.org/show_bug.cgi?id=170348
581         <rdar://problem/24727151>
582
583         Reviewed by David Hyatt.
584
585         1. In RenderFlowThread::offsetFromLogicalTopOfFirstRegion() we need to take table section offset into account (they are skipped
586         during the containing block traversal).
587         2. Trigger paginated relayout when body is moved vertically due to caption/thead etc.
588
589         Test: fast/multicol/table-section-page-break.html
590
591         * rendering/RenderFlowThread.cpp:
592         (WebCore::RenderFlowThread::offsetFromLogicalTopOfFirstRegion):
593         * rendering/RenderTable.cpp:
594         (WebCore::RenderTable::layout):
595
596 2017-03-31  Simon Fraser  <simon.fraser@apple.com>
597
598         Rename DOMWindow's m_touchEventListenerCount to m_touchAndGestureEventListenerCount
599         https://bugs.webkit.org/show_bug.cgi?id=170371
600
601         Reviewed by Tim Horton.
602
603         This count tracks touch and gesture event listeners, so name it appropriately.
604
605         * page/DOMWindow.cpp:
606         (WebCore::DOMWindow::addEventListener):
607         (WebCore::DOMWindow::removeEventListener):
608         (WebCore::DOMWindow::removeAllEventListeners):
609         * page/DOMWindow.h:
610
611 2017-03-31  Simon Fraser  <simon.fraser@apple.com>
612
613         When destroying a Node, assert that it's been removed from all the touch handler maps
614         https://bugs.webkit.org/show_bug.cgi?id=170363
615         rdar://problem/31377469
616
617         Reviewed by Tim Horton.
618
619         Assert that the Node has been removed from the touch handler maps in all documents on destruction.
620
621         * dom/Document.h:
622         (WebCore::Document::hasTouchEventHandlers):
623         (WebCore::Document::touchEventTargetsContain):
624         * dom/Node.cpp:
625         (WebCore::Node::~Node):
626
627 2017-03-31  Alexey Proskuryakov  <ap@apple.com>
628
629         Rolling back https://trac.webkit.org/r214689, as it caused many crashes.
630
631         Was:
632         Fix memory leak in CreateSessionDescriptionObserver::OnSuccess
633         https://bugs.webkit.org/show_bug.cgi?id=170357
634
635         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
636         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionSucceeded):
637
638 2017-03-31  Youenn Fablet  <youenn@apple.com>
639
640         Fix memory leak in RealtimeVideoIncomingSource
641         https://bugs.webkit.org/show_bug.cgi?id=170356
642
643         Reviewed by Eric Carlson.
644
645         No change of behavior.
646
647         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
648         (WebCore::RealtimeIncomingVideoSource::OnFrame): Adopting the newly created pointer.
649
650 2017-03-31  Andy Estes  <aestes@apple.com>
651
652         REGRESSION (r202472): Data Detection overwrites existing links in detected ranges
653         https://bugs.webkit.org/show_bug.cgi?id=170365
654         <rdar://problem/29205721>
655
656         Reviewed by Tim Horton.
657
658         r202472 changed the node traversal in searchForLinkRemovingExistingDDLinks() to only
659         consider nodes that are descendants of startNode, but we need to traverse all nodes between
660         startNode and endNode to find existing non-DD links.
661
662         As a result, we'd add a Data Detector link to the following snippet and make the original
663         links un-clickable:
664
665             <a href='#'>tomorrow</a> <a href='#'>night</a>
666
667         Fix this by not specifying a stayWithin node when calling NodeTraversal::next(). The loop
668         will terminate when we reach endNode.
669
670         Updated WebKit2.DataDetectionReferenceDate API test.
671
672         * editing/cocoa/DataDetection.mm:
673         (WebCore::searchForLinkRemovingExistingDDLinks):
674
675 2017-03-31  Eric Carlson  <eric.carlson@apple.com>
676
677         Incoming video source doesn't propogate frame rotation
678         https://bugs.webkit.org/show_bug.cgi?id=170364
679
680         Reviewed by Youenn Fablet.
681
682         No new tests, the mock video source doesn't support rotation. Test will be added when
683         this is fixed in https://bugs.webkit.org/show_bug.cgi?id=169822. The changes were 
684         verified manually.
685
686         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
687         (WebCore::RealtimeIncomingVideoSource::OnFrame): Convert frame rotation to sample
688         orientation and swap width and height when necessary.
689         (WebCore::RealtimeIncomingVideoSource::processNewSample):
690         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
691
692 2017-03-31  Chris Dumez  <cdumez@apple.com>
693
694         Possible null dereference under SourceBuffer::sourceBufferPrivateDidReceiveSample()
695         https://bugs.webkit.org/show_bug.cgi?id=159639
696
697         Reviewed by Eric Carlson.
698
699         Add a null check for trackBuffer.description before dereferencing as it seems
700         it can be null.
701
702         * Modules/mediasource/SourceBuffer.cpp:
703         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
704
705 2017-03-31  Youenn Fablet  <youenn@apple.com>
706
707         Fix memory leak in CreateSessionDescriptionObserver::OnSuccess
708         https://bugs.webkit.org/show_bug.cgi?id=170357
709
710         Reviewed by Geoffrey Garen.
711
712         No change of behavior.
713
714         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
715         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionSucceeded): Adopting the raw pointer parameter.
716
717 2017-03-31  Fujii Hironori  <Hironori.Fujii@sony.com>
718
719         [WinCairo] WebCore::PlatformDisplay::terminateEGLDisplay causes a crash in libGLESv2.dll while processing atexit
720         https://bugs.webkit.org/show_bug.cgi?id=170331
721
722         Reviewed by Michael Catanzaro.
723
724         WebCore::PlatformDisplay uses atexit to destruct EGL displays
725         while exiting process. But, when the atexit will be processed,
726         heap of libGLESv2.dll would be already destructed and causing a
727         crash on Windows. Do not use atexit for Windows.
728
729         AppleWin port does not use PlatformDisplay. Thus, it does not have
730         this bug.
731
732         * platform/graphics/PlatformDisplay.cpp:
733         (WebCore::PlatformDisplay::initializeEGLDisplay): Do not use atexit for Windows.
734         (WebCore::PlatformDisplay::shutDownEglDisplays): Added.
735         * platform/graphics/PlatformDisplay.h: Added a declaration of shutDownEglDisplays.
736
737 2017-03-31  Yoav Weiss  <yoav@yoav.ws>
738
739         Remove PRELOAD_DEBUG related code.
740         https://bugs.webkit.org/show_bug.cgi?id=170352
741
742         Reviewed by Youenn Fablet.
743
744         As the PRELOAD_DEBUG related code stopped building and it seems like no one noticed,
745         it seems safe to assume that we can remove that code. This patch removes it.
746
747         No new tests as there's no functional change.
748
749         * loader/cache/CachedResourceLoader.cpp:
750         (WebCore::CachedResourceLoader::preload):
751         (WebCore::CachedResourceLoader::clearPreloads):
752         (WebCore::CachedResourceLoader::printPreloadStats): Deleted.
753
754 2017-03-31  Brady Eidson  <beidson@apple.com>
755
756         Clean up the "StorageType" enum.
757         https://bugs.webkit.org/show_bug.cgi?id=170349
758
759         Reviewed by Tim Horton.
760
761         - Make this `enum` into an `enum class`
762         - Add a new type specific for "transient local storage"
763
764         No new tests (No behavior change).
765
766         * WebCore.xcodeproj/project.pbxproj:
767         
768         * inspector/InspectorDOMStorageAgent.cpp:
769         (WebCore::InspectorDOMStorageAgent::didDispatchDOMStorageEvent):
770         
771         * inspector/InspectorInstrumentation.h:
772         
773         * loader/EmptyClients.cpp:
774         
775         * storage/Storage.cpp:
776         (WebCore::Storage::isDisabledByPrivateBrowsing):
777         
778         * storage/StorageArea.h:
779         (): Deleted.
780         
781         * storage/StorageEventDispatcher.cpp:
782         (WebCore::StorageEventDispatcher::dispatchSessionStorageEventsToFrames):
783         (WebCore::StorageEventDispatcher::dispatchLocalStorageEventsToFrames):
784         
785         * storage/StorageType.h:
786         (WebCore::isLocalStorage):
787
788 2017-03-31  Chris Dumez  <cdumez@apple.com>
789
790         Unreviewed, Mark "HTML interactive form validation" as done.
791
792         It is shipping in Safari 10.1.
793  
794         * features.json:
795
796 2017-03-31  Csaba Osztrogonác  <ossy@webkit.org>
797
798         Mac cmake buildfix after r214666
799         https://bugs.webkit.org/show_bug.cgi?id=170342
800
801         Unreviewed buildfix.
802
803         * PlatformMac.cmake:
804         * testing/MockPreviewLoaderClient.h:
805
806 2017-03-31  Sam Weinig  <sam@webkit.org>
807
808         Remove unneeded custom constructors include.
809
810         * WebCore.xcodeproj/project.pbxproj:
811         * bindings/js/ios: Removed.
812         * bindings/js/ios/TouchConstructors.cpp: Removed.
813
814 2017-03-31  John Wilander  <wilander@apple.com>
815
816         Resource Load Statistics: Check if the store exists before clearing it
817         https://bugs.webkit.org/show_bug.cgi?id=170324
818         <rdar://problem/31258505>
819
820         Reviewed by Brent Fulgham.
821
822         No new tests. Added a null check.
823
824         * loader/ResourceLoadObserver.cpp:
825         (WebCore::ResourceLoadObserver::clearInMemoryAndPersistentStore):
826             Added a null check.
827
828 2017-03-31  Romain Bellessort  <romain.bellessort@crf.canon.fr>
829
830         [Readable Streams API] Implement cloneArrayBuffer in WebCore
831         https://bugs.webkit.org/show_bug.cgi?id=170008
832
833         Reviewed by Youenn Fablet.
834
835         Implemented cloneArrayBuffer based on existing structuredCloneArrayBuffer
836         implementation. The code has been factorized so that both cloneArrayBuffer
837         and structuredCloneArrayBuffer rely on the same code (which is basically
838         the previous implementation of structuredCloneArrayBuffer + the ability
839         to clone only a part of considered buffer).
840
841         Added test to check cloneArrayBuffer behaviour.
842
843         * Modules/streams/ReadableByteStreamInternals.js: Deleted cloneArrayBuffer JS implementation.
844         * bindings/js/JSDOMGlobalObject.cpp:
845         (WebCore::JSDOMGlobalObject::addBuiltinGlobals): Add cloneArrayBuffer private declaration.
846         * bindings/js/StructuredClone.cpp:
847         (WebCore::cloneArrayBufferImpl): Added (mostly based on previous structuredCloneArrayBuffer).
848         (WebCore::cloneArrayBuffer): Added.
849         (WebCore::structuredCloneArrayBuffer): Updated.
850         * bindings/js/StructuredClone.h: Added cloneArrayBuffer declaration.
851         * bindings/js/WebCoreBuiltinNames.h: Added cloneArrayBuffer declaration.
852         * testing/Internals.cpp: Added support for testing cloneArrayBuffer.
853         * testing/Internals.h: Added support for testing cloneArrayBuffer.
854         * testing/Internals.idl: Added support for testing cloneArrayBuffer.
855
856 2017-03-31  Antoine Quint  <graouts@apple.com>
857
858         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
859         https://bugs.webkit.org/show_bug.cgi?id=168409
860         <rdar://problem/30799198>
861
862         Unreviewed. Yet more logging to determine under what circumstance ScriptedAnimationController gets suspended.
863
864         * dom/Document.cpp:
865         (WebCore::Document::requestAnimationFrame):
866
867 2017-03-30  Zan Dobersek  <zdobersek@igalia.com>
868
869         Unreviewed GTK+ build fix. Add missing ANGLE build targets
870         to the build.
871
872         * CMakeLists.txt:
873
874 2017-03-30  Simon Fraser  <simon.fraser@apple.com>
875
876         Ensure that Node::willBeDeletedFrom() always removes touch event handlers from the document
877         https://bugs.webkit.org/show_bug.cgi?id=170323
878         rdar://problem/23647630
879
880         Reviewed by Chris Dumez.
881
882         There are two instances where nodes are registered as touch event handlers without
883         having normal touch event listeners: slider thumb elements, and elements with overflow scrolling,
884         on iOS.
885
886         For such nodes, hasEventTargetData() will be false, but we want to ensure
887         that they are removed from the Document's touchEventHandler set, so move the
888         call to document.removeTouchEventHandler() outside of the conditional block.
889
890         This should be cheap in most cases when the touchEventHandler is empty.
891
892         * dom/Node.cpp:
893         (WebCore::Node::willBeDeletedFrom):
894
895 2017-03-30  Simon Fraser  <simon.fraser@apple.com>
896
897         Minor cleanup checking for gesture event names
898         https://bugs.webkit.org/show_bug.cgi?id=170319
899
900         Reviewed by Tim Horton.
901
902         Just use isGestureEventType() in a couple of places.
903
904         * dom/Node.cpp:
905         (WebCore::tryAddEventListener):
906         (WebCore::tryRemoveEventListener):
907
908 2017-03-30  Simon Fraser  <simon.fraser@apple.com>
909
910         Rename a touch event function, and new touch region test results
911         https://bugs.webkit.org/show_bug.cgi?id=170309
912         rdar://problem/31329520
913
914         Reviewed by Chris Dumez.
915
916         Adapt to a naming change in WebKitAdditions.
917
918         * dom/Document.cpp:
919         (WebCore::Document::removeAllEventListeners):
920         * page/FrameView.cpp:
921         (WebCore::FrameView::layout):
922         * rendering/RenderElement.cpp:
923         (WebCore::RenderElement::styleWillChange):
924         * rendering/RenderLayer.cpp:
925         (WebCore::RenderLayer::scrollTo):
926         (WebCore::RenderLayer::calculateClipRects):
927
928 2017-03-30  Matt Rajca  <mrajca@apple.com>
929
930         YouTube sometimes does not respect "user gesture" restriction for videos.
931         https://bugs.webkit.org/show_bug.cgi?id=170297
932
933         I discovered a code path that does not honor the "user gesture" requirement and playback is able to begin
934         even though we have a restriction in place. When using Media Source Extensions, which YouTube does, we transition
935         from a "Have Metadata" to a "Future Data" state that causes playback to begin, however, we never check
936         if we have a playback restriction in place.
937
938         Reviewed by Eric Carlson.
939
940         * html/HTMLMediaElement.cpp:
941         (WebCore::HTMLMediaElement::setReadyState):
942
943 2017-03-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
944
945         REGRESSION (r213764): Background image from sprite sheet incorrectly scaled
946         https://bugs.webkit.org/show_bug.cgi?id=169547
947
948         Reviewed by Simon Fraser.
949
950         The bug happens when drawing only a rectangle of an image not the whole
951         image. In BitmapImage::draw(), sizeForDrawing was calculated as the destRect
952         scaled by the transformation which is applied to the GraphicsContext. Two
953         problems with this approach. The first one is destRect can be only part of
954         the image. The second problem is, the ratio destRect / srcRect is another
955         scaling that needs to be considered.
956
957         To fix this issue, first the base size has to be size of the image and not
958         destRect.size(). Secondly, we need to scale this base size with the context
959         transformation multiplied by the ratio destRect / srcRect. This scaling is
960         exactly the same scaling which is calculated in subsamplingScale(). Finally
961         we use this scaled size as the sizeForDrawing to send to the ImageDecoder.
962
963         Test: fast/images/sprite-sheet-image-draw.html
964
965         * platform/graphics/BitmapImage.cpp:
966         (WebCore::BitmapImage::draw): Fix the bug.
967         (WebCore::BitmapImage::stopAnimation): Stops the async image decoding for animated images only.
968         The decoding for large images will be stopped when BitmapImage::newFrameNativeImageAvailableAtIndex()
969         is called and the decoding queue is idle.
970         (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): Add image logging.
971         * platform/graphics/BitmapImage.h: Move sourceURL() to the Image class.
972         * platform/graphics/GraphicsContext.cpp: Pass imagePaintingOptions.m_decodingMode to Image::drawTiled().
973         (WebCore::GraphicsContext::drawTiledImage): Pass imagePaintingOptions.m_decodingMode) to Image::drawTiled().
974         * platform/graphics/Image.cpp:
975         (WebCore::Image::sourceURL): Moved from BitmapImage.
976         (WebCore::Image::drawTiled): Add a DecodingMode argument instead of calling always with DecodingMode::Synchronous.
977         * platform/graphics/Image.h:
978         * platform/graphics/ImageFrameCache.cpp:
979         (WebCore::ImageFrameCache::cacheAsyncFrameNativeImageAtIndex): Add image logging.
980         (WebCore::ImageFrameCache::startAsyncDecodingQueue): Ditto,
981         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Ditto.
982         (WebCore::ImageFrameCache::stopAsyncDecodingQueue): Ditto.
983         (WebCore::ImageFrameCache::sourceURL): A helper function to avoid checking the value of m_image.
984         * platform/graphics/ImageFrameCache.h:
985         * platform/graphics/NativeImage.h: Rename subsamplingScale() to nativeImageDrawingScale() and return image scaling instead.
986         * platform/graphics/cairo/NativeImageCairo.cpp:
987         (WebCore::nativeImageDrawingScale): Ditto.
988         (WebCore::subsamplingScale): Deleted.
989         * platform/graphics/cg/NativeImageCG.cpp:
990         (WebCore::nativeImageDrawingScale): Ditto.
991         (WebCore::subsamplingScale): Deleted.
992         * platform/graphics/win/NativeImageDirect2D.cpp:
993         (WebCore::nativeImageDrawingScale): Ditto.
994         (WebCore::subsamplingScale): Deleted.
995
996 2017-03-30  Matt Baker  <mattbaker@apple.com>
997
998         Web Inspector: Assertion failure in InspectorStyleProperty::setRawTextFromStyleDeclaration
999         https://bugs.webkit.org/show_bug.cgi?id=170279
1000         <rdar://problem/30200492>
1001
1002         Reviewed by David Hyatt.
1003
1004         The SourceRange for a CSSPropertySourceData should be relative to the start
1005         of the declaration body, not the start of the StyleSheetHandler’s parsed
1006         text. This only affected the ranges of unparsed (parsedOK == false) properties
1007         lacking a trailing semi-colon.
1008
1009         This patch doesn't change the behavior of InspectorStyleSheet other than
1010         silencing an irksome assert, as String::substring does a safety check on
1011         the passed in length.
1012
1013         * inspector/InspectorStyleSheet.cpp:
1014         (WebCore::fixUnparsedProperties):
1015
1016 2017-03-30  Youenn Fablet  <youenn@apple.com> and Jon Lee <jonlee@apple.com>
1017
1018         Clean up RTCDataChannel
1019         https://bugs.webkit.org/show_bug.cgi?id=169732
1020
1021         Reviewed by Chris Dumez.
1022
1023         Test: webrtc/datachannel/datachannel-event.html
1024               webrtc/datachannel/bufferedAmountLowThreshold.html
1025
1026         Making RTCDataChannel interface closer to the spec updating implementation accordingly.
1027         See https://w3c.github.io/webrtc-pc/#rtcdatachannel.
1028         In particular adding RTCDataChannelEvent constructor, and missing bufferedAmount related attributes.
1029         Doing some additional cleaning refactoring.
1030
1031         Making bufferedAmountIsDecreasing take a bufferedAmount argument so that we get the actual value passed by
1032         libwebrtc without needing to get it from the libwebrtc network thread again.
1033         In the future, we should store the bufferedAmount value in RTCDataChannel and update its value on each libwebrtc
1034         OnBufferedAmountChange. Special treatment may be needed when the data channel is closed, in which case the bufferedAmount should just be
1035         updated to increase in the send method.
1036
1037         Added some FIXMEs as RTCDataChannel is not aligned with the spec related to send and bufferedAmount.
1038
1039         * Modules/mediastream/RTCDataChannel.cpp:
1040         (WebCore::RTCDataChannel::send):
1041         (WebCore::RTCDataChannel::close):
1042         (WebCore::RTCDataChannel::didChangeReadyState):
1043         (WebCore::RTCDataChannel::bufferedAmountIsDecreasing):
1044         * Modules/mediastream/RTCDataChannel.h:
1045         * Modules/mediastream/RTCDataChannel.idl:
1046         * Modules/mediastream/RTCDataChannelEvent.cpp:
1047         (WebCore::RTCDataChannelEvent::create):
1048         (WebCore::RTCDataChannelEvent::RTCDataChannelEvent):
1049         (WebCore::RTCDataChannelEvent::channel):
1050         * Modules/mediastream/RTCDataChannelEvent.h:
1051         * Modules/mediastream/RTCDataChannelEvent.idl:
1052         * Modules/mediastream/RTCPeerConnection.idl:
1053         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
1054         (WebCore::LibWebRTCDataChannelHandler::OnStateChange):
1055         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1056         (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
1057         * WebCore.xcodeproj/project.pbxproj:
1058         * dom/EventNames.h:
1059         * platform/mediastream/RTCDataChannelHandler.h:
1060         * platform/mediastream/RTCDataChannelHandlerClient.h:
1061         * platform/mediastream/RTCDataChannelState.h: Added.
1062         * platform/mediastream/RTCPeerConnectionHandlerClient.h:
1063         * platform/mock/RTCDataChannelHandlerMock.cpp:
1064         (WebCore::RTCDataChannelHandlerMock::setClient):
1065         (WebCore::RTCDataChannelHandlerMock::close):
1066         * platform/mock/RTCNotifiersMock.cpp:
1067         (WebCore::IceConnectionNotifier::IceConnectionNotifier):
1068         (WebCore::SignalingStateNotifier::SignalingStateNotifier):
1069         (WebCore::DataChannelStateNotifier::DataChannelStateNotifier):
1070         * platform/mock/RTCNotifiersMock.h:
1071
1072 2017-03-30  Javier Fernandez  <jfernandez@igalia.com>
1073
1074         [css-align] Adapt content-alignment properties to the new baseline syntax
1075         https://bugs.webkit.org/show_bug.cgi?id=170262
1076
1077         Reviewed by David Hyatt.
1078
1079         The baseline-position syntax has changed recently, so we need to update
1080         the CSS properties using the old syntax. This patch address only the
1081         content-alignment (align-content and justify-content).
1082
1083         I used this patch to adapt the implementation of the parsing logic for
1084         these properties to the new Blink's CSS Parsing Design.
1085
1086         The new baseline syntax is "[first | last ]? baseline" which implies
1087         modifying the parsing and computed value logic.
1088
1089         There are several layout tests affected by this change, so I'll update
1090         them accordingly.
1091
1092         No new tests, just added/modified some cases to the tests we
1093         already have using the new baseline values.
1094
1095         * css/CSSComputedStyleDeclaration.cpp:
1096         (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment):
1097         * css/CSSContentDistributionValue.cpp:
1098         (WebCore::CSSContentDistributionValue::customCSSText):
1099         * css/CSSPrimitiveValueMappings.h:
1100         (WebCore::CSSPrimitiveValue::operator ItemPosition):
1101         (WebCore::CSSPrimitiveValue::operator ContentPosition):
1102         * css/CSSValueKeywords.in:
1103         * css/parser/CSSPropertyParser.cpp:
1104         (WebCore::isBaselineKeyword):
1105         (WebCore::consumeBaselineKeyword):
1106         (WebCore::consumeContentDistributionOverflowPosition):
1107         (WebCore::consumeSelfPositionOverflowPosition):
1108
1109 2017-03-30  James Craig  <jcraig@apple.com>
1110
1111         AX: Expose a new AXSubrole for explicit ARIA "group" role
1112         https://bugs.webkit.org/show_bug.cgi?id=169810
1113         <rdar://problem/31039693>
1114
1115         Reviewed by Chris Fleizach.
1116
1117         Split GroupRole into generics (GroupRole) and explicit groups 
1118         (ApplicationGroupRole) so we can expose a subrole on the explicit 
1119         groups. Account for the change in ARIA Tree and Menu hierachies. 
1120         Update the computedRoleValue for WebKit Inspector usage, too.
1121
1122         Updated existing tests.
1123
1124         Test: accessibility/list-detection2.html:
1125         Test: accessibility/roles-computedRoleString.html:
1126         Test: inspector/dom/getAccessibilityPropertiesForNode.html:
1127         Test: inspector/dom/highlightFrame.html:
1128         Test: inspector/dom/highlightSelector.html:
1129
1130         * accessibility/AccessibilityNodeObject.cpp:
1131         (WebCore::AccessibilityNodeObject::helpText):
1132         (WebCore::AccessibilityNodeObject::hierarchicalLevel):
1133         (WebCore::AccessibilityNodeObject::remapAriaRoleDueToParent):
1134         * accessibility/AccessibilityObject.cpp:
1135         (WebCore::AccessibilityObject::accessibleNameDerivesFromContent):
1136         (WebCore::AccessibilityObject::ariaTreeItemContent):
1137         (WebCore::initializeRoleMap):
1138         (WebCore::AccessibilityObject::computedRoleString):
1139         * accessibility/AccessibilityObject.h:
1140         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1141         (atkRole):
1142         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1143         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
1144         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1145         (createAccessibilityRoleMap):
1146         (-[WebAccessibilityObjectWrapper subrole]):
1147
1148 2017-03-30  Chris Dumez  <cdumez@apple.com>
1149
1150         We are spending a lot of time bzero'ing AudioChannel buffers on uni-watch.com
1151         https://bugs.webkit.org/show_bug.cgi?id=170288
1152         <rdar://problem/31289132>
1153
1154         Reviewed by Eric Carlson.
1155
1156         We are spending a lot of time bzero'ing AudioChannel buffers on uni-watch.com due
1157         to doubleclick ads using WebAudio with a 0-gain GainNode. We should optimize the
1158         0-gain case as much as possible.
1159
1160         No new tests, only an optimization.
1161
1162         * Modules/webaudio/AudioNode.cpp:
1163         (WebCore::AudioNode::processIfNecessary):
1164         Drop call to unsilenceOutputs() before calling AudioNode::process(). The AudioChannel
1165         API already takes care of clearing its 'silent' flag whenever its buffer changes so
1166         there should be no need to explicitly clearing the 'silent' flag before calling
1167         process(). This was causing us to zero out buffers that were already filled with
1168         zeros because AudioChannel::zero() would no longer return early, not knowing the
1169         channel is already silent. This reduces the number of bzero() calls by ~3.5x on
1170         uni-watch.com (from 100 calls every ~20ms to 100 calls every ~70ms.
1171
1172         * Modules/webaudio/AudioNode.h:
1173         * platform/audio/mac/AudioDestinationMac.cpp:
1174         (WebCore::AudioDestinationMac::render):
1175         Avoid clamping the values in the channel buffer if the channel is silent since this
1176         will have no effect (given that the buffer only contains zeros).
1177
1178 2017-03-30  Eric Carlson  <eric.carlson@apple.com>
1179
1180         [Crash] WebCore::AudioBuffer::AudioBuffer don't checking illegal value
1181         https://bugs.webkit.org/show_bug.cgi?id=169956
1182
1183         Reviewed by Youenn Fablet.
1184
1185         Test: webaudio/audiobuffer-crash.html
1186
1187         * Modules/webaudio/AudioBuffer.cpp:
1188         (WebCore::AudioBuffer::AudioBuffer): Invalidate the object and return early if the channel 
1189         array allocation fails.
1190         (WebCore::AudioBuffer::AudioBuffer): Ditto.
1191         (WebCore::AudioBuffer::invalidate): Invalidate the object.
1192         * Modules/webaudio/AudioBuffer.h:
1193
1194 2017-03-30  Antoine Quint  <graouts@apple.com>
1195
1196         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
1197         https://bugs.webkit.org/show_bug.cgi?id=168409
1198         <rdar://problem/30799198>
1199
1200         Unreview. Print the backtrace when we suspend scripted animations.
1201
1202         * page/Page.cpp:
1203         (WebCore::Page::suspendScriptedAnimations):
1204
1205 2017-03-30  Antoine Quint  <graouts@apple.com>
1206
1207         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
1208         https://bugs.webkit.org/show_bug.cgi?id=168409
1209         <rdar://problem/30799198>
1210
1211         Unreview. Pring the backtrace when we suspend ScriptedAnimationController.
1212
1213         * dom/ScriptedAnimationController.cpp:
1214         (WebCore::ScriptedAnimationController::suspend):
1215
1216 2017-03-30  Antoine Quint  <graouts@apple.com>
1217
1218         [Modern Media Controls] Invalid placard icon is not visible for short video
1219         https://bugs.webkit.org/show_bug.cgi?id=170277
1220         <rdar://problem/31327955>
1221
1222         Reviewed by Eric Carlson.
1223
1224         Make the minimum dimension needed to display a placard icon configurable and let the
1225         invalid placard use a 50pt dimension. We also make a drive-by fix to reset "text-align"
1226         for media controls as having a "text-align: center" inherited value would mess up
1227         positioning of the placard icon and make it flush to the right of the placard.
1228
1229         Test: media/modern-media-controls/invalid-placard/invalid-placard-constrained-metrics.html
1230
1231         * Modules/modern-media-controls/controls/invalid-placard.js:
1232         (InvalidPlacard):
1233         * Modules/modern-media-controls/controls/media-controls.css:
1234         (.media-controls):
1235         * Modules/modern-media-controls/controls/placard.js:
1236         (Placard.prototype.layout):
1237
1238 2017-03-30  Zan Dobersek  <zdobersek@igalia.com>
1239
1240         [GCrypt] Register missing algorithms in CryptoAlgorithmRegistry::platformRegisterAlgoritmhs()
1241         https://bugs.webkit.org/show_bug.cgi?id=170273
1242
1243         Reviewed by Michael Catanzaro.
1244
1245         * crypto/gcrypt/CryptoAlgorithmRegistryGCrypt.cpp:
1246         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
1247         Add registerAlgorithm<> calls for AES_CFB, AES_GCM, ECDH and
1248         PBKDF2 algorithms.
1249
1250 2017-03-30  Brent Fulgham  <bfulgham@apple.com>
1251
1252         Remove unused MediaControlsApple implementation
1253         https://bugs.webkit.org/show_bug.cgi?id=170258
1254         <rdar://problem/31331056>
1255
1256         Reviewed by Eric Carlson.
1257
1258         Remove dead code related to old media controls. We switched to HTML5-based media controls
1259         several years ago.
1260
1261         No new tests. Removing this dead code should have no change in behavior.
1262
1263         * WebCore.xcodeproj/project.pbxproj: Remove unused files.
1264         * dom/EventListener.h: Remove unused event type.
1265         * html/shadow/MediaControlsApple.cpp: Removed.
1266         * html/shadow/MediaControlsApple.h: Removed.
1267
1268 2017-03-30  Fujii Hironori  <Hironori.Fujii@sony.com>
1269
1270         [WinCairo] ImageCairoWin.cpp: error C2660: 'WebCore::BitmapImage::draw': function does not take 6 arguments
1271         https://bugs.webkit.org/show_bug.cgi?id=170275
1272
1273         Reviewed by Said Abou-Hallawa.
1274
1275         Apply the similar change of ImageCGWin.cpp of r214450 to ImageCairoWin.cpp.
1276
1277         * platform/graphics/win/ImageCairoWin.cpp:
1278         (WebCore::BitmapImage::getHBITMAPOfSize): Pass DecodingMode::Synchronous to Image::draw().
1279         (WebCore::BitmapImage::drawFrameMatchingSourceSize): Ditto.
1280
1281 2017-03-27  Sergio Villar Senin  <svillar@igalia.com>
1282
1283         [css-grid] Clamp the number of autorepeat tracks
1284         https://bugs.webkit.org/show_bug.cgi?id=170120
1285
1286         Reviewed by Manuel Rego Casasnovas.
1287
1288         As suggested by the specs we do clamp the maximum number of tracks per grid in order to
1289         minimize potential OOM situations. However we were not considering the case of the recently
1290         added auto repeat syntax. Abnormally huge values for the width/height on the grid container
1291         could lead to a number of auto repeat tracks higher than the maximum.
1292
1293         A new API was added to Internals in order to test limits without having to create huge
1294         grids. This new API allows clients to set an arbitrary limit to the number of tracks. The
1295         addition of this new API forced us to add GridPosition.cpp to the project to define the
1296         global variable we use for testing. We took the chance to move part of the implementation
1297         from the header file to the source file.
1298
1299         Last but not least, several new ASSERTs were added to Grid.cpp implementation to ensure that
1300         we do not surpass the grid track limits.
1301
1302         Test: fast/css-grid-layout/grid-auto-repeat-huge-grid.html
1303
1304         * CMakeLists.txt:
1305         * WebCore.xcodeproj/project.pbxproj:
1306         * css/parser/CSSPropertyParser.cpp:
1307         (WebCore::consumeGridTrackRepeatFunction):
1308         * rendering/Grid.cpp:
1309         (WebCore::Grid::ensureGridSize): Added ASSERT.
1310         (WebCore::Grid::setSmallestTracksStart): Ditto.
1311         (WebCore::Grid::setAutoRepeatTracks): Ditto.
1312         (WebCore::Grid::setAutoRepeatEmptyColumns): Ditto.
1313         (WebCore::Grid::setAutoRepeatEmptyRows): Ditto.
1314         * rendering/RenderGrid.cpp:
1315         (WebCore::RenderGrid::clampAutoRepeatTracks): New method.
1316         (WebCore::RenderGrid::placeItemsOnGrid): Clamp the number of auto repeat tracks before
1317         passing them to the Grid.
1318         * rendering/RenderGrid.h:
1319         * rendering/style/GridArea.h:
1320         (WebCore::GridSpan::GridSpan):
1321         * rendering/style/GridPosition.cpp: Added.
1322         (WebCore::GridPosition::setExplicitPosition):
1323         (WebCore::GridPosition::setAutoPosition):
1324         (WebCore::GridPosition::setSpanPosition):
1325         (WebCore::GridPosition::setNamedGridArea):
1326         (WebCore::GridPosition::integerPosition):
1327         (WebCore::GridPosition::namedGridLine):
1328         (WebCore::GridPosition::spanPosition):
1329         (WebCore::GridPosition::operator==):
1330         * rendering/style/GridPosition.h:
1331         (WebCore::GridPosition::shouldBeResolvedAgainstOppositePosition):
1332         (WebCore::GridPosition::max):
1333         (WebCore::GridPosition::min):
1334         (WebCore::GridPosition::setMaxPositionForTesting):
1335         (WebCore::GridPosition::setExplicitPosition): Deleted.
1336         (WebCore::GridPosition::setAutoPosition): Deleted.
1337         (WebCore::GridPosition::setSpanPosition): Deleted.
1338         (WebCore::GridPosition::setNamedGridArea): Deleted.
1339         (WebCore::GridPosition::integerPosition): Deleted.
1340         (WebCore::GridPosition::namedGridLine): Deleted.
1341         (WebCore::GridPosition::spanPosition): Deleted.
1342         (WebCore::GridPosition::operator==): Deleted.
1343         * rendering/style/GridPositionsResolver.cpp:
1344         (WebCore::GridPositionsResolver::explicitGridColumnCount):
1345         (WebCore::GridPositionsResolver::explicitGridRowCount):
1346         * testing/Internals.cpp:
1347         (WebCore::Internals::setGridMaxTracksLimit):
1348         * testing/Internals.h:
1349         * testing/Internals.idl:
1350
1351 2017-03-29  Ryosuke Niwa  <rniwa@webkit.org>
1352
1353         Disconnecting a HTMLObjectElement does not always unload its content document
1354         https://bugs.webkit.org/show_bug.cgi?id=169606
1355
1356         Reviewed by Andy Estes.
1357
1358         When removing a node, we first disconnect all subframes then update the focused element as we remove each child.
1359         However, when the removed element is a focused object element with a content document, removeFocusedNodeOfSubtree
1360         can update the style tree synchronously inside Document::setFocusedElement, and reload the document.
1361
1362         Avoid this by instantiating a SubframeLoadingDisabler on the parent of the focused element.
1363
1364         Test: fast/dom/removing-focused-object-element.html
1365
1366         * dom/Document.cpp:
1367         (WebCore::Document::removeFocusedNodeOfSubtree):
1368
1369 2017-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
1370
1371         Migrate to kCTFontCSSWidthAttribute
1372         https://bugs.webkit.org/show_bug.cgi?id=170265
1373
1374         Reviewed by Darin Adler.
1375
1376         Previously, we were mapping from Core Text widths to CSS widths in WebKit.
1377         However, on some OSes, Core Text can directly tell us what the CSS width
1378         value is.
1379
1380         No new tests because there is no behavior change.
1381
1382         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1383         (WebCore::getCSSAttribute):
1384         (WebCore::capabilitiesForFontDescriptor):
1385         * platform/spi/cocoa/CoreTextSPI.h:
1386
1387 2017-03-28  Simon Fraser  <simon.fraser@apple.com>
1388
1389         Make it possible to dump touch event regions for testing
1390         https://bugs.webkit.org/show_bug.cgi?id=170209
1391         <rdar://problem/31309258>
1392
1393         Reviewed by Tim Horton.
1394
1395         Expose internals.touchEventRectsForEvent() and internals.passiveTouchEventListenerRects(), which
1396         fetch data via Page.
1397
1398         Because the regions are normally updated on a timer, we have to force an eager update via Document::updateTouchEventRegions().
1399
1400         Test: fast/events/touch/ios/touch-event-regions.html
1401
1402         * page/Page.cpp:
1403         (WebCore::Page::nonFastScrollableRects):
1404         (WebCore::Page::touchEventRectsForEvent):
1405         (WebCore::Page::passiveTouchEventListenerRects):
1406         * page/Page.h:
1407         * testing/Internals.cpp:
1408         (WebCore::Internals::touchEventRectsForEvent):
1409         (WebCore::Internals::passiveTouchEventListenerRects):
1410         * testing/Internals.h:
1411         * testing/Internals.idl:
1412
1413 2017-03-29  Zalan Bujtas  <zalan@apple.com>
1414
1415         RenderBlockFlow::addFloatsToNewParent should check if float is already added to the object list.
1416         https://bugs.webkit.org/show_bug.cgi?id=170259
1417         <rdar://problem/31300584>
1418
1419         Reviewed by Simon Fraser.
1420
1421         r210145 assumed that m_floatingObjects would simply ignore the floating box if it was already in the list.  
1422
1423         Test: fast/block/float/placing-multiple-floats-crash.html
1424
1425         * rendering/RenderBlockFlow.cpp:
1426         (WebCore::RenderBlockFlow::addFloatsToNewParent):
1427
1428 2017-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
1429
1430         Try to normalize variation ranges
1431         https://bugs.webkit.org/show_bug.cgi?id=170119
1432
1433         Unreviewed.
1434
1435         Addressing post-review comment.
1436
1437         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1438         (WebCore::isGXVariableFont):
1439
1440 2017-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
1441
1442         Try to normalize variation ranges
1443         https://bugs.webkit.org/show_bug.cgi?id=170119
1444
1445         Reviewed by Simon Fraser.
1446
1447         TrueType GX-style variation fonts use one particular scale for values on their
1448         weight/width/slope axes - usually the values lie between -1 and 1 on that scale.
1449         However, OpenType 1.8-style fonts use the CSS scale for values on these axes.
1450         For the purposes of font selection, these values need to lie on the same scale.
1451         However, when font selection is completed and the variation values are actually
1452         being applied to the fonts, values which lie on the font's actual scale need to
1453         be applied. This patch adds normalize*() and denormalize*() functions to perform
1454         both of these operations. 
1455
1456         The conversion itself between the two scales isn't an exact mapping. Mapping
1457         slope is just a linear relationship with 0deg <=> 0 and 20deg <=> 1 (as per the
1458         CSS Fonts spec). Mapping widths is similar, it uses a 2-component piecewise
1459         linear relationship which includes the values given in the Microsoft OpenType
1460         spec for the OS/2 table's usWidthClass field. Weights are more difficult, so I
1461         plotted the CSS weights and the GX-style weights for every style of San
1462         Francisco, saw that the relationship appears to be linear, and ran a linear
1463         regression to compute the line equation.
1464
1465         As for the actual discrimination of determining whether a font is a GX-style
1466         font or not, we can use the presence of the 'STAT' table. This table didn't
1467         exist when GX fonts were being created, and OpenType 1.8 variable fonts are
1468         required to have this table.
1469
1470         Facebook uses the string ".SFNSText" in their @font-face blocks. This font is
1471         a variation font, but uses the GX-style values. Facebook asks us to create
1472         this font with a weight of 700, and because the values in the font are around
1473         1.0, we were erroneously thinking that the font wasn't bold, so we were then
1474         applying synthetic bold. This was causing text on facebook to look fuzzy and
1475         ugly.
1476
1477         Test: fast/text/variations/font-selection-properties-expected.html
1478
1479         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1480         (WebCore::isGXVariableFont):
1481         (WebCore::normalizeWeight):
1482         (WebCore::normalizeSlope):
1483         (WebCore::denormalizeWeight):
1484         (WebCore::denormalizeWidth):
1485         (WebCore::denormalizeSlope):
1486         (WebCore::normalizeWidth):
1487         (WebCore::preparePlatformFont): Instead of using FontSelectionValues for the
1488         intermediate values, we should use floats instead. This is because
1489         FontSelectionValues are fixed-point numbers with the denominator having 2 bits.
1490         When using this data type to represent values on the GX scale, which are usually
1491         between 0 and 1, you lose a lot of fidelity. Instead, our intermediate
1492         calculations should be done with floats, and converted to FontSelectionValues at
1493         the end when they are representative of values on the CSS scale.
1494         (WebCore::stretchFromCoreTextTraits):
1495         (WebCore::fontWeightFromCoreText):
1496         (WebCore::extractVariationBounds):
1497         (WebCore::variationCapabilitiesForFontDescriptor):
1498         (WebCore::capabilitiesForFontDescriptor):
1499
1500 2017-03-29  Saam Barati  <sbarati@apple.com>
1501
1502         LinkBuffer and ExecutableAllocator shouldn't have anything to do with VM
1503         https://bugs.webkit.org/show_bug.cgi?id=170210
1504
1505         Reviewed by Mark Lam.
1506
1507         * cssjit/SelectorCompiler.cpp:
1508         (WebCore::SelectorCompiler::compileSelector):
1509         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
1510
1511 2017-03-29  Javier Fernandez  <jfernandez@igalia.com>
1512
1513         [css-align] Adapt self-alignment properties to the new baseline syntax
1514         https://bugs.webkit.org/show_bug.cgi?id=170235
1515
1516         Reviewed by David Hyatt.
1517
1518         The baseline-position syntax has changed recently, so we need to update
1519         the CSS properties using the old syntax. This patch address only the
1520         self-alignment (align-self and justify-self) and default-alignment
1521         (align-items and justify-items).
1522
1523         The content-distribution properties (align-content and justify-content)
1524         will be updated in a follow up patch.
1525
1526         The new baseline syntax is "[first | last ]? baseline" which implies
1527         modifying the parsing and computed value logic.
1528
1529         There are several layout tests affected by this change, so I'll update
1530         them accordingly.
1531
1532         No new tests, just added/modified some cases to the tests we already have using the new baseline values.
1533
1534         * css/CSSComputedStyleDeclaration.cpp:
1535         (WebCore::valueForItemPositionWithOverflowAlignment):
1536         * css/CSSValueKeywords.in:
1537         * css/StyleBuilderConverter.h:
1538         (WebCore::StyleBuilderConverter::convertSelfOrDefaultAlignmentData):
1539         * css/parser/CSSPropertyParser.cpp:
1540         (WebCore::consumeBaselineKeyword):
1541         (WebCore::consumeSelfPositionOverflowPosition):
1542
1543 2017-03-29  Chris Dumez  <cdumez@apple.com>
1544
1545         Animated SVG images are not paused in pages loaded in the background
1546         https://bugs.webkit.org/show_bug.cgi?id=170043
1547         <rdar://problem/31234412>
1548
1549         Reviewed by Simon Fraser.
1550
1551         Animated SVG images are not paused in pages loaded in the background. We rely
1552         on FrameView::isOffscreen() to stop images animations in background tab (See
1553         logic in RenderElement's shouldRepaintForImageAnimation()). This works fine
1554         if a tab is visble and then becomes hidden (i.e. by switching to another
1555         tab). However, in the case where the tab gets loaded while in the background
1556         (e.g. opening link in new background tab, or session restore), then the
1557         animations would not be paused, due to FrameView::isOffscreen() erroneously
1558         returning false in this case.
1559
1560         Normally, the following chain of events happens:
1561         - Page is visible, we construct a main frame and its FrameView for loading
1562           the page. When a FrameView is constructed, we call FrameView::show() to
1563           make it visible. Then, if the page becomes non-visible, we call
1564           Page::setIsVisibleInternal(false) which calls FrameView::hide(). After
1565           that, FrameView::isOffscreen() correctly returns true because we properly
1566           called FrameView::hide().
1567
1568         However, when doing a load while the Page is hidden, the following was
1569         happening:
1570         - Page is not visible, we call Page::setIsVisibleInternal(false) which tries
1571           to call FrameView::hide() for the main frame but it does not have a FrameView
1572           yet (because the load has not started). We start the load and end up creating
1573           a FrameView. The FrameView constructor was calling FrameView::show()
1574           unconditionally, thus making the FrameView think is visible, even though its
1575           page isn't. At this point, FrameView::isOffscreen() was returning false
1576           and animations would keep running, even though the page is not visible.
1577
1578         To address the issue, we now call FrameView::show() in FrameView::create() only
1579         if the Page is actually visible, instead of calling it unconditionally. If the
1580         page ever becomes visible, Page::setIsVisibleInternal(true) will be called and
1581         it will take care of calling FrameView::show() then.
1582
1583         Tests: svg/animations/animations-paused-in-background-page-iframe.html
1584                svg/animations/animations-paused-in-background-page.html
1585
1586         * page/FrameView.cpp:
1587         (WebCore::FrameView::create):
1588
1589 2017-03-29  Wenson Hsieh  <wenson_hsieh@apple.com>
1590
1591         Links with empty hrefs should not be drag sources
1592         https://bugs.webkit.org/show_bug.cgi?id=170241
1593         <rdar://problem/31305505>
1594
1595         Reviewed by Tim Horton.
1596
1597         The m_dragSouceAction member of DragController represents the drag source actions that are available to the
1598         document, rather than the available actions given the dragging element. Thus, it is not correct to only check
1599         that (m_dragSourceAction & DragSourceActionAttachment) before proceeding down the attachment dragging codepath.
1600         This should be additionally guarded with a check that the element being dragged is, in fact, an attachment
1601         element.
1602
1603         New API test (see Tools/ChangeLog).
1604
1605         * page/DragController.cpp:
1606         (WebCore::DragController::startDrag):
1607
1608 2017-03-29  Jeremy Jones  <jeremyj@apple.com>
1609
1610         WebVideoFullscreenInterfaceAVKit needs a strong self ref before dispatching to the main thread.
1611         https://bugs.webkit.org/show_bug.cgi?id=170129
1612
1613         Reviewed by David Kilzer.
1614
1615         No new tests becuase no new behavior.
1616
1617         Hold a strong reference to WebVideoFullscreenInterfaceAVKit when dispatching to the main thread.
1618         Make WebVideoFullscreenInterfaceAVKit safe to retain from non-main thread.
1619
1620         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
1621         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1622         (WebVideoFullscreenInterfaceAVKit::exitFullscreen):
1623
1624 2017-03-29  Zan Dobersek  <zdobersek@igalia.com>
1625
1626         [GCrypt] Add a Handle<> class to help with GCrypt object lifetime control
1627         https://bugs.webkit.org/show_bug.cgi?id=170238
1628
1629         Reviewed by Michael Catanzaro.
1630
1631         The platform-specific CryptoAlgorithmHMAC implementation is modified
1632         to showcase the GCrypt::Handle<> use. HandleDeleter<gcry_mac_hd_t>
1633         is added accordingly.
1634
1635         * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
1636         (WebCore::calculateSignature):
1637
1638 2017-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
1639
1640         Variation fonts: Make sure that feature detection and preprocessor macros are right
1641         https://bugs.webkit.org/show_bug.cgi?id=169518
1642
1643         Reviewed by Simon Fraser.
1644
1645         When I added variable fonts support, I made all OSes parse the newly accepted values,
1646         instead of just the OSes which support variable fonts.
1647
1648         Test: fast/text/font-variations-feature-detection.html
1649
1650         * css/parser/CSSPropertyParser.cpp:
1651         (WebCore::consumeFontStretch):
1652         (WebCore::consumeFontStyle):
1653         * css/parser/CSSPropertyParserHelpers.cpp:
1654         (WebCore::CSSPropertyParserHelpers::divisibleBy100):
1655         (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
1656
1657 2017-03-29  Antoine Quint  <graouts@apple.com>
1658
1659         [Modern Media Controls] Controls bar may disappear while captions menu is visible (redux)
1660         https://bugs.webkit.org/show_bug.cgi?id=170239
1661         <rdar://problem/31320685>
1662
1663         Reviewed by Dean Jackson.
1664
1665         We did some work in webkit.org/b/168751 to prevent the controls bar from disappearing while the
1666         captions menu is visible. But there were two cases where the behavior was not as intended:
1667
1668             1. the controls bar would hide upon exiting the video.
1669             2. clicking on the controls bar while the caption panel is up would hide the controls bar
1670                as well as the captions panel.
1671
1672         Instead of determining that the "userInteractionEnabled" property being set to "false" is indicative
1673         of secondary UI, such as the tracks panel, being attached to the controls bar, we now have an
1674         explicit property to specify this. Now, when "hasSecondaryUIAttached" is "true", we prevent the
1675         controls bar from fading when exiting the media.
1676
1677         Additionally, when dismissing the tracks panel, we check whether a mouse event lead to this and check
1678         if the mouse was positioned over the controls bar. If that is the case, we no longer hide the controls
1679         bar and only dismiss the tracks panel.
1680
1681         Test: media/modern-media-controls/tracks-panel/tracks-panel-controls-bar-remains-visible-after-clicking-over-it.html
1682
1683         * Modules/modern-media-controls/controls/controls-bar.js:
1684         (ControlsBar.prototype.set userInteractionEnabled):
1685         (ControlsBar.prototype.handleEvent):
1686         (ControlsBar.prototype._autoHideTimerFired):
1687         * Modules/modern-media-controls/controls/macos-media-controls.js:
1688         (MacOSMediaControls.prototype.showTracksPanel):
1689         (MacOSMediaControls.prototype.hideTracksPanel):
1690
1691 2017-03-29  Antoine Quint  <graouts@apple.com>
1692
1693         [Modern Media Controls] Volume slider is initially empty
1694         https://bugs.webkit.org/show_bug.cgi?id=170237
1695         <rdar://problem/31319077>
1696
1697         Reviewed by Dean Jackson.
1698
1699         Fixing fallout from https://bugs.webkit.org/show_bug.cgi?id=167935 where we changed the behavior
1700         of layout() to happen prior to a commit. In this one instance, we were overriding layout() to run
1701         after a commit, so we now override commit(). Otherwise, the <canvas> that we draw the volume slider
1702         into would have its "width" and "height" properties set after we drew, which would clear the <canvas>.
1703
1704         * Modules/modern-media-controls/controls/slider.js:
1705         (Slider.prototype.commit):
1706         (Slider.prototype.layout): Deleted.
1707
1708 2017-03-29  Zan Dobersek  <zdobersek@igalia.com>
1709
1710         [GCrypt] Move over empty GnuTLS-based SUBTLE_CRYPTO implementation files
1711         https://bugs.webkit.org/show_bug.cgi?id=170232
1712
1713         Reviewed by Michael Catanzaro.
1714
1715         Migrate the GnuTLS SUBTLE_CRYPTO implementation files to the gcrypt/
1716         directory. The implementation files themselves are no-op, so this is
1717         a simple move-and-rename operation that will enable proceeding with
1718         the libgcrypt-based implementation of SUBTLE_CRYPTO functionality.
1719
1720         No change in behavior. The SUBTLE_CRYPTO feature should build as it
1721         did before, and the implementations are empty anyway.
1722
1723         * PlatformGTK.cmake:
1724         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp.
1725         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_CFBGnuTLS.cpp.
1726         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp.
1727         * crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp.
1728         * crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmECDHGnuTLS.cpp.
1729         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmPBKDF2GnuTLS.cpp.
1730         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp.
1731         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp: This one already exists.
1732         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp.
1733         * crypto/gcrypt/CryptoAlgorithmRegistryGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmRegistryGnuTLS.cpp.
1734         * crypto/gcrypt/CryptoKeyECGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoKeyECGnuTLS.cpp.
1735         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoKeyRSAGnuTLS.cpp.
1736         * crypto/gcrypt/SerializedCryptoKeyWrapGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/SerializedCryptoKeyWrapGnuTLS.cpp.
1737         * crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp: Removed.
1738
1739 2017-03-29  Zan Dobersek  <zdobersek@igalia.com>
1740
1741         [GnuTLS] Remove unused CryptoDigestGnuTLS, CryptoAlgorithmHMACGnuTLS implementation files
1742         https://bugs.webkit.org/show_bug.cgi?id=170231
1743
1744         Reviewed by Michael Catanzaro.
1745
1746         * crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp: Removed. The GCrypt counterpart
1747         is already in use, and this file wasn't even being built.
1748
1749 2017-03-29  Youenn Fablet  <youenn@apple.com>
1750
1751         Move DTMF WebRTC extension behind its own compile flag
1752         https://bugs.webkit.org/show_bug.cgi?id=170226
1753
1754         Reviewed by Eric Carlson.
1755
1756         Moving RTCDTMFSender and RTCDTMFToneChangeEvent behinf a WEB_RTC_DTMF compile flag.
1757         This compile flag is not set on any supported platform yet.
1758         Disabling related test and updated test expectations.
1759
1760         * Modules/mediastream/RTCDTMFSender.cpp:
1761         * Modules/mediastream/RTCDTMFSender.h:
1762         * Modules/mediastream/RTCDTMFSender.idl:
1763         * Modules/mediastream/RTCDTMFToneChangeEvent.cpp:
1764         * Modules/mediastream/RTCDTMFToneChangeEvent.h:
1765         * Modules/mediastream/RTCDTMFToneChangeEvent.idl:
1766         * dom/EventNames.in:
1767         * dom/EventTargetFactory.in:
1768         * platform/mediastream/RTCDTMFSenderHandler.h:
1769         * platform/mediastream/RTCDTMFSenderHandlerClient.h:
1770
1771 2017-03-29  Antoine Quint  <graouts@apple.com>
1772
1773         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
1774         https://bugs.webkit.org/show_bug.cgi?id=168409
1775         <rdar://problem/30799198>
1776
1777         Reviewed by Dean Jackson.
1778
1779         Add a new internals setting to opt into ScriptedAnimationController logging through DOM events dispatched
1780         through the document. This should allow this flaky test to get information as to why the frame isn't
1781         firing when it times out.
1782
1783         * dom/ScriptedAnimationController.cpp:
1784         (WebCore::ScriptedAnimationController::suspend):
1785         (WebCore::ScriptedAnimationController::resume):
1786         (WebCore::ScriptedAnimationController::addThrottlingReason):
1787         (WebCore::ScriptedAnimationController::removeThrottlingReason):
1788         (WebCore::ScriptedAnimationController::registerCallback):
1789         (WebCore::ScriptedAnimationController::cancelCallback):
1790         (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
1791         (WebCore::ScriptedAnimationController::scheduleAnimation):
1792         (WebCore::ScriptedAnimationController::dispatchLoggingEventIfRequired):
1793         * dom/ScriptedAnimationController.h:
1794         * page/Settings.in:
1795         * testing/InternalSettings.cpp:
1796         (WebCore::InternalSettings::resetToConsistentState):
1797         (WebCore::InternalSettings::shouldDispatchRequestAnimationFrameEvents):
1798         (WebCore::InternalSettings::setShouldDispatchRequestAnimationFrameEvents):
1799         * testing/InternalSettings.h:
1800         * testing/InternalSettings.idl:
1801
1802 2017-03-28  Youenn Fablet  <youenn@apple.com>
1803
1804         [WebRTC] After r214441 addIceCandidate no longer accepts an RTCIceCandidateInit dictionary
1805         https://bugs.webkit.org/show_bug.cgi?id=170192
1806
1807         Reviewed by Jon Lee.
1808
1809         Covered by updated tests.
1810
1811         * Modules/mediastream/RTCIceCandidate.idl: Candidate is no longer a required field in RTCIceCandidateInit.
1812         * Modules/mediastream/RTCPeerConnectionInternals.js: Reworking defaultsToNull to handle both undefined and null cases.
1813
1814 2017-03-28  Youenn Fablet  <youenn@apple.com>
1815
1816         LibWebRTCProvider should allow setting encoder and decoder factories
1817         https://bugs.webkit.org/show_bug.cgi?id=170212
1818
1819         Reviewed by Eric Carlson.
1820
1821         No change of behavior.
1822         Adding the ability to set encoder/decoder libwebrtc factory getters.
1823         Setting default cocoa factory getters.
1824
1825         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
1826         (WebCore::staticFactoryAndThreads):
1827         (WebCore::initializePeerConnectionFactoryAndThreads):
1828         (WebCore::LibWebRTCProvider::setDecoderFactoryGetter):
1829         (WebCore::LibWebRTCProvider::setEncoderFactoryGetter):
1830         (WebCore::LibWebRTCProvider::setPeerConnectionFactory):
1831         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
1832
1833 2017-03-27  Brent Fulgham  <bfulgham@apple.com>
1834
1835         Only attach Attributes to a given element one time
1836         https://bugs.webkit.org/show_bug.cgi?id=170125
1837         <rdar://problem/31279676>
1838
1839         Reviewed by Chris Dumez.
1840
1841         Attach the attribute node to the Element before calling 'setAttributeInternal', since that method may cause
1842         arbitrary JavaScript events to fire. 
1843
1844         Test: fast/dom/Attr/only-attach-attr-once.html
1845
1846         * dom/Element.cpp:
1847         (WebCore::Element::attachAttributeNodeIfNeeded): Added.
1848         (WebCore::Element::setAttributeNode): Use new method. Revise to attach attribute before calling 'setAttributeInternal'. 
1849         (WebCore::Element::setAttributeNodeNS): Ditto.
1850         * dom/Element.h:
1851
1852 2017-03-28  Youenn Fablet  <youenn@apple.com>
1853
1854         Stop RTCDataChannel when closing page
1855         https://bugs.webkit.org/show_bug.cgi?id=170166
1856
1857         Reviewed by Eric Carlson.
1858
1859         Test: webrtc/datachannel/datachannel-gc.html
1860
1861         Making RTCDataChannel an ActiveDOMObject.
1862         Closing the data channel backend and freeing upon close and stop.
1863
1864         * Modules/mediastream/RTCDataChannel.cpp:
1865         (WebCore::RTCDataChannel::create):
1866         (WebCore::RTCDataChannel::RTCDataChannel):
1867         (WebCore::RTCDataChannel::close):
1868         (WebCore::RTCDataChannel::stop):
1869         * Modules/mediastream/RTCDataChannel.h:
1870         * Modules/mediastream/RTCDataChannel.idl:
1871         * Modules/mediastream/RTCPeerConnection.h:
1872
1873 2017-03-28  Myles C. Maxfield  <mmaxfield@apple.com>
1874
1875         Ranges for variation font properties are not enforced
1876         https://bugs.webkit.org/show_bug.cgi?id=169979
1877
1878         Reviewed by David Hyatt.
1879
1880         The spec specifies that:
1881         - Font weights less than or equal to 0, or greater than or equal to 1000 are parse errors
1882         - Font stretch values less than or equal to 0% are parse errors
1883         - Font style values less than or equal to -90deg or greater than or equal to 90deg are parse errors
1884
1885         Test: fast/text/variations/out-of-bounds-selection-properties.html
1886
1887         * css/parser/CSSPropertyParser.cpp:
1888         (WebCore::consumeFontWeightRange):
1889         (WebCore::fontStretchIsWithinRange):
1890         (WebCore::consumeFontStretch):
1891         (WebCore::consumeFontStretchRange):
1892         (WebCore::fontStyleIsWithinRange):
1893         (WebCore::consumeFontStyle):
1894         (WebCore::consumeFontStyleRange):
1895
1896 2017-03-28  Andy Estes  <aestes@apple.com>
1897
1898         [iOS] Crash in -[WebPreviewLoader failed] when running http/tests/multipart/policy-ignore-crash.php
1899         https://bugs.webkit.org/show_bug.cgi?id=170197
1900         <rdar://problem/30314067>
1901
1902         Reviewed by Brady Eidson.
1903
1904         If QuickLook conversion fails, we call ResourceLoader::didFail() with the NSError from
1905         QuickLook, which will call back into PreviewLoader::didFail(). We only care about network
1906         failures in PreviewLoader, not conversion failures, so check if
1907         m_finishedLoadingDataIntoConverter is set before continuing (like we do in
1908         PreviewLoader::didFinishLoading()).
1909
1910         Fixes crash in http/tests/multipart/policy-ignore-crash.php.
1911
1912         * loader/ios/PreviewLoader.mm:
1913         (WebCore::PreviewLoader::didFail):
1914
1915 2017-03-28  Chris Dumez  <cdumez@apple.com>
1916
1917         Audio indicator is visible on uni-watch.com but there is no audible audio
1918         https://bugs.webkit.org/show_bug.cgi?id=170200
1919         <rdar://problem/31289132>
1920
1921         Reviewed by Eric Carlson.
1922
1923         Cherry-pick the following patch from Blink by <rtoy@chromium.org>:
1924         - https://chromium.googlesource.com/chromium/src.git/+/439de5bb2a31384666db1a0e2dadb2b97d2f3ce4
1925
1926         When the gain of a GainNode is 0 or 1, the operation of the node can
1927         be optimized.  When gain = 1, just copy the input to the output.  When
1928         gain = 0; just zero out the output.  Currently, the input is
1929         multiplied by the gain to produce the output.  This just optimizes the
1930         multiplication away for the two special cases.
1931
1932         Also, have the GainNode set the silence hint if the gain is 0.
1933
1934         And fix a bug in processIfNecessary when unsilenceOutputs was causing the
1935         silence hint to be cleared after the node's process method was finished
1936         and may have set the silence hint.  The processing should come after
1937         unsilenceOutputs to preserve any hints from processing the node.
1938
1939         * Modules/webaudio/AudioNode.cpp:
1940         (WebCore::AudioNode::processIfNecessary):
1941         * Modules/webaudio/GainNode.cpp:
1942         (WebCore::GainNode::process):
1943         * platform/audio/AudioBus.cpp:
1944         (WebCore::AudioBus::copyWithGainFrom):
1945
1946 2017-03-28  Chris Dumez  <cdumez@apple.com>
1947
1948         Animated SVG images are not paused when outside viewport
1949         https://bugs.webkit.org/show_bug.cgi?id=170155
1950         <rdar://problem/31288893>
1951
1952         Reviewed by Antti Koivisto.
1953
1954         Make sure animated SVG images get paused when outside the viewport,
1955         similarly to what was already done for animated GIF images. Also
1956         make sure they are paused when they no longer have any renderers
1957         using them.
1958
1959         Tests: svg/animations/animated-svg-image-outside-viewport-paused.html
1960                svg/animations/animated-svg-image-removed-from-document-paused.html
1961
1962         * loader/cache/CachedImage.cpp:
1963         (WebCore::CachedImage::didAddClient):
1964         Restart the animation whenever a new CachedImage client is added. This
1965         will cause us the re-evaluate if the animation should run. The animation
1966         will pause again if the new renderer is not inside the viewport.
1967
1968         (WebCore::CachedImage::animationAdvanced):
1969         Add a flag to newImageAnimationFrameAvailable() so that the renderers can
1970         let us know if we can pause the animation. Pause the animation if all no
1971         renderer requires it (i.e. they are all outside the viewport, or there
1972         are no renderers).
1973
1974         * loader/cache/CachedImageClient.h:
1975         (WebCore::CachedImageClient::newImageAnimationFrameAvailable):
1976         By default, the CachedImageClients allow pausing. Only renderer will
1977         potentially prevent pausing if they are inside the viewport.
1978
1979         * platform/graphics/BitmapImage.cpp:
1980         (WebCore::BitmapImage::isAnimating):
1981         * platform/graphics/BitmapImage.h:
1982         * platform/graphics/Image.h:
1983         (WebCore::Image::isAnimating):
1984         Add isAnimating() flag on Image for layout testing purposes.
1985
1986         * rendering/RenderElement.cpp:
1987         (WebCore::RenderElement::newImageAnimationFrameAvailable):
1988         Set canPause flag to true if the renderer is not inside the viewport.
1989
1990         (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded):
1991         Call startAnimation() if the renderer is now visible to resume SVG
1992         animations. Repainting is enough for GIF animations but not for SVG
1993         animations, we have to explicitly resume them.
1994
1995         * rendering/RenderElement.h:
1996         * rendering/RenderView.cpp:
1997         (WebCore::RenderView::addRendererWithPausedImageAnimations):
1998         (WebCore::RenderView::removeRendererWithPausedImageAnimations):
1999         (WebCore::RenderView::resumePausedImageAnimationsIfNeeded):
2000         * rendering/RenderView.h:
2001         Store CachedImages with the renderers that have paused animations.
2002         This is required for SVG where we need to explicitly resume the
2003         animation on the CachedImage when the renderer becomes visible
2004         again. Having access to the Image will also allow us to do smarter
2005         visibility checks in RenderElement's shouldRepaintForImageAnimation(),
2006         in the future.
2007
2008         * svg/SVGSVGElement.cpp:
2009         (WebCore::SVGSVGElement::hasActiveAnimation):
2010         * svg/SVGSVGElement.h:
2011         Add hasActiveAnimation() method.
2012
2013         * svg/graphics/SVGImage.cpp:
2014         (WebCore::SVGImage::startAnimation):
2015         Check that animations are paused before starting them. This avoid
2016         jumping due to unnecessary calls to rootElement->setCurrentTime(0).
2017
2018         (WebCore::SVGImage::isAnimating):
2019         Add isAnimating() method for layout tests purposes.
2020
2021         * svg/graphics/SVGImage.h:
2022         * svg/graphics/SVGImageClients.h:
2023         Call animationAdvanced() on the observer instead of the generic
2024         changedInRect() when the SVGImage is animating. This way, we go
2025         through the same code path as GIF animations and we end up calling
2026         CachedImage::animationAdvanced() which calls newImageAnimationFrameAvailable()
2027         on RenderElement, which determines if the animation should keep
2028         running or not.
2029
2030         * testing/Internals.cpp:
2031         (WebCore::Internals::isImageAnimating):
2032         * testing/Internals.h:
2033         * testing/Internals.idl:
2034         Add layout testing infrastructure.
2035
2036 2017-03-28  Antti Koivisto  <antti@apple.com>
2037
2038         Missing render tree position invalidation when tearing down renderers for display:contents subtree
2039         https://bugs.webkit.org/show_bug.cgi?id=170199
2040         <rdar://problem/31260856>
2041
2042         Reviewed by Zalan Bujtas.
2043
2044         Test: fast/shadow-dom/slot-renderer-teardown.html
2045
2046         * style/RenderTreeUpdater.cpp:
2047         (WebCore::RenderTreeUpdater::updateElementRenderer):
2048
2049             Invalidate the render tree position in case we do a teardown for an element without renderer.
2050
2051 2017-03-28  Ryan Haddad  <ryanhaddad@apple.com>
2052
2053         Unreviewed, rolling out r214485.
2054
2055         This change caused LayoutTest crashes.
2056
2057         Reverted changeset:
2058
2059         "Stop RTCDataChannel when closing page"
2060         https://bugs.webkit.org/show_bug.cgi?id=170166
2061         http://trac.webkit.org/changeset/214485
2062
2063 2017-03-28  Anders Carlsson  <andersca@apple.com>
2064
2065         ApplePayShippingContactUpdate.idl shouldn't have status field
2066         https://bugs.webkit.org/show_bug.cgi?id=170202
2067         rdar://problem/31307106
2068
2069         Reviewed by Beth Dakin.
2070
2071         * Modules/applepay/ApplePaySession.cpp:
2072         (WebCore::convertAndValidate):
2073         If status isn't set, infer it based on whether there are errors present or not.
2074
2075         * Modules/applepay/ApplePayShippingContactUpdate.h:
2076         Make status optional here; it's still used by the old code path.
2077
2078         * Modules/applepay/ApplePayShippingContactUpdate.idl:
2079         Remove status here.
2080
2081 2017-03-28  Brian Burg  <bburg@apple.com>
2082
2083         Web Inspector: Add "Disable Caches" option that only applies to the inspected page while Web Inspector is open
2084         https://bugs.webkit.org/show_bug.cgi?id=169865
2085         <rdar://problem/31250573>
2086
2087         Reviewed by Joseph Pecoraro.
2088
2089         Rewrite the network agent's command for disabling resource caching to use Page::setResourceCachingEnabled.
2090         The old implementation was doing weird stuff like setting no-cache headers and evicting the
2091         contents of the memory cache, neither of which is correct. The new approach has no side effects
2092         on the network, disk, or memory cache so it can be turned on temporarily without causing problems.
2093
2094         New tests:
2095         - http/tests/inspector/network/set-resource-caching-disabled-disk-cache.html
2096         - http/tests/inspector/network/set-resource-caching-disabled-memory-cache.html
2097
2098         * inspector/InspectorNetworkAgent.h:
2099         * inspector/InspectorNetworkAgent.cpp:
2100         (WebCore::InspectorNetworkAgent::setCacheDisabled): Deleted.
2101         (WebCore::InspectorNetworkAgent::setResourceCachingDisabled): Added.
2102         Implement new command.
2103
2104         (WebCore::InspectorNetworkAgent::willSendRequest):
2105         (WebCore::InspectorNetworkAgent::mainFrameNavigated):
2106         Remove crufty attempts to break caches. I believe these are intended to defeat caching
2107         proxies and similar middlemen, but this is just as likely to cause unusual loading behavior.
2108
2109         * page/Page.h:
2110         (WebCore::Page::isResourceCachingDisabled):
2111         (WebCore::Page::setResourceCachingDisabledOverride):
2112         Add an override setting so that Web Inspector's override does not mess up the value
2113         of isResourceCachingDisabled that may have been set by a WebKit API client.
2114
2115 2017-03-28  Youenn Fablet  <youenn@apple.com>
2116
2117         Fix addIceCandidate after r214441
2118         https://bugs.webkit.org/show_bug.cgi?id=170146
2119
2120         Reviewed by Chris Dumez.
2121
2122         Covered by rebased test.
2123
2124         * Modules/mediastream/RTCPeerConnection.js:
2125         (addIceCandidate): Setting function length to 1 and throwing if no parameter is passed.
2126
2127 2017-03-28  Youenn Fablet  <youenn@apple.com>
2128
2129         Stop RTCDataChannel when closing page
2130         https://bugs.webkit.org/show_bug.cgi?id=170166
2131
2132         Reviewed by Eric Carlson.
2133
2134         Test: webrtc/datachannel/datachannel-gc.html
2135
2136         Making RTCDataChannel an ActiveDOMObject.
2137         Closing the data channel backend and freeing upon close and stop.
2138
2139         * Modules/mediastream/RTCDataChannel.cpp:
2140         (WebCore::RTCDataChannel::create):
2141         (WebCore::RTCDataChannel::RTCDataChannel):
2142         (WebCore::RTCDataChannel::close):
2143         (WebCore::RTCDataChannel::stop):
2144         * Modules/mediastream/RTCDataChannel.h:
2145         * Modules/mediastream/RTCDataChannel.idl:
2146         * Modules/mediastream/RTCPeerConnection.h:
2147
2148 2017-03-27  Simon Fraser  <simon.fraser@apple.com>
2149
2150         Enhance the touch region debug overlay to show regions for the different events
2151         https://bugs.webkit.org/show_bug.cgi?id=170162
2152
2153         Reviewed by Tim Horton.
2154
2155         Have NonFastScrollableRegionOverlay use a different color for each region in EventTrackingRegions,
2156         and to draw a legend showing what the colors mean.
2157         
2158         On Mac, this overlay displays the non-fast scrollable region (which we don't keep separate from the wheel event
2159         region).
2160
2161         * page/DebugPageOverlays.cpp:
2162         (WebCore::NonFastScrollableRegionOverlay::updateRegion):
2163         (WebCore::touchEventRegionColors):
2164         (WebCore::drawRightAlignedText):
2165         (WebCore::NonFastScrollableRegionOverlay::drawRect):
2166         (WebCore::RegionOverlay::drawRect):
2167         (WebCore::RegionOverlay::drawRegion):
2168
2169 2017-03-27  Simon Fraser  <simon.fraser@apple.com>
2170
2171         Make sure the non-fast scrolling debug overlay is correctly updated
2172         https://bugs.webkit.org/show_bug.cgi?id=170142
2173
2174         Reviewed by Tim Horton.
2175
2176         AsyncScrollingCoordinator::frameViewEventTrackingRegionsChanged() is called on a timer
2177         from Document code, so the existing DebugPageOverlays::didLayout() call at the end
2178         of FrameView::layout() wasn't sufficient to keep the non-fast scrollable region up-to-date
2179         on iOS.
2180
2181         * page/scrolling/AsyncScrollingCoordinator.cpp:
2182         (WebCore::AsyncScrollingCoordinator::frameViewEventTrackingRegionsChanged):
2183
2184 2017-03-28  Antoine Quint  <graouts@apple.com>
2185
2186         [Modern Media Controls] AirPlay placard text looks bad on 1x displays
2187         https://bugs.webkit.org/show_bug.cgi?id=170183
2188         <rdar://problem/30663416>
2189
2190         Reviewed by Dean Jackson.
2191
2192         Use subpixel antialiasing for all text in modern media controls.
2193
2194         * Modules/modern-media-controls/controls/media-controls.css:
2195         (.media-controls-container,):
2196
2197 2017-03-28  Antoine Quint  <graouts@apple.com>
2198
2199         [Modern Media Controls] Improve appearance of tracks panel on macOS
2200         https://bugs.webkit.org/show_bug.cgi?id=168929
2201         <rdar://problem/30741589>
2202
2203         Reviewed by Eric Carlson.
2204
2205         We use a solid color for the focus state that matches the style used on macOS
2206         and blend the titles the same way we blend other non-solid labels in the controls bar.
2207
2208         * Modules/modern-media-controls/controls/tracks-panel.css:
2209         (.tracks-panel section):
2210         (.tracks-panel section > h3):
2211         (.tracks-panel section > ul > li:focus):
2212
2213 2017-03-28  Yoav Weiss  <yoav@yoav.ws>
2214
2215         Add a warning for unused link preloads.
2216         https://bugs.webkit.org/show_bug.cgi?id=165670
2217
2218         Reviewed by Youenn Fablet.
2219
2220         Tests: http/tests/preload/single_download_preload_headers_charset.php
2221                http/tests/preload/unused_preload_warning.html
2222
2223         * dom/Document.cpp:
2224         (WebCore::Document::prepareForDestruction): Stop the timer once the document is destructed.
2225         * loader/LinkPreloadResourceClients.h: Add shouldMarkAsReferenced overides for the LinkPreloadResourceClient classes.
2226         * loader/cache/CachedResource.cpp:
2227         (WebCore::CachedResource::addClientToSet): Make sure LinkPreloadResourceClients don't set resource to be referenced.
2228         * loader/cache/CachedResourceClient.h:
2229         (WebCore::CachedResourceClient::shouldMarkAsReferenced): Make sure that ResourceClients mark preloads as referenced by default.
2230         * loader/cache/CachedResourceLoader.cpp:
2231         (WebCore::CachedResourceLoader::CachedResourceLoader): Initialize timer.
2232         (WebCore::CachedResourceLoader::~CachedResourceLoader): Stop timer.
2233         (WebCore::CachedResourceLoader::documentDidFinishLoadEvent): Trigger a timer if preloads weren't cleared at load time.
2234         (WebCore::CachedResourceLoader::stopUnusedPreloadsTimer): Stop the timer.
2235         (WebCore::CachedResourceLoader::warnUnusedPreloads): Iterate over m_preloads and issue a warning for non-referenced preloads.
2236         * loader/cache/CachedResourceLoader.h:
2237         * page/DOMWindow.cpp:
2238         (WebCore::DOMWindow::willDetachDocumentFromFrame): Clear Resource Timing buffer when document detaches, to avoid test flakiness.
2239
2240 2017-03-28  Antoine Quint  <graouts@apple.com>
2241
2242         REGRESSION: Double-clicking the captions button while the captions popover is open prevents the popover from being opened again
2243         https://bugs.webkit.org/show_bug.cgi?id=170171
2244         <rdar://problem/31095500>
2245
2246         Reviewed by Dean Jackson.
2247
2248         We used to consider that the tracks panel was presented as long as it had a parent, but since we were using for the animated
2249         transition to complete before actually removing the panel from the node hierarchy, consecutive calls to hide then present
2250         would fail to present the panel. We now use a private instance variable to track the presented state which is set immediately
2251         as presentInParent() and hide() are called.
2252
2253         Test: media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button.html
2254
2255         * Modules/modern-media-controls/controls/tracks-panel.js:
2256         (TracksPanel.prototype.get presented):
2257         (TracksPanel.prototype.presentInParent):
2258         (TracksPanel.prototype.hide):
2259
2260 2017-03-28  Aaron Chu  <aaron_chu@apple.com>
2261
2262         AX: Media controls should be able to be re-activated after faded away
2263         https://bugs.webkit.org/show_bug.cgi?id=170048
2264         <rdar://problem/30157179>
2265
2266         Reviewed by Antoine Quint.
2267
2268         Added a "foucsin" listener for the controls bar so that when an element
2269         within fires a "focusin" event, the controls bar reappears if it is faded.
2270
2271         Test: media/modern-media-controls/media-controls/media-controls-appear-when-focus.html
2272
2273         * Modules/modern-media-controls/controls/controls-bar.js:
2274         (ControlsBar.prototype.handleEvent):
2275
2276 2017-03-28  Antoine Quint  <graouts@apple.com>
2277
2278         [Modern Media Controls] Improve media documents across macOS, iPhone and iPad
2279         https://bugs.webkit.org/show_bug.cgi?id=169145
2280         <rdar://problem/17048858>
2281
2282         Reviewed by Dean Jackson.
2283
2284         There were a variety of issues with media documents, some longstanding, and some specifically
2285         about modern media controls.
2286
2287         One issue was that fullscreen and picture-in-picture buttons would show for audio media documents,
2288         due to using a <video> element to load the audio file. We now have additional logic in MediaController
2289         to identify if the loaded media is really an audio file, and using this information to hide the
2290         fullscreen and picture-in-picture buttons.
2291
2292         Another issue was that we would inject style in MediaDocument.cpp that was specific to modern media
2293         controls when we could have the modern-media-controls module injected CSS handle this styling. We now
2294         use the injected style in the shadow root to size media documents based on the device characteristics
2295         and ensuring that page styles are overridden.
2296
2297         We also simplify how MediaDocument.cpp sets the source of the media element to simply use the "src"
2298         attribute and not a <source> element.
2299
2300         Finally, we introduce a MediaDocumentController class that is instantiated when we're dealing with
2301         a media document to hide the controls while we determine the type of media we're loading (audio vs.
2302         video) in order to apply the appropriate styling without flashes.
2303
2304         As a result of the new styles applied by the modern-media-controls module, media documents have a
2305         similar behavior on macOS and iPad, where we only enforce a min-width for video allowing them
2306         to play at their natural size otherwise, and enforcing a fixed width for audio. On iPhone however,
2307         we want to always play the media at full width, with some padding in the case of audio.
2308
2309         Tests: media/modern-media-controls/fullscreen-support/fullscreen-support-disabled-video-with-audio-tracks-only.html
2310                media/modern-media-controls/media-documents/ipad/media-document-audio-ios-sizing.html
2311                media/modern-media-controls/media-documents/ipad/media-document-video-ios-sizing.html
2312                media/modern-media-controls/media-documents/media-document-audio-ios-sizing.html
2313                media/modern-media-controls/media-documents/media-document-audio-mac-sizing.html
2314                media/modern-media-controls/media-documents/media-document-video-ios-sizing.html
2315                media/modern-media-controls/media-documents/media-document-video-mac-sizing.html
2316                media/modern-media-controls/pip-support/pip-support-disabled-video-with-audio-tracks-only.html
2317
2318         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
2319         (:host(audio) .media-controls.ios.inline > .controls-bar:before,):
2320         (:host(audio) .media-controls.ios.inline > .controls-bar:before): Deleted.
2321         * Modules/modern-media-controls/controls/macos-media-controls.css:
2322         (:host(audio) .media-controls.mac.inline > .controls-bar,):
2323         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint,):
2324         (:host(audio) .media-controls.mac.inline > .controls-bar): Deleted.
2325         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint): Deleted.
2326         * Modules/modern-media-controls/controls/media-document.css: Copied from Source/WebCore/Modules/modern-media-controls/controls/macos-media-controls.css.
2327         (:host(.media-document)):
2328         (:host(.media-document.ready)):
2329         (:host(.media-document.audio.mac)):
2330         (:host(.media-document.audio.ipad)):
2331         (:host(.media-document.audio.iphone)):
2332         (:host(.media-document.video.mac)):
2333         (:host(.media-document.video.ipad)):
2334         (:host(.media-document.video.iphone)):
2335         * Modules/modern-media-controls/js-files:
2336         * Modules/modern-media-controls/media/fullscreen-support.js:
2337         (FullscreenSupport.prototype.syncControl):
2338         (FullscreenSupport):
2339         * Modules/modern-media-controls/media/media-controller.js:
2340         (MediaController):
2341         (MediaController.prototype.get isAudio):
2342         * Modules/modern-media-controls/media/media-document-controller.js: Copied from Source/WebCore/Modules/modern-media-controls/media/fullscreen-support.js.
2343         (MediaDocumentController):
2344         (MediaDocumentController.prototype.handleEvent):
2345         (MediaDocumentController.prototype._mediaDocumentHasMetadata):
2346         (MediaDocumentController.prototype._mediaDocumentHasSize):
2347         * Modules/modern-media-controls/media/pip-support.js:
2348         (PiPSupport.prototype.syncControl):
2349         (PiPSupport):
2350         * html/MediaDocument.cpp:
2351         (WebCore::MediaDocumentParser::createDocumentStructure):
2352
2353 2017-03-28  Myles C. Maxfield  <mmaxfield@apple.com>
2354
2355         Follow-up patch after r214364.
2356         https://bugs.webkit.org/show_bug.cgi?id=168895
2357
2358         Unreviewed.
2359
2360         * platform/graphics/FontDescription.cpp:
2361         (WebCore::FontDescription::FontDescription):
2362
2363 2017-03-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
2364
2365         REGRESSION(213764): Large images should not be decoded asynchronously when they are drawn on a canvas
2366         https://bugs.webkit.org/show_bug.cgi?id=169771
2367
2368         Reviewed by Simon Fraser.
2369
2370         Sometimes we have to draw the image immediately like when a canvas calls  
2371         drawImage. In this case we have to decode the image synchronously to guarantee
2372         the drawing. Other times we need to decode with the native size of the image.
2373         The animated images have to be decoded with native size always. Otherwise
2374         the frame cache will be messed up if the same image is animated with different
2375         sizes. Currently we always decode asynchronously with sizeForDrawing. We need
2376         to decouple the decoding mode from the sizeForDrawing.
2377
2378         This patch introduce the DecodingOptions class which can store and compare the
2379         following four cases:
2380             -- Synchronous: The frame has be decoded with native size only.
2381             -- Asynchronous + anySize: This is passed from the Image::draw() callers.
2382             -- Asynchronous + fullSize: The image has to be decoded with its full size.
2383             -- Asynchronous + sizeForDrawing: The image can be decoded with sizeForDrawing unless
2384             it was decoded with either a full size or sizeForDrawing which is larger than the
2385             requested sizeForDrawing.
2386             
2387         A new argument of type DecodingMode will be added to Image::draw() function.
2388         Only when the drawing comes from the render tree, it will be Asynchronous.
2389         Otherwise it will be Synchronous.
2390
2391         Tests: fast/images/animated-image-different-dest-size.html
2392                fast/images/async-image-background-image.html
2393                fast/images/async-image-canvas-draw-image.html
2394
2395         * WebCore.xcodeproj/project.pbxproj:
2396         * platform/graphics/BitmapImage.cpp:
2397         (WebCore::BitmapImage::frameImageAtIndexCacheIfNeeded): Gets the frame image, cache it synchronously if
2398         the current one is invalid. frameImageAtIndex() returns whatever stored in the cache.
2399         (WebCore::BitmapImage::nativeImage): Call frameImageAtIndexCacheIfNeeded() instead of frameImageAtIndex().
2400         (WebCore::BitmapImage::nativeImageForCurrentFrame): Ditto.
2401         (WebCore::BitmapImage::nativeImageOfSize): Ditto.
2402         (WebCore::BitmapImage::framesNativeImages): Ditto.
2403         (WebCore::BitmapImage::draw): Change the logic to do the following:
2404         -- The animated image has to be decoded with its full size.
2405         -- The animated image expects the current frame to be ready for drawing.
2406         -- The large image decoding does not need to call internalStartAnimation().
2407         -- The large image has to request async image decoding but draw the current one if it exists.
2408         (WebCore::BitmapImage::drawPattern): Draw the pattern synchronously.
2409         (WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImages): Delete the call to shouldUseAsyncDecodingForTesting()
2410         since it is only applied for animated images.
2411         (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImages): Call shouldUseAsyncDecodingForAnimatedImageForTesting().
2412         (WebCore::BitmapImage::internalStartAnimation): Request decoding with the full size.
2413         (WebCore::BitmapImage::advanceAnimation): Call shouldUseAsyncDecodingForAnimatedImageForTesting().
2414         (WebCore::BitmapImage::internalAdvanceAnimation): Assert the current frame is not being decoding asynchronously for any size.
2415         (WebCore::BitmapImage::frameImageAtIndex): Deleted. Moved to the header file but with a new purpose: return
2416         the current frame from the frame cache as is; do not cache a new one.
2417         (WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImage): Deleted. Function was renamed to shouldUseAsyncDecodingForLargeImages.
2418         (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImage): Deleted. Function was renamed to shouldUseAsyncDecodingForAnimatedImages.
2419         * platform/graphics/BitmapImage.h:
2420         * platform/graphics/CrossfadeGeneratedImage.cpp:
2421         (WebCore::CrossfadeGeneratedImage::draw): Add a new argument of type DecodingMode.
2422         * platform/graphics/CrossfadeGeneratedImage.h:
2423         * platform/graphics/DecodingOptions.h: Added.
2424         (WebCore::DecodingOptions::DecodingOptions): Default constructor: Synchronous mode.
2425         (WebCore::DecodingOptions::operator==): Compares two DecodingOptions for equality.
2426         (WebCore::DecodingOptions::isSynchronous): Is the frame decoded synchronously?
2427         (WebCore::DecodingOptions::isAsynchronous): Is the frame decoded asynchronously?
2428         (WebCore::DecodingOptions::isAsynchronousCompatibleWith): Is this DecodingOptions compatible with another one?
2429         (WebCore::DecodingOptions::hasFullSize): Is the decoding mode asynchronous but for the image full size?
2430         (WebCore::DecodingOptions::hasSizeForDrawing): Is this decoding mode asynchronous but for a sizeForDrawing?
2431         (WebCore::DecodingOptions::sizeForDrawing): Returns the sizeForDrawing. m_decodingModeOrSize has to hold an IntSize.
2432         (WebCore::DecodingOptions::maxDimension): Moved form ImageFrame.cpp.
2433         (WebCore::DecodingOptions::has): A helper function.
2434         (WebCore::DecodingOptions::hasDecodingMode): Does m_decodingModeOrSize a DecodingMode?
2435         (WebCore::DecodingOptions::hasSize): Does m_decodingModeOrSize an IntSize?
2436         * platform/graphics/GeneratedImage.h: Add a new argument of type DecodingMode.
2437         * platform/graphics/GradientImage.cpp:
2438         (WebCore::GradientImage::draw): Ditto.
2439         * platform/graphics/GradientImage.h: Ditto.
2440         * platform/graphics/GraphicsContext.cpp:
2441         (WebCore::GraphicsContext::drawImage): Pass the ImagePaintingOptions::m_DecodingMode to Image::draw().
2442         * platform/graphics/GraphicsContext.h:
2443         (WebCore::ImagePaintingOptions::ImagePaintingOptions): Add a new member of type DecodingMode to ImagePaintingOptions.
2444         * platform/graphics/Image.cpp:
2445         (WebCore::Image::drawTiled): Pass DecodingMode::Synchronous to Image::draw().
2446         * platform/graphics/Image.h: Add a new argument of type DecodingMode to Image::draw().
2447         * platform/graphics/ImageFrame.cpp:
2448         (WebCore::ImageFrame::operator=): Replace m_sizeForDrawing by m_decodingOptions.
2449         (WebCore::ImageFrame::hasNativeImage): Check if m_nativeImage is valid and the subsamplingLevels match.
2450         (WebCore::ImageFrame::hasFullSizeNativeImage): Checks hasNativeImage() and whether the image frame was
2451         decoded for the image full size.
2452         (WebCore::ImageFrame::hasDecodedNativeImageCompatibleWithOptions): Checks hasNativeImage() and the DecodingOptions match.
2453         (WebCore::maxDimension): Deleted. Moved to DecodingOptions.h.
2454         (WebCore::ImageFrame::isBeingDecoded): Deleted. The check for having an ImageFrame being decoded is
2455         moved to ImageFrameCache.
2456         (WebCore::ImageFrame::hasValidNativeImage): Deleted. No need to this function.
2457         * platform/graphics/ImageFrame.h:
2458         (WebCore::ImageFrame::hasNativeImage): Add an std::optional<SubsamplingLevel> argument.
2459         (WebCore::ImageFrame::hasFullSizeNativeImage): Checks whether the ImageFrame was decoded for the image full size.
2460         (WebCore::ImageFrame::enqueueSizeForDecoding): Deleted.
2461         (WebCore::ImageFrame::dequeueSizeForDecoding): Deleted.
2462         (WebCore::ImageFrame::clearSizeForDecoding): Deleted.
2463         (WebCore::ImageFrame::isBeingDecoded): Deleted.
2464         (WebCore::ImageFrame::sizeForDrawing): Deleted.
2465         (WebCore::ImageFrame::hasDecodedNativeImage): Deleted.
2466         The logic of knowing whether an ImageFrame is being decoded is moved to ImageFrameCache.
2467         * platform/graphics/ImageFrameCache.cpp:
2468         (WebCore::ImageFrameCache::cacheFrameMetadataAtIndex): Caches the metadata of an ImageFrame. If the NativeImage
2469         was decoded for a sizeForDrawing, the size of the ImageFrame will be the nativeImageSize(). Otherwise, the
2470         frameSizeAtIndex() will be called.
2471         (WebCore::ImageFrameCache::cacheFrameNativeImageAtIndex): Cache a new NativeImage which involves caching new
2472         metadata and updating the memory cache. No need to check if the existing native image is valid or not for the
2473         DecodingOptions. Actually it would be a bug if it happens. This is why cacheNativeImageForFrameRequest() asserts
2474         !frame.hasAsyncNativeImage() before calling cacheFrameNativeImageAtIndex().
2475         (WebCore::ImageFrameCache::cacheAsyncFrameNativeImageAtIndex): Cache new NativeImage which was decoded asynchronously.
2476         (WebCore::ImageFrameCache::startAsyncDecodingQueue): Call cacheAsyncFrameNativeImageAtIndex() instead of
2477         cacheNativeImageForFrameRequest() for clarity.
2478         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Call hasAsyncNativeImage() instead of hasValidNativeImage()
2479         Call frameIsDecodingCompatibleWithOptionsAtIndex() instead of frame.isBeingDecoded(). Replace the call to enqueueSizeForDecoding()
2480         by appending the same ImageFrameRequest to m_frameCommitQueue.
2481         (WebCore::ImageFrameCache::isAsyncDecodingQueueIdle): Use m_frameCommitQueue to answer the question whether the decodingQueue is idle.
2482         (WebCore::ImageFrameCache::stopAsyncDecodingQueue): Use m_frameCommitQueue to loop through all the ImageFrames which are currently being decoded.
2483         (WebCore::ImageFrameCache::frameAtIndexCacheIfNeeded): For getting the metadata, this function needs a valid frame. If it is requested
2484         to decode the nativeImage, it has to do it synchronously.
2485         (WebCore::ImageFrameCache::singlePixelSolidColor): Don't cache the frame if it is an animated image or the size is not a single pixel.
2486         (WebCore::ImageFrameCache::frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex): Use m_frameCommitQueue to answer the question whether an ImageFrame
2487         is being decoded and is compatible with DecodingOptions.
2488         (WebCore::ImageFrameCache::frameHasFullSizeNativeImageAtIndex): Calls ImageFrame::hasFullNativeImage() for a frame. 
2489         (WebCore::ImageFrameCache::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex): Calls ImageFrame::hasDecodedNativeImageCompatibleWithOptions() for a frame.
2490         (WebCore::ImageFrameCache::frameImageAtIndex): Returns the current NativeImage without caching.
2491         (WebCore::ImageFrameCache::frameImageAtIndexCacheIfNeeded): Returns the current NativeImage but cache it synchronously if needed.
2492         (WebCore::ImageFrameCache::setFrameNativeImageAtIndex): Deleted.
2493         (WebCore::ImageFrameCache::setFrameMetadataAtIndex): Deleted.
2494         (WebCore::ImageFrameCache::replaceFrameNativeImageAtIndex): Deleted.
2495         (WebCore::ImageFrameCache::frameIsBeingDecodedAtIndex): Deleted.
2496         (WebCore::ImageFrameCache::frameHasImageAtIndex): Deleted.
2497         (WebCore::ImageFrameCache::frameHasValidNativeImageAtIndex): Deleted.
2498         (WebCore::ImageFrameCache::frameHasDecodedNativeImage): Deleted.
2499         * platform/graphics/ImageFrameCache.h: Two ImageFrameRequest queues will be used.
2500         -- The existing one m_frameRequestQueue which is shared between the main thread and decoding thread. The requests will be
2501         dequeued from it before starting the decoding. The decoded NativeImage will be cached only on the main thread. The decoding
2502         thread is not blocked by the callOnMainThread(). This means there might be multiple ImageFrameRequests which were dequeued
2503         while their NativeImages have not been cached yet.
2504         -- A new one m_frameCommitQueue which is track all the ImageFrameRequests whose NativeImages have not been cached yet.
2505         (WebCore::ImageFrameCache::frameAtIndexCacheIfNeeded): Be explicit about caching the image frame. frameImageAtIndex()
2506         returns the current image frame without caching. frameAtIndexCacheIfNeeded(). returns the current image frame but cache
2507         it if needed.
2508         (WebCore::ImageFrameCache::ImageFrameRequest::operator==): Compares two ImageFrameRequests for equality.
2509         * platform/graphics/ImageSource.cpp:
2510         (WebCore::ImageSource::frameImageAtIndexCacheIfNeeded): 
2511         (WebCore::ImageSource::frameImageAtIndex): Deleted.
2512         * platform/graphics/ImageSource.h:
2513         (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex): Change the type of the argument from IntSize to be const std::optional<IntSize>.
2514         (WebCore::ImageSource::frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex): Rename of frameIsBeingDecodedAtIndex(). Replace the argument of type
2515         std::optional<IntSize> by an argument of type DecodingOptions.
2516         (WebCore::ImageSource::frameHasFullSizeNativeImageAtIndex): A wrapper around the ImageFrameCache function.
2517         (WebCore::ImageSource::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex): Ditto.
2518         (WebCore::ImageSource::frameImageAtIndex): Ditto.
2519         (WebCore::ImageSource::frameIsBeingDecodedAtIndex): Deleted.
2520         (WebCore::ImageSource::frameHasValidNativeImageAtIndex): Deleted.
2521         (WebCore::ImageSource::frameHasDecodedNativeImage): Deleted.
2522         * platform/graphics/NamedImageGeneratedImage.cpp:
2523         (WebCore::NamedImageGeneratedImage::draw): Add a new argument of type DecodingMode.
2524         * platform/graphics/NamedImageGeneratedImage.h: Ditto.
2525         * platform/graphics/cairo/ImageBufferCairo.cpp:
2526         (WebCore::ImageBuffer::draw): Add a new argument of type DecodingMode.
2527         * platform/graphics/cg/ImageDecoderCG.cpp:
2528         (WebCore::ImageDecoder::createFrameImageAtIndex): Replace the sizeForDrawing argument by a DecodingMode argument. Add a new handling
2529         for decoding asynchronously for the image full size.
2530         * platform/graphics/cg/ImageDecoderCG.h: Change the prototype of the function.
2531         * platform/graphics/cg/PDFDocumentImage.cpp:
2532         (WebCore::PDFDocumentImage::draw): Add a new argument of type DecodingMode.
2533         * platform/graphics/cg/PDFDocumentImage.h:
2534         * platform/graphics/win/ImageCGWin.cpp:
2535         (WebCore::BitmapImage::getHBITMAPOfSize): Pass DecodingMode::Synchronous to Image::draw().
2536         (WebCore::BitmapImage::drawFrameMatchingSourceSize): Ditto.
2537         * platform/graphics/win/ImageDecoderDirect2D.cpp:
2538         (WebCore::ImageDecoder::createFrameImageAtIndex): Replace the sizeForDrawing argument by a DecodingMode argument.
2539         * platform/graphics/win/ImageDecoderDirect2D.h: Change the prototype of the function.
2540         * platform/image-decoders/ImageDecoder.cpp: 
2541         (WebCore::ImageDecoder::createFrameImageAtIndex): Replace the sizeForDrawing argument by a DecodingMode argument.
2542         * platform/image-decoders/ImageDecoder.h: Change the prototype of the function.
2543         * rendering/RenderBoxModelObject.cpp:
2544         (WebCore::RenderBoxModelObject::paintFillLayerExtended): Draw the background image asynchronously if the image size is large.
2545         * rendering/RenderImage.cpp:
2546         (WebCore::RenderImage::paintIntoRect): Draw the background image element asynchronously if the image size is large.
2547         * svg/graphics/SVGImage.cpp:
2548         (WebCore::SVGImage::drawForContainer): Pass DecodingMode::Synchronous to draw().
2549         (WebCore::SVGImage::nativeImageForCurrentFrame): Ditto.
2550         (WebCore::SVGImage::nativeImage): Ditto.
2551         (WebCore::SVGImage::draw): Add a new argument of type DecodingMode.
2552         * svg/graphics/SVGImage.h: Change the prototype of the function.
2553         * svg/graphics/SVGImageForContainer.cpp:
2554         (WebCore::SVGImageForContainer::draw): Add a new argument of type DecodingMode.
2555         * svg/graphics/SVGImageForContainer.h: Change the prototype of the function.
2556
2557 2017-03-27  Youenn Fablet  <youenn@apple.com>
2558
2559         Activate release libwebrtc logging when WebRTC log channel is on
2560         https://bugs.webkit.org/show_bug.cgi?id=169659
2561
2562         Reviewed by Alex Christensen.
2563
2564         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
2565         (WebCore::initializePeerConnectionFactoryAndThreads):
2566
2567 2017-03-27  Antti Koivisto  <antti@apple.com>
2568
2569         Move visibleInViewportStateChanged callback from Element to render tree
2570         https://bugs.webkit.org/show_bug.cgi?id=170039
2571
2572         Reviewed by Zalan Bujtas.
2573
2574         Make it easier to use from the render tree.
2575
2576         Also for simplicity move the bits from RenderObject rare data to RenderElement.
2577         There is plenty of space there.
2578
2579         * dom/Element.h:
2580         (WebCore::Element::isVisibleInViewportChanged): Deleted.
2581         * html/HTMLMediaElement.h:
2582         * rendering/RenderElement.cpp:
2583         (WebCore::RenderElement::RenderElement):
2584         (WebCore::RenderElement::willBeDestroyed):
2585         (WebCore::RenderElement::registerForVisibleInViewportCallback):
2586         (WebCore::RenderElement::unregisterForVisibleInViewportCallback):
2587         (WebCore::RenderElement::setVisibleInViewportState):
2588         (WebCore::RenderElement::visibleInViewportStateChanged):
2589         * rendering/RenderElement.h:
2590         (WebCore::RenderElement::visibleInViewportState):
2591         * rendering/RenderObject.cpp:
2592         (WebCore::RenderObject::setIsRegisteredForVisibleInViewportCallback): Deleted.
2593         (WebCore::RenderObject::setVisibleInViewportState): Deleted.
2594         * rendering/RenderObject.h:
2595         (WebCore::RenderObject::hasOutlineAutoAncestor):
2596         (WebCore::RenderObject::RenderObjectRareData::RenderObjectRareData):
2597         (WebCore::RenderObject::isRegisteredForVisibleInViewportCallback): Deleted.
2598         (WebCore::RenderObject::visibleInViewportState): Deleted.
2599         * rendering/RenderVideo.cpp:
2600         (WebCore::RenderVideo::visibleInViewportStateChanged):
2601         * rendering/RenderVideo.h:
2602         * rendering/RenderView.cpp:
2603         (WebCore::RenderView::updateVisibleViewportRect):
2604
2605 2017-03-27  Youenn Fablet  <youenn@apple.com>
2606
2607         addIceCandidate should not throw if passed null or undefined
2608         https://bugs.webkit.org/show_bug.cgi?id=170118
2609
2610         Reviewed by Eric Carlson.
2611
2612         Covered by updated test.
2613
2614         A null/undefined candidate passed to addIceCandidate means end of Ice candidate..
2615
2616         * Modules/mediastream/PeerConnectionBackend.cpp:
2617         (WebCore::PeerConnectionBackend::addIceCandidate):
2618         * Modules/mediastream/PeerConnectionBackend.h:
2619         (WebCore::PeerConnectionBackend::endOfIceCandidates):
2620         * Modules/mediastream/RTCPeerConnection.cpp:
2621         (WebCore::RTCPeerConnection::queuedAddIceCandidate):
2622         * Modules/mediastream/RTCPeerConnection.h:
2623         * Modules/mediastream/RTCPeerConnection.idl:
2624         * Modules/mediastream/RTCPeerConnection.js:
2625         (addIceCandidate):
2626
2627 2017-03-27  Antti Koivisto  <antti@apple.com>
2628
2629         Allow the page to render before <link> stylesheet tags in body
2630         https://bugs.webkit.org/show_bug.cgi?id=149157
2631         <rdar://problem/24658830>
2632
2633         Reviewed by Simon Fraser.
2634
2635         Currently we block style and renderer building completely if document has any loading
2636         stylesheets. In case a script queries something layout dependent we construct the render
2637         tree with whatever style we have but block painting in it.
2638
2639         This patch changes behavior so that a loading stylesheet in body only blocks rendering for elements
2640         that are after it. The expectation is that such stylesheets rarely affect elements before them
2641         and the elements can be rendered without causing ugly visible styling changes.
2642
2643         The patch replaces the old flash-of-unstyled-content (FOUC) preventation mechanism with a more
2644         fine-grained one. Paint blocking is now done on per-renderer basis with based on isNonFinal flag in
2645         RenderStyle.
2646
2647         For stylesheets in head the behavior should be largely unchanged.
2648
2649         Test: http/tests/incremental/stylesheet-body-incremental-rendering.html
2650
2651         * css/StyleResolver.cpp:
2652         (WebCore::StyleResolver::pseudoStyleRulesForElement):
2653         * dom/Document.cpp:
2654         (WebCore::Document::Document):
2655         (WebCore::Document::resolveStyle):
2656         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
2657
2658             Remove the old FOUC preventation state tracking.
2659
2660         (WebCore::Document::shouldScheduleLayout):
2661         (WebCore::Document::didRemoveAllPendingStylesheet):
2662
2663             Repaints will now get triggered by the normal style mechanism.
2664
2665         * dom/Document.h:
2666         (WebCore::Document::hasNodesWithNonFinalStyle):
2667         (WebCore::Document::setHasNodesWithNonFinalStyle):
2668
2669             Track if we need to recompute the style later because non-final or unstyled elements.
2670
2671         (WebCore::Document::didLayoutWithPendingStylesheets): Deleted.
2672         (WebCore::Document::hasNodesWithPlaceholderStyle): Deleted.
2673         (WebCore::Document::setHasNodesWithPlaceholderStyle): Deleted.
2674         * html/HTMLFrameSetElement.cpp:
2675         (WebCore::HTMLFrameSetElement::rendererIsNeeded):
2676         * page/FrameView.cpp:
2677         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty):
2678
2679             Don't qualify as visually non-empty if we have loading stylesheets in head (even if there is
2680             a fouc-prevented render tree).
2681
2682         (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
2683         * rendering/RenderBlock.cpp:
2684         (WebCore::RenderBlock::paintContents):
2685
2686             Instead of a global test, block painting if isNonFinal is set in the renderer's style.
2687
2688         * rendering/RenderLayer.cpp:
2689         (WebCore::shouldSuppressPaintingLayer):
2690         * rendering/style/RenderStyle.cpp:
2691         (WebCore::RenderStyle::changeRequiresRepaint):
2692
2693             The isNonFinal flag prevents painting so we need to trigger repaint when it gets cleared.
2694
2695         * rendering/style/RenderStyle.h:
2696         (WebCore::RenderStyle::isNotFinal):
2697         (WebCore::RenderStyle::setIsNotFinal):
2698         (WebCore::RenderStyle::isPlaceholderStyle): Deleted.
2699         (WebCore::RenderStyle::setIsPlaceholderStyle): Deleted.
2700
2701             There is no need for placeholder styles anymore. Reuse the bit for isNotFinal.
2702
2703         * rendering/style/StyleRareNonInheritedData.cpp:
2704         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
2705         (WebCore::StyleRareNonInheritedData::operator==):
2706         * rendering/style/StyleRareNonInheritedData.h:
2707         * style/StyleScope.cpp:
2708         (WebCore::Style::Scope::analyzeStyleSheetChange):
2709         (WebCore::Style::Scope::updateActiveStyleSheets):
2710         * style/StyleTreeResolver.cpp:
2711         (WebCore::Style::TreeResolver::styleForElement):
2712         (WebCore::Style::TreeResolver::resolveElement):
2713
2714             If we have seens a loading stylesheet and don't have a renderer yet don't style the element.
2715             In case there is a renderer or we are ignoring pending sheets, resolve the style normally
2716             but mark it as non-final.
2717
2718         (WebCore::Style::makePlaceholderStyle): Deleted.
2719
2720 2017-03-27  Myles C. Maxfield  <mmaxfield@apple.com>
2721
2722         Test variation font ranges in the CSS Font Loading API
2723         https://bugs.webkit.org/show_bug.cgi?id=170022
2724
2725         Reviewed by Dean Jackson.
2726
2727         Test: fast/text/variations/font-loading-api-parse-ranges.html
2728
2729         Don't use keywords when reporting font variation range values.
2730
2731         * css/CSSComputedStyleDeclaration.cpp:
2732         (WebCore::ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue):
2733         (WebCore::ComputedStyleExtractor::fontWeightFromStyleValue):
2734         (WebCore::ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue):
2735         (WebCore::ComputedStyleExtractor::fontStretchFromStyleValue):
2736         (WebCore::ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue):
2737         (WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
2738         * css/CSSComputedStyleDeclaration.h:
2739         * css/FontFace.cpp:
2740         (WebCore::FontFace::style):
2741         (WebCore::FontFace::weight):
2742         (WebCore::FontFace::stretch):
2743
2744 2017-03-27  Anders Carlsson  <andersca@apple.com>
2745
2746         Propagate shipping contact update errors
2747         https://bugs.webkit.org/show_bug.cgi?id=170141
2748         rdar://problem/31276576
2749
2750         Reviewed by Tim Horton.
2751
2752         * Modules/applepay/ApplePaySession.cpp:
2753         (WebCore::convertAndValidate):
2754
2755 2017-03-27  Ryan Haddad  <ryanhaddad@apple.com>
2756
2757         Unreviewed, rolling out r214411.
2758
2759         Two of the LayoutTests for this change time out on ios-
2760         simulator.
2761
2762         Reverted changeset:
2763
2764         "[Modern Media Controls] Improve media documents across macOS,
2765         iPhone and iPad"
2766         https://bugs.webkit.org/show_bug.cgi?id=169145
2767         http://trac.webkit.org/changeset/214411
2768
2769 2017-03-27  Antoine Quint  <graouts@apple.com>
2770
2771         [Modern Media Controls] Clicking on the tracks button when the tracks panel is up in a media document pauses the video
2772         https://bugs.webkit.org/show_bug.cgi?id=168517
2773         <rdar://problem/30577636>
2774
2775         Reviewed by Dean Jackson.
2776
2777         We completely turn off default event handling in MediaDocument.cpp since we're implementing the
2778         behavior we expect to pause and resume the video in the modern-media-controls module already. This
2779         gets rid of this odd case where the content would not see the "click" event while the C++ side would
2780         handle it and pause the video.
2781
2782         * Modules/modern-media-controls/media/media-controller.js:
2783         (MediaController):
2784         (MediaController.prototype.handleEvent):
2785         (MediaController.prototype._containerWasClicked): Deleted.
2786         * html/MediaDocument.cpp:
2787         (WebCore::MediaDocument::defaultEventHandler):
2788
2789 2017-03-27  Youenn Fablet  <youenn@apple.com>
2790
2791         Tighten RTCDatachannel creation and parameter getters
2792         https://bugs.webkit.org/show_bug.cgi?id=170081
2793
2794         Reviewed by Eric Carlson.
2795
2796         Covered by updated tests.
2797
2798         Adding some parameter checks when creating data channels.
2799         Making some getters nullable as per the spec.
2800
2801         * Modules/mediastream/RTCDataChannel.h:
2802         * Modules/mediastream/RTCDataChannel.idl:
2803         * Modules/mediastream/RTCPeerConnection.cpp:
2804         (WebCore::RTCPeerConnection::createDataChannel):
2805         * Modules/mediastream/RTCPeerConnection.idl:
2806         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2807         (WebCore::LibWebRTCMediaEndpoint::createDataChannel):
2808         (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
2809         * platform/mediastream/RTCDataChannelHandler.h:
2810         (): Deleted.
2811
2812 2017-03-27  Youenn Fablet  <youenn@apple.com>
2813
2814         Add support for RTCRtpReceiver/RTCRtpSender getParameters
2815         https://bugs.webkit.org/show_bug.cgi?id=170057
2816
2817         Reviewed by Alex Christensen.
2818
2819         Test: webrtc/video-getParameters.html
2820
2821         getParameters returns a dictionary of values taken from libwebrtc RtpReceiverInterface/RtpSenderInrterface objects.
2822         Added a direct link between WebCore RTCRtpReceiver and libwebrtc RtpReceiverInterface object.
2823         Making the link between WebCore RTCRtpSender and libwebrtc RtpSenderInrterface object through
2824         PeerConnectionBackend to keep the current architecture shared with OpenWebRTC.
2825         In the future, we should try to make the link more direct.
2826
2827         Added routines to support the conversion from libwebrtc to WebCore.
2828         Ensured that RTCRtpReceiver is cleaning its backend when being stopped.
2829
2830         * CMakeLists.txt:
2831         * DerivedSources.make:
2832         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2833         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
2834         * Modules/mediastream/PeerConnectionBackend.h:
2835         (WebCore::PeerConnectionBackend::getParameters):
2836         * Modules/mediastream/RTCPeerConnection.cpp:
2837         (WebCore::RTCPeerConnection::doClose):
2838         (WebCore::RTCPeerConnection::getParameters):
2839         * Modules/mediastream/RTCPeerConnection.h:
2840         * Modules/mediastream/RTCRtpParameters.h: Added.
2841         * Modules/mediastream/RTCRtpParameters.idl: Added.
2842         * Modules/mediastream/RTCRtpReceiver.cpp:
2843         (WebCore::RTCRtpReceiver::RTCRtpReceiver):
2844         * Modules/mediastream/RTCRtpReceiver.h:
2845         (WebCore::RTCRtpReceiver::Backend::~Backend):
2846         (WebCore::RTCRtpReceiver::Backend::getParameters):
2847         (WebCore::RTCRtpReceiver::create):
2848         (WebCore::RTCRtpReceiver::stop):
2849         (WebCore::RTCRtpReceiver::setBackend):
2850         (WebCore::RTCRtpReceiver::getParameters):
2851         * Modules/mediastream/RTCRtpReceiver.idl:
2852         * Modules/mediastream/RTCRtpSender.cpp:
2853         (WebCore::RTCRtpSender::create):
2854         (WebCore::RTCRtpSender::RTCRtpSender):
2855         (WebCore::RTCRtpSender::replaceTrack):
2856         (WebCore::RTCRtpSender::getParameters):
2857         * Modules/mediastream/RTCRtpSender.h:
2858         (WebCore::RTCRtpSender::Backend::~Backend):
2859         (WebCore::RTCRtpSender::isStopped):
2860         (WebCore::RTCRtpSender::stop):
2861         * Modules/mediastream/RTCRtpSender.idl:
2862         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2863         (WebCore::LibWebRTCMediaEndpoint::addTrack):
2864         (WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
2865         (WebCore::LibWebRTCMediaEndpoint::OnAddTrack):
2866         (WebCore::LibWebRTCMediaEndpoint::stop):
2867         (WebCore::fillEncodingParameters):
2868         (WebCore::fillHeaderExtensionParameters):
2869         (WebCore::fillCodecParameters):
2870         (WebCore::fillRtpParameters):
2871         (WebCore::RTCRtpReceiverBackend::getParameters):
2872         (WebCore::LibWebRTCMediaEndpoint::getRTCRtpSenderParameters):
2873         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2874         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2875         (WebCore::LibWebRTCPeerConnectionBackend::notifyAddedTrack):
2876         (WebCore::LibWebRTCPeerConnectionBackend::getParameters):
2877         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2878         * WebCore.xcodeproj/project.pbxproj:
2879         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
2880
2881 2017-03-27  Myles C. Maxfield  <mmaxfield@apple.com>
2882
2883         font variation properties don't need to accept numbers
2884         https://bugs.webkit.org/show_bug.cgi?id=169357
2885
2886         Reviewed by Antti Koivisto.
2887
2888         The CSS Fonts level 4 spec stabilized the grammar accepted by font-weight,
2889         font-style, and font-stretch. The changes are that font-style and
2890         font-stretch no longer accept raw numbers, and the @font-face descriptor
2891         ranges are now separated by spaces instead of slashes.
2892
2893         Tests: fast/text/font-selection-font-face-parse.html
2894                fast/text/font-selection-font-loading-api-parse.html
2895                fast/text/font-stretch-parse.html
2896                fast/text/font-style-parse.html
2897                fast/text/variations/font-selection-properties.html
2898
2899         * css/CSSComputedStyleDeclaration.cpp:
2900         (WebCore::ComputedStyleExtractor::fontWeightFromStyleValue):
2901         (WebCore::fontWeightFromStyle):
2902         (WebCore::ComputedStyleExtractor::fontStretchFromStyleValue):
2903         (WebCore::fontStretchFromStyle):
2904         (WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
2905         (WebCore::fontStyleFromStyle):
2906         * css/CSSComputedStyleDeclaration.h:
2907         * css/FontFace.cpp:
2908         (WebCore::FontFace::style):
2909         (WebCore::FontFace::weight):
2910         (WebCore::FontFace::stretch):
2911         (WebCore::rangeIsSingleValue): Deleted.
2912         * css/StyleBuilderConverter.h:
2913         (WebCore::StyleBuilderConverter::convertFontStretchFromValue):
2914         * css/parser/CSSPropertyParser.cpp:
2915         (WebCore::consumeFontWeightRange):
2916         (WebCore::consumeFontStretch):
2917         (WebCore::consumeFontStretchRange):
2918         (WebCore::consumeFontStyle):
2919         (WebCore::consumeFontStyleRange):
2920
2921 2017-03-27  Youenn Fablet  <youenn@apple.com>
2922
2923         Further optimize checkWebRTCAvailability
2924         https://bugs.webkit.org/show_bug.cgi?id=169147
2925
2926         Reviewed by Alex Christensen.
2927
2928         Tested locally by removing libwebrtc.dylib.
2929         Replacing dlopen check by checking an exported symbol, rtc::LogMessage::LogToDebug.
2930         This check is more efficient and accurate. It should work in more configurations than the previous one.
2931
2932         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
2933         (WebCore::isNullFunctionPointer):
2934         (WebCore::LibWebRTCProvider::webRTCAvailable):
2935
2936 2017-03-27  Myles C. Maxfield  <mmaxfield@apple.com>
2937
2938         Implement format specifier for variation fonts
2939         https://bugs.webkit.org/show_bug.cgi?id=169327
2940
2941         Reviewed by Simon Fraser.
2942
2943         Variation fonts require the format("woff-variations"), format("truetype-variations"),
2944         and format("opentype-variations") format specifies in @font-face rules.
2945
2946         Test: fast/text/variations/font-face-format.html
2947
2948         * platform/graphics/mac/FontCustomPlatformData.cpp:
2949         (WebCore::FontCustomPlatformData::supportsFormat):
2950
2951 2017-03-27  Myles C. Maxfield  <mmaxfield@apple.com>
2952
2953         Make sure animation works for font-weight, font-stretch, and font-style
2954         https://bugs.webkit.org/show_bug.cgi?id=169683
2955
2956         Reviewed by Simon Fraser.
2957
2958         Hook up animation code for FontSelectionValues.
2959
2960         Tests: animations/font-variations/font-stretch.html
2961                animations/font-variations/font-style.html
2962                animations/font-variations/font-weight.html
2963
2964         * page/animation/CSSPropertyAnimation.cpp:
2965         (WebCore::blendFunc):
2966         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
2967         * rendering/style/RenderStyle.cpp:
2968         (WebCore::RenderStyle::setFontWeight):
2969         (WebCore::RenderStyle::setFontStretch):
2970         (WebCore::RenderStyle::setFontItalic):
2971         * rendering/style/RenderStyle.h:
2972         (WebCore::RenderStyle::fontWeight):
2973         (WebCore::RenderStyle::fontStretch):
2974         (WebCore::RenderStyle::fontItalic):
2975
2976 2017-03-27  Alex Christensen  <achristensen@webkit.org>
2977
2978         Make WebSockets work in network process
2979         https://bugs.webkit.org/show_bug.cgi?id=169930
2980
2981         Reviewed by Youenn Fablet.
2982
2983         Covered by 136 existing tests in http/tests/websocket/tests/hybi
2984         This also does fine with the 544 websocket tests in the web-platform-tests which we have not yet imported.
2985         Also added http/tests/websocket/tests/hybi/network-process-crash-error.html
2986         to test a new condition that couldn't happen before this move: the NetworkProcess crashing.
2987
2988         * Modules/websockets/WebSocketChannel.cpp:
2989         (WebCore::WebSocketChannel::fail):
2990         We were asserting that didCloseSocketStream was called.  It is still called,
2991         but not synchronously like it used to.  This assertion is now invalid, but tests
2992         that would hit it still pass.
2993         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
2994         (WebCore::SocketStreamHandleImpl::platformSendInternal):
2995         CFWriteStreamCanAcceptBytes crashes if you give it a null parameter, and that can happen now.
2996         If we have no write stream, then we cannot write.  Tests that hit this pass still.
2997
2998 2017-03-27  Antoine Quint  <graouts@apple.com>
2999
3000         [Modern Media Controls] Improve media documents across macOS, iPhone and iPad
3001         https://bugs.webkit.org/show_bug.cgi?id=169145
3002         <rdar://problem/17048858>
3003
3004         Reviewed by Dean Jackson.
3005
3006         There were a variety of issues with media documents, some longstanding, and some specifically
3007         about modern media controls.
3008
3009         One issue was that fullscreen and picture-in-picture buttons would show for audio media documents,
3010         due to using a <video> element to load the audio file. We now have additional logic in MediaController
3011         to identify if the loaded media is really an audio file, and using this information to hide the
3012         fullscreen and picture-in-picture buttons.
3013
3014         Another issue was that we would inject style in MediaDocument.cpp that was specific to modern media
3015         controls when we could have the modern-media-controls module injected CSS handle this styling. We now
3016         use the injected style in the shadow root to size media documents based on the device characteristics
3017         and ensuring that page styles are overridden.
3018
3019         We also simplify how MediaDocument.cpp sets the source of the media element to simply use the "src"
3020         attribute and not a <source> element.
3021
3022         Finally, we introduce a MediaDocumentController class that is instantiated when we're dealing with
3023         a media document to hide the controls while we determine the type of media we're loading (audio vs.
3024         video) in order to apply the appropriate styling without flashes.
3025
3026         As a result of the new styles applied by the modern-media-controls module, media documents have a
3027         similar behavior on macOS and iPad, where we only enforce a min-width for video allowing them
3028         to play at their natural size otherwise, and enforcing a fixed width for audio. On iPhone however,
3029         we want to always play the media at full width, with some padding in the case of audio.
3030
3031         Tests: media/modern-media-controls/fullscreen-support/fullscreen-support-disabled-video-with-audio-tracks-only.html
3032                media/modern-media-controls/media-documents/ipad/media-document-audio-ios-sizing.html
3033                media/modern-media-controls/media-documents/ipad/media-document-video-ios-sizing.html
3034                media/modern-media-controls/media-documents/media-document-audio-ios-sizing.html
3035                media/modern-media-controls/media-documents/media-document-audio-mac-sizing.html
3036                media/modern-media-controls/media-documents/media-document-video-ios-sizing.html
3037                media/modern-media-controls/media-documents/media-document-video-mac-sizing.html
3038                media/modern-media-controls/pip-support/pip-support-disabled-video-with-audio-tracks-only.html
3039
3040         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
3041         (:host(audio) .media-controls.ios.inline > .controls-bar:before,):
3042         (:host(audio) .media-controls.ios.inline > .controls-bar:before): Deleted.
3043         * Modules/modern-media-controls/controls/macos-media-controls.css:
3044         (:host(audio) .media-controls.mac.inline > .controls-bar,):
3045         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint,):
3046         (:host(audio) .media-controls.mac.inline > .controls-bar): Deleted.
3047         (:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint): Deleted.
3048         * Modules/modern-media-controls/controls/media-document.css: Added.
3049         (:host(.media-document)):
3050         (:host(.media-document.ready)):
3051         (:host(.media-document.audio.mac)):
3052         (:host(.media-document.audio.ipad)):
3053         (:host(.media-document.audio.iphone)):
3054         (:host(.media-document.video.mac)):
3055         (:host(.media-document.video.ipad)):
3056         (:host(.media-document.video.iphone)):
3057         * Modules/modern-media-controls/js-files:
3058         * Modules/modern-media-controls/media/fullscreen-support.js:
3059         (FullscreenSupport.prototype.syncControl):
3060         (FullscreenSupport):
3061         * Modules/modern-media-controls/media/media-controller.js:
3062         (MediaController):
3063         (MediaController.prototype.get isAudio):
3064         * Modules/modern-media-controls/media/media-document-controller.js: Added.
3065         (MediaDocumentController):
3066         (MediaDocumentController.prototype.handleEvent):
3067         (MediaDocumentController.prototype._mediaDocumentHasMetadata):
3068         (MediaDocumentController.prototype._mediaDocumentHasSize):
3069         * Modules/modern-media-controls/media/pip-support.js:
3070         (PiPSupport.prototype.syncControl):
3071         (PiPSupport):
3072         * html/MediaDocument.cpp:
3073         (WebCore::MediaDocumentParser::createDocumentStructure):
3074
3075 2017-03-25  Chris Dumez  <cdumez@apple.com>
3076
3077         REGRESSION(r214195): zillow.com header video doesn't resume when switching to another tab and back
3078         https://bugs.webkit.org/show_bug.cgi?id=170080
3079         <rdar://problem/31252522>
3080
3081         Reviewed by Eric Carlson.
3082
3083         The video header on zillow.com would pause when switching to another tab after r214195. On
3084         switching back to the zillow.com tab, we would resume the video but fail to take the poster
3085         away, making it look like the video is still paused.
3086
3087         We normally take the poster away when HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable()
3088         is called. However, mediaPlayerFirstVideoFrameAvailable() was only ever called once because of
3089         the m_haveReportedFirstVideoFrame flag in MediaPlayerPrivateAVFoundation::updateStates().
3090         We now reset m_haveReportedFirstVideoFrame to false in updateStates() if hasAvailableVideoFrame()
3091         return false, so that we call mediaPlayerFirstVideoFrameAvailable() again when the return
3092         value of asAvailableVideoFrame() becomes true again (e.g. after the media session interruption
3093         has ended).
3094
3095         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
3096         (WebCore::MediaPlayerPrivateAVFoundation::updateStates):
3097
3098 2017-03-24  Wenson Hsieh  <wenson_hsieh@apple.com>
3099
3100         [WK2] Add a UI delegate SPI hook to enable or disable navigation on drop
3101         https://bugs.webkit.org/show_bug.cgi?id=169168
3102         <rdar://problem/30688374>
3103
3104         Reviewed by Tim Horton.
3105
3106         Refactor client hooks for the drag destination action in WebCore to ask for the drag destination action mask
3107         upon initializing the DragData. In DragController, rather than setting m_dragDestinationAction to the result of
3108         m_client.actionMaskForDrag, we instead set it to the DragData's destination action.
3109
3110         Tests to come in a future patch.
3111
3112         * loader/EmptyClients.cpp:
3113         * page/DragClient.h:
3114
3115         Rather than pass in a DragData, pass in only the platform data that we need to hand to the delegate. This is
3116         because we now ask for drag destination actions prior to creating the DragData.
3117
3118         * page/DragController.cpp:
3119         (WebCore::DragController::dragEnteredOrUpdated):
3120
3121         Update the available drag destination actions in WebCore using the destination actions stored in DragData rather
3122         than calling out to the client delegate.
3123
3124         * loader/EmptyClients.cpp:
3125         * platform/DragData.cpp:
3126         (WebCore::DragData::DragData):
3127         * platform/DragData.h:
3128         (WebCore::DragData::dragDestinationAction):
3129         (WebCore::DragData::operator =):
3130         * platform/mac/DragDataMac.mm:
3131         (WebCore::DragData::DragData):
3132
3133 2017-03-25  Aaron Chu  <aaron_chu@apple.com>
3134
3135         AX: Media controls are unlabeled
3136         https://bugs.webkit.org/show_bug.cgi?id=169947
3137         <rdar://problem/30153323>
3138
3139         Reviewed by Antoine Quint.
3140
3141         Added a "label" property for Icons, which are used to set
3142         the aria-label for the controls in modern media controls.
3143
3144         Test: Addition to all existing modern media controls tests.
3145
3146         * English.lproj/modern-media-controls-localized-strings.js:
3147         * Modules/modern-media-controls/controls/icon-button.js:
3148         (IconButton.prototype.set iconName):
3149         (IconButton.prototype.handleEvent):
3150         (IconButton.prototype._loadImage):
3151         * Modules/modern-media-controls/controls/icon-service.js:
3152         * Modules/modern-media-controls/controls/start-button.js:
3153         (StartButton):
3154         * Modules/modern-media-controls/js-files:
3155
3156 2017-03-25  Carlos Garcia Campos  <cgarcia@igalia.com>
3157
3158         [XDG] MIMETypeRegistry::getMIMETypeForExtension should return a null/empty string when mime type is unknown
3159         https://bugs.webkit.org/show_bug.cgi?id=170050
3160
3161         Reviewed by Michael Catanzaro.
3162
3163         That's what the callers expect, but we alre always returning XDG_MIME_TYPE_UNKNOWN which is
3164         application/octet-stream.
3165
3166         Fixes: plugins/no-mime-with-valid-extension.html
3167
3168         * platform/xdg/MIMETypeRegistryXdg.cpp:
3169         (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
3170
3171 2017-03-24  Myles C. Maxfield  <mmaxfield@apple.com>
3172
3173         Add font-optical-sizing to CSSComputedStyleDeclaration
3174         https://bugs.webkit.org/show_bug.cgi?id=170083
3175
3176         Reviewed by Joseph Pecoraro.
3177
3178         Covered by existing tests.
3179
3180         * css/CSSComputedStyleDeclaration.cpp:
3181
3182 2017-03-24  Daniel Bates  <dabates@apple.com>
3183
3184         media/restore-from-page-cache.html causes NoEventDispatchAssertion::isEventAllowedInMainThread() assertion failure
3185         https://bugs.webkit.org/show_bug.cgi?id=170087
3186         <rdar://problem/31254822>
3187
3188         Reviewed by Simon Fraser.
3189
3190         Reduce the scope of code that should never dispatch DOM events so as to allow updating contents size
3191         after restoring a page from the page cache.
3192
3193         In r214014 we instantiate a NoEventDispatchAssertion in FrameLoader::commitProvisionalLoad()
3194         around the call to CachedPage::restore() to assert when a DOM event is dispatched during
3195         page restoration as such events can cause re-entrancy into the page cache. As it turns out
3196         it is sufficient to ensure that no DOM events are dispatched after restoring all cached frames
3197         as opposed to after CachedPage::restore() returns.
3198
3199         Also rename Document::enqueue{Pageshow, Popstate}Event() to dispatch{Pageshow, Popstate}Event(),
3200         respectively, since they synchronously dispatch events :(. We hope in the future to make them
3201         asynchronously dispatch events.
3202
3203         * dom/Document.cpp:
3204         (WebCore::Document::implicitClose): Update for renaming.
3205         (WebCore::Document::statePopped): Ditto.
3206         (WebCore::Document::dispatchPageshowEvent): Renamed; formerly named enqueuePageshowEvent().
3207         (WebCore::Document::dispatchPopstateEvent): Renamed; formerly named enqueuePopstateEvent().
3208         (WebCore::Document::enqueuePageshowEvent): Deleted.
3209         (WebCore::Document::enqueuePopstateEvent): Deleted.
3210         * dom/Document.h:
3211         * history/CachedPage.cpp:
3212         (WebCore::firePageShowAndPopStateEvents): Moved logic from FrameLoader::didRestoreFromCachedPage() to here.
3213         (WebCore::CachedPage::restore): Modified to call firePageShowAndPopStateEvents().
3214         * loader/FrameLoader.cpp:
3215         (WebCore::FrameLoader::commitProvisionalLoad): Removed use of NoEventDispatchAssertion RAII object. We
3216         will instantiate it in CachedPage::restore() with a smaller scope.
3217         (WebCore::FrameLoader::didRestoreFromCachedPage): Deleted; moved logic from here to WebCore::firePageShowAndPopStateEvents().
3218         * loader/FrameLoader.h:
3219
3220 2017-03-24  Ryan Haddad  <ryanhaddad@apple.com>
3221
3222         Unreviewed, rolling out r214361.
3223
3224         This change caused flakiness in http/tests/preload tests.
3225
3226         Reverted changeset:
3227
3228         "Add a warning for unused link preloads."
3229         https://bugs.webkit.org/show_bug.cgi?id=165670
3230         http://trac.webkit.org/changeset/214361
3231
3232 2017-03-24  Antoine Quint  <graouts@webkit.org>
3233
3234         [Modern Media Controls] Remove placard icon if height is compressed
3235         https://bugs.webkit.org/show_bug.cgi?id=167935
3236         <rdar://problem/30397128>
3237
3238         Reviewed by Dean Jackson.
3239
3240         We make the addition of certain Placard children conditional on the placard's metrics. Whenever the
3241         media controls metrics changes, the placard, if any, is set to have the same metrics and layout() is
3242         called where we ensure that there is enough space, per designs, to have the icon, description and even
3243         the title visible. We also make some CSS improvements to guarantee that the description is laid out on
3244         two lines at most and that both text labels are trimmed elegantly with an ellipsis shold the width be
3245         insufficient to display the whole text.
3246
3247         Since we would have needed to have more width/height setter overrides to trigger layout, we now make
3248         LayoutNode trigger layout() directly and remove the need for subclasses to do this on a per-class basis.
3249         We also make layout() a method that can be called safely anytime as it's now no longer part of the DOM
3250         commit step, a new commit() method is used instead of that.
3251
3252         Tests: media/modern-media-controls/layout-node/node-made-dirty-during-commit.html
3253                media/modern-media-controls/media-controls/media-controls-placard-compressed-metrics.html
3254
3255         * Modules/modern-media-controls/controls/layout-node.js:
3256         (LayoutNode.prototype.set width):
3257         (LayoutNode.prototype.set height):
3258         Trigger a call to layout() anytime "width" or "height" is set on any LayoutNode.
3259
3260         (LayoutNode.prototype.layout):
3261         (LayoutNode.prototype.commit):
3262         (performScheduledLayout):
3263         Make layout() an empty method that subclasses can override easily outside of the DOM commit cycle,
3264         its previous implementation is now called "commit()" which is a more accurate name.
3265
3266         * Modules/modern-media-controls/controls/media-controls.js:
3267         (MediaControls.prototype.get placard):
3268         (MediaControls.prototype.get showsPlacard):
3269         (MediaControls.prototype.showPlacard):
3270         (MediaControls.prototype.hidePlacard):
3271         (MediaControls.prototype.layout):
3272         (MediaControls.prototype.get width): Deleted.
3273         (MediaControls.prototype.set width): Deleted.
3274         Add a "placard" property to make it simpler to reference the placard instead of making assumptions in
3275         several places in that class on the children order. Anytime we run a layout or show the placard, ensure
3276         that the placard metrics are synced with the media controls metrics.
3277
3278         * Modules/modern-media-controls/controls/placard.css:
3279         (.placard .container):
3280         (.placard .title,):
3281         (.placard .description):
3282         We now ensure that both the title and description are trimmed with an ellipsis when we run out of space
3283         to display them fully.
3284
3285         * Modules/modern-media-controls/controls/placard.js:
3286         (Placard.):
3287         (Placard.prototype.layout):
3288         We add new constraints to only show the icon, title and description if the placard is tall and wide enough.
3289
3290         * Modules/modern-media-controls/controls/slider.js:
3291         (Slider.prototype.get width): Deleted.
3292         (Slider.prototype.set width): Deleted.
3293         Removed custom "width" getters and setters now we can just override layout() in case node metrics change.
3294
3295         * Modules/modern-media-controls/controls/time-control.js:
3296         (TimeControl.prototype.set useSixDigitsForTimeLabels):
3297         (TimeControl.prototype.layout):
3298         (TimeControl.prototype.get width): Deleted.
3299         (TimeControl.prototype.set width): Deleted.
3300         (TimeControl.prototype._availableWidthHasChanged): Deleted.
3301         Removed custom "width" getters and setters now we can just override layout() in case node metrics change.
3302
3303         * Modules/modern-media-controls/media/media-controller.js:
3304         (MediaController):
3305         Ensure we flush pending updates at construction time so that we match the size of the media controls right
3306         at the first media layout.
3307
3308 2017-03-24  Eric Carlson  <eric.carlson@apple.com>
3309
3310         [MediaStream] "ideal" constraints passed to getUserMedia should affect fitness score
3311         https://bugs.webkit.org/show_bug.cgi?id=170056
3312
3313         Reviewed by Youenn Fablet.
3314
3315         Include the fitness score calculated for ideal constraints in the calculation of a capture
3316         overall device fitness score. 
3317
3318         No new tests, existing tests updated.
3319
3320         * platform/mediastream/MediaConstraints.cpp:
3321         (WebCore::StringConstraint::fitnessDistance): Drive-by fix: return early if ideal is empty,
3322         not exact.
3323
3324         * platform/mediastream/RealtimeMediaSource.cpp:
3325         (WebCore::RealtimeMediaSource::supportsSizeAndFrameRate): Return fitness distance.
3326         (WebCore::RealtimeMediaSource::selectSettings): Include the fitness distance of supported
3327         ideal constraints.
3328         (WebCore::RealtimeMediaSource::supportsConstraint): New.
3329         (WebCore::RealtimeMediaSource::applyConstraints):
3330         * platform/mediastream/RealtimeMediaSource.h:
3331
3332         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
3333         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints): Sort candidate sources
3334         by their fitness score.
3335
3336         * platform/mock/MockRealtimeVideoSource.cpp:
3337         (WebCore::MockRealtimeVideoSource::initializeCapabilities): Each video source should support
3338         one facing mode, not both.
3339
3340 2017-03-24  Dean Jackson  <dino@apple.com>
3341
3342         Serialization of custom props in longhand should be "" not value of shorthand
3343         https://bugs.webkit.org/show_bug.cgi?id=167699
3344         <rdar://problem/30324200>
3345
3346         Reviewed by Sam Weinig.
3347
3348         https://www.w3.org/TR/css-variables/#variables-in-shorthands says
3349         "Pending-substitution values must be serialized as the empty string, if
3350         an API allows them to be observed."
3351
3352         We were returning the cssText instead.
3353
3354         Test: fast/css/variables/rule-property-get.html has been updated.
3355
3356         * css/StyleProperties.cpp:
3357         (WebCore::StyleProperties::getPropertyValue): Return the empty string
3358         if we're a pending substitution value.
3359
3360 2017-03-24  Wenson Hsieh  <wenson_hsieh@apple.com>
3361
3362         Unreviewed, fix the ToT build on the latest SDK.
3363
3364         Add deprecated declaration guards around two synchronous UIItemProvider methods in WebItemProviderPasteboard.
3365         <rdar://problem/30451096> tracks adoption of the asynchronous versions of these methods.
3366
3367         * platform/ios/WebItemProviderPasteboard.mm:
3368         (-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
3369         (-[WebItemProviderPasteboard _tryToCreateAndAppendObjectOfClass:toArray:usingProvider:]):
3370
3371 2017-03-24  Antoine Quint  <graouts@webkit.org>
3372
3373         [Modern Media Controls] Captions don't move with the appearance of the inline controls
3374         https://bugs.webkit.org/show_bug.cgi?id=170051
3375         <rdar://problem/30754428>
3376
3377         Reviewed by Dean Jackson.
3378
3379         We now size the captions container to account for the controls bar height when visible. To do this,
3380         we use CSS variables to specify the height of the controls bar in default inline mode, compact inline
3381         mode and fullscreen mode.
3382
3383         Test: media/modern-media-controls/tracks-support/tracks-support-captions-offset-with-controls-bar.html
3384
3385         * Modules/modern-media-controls/controls/controls-bar.js:
3386         (ControlsBar.prototype.set faded):
3387         Notify the hosting MediaControls that the "faded" property changed.
3388
3389         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
3390         (.media-controls.ios.inline > .controls-bar):
3391         Use the new --inline-controls-bar-height CSS variable to specify the inline bar height.
3392
3393         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css:
3394         (.media-controls.mac.inline.compact > .controls-bar):
3395         Use the new --inline-compact-controls-bar-height CSS variable to specify the inline bar height.
3396
3397         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
3398         (.media-controls.mac.fullscreen > .controls-bar):
3399         Use the new --fullscreen-controls-bar-height CSS variable to specify the inline bar height.
3400
3401         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
3402         (.media-controls.mac.inline > .controls-bar):
3403         Use the new --inline-controls-bar-height CSS variable to specify the inline bar height.
3404
3405         * Modules/modern-media-controls/controls/media-controls.css:
3406         (*):
3407         Specify new CSS variables for the various controls bar heights.
3408
3409         * Modules/modern-media-controls/controls/media-controls.js:
3410         (MediaControls.prototype.controlsBarFadedStateDidChange):
3411         Notify the delegate of a controls bar "faded" property change. 
3412
3413         * Modules/modern-media-controls/controls/text-tracks.css:
3414         (video::-webkit-media-text-track-container):
3415         (video::-webkit-media-text-track-container.visible-controls-bar):
3416         (video::-webkit-media-text-track-container.visible-controls-bar.compact-controls-bar):
3417         (video::-webkit-media-text-track-display):
3418         Shorten the height of the captions container when the controls bar is visible. We also
3419         fix a couple of prefixed properties that didn't need to be.
3420
3421         * Modules/modern-media-controls/media/media-controller.js:
3422         (MediaController.prototype.controlsBarFadedStateDidChange):
3423         (MediaController.prototype._updateControlsIfNeeded):
3424         (MediaController.prototype._updateTextTracksClassList):
3425         (MediaController):
3426         Ensure we reflect the "faded" state of the controls bar on the captions container using
3427         a CSS class, as well as whether the controls bar mode is compact.
3428
3429 2017-03-24  Brent Fulgham  <bfulgham@apple.com>
3430
3431         Handle recursive calls to ProcessingInstruction::checkStyleSheet
3432         https://bugs.webkit.org/show_bug.cgi?id=169982
3433         <rdar://problem/31083051>
3434
3435         Reviewed by Antti Koivisto.
3436
3437        See if we triggered a recursive load of the stylesheet during the 'beforeload'
3438        event handler. If so, reset to a valid state before completing the load.
3439
3440        We should also check after 'beforeload' that we were not disconnected from (or
3441        moved to a new) document.
3442
3443        I also looked for other cases of this pattern and fixed them, too.
3444
3445        Tests: fast/dom/beforeload/image-removed-during-before-load.html
3446                fast/dom/beforeload/recursive-css-pi-before-load.html
3447                fast/dom/beforeload/recursive-link-before-load.html
3448                fast/dom/beforeload/recursive-xsl-pi-before-load.html
3449
3450         * dom/ProcessingInstruction.cpp:
3451         (WebCore::ProcessingInstruction::clearExistingCachedSheet): Added.
3452         (WebCore::ProcessingInstruction::checkStyleSheet): Prevent recursive calls into
3453         this function during 'beforeload' handling. Also, safely handle the case where
3454         the element was disconnected in the 'beforeload' handler (similar to what
3455         we do in HTMLLinkElement).
3456         (WebCore::ProcessingInstruction::setCSSStyleSheet): Drive-by Fix: Protect the
3457         current document to match what we do in setXSLStyleSheet.
3458         * dom/ProcessingInstruction.h:
3459         * html/HTMLLinkElement.cpp:
3460         (WebCore::HTMLLinkElement::process): Prevent recursive calls into
3461         this function during 'beforeload' handling.
3462         * html/HTMLLinkElement.h:
3463         * loader/ImageLoader.cpp:
3464         (WebCore::ImageLoader::dispatchPendingBeforeLoadEvent): safely handle the case where
3465         the element was disconnected in the 'beforeload' handler (similar to what
3466         we do in HTMLLinkElement).
3467         * style/StyleScope.cpp:
3468         (WebCore::Style::Scope::hasPendingSheet): Added.
3469         * style/StyleScope.h:
3470
3471 2017-03-24  Brady Eidson  <beidson@apple.com>
3472
3473         A null compound index value crashes the Databases process.
3474         <rdar://problem/30499831> and https://bugs.webkit.org/show_bug.cgi?id=170000
3475
3476         Reviewed by Alex Christensen.
3477
3478         Test: storage/indexeddb/modern/single-entry-index-invalid-key-crash.html
3479
3480         * bindings/js/IDBBindingUtilities.cpp:
3481         (WebCore::createKeyPathArray): Fix the bug by rejecting arrays with any invalid keys in them.
3482         
3483         Add some logging:
3484         * Modules/indexeddb/IDBKeyPath.cpp:
3485         (WebCore::loggingString):
3486         * Modules/indexeddb/IDBKeyPath.h:
3487         * Modules/indexeddb/IDBObjectStore.cpp:
3488         (WebCore::IDBObjectStore::createIndex):
3489         * Modules/indexeddb/shared/IDBIndexInfo.cpp:
3490         (WebCore::IDBIndexInfo::loggingString):
3491
3492 2017-03-24  Ryan Haddad  <ryanhaddad@apple.com>
3493
3494         Unreviewed, rolling out r214360.
3495
3496         This change caused 20+ LayoutTest failures.
3497
3498         Reverted changeset:
3499
3500         "Handle recursive calls to
3501         ProcessingInstruction::checkStyleSheet"
3502         https://bugs.webkit.org/show_bug.cgi?id=169982
3503         http://trac.webkit.org/changeset/214360
3504
3505 2017-03-24  Youenn Fablet  <youenn@apple.com>
3506
3507         Add support for qpSum in WebRTC stats
3508         https://bugs.webkit.org/show_bug.cgi?id=170060
3509
3510         Reviewed by Eric Carlson.
3511
3512         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3513         (WebCore::fillRTCRTPStreamStats): exposing libwebrtc qpSum value.
3514
3515 2017-03-24  Daniel Bates  <dabates@apple.com>
3516
3517         Prevent new navigations during document unload
3518         https://bugs.webkit.org/show_bug.cgi?id=169934
3519         <rdar://problem/31247584>
3520
3521         Reviewed by Chris Dumez.
3522
3523         Similar to our policy of preventing new navigations from onbeforeunload handlers
3524         we should prevent new navigations that are initiated during the document unload
3525         process.
3526
3527         The significant part of this change is the instantiation of the RAII object NavigationDisabler
3528         in Document::prepareForDestruction(). The rest of this change just renames class
3529         NavigationDisablerForBeforeUnload to NavigationDisabler now that this RAII class is
3530         used to prevent navigation from both onbeforeunload event handlers and when unloading
3531         a document.
3532
3533         Test: fast/frames/frame-unload-navigate-and-setTimeout-assert-fail.html
3534
3535         * dom/Document.cpp:
3536         (WebCore::Document::prepareForDestruction): Disable new navigations when disconnecting
3537         subframes. Also assert that the document is not in the page cache before we fall off
3538         the end of the function.
3539         * loader/FrameLoader.cpp:
3540         (WebCore::FrameLoader::isNavigationAllowed): Update for renaming below.
3541         (WebCore::FrameLoader::shouldClose): Ditto.
3542         * loader/NavigationScheduler.cpp:
3543         (WebCore::NavigationScheduler::shouldScheduleNavigation): Ditto.
3544         * loader/NavigationScheduler.h:
3545         (WebCore::NavigationDisabler::NavigationDisabler): Renamed class; formerly named NavigationDisablerForBeforeUnload.
3546         (WebCore::NavigationDisabler::~NavigationDisabler): Ditto.
3547         (WebCore::NavigationDisabler::isNavigationAllowed): Ditto.
3548         (WebCore::NavigationDisablerForBeforeUnload::NavigationDisablerForBeforeUnload): Deleted.
3549         (WebCore::NavigationDisablerForBeforeUnload::~NavigationDisablerForBeforeUnload): Deleted.
3550         (WebCore::NavigationDisablerForBeforeUnload::isNavigationAllowed): Deleted.
3551
3552 2017-03-24  Myles C. Maxfield  <mmaxfield@apple.com>
3553
3554         Implement font-optical-sizing
3555         https://bugs.webkit.org/show_bug.cgi?id=168895
3556
3557         Reviewed by Dean Jackson.
3558
3559         Upon advice from Microsoft, the only input to optical sizing is just the
3560         font-size computed value. It is implemented by setting the 'opsz' font
3561         variation axis. Because the propery has such a simple grammar, the
3562         implementation is quite straightforward.
3563
3564         Test: fast/text/variations/optical-sizing.html
3565
3566         * css/CSSComputedStyleDeclaration.cpp:
3567         (WebCore::ComputedStyleExtractor::propertyValue):
3568         * css/CSSPrimitiveValueMappings.h:
3569         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3570         (WebCore::CSSPrimitiveValue::operator FontOpticalSizing):
3571         * css/CSSProperties.json:
3572         * css/parser/CSSParserFastPaths.cpp:
3573         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
3574         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
3575         * platform/graphics/FontCache.h:
3576         (WebCore::FontDescriptionKey::makeFlagsKey):
3577         * platform/graphics/FontDescription.h:
3578         (WebCore::FontDescription::opticalSizing):
3579         (WebCore::FontDescription::setOpticalSizing):
3580         (WebCore::FontDescription::operator==):
3581         (WebCore::FontCascadeDescription::initialOpticalSizing):
3582         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3583         (WebCore::preparePlatformFont):
3584         (WebCore::fontWithFamily):
3585         (WebCore::FontCache::createFontPlatformData):
3586         (WebCore::FontCache::systemFallbackForCharacters):
3587         * platform/graphics/mac/FontCustomPlatformData.cpp:
3588         (WebCore::FontCustomPlatformData::fontPlatformData):
3589         * platform/text/TextFlags.h:
3590
3591 2017-03-24  Chris Dumez  <cdumez@apple.com>
3592
3593         Unreviewed, rolling out r214329.
3594
3595         Significantly regressed Speedometer
3596
3597         Reverted changeset:
3598
3599         "window.crypto.getRandomValues() uses the insecure RC4 RNG"
3600         https://bugs.webkit.org/show_bug.cgi?id=169623
3601         http://trac.webkit.org/changeset/214329
3602
3603 2017-03-24  Yoav Weiss  <yoav@yoav.ws>
3604
3605         Add a warning for unused link preloads.
3606         https://bugs.webkit.org/show_bug.cgi?id=165670
3607
3608         Reviewed by Youenn Fablet.
3609
3610         This patch adds a warning message, to warn developers that are using
3611         link preloads in cases where the downloaded resource is likely to
3612         remain unused.
3613
3614         Test: http/tests/preload/unused_preload_warning.html
3615
3616         * dom/Document.cpp:
3617         (WebCore::Document::prepareForDestruction): Stop the timer once the document is destructed.
3618         * loader/LinkPreloadResourceClients.h: Add shouldMarkAsReferenced overides for the LinkPreloadResourceClient classes.
3619         * loader/cache/CachedResource.cpp:
3620         (WebCore::CachedResource::addClientToSet): Make sure LinkPreloadResourceClients don't set resource to be referenced.
3621         * loader/cache/CachedResourceClient.h:
3622         (WebCore::CachedResourceClient::shouldMarkAsReferenced): Make sure that ResourceClients mark preloads as referenced by default.
3623         * loader/cache/CachedResourceLoader.cpp:
3624         (WebCore::CachedResourceLoader::CachedResourceLoader): Initialize timer.
3625         (WebCore::CachedResourceLoader::~CachedResourceLoader): Stop timer.
3626         (WebCore::CachedResourceLoader::warnUnusedPreloads): Iterate over m_preloads and issue a warning for non-referenced preloads.
3627         (WebCore::CachedResourceLoader::documentDidFinishLoadEvent): Trigger a timer if preloads weren't cleared at load time.
3628         (WebCore::CachedResourceLoader::warnUnusedPreloads): Triggered by the timer, and called CachedResourceLoader::warnUnusedPreloads.
3629         (WebCore::CachedResourceLoader::stopUnusedPreloadsTimer): Stop the timer.
3630
3631 2017-03-24  Brent Fulgham  <bfulgham@apple.com>
3632
3633         Handle recursive calls to ProcessingInstruction::checkStyleSheet
3634         https://bugs.webkit.org/show_bug.cgi?id=169982
3635         <rdar://problem/31083051>
3636
3637         Reviewed by Antti Koivisto.
3638
3639         See if we triggered a recursive load of the stylesheet during the 'beforeload'
3640         event handler. If so, reset to a valid state before completing the load.
3641
3642         We should also check after 'beforeload' that we were not disconnected from (or
3643         moved to a new) document.
3644
3645         I also looked for other cases of this pattern and fixed them.
3646
3647         Tests: fast/dom/beforeload/image-removed-during-before-load.html
3648                fast/dom/beforeload/recursive-css-pi-before-load.html
3649                fast/dom/beforeload/recursive-link-before-load.html
3650                fast/dom/beforeload/recursive-xsl-pi-before-load.html
3651
3652         * dom/ProcessingInstruction.cpp:
3653         (WebCore::ProcessingInstruction::clearExistingCachedSheet): Added.
3654         (WebCore::ProcessingInstruction::checkStyleSheet): Reset to valid state
3655         if necessary after the 'beforeload' handler. Also, safely handle the case where
3656         the element was disconnected in the 'beforeload' handler (similar to what
3657         we do in HTMLLinkElement).
3658         (WebCore::ProcessingInstruction::setCSSStyleSheet): Drive-by Fix: Protect the
3659         current document to match what we do in setXSLStyleSheet.
3660         * dom/ProcessingInstruction.h:
3661         * html/HTMLMediaElement.cpp:
3662         (WebCore::HTMLMediaElement::selectMediaResource): Safely handle the case where
3663         the element was disconnected in the 'beforeload' handler.
3664         (WebCore::HTMLMediaElement::selectNextSourceChild): Ditto.
3665         * loader/ImageLoader.cpp:
3666         (WebCore::ImageLoader::dispatchPendingBeforeLoadEvent): Ditto.
3667
3668 2017-03-24  Myles C. Maxfield  <mmaxfield@apple.com>
3669
3670         font-style needs a new CSSValue to make CSSRule.cssText work correctly
3671         https://bugs.webkit.org/show_bug.cgi?id=169258
3672
3673         Reviewed by David Hyatt.
3674
3675         With variation fonts, font-style's value can't be captured in a CSSPrimitiveValue (nor any other subclass
3676         off CSSValue) any more. Instead, we need to create two new CSSValues which represent the grammar that font-
3677         style and it's associated @font-face descriptor accept.
3678
3679         The grammar of the font-style property is "normal | italic | oblique [ <<angle>> ]?"
3680         The grammar of the font-style descriptor is "normal | italic | oblique [ <<angle>> | <<angle>> <<angle>> ]?"
3681
3682         We currently still support numbers in place of the <<angle>> value (contrary to the spec). We will remove
3683         this support in https://bugs.webkit.org/show_bug.cgi?id=169357.
3684
3685         Tests: fast/text/font-selection-font-face-parse.html:
3686                fast/text/font-style-parse.html:
3687
3688         * CMakeLists.txt:
3689         * WebCore.xcodeproj/project.pbxproj:
3690         * css/CSSAllInOne.cpp:
3691         * css/CSSComputedStyleDeclaration.cpp:
3692         (WebCore::fontStyleFromStyle):
3693         (WebCore::fontShorthandValueForSelectionProperties):
3694         * css/CSSFontFace.cpp:
3695         (WebCore::calculateWeightRange):
3696         (WebCore::calculateStretchRange):
3697         (WebCore::calculateItalicRange):
3698         * css/CSSFontFaceSet.cpp:
3699         (WebCore::computeFontSelectionRequest):
3700         (WebCore::CSSFontFaceSet::matchingFaces):
3701         (WebCore::calculateWeightValue): Deleted.
3702         (WebCore::calculateStretchValue): Deleted.
3703         (WebCore::calculateStyleValue): Deleted.
3704         * css/CSSFontFaceSet.h:
3705         * css/CSSFontSelector.cpp:
3706         (WebCore::CSSFontSelector::addFontFaceRule):
3707         * css/CSSFontStyleRangeValue.cpp: Added.
3708         (WebCore::CSSFontStyleRangeValue::customCSSText):
3709         (WebCore::CSSFontStyleRangeValue::equals):
3710         * css/CSSFontStyleRangeValue.h: Added.
3711         * css/CSSFontStyleValue.cpp: Added.
3712         (WebCore::CSSFontStyleValue::customCSSText):
3713         (WebCore::CSSFontStyleValue::equals):
3714         * css/CSSFontStyleValue.h: Added.
3715         * css/CSSFontValue.cpp:
3716         (WebCore::CSSFontValue::customCSSText):
3717         * css/CSSFontValue.h:
3718         * css/CSSValue.cpp:
3719         (WebCore::CSSValue::equals):
3720         (WebCore::CSSValue::cssText):
3721         (WebCore::CSSValue::destroy):
3722         * css/CSSValue.h:
3723         (WebCore::CSSValue::isFontStyleValue):
3724         (WebCore::CSSValue::isFontStyleRangeValue):
3725         * css/FontFace.cpp:
3726         (WebCore::FontFace::style):
3727         (WebCore::FontFace::weight):
3728         (WebCore::FontFace::stretch):
3729         * css/StyleBuilderConverter.h:
3730         (WebCore::StyleBuilderConverter::convertFontWeightFromValue):
3731         (WebCore::StyleBuilderConverter::convertFontStretchFromValue):
3732         (WebCore::StyleBuilderConverter::convertFontStyleFromValue):
3733         (WebCore::StyleBuilderConverter::convertFontWeight):
3734         (WebCore::StyleBuilderConverter::convertFontStretch):
3735         (WebCore::StyleBuilderConverter::convertFontStyle):
3736         * css/parser/CSSPropertyParser.cpp:
3737         (WebCore::consumeFontStyle):
3738         (WebCore::consumeFontStyleRange):
3739         (WebCore::CSSPropertyParser::consumeSystemFont):
3740         (WebCore::CSSPropertyParser::consumeFont):
3741         * svg/SVGFontFaceElement.cpp:
3742         (WebCore::SVGFontFaceElement::parseAttribute):
3743
3744 2017-03-24  Alex Christensen  <achristensen@webkit.org>
3745
3746         REGRESSION: Content Blocker: Blocking "a[href*=randomString]" doesn't work
3747         https://bugs.webkit.org/show_bug.cgi?id=169167
3748
3749         Reviewed by Simon Fraser.
3750
3751         When testing content extensions, we have always called an API function that internally
3752         has called AtomicString::init somewhere before we start compiling the content extension.
3753         On iOS, though, we call [_WKUserContentExtensionStore compileContentExtensionForIdentifier:...]
3754         without having already called anything that calls AtomicString::init.  The new CSS parser is now
3755         failing to parse some selectors because CSSSelectorParser::defaultNamespace is returning starAtom,
3756         which is a null atomic string before AtomicString::init is called.
3757
3758         Covered by a new API test.
3759
3760         * contentextensions/ContentExtensionParser.cpp:
3761         (WebCore::ContentExtensions::isValidCSSSelector):
3762         (WebCore::ContentExtensions::loadAction):
3763         (WebCore::ContentExtensions::isValidSelector): Deleted.
3764         * contentextensions/ContentExtensionParser.h:
3765         Call AtomicString::init before checking if a css selector is valid.
3766
3767 2017-03-24  Youenn Fablet  <youenn@apple.com>
3768
3769         Add libwebrtc backend support for RTCRtpSender::replaceTrack
3770         https://bugs.webkit.org/show_bug.cgi?id=169841
3771
3772         Reviewed by Alex Christensen.
3773
3774         Tests: webrtc/audio-replace-track.html
3775                webrtc/video-replace-track.html
3776
3777         Adding support for replaceTrack for audio and video sources.
3778         Replacing tracks will always succeed for audio sources.
3779         For video tracks, it will only succeed if the video resolution is not greater.
3780         LibWebRTCPeerConnectionBackend will delegate the track replacing by replacing the source of the outgoing sources with the source wrapped in the replacing track.
3781
3782         Video test is not fully passing as size constraints for mock video sources are not providing the right video stream resolution.
3783
3784         * Modules/mediastream/RTCRtpSender.cpp:
3785         (WebCore::RTCRtpSender::replaceTrack):
3786         * Modules/mediastream/RTCRtpSender.h:
3787         * Modules/mediastream/RTCRtpSender.idl:
3788         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3789         (WebCore::LibWebRTCPeerConnectionBackend::replaceTrack):
3790         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
3791         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
3792         (WebCore::RealtimeOutgoingAudioSource::setSource):
3793         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
3794         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
3795         (WebCore::RealtimeOutgoingVideoSource::setSource):
3796         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
3797         * platform/mock/MockRealtimeVideoSource.cpp:
3798         (WebCore::MockRealtimeVideoSource::drawText):
3799         (WebCore::MockRealtimeVideoSource::generateFrame):
3800
3801 2017-03-24  Jon Lee  <jonlee@apple.com>
3802
3803         Remove comment from RTCStatsReport.idl to convert ssrc to DOMString.
3804         Unreviewed.
3805
3806         Latest available Editor's Draft of WebRTC Statistics API is from 14 December 2016,
3807         but since then, in https://github.com/w3c/webrtc-stats/pull/157, it was changed to become
3808         unsigned long.
3809
3810         * Modules/mediastream/RTCStatsReport.idl:
3811
3812 2017-03-24  Youenn Fablet  <youenn@apple.com>
3813
3814         Add support for DataChannel and MediaStreamTrack stats
3815         https://bugs.webkit.org/show_bug.cgi?id=170031
3816
3817         Reviewed by Eric Carlson.
3818
3819         Tests: webrtc/datachannel/datachannel-stats.html
3820                webrtc/video-mediastreamtrack-stats.html
3821
3822         Exposing libwebrtc stats through WebRTC stats API, gathered for data channel and media stream tracks.
3823
3824         * Modules/mediastream/RTCStatsReport.h:
3825         (WebCore::RTCStatsReport::MediaStreamTrackStats::MediaStreamTrackStats):
3826         (WebCore::RTCStatsReport::DataChannelStats::DataChannelStats):
3827         * Modules/mediastream/RTCStatsReport.idl:
3828         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3829         (WebCore::fillRTCMediaStreamTrackStats):
3830         (WebCore::fillRTCDataChannelStats):
3831         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
3832
3833 2017-03-24  Youenn Fablet  <youenn@apple.com>
3834
3835         Fix framesEncoded/framesDecoded RTC stats
3836         https://bugs.webkit.org/show_bug.cgi?id=170024
3837
3838         Reviewed by Eric Carlson.
3839
3840         Test: webrtc/video-stats.html
3841
3842         Adding access to these fields now that they are available.
3843
3844         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3845         (WebCore::fillInboundRTPStreamStats):
3846         (WebCore::fillOutboundRTPStreamStats):
3847
3848 2017-03-24  Carlos Garcia Campos  <cgarcia@igalia.com>
3849
3850         Unreviewed. Fix GTK+ test /webkit2/WebKitWebView/default-menu after r214244.
3851
3852         Fix mnemonic string of contextMenuItemTagOpenAudioInNewWindow() that I copy pasted from
3853         contextMenuItemTagOpenVideoInNewWindow().
3854
3855         * platform/LocalizedStrings.cpp:
3856         (WebCore::contextMenuItemTagOpenAudioInNewWindow):
3857
3858 2017-03-24  Carlos Garcia Campos  <cgarcia@igalia.com>
3859
3860         [GStreamer] MediaPlayerPrivateGStreamerOwr shouldn't be the default engine
3861         https://bugs.webkit.org/show_bug.cgi?id=170049
3862
3863         Reviewed by Žan Doberšek.
3864
3865         This is causing several media tests to fail after r214338. When trying to load something like this:
3866
3867         http://127.0.0.1:8000/media/resources/serve-video.php?name=../../../../media/content/silence.wav&type=audio/wav&content-length=no&icy-data=yes
3868
3869         since r214338, the content type is known and inferred from the extension in this case, what ends up calling
3870         nextMediaEngine() in MediaPlayer::loadWithNextMediaEngine. That returns the first registered media engine, that
3871         is Owr that doesn't know how to load that and fails.
3872
3873         Fixes: http/tests/media/media-play-stream-chunked-icy.html
3874                http/tests/media/media-seeking-no-ranges-server.html
3875                http/tests/media/video-auth.html
3876                http/tests/media/video-play-stall-before-meta-data.html
3877                http/tests/security/contentSecurityPolicy/audio-redirect-allowed.html
3878                http/tests/security/contentSecurityPolicy/audio-redirect-allowed2.html
3879                http/tests/security/contentSecurityPolicy/audio-redirect-blocked.html
3880                http/tests/security/contentSecurityPolicy/video-redirect-allowed.html
3881                http/tests/security/contentSecurityPolicy/video-redirect-allowed2.html
3882                http/tests/security/contentSecurityPolicy/video-redirect-blocked.html
3883
3884         * platform/graphics/MediaPlayer.cpp:
3885         (WebCore::buildMediaEnginesVector):
3886
3887 2017-03-24  Per Arne Vollan  <pvollan@apple.com>
3888
3889         Text stroke is sometimes clipped on video captions.
3890         https://bugs.webkit.org/show_bug.cgi?id=170006
3891
3892         Reviewed by Eric Carlson.
3893
3894         Set 'overflow' property to 'visible' on cue element to avoid clipping of text stroke.
3895
3896         Updated test media/track/track-css-stroke-cues.html.
3897
3898         * html/track/TextTrackCueGeneric.cpp:
3899         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
3900         * html/track/VTTCue.cpp:
3901         (WebCore::VTTCueBox::applyCSSProperties):
3902
3903 2017-03-24  Carlos Garcia Campos  <cgarcia@igalia.com>
3904
3905         [GTK] Add MIMETypeRegistry implementation using xdgmime and remove the GTK+ one
3906         https://bugs.webkit.org/show_bug.cgi?id=170001
3907
3908         Reviewed by Michael Catanzaro.
3909
3910         The XDG implementation could be used by any port where shared-mime-info is expected to be available. It also
3911         improves the current GTK+ implementation that is based on a very small map of mime types and extensions.
3912
3913         * CMakeLists.txt:
3914         * PlatformGTK.cmake:
3915         * platform/xdg/MIMETypeRegistryXdg.cpp: Renamed from Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp.
3916         (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
3917         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
3918
3919 2017-03-23  Jon Lee  <jonlee@apple.com>
3920
3921         Update createDataChannel on RTCPeerConnection
3922         https://bugs.webkit.org/show_bug.cgi?id=170044
3923
3924         Reviewed by Youenn Fablet.
3925
3926         * Modules/mediastream/RTCPeerConnection.idl: Change label to USVString.
3927
3928 2017-03-23  Antti Koivisto  <antti@apple.com>
3929
3930         Revert r213712, caused iPad PLT regression
3931         https://bugs.webkit.org/show_bug.cgi?id=170040
3932
3933         Unreviewed.
3934
3935         A few subtests have big regressions.
3936
3937         * css