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