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