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