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