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