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