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