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