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