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