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