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