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