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