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