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