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