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