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