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