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