[MediaStream] delete CaptureDeviceInfo struct
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-02-15  Eric Carlson  <eric.carlson@apple.com>
2
3         [MediaStream] delete CaptureDeviceInfo struct
4         https://bugs.webkit.org/show_bug.cgi?id=168395
5
6         The CaptureDeviceInfo struct and CaptureDevice class were almost identical, so
7         add an "enabled" field to the later, delete the former, and switch all uses of
8         CaptureDeviceInfo to CaptureDevice.
9
10         Do some minor drive-by cleanup of AVCaptureDeviceManager::refreshCaptureDevices
11         and CaptureDeviceManager::captureDeviceFromDeviceID.
12         
13         Reviewed by Sam Weinig.
14
15         No new tests, no behavior change.
16
17         * Modules/mediastream/MediaDevicesRequest.cpp:
18         (WebCore::MediaDevicesRequest::start): SourceKind -> DeviceType
19         * platform/mediastream/CaptureDevice.h:
20         (WebCore::CaptureDevice::CaptureDevice):
21         (WebCore::CaptureDevice::type): Renamed from kind.
22         (WebCore::CaptureDevice::setType):
23         (WebCore::CaptureDevice::enabled): Added.
24         (WebCore::CaptureDevice::setEnabled):
25         (WebCore::CaptureDevice::kind): Deleted.
26         (WebCore::CaptureDevice::setKind): Deleted.
27
28         * platform/mediastream/CaptureDeviceManager.cpp:
29         (CaptureDeviceManager::getSourcesInfo):
30         (CaptureDeviceManager::captureDeviceFromDeviceID): Don't call sourceWithUID.
31         (CaptureDeviceManager::bestSourcesForTypeAndConstraints):
32         (CaptureDeviceManager::sourceWithUID):
33         * platform/mediastream/CaptureDeviceManager.h:
34         (WebCore::CaptureDeviceManager::refreshCaptureDevices):
35         (WebCore::CaptureDeviceManager::refreshCaptureDeviceList): Deleted.
36
37         * platform/mediastream/mac/AVCaptureDeviceManager.h:
38         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
39         (WebCore::AVCaptureDeviceManager::captureDevices):
40         (WebCore::deviceIsAvailable):
41         (WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
42         (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints):
43         (WebCore::AVCaptureDeviceManager::deviceConnected):
44         (WebCore::AVCaptureDeviceManager::deviceDisconnected):
45         (WebCore::AVCaptureDeviceManager::captureDeviceList): Deleted.
46         (WebCore::shouldConsiderDeviceInDeviceList): Deleted.
47         (WebCore::AVCaptureDeviceManager::refreshCaptureDeviceList): Deleted.
48         * platform/mock/MockRealtimeMediaSource.cpp:
49         (WebCore::MockRealtimeMediaSource::audioDeviceInfo):
50         (WebCore::MockRealtimeMediaSource::videoDeviceInfo):
51
52 2017-02-15  Sam Weinig  <sam@webkit.org>
53
54         [WebIDL] Remove custom conversion from FontFace code by using a Variant
55         https://bugs.webkit.org/show_bug.cgi?id=168384
56
57         Reviewed by Alex Christensen.
58
59         Match the font face spec and use a union rather than any in the FontFace constructor.
60
61         Test: Added additional cases to fast/text/font-face-javascript.html.
62
63         * css/FontFace.cpp:
64         (WebCore::FontFace::create):
65         * css/FontFace.h:
66         * css/FontFace.idl:
67
68 2017-02-15  Jer Noble  <jer.noble@apple.com>
69
70         Disabled Media Sources should render black/silence
71         https://bugs.webkit.org/show_bug.cgi?id=168281
72
73         Reviewed by Eric Carlson.
74
75         Test: webrtc/video-disabled-black.html
76
77         Pass the enabled flag setting down from the MediaStreamTrackPrivate to its underlying
78         source, including RealtimeMediaSource and RealtimeOutgoingAudio/VideoSource. When either
79         enabled is cleared or muted is set, generate empty (black or silent) media, as opposed to
80         pausing media or (worse) continuing to send generated media.
81
82         * platform/mediastream/MediaStreamTrackPrivate.cpp:
83         (WebCore::MediaStreamTrackPrivate::setEnabled):
84         (WebCore::MediaStreamTrackPrivate::sourceEnabledChanged):
85         * platform/mediastream/MediaStreamTrackPrivate.h:
86         * platform/mediastream/RealtimeMediaSource.cpp:
87         (WebCore::RealtimeMediaSource::setEnabled):
88         * platform/mediastream/RealtimeMediaSource.h:
89         (WebCore::RealtimeMediaSource::enabled):
90         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
91         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
92         (WebCore::MockRealtimeAudioSourceMac::render):
93         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
94         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
95         (WebCore::RealtimeOutgoingAudioSource::sourceEnabledChanged):
96         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
97         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
98         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
99         (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
100         (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
101         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
102         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
103         * platform/mock/MockRealtimeVideoSource.cpp:
104         (WebCore::MockRealtimeVideoSource::generateFrame):
105
106 2017-02-15  Wenson Hsieh  <wenson_hsieh@apple.com>
107
108         Editing history scripts should not add the contenteditable attribute or override key events
109         https://bugs.webkit.org/show_bug.cgi?id=168389
110         <rdar://problem/30529945>
111
112         Reviewed by Dan Bernstein.
113
114         Clients that hook into editing history tracking should handle setting the contenteditable attribute on the body
115         rather than have the script add it to the body. Additionally, this script should NOT be overriding any keydown
116         events. These were initially added for compatibility with a test harness early on, and should have been removed
117         earlier.
118
119         * Scripts/DumpEditingHistory.js:
120
121 2017-02-15  Jer Noble  <jer.noble@apple.com>
122
123         Pass "RequiresCustomURLLoading" in AVURLAsset options dictionary
124         https://bugs.webkit.org/show_bug.cgi?id=168381
125
126         Reviewed by Eric Carlson.
127
128         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
129         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
130
131 2017-02-15  Anders Carlsson  <andersca@apple.com>
132
133         Fix build.
134
135         * page/DragController.cpp:
136         (WebCore::DragController::doSystemDrag):
137
138 2017-02-15  Anders Carlsson  <andersca@apple.com>
139
140         Modernize DragClient::startDrag somewhat
141         https://bugs.webkit.org/show_bug.cgi?id=168379
142
143         Reviewed by Tim Horton.
144
145         Change DragClient::startDrag to take a DragImage instead of a DragImageRef, and to pass along the source action
146         instead of whether it's a link or not.
147
148         * loader/EmptyClients.cpp:
149         * page/DragClient.h:
150         * page/DragController.cpp:
151         (WebCore::DragController::startDrag):
152         (WebCore::DragController::doImageDrag):
153         (WebCore::DragController::doSystemDrag):
154         * page/DragController.h:
155
156 2017-02-15  Chris Dumez  <cdumez@apple.com>
157
158         Expose Symbol.toPrimitive / valueOf on Location instances
159         https://bugs.webkit.org/show_bug.cgi?id=168295
160
161         Reviewed by Geoffrey Garen, Keith Miller and Mark Lam.
162
163         Expose Symbol.toPrimitive / valueOf on Location instances as per:
164         - https://html.spec.whatwg.org/#the-location-interface
165
166         Firefox and Chrome already comply with the specification.
167
168         Tests: fast/dom/location-valueOf-after-object-prototype-update.html
169                fast/dom/location-valueOf-after-object-prototype-update2.html
170                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html
171                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof.html
172
173         * bindings/scripts/CodeGeneratorJS.pm:
174         (GenerateImplementation):
175
176 2017-02-15  Aakash Jain  <aakash_jain@apple.com>
177
178         Remove WebIOSEvent interface
179         https://bugs.webkit.org/show_bug.cgi?id=168368
180
181         Reviewed by Tim Horton.
182
183         * platform/ios/WebEvent.h: Removed WebIOSEvent.
184
185 2017-02-15  Chris Dumez  <cdumez@apple.com>
186
187         [iOS] Form Validation Bubble should be sensitive to Dynamic Type
188         https://bugs.webkit.org/show_bug.cgi?id=168291
189         <rdar://problem/30508593>
190
191         Reviewed by Tim Horton.
192
193         Update ValidationBubble implementation on iOS to stop obeying the
194         minimum font size setting, given that this setting is not exposed
195         on iOS. Instead, we now rely on
196         [UIFont preferredFontForTextStyle:UIFontTextStyleCallout], which
197         will give us a font whose size obeys Dynamic Type [1] setting on iOS.
198
199         [1] https://developer.apple.com/ios/human-interface-guidelines/visual-design/typography/
200
201         No new tests, no easily testable.
202
203         * platform/ios/ValidationBubbleIOS.mm:
204         (WebCore::ValidationBubble::ValidationBubble):
205
206 2017-02-15  Yusuke Suzuki  <utatane.tea@gmail.com>
207
208         [JSC] Drop PassRefPtr
209         https://bugs.webkit.org/show_bug.cgi?id=168320
210
211         Reviewed by Saam Barati.
212
213         * bindings/js/ScriptSourceCode.h:
214         (WebCore::ScriptSourceCode::ScriptSourceCode):
215         Use Ref and pass it to SourceCode.
216
217         * replay/ReplayController.cpp:
218         (WebCore::ReplayController::frameNavigated):
219         Pass reference.
220
221 2017-02-15  Xabier Rodriguez Calvar  <calvaris@igalia.com>
222
223         [GStreamer][MSE][EME] Handle protection event also at decryptor level
224         https://bugs.webkit.org/show_bug.cgi?id=168316
225
226         Reviewed by Žan Doberšek.
227
228         So far in MSE pipeline we were handling the encryption events
229         only when they arrived at the demuxer but this won't work in any
230         kind of key renegotiation as the event will never arrive. Now we
231         connect to the element messages, check for the drm id and send it
232         to the private player for processing.
233
234         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
235         (WebCore::appendPipelineElementMessageCallback):
236         (WebCore::AppendPipeline::AppendPipeline):
237         (WebCore::AppendPipeline::handleElementMessage):
238         * platform/graphics/gstreamer/mse/AppendPipeline.h:
239
240 2017-02-15  Zan Dobersek  <zdobersek@igalia.com>
241
242         [EME] MediaKeys::setServerCertificate() must resolve with 'false' when certificates aren't supported
243         https://bugs.webkit.org/show_bug.cgi?id=168362
244
245         Reviewed by Xabier Rodriguez-Calvar.
246
247         In MediaKeys::setServerCertificate(), when the CDM implementation
248         doesn't support server certificates, it should resolve the promise
249         with the 'false' value, as mandated by the specification, and not
250         reject it.
251
252         A test case in mock-MediaKeys-setServerCertificate.html is updated.
253
254         * Modules/encryptedmedia/MediaKeys.cpp:
255         (WebCore::MediaKeys::setServerCertificate):
256
257 2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
258
259         REGRESSION (r206014): HTTPHeaderMap does not consistently use comma without space to separate values of header fields
260         https://bugs.webkit.org/show_bug.cgi?id=168115
261
262         Reviewed by Darin Adler.
263
264         In r206014 HTTPHeaderMap::add() was updated to combine common headers with ',' instead of ", " to match the
265         fetch specification, but the uncommon headers are still combined with ", ".
266
267         * platform/network/HTTPHeaderMap.cpp:
268         (WebCore::HTTPHeaderMap::add):
269
270 2017-02-14  Ryosuke Niwa  <rniwa@webkit.org>
271
272         An assertion failure inside removeChildren
273         https://bugs.webkit.org/show_bug.cgi?id=168069
274
275         Reviewed by Brent Fulgham.
276
277         The bug was caused by notifyRemovePendingSheet executing scripts synchronously where it shouldn't.
278
279         Removed the call to notifyRemovePendingSheetIfNeeded in notifyChildNodeRemoved. Instead, invoke it
280         in its call sites when they're safe.
281
282         Test: http/tests/security/move-iframe-within-focus-handler-inside-removal.html
283
284         * dom/ContainerNode.cpp:
285         (WebCore::ContainerNode::takeAllChildrenFrom):
286         (WebCore::ContainerNode::notifyChildInserted):
287         (WebCore::ContainerNode::removeChild):
288         (WebCore::ContainerNode::parserRemoveChild):
289         (WebCore::ContainerNode::replaceAllChildren):
290         (WebCore::ContainerNode::removeChildren):
291         * dom/ContainerNodeAlgorithms.cpp:
292         (WebCore::notifyChildNodeRemoved):
293
294 2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
295
296         [GStreamer] Several tests are timing out after r212349
297         https://bugs.webkit.org/show_bug.cgi?id=168359
298
299         Reviewed by Žan Doberšek.
300
301         This is because they are failing the cross origin check. Those tests are not using WebKitWebSrc, but
302         GstFileSrc. I didn't consider the case of source not being a WebKitWebSrc.
303
304         Fixes several timeout instroduced in r212349.
305
306         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
307         (WebCore::MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin): Split the source check in two. First check if
308         it's nullptr, and return false. Then check if it's a WebKitWebSrc and return true if it isn't.
309
310 2017-02-14  Brent Fulgham  <bfulgham@apple.com>
311
312         Revalidate URL after events that could trigger navigations
313         https://bugs.webkit.org/show_bug.cgi?id=168071
314         <rdar://problem/30450379>
315
316         Reviewed by Ryosuke Niwa.
317
318         When arbitary javascript runs during a load, we should revalidate
319         the URLs involved to make sure they are still valid.
320
321         Tests: http/tests/plugins/navigation-during-load-embed.html
322                http/tests/plugins/navigation-during-load.html
323
324         * html/HTMLEmbedElement.cpp:
325         (WebCore::HTMLEmbedElement::updateWidget): Confirm we are still allowed to
326         load the URL after executing JS callbacks.
327         * html/HTMLFrameElementBase.cpp:
328         (WebCore::HTMLFrameElementBase::isURLAllowed): Split existing function into
329         existing protected method, and a new public method that checks a passed URL
330         for validity.
331         * html/HTMLFrameElementBase.h:
332         * html/HTMLFrameOwnerElement.h:
333         (WebCore::HTMLFrameOwnerElement::isURLAllowed):
334         * html/HTMLObjectElement.cpp:
335         (WebCore::HTMLObjectElement::updateWidget): Confirm we are still allowed to
336         load the URL after executing JS callbacks.
337         * loader/SubframeLoader.cpp:
338         (WebCore::SubframeLoader::requestFrame): Ditto.
339
340 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
341
342         [GStreamer] Implement MediaPlayerPrivate::hasSingleSecurityOrigin()
343         https://bugs.webkit.org/show_bug.cgi?id=168322
344
345         Reviewed by Žan Doberšek.
346
347         It currently returns true unconditionally. Add resolved-location property to WebKitWebSourceGStreamer to track
348         the resolved url returned by the server and use that from MediaPlayerPrivate to check if there was a cross
349         origin redirection.
350
351         Fixes: http/tests/security/canvas-remote-read-remote-video-redirect.html
352
353         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
354         (WebCore::MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin):
355         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
356         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
357         (webKitWebSrcFinalize):
358         (webKitWebSrcGetProperty):
359         (webKitWebSrcStart):
360         (webKitWebSrcQueryWithParent):
361         (webKitWebSrcGetUri):
362         (webKitWebSrcSetUri):
363         (StreamingClient::handleResponseReceived):
364         (ResourceHandleStreamingClient::wasBlocked):
365         (ResourceHandleStreamingClient::cannotShowURL):
366
367 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
368
369         Unreviewed, rolling out r211967.
370
371         Caused rendering issues in HiDPI
372
373         Reverted changeset:
374
375         "[GTK] scroll with transparent background not repainted after
376         scrollY >= 32768"
377         https://bugs.webkit.org/show_bug.cgi?id=154283
378         http://trac.webkit.org/changeset/211967
379
380 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
381
382         [GTK] Update cookie manager API to properly work with ephemeral sessions
383         https://bugs.webkit.org/show_bug.cgi?id=168230
384
385         Reviewed by Michael Catanzaro.
386
387         Add implementation for deleteAllCookiesModifiedSince. Note that this only works when the timespan is 0, we need
388         new libsoup API to support removing recently modified cookies.
389
390         * platform/network/soup/CookieJarSoup.cpp:
391         (WebCore::deleteAllCookiesModifiedSince):
392
393 2017-02-14  Joseph Pecoraro  <pecoraro@apple.com>
394
395         [WebIDL] Improve serializer = { inherit }
396         https://bugs.webkit.org/show_bug.cgi?id=168293
397
398         Reviewed by Youenn Fablet.
399
400         * bindings/scripts/CodeGeneratorJS.pm:
401         (GenerateHeader):
402         Expose a serialize() method on the interface.
403
404         (GenerateSerializerFunction):
405         (GenerateSerializerAttributesForInterface): Deleted.
406         Subclasses that have `serializer = { inherit }` can use
407         their parent's serialize() method to get the initial object.
408         We can now collapse everything back into a single function
409         because we only generate code for our own attributes.
410
411         * bindings/scripts/test/JS/JSTestNode.cpp:
412         (WebCore::JSTestNode::serialize):
413         (WebCore::jsTestNodePrototypeFunctionToJSONCaller):
414         * bindings/scripts/test/JS/JSTestNode.h:
415         * bindings/scripts/test/JS/JSTestObj.cpp:
416         (WebCore::JSTestObj::serialize):
417         (WebCore::jsTestObjPrototypeFunctionToJSONCaller):
418         * bindings/scripts/test/JS/JSTestObj.h:
419         * bindings/scripts/test/JS/JSTestSerialization.cpp:
420         (WebCore::JSTestSerialization::serialize):
421         (WebCore::jsTestSerializationPrototypeFunctionToJSONCaller):
422         * bindings/scripts/test/JS/JSTestSerialization.h:
423         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
424         (WebCore::JSTestSerializationInherit::serialize):
425         (WebCore::jsTestSerializationInheritPrototypeFunctionToJSONCaller):
426         * bindings/scripts/test/JS/JSTestSerializationInherit.h:
427         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
428         (WebCore::JSTestSerializationInheritFinal::serialize):
429         (WebCore::jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller):
430         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
431         Updated results.
432
433 2017-02-14  Aakash Jain  <aakash_jain@apple.com>
434
435         Move methods from WebCoreThread.h to WebCoreThreadInternal.h
436         https://bugs.webkit.org/show_bug.cgi?id=168326
437
438         Reviewed by Alexey Proskuryakov.
439
440         * platform/ios/wak/WebCoreThread.h: Move methods WebThreadRunLoop and WebThreadCurrentContext to WebCoreThreadInternal.h
441         * platform/ios/wak/WebCoreThreadInternal.h: Ditto.
442         * platform/ios/wak/WebCoreThreadRun.cpp: Removed WebCoreThread.h as it is already included by WebCoreThreadInternal.h
443         * platform/ios/wak/WKGraphics.mm: Included WebCoreThreadInternal.h, it subsequently includes WebCoreThread.h
444         * inspector/InspectorTimelineAgent.cpp: Ditto.
445         * page/mac/PageMac.mm: Ditto.
446         * platform/cf/MainThreadSharedTimerCF.cpp: Ditto.
447         * platform/cocoa/MemoryPressureHandlerCocoa.mm: Ditto.
448         * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp: Ditto.
449         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp: Ditto.
450         * bindings/js/CommonVM.cpp: included WebCoreThreadInternal.h
451
452 2017-02-14  Wenson Hsieh  <wenson_hsieh@apple.com>
453
454         [WK2] Support data interaction on links
455         https://bugs.webkit.org/show_bug.cgi?id=168331
456         <rdar://problem/30200837>
457
458         Reviewed by Tim Horton.
459
460         Adds support for data interaction on links at the WebCore layer, refactoring some drag-and-drop code on the Mac
461         along the way. Also adds two new TestWebKitAPI unit tests in DataInteractionTests.mm: LinkToInput and
462         BackgroundImageLinkToInput (see Tools/ChangeLog for more information).
463
464         * page/DragController.cpp:
465         (WebCore::DragController::startDrag):
466         (WebCore::DragController::doImageDrag):
467         (WebCore::DragController::doSystemDrag):
468
469         Introduce platformAdjustDragImageForDeviceScaleFactor, and special-case drag images for links to anchor at the
470         bottom center.
471
472         * platform/DragImage.cpp:
473         (WebCore::platformAdjustDragImageForDeviceScaleFactor):
474
475         Scale the drag image up by the device scale factor. In WebDragClient, we scale the image back down to the
476         original size. It seems the reason we do this extra dance is because the image sizing heuristic in between
477         assumes that the image dimensions are for a non-retina device, but this work should really not be necessary if
478         we tweak the heuristic to account for deviceScaleFactor. We should address this in a separate patch.
479
480         * platform/DragImage.h:
481         * platform/graphics/Path.h:
482
483 2017-02-14  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>
484
485         [CURL] ResourceError created with error information should have default type Type::General
486         https://bugs.webkit.org/show_bug.cgi?id=168345
487
488         Reviewed by Alex Christensen.
489
490         ResourceError has separate implementaion for each platform
491         so that the interface should be same.
492         On CURL port, the constructor with error information has
493         different default value on `type` parameter. It is Type::Null but other implementaitons have Type::General.
494         This causes some ResourceError is created inconsistent. 
495
496         * platform/network/curl/ResourceError.h:
497         (WebCore::ResourceError::ResourceError):
498
499 2017-02-14  Youenn Fablet  <youennf@gmail.com>
500
501         [WebRTC] Add support for libwebrtc negotiation needed event
502         https://bugs.webkit.org/show_bug.cgi?id=168267
503
504         Reviewed by Eric Carlson.
505
506         Test: webrtc/negotiatedneeded-event-addStream.html
507
508         Moving generic code (markAsNeedingNegotiation) from MediaEndpointPeerConnection to PeerConnectionBackend.
509         This code handles the control of sending or not the negotiationneeded event.
510
511         Updating mock to use markAsNeedingNegotiation when streams are changed.
512         Updating libwebrtc backend to call markAsNeedingNegotiation when required by libwebrtc implementation.
513
514         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
515         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
516         * Modules/mediastream/MediaEndpointPeerConnection.h:
517         * Modules/mediastream/PeerConnectionBackend.cpp:
518         (WebCore::PeerConnectionBackend::markAsNeedingNegotiation):
519         * Modules/mediastream/PeerConnectionBackend.h:
520         (WebCore::PeerConnectionBackend::isNegotiationNeeded):
521         (WebCore::PeerConnectionBackend::clearNegotiationNeededState):
522         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
523         (WebCore::LibWebRTCMediaEndpoint::OnRenegotiationNeeded):
524         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
525         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
526         * testing/MockLibWebRTCPeerConnection.cpp:
527         (WebCore::MockLibWebRTCPeerConnection::AddStream):
528         (WebCore::MockLibWebRTCPeerConnection::RemoveStream):
529
530 2017-02-14  Brady Eidson  <beidson@apple.com>
531
532         Unreviewed followup to r212330 to fix Debug builds
533
534         * loader/DocumentThreadableLoader.cpp:
535         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Add call to relaxAdoptionRequirement().
536
537 2017-02-14  Matt Rajca  <mrajca@apple.com>
538
539         Website policies: iframes should respect the autoplay policy of the top-level document
540         https://bugs.webkit.org/show_bug.cgi?id=168333
541
542         Reviewed by Alex Christensen.
543
544         API tests were added.
545
546         * html/HTMLMediaElement.cpp:
547         (WebCore::HTMLMediaElement::HTMLMediaElement):
548
549 2017-02-14  Dean Jackson  <dino@apple.com>
550
551         Rename preferLowPowerWebGLRendering setting to forceWebGLUsesLowPower
552         https://bugs.webkit.org/show_bug.cgi?id=168339
553         <rdar://problem/30522092>
554
555         Reviewed by Simon Fraser.
556
557         Use a setting name that more clearly reflects what it is doing. It's not
558         preferring to use the low-power GPU, it's forcing it.
559
560         * html/canvas/WebGLRenderingContextBase.cpp:
561         (WebCore::WebGLRenderingContextBase::create):
562         * page/Settings.in:
563
564 2017-02-14  Brady Eidson  <beidson@apple.com>
565
566         Speculative fix for: Crash in DocumentThreadableLoader::redirectReceived.
567         <rdar://problem/29899473> and https://bugs.webkit.org/show_bug.cgi?id=168337
568
569         Reviewed by Geoffrey Garen.
570
571         No new tests (Unable to find a reproduction).
572
573         * loader/DocumentThreadableLoader.cpp:
574         (WebCore::DocumentThreadableLoader::loadRequest):
575
576 2017-02-14  Youenn Fablet  <youenn@apple.com>
577
578         [WebRTC] Remove obsolete WebRTC stats API
579         https://bugs.webkit.org/show_bug.cgi?id=167910
580
581         Reviewed by Alex Christensen.
582
583         No change of behavior as removed constructs are not functional.
584         Removing RTCStatsResponse which no longer exists and made RTCStatsReport an empty container for now.
585
586         * CMakeLists.txt:
587         * DerivedSources.cpp:
588         * DerivedSources.make:
589         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
590         (WebCore::MediaEndpointPeerConnection::getStats):
591         * Modules/mediastream/MediaEndpointPeerConnection.h:
592         * Modules/mediastream/PeerConnectionBackend.h:
593         * Modules/mediastream/RTCPeerConnection.cpp:
594         (WebCore::RTCPeerConnection::getStats):
595         * Modules/mediastream/RTCStatsReport.cpp:
596         (WebCore::RTCStatsReport::create): Deleted.
597         (WebCore::RTCStatsReport::RTCStatsReport): Deleted.
598         (WebCore::RTCStatsReport::names): Deleted.
599         (WebCore::RTCStatsReport::local): Deleted.
600         (WebCore::RTCStatsReport::remote): Deleted.
601         (WebCore::RTCStatsReport::addStatistic): Deleted.
602         * Modules/mediastream/RTCStatsReport.h:
603         (WebCore::RTCStatsReport::create):
604         (WebCore::RTCStatsReport::timestamp): Deleted.
605         (WebCore::RTCStatsReport::id): Deleted.
606         (WebCore::RTCStatsReport::type): Deleted.
607         (WebCore::RTCStatsReport::stat): Deleted.
608         * Modules/mediastream/RTCStatsReport.idl:
609         * Modules/mediastream/RTCStatsResponse.cpp: Removed.
610         * Modules/mediastream/RTCStatsResponse.h: Removed.
611         * Modules/mediastream/RTCStatsResponse.idl: Removed.
612         * WebCore.xcodeproj/project.pbxproj:
613         * platform/mediastream/MediaEndpoint.h:
614         (WebCore::MediaEndpoint::getStats):
615         * platform/mediastream/RTCStatsRequest.h: Removed.
616         * platform/mediastream/RTCStatsResponseBase.h: Removed.
617
618 2017-02-14  Karim H  <karim@karhm.com>
619
620         Removed unused methods of WebCore::FileStream
621         https://bugs.webkit.org/show_bug.cgi?id=168025
622
623         Reviewed by Michael Catanzaro.
624
625         * fileapi/AsyncFileStream.cpp:
626         (WebCore::AsyncFileStream::openForWrite): Deleted.
627         (WebCore::AsyncFileStream::write): Deleted.
628         (WebCore::AsyncFileStream::truncate): Deleted.
629         * fileapi/AsyncFileStream.h:
630         * platform/FileStream.cpp:
631         (WebCore::FileStream::openForWrite): Deleted.
632         (WebCore::FileStream::write): Deleted.
633         (WebCore::FileStream::truncate): Deleted.
634         * platform/FileStream.h:
635
636 2017-02-14  Chris Dumez  <cdumez@apple.com>
637
638         HTML Form Validation bubble should take minimum font size setting into consideration
639         https://bugs.webkit.org/show_bug.cgi?id=168271
640         <rdar://problem/29869869>
641
642         Reviewed by Simon Fraser.
643
644         HTML Form Validation bubble should take minimum font size setting into consideration
645         for better accessibility.
646
647         Test: fast/forms/validation-message-minimum-font-size.html
648
649         * platform/ValidationBubble.h:
650         (WebCore::ValidationBubble::create):
651         (WebCore::ValidationBubble::fontSize):
652         * platform/ios/ValidationBubbleIOS.mm:
653         (WebCore::ValidationBubble::ValidationBubble):
654         * platform/mac/ValidationBubbleMac.mm:
655         (WebCore::ValidationBubble::ValidationBubble):
656         Update the ValidationBubble constructor to take in Settings. For now, there is a
657         single setting that is the minimum font size and that is taken into account when
658         setting the font size of the validation bubble text.
659
660 2017-02-14  Eric Carlson  <eric.carlson@apple.com>
661
662         [MediaStream] add navigator.getUserMedia for compatibility with legacy content
663         https://bugs.webkit.org/show_bug.cgi?id=168324
664         <rdar://problem/30513125>
665
666         Reviewed by Youenn Fablet.
667
668         Tests: fast/mediastream/argument-types.html
669                fast/mediastream/getusermedia.html
670                fast/mediastream/webkitGetUserMedia-shadowing-then.html
671
672         * CMakeLists.txt:
673         * DerivedSources.cpp:
674         * DerivedSources.make:
675         * Modules/mediastream/MediaDevices.idl:
676         * Modules/mediastream/NavigatorUserMedia.idl: Added.
677         * Modules/mediastream/NavigatorUserMedia.js: Added.
678         * WebCore.xcodeproj/project.pbxproj:
679         * bindings/js/WebCoreBuiltinNames.h:
680         * page/Navigator.idl:
681
682 2017-02-14  Chris Dumez  <cdumez@apple.com>
683
684         Fallback to legacy type only when event is trusted
685         https://bugs.webkit.org/show_bug.cgi?id=168301
686
687         Reviewed by Ryosuke Niwa.
688
689         Fallback to legacy type only when event is trusted as per a recent
690         DOM specification change:
691         - https://github.com/whatwg/dom/issues/404
692         - https://github.com/whatwg/dom/pull/406
693
694         No new tests, rebaselined existing test.
695
696         * dom/EventTarget.cpp:
697         (WebCore::legacyType):
698         (WebCore::EventTarget::fireEventListeners):
699
700 2017-02-13  Dean Jackson  <dino@apple.com>
701
702         Rename preferLowPowerToHighPerformance to powerPreference
703         https://bugs.webkit.org/show_bug.cgi?id=168269
704         <rdar://problem/30504444>
705
706         Reviewed by Chris Dumez.
707
708         Based on the discussion in https://github.com/KhronosGroup/WebGL/pull/2283.
709
710         Change WebGLContextAttributes's preferLowPowerToHighPerformance boolean
711         into a powerPreference enum taking three values. The implementation
712         of the enum is in GraphicsContext3DAttributes.
713
714         While the name and values have changed, there should be no change in
715         behaviour caused by this patch.
716
717         * html/canvas/WebGLContextAttributes.h: Use GraphicsContext3DAttributes
718         enum GraphicsContext3DPowerPreference.
719         * html/canvas/WebGLContextAttributes.idl: Rename and add the WebIDL enum.
720         * html/canvas/WebGLRenderingContextBase.cpp: Use the new values.
721         (WebCore::WebGLRenderingContextBase::create):
722         (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker):
723         * platform/WebGLStateTracker.cpp:
724         * platform/WebGLStateTracker.h: Update the state tracker to use the new
725         values.
726         * platform/graphics/GraphicsContext3DAttributes.h:
727         * platform/graphics/mac/GraphicsContext3DMac.mm:
728         (WebCore::setPixelFormat): Accept GraphicsContext3DPowerPreference as a parameter.
729         (WebCore::GraphicsContext3D::GraphicsContext3D):
730
731 2017-02-14  Youenn Fablet  <youennf@gmail.com>
732
733         [WebRTC] Implement description getters for libwebrtc RTCPeerConnection
734         https://bugs.webkit.org/show_bug.cgi?id=168234
735
736         Reviewed by Alex Christensen.
737
738         Allows passing W3C webrtc tests.
739
740         Implementing localDescription/remoteDescription using libwebrtc backend.
741         current and pending description getters are made the same as local/remote getters for the moment.
742         This should be fixed when upgrading to latest libwebrtc revision.
743
744         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
745         (WebCore::toSessionDescriptionType):
746         (WebCore::fromSessionDescriptionType):
747         (WebCore::fromSessionDescription):
748         (WebCore::LibWebRTCMediaEndpoint::localDescription):
749         (WebCore::LibWebRTCMediaEndpoint::remoteDescription):
750         (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
751         (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
752         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
753         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
754         (WebCore::LibWebRTCPeerConnectionBackend::localDescription):
755         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
756
757 2017-02-14  Jeremy Jones  <jeremyj@apple.com>
758
759         When playing inline after fullscreen, set a flag instead of adding attribute plays inline, and use in requiresFullscreenForVideoPlayback.
760         https://bugs.webkit.org/show_bug.cgi?id=167815
761         rdar://problem/27685077
762
763         Reviewed by Jer Noble.
764
765         Test: media/media-fullscreen-loop-inline.html
766
767         When video is allowed to play inline after fullscreen. Looped video causes play state to update, which can send video back to fullscreen when
768         allowsInline is false. This change will set a new flag when allowsInlineMediaPlaybackAfterFullscreen allows inline playback that can be tested
769         in requiresFullscreenForVideoPlayback to prevent sending video back into fullscreen when video loops.
770
771         * html/HTMLMediaElement.cpp:
772         (WebCore::HTMLMediaElement::enterFullscreen):
773         (WebCore::HTMLMediaElement::exitFullscreen):
774         * html/HTMLMediaElement.h:
775         (WebCore::HTMLMediaElement::isTemporarilyAllowingInlinePlaybackAfterFullscreen): Added.
776         * html/MediaElementSession.cpp:
777         (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
778
779 2017-02-14  Jer Noble  <jer.noble@apple.com>
780
781         Video elements with MediaSource objects set by srcObject are not cleared when srcObject is set to null
782         https://bugs.webkit.org/show_bug.cgi?id=168268
783
784         Reviewed by Eric Carlson.
785
786         Test: fast/mediastream/MediaStream-MediaElement-setObject-null.html
787
788         Make the setSrcObject() operation compliant with the HTML spec. Since the specification defines
789         srcObject in terms of either a MediaSource, MediaStream, or Blob object, add the variant typedef
790         to HTMLMediaElement and move the definition out of the Modules/mediastream extension IDL and into
791         HTMLMediaElement.idl. Then bring the "media elements load" and "resource selection" algorithms up
792         to their most recent definitions in the HTML5 spec.
793
794         Drive-by fix: Allow the (admittedly weird) single-element-union type in IDL.
795
796         * CMakeLists.txt:
797         * DerivedSources.cpp:
798         * DerivedSources.make:
799         * Modules/mediastream/HTMLMediaElementMediaStream.cpp: Removed.
800         * Modules/mediastream/HTMLMediaElementMediaStream.h: Removed.
801         * Modules/mediastream/HTMLMediaElementMediaStream.idl: Removed.
802         * WebCore.xcodeproj/project.pbxproj:
803         * bindings/scripts/IDLParser.pm:
804         (parseUnionType):
805         * html/HTMLAudioElement.cpp:
806         (WebCore::HTMLAudioElement::createForJSConstructor):
807         * html/HTMLMediaElement.cpp:
808         (WebCore::actionName):
809         (WebCore::HTMLMediaElement::parseAttribute):
810         (WebCore::HTMLMediaElement::insertedInto):
811         (WebCore::HTMLMediaElement::scheduleDelayedAction):
812         (WebCore::HTMLMediaElement::scheduleNextSourceChild):
813         (WebCore::HTMLMediaElement::pendingActionTimerFired):
814         (WebCore::HTMLMediaElement::setSrcObject):
815         (WebCore::HTMLMediaElement::load):
816         (WebCore::HTMLMediaElement::prepareForLoad):
817         (WebCore::HTMLMediaElement::selectMediaResource):
818         (WebCore::HTMLMediaElement::loadResource):
819         (WebCore::HTMLMediaElement::playInternal):
820         (WebCore::HTMLMediaElement::pauseInternal):
821         (WebCore::HTMLMediaElement::sourceWasAdded):
822         (WebCore::HTMLMediaElement::clearMediaPlayer):
823         (WebCore::HTMLMediaElement::resume):
824         (WebCore::HTMLMediaElement::mediaCanStart):
825         (WebCore::HTMLMediaElement::createMediaPlayer):
826         (WebCore::HTMLMediaElement::loadInternal): Deleted.
827         * html/HTMLMediaElement.h:
828         (WebCore::HTMLMediaElement::srcObject):
829         * html/HTMLMediaElement.idl:
830         * platform/ContentType.h:
831
832 2017-02-14  Aakash Jain  <aakash_jain@apple.com>
833
834         Remove unused WebThreadContextIsCurrent method from WebCoreThread.h
835         https://bugs.webkit.org/show_bug.cgi?id=168254
836
837         Reviewed by Dan Bernstein.
838
839         * platform/ios/wak/WebCoreThread.h: Removed unused WebThreadContextIsCurrent.
840         * platform/ios/wak/WebCoreThread.mm:
841         (WebThreadContextIsCurrent): Deleted.
842
843 2017-02-14  Alexey Proskuryakov  <ap@apple.com>
844
845         WebCore shouldn't export SystemMemory.h
846         https://bugs.webkit.org/show_bug.cgi?id=168285
847
848         Reviewed by Alex Christensen.
849
850         * WebCore.xcodeproj/project.pbxproj:
851
852 2017-02-13  Filip Pizlo  <fpizlo@apple.com>
853
854         worker.postMessage should throw a TypeError if a SharedArrayBuffer is in the transfer list
855         https://bugs.webkit.org/show_bug.cgi?id=168277
856
857         Reviewed by Mark Lam.
858
859         Test: workers/sab/postMessage-transfer-type-error.html
860         
861         This is a simple spec compliance change. The title says it all.
862
863         * bindings/js/SerializedScriptValue.cpp:
864         (WebCore::SerializedScriptValue::create):
865
866 2017-02-14  Zan Dobersek  <zdobersek@igalia.com>
867
868         HTMLMediaElement: WebKitMediaKeys member name should be prefixed
869         https://bugs.webkit.org/show_bug.cgi?id=168297
870
871         Reviewed by Xabier Rodriguez-Calvar.
872
873         Rename the LEGACY_ENCRYPTED_MEDIA m_mediaKeys variable to m_webkitMediaKeys
874         so that it contains the legacy prefix, just like the API. This will make
875         room for the MediaKeys member variable that will be implemented under
876         the ENCRYPTED_MEDIA guards.
877
878         * html/HTMLMediaElement.cpp:
879         (WebCore::HTMLMediaElement::mediaPlayerCachedKeyForKeyId):
880         (WebCore::HTMLMediaElement::webkitSetMediaKeys):
881         * html/HTMLMediaElement.h:
882         (WebCore::HTMLMediaElement::webkitKeys):
883
884 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
885
886         [GTK] Make DragImageRef a RefPtr instead of a plain pointer
887         https://bugs.webkit.org/show_bug.cgi?id=168296
888
889         Reviewed by Sergio Villar Senin.
890
891         Use RefPtr<cairo_surface_t> as DragImageRef for GTK+ port to avoid memory leaks.
892
893         * platform/DragImage.h:
894         * platform/gtk/DragImageGtk.cpp:
895         (WebCore::dragImageSize):
896         (WebCore::deleteDragImage):
897         (WebCore::scaleDragImage):
898         (WebCore::dissolveDragImageToFraction):
899         (WebCore::createDragImageFromImage):
900         (WebCore::createDragImageIconForCachedImageFilename):
901
902 2017-02-14  Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
903
904         [GStreamer][MSE] Some GStreamer log messages are generated with the 'default' category
905         https://bugs.webkit.org/show_bug.cgi?id=168015
906
907         Reviewed by Xabier Rodriguez-Calvar.
908
909         The elements AppendPipeline, PlaybackPipeline, MediaSourceClientGstreamerMSE do not have
910         a defined Gstreamer log category, then the webkitmse category has been added to them.
911         WebKitMediaSourceGstreamer has its own category but was not declared at the beginning of
912         the .cpp file.
913
914         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Added webkitmse category.
915         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
916         Added webkitmse category and gst header.
917         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: Added webkitmse category.
918         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
919         Added webkitmediasrc category.
920
921 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
922
923         CookieManager only works with the default session
924         https://bugs.webkit.org/show_bug.cgi?id=168229
925
926         Reviewed by Alex Christensen.
927
928         Update cookie observer API to use a std::function instead of a function pointer and make it work with multiple
929         sessions in the backends that support it.
930
931         * platform/network/CookieStorage.h:
932         * platform/network/cf/CookieStorageCFNet.cpp:
933         (WebCore::cookieChangeCallbackMap):
934         (WebCore::notifyCookiesChanged):
935         (WebCore::startObservingCookieChanges):
936         (WebCore::stopObservingCookieChanges):
937         * platform/network/mac/CookieStorageMac.mm:
938         (-[WebCookieStorageObjCAdapter startListeningForCookieChangeNotificationsWithCallback:]):
939         (-[WebCookieStorageObjCAdapter stopListeningForCookieChangeNotifications]):
940         (WebCore::startObservingCookieChanges):
941         (WebCore::stopObservingCookieChanges):
942         * platform/network/soup/CookieStorageSoup.cpp:
943         (WebCore::cookieChangeCallbackMap):
944         (WebCore::soupCookiesChanged):
945         (WebCore::startObservingCookieChanges):
946         (WebCore::stopObservingCookieChanges):
947
948 2017-02-13  Antoine Quint  <graouts@apple.com>
949
950         REGRESSION: Update volume and scrubbing slider to match HI designs
951         https://bugs.webkit.org/show_bug.cgi?id=168170
952         <rdar://problem/28095266>
953
954         Reviewed by Dean Jackson.
955
956         We bring the designs of the control's background materials, scrubber and
957         volume slider up to spec.
958
959         The first important set of changes is that, on macOS, the materials and colors
960         were incorrect. Buttons and time labels now set a mix-blend-mode to correctly
961         appear vibrant against the media, and the controls bar, volume container
962         and tracks menu now use a new BackgroundTint node to correctly apply both
963         a backdrop-filter and blended tint above it.
964
965         The second important set of changes is the rendering of the sliders. Up to now
966         we would simply style the <input type="range"> track and thumb, applying solid
967         fills and strokes. We now draw sliders in two ways depending on the platform.
968         
969         On macOS, we draw the whole slider with a <canvas> element with "mix-blend-mode"
970         set to "plus-lighter". On iOS, we draw the track as a <div> with "mix-blend-mode"
971         set to "plus-darker" and draw the fill (up to the thumb) in the <canvas> with
972         no blend mode to obtain a pure white color, finally the thumb is rendered by the
973         <input> element. We couldn't draw the pure white color with the track in the
974         same <canvas> due to the "plus-darker" blend mode.
975
976         Test: media/modern-media-controls/background-tint/background-tint.html
977
978         * Modules/modern-media-controls/controls/airplay-button.css:
979         (button.airplay.on):
980         * Modules/modern-media-controls/controls/background-tint.css: Added.
981         (.background-tint):
982         (.background-tint,):
983         (.background-tint > .blur):
984         (.background-tint > .tint):
985         * Modules/modern-media-controls/controls/background-tint.js: Added.
986         (BackgroundTint):
987         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
988         (.media-controls.ios.inline .scrubber.slider):
989         (.media-controls.ios.inline .scrubber.slider > div):
990         (.media-controls.ios.inline .scrubber.slider > input::-webkit-slider-thumb):
991         (.media-controls.ios.inline .scrubber.slider > .fill): Deleted.
992         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css:
993         (.media-controls.mac.inline.compact .volume-slider-container):
994         (.media-controls.mac.inline.compact .volume.slider):
995         (.media-controls.mac.inline.compact .scrubber.slider > input::-webkit-slider-thumb): Deleted.
996         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
997         (.media-controls.mac.fullscreen > .controls-bar):
998         (.media-controls.mac.fullscreen > .controls-bar > .background-tint > div):
999         (.media-controls.mac.fullscreen .volume.slider):
1000         (.media-controls.mac.fullscreen button.volume-up):
1001         (.media-controls.mac.fullscreen button.rewind):
1002         (.media-controls.mac.fullscreen button.forward):
1003         (.media-controls.mac.fullscreen .buttons-container.right button):
1004         (.media-controls.mac.fullscreen .scrubber):
1005         (.media-controls.mac.fullscreen > .controls-bar button): Deleted.
1006         (.media-controls.mac.fullscreen button.airplay): Deleted.
1007         (.media-controls.mac.fullscreen button.aspect-ratio): Deleted.
1008         (.media-controls.mac.fullscreen button.pip): Deleted.
1009         (.media-controls.mac.fullscreen button.tracks): Deleted.
1010         (.media-controls.mac.fullscreen button.fullscreen): Deleted.
1011         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
1012         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
1013         (.media-controls.mac.inline .scrubber.slider):
1014         (.media-controls.mac.inline .volume-slider-container):
1015         (.media-controls.mac.inline .volume-slider-container > .background-tint):
1016         (.media-controls.mac.inline .volume-slider-container > .background-tint > div):
1017         (.media-controls.mac.inline .volume.slider):
1018         (.media-controls.mac.inline button): Deleted.
1019         (.media-controls.mac.inline button:active): Deleted.
1020         (.media-controls.mac.inline > .controls-bar button): Deleted.
1021         (.media-controls.mac.inline > .controls-bar,): Deleted.
1022         (.media-controls.mac.inline .volume-slider-container:before): Deleted.
1023         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
1024         (MacOSInlineMediaControls.prototype.layout):
1025         * Modules/modern-media-controls/controls/macos-media-controls.css: Added.
1026         (.media-controls.mac button:active):
1027         (.media-controls.mac > .controls-bar button):
1028         (.media-controls.mac > .controls-bar .time-label):
1029         (.media-controls.mac > .controls-bar .slider > canvas):
1030         (.media-controls.mac > .controls-bar .slider > input::-webkit-slider-thumb):
1031         * Modules/modern-media-controls/controls/scrubber.css: Removed.
1032         * Modules/modern-media-controls/controls/scrubber.js:
1033         (Scrubber):
1034         (Scrubber.prototype.get buffered):
1035         (Scrubber.prototype.set buffered):
1036         (Scrubber.prototype.draw):
1037         (Scrubber.prototype._drawMacOS):
1038         (Scrubber.prototype._drawiOS):
1039         * Modules/modern-media-controls/controls/slider.css:
1040         (.slider):
1041         (.slider > canvas,):
1042         (.slider > canvas):
1043         (.slider > input):
1044         (.slider > input,): Deleted.
1045         (.slider > .fill): Deleted.
1046         (.slider > input::-webkit-slider-thumb): Deleted.
1047         * Modules/modern-media-controls/controls/slider.js:
1048         (Slider.prototype.set value):
1049         (Slider.prototype.set width):
1050         (Slider.prototype.commitProperty):
1051         (Slider.prototype.layout):
1052         (Slider.prototype.draw):
1053         (Slider.prototype._handleInputEvent):
1054         (Slider.prototype._handleChangeEvent):
1055         (addRoundedRect):
1056         (Slider.prototype._updateFill): Deleted.
1057         * Modules/modern-media-controls/controls/start-button.css:
1058         (button.start):
1059         * Modules/modern-media-controls/controls/time-control.js:
1060         * Modules/modern-media-controls/controls/time-label.css:
1061         (.time-label):
1062         * Modules/modern-media-controls/controls/tracks-panel.css:
1063         (.tracks-panel):
1064         (.tracks-panel > .background-tint > div):
1065         (.tracks-panel > section):
1066         (.tracks-panel > section:first-of-type):
1067         (.tracks-panel > section > h3):
1068         (.tracks-panel > section > ul):
1069         (.tracks-panel > section > ul > li):
1070         (.tracks-panel > section > ul > li:focus):
1071         (.tracks-panel > section > ul > li.selected:before):
1072         (.tracks-panel > section > ul > li.animated):
1073         (.tracks-panel-section): Deleted.
1074         (.tracks-panel-section:first-of-type): Deleted.
1075         (.tracks-panel-section > h3): Deleted.
1076         (.tracks-panel-section > ul): Deleted.
1077         (.tracks-panel-section > ul > li): Deleted.
1078         (.tracks-panel-section > ul > li:focus): Deleted.
1079         (.tracks-panel-section > ul > li.selected:before): Deleted.
1080         (.tracks-panel-section > ul > li.animated): Deleted.
1081         * Modules/modern-media-controls/controls/tracks-panel.js:
1082         (TracksPanel.prototype._childrenFromDataSource):
1083         (TracksPanel.prototype._childrenFromDataSource.): Deleted.
1084         * Modules/modern-media-controls/controls/volume-slider.js:
1085         (VolumeSlider):
1086         (VolumeSlider.prototype.handleEvent):
1087         (VolumeSlider.prototype.draw):
1088         * Modules/modern-media-controls/js-files:
1089         * Modules/modern-media-controls/media/scrubbing-support.js:
1090         (ScrubbingSupport.prototype.get mediaEvents):
1091         (ScrubbingSupport.prototype.syncControl):
1092         (ScrubbingSupport):
1093
1094 2017-02-13  Alex Christensen  <achristensen@webkit.org>
1095
1096         URLs with an invalid IPv4 address should be invalid
1097         https://bugs.webkit.org/show_bug.cgi?id=168260
1098
1099         Reviewed by Tim Horton.
1100
1101         All URL hosts are fed through the IPv4 parser.  https://webkit.org/ doesn't
1102         look enough like an IPv4 address to be considered an invalid IPv4 address, so 
1103         we continue to the String host processing.  http://127.0.0.257 does, though, and
1104         according to https://url.spec.whatwg.org/#concept-ipv4-parser parsing that URL
1105         should fail.
1106
1107         Covered by newly passing web platform tests.
1108
1109         * platform/URLParser.cpp:
1110         (WebCore::URLParser::parseIPv4Host):
1111         (WebCore::URLParser::parseHostAndPort):
1112         * platform/URLParser.h:
1113
1114 2017-02-13  Dan Bernstein  <mitz@apple.com>
1115
1116         Reverted r212275. It still breaks some Apple-internal builds.
1117
1118         * platform/spi/mac/TUCallSPI.h:
1119
1120 2017-02-13  Joseph Pecoraro  <pecoraro@apple.com>
1121
1122         Address ESLint warnings in modern-media-controls
1123         https://bugs.webkit.org/show_bug.cgi?id=168224
1124
1125         Reviewed by Alexey Proskuryakov.
1126
1127         * Modules/modern-media-controls/controls/controls-bar.js:
1128         * Modules/modern-media-controls/controls/fullscreen-button.js:
1129         * Modules/modern-media-controls/controls/layout-node.js:
1130         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
1131         * Modules/modern-media-controls/controls/media-controls.js:
1132         * Modules/modern-media-controls/controls/scheduler.js:
1133         * Modules/modern-media-controls/controls/seek-button.js:
1134         * Modules/modern-media-controls/controls/tracks-panel.js:
1135         * Modules/modern-media-controls/controls/volume-slider.js:
1136         * Modules/modern-media-controls/gesture-recognizers/gesture-recognizer.js:
1137         * Modules/modern-media-controls/gesture-recognizers/pinch.js:
1138         * Modules/modern-media-controls/media/fullscreen-support.js:
1139         * Modules/modern-media-controls/media/media-controller.js:
1140         * Modules/modern-media-controls/media/placard-support.js:
1141         * Modules/modern-media-controls/media/status-support.js:
1142         Address pedantic warnings.
1143
1144 2017-02-13  Dan Bernstein  <mitz@apple.com>
1145
1146         Restored changes from r212210 in a way that does not break the build.
1147
1148         * platform/spi/mac/TUCallSPI.h:
1149
1150 2017-02-13  Zalan Bujtas  <zalan@apple.com>
1151
1152         FontCascade::widthForSimpleText should skip applyTransforms() when kerning and ligatures are off.
1153         https://bugs.webkit.org/show_bug.cgi?id=168251
1154         <rdar://problem/30498102>
1155
1156         Reviewed by Antti Koivisto.
1157
1158         Covered by existing (perf)tests.
1159
1160         * platform/graphics/FontCascade.cpp:
1161         (WebCore::FontCascade::widthForSimpleText):
1162
1163 2017-02-12  Brian Burg  <bburg@apple.com>
1164
1165         Web Inspector: expose system user interface layout direction through InspectorFrontendHost
1166         https://bugs.webkit.org/show_bug.cgi?id=168209
1167         <rdar://problem/11573736>
1168
1169         Reviewed by Joseph Pecoraro.
1170
1171         Forward the UserInterfaceLayoutDirection of the inspector page. If the WebKit client has
1172         properly set the UI directionality from system settings in PageClient, this will get inherited
1173         automatically by the Inspector's WebPage instance.
1174
1175         * inspector/InspectorFrontendClient.h:
1176         * inspector/InspectorFrontendClientLocal.cpp:
1177         (WebCore::InspectorFrontendClientLocal::userInterfaceLayoutDirection):
1178         * inspector/InspectorFrontendClientLocal.h:
1179
1180         * inspector/InspectorFrontendHost.h:
1181         * inspector/InspectorFrontendHost.idl:
1182         * inspector/InspectorFrontendHost.cpp:
1183         (WebCore::InspectorFrontendHost::userInterfaceLayoutDirection):
1184         Expose the directionality to the frontend as "ltr" or "rtl" strings.
1185
1186 2017-02-13  Zalan Bujtas  <zalan@apple.com>
1187
1188         Simple line layout: Do not measure runs with trailing whitespace when kerning and ligatures are off.
1189         https://bugs.webkit.org/show_bug.cgi?id=168247
1190         <rdar://problem/30497288>
1191
1192         Reviewed by Antti Koivisto.
1193
1194         The width of the run is supposed to be the same with or without the trailing whitespace.
1195
1196         Covered by performance test.
1197
1198         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
1199         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
1200         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
1201         * rendering/SimpleLineLayoutTextFragmentIterator.h:
1202
1203 2017-02-13  Karim H  <karim@karhm.com>
1204
1205         Added the other missing BSTR roles tag names.
1206         https://bugs.webkit.org/show_bug.cgi?id=165545
1207
1208         Reviewed by Chris Fleizach.
1209
1210         Test: accessibility/win/bstr-elements-role.html
1211
1212         * accessibility/AccessibilityRenderObject.cpp:
1213         (WebCore::shouldReturnTagNameAsRoleForMSAA):
1214
1215 2017-02-13  Youenn Fablet  <youennf@gmail.com>
1216
1217         [WebRTC] Creating RTCPeerConnection with libwebrtc backend is crashing on rwt
1218         https://bugs.webkit.org/show_bug.cgi?id=168250
1219
1220         Reviewed by Alex Christensen.
1221
1222         Covered by webrtc tests in LayoutTests and in web-platform-tests.
1223         Making mock peer connection factory keep a ref of the real libwebrtc peer connection factory.
1224         That way, it can create real libwebrtc backends whenever requested by tests.
1225
1226         Moving LibWebRTCUtils.h routines as static LibWebRTCProvider methods.
1227         In the future, we should make them no longer static.
1228
1229         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1230         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
1231         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
1232         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
1233         * WebCore.xcodeproj/project.pbxproj:
1234         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.cpp.
1235         (WebCore::LibWebRTCProvider::callOnWebRTCNetworkThread):
1236         (WebCore::LibWebRTCProvider::callOnWebRTCSignalingThread):
1237         (WebCore::LibWebRTCProvider::factory):
1238         (WebCore::LibWebRTCProvider::setPeerConnectionFactory):
1239         (WebCore::createActualPeerConnection):
1240         (WebCore::LibWebRTCProvider::createPeerConnection):
1241         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
1242         * platform/mediastream/libwebrtc/LibWebRTCUtils.h: Removed.
1243         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1244         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
1245         * testing/Internals.cpp:
1246         * testing/MockLibWebRTCPeerConnection.cpp:
1247         (WebCore::useMockRTCPeerConnectionFactory):
1248         (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription):
1249         (WebCore::releaseInNetworkThread):
1250         (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription):
1251         (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription):
1252         (WebCore::MockLibWebRTCPeerConnection::CreateOffer):
1253         (WebCore::MockLibWebRTCPeerConnection::CreateAnswer):
1254
1255 2017-02-13  Anders Carlsson  <andersca@apple.com>
1256
1257         Simplify DragController::startDrag
1258         https://bugs.webkit.org/show_bug.cgi?id=168240
1259
1260         Reviewed by Tim Horton.
1261
1262         Use early returns instead of assigning to a variable that's returned at the end of the function.
1263
1264         * page/DragController.cpp:
1265         (WebCore::DragController::startDrag):
1266
1267 2017-02-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
1268
1269         The current frame of an image should not deleted if another frame is asynchronously being decoded
1270         https://bugs.webkit.org/show_bug.cgi?id=167618
1271
1272         Reviewed by Simon Fraser.
1273
1274         Test: fast/images/animated-image-draw-while-decode.html
1275
1276         If the memory cache asks the BitmapImage to destroy all its frames while
1277         the next frame is being decoded, a thread contention may happen. This can
1278         happen when BitmapImage::draw() is called and the next frame is not ready
1279         yet for drawing, so the current frame has to be drawn. This will invoke
1280         a frame decoding in the same image from the drawing committing thread.
1281
1282         We can avoid that by destroying all the frames except the current frame if
1283         the image is asynchronously decoding its frames. This should not add extra
1284         memory overhead because building the image frame cache and then destroying
1285         it, when needed, is an on-going process. The frames will be allocated and
1286         decoded all the time and all of them can be destroyed except the current one.
1287         
1288         * platform/graphics/BitmapImage.cpp:
1289         (WebCore::BitmapImage::destroyDecodedData):
1290         (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
1291         The logic of destroying the ImageFrames was split among BitmapImage, ImageSource
1292         and ImageFrameCache. Move all the logic to BitmapImage and have ImageFrameCache
1293         be responsible only for destroying a range of ImageFrames.
1294
1295         (WebCore::BitmapImage::draw): add an ASSERT_IMPLIES to ensure the current frame
1296         is ready to be rendered if the next frame is being decoded.
1297         
1298         * platform/graphics/BitmapImage.h: Move a const from ImageFrameCache.h to BitmapImage.h.
1299
1300         * platform/graphics/ImageFrameCache.cpp:
1301         (WebCore::ImageFrameCache::destroyDecodedData):
1302         (WebCore::ImageFrameCache::destroyDecodedDataIfNecessary): Deleted.
1303         * platform/graphics/ImageFrameCache.h:
1304         (WebCore::ImageFrameCache::destroyAllDecodedData):
1305         (WebCore::ImageFrameCache::destroyAllDecodedDataExcludeFrame):
1306         (WebCore::ImageFrameCache::destroyDecodedDataBeforeFrame):
1307         Make ImageFrameCache be responsible for destroying a range of ImageFrames.
1308         This range might include all the frames, all the frames but up to a specific
1309         frame, or all the frames but exclude one frame in the middle.
1310         
1311         * platform/graphics/ImageSource.cpp:
1312         (WebCore::ImageSource::clear): No need to call clearFrameBufferCache() from clear().
1313         The decision to call clearFrameBufferCache() or clear() is moved to
1314         BitmapImage::destroyDecodedData().
1315          
1316         (WebCore::ImageSource::destroyDecodedData): Deleted.
1317         (WebCore::ImageSource::destroyDecodedDataIfNecessary): Deleted.
1318         These functions are replaced by another set of functions in ImageSource.h.
1319         
1320         * platform/graphics/ImageSource.h:
1321         (WebCore::ImageSource::destroyAllDecodedData):
1322         (WebCore::ImageSource::destroyAllDecodedDataExcludeFrame):
1323         (WebCore::ImageSource::destroyDecodedDataBeforeFrame):
1324         (WebCore::ImageSource::hasDecodingQueue):
1325         These are new wrappers which call the corresponding ImageFrameCache functions.
1326
1327 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
1328
1329         [Cocoa] Stop soft-linking CTRunGetBaseAdvancesAndOrigins()
1330         https://bugs.webkit.org/show_bug.cgi?id=168256
1331
1332         Reviewed by Alex Christensen.
1333
1334         Use of this function is already behind a platform guard.
1335
1336         No new tests because there is no behavior change.
1337
1338         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
1339         (SOFT_LINK): Deleted.
1340
1341 2017-02-13  Jiewen Tan  <jiewen_tan@apple.com>
1342
1343         [WebCrypto] WebInspector should indicate webkitSubtle is deprecated
1344         https://bugs.webkit.org/show_bug.cgi?id=165913
1345         <rdar://problem/30477222>
1346
1347         Reviewed by Joseph Pecoraro.
1348
1349         Covered by existing tests.
1350
1351         * page/Crypto.cpp:
1352         (WebCore::Crypto::webkitSubtle):
1353
1354 2017-02-13  Simon Fraser  <simon.fraser@apple.com>
1355
1356         Call WKDestroyRenderingResources() on iOS when tabs are backgrounded
1357         https://bugs.webkit.org/show_bug.cgi?id=168261
1358         rdar://problem/30481079
1359
1360         Reviewed by Tim Horton.
1361
1362         Add CABackingStoreCollectBlocking() to QuartzCoreSPI.h, and fix files in WebCore
1363         that do a framework include.
1364
1365         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
1366         * platform/graphics/cocoa/WebActionDisablingCALayerDelegate.h:
1367         * platform/spi/cocoa/QuartzCoreSPI.h:
1368         * platform/spi/mac/NSViewSPI.h:
1369
1370 2017-02-13  Youenn Fablet  <youenn@apple.com>
1371
1372         ASSERTION FAILED: !m_bodyLoader
1373         https://bugs.webkit.org/show_bug.cgi?id=166986
1374
1375         Reviewed by Sam Weinig.
1376
1377         Refactoring to make the unset/set pending activity part of body loader.
1378         This allows ensuring to not forget to do that by simply deleting the body loader.
1379
1380         * Modules/fetch/FetchResponse.cpp:
1381         (WebCore::FetchResponse::fetch):
1382         (WebCore::FetchResponse::BodyLoader::didSucceed):
1383         (WebCore::FetchResponse::BodyLoader::didFail):
1384         (WebCore::FetchResponse::BodyLoader::BodyLoader):
1385         (WebCore::FetchResponse::BodyLoader::~BodyLoader):
1386         (WebCore::FetchResponse::stop):
1387         * Modules/fetch/FetchResponse.h:
1388
1389 2017-02-13  Aakash Jain  <aakash_jain@apple.com>
1390
1391         Remove unused WebCoreThreadSafe.h
1392         https://bugs.webkit.org/show_bug.cgi?id=168236
1393
1394         Reviewed by Dan Bernstein.
1395
1396         * platform/ios/wak/WebCoreThreadSafe.h: Removed.
1397         * WebCore.xcodeproj/project.pbxproj: Removed WebCoreThreadSafe.h
1398         * platform/ios/wak/WebCoreThread.mm: Removed WebCoreThreadSafe.h and included WAKWindow.h directly
1399
1400 2017-02-13  Anders Carlsson  <andersca@apple.com>
1401
1402         Fix iOS build.
1403
1404         * platform/ios/DragImageIOS.mm:
1405         (WebCore::deleteDragImage):
1406
1407 2017-02-13  Sam Weinig  <sam@webkit.org>
1408
1409         Rename MediaQueryExp.h/cpp to MediaQueryExpression.h/cpp
1410         https://bugs.webkit.org/show_bug.cgi?id=168249
1411
1412         Reviewed by Dean Jackson.
1413
1414         Fix a FIXME and rename MediaQueryExp.h/cpp to match the class it contains, MediaQueryExpression.
1415
1416         * CMakeLists.txt:
1417         * WebCore.xcodeproj/project.pbxproj:
1418         * css/CSSAllInOne.cpp:
1419         * css/MediaQuery.h:
1420         * css/MediaQueryEvaluator.h:
1421         * css/MediaQueryExp.cpp: Removed.
1422         * css/MediaQueryExp.h: Removed.
1423         * css/MediaQueryExpression.cpp: Copied from Source/WebCore/css/MediaQueryExp.cpp.
1424         * css/MediaQueryExpression.h: Copied from Source/WebCore/css/MediaQueryExp.h.
1425         * css/parser/MediaQueryParser.h:
1426
1427 2017-02-13  Aakash Jain  <aakash_jain@apple.com>
1428
1429         WAKResponder should be exported from WebCore
1430         https://bugs.webkit.org/show_bug.cgi?id=168245
1431
1432         Reviewed by Dan Bernstein.
1433
1434         * platform/ios/wak/WAKResponder.h:
1435
1436 2017-02-13  Simon Fraser  <simon.fraser@apple.com>
1437
1438         Log to the History Channel in a few more places
1439         https://bugs.webkit.org/show_bug.cgi?id=168252
1440
1441         Reviewed by Brady Eidson.
1442
1443         *** Aliens ***
1444
1445         * loader/HistoryController.cpp:
1446         (WebCore::HistoryController::restoreScrollPositionAndViewState):
1447         (WebCore::HistoryController::updateForReload):
1448         * loader/NavigationScheduler.cpp:
1449         (WebCore::NavigationScheduler::scheduleHistoryNavigation):
1450         (WebCore::NavigationScheduler::timerFired):
1451         (WebCore::NavigationScheduler::cancel):
1452         * page/History.cpp:
1453         (WebCore::History::go):
1454
1455 2017-02-13  Alex Christensen  <achristensen@webkit.org>
1456
1457         Percent should be allowed in non-special URL hosts
1458         https://bugs.webkit.org/show_bug.cgi?id=168255
1459
1460         Reviewed by Tim Horton.
1461
1462         In the last few weeks, the spec has consolidated its sets of code points.
1463         Now forbidden host code points replace the old invalid host code points with
1464         the modification that percents are allowed in non-special hosts because we
1465         percent-encode non-ascii code points in non-special hosts.
1466         See https://url.spec.whatwg.org/#concept-opaque-host-parser
1467
1468         Covered by newly passing web platform tests.
1469
1470         * platform/URLParser.cpp:
1471         (WebCore::isC0Control):
1472         (WebCore::isInUserInfoEncodeSet):
1473         (WebCore::URLParser::hasForbiddenHostCodePoint):
1474         (WebCore::URLParser::parseHostAndPort):
1475         (WebCore::isInvalidDomainCharacter): Deleted.
1476         (WebCore::URLParser::hasInvalidDomainCharacter): Deleted.
1477         * platform/URLParser.h:
1478
1479 2017-02-13  Anders Carlsson  <andersca@apple.com>
1480
1481         Fix Windows build.
1482
1483         * platform/win/PasteboardWin.cpp:
1484         (WebCore::Pasteboard::setDragImage):
1485
1486 2017-02-13  Alex Christensen  <achristensen@webkit.org>
1487
1488         Fix Yosemite build after r211765
1489         https://bugs.webkit.org/show_bug.cgi?id=168246
1490         <rdar://problem/30494174>
1491
1492         Reviewed by Brady Eidson.
1493
1494         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
1495         (SOFT_LINK):
1496
1497 2017-02-13  Anders Carlsson  <andersca@apple.com>
1498
1499         Add a DragImage class that wraps a DragImageRef
1500         https://bugs.webkit.org/show_bug.cgi?id=168131
1501
1502         Reviewed by Beth Dakin.
1503
1504         This allows us to get rid of the explicit deleteDragImage calls and will make additional cleanup of the
1505         various drag code paths possible. No functionality change.
1506
1507         * dom/DataTransfer.cpp:
1508         (WebCore::DataTransfer::updateDragImage):
1509         * page/DragController.cpp:
1510         (WebCore::DragController::startDrag):
1511         (WebCore::DragController::doImageDrag):
1512         (WebCore::DragController::doSystemDrag):
1513         * page/DragController.h:
1514         * platform/DragImage.cpp:
1515         (WebCore::DragImage::DragImage):
1516         (WebCore::DragImage::operator=):
1517         (WebCore::DragImage::~DragImage):
1518         * platform/DragImage.h:
1519         * platform/Pasteboard.h:
1520         * platform/StaticPasteboard.h:
1521         * platform/mac/PasteboardMac.mm:
1522         (WebCore::Pasteboard::setDragImage):
1523
1524 2017-02-13  Chris Dumez  <cdumez@apple.com>
1525
1526         Regression(r211455): ASSERTION FAILED: frameView || pageCacheState() == InPageCache in com.apple.WebCore: WebCore::Document::destroyRenderTree
1527         https://bugs.webkit.org/show_bug.cgi?id=168237
1528         <rdar://problem/30494165>
1529
1530         Reviewed by Gavin Barraclough.
1531
1532         Drop bad assertion under document::destroyRenderTree() that was introduced in r211455.
1533         The assertion seemed like a good idea but the issue is that CachedFrame::destroy()
1534         reset's the document's pageCacheState before calling Document::prepareForDestruction().
1535
1536         No new tests, this fixes assertion hits on our bots.
1537
1538         * dom/Document.cpp:
1539         (WebCore::Document::destroyRenderTree):
1540
1541 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
1542
1543         Update custom line breaking iterators to the latest version of Unicode
1544         https://bugs.webkit.org/show_bug.cgi?id=168182
1545
1546         Reviewed by Zalan Bujtas.
1547
1548         Clean up our breaking code to be more descriptive about the difference between
1549         line-break: auto vs line-break: loose | normal | strict. The only difference is
1550         that we have some hardcoded tables to speed up character iteration for
1551         line-break: auto.
1552
1553         Tests: TestWebKitAPI WebKit2.LineBreaking
1554
1555         * rendering/BreakLines.h:
1556         (WebCore::nextBreakablePosition):
1557         (WebCore::nextBreakablePositionIgnoringNBSP):
1558         (WebCore::nextBreakablePositionWithoutShortcut):
1559         (WebCore::nextBreakablePositionIgnoringNBSPWithoutShortcut):
1560         (WebCore::isBreakable):
1561         (WebCore::nextBreakablePositionNonLoosely): Deleted.
1562         (WebCore::nextBreakablePositionLoosely): Deleted.
1563         (WebCore::nextBreakablePositionLoose): Deleted.
1564         (WebCore::nextBreakablePositionIgnoringNBSPLoose): Deleted.
1565         * rendering/RenderText.cpp:
1566         (WebCore::RenderText::computePreferredLogicalWidths):
1567         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
1568         (WebCore::SimpleLineLayout::nextBreakablePositionInSegment):
1569         * rendering/line/BreakingContext.h:
1570         (WebCore::BreakingContext::handleText):
1571         (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord):
1572
1573 2017-02-13  Youenn Fablet  <youenn@apple.com>
1574
1575         Remove @getUserMedia identifier
1576         https://bugs.webkit.org/show_bug.cgi?id=168216
1577
1578         Reviewed by Sam Weinig.
1579
1580         No change of behavior.
1581
1582         * Modules/mediastream/MediaDevices.idl:
1583         * bindings/js/WebCoreBuiltinNames.h:
1584
1585 2017-02-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1586
1587         [GTK] Non-accelerated drawing is broken with HiDPI
1588         https://bugs.webkit.org/show_bug.cgi?id=168128
1589
1590         Reviewed by Michael Catanzaro.
1591
1592         When device scale factor changes, the page notifies the page overlay controller about it. Then overlay root
1593         layers are created to be notified about the device scale factor. That causes us to enter in accelerated
1594         compositing mode, because the graphics layer factory is called. But the render layer compositor doesn't really
1595         enter in accelerated mode, because there aren't page overlays, the accelerated mode is not forced and the website
1596         doesn't require acceleration either. This leaves our drawing area in an inconsistent state, it thinks it's in AC
1597         mode because it has a layer tree host, but without a root layer attached, so nothing is rendered. The page
1598         overlay controller doesn't need to create the layers when device scale factor changes, when an overlay is
1599         installed, layers will be created with the current device scale factor anyway.
1600
1601         * page/PageOverlayController.cpp:
1602         (WebCore::PageOverlayController::didChangeDeviceScaleFactor): Return early if not initialized yet.
1603
1604 2017-02-13  Csaba Osztrogonác  <ossy@webkit.org>
1605
1606         REGRESSION(r210845) Build broken with ENABLE_MHTML disabled
1607         https://bugs.webkit.org/show_bug.cgi?id=167771
1608
1609         Reviewed by Daniel Bates.
1610
1611         * loader/DocumentLoader.cpp:
1612         (WebCore::DocumentLoader::commitData):
1613
1614 2017-02-12  Dan Bernstein  <mitz@apple.com>
1615
1616         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
1617
1618         * platform/spi/mac/TUCallSPI.h: Reverted to r212210.
1619
1620 2017-02-12  Dan Bernstein  <mitz@apple.com>
1621
1622         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
1623
1624         * platform/spi/mac/TUCallSPI.h:
1625
1626 2017-02-12  Dan Bernstein  <mitz@apple.com>
1627
1628         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
1629
1630         * platform/spi/mac/TUCallSPI.h:
1631
1632 2017-02-12  Dan Bernstein  <mitz@apple.com>
1633
1634         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
1635
1636         * platform/spi/mac/NSMenuSPI.h: Replaced declaration of deprecated method with its current
1637           equivalent.
1638
1639 2017-02-12  Dan Bernstein  <mitz@apple.com>
1640
1641         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
1642
1643         * platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h:
1644
1645 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
1646
1647         parserRemoveChild should unload subframes
1648         https://bugs.webkit.org/show_bug.cgi?id=168151
1649
1650         Reviewed by Darin Adler.
1651
1652         Fix the bug that the adoption agency algorithm does not unload subframes as it disconnects nodes.
1653
1654         Also moved calls to nodeWillBeRemoved inside NoEventDispatchAssertion to expand on r211965.
1655
1656         Tests: fast/parser/adoption-agency-clear-focus-range.html
1657                fast/parser/adoption-agency-unload-iframe-1.html
1658                fast/parser/adoption-agency-unload-iframe-2.html
1659
1660         * dom/ContainerNode.cpp:
1661         (WebCore::ContainerNode::takeAllChildrenFrom): Rewritten using idioms used in removeChildren and parserAppendChild.
1662
1663         Disconnect all subframes first since this can synchronously dispatch an unload event. Then update DOM ranges,
1664         the focused element, and other states in the document.
1665
1666         Second, use the regular removeBetween, notifyChildNodeRemoved, childrenChanged sequence of calls to disconnect nodes
1667         instead of a single call to removeDetachedChildren to properly disconnect child nodes since those nodes may have
1668         already come live due to execution of synchronous scripts prior to the adoption agency algorithm has run, or in
1669         response to the unload event we just dispatched.
1670
1671         Third, append these nodes using parserAppendChild to avoid dispatching mutation events.
1672
1673         (WebCore::willRemoveChild): Removed the call to nodeWillBeRemoved. It's now called within NoEventDispatchAssertion
1674         in each call site of willRemoveChild and willRemoveChildren.
1675         (WebCore::willRemoveChildren): Ditto.
1676         (WebCore::ContainerNode::removeChild): Call nodeWillBeRemoved inside NoEventDispatchAssertion.
1677         (WebCore::ContainerNode::replaceAllChildren): Call nodeWillBeRemoved inside NoEventDispatchAssertion.
1678         (WebCore::ContainerNode::parserRemoveChild): Disconnect subframes and update document's states.
1679
1680         * html/parser/HTMLConstructionSite.cpp:
1681         (WebCore::executeTakeAllChildrenAndReparentTask): Add a release assert that new parent does not already have a parent. 
1682
1683 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
1684
1685         REGRESSION (r179497): Crash inside setAttributeNode
1686         https://bugs.webkit.org/show_bug.cgi?id=168161
1687         <rdar://problem/30451581>
1688
1689         Reviewed by Andreas Kling.
1690
1691         The bug was caused by setAttributeNode calling setAttributeInternal with the same element data as the one used
1692         to call removeAttributeInternal despite of the fact removeAttributeInternal could have invoked arbitrary scripts
1693         and mutated element's m_elementData.
1694
1695         Fixed the bug by calling with setAttributeInternal with the result of new invocation of ensureUniqueElementData().
1696
1697         Test: fast/dom/Attr/make-unique-element-data-while-replacing-attr.html
1698
1699         * dom/Element.cpp:
1700         (WebCore::Element::setAttributeNode):
1701
1702 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
1703
1704         Rebaseline bindings tests after r212207.
1705
1706         * bindings/scripts/test/JS/JSTestObj.cpp:
1707         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
1708
1709 2017-02-12  Dan Bernstein  <mitz@apple.com>
1710
1711         [Cocoa] Some -respondsToSelector: checks are unnecessary
1712         https://bugs.webkit.org/show_bug.cgi?id=168183
1713
1714         Reviewed by Tim Horton.
1715
1716         * English.lproj/Localizable.strings: Removed a string that’s no longer needed after the
1717           change to WebKit2/Platform/mac/MenuUtilities.mm.
1718
1719         * editing/mac/DictionaryLookup.mm:
1720         (WebCore::showPopupOrCreateAnimationController): Removed check whether
1721           LULookupDefinitionModule responds to +showDefinitionForTerm:relativeToRect:ofView:options:.
1722
1723         * platform/cocoa/NetworkExtensionContentFilter.mm:
1724         (WebCore::NetworkExtensionContentFilter::initialize): Changed to use
1725           -[NEFilterSource setSourceAppIdentifier:], without checking, instead of
1726           -setSourceAppBundleID:, which does not exist.
1727
1728         * platform/cocoa/ScrollController.mm:
1729         (systemUptime): Deleted.
1730         (WebCore::ScrollController::snapRubberBand): Use -[NSProcessInfo systemUptime] directly.
1731
1732         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
1733         (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker): Remove unnecessary check.
1734
1735         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1736         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Ditto.
1737         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto.
1738         (WebCore::MediaPlayerPrivateAVFoundationObjC::didPassCORSAccessCheck): Replaced
1739           -respondsToSelector: check with -isKindOfClass: check corresponding to the above cast.
1740         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): Removed unnecessary
1741           check.
1742
1743         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
1744         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer): Removed unnecessary checks.
1745
1746         * platform/graphics/mac/WebGLLayer.mm:
1747         (-[WebGLLayer initWithGraphicsContext3D:]): Ditto.
1748
1749         * platform/mac/PlatformEventFactoryMac.mm:
1750         (WebCore::typeForEvent): Removed check whether NSMenu responds to +menuTypeForEvent: and
1751           all code to handle that case that it doesn’t.
1752
1753         * platform/mac/WebVideoFullscreenController.mm:
1754         (-[WebVideoFullscreenController applicationDidResignActive:]): Removed check whether
1755           NSWindow responds to -isOnActiveSpace.
1756         (-[WebVideoFullscreenController updateMenuAndDockForFullscreen]): Removed check whether
1757           NSApplication responds to -setPresentationOptions:
1758
1759         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
1760         (-[WebVideoFullscreenInterfaceMacObjC updateIsPlaying:newPlaybackRate:]): Removed
1761           unnecessary -respondsToSelector: check.
1762         (-[WebVideoFullscreenInterfaceMacObjC setVideoDimensions:]): Ditto.
1763         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]): Ditto.
1764
1765         * platform/spi/cf/CFNetworkSPI.h: Moved declarations of
1766           -[NSURLCache _initWithMemoryCapacity:diskCapacity:relativePath:] and
1767           -[NSURLCache _CFURLCache] to the !USE(APPLE_INTERNAL_SDK) section.
1768
1769         * platform/spi/cocoa/NEFilterSourceSPI.h: Added declaration of NEFilterSource’
1770           sourceAppIdentifier property to the !USE(APPLE_INTERNAL_SDK) section and deleted
1771           unconditional declaration of sourceAppBundleID property, which doesn’t exist.
1772
1773         * platform/spi/cocoa/QuartzCoreSPI.h: Removed redundant declarations.
1774
1775         * platform/spi/ios/DataDetectorsUISPI.h: Moved declarations of DDDetectionController methods
1776           from WebKit2/UIProcess/ios/{WKActionSheetAssistant,WKContentViewInteraction}.mm to here.
1777           Removed an unused declaration.
1778
1779         * platform/spi/mac/LookupSPI.h: Moved redundant declarations into the
1780           !USE(APPLE_INTERNAL_SDK) section.
1781
1782         * platform/spi/mac/NSMenuSPI.h: Changed to import NSMenu_Private.h when using the
1783           Apple internal SDK. Cleaned up the declarations for the other case.
1784
1785         * platform/spi/mac/TUCallSPI.h: Changed to import TUCall_Strings.h when use the Apple
1786           internal SDK.
1787
1788 2017-02-11  Sam Weinig  <sam@webkit.org>
1789
1790         Remove the remaining functions out of JSDOMBinding
1791         https://bugs.webkit.org/show_bug.cgi?id=168179
1792
1793         Reviewed by Darin Adler.
1794
1795         Move utility functions into more appropriate locations.
1796         - Move hasIteratorMethod to runtime/IteratorOperations.h
1797         - Move nonCachingStaticFunctionGetter to runtime/Lookup.h
1798         - Move addImpureProperty to CommonVM
1799
1800         Remove toJS overload that took a Vector<T>. Replace it's usage
1801         with toJS<IDLSequence<T>> usage. To make this work, added two
1802         new types, IDLIDBKeyData and IDLIDBValue.
1803
1804         * Modules/indexeddb/IDBCursor.cpp:
1805         (WebCore::IDBCursor::setGetResult):
1806         * Modules/indexeddb/IDBRequest.cpp:
1807         (WebCore::IDBRequest::setResult):
1808         (WebCore::IDBRequest::setResultToStructuredClone):
1809         Adopt JSDOMConvert infrastructure for conversions using new types.
1810
1811         * bindings/IDLTypes.h:
1812         * bindings/js/JSDOMConvertIndexedDB.h:
1813         (WebCore::JSConverter<IDLIDBKeyData>::convert):
1814         (WebCore::JSConverter<IDLIDBValue>::convert):
1815         Add new types for IDBKeyData and IDBValue.
1816
1817         * bindings/js/CommonVM.cpp:
1818         (WebCore::addImpureProperty):
1819         * bindings/js/CommonVM.h:
1820         Move addImpureProperty here from JSDOMBinding.
1821
1822         * bindings/js/IDBBindingUtilities.cpp:
1823         (WebCore::idbKeyDataToScriptValue): Deleted.
1824         * bindings/js/IDBBindingUtilities.h:
1825         Remove unused idbKeyDataToScriptValue, and group like functions
1826         together.
1827
1828         * bindings/js/JSDOMBinding.cpp: Removed.
1829         * bindings/js/JSDOMBinding.h:
1830         (WebCore::nonCachingStaticFunctionGetter): Deleted.
1831         (WebCore::toJS): Deleted.
1832         Move/remove functions.
1833
1834         * bindings/js/JSDOMConvertUnion.h:
1835         Update for move of hasIteratorMethod to runtime/IteratorOperations.h
1836
1837         * bindings/js/JSDOMWindowCustom.cpp:
1838         * bindings/js/JSHTMLDocumentCustom.cpp:
1839         * bindings/js/JSLocationCustom.cpp:
1840         Update for move of nonCachingStaticFunctionGetter to runtime/Lookup.h
1841
1842         * bindings/js/JSSubtleCryptoCustom.cpp:
1843         Remove unneeded include of runtime/IteratorOperations.h
1844
1845         * bindings/scripts/CodeGeneratorJS.pm:
1846         (GenerateOverloadedFunctionOrConstructor):
1847         Include runtime/IteratorOperations when needing to distinguish a sequence.
1848
1849         * html/HTMLDocument.cpp:
1850         Replace include of JSDOMBinding.h with CommonVM.h for addImpureProperty.
1851
1852 2017-02-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1853
1854         [GTK] Handle caps lock indicator in event modifiers
1855         https://bugs.webkit.org/show_bug.cgi?id=168186
1856
1857         Reviewed by Michael Catanzaro.
1858
1859         Add helper function to check if caps lock is present in the given modifiers. We need this because in GDK
1860         GDK_LOCK_MASK might be either CapsLock or ShiftLock in X11. We use this new method in all platform event
1861         implementations to add the appropriate modifiers.
1862
1863         Fixes: fast/events/special-key-events-in-input-text.html
1864
1865         * platform/PlatformKeyboardEvent.h:
1866         * platform/gtk/PlatformKeyboardEventGtk.cpp:
1867         (WebCore::modifiersForGdkKeyEvent):
1868         (WebCore::PlatformKeyboardEvent::modifiersContainCapsLock):
1869         * platform/gtk/PlatformMouseEventGtk.cpp:
1870         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
1871         * platform/gtk/PlatformWheelEventGtk.cpp:
1872         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
1873
1874 2017-02-11  Sam Weinig  <sam@webkit.org>
1875
1876         Remove custom bindings for XSLTProcessor.idl
1877         https://bugs.webkit.org/show_bug.cgi?id=168174
1878
1879         Reviewed by Andreas Kling.
1880
1881         * CMakeLists.txt:
1882         * WebCore.xcodeproj/project.pbxproj:
1883         * bindings/js/JSBindingsAllInOne.cpp:
1884         * bindings/js/JSXSLTProcessorCustom.cpp: Removed.
1885         Remove file.
1886  
1887         * bindings/js/JSDOMBinding.cpp:
1888         (WebCore::jsStringOrUndefined): Deleted.
1889         * bindings/js/JSDOMBinding.h:
1890         Remove now unused jsStringOrUndefined.
1891
1892         * xml/XSLTProcessor.cpp:
1893         (WebCore::XSLTProcessor::setParameter):
1894         (WebCore::XSLTProcessor::getParameter):
1895         (WebCore::XSLTProcessor::removeParameter):
1896         * xml/XSLTProcessor.idl:
1897         Replace custom bindings bindings with early returns. One subtle difference
1898         between the custom bindings and this, is that getParameter will return 
1899         jsNull() rather than jsUndefined() for null String returns. This matches
1900         all other bindings.
1901
1902 2017-02-11  Olivier Blin  <olivier.blin@softathome.com>
1903
1904         [GStreamer][MSE][EME] Fix decryptor assignment
1905         https://bugs.webkit.org/show_bug.cgi?id=168122
1906
1907         Reviewed by Michael Catanzaro.
1908
1909         The new decryptor is a floating reference so we should not use the
1910         adopt GRefPtr constructor, but use the regular assignment operator
1911         that will sink the object (clear the floating flag).
1912
1913         This fixes assertions in debug build.
1914
1915         See previous pipeline fix in r210851 and WPE commit
1916         06020b18831e1c0eead34e2c1a5a4b7d026c227d.
1917
1918         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1919         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
1920         Do not use adoptGRef(), it prevented the object from being sunk.
1921
1922 2017-02-11  Simon Fraser  <simon.fraser@apple.com>
1923
1924         Avoid a redundant scroll to 0,0 when navigating back to a url with no fragment
1925         https://bugs.webkit.org/show_bug.cgi?id=168177
1926
1927         Reviewed by Sam Weinig.
1928
1929         FrameView::scrollToFragment() is called from FrameLoader::scrollToFragmentWithParentBoundary()
1930         when navigating within the page. If the URL had no fragment identifier, this code would
1931         call into FrameView::scrollToAnchor() with an empty name, where maintainScrollPositionAtAnchor()
1932         used the document as the anchor, thus scrolling to 0,0. Later, history().restoreScrollPositionAndViewState()
1933         the restores the scroll position from history.
1934         
1935         This scroll to 0,0 happened to be not visible to the page because of scroll event
1936         coalescing, but it makes implementation of history.scrollRestoration harder, so avoid it
1937         by just returning early from FrameView::scrollToFragment() if there is no fragment,
1938         making sure to clear the document's CSSTarget.
1939
1940         * dom/Document.cpp:
1941         (WebCore::Document::setCSSTarget):
1942         * page/FrameView.cpp:
1943         (WebCore::FrameView::scrollToFragment):
1944         (WebCore::FrameView::scrollToAnchor):
1945
1946 2017-02-11  Chris Dumez  <cdumez@apple.com>
1947
1948         Implement URL's toJSON()
1949         https://bugs.webkit.org/show_bug.cgi?id=167979
1950
1951         Reviewed by Sam Weinig.
1952
1953         Implement URL's toJSON() as per:
1954         - https://url.spec.whatwg.org/#dom-url-tojson
1955
1956         This is already supported by Firefox.
1957
1958         Also, drop URLUtils.idl as it is no longer in the specification.
1959         Merge its content to DOMURL.idl as per the URL specification.
1960
1961         Finally, mark href attribute as stringifier and drop the toString()
1962         operation to match the specification. This fixes a bug where our
1963         toString property was not enumerable but should have been.
1964
1965         Tests: fast/url/url-tojson.html
1966                imported/w3c/web-platform-tests/url/url-tojson.html
1967
1968         * CMakeLists.txt:
1969         * DerivedSources.make:
1970         * WebCore.xcodeproj/project.pbxproj:
1971         * html/DOMURL.idl:
1972         * html/URLUtils.h:
1973         (WebCore::URLUtils<T>::toJSON):
1974         * html/URLUtils.idl: Removed.
1975
1976 2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
1977
1978         [GTK][EFL] Implement MIMETypeRegistry::getPreferredExtensionForMIMEType
1979         https://bugs.webkit.org/show_bug.cgi?id=168163
1980
1981         Reviewed by Michael Catanzaro.
1982
1983         It's missing causing several HTML anchor download tests to fail because the suggested filename missed the
1984         extension. This patch moves MIMETypeRegistry::appendFileExtensionIfNecessary() from the cocoa specific file to the
1985         common file because it's not actually platform specific. MIMETypeRegistry::getPreferredExtensionForMIMEType() is
1986         what platforms should implement.
1987
1988         Fixes: fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html
1989                fast/dom/HTMLAnchorElement/anchor-download.html
1990                fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
1991                fast/dom/HTMLAnchorElement/anchor-nodownload-set.html
1992
1993         * platform/MIMETypeRegistry.cpp:
1994         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
1995         * platform/cocoa/MIMETypeRegistryCocoa.mm:
1996         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary): Deleted.
1997         * platform/efl/MIMETypeRegistryEfl.cpp:
1998         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
1999         * platform/gtk/MIMETypeRegistryGtk.cpp:
2000         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
2001
2002 2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2003
2004         Unreviewed. Update imageTitle translatable string.
2005
2006         To match mac port. Fixes fast/images/imageDocument-title.html.
2007
2008         * platform/gtk/LocalizedStringsGtk.cpp:
2009         (WebCore::imageTitle):
2010
2011 2017-02-10  John Wilander  <wilander@apple.com>
2012
2013         Updates to Resource Load Statistics: Get the right website data store and introduce timeout for user interaction
2014         https://bugs.webkit.org/show_bug.cgi?id=167474
2015         <rdar://problem/24681808>
2016         <rdar://problem/24703286>
2017         <rdar://problem/30290270>
2018
2019         This patch does the following:
2020         1. Gets the right website data store. API::WebsiteDataStore::defaultDataStore()
2021             does not provide the right data store.
2022         2. Introduces timeout for user interaction. A domain needs interaction every 30
2023             days to stay in that category.
2024         3. Adds grandfathered to the statistics model in preparation for grandfathering of
2025             existing data records.
2026         4. Adds test infrastructure to allow testing of the various rules in place for
2027             data records removal.
2028         5. Fixes various smaller bugs that were found as part of setting up the tests.
2029         6. Regresses the data records removal counting. We need to come up with a thread
2030             safe way of gathering removal statistics from more than one data store now
2031             that we potentially interact with multiple stores.
2032         7. Adds a first set of layout tests for resource load statistics.
2033
2034         Reviewed by Andy Estes.
2035
2036         Tests: http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html
2037                http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html
2038                http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html
2039                http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html
2040                http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html
2041
2042         * dom/Document.cpp:
2043         (WebCore::Document::updateLastHandledUserGestureTimestamp):
2044             This now calls ResourceLoadObserver::logUserInteraction() every time since
2045             we want to keep track of the most recent user interaction.
2046         * loader/ResourceLoadObserver.cpp:
2047         (WebCore::ResourceLoadObserver::statisticsStore):
2048             New getter used by WebResourceLoadStatisticsManager::resetToConsistentState().
2049         (WebCore::reduceTimeResolutionToOneDay):
2050             Convenience function.
2051         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2052             Reduces time resolution for privacy reasons.
2053         (WebCore::ResourceLoadObserver::logUserInteraction):
2054         (WebCore::ResourceLoadObserver::clearUserInteraction):
2055         (WebCore::ResourceLoadObserver::hasHadUserInteraction):
2056         (WebCore::ResourceLoadObserver::setPrevalentResource):
2057         (WebCore::ResourceLoadObserver::isPrevalentResource):
2058         (WebCore::ResourceLoadObserver::clearPrevalentResource):
2059         (WebCore::ResourceLoadObserver::setTimeToLiveUserInteraction):
2060         (WebCore::ResourceLoadObserver::fireDataModificationHandler):
2061             New functions that allow WebKitTestRunner to stage exact
2062             statistics, fire the handler, and test the outcome.
2063         * loader/ResourceLoadObserver.h:
2064         * loader/ResourceLoadStatistics.cpp:
2065         (WebCore::ResourceLoadStatistics::encode):
2066         (WebCore::ResourceLoadStatistics::decode):
2067         (WebCore::ResourceLoadStatistics::toString):
2068         (WebCore::ResourceLoadStatistics::merge):
2069             Support for statistics mostRecentUserInteraction, grandfathered, and
2070             dataRecordsRemoved.
2071         * loader/ResourceLoadStatistics.h:
2072         * loader/ResourceLoadStatisticsStore.cpp:
2073         (WebCore::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
2074             New function that allows WebKitTestRunner to test 
2075             aging out of user interaction.
2076         (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
2077             Now takes into account the timestamp and ages
2078             out user interaction.
2079         (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction):
2080             Now makes use of ResourceLoadStatisticsStore::hasHadRecentUserInteraction().
2081         * loader/ResourceLoadStatisticsStore.h:
2082
2083 2017-02-10  Sam Weinig  <sam@webkit.org>
2084
2085         [WebIDL] Cleanup XMLHttpRequest's bindings
2086         https://bugs.webkit.org/show_bug.cgi?id=168067
2087
2088         Reviewed by Chris Dumez.
2089
2090         * bindings/js/JSDOMBinding.cpp:
2091         (WebCore::jsOwnedStringOrNull): Deleted.
2092         * bindings/js/JSDOMBinding.h:
2093         Remove jsOwnedStringOrNull and inline it into it's one use
2094         in JSXMLHttpRequestCustom.
2095
2096         * bindings/js/JSXMLHttpRequestCustom.cpp:
2097         (WebCore::JSXMLHttpRequest::responseText):
2098         (WebCore::SendFunctor::SendFunctor): Deleted.
2099         (WebCore::SendFunctor::line): Deleted.
2100         (WebCore::SendFunctor::column): Deleted.
2101         (WebCore::SendFunctor::url): Deleted.
2102         (WebCore::SendFunctor::operator()): Deleted.
2103         (WebCore::JSXMLHttpRequest::send): Deleted.
2104         * xml/XMLHttpRequest.cpp:
2105         (WebCore::XMLHttpRequest::send):
2106         * xml/XMLHttpRequest.h:
2107         Remove custom send, replacing it with a single send implementation that
2108         takes a variant.
2109
2110         * xml/XMLHttpRequest.idl:
2111         Cleanup the IDL to better match the spec. Update correct types where trivial.
2112
2113 2017-02-10  Chris Dumez  <cdumez@apple.com>
2114
2115         document.origin doesn't match spec
2116         https://bugs.webkit.org/show_bug.cgi?id=168022
2117
2118         Reviewed by Sam Weinig.
2119
2120         Update document.origin to return the origin in the expected format:
2121         - https://dom.spec.whatwg.org/#dom-document-origin
2122
2123         Change: "https_webkit.org_0 -> "https://webkit.org".
2124
2125         The new behavior matches Firefox and Chrome.
2126
2127         No new tests, updated existing tests.
2128
2129         * dom/Document.cpp:
2130         (WebCore::Document::origin):
2131
2132 2017-02-10  Daniel Bates  <dabates@apple.com>
2133
2134         Attempt to fix the build following <https://trac.webkit.org/changeset/212173>
2135         (https://bugs.webkit.org/show_bug.cgi?id=166774)
2136
2137         * dom/Document.cpp:
2138         (WebCore::Document::detachFromCachedFrame): Use ASSER_UNUSED() instead of ASSERT() since
2139         the parameter cachedFrame is unused in non-debug build.
2140
2141 2017-02-10  Daniel Bates  <dabates@apple.com>
2142
2143         Detach frame from document when entering page cache
2144         https://bugs.webkit.org/show_bug.cgi?id=166774
2145         <rdar://problem/29904368>
2146
2147         Reviewed by Chris Dumez.
2148
2149         When a page enters the page cache it is unnecessary for it to hold a reference to its
2150         associated frame because subsequent interactions with the page do not need to make use
2151         of it. Once a page exits the page cache we associate it with its frame.
2152
2153         * dom/Document.cpp:
2154         (WebCore::Document::frameDestroyed): Update comment to reflect the renaming of disconnectFromFrame().
2155         (WebCore::Document::attachToCachedFrame): Added.
2156         (WebCore::Document::detachFromCachedFrame): Added.
2157         (WebCore::Document::prepareForDestruction): Only call CSSAnimationController::detachFromDocument() if
2158         we have a frame. Substitute detachFromFrame() for disconnectFromFrame() as the latter was renamed to
2159         the former.
2160         (WebCore::Document::hasEverCalledWindowOpen): Deleted.
2161         (WebCore::Document::markHasCalledWindowOpen): Deleted.
2162         (WebCore::Document::disconnectFromFrame): Renamed to detachFromFrame.
2163         * dom/Document.h:
2164         (WebCore::Document::detachFromFrame): Renamed; formerly named disconnectFromFrame(). Changed
2165         visibility from public to private and made this function inline.
2166         * history/CachedFrame.cpp:
2167         (WebCore::CachedFrameBase::pruneDetachedChildFrames): Remove cached child frames that were
2168         removed from the page when it was in the page cache as there is no need to restore such frames.
2169         (WebCore::CachedFrameBase::restore): Call pruneDetachedChildFrames() before restoring the
2170         frame tree.
2171         (WebCore::CachedFrame::CachedFrame): Detach from the frame.
2172         (WebCore::CachedFrame::open): Assert that we have a document and re-attach the frame.
2173         (WebCore::CachedFrame::destroy): Update assertion as this function should only be called for a
2174         frameless document. Only detach the FrameView, DocumentLoader, and Page when the cached frame is for
2175         subframe and is associated with a Page object. Call CSSAnimationController::detachFromDocument() to
2176         detach the animation controller from the document as it is being destroyed. We have to do this here
2177         because the document does not have a frame. And Document::prepareForDestruction() only calls
2178         CSSAnimationController::detachFromDocument() if the document has a frame.
2179         * history/CachedFrame.h:
2180         * history/PageCache.cpp:
2181         (WebCore::canCachePage): Remove logic that prevents caching of a page that called window.open()
2182         or has an opener as it is feasible to keep such pages in the page cache.
2183         * html/HTMLFrameElementBase.cpp:
2184         (WebCore::HTMLFrameElementBase::finishedInsertingSubtree): Fix style nit.
2185         * loader/FrameLoader.cpp:
2186         (WebCore::FrameLoader::frameDetached): Only stop all loaders and stop active DOM objects if the
2187         page is not in- or about to enter- the page cache. A page in the page cache has finished loading
2188         and its active DOM objects are suspended. Also fix style nit in comment.
2189         (WebCore::FrameLoader::detachFromParent): Only stop all loaders if the page is not in- or about to
2190         enter- the page cache. A page in the page cache has finished loading. Also added a comment to explain
2191         that we protect the frame because stopAllLoaders() can cause the frame to be deallocated.
2192         * page/DOMWindow.cpp:
2193         (WebCore::DOMWindow::createWindow): Remove logic to call markHasCalledWindowOpen() as this
2194         function will be removed.
2195         * page/DiagnosticLoggingKeys.cpp:
2196         (WebCore::DiagnosticLoggingKeys::hasCalledWindowOpenKey): Deleted.
2197         (WebCore::DiagnosticLoggingKeys::hasOpenerKey): Deleted.
2198         * page/DiagnosticLoggingKeys.h:
2199         * page/Page.cpp:
2200         (WebCore::Page::openedByWindowOpen): Deleted.
2201         * page/Page.h:
2202         * page/Settings.in: Remove setting allowsPageCacheWithWindowOpener.
2203
2204 2017-02-10  Simon Fraser  <simon.fraser@apple.com>
2205
2206         REGRESSION (r211845): [ios-simulator] LayoutTest compositing/masks/solid-color-masked.html is a flaky failure
2207         https://bugs.webkit.org/show_bug.cgi?id=168054
2208
2209         Reviewed by Tim Horton.
2210
2211         When adding mask layers, there was an ordering dependency. There was a hack in GraphicsLayerCA::setVisibleAndCoverageRects()
2212         to propagate m_intersectsCoverageRect to masks. However, if GraphicsLayerCA::setVisibleAndCoverageRects()
2213         ran on the masked layer before the mask was added, nothing updated the "m_intersectsCoverageRect" state of the mask layer.
2214
2215         Fix by explicitly calling setVisibleAndCoverageRects() on the mask layer, passing the same rects and
2216         viewport-constrained state as for its host layer (we already assume that their geometry matches).
2217
2218         Tested by compositing/masks/solid-color-masked.html
2219
2220         * platform/graphics/ca/GraphicsLayerCA.cpp:
2221         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
2222         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
2223
2224 2017-02-10  Commit Queue  <commit-queue@webkit.org>
2225
2226         Unreviewed, rolling out r212154, r212154, and r212156.
2227         https://bugs.webkit.org/show_bug.cgi?id=168156
2228
2229         broke internal builds (Requested by smfr on #webkit).
2230
2231         Reverted changesets:
2232
2233         "Add a DragImage class that wraps a DragImageRef"
2234         https://bugs.webkit.org/show_bug.cgi?id=168131
2235         http://trac.webkit.org/changeset/212154
2236
2237         "Add a DragImage class that wraps a DragImageRef"
2238         https://bugs.webkit.org/show_bug.cgi?id=168131
2239         http://trac.webkit.org/changeset/212154
2240
2241         "Try to fix the iOS and Windows builds."
2242         http://trac.webkit.org/changeset/212156
2243
2244 2017-02-10  Csaba Osztrogonác  <ossy@webkit.org>
2245
2246         Fix the !ENABLE(WEBGL) build
2247         https://bugs.webkit.org/show_bug.cgi?id=168112
2248
2249         Reviewed by Alex Christensen.
2250
2251         * html/canvas/WebGLRenderingContextBase.h:
2252
2253 2017-02-10  Youenn Fablet  <youenn@apple.com>
2254
2255         [Fetch API] fetch fails when undefined is passed as headers
2256         https://bugs.webkit.org/show_bug.cgi?id=168043
2257
2258         Reviewed by Geoffrey Garen.
2259
2260         Covered by updated test.
2261
2262         * Modules/fetch/FetchInternals.js:
2263         (fillFetchHeaders): Exit early in case of undefined headers, since it is an optional parameter.
2264
2265 2017-02-10  Csaba Osztrogonác  <ossy@webkit.org>
2266
2267         Fix the !ENABLE(WEB_TIMING) build
2268         https://bugs.webkit.org/show_bug.cgi?id=168113
2269
2270         Reviewed by Alex Christensen.
2271
2272         * workers/WorkerGlobalScope.cpp:
2273         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
2274
2275 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
2276
2277         Update features.json for Performance Timing APIs
2278         https://bugs.webkit.org/show_bug.cgi?id=168148
2279
2280         Reviewed by Simon Fraser.
2281
2282         * features.json:
2283
2284 2017-02-10  Anders Carlsson  <andersca@apple.com>
2285
2286         Try to fix the iOS and Windows builds.
2287
2288         * platform/ios/DragImageIOS.mm:
2289         (WebCore::deleteDragImage):
2290         * platform/win/PasteboardWin.cpp:
2291         (WebCore::Pasteboard::setDragImage):
2292
2293 2017-02-10  Anders Carlsson  <andersca@apple.com>
2294
2295         Add a DragImage class that wraps a DragImageRef
2296         https://bugs.webkit.org/show_bug.cgi?id=168131
2297
2298         Reviewed by Beth Dakin.
2299
2300         This allows us to get rid of the explicit deleteDragImage calls and will make additional cleanup of the
2301         various drag code paths possible. No functionality change.
2302
2303         * dom/DataTransfer.cpp:
2304         (WebCore::DataTransfer::updateDragImage):
2305         * page/DragController.cpp:
2306         (WebCore::DragController::startDrag):
2307         (WebCore::DragController::doImageDrag):
2308         (WebCore::DragController::doSystemDrag):
2309         * page/DragController.h:
2310         * platform/DragImage.cpp:
2311         (WebCore::DragImage::DragImage):
2312         (WebCore::DragImage::operator=):
2313         (WebCore::DragImage::~DragImage):
2314         * platform/DragImage.h:
2315         * platform/Pasteboard.h:
2316         * platform/StaticPasteboard.h:
2317         * platform/mac/PasteboardMac.mm:
2318         (WebCore::Pasteboard::setDragImage):
2319
2320 2017-02-10  Simon Fraser  <simon.fraser@apple.com>
2321
2322         Make sure the "inwindow" flag propagates to TiledBackings for masks and reflections
2323         https://bugs.webkit.org/show_bug.cgi?id=168127
2324         rdar://problem/30467120
2325
2326         Reviewed by Tim Horton.
2327         
2328         Replace the special-case, but wrong, GraphicsLayer traversal in setIsInWindowIncludingDescendants()
2329         which forgot to hit masks and replica layers with a generic traverse() function, which
2330         is then used for setting 'inWindow' as well as resetting tracked repaints.
2331
2332         Tests: compositing/tiling/tiled-mask-inwindow.html
2333                compositing/tiling/tiled-reflection-inwindow.html
2334
2335         * page/PageOverlayController.cpp:
2336         (WebCore::PageOverlayController::layerWithDocumentOverlays):
2337         (WebCore::PageOverlayController::layerWithViewOverlays):
2338         * platform/graphics/GraphicsLayer.cpp:
2339         (WebCore::GraphicsLayer::setIsInWindow):
2340         (WebCore::GraphicsLayer::setReplicatedByLayer):
2341         (WebCore::GraphicsLayer::traverse):
2342         (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): Deleted.
2343         * platform/graphics/GraphicsLayer.h:
2344         * rendering/RenderLayerCompositor.cpp:
2345         (WebCore::RenderLayerCompositor::setIsInWindow):
2346         (WebCore::RenderLayerCompositor::resetTrackedRepaintRects):
2347         (WebCore::resetTrackedRepaintRectsRecursive): Deleted.
2348
2349 2017-02-09  Simon Fraser  <simon.fraser@apple.com>
2350
2351         Tiled layers are sometimes left with some tiles when outside the viewport
2352         https://bugs.webkit.org/show_bug.cgi?id=168104
2353         rdar://problem/30459055
2354
2355         Reviewed by Tim Horton.
2356
2357         When the coverage rect of a TiledBacking goes from a non-empty rect to an empty rect, we
2358         shouldn't just early return from TileGrid::revalidateTiles(), otherwise we are left with some
2359         tiles. Run through the function as normal, which will remove all the tiles for an empty coverage rect.
2360         
2361         Minor logging changes.
2362
2363         Test: tiled-drawing/tile-coverage-iframe-to-zero-coverage.html
2364
2365         * platform/graphics/ca/TileGrid.cpp:
2366         (WebCore::TileGrid::revalidateTiles):
2367
2368 2017-02-10  Zalan Bujtas  <zalan@apple.com>
2369
2370         Mail hangs when removing multiple rows from large table.
2371         https://bugs.webkit.org/show_bug.cgi?id=168103
2372         <rdar://problem/30090186>
2373
2374         Reviewed by Ryosuke Niwa.
2375
2376         DeleteSelectionCommand::removeNode doesn't actually destroy table structure items,
2377         but instead it removes their content. In order to be able to continue editing the table after
2378         the delete, we need to ensure that its cells' width and height are > 0. Currently we issue layout on
2379         each table item recursively.
2380         This patch delays the layout until after we've finished with the entire subtree delete (10x progression).
2381
2382         Performance test added.
2383
2384         * editing/DeleteSelectionCommand.cpp:
2385         (WebCore::DeleteSelectionCommand::insertBlockPlaceholderForTableCellIfNeeded):
2386         (WebCore::DeleteSelectionCommand::removeNodeUpdatingStates):
2387         (WebCore::shouldRemoveContentOnly):
2388         (WebCore::DeleteSelectionCommand::removeNode):
2389         * editing/DeleteSelectionCommand.h:
2390
2391 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
2392
2393         [Resource Timing] Enable Resource Timing by default in Tests
2394         https://bugs.webkit.org/show_bug.cgi?id=168145
2395
2396         Reviewed by Ryosuke Niwa.
2397
2398         * loader/ResourceTimingInformation.cpp:
2399         (WebCore::ResourceTimingInformation::addResourceTiming):
2400         * testing/InternalSettings.cpp:
2401         (WebCore::InternalSettings::Backup::Backup):
2402         (WebCore::InternalSettings::Backup::restoreTo):
2403         (WebCore::InternalSettings::setResourceTimingEnabled): Deleted.
2404         * testing/InternalSettings.h:
2405         * testing/InternalSettings.idl:
2406         No longer needed for tests.
2407
2408 2017-02-10  Dan Bernstein  <mitz@apple.com>
2409
2410         [Cocoa] Add shouldChangeSelectedRange to WKWebProcessPlugInEditingDelegate
2411         https://bugs.webkit.org/show_bug.cgi?id=168097
2412
2413         Reviewed by Tim Horton.
2414
2415         Added a userTriggered argument to FrameSelection::setSelectedRange so that WebKit2 can
2416         indicate that changes should be agreed to by the delegate.
2417
2418         * editing/FrameSelection.cpp:
2419         (WebCore::FrameSelection::setSelectedRange): If the change is user-triggered, check with
2420           shouldChangeSelection.
2421         * editing/FrameSelection.h:
2422
2423 2017-02-10  Jonathan Bedard  <jbedard@apple.com>
2424
2425         Removing LayoutTestRelay
2426         https://bugs.webkit.org/show_bug.cgi?id=165927
2427
2428         Reviewed by Daniel Bates.
2429         Part 2
2430
2431         LayoutTestRelay uses SPI, since recent versions of the iOS SDK allow for installing apps on
2432         simulators through simctl (iOS 10 and later), use this functionality instead.
2433
2434         * platform/RuntimeApplicationChecks.mm:
2435         (WebCore::IOSApplication::isDumpRenderTree): Update comment to reflect removal of LayoutTestRelay.
2436
2437 2017-02-10  Youenn Fablet  <youenn@apple.com>
2438
2439         [WebRTC] Implement Outgoing libwebrtc audio source support
2440         https://bugs.webkit.org/show_bug.cgi?id=168118
2441
2442         Reviewed by Eric Carlson.
2443
2444         No new automated tests as we need the audio rendering to work to test the whole loop.
2445
2446         Using an AudioSampleDataSource to convert the captured data to libwebrtc expected format.
2447         Capturing and pushing data happens in the capture thread.
2448         Pulling of converted data happens in libwebrtc thread.
2449
2450         Introducing LibWebRTCAudioFormat.h to centralize libwbebrtc expected audio format.
2451
2452         * WebCore.xcodeproj/project.pbxproj:
2453         * platform/audio/WebAudioBufferList.cpp:
2454         (WebCore::WebAudioBufferList::WebAudioBufferList): Missing initialization leads to assertion failure.
2455         * platform/audio/mac/AudioSampleBufferList.cpp:
2456         (WebCore::AudioSampleBufferList::copyFrom): In case of interleaved channels, there is one buffer but two channels.
2457         * platform/audio/mac/AudioSampleDataSource.cpp:
2458         (WebCore::AudioSampleDataSource::pushSamples):
2459         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
2460         * platform/audio/mac/AudioSampleDataSource.h:
2461         * platform/mediastream/libwebrtc/LibWebRTCAudioFormat.h: Added.
2462         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
2463         (WebCore::libwebrtcAudioFormat):
2464         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
2465         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
2466         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
2467         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
2468         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
2469
2470 2017-02-10  Ryosuke Niwa  <rniwa@webkit.org>
2471
2472         HTMLConstructionSiteTask::Insert should never be called on a node with a parent
2473         https://bugs.webkit.org/show_bug.cgi?id=168099
2474
2475         Reviewed by Sam Weinig.
2476
2477         insertAlreadyParsedChild always use HTMLConstructionSiteTask::InsertAlreadyParsedChild instead
2478         of using HTMLConstructionSiteTask::Insert when fostering a child.
2479
2480         Also combine the step to take all children and re-parenting into a single task instead of
2481         separately issuing TakeAllChildren and Reparent tasks.
2482
2483         No new tests since this is a refactoring.
2484
2485         * html/parser/HTMLConstructionSite.cpp:
2486         (WebCore::insert): Now asserts that the child node never have a parent.
2487         (WebCore::executeInsertAlreadyParsedChildTask): Moved the code to remove the parent here.
2488         (WebCore::executeTakeAllChildrenAndReparentTask): Renamed from executeTakeAllChildrenTask
2489         now that this function also does the reparenting.
2490         (WebCore::executeTask):
2491         (WebCore::HTMLConstructionSite::reparent): Removed the variant only used with takeAllChildren.
2492         (WebCore::HTMLConstructionSite::insertAlreadyParsedChild): Always use InsertAlreadyParsedChild
2493         instead of calling fosterParent which uses Insert when fostering parents.
2494         (WebCore::HTMLConstructionSite::takeAllChildrenAndReparent): Renamed from takeAllChildren.
2495         * html/parser/HTMLConstructionSite.h:
2496         (WebCore::HTMLConstructionSiteTask:Operation):
2497         * html/parser/HTMLTreeBuilder.cpp:
2498         (WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
2499
2500 2017-02-10  Dave Hyatt  <hyatt@apple.com>
2501
2502         [CSS Parser] Make intercap property values serialize correctly
2503         https://bugs.webkit.org/show_bug.cgi?id=168073
2504
2505         Reviewed by Zalan Bujtas.
2506
2507         Fix CSS value keywords to preserve case when the value contains capital
2508         letters. Examples include optimizeSpeed, translateX, scaleY, etc.
2509
2510         * css/CSSPrimitiveValueMappings.h:
2511         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2512         (WebCore::CSSPrimitiveValue::operator EPointerEvents):
2513         (WebCore::CSSPrimitiveValue::operator TextRenderingMode):
2514         (WebCore::CSSPrimitiveValue::operator EImageRendering):
2515         (WebCore::CSSPrimitiveValue::operator EColorInterpolation):
2516         (WebCore::CSSPrimitiveValue::operator EColorRendering):
2517         (WebCore::CSSPrimitiveValue::operator EShapeRendering):
2518         * css/MediaQueryEvaluator.cpp:
2519         (WebCore::colorGamutEvaluate):
2520         * css/SVGCSSValueKeywords.in:
2521         * css/TransformFunctions.cpp:
2522         (WebCore::transformOperationType):
2523         (WebCore::transformsForValue):
2524         * css/makevalues.pl:
2525         * css/parser/CSSParserFastPaths.cpp:
2526         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2527         (WebCore::parseTransformTranslateArguments):
2528         (WebCore::parseSimpleTransformValue):
2529         * css/parser/CSSPropertyParser.cpp:
2530         (WebCore::consumeTransformValue):
2531         * css/parser/CSSPropertyParserHelpers.cpp:
2532         (WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
2533
2534 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
2535
2536         [EME] Implement MediaKeySession::load()
2537         https://bugs.webkit.org/show_bug.cgi?id=168041
2538
2539         Reviewed by Xabier Rodriguez-Calvar.
2540
2541         Implement the MediaKeySession::load() method, tracing the steps as they
2542         are defined in the EME specification. The only exception is step 8.3,
2543         which requires additional facility that tracks currently open sessions
2544         and provides information whether for a given session ID there's already
2545         a MediaKeySession that's not yet been closed.
2546
2547         Session ID sanitization is done through the CDM::sanitizeSessionId()
2548         method, which relays the task to the CDMPrivate implementation.
2549
2550         The CDMInstance::loadSession() virtual method is called with the session
2551         type, sanitized ID, the Document's origin (in string form) and the
2552         callback that's invoked upon completion of the task. The callback
2553         checks whether the operation was successful, or examines the reason for
2554         the load failure in case it wasn't, rejecting the promise in the latter
2555         case either immediately or in the following task at the latest.
2556
2557         When the load was successful, the optional known keys, expiration time
2558         and message are handled appropriately, and the promise is resolved.
2559
2560         MockCDM::sanitizeSessionId() implementation only treats
2561         'valid-loaded-session' as a valid session ID.
2562         MockCDMInstance::loadSession() implementation is kept slim for now, only
2563         providing the 'license-renewal' message when invoking the passed-in
2564         callback. Known keys and expiration time will also be tested once the
2565         relevant MediaKeySession algorithms are implemented.
2566
2567         Test: media/encrypted-media/mock-MediaKeySession-load.html
2568
2569         * Modules/encryptedmedia/CDM.cpp:
2570         (WebCore::CDM::sanitizeSessionId):
2571         * Modules/encryptedmedia/CDM.h:
2572         * Modules/encryptedmedia/CDMInstance.h:
2573         * Modules/encryptedmedia/CDMPrivate.h:
2574         * Modules/encryptedmedia/MediaKeySession.cpp:
2575         (WebCore::MediaKeySession::load):
2576         * testing/MockCDMFactory.cpp:
2577         (WebCore::MockCDM::sanitizeSessionId):
2578         (WebCore::MockCDMInstance::loadSession):
2579         * testing/MockCDMFactory.h:
2580
2581 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
2582
2583         [EME] Implement MediaKeySession::sessionClosed()
2584         https://bugs.webkit.org/show_bug.cgi?id=168039
2585
2586         Reviewed by Xabier Rodriguez-Calvar.
2587
2588         Implement the 'session closed' algorithm for MediaKeySession by
2589         following the specified steps. After this algorithm is run, the
2590         session should be considered closed, which we track via the m_closed
2591         member variable on the class. This is set to true before the promise
2592         that's accessible through the 'closed' attribute is resolved.
2593
2594         Because the algorithm requires the CDM instance to store any record
2595         of key usage when the session's type is 'persistent-usage-record', the
2596         storeRecordOfKeyUsage() virtual method is added to the CDMInstance
2597         interface. MockCDMInstance implementation is left unimplemented for now.
2598
2599         JSMediaKeySession::closed() accessor now has a custom implementation
2600         that creates a deferred promise for that object if there's none yet, and
2601         shares it with the wrapped class through the registerClosedPromise()
2602         method, storing a reference to the promise in the m_closedPromise
2603         member variable, or resolving the promise immediately if the session was
2604         already closed.
2605
2606         Test cases added to media/encrypted-media/mock-MediaKeySession-close.html.
2607
2608         * Modules/encryptedmedia/CDMInstance.h:
2609         * Modules/encryptedmedia/MediaKeySession.cpp:
2610         (WebCore::MediaKeySession::registerClosedPromise):
2611         (WebCore::MediaKeySession::sessionClosed):
2612         * Modules/encryptedmedia/MediaKeySession.h:
2613         * bindings/js/JSMediaKeySessionCustom.cpp:
2614         (WebCore::JSMediaKeySession::closed):
2615         * testing/MockCDMFactory.cpp:
2616         (WebCore::MockCDMInstance::storeRecordOfKeyUsage):
2617         * testing/MockCDMFactory.h:
2618
2619 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
2620
2621         [EME] Implement MediaKeySession::updateKeyStatuses(), MediaKeyStatusMap
2622         https://bugs.webkit.org/show_bug.cgi?id=167888
2623
2624         Reviewed by Xabier Rodriguez-Calvar.
2625
2626         Implement MediaKeySession::updateKeyStatuses(), transforming the passed-in
2627         KeyStatusVector into a Vector mapping the key IDs to MediaKeyStatus values.
2628         A keystatuseschange event is fired on the MediaKeySession object afterwards.
2629         The queueing of the task that runs the 'attemp to resume playback' on the
2630         related HTMLMediaElement objects isn't done yet since that algorithm isn't
2631         implemented yet.
2632
2633         The statuses Vector is stored on the MediaKeySession object. That Vector is
2634         then exposed through the MediaKeyStatusMap object, each such object being
2635         unique to one MediaKeySession object. The implementation of MediaKeyStatusMap
2636         thus keeps a reference to the session object as long as that object is alive,
2637         and queries the MediaKeySession::statuses() getter to access the Vector that
2638         contains status information for all the key IDs.
2639
2640         MediaKeyStatusMap::Iterator object keeps a reference to the MediaKeyStatusMap
2641         object and accesses the statuses by indexing into the status Vector of the
2642         related MediaKeySession object.
2643
2644         CDMInstance::updateLicense() now accepts the session ID string as the first
2645         argument, making it possible to specify which session should be updated.
2646
2647         MockCDMFactory::keysForSessionWithID() returns an optional reference to the
2648         Vector value in the session map that lists all the key IDs that are being
2649         stored for that session.
2650
2651         MockCDMInstance::updateLicense() now detects the 'keys-changed' entry in the
2652         passed-in response data, and upon detecting that constructs a KeyStatusVector
2653         object containing all the keys for that session. KeyStatus::Usable is returned
2654         for each object at the moment, but this should be adjustable in the future
2655         through additional parameters passed through the response data. The Vector
2656         object is then passed to the callback and is then passed to the 'update key
2657         statuses' algorithm in MediaKeySession.
2658
2659         Covered by a test case in media/encrypted-media/mock-MediaKeySession-update.html.
2660
2661         * Modules/encryptedmedia/CDMInstance.h:
2662         * Modules/encryptedmedia/MediaKeySession.cpp:
2663         (WebCore::MediaKeySession::MediaKeySession):
2664         (WebCore::MediaKeySession::~MediaKeySession):
2665         (WebCore::MediaKeySession::update):
2666         (WebCore::MediaKeySession::updateKeyStatuses):
2667         * Modules/encryptedmedia/MediaKeySession.h:
2668         * Modules/encryptedmedia/MediaKeyStatusMap.cpp:
2669         (WebCore::MediaKeyStatusMap::MediaKeyStatusMap):
2670         (WebCore::MediaKeyStatusMap::detachSession):
2671         (WebCore::MediaKeyStatusMap::size):
2672         (WebCore::keyIdsMatch):
2673         (WebCore::MediaKeyStatusMap::has):
2674         (WebCore::MediaKeyStatusMap::get):
2675         (WebCore::MediaKeyStatusMap::Iterator::Iterator):
2676         (WebCore::MediaKeyStatusMap::Iterator::next):
2677         * Modules/encryptedmedia/MediaKeyStatusMap.h:
2678         (WebCore::MediaKeyStatusMap::create):
2679         * Modules/encryptedmedia/MediaKeyStatusMap.idl:
2680         * testing/MockCDMFactory.cpp:
2681         (WebCore::MockCDMFactory::keysForSessionWithID):
2682         (WebCore::MockCDMInstance::updateLicense):
2683         * testing/MockCDMFactory.h:
2684
2685 2017-02-09  Simon Fraser  <simon.fraser@apple.com>
2686
2687         Improve IOSurfacePool logging
2688         https://bugs.webkit.org/show_bug.cgi?id=168098
2689
2690         Reviewed by Tim Horton.
2691
2692         Pass a string to DUMP_POOL_STATISTICS so we can tell what's triggering the
2693         logging.
2694
2695         * platform/graphics/cg/IOSurfacePool.cpp:
2696         (WebCore::IOSurfacePool::takeSurface):
2697         (WebCore::IOSurfacePool::addSurface):
2698         (WebCore::IOSurfacePool::evict):
2699         (WebCore::IOSurfacePool::collectionTimerFired):
2700         (WebCore::IOSurfacePool::showPoolStatistics):
2701         * platform/graphics/cg/IOSurfacePool.h:
2702
2703 2017-02-09  Alex Christensen  <achristensen@webkit.org>
2704
2705         Unreviewed, rolling out r212040.
2706
2707         Broke build.  I'm not surprised
2708
2709         Reverted changeset:
2710
2711         "[WebRTC][Mac] Activate libwebrtc"
2712         https://bugs.webkit.org/show_bug.cgi?id=167293
2713         http://trac.webkit.org/changeset/212040
2714
2715 2017-02-09  Chris Dumez  <cdumez@apple.com>
2716
2717         [Mac][WK2] Use MIME type to add file extension to downloads' suggested filenames when missing
2718         https://bugs.webkit.org/show_bug.cgi?id=168077
2719         <rdar://problem/30412595>
2720
2721         Reviewed by Alex Christensen.
2722
2723         Add utility function to MIMETypeRegistry that appends an extension to
2724         a filename if necessary, based on a provided MIME type.
2725
2726         Tests: fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
2727                http/tests/download/anchor-download-no-extension.html
2728
2729         * platform/MIMETypeRegistry.cpp:
2730         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
2731         * platform/MIMETypeRegistry.h:
2732         * platform/cocoa/MIMETypeRegistryCocoa.mm:
2733         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
2734
2735 2017-02-09  Youenn Fablet  <youenn@apple.com>
2736
2737         [WebRTC][Mac] Activate libwebrtc
2738         https://bugs.webkit.org/show_bug.cgi?id=167293
2739
2740         Reviewed by Alex Christensen.
2741
2742         * Configurations/WebCore.xcconfig:
2743         * Configurations/WebCoreTestSupport.xcconfig:
2744
2745 2017-02-09  Philip Rogers  <pdr@google.com>
2746
2747         SVG clip-path references can clip out later content
2748         https://bugs.webkit.org/show_bug.cgi?id=164181
2749
2750         Reviewed by Said Abou-Hallawa.
2751
2752         RenderSVGResourceClipper can modify the GraphicsContext state (through the path-only
2753         clipping codepath) so we need to ensure RenderLayer::setupClipPath saves the context
2754         and its caller restores it back so later content is not clipped as well.
2755
2756         This patch is based on a chromium patch by fs@opera.com:
2757         https://chromium.googlesource.com/chromium/src/+/b3f7e7d2c4afb3c7e5c7eb438ff5933cbe2109b3
2758
2759         Test: css3/masking/clip-path-reference-restore.html
2760
2761         * rendering/RenderLayer.cpp:
2762         (WebCore::RenderLayer::setupClipPath): Add a GC save and return true to restore. Also switch to downcast instead of static_cast.
2763
2764 2017-02-09  Filip Pizlo  <fpizlo@apple.com>
2765
2766         SharedArrayBuffer does not need to be in the transfer list
2767         https://bugs.webkit.org/show_bug.cgi?id=168079
2768
2769         Reviewed by Geoffrey Garen and Keith Miller.
2770
2771         Tests: workers/sab/multi-memory-multi-buffer.html
2772                workers/sab/multi-memory.html
2773                workers/sab/no-transfer.html
2774                workers/sab/postMessage-clones.html
2775                workers/sab/sent-from-worker-no-transfer.html
2776                workers/sab/sent-from-worker-transfer.html
2777
2778         The SAB API that we originally implemented required that SABs get put in transfer lists
2779         when they are sent to workers.
2780         
2781         The new SAB API that everyone is converging towards requires that you do not put the
2782         SAB in the transfer list. That's supposed to be an error. Instead, anytime that a SAB
2783         is part of any message to or from a dedicated worker then it is automatically shared.
2784         
2785         The new API provides a lot more clarity about what is supposed to happen in contexts
2786         that support transfering but don't support sharing.
2787         
2788         Right now this patch allows both styles to work, but I hope we can disable the transfer
2789         list capability soon.
2790
2791         * bindings/js/IDBBindingUtilities.cpp:
2792         (WebCore::deserializeIDBValueToJSValue):
2793         * bindings/js/JSMessageEventCustom.cpp:
2794         (WebCore::JSMessageEvent::data):
2795         * bindings/js/SerializedScriptValue.cpp:
2796         (WebCore::CloneSerializer::serialize):
2797         (WebCore::CloneSerializer::CloneSerializer):
2798         (WebCore::CloneSerializer::dumpIfTerminal):
2799         (WebCore::CloneDeserializer::deserialize):
2800         (WebCore::CloneDeserializer::CloneDeserializer):
2801         (WebCore::CloneDeserializer::readTerminal):
2802         (WebCore::SerializedScriptValue::SerializedScriptValue):
2803         (WebCore::SerializedScriptValue::create):
2804         (WebCore::SerializedScriptValue::deserialize):
2805         * bindings/js/SerializedScriptValue.h:
2806         (): Deleted.
2807         * dom/CustomEvent.cpp:
2808         (WebCore::CustomEvent::trySerializeDetail):
2809         * dom/ErrorEvent.cpp:
2810         (WebCore::ErrorEvent::trySerializeError):
2811         * dom/MessageEvent.cpp:
2812         (WebCore::MessageEvent::trySerializeData):
2813         * dom/PopStateEvent.cpp:
2814         (WebCore::PopStateEvent::trySerializeState):
2815         * workers/DedicatedWorkerGlobalScope.cpp:
2816         (WebCore::DedicatedWorkerGlobalScope::postMessage):
2817         * workers/Worker.cpp:
2818         (WebCore::Worker::postMessage):
2819
2820 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
2821
2822         Unreviewed build fix after r212025.
2823
2824         inDocument -> isConnected
2825
2826         * html/FormAssociatedElement.cpp:
2827         (WebCore::FormAssociatedElement::didMoveToNewDocument):
2828         (WebCore::FormAssociatedElement::resetFormAttributeTargetObserver):
2829         * html/HTMLFormElement.cpp:
2830         (WebCore::HTMLFormElement::formElementIndex):
2831
2832 2017-02-09  Chris Dumez  <cdumez@apple.com>
2833
2834         Make sure Event keeps its current target element alive
2835         https://bugs.webkit.org/show_bug.cgi?id=167885
2836         <rdar://problem/30376972>
2837
2838         Reviewed by Brent Fulgham.
2839
2840         Make sure Event keeps its current target element alive to avoid
2841         crashes if it is accessed by JS after it has been garbage collected.
2842
2843         Test: fast/events/currentTarget-gc-crash.html
2844
2845         * dom/Event.cpp:
2846         (WebCore::Event::setCurrentTarget):
2847         * dom/Event.h:
2848         (WebCore::Event::currentTarget):
2849
2850 2017-02-09  Ryosuke Niwa  <rniwa@webkit.org>
2851
2852         Crash in render tree after dynamically mutating the slot value
2853         https://bugs.webkit.org/show_bug.cgi?id=167502
2854
2855         Reviewed by Antti Koivisto.
2856
2857         The crash was caused by attributeChanged not destructing the render tree after an assigned element had been
2858         removed from its slot. Since the style resolver can no longer find this element in the flat tree, we need to
2859         delete its render object as if the element had been removed from the DOM tree.
2860
2861         Tests: fast/html/details-summary-slot.html
2862                fast/shadow-dom/shadow-slot-attribute-change-crash.html
2863
2864         * dom/Element.cpp:
2865         (WebCore::Element::attributeChanged):
2866         * html/HTMLSummaryElement.cpp:
2867         (WebCore::SummarySlotElement): Added. Always use the default slot regardless of the slot attribute's value.
2868         (WebCore::HTMLSummaryElement::create): Use SummarySlotElement
2869
2870 2017-02-09  Antti Koivisto  <antti@apple.com>
2871
2872         Details element doesn't work correctly when mutating content between closing and opening
2873         https://bugs.webkit.org/show_bug.cgi?id=167310
2874
2875         Reviewed by Ryosuke Niwa.
2876
2877         Tests: fast/html/details-close-modify-open.html
2878                fast/shadow-dom/slot-remove-mutate-add.html
2879
2880         * dom/SlotAssignment.cpp:
2881         (WebCore::SlotAssignment::didChangeSlot):
2882
2883             Always reset the slot assignment when content is mutated.
2884
2885 2017-02-09  Chris Dumez  <cdumez@apple.com>
2886
2887         Crash under FormSubmission::create()
2888         https://bugs.webkit.org/show_bug.cgi?id=167200
2889         <rdar://problem/30096323>
2890
2891         Reviewed by Darin Adler.
2892
2893         The issue is that FormSubmission::create() was iterating over
2894         form.associatedElements() as was calling Element::appendFormData()
2895         in the loop. HTMLObjectElement::appendFormData() was calling
2896         pluginWidget(PluginLoadingPolicy::Load) which causes a synchronous
2897         layout and can fire events (such as focus event) synchronously.
2898         Firing those events synchronously allows the JS to modify the
2899         form.associatedElements() vector we are currently iterating on.
2900
2901         To avoid this issue, we now call pluginWidget(PluginLoadingPolicy::DoNotLoad)
2902         in HTMLObjectElement::appendFormData() as we are not allowed to fire
2903         synchronous events at this point. I also added a security assertion
2904         in FormSubmission::create() to catch cases where we fire JS events
2905         while iterating over the form associated elements to more easily
2906         notice these things in the future.
2907
2908         Test: fast/forms/formsubmission-appendFormData-crash.html
2909
2910         * html/HTMLObjectElement.cpp:
2911         (WebCore::HTMLObjectElement::appendFormData):
2912         * loader/FormSubmission.cpp:
2913         (WebCore::FormSubmission::create):
2914
2915 2017-02-09  Chris Dumez  <cdumez@apple.com>
2916
2917         Crash under HTMLFormElement::registerFormElement()
2918         https://bugs.webkit.org/show_bug.cgi?id=167162
2919
2920         Reviewed by Ryosuke Niwa.
2921
2922         didMoveToNewDocument() was re-registering FormAttributeTargetObserver
2923         even if the element's inDocument was not set yet. As a result, it was
2924         possible for FormAssociatedElement::resetFormOwner() to be called
2925         when the element was in the tree but with its inDocument still being
2926         false (because insertedInto() has not been called yet). This could
2927         end up calling HTMLFormElement::registerFormElement() even though
2928         the element is still recognized as detached. This is an issue because
2929         HTMLFormElement::m_associatedElements's order and its corresponding
2930         indexes (m_associatedElementsBeforeIndex / m_associatedElementsAfterIndex)
2931         rely on the position of the element with regards to the form element
2932         (before / inside / after).
2933
2934         To address the issue, we now only register the FormAttributeTargetObserver
2935         in didMoveToNewDocument() if the inDocument flag is set to true. This
2936         is similar to what is done at other call sites of
2937         resetFormAttributeTargetObserver(). We also ignore the form content
2938         attribute in HTMLFormElement::formElementIndex() if the element is
2939         not connected.
2940
2941         As per the HTML specification [1], the form content attribute is only
2942         taken if the element is connected (i.e. inDocument flag is true).
2943
2944         Note that FormAssociatedElement::findAssociatedForm() was already
2945         ignoring the form content attribute if the element is disconnected.
2946
2947         [1] https://html.spec.whatwg.org/#reset-the-form-owner (step 3)
2948
2949         Test: fast/forms/registerFormElement-crash.html
2950
2951         * html/FormAssociatedElement.cpp:
2952         (WebCore::FormAssociatedElement::didMoveToNewDocument):
2953         Only call resetFormAttributeTargetObserver() if inDocument flag is set,
2954         similarly to what is done at other call sites.
2955
2956         (WebCore::FormAssociatedElement::resetFormAttributeTargetObserver):
2957         Add an assertion to make sure no one call this method on an element that
2958         is not connected.
2959
2960         * html/HTMLFormElement.cpp:
2961         (WebCore::HTMLFormElement::formElementIndex):
2962         Ignore the form content attribute if the element is not connected, as
2963         per the HTML specification [1].
2964
2965 2017-02-09  Antti Koivisto  <antti@apple.com>
2966
2967         Tear down existing renderers when adding a shadow root.
2968         https://bugs.webkit.org/show_bug.cgi?id=167117
2969
2970         Reviewed by Andreas Kling.
2971
2972         Adding a shadow root may cause children no longer be part of the flat tree. If they had renderers
2973         tear down code would no longer reach them.
2974
2975         Test: fast/shadow-dom/attach-shadow-teardown.html
2976
2977         * dom/Element.cpp:
2978         (WebCore::Element::addShadowRoot):
2979
2980             Tear down existing render tree when adding a shadow root.
2981
2982 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
2983
2984         Handle synchronous layout when setting a selection range
2985         https://bugs.webkit.org/show_bug.cgi?id=167092
2986         <rdar://problem/30041640>
2987
2988         Reviewed by Antti Koivisto.
2989
2990         The 'innerTextElement' of a form control can change during layout due
2991         to arbitrary JavaScript executing. Handle the case where the inner text
2992         element has changed so that current render box height is while setting
2993         a selection range.
2994
2995         Test: fast/forms/input-type-change-during-selection.html
2996
2997         * html/HTMLTextFormControlElement.cpp:
2998         (WebCore::HTMLTextFormControlElement::setSelectionRange):
2999
3000 2017-02-09  Alex Christensen  <achristensen@webkit.org>
3001
3002         Fix CMake build.
3003
3004         * PlatformMac.cmake:
3005
3006 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
3007
3008         Disconnect shadow children of root when detaching a frame
3009         https://bugs.webkit.org/show_bug.cgi?id=166851
3010         <rdar://problem/29930443>
3011
3012         Reviewed by Andy Estes.
3013
3014         If the root of the tree we are disconnecting has a shadow element, include it in the set of
3015         things to disconnect.
3016
3017         Tests: fast/shadow-dom/shadow-at-root-during-disconnect.html
3018
3019         * dom/ContainerNodeAlgorithms.cpp:
3020         (WebCore::disconnectSubframes):
3021
3022 2017-02-09  Alexey Proskuryakov  <ap@apple.com>
3023
3024         Remove unused WebThreadRunSync
3025         https://bugs.webkit.org/show_bug.cgi?id=168024
3026
3027         Reviewed by Tim Horton.
3028
3029         * platform/ios/wak/WebCoreThreadRun.cpp:
3030         * platform/ios/wak/WebCoreThreadRun.h:
3031         * platform/ios/wak/WebCoreThreadSystemInterface.cpp:
3032         (InitWebCoreThreadSystemInterface):
3033
3034 2017-02-09  Ryan Haddad  <ryanhaddad@apple.com>
3035
3036         Unreviewed, rolling out r211802.
3037
3038         This change caused fast/regions/inline-block-inside-anonymous-
3039         overflow-with-covered-controls.html to be a flaky failure.
3040
3041         Reverted changeset:
3042
3043         "[Modern Media Controls] Improve handling of <video> with only
3044         audio tracks"
3045         https://bugs.webkit.org/show_bug.cgi?id=167836
3046         http://trac.webkit.org/changeset/211802
3047
3048 2017-02-09  Alex Christensen  <achristensen@webkit.org>
3049
3050         Fix i386 libwebrtc build
3051         https://bugs.webkit.org/show_bug.cgi?id=168038
3052
3053         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
3054         DataChannelInterface::buffered_amount returns a uint64_t, and we want a size_t.
3055         If this overflows, then we've run out of memory and crashed a long time ago.
3056
3057 2017-02-09  Andreas Kling  <akling@apple.com>
3058
3059         Document::settings() should return a const Settings&.
3060         <https://webkit.org/b/168061>
3061
3062         Reviewed by Geoffrey Garen.
3063
3064         - Make Document::settings() return a const reference.
3065         - Added Document::mutableSettings() for all your non-const needs.
3066         - Fixed up settings generator to produce const getters.
3067         - Simplify a few settings() call sites that exposed themselves.
3068
3069         * Modules/applepay/ApplePaySession.cpp:
3070         (WebCore::shouldDiscloseApplePayCapability):
3071         * Modules/mediastream/UserMediaRequest.cpp:
3072         (WebCore::canCallGetUserMedia):
3073         * css/CSSFontFace.cpp:
3074         (WebCore::CSSFontFace::appendSources):
3075         * css/CSSFontSelector.cpp:
3076         (WebCore::resolveGenericFamily):
3077         * css/StyleResolver.h:
3078         (WebCore::StyleResolver::settings):
3079         * dom/Document.h:
3080         (WebCore::Document::settings):
3081         (WebCore::Document::mutableSettings):
3082         * html/FTPDirectoryDocument.cpp:
3083         (WebCore::createTemplateDocumentData):
3084         * html/HTMLCanvasElement.cpp:
3085         (WebCore::shouldEnableWebGL):
3086         * html/HTMLEmbedElement.cpp:
3087         (WebCore::HTMLEmbedElement::rendererIsNeeded):
3088         * html/HTMLSelectElement.cpp:
3089         (WebCore::HTMLSelectElement::menuListDefaultEventHandler):
3090         * html/ImageDocument.cpp:
3091         (WebCore::ImageDocument::updateDuringParsing):
3092         * page/csp/ContentSecurityPolicy.cpp:
3093         (WebCore::ContentSecurityPolicy::allowContentSecurityPolicySourceStarToMatchAnyProtocol):
3094         * page/make_settings.pl:
3095         (printGetterAndSetter):
3096         * rendering/SimpleLineLayout.cpp:
3097         (WebCore::SimpleLineLayout::toggleSimpleLineLayout):
3098
3099 2017-02-09  Jer Noble  <jer.noble@apple.com>
3100
3101         Make passing PlatformAudioData in audioSamplesAvaliable const-correct.
3102         https://bugs.webkit.org/show_bug.cgi?id=168051
3103
3104         Reviewed by Eric Carlson.
3105
3106         Modify all the functions which take a (conceptually) read-only audio buffer const-correct.
3107
3108         Drive-by fix: AudioSampleBufferList::copyFrom() set a ivar pointer to the passed in
3109         AudioBufferList. Ensure that the ivar is reset when copyFrom() returns by using a
3110         SetForScope.
3111
3112         * platform/audio/mac/AudioSampleBufferList.cpp:
3113         (WebCore::AudioSampleBufferList::copyFrom):
3114         * platform/audio/mac/AudioSampleBufferList.h:
3115         * platform/audio/mac/AudioSampleDataSource.cpp:
3116         (WebCore::AudioSampleDataSource::pushSamplesInternal):
3117         (WebCore::AudioSampleDataSource::pushSamples):
3118         * platform/audio/mac/AudioSampleDataSource.h:
3119         * platform/mediastream/RealtimeMediaSource.cpp:
3120         (WebCore::RealtimeMediaSource::audioSamplesAvailable):
3121         * platform/mediastream/RealtimeMediaSource.h:
3122         (WebCore::RealtimeMediaSource::Observer::audioSamplesAvailable):
3123         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3124         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
3125         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
3126         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
3127         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
3128         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
3129
3130 2017-02-09  Jer Noble  <jer.noble@apple.com>
3131
3132         Fix some logging statements in MediaPlayerPrivateMediaStreamAVFObjC
3133         https://bugs.webkit.org/show_bug.cgi?id=168063
3134
3135         Reviewed by Eric Carlson.
3136
3137         Make the format string match the types passed in (i.e., floats, not strings).
3138
3139         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3140         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateSampleTimes):
3141
3142 2017-02-09  Eric Carlson  <eric.carlson@apple.com>
3143
3144         [MediaStream Mac] Handle NULL m_sampleBufferDisplayLayer
3145         https://bugs.webkit.org/show_bug.cgi?id=168060
3146
3147         Reviewed by Jer Noble.
3148
3149         No new tests, this avoids an occasional crash on the bots.
3150
3151         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3152         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): Don't assume
3153         m_sampleBufferDisplayLayer is valid.
3154
3155 2017-02-09  Chris Dumez  <cdumez@apple.com>
3156
3157         Object.getPrototypeOf(NodeFilter) should be Function.prototype, not Object.prototype
3158         https://bugs.webkit.org/show_bug.cgi?id=167964
3159
3160         Reviewed by Youenn Fablet.
3161
3162         Object.getPrototypeOf(NodeFilter) should be Function.prototype, not Object.prototype
3163         after the following WebIDL spec change:
3164         - https://github.com/heycam/webidl/issues/96
3165
3166         This aligns our behavior with other browsers as the spec has been updated to match
3167         the majority.
3168
3169         No new tests, rebaselined existing test.
3170
3171         * bindings/scripts/CodeGeneratorJS.pm:
3172         (GenerateConstructorHelperMethods):
3173         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
3174         (WebCore::JSTestCallbackInterfaceConstructor::prototypeForStructure):
3175
3176 2017-02-09  Miguel Gomez  <magomez@igalia.com>
3177
3178         [GTK] scroll with transparent background not repainted after scrollY >= 32768
3179         https://bugs.webkit.org/show_bug.cgi?id=154283
3180
3181         Reviewed by Carlos Garcia Campos.
3182
3183         Due to a limitation of the pixman backend, which uses 16 bits to hold signed integers, cairo is
3184         not able to draw anything when using transformation matrices with values bigger than 32768. When
3185         drawing patterns into large pages, the matrices values can overflow those 16 bits, so cairo doesn't
3186         draw anything in, which causes the reported transparent backgrounds.
3187
3188         The patch modifies the transformation matrices both from the current context and the pattern we
3189         are painting, to avoid them to hold values that cannot stored in 16 bits.
3190
3191         There's still the possibility that this happens, but it would require using a pattern with a size
3192         bigger than 32768.
3193
3194         Based on a previous patch by Gwang Yoon Hwang  <yoon@igalia.com>.
3195
3196         No new tests.
3197
3198         * platform/graphics/cairo/CairoUtilities.cpp:
3199         (WebCore::drawPatternToCairoContext):
3200
3201 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
3202
3203         Unreviewed build fix after r211965.
3204
3205         * dom/Document.cpp:
3206         (WebCore::Document::adoptNode): inDocument -> isConnected
3207
3208 2017-02-09  Ryosuke Niwa  <rniwa@webkit.org>
3209
3210         Adopting a child node of a script element can run script
3211         https://bugs.webkit.org/show_bug.cgi?id=167318
3212
3213         Reviewed by Darin Adler.
3214
3215         The bug was caused by ScriptElement::childrenChanged indiscriminately running the script.
3216         Do this only if some node has been inserted as spec'ed:
3217
3218         https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model
3219         "The script element is connected and a node or document fragment is inserted into
3220         the script element, after any script elements inserted at that time."
3221
3222         Split NonContentsChildChanged into NonContentsChildInserted and NonContentsChildRemoved to disambiguate
3223         non-contents child such as text and element being removed or inserted. New behavior matches that of
3224         Gecko and Chrome as well as the latest HTML5 specification.
3225
3226         Also deploy NoEventDispatchAssertion in more places. Unfortunately, this results in some DOM trees
3227         internal to WebKit to be mutated while there is NoEventDispatchAssertion in the stack. Added a new RAII
3228         object "EventAllowedScope" to temporarily disable this assertion within such a tree. CachedSVGFont's
3229         ensureCustomFontData used to completely disable this assertion but we no longer have to do this either.
3230
3231         To clarify the new semantics, renamed isEventDispatchForbidden to isEventAllowedInMainThread with
3232         the negated boolean value, and added a new variant isEventDispatchAllowedInSubtree, which checks
3233         isEventDispatchForbidden() is true or if the node was one of an internal DOM node or its descendent
3234         held by EventAllowedScope.
3235
3236         Inspired by https://chromium.googlesource.com/chromium/src/+/604e798ec6ee30f44d57a5c4a44ce3dab3a871ed
3237
3238         Tests: fast/html/script-must-not-run-when-child-is-adopted.html
3239                fast/html/script-must-not-run-when-child-is-removed.html
3240
3241         * dom/CharacterData.cpp:
3242         (WebCore::CharacterData::notifyParentAfterChange): Added NoEventDispatchAssertion.
3243         * dom/ContainerNode.cpp:
3244         (WebCore::ContainerNode::insertBefore): Added NoEventDispatchAssertion around TreeScope's adoptIfNeeded
3245         and insertBeforeCommon as done elsewhere.
3246         (WebCore::ContainerNode::appendChildCommon): Added NoEventDispatchAssertion.
3247         (WebCore::ContainerNode::changeForChildInsertion): Use NonContentsChildInserted here.
3248         (WebCore::ContainerNode::notifyChildRemoved): Added NoEventDispatchAssertion.
3249         (WebCore::ContainerNode::replaceChild): Moved adoptIfNeeded into NoEventDispatchAssertion.
3250         (WebCore::ContainerNode::removeChild): Added NoEventDispatchAssertion.
3251         (WebCore::ContainerNode::parserRemoveChild): Added NoEventDispatchAssertion.
3252         (WebCore::ContainerNode::removeChildren): Call childrenChanged in NoEventDispatchAssertion.
3253         (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): Moved adoptIfNeeded into
3254         NoEventDispatchAssertion.
3255         (WebCore::dispatchChildInsertionEvents): Check the forbidden-ness more precisely.
3256         (WebCore::dispatchChildRemovalEvents): Ditto.
3257         * dom/ContainerNode.h:
3258         (WebCore::ContainerNode::ChildChange::isInsertion): Added.
3259         * dom/ContainerNodeAlgorithms.cpp:
3260         (WebCore::notifyChildNodeInserted): Check the forbidden-ness more precisely. Here, we check against
3261         insertionPoint since EventAllowedScope checks against the root node.
3262         * dom/Document.cpp:
3263         (WebCore::Document::adoptNode): Assert the node to be adopted has not been inserted back, or else
3264         remove() had resulted in an exception before calling TreeScope::adoptIfNeeded.
3265         * dom/Element.cpp:
3266         (WebCore::Element::childrenChanged):
3267         * dom/NoEventDispatchAssertion.h:
3268         (WebCore::NoEventDispatchAssertion::isEventDispatchForbidden): Added a new variant that takes a node.
3269         If this node is a descendent of a node "marked as safe" by EventAllowedScope, then we don't consider
3270         the event dispatch to be forbidden.
3271         (WebCore::NoEventDispatchAssertion::dropTemporarily): Deleted.
3272         (WebCore::NoEventDispatchAssertion::restoreDropped): Deleted.
3273         (WebCore::NoEventDispatchAssertion::EventAllowedScope): Added. A RAII object which marks descendants of
3274         a given node as "safe" for the purpose of checking isEventDispatchForbidden.
3275         (WebCore::NoEventDispatchAssertion::EventAllowedScope::EventAllowedScope): Added. There can be a chain
3276         of EventAllowedScope objects in the stack. s_currentScope points to the most recently instantiated
3277         RAII object, and each instance remembers prior instance. 
3278         (WebCore::NoEventDispatchAssertion::EventAllowedScope::~EventAllowedScope): Added.
3279         (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNode): Added. Returns true if the given
3280         node is a descendent of any node held by instances of EventAllowedScope.
3281         (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNodeInternal): Added. A helper function
3282         for isAllowedNode.
3283         * dom/Node.cpp:
3284         (WebCore::Node::dispatchSubtreeModifiedEvent): Check the forbidden-ness more precisely.
3285         * dom/ScriptElement.cpp:
3286         (WebCore::ScriptElement::childrenChanged): Only prepare the script if we've inserted nodes.
3287         (WebCore::ScriptElement::executeClassicScript): Assert isEventDispatchForbidden is false since running
3288         arbitrary author scripts can, indeed, result dispatch any events.
3289         * dom/ScriptElement.h:
3290         * html/HTMLElement.cpp:
3291         (WebCore::textToFragment): Made this a static local function and not return an exception since there
3292         is no way appendChild called in this function can throw an exception.
3293         (WebCore::HTMLElement::setInnerText): Create EventAllowedScope for the fragment. It's called called by
3294         HTMLTextAreaElement's childrenChanged to update its UA shadow tree, and it's dispatching as event on
3295         a new fragment can't execute arbitrary scripts since it has never been exposed to author scripts.
3296         Because of the precise-ness of this check, this does not disable the assertion for "this" element.
3297         HTMLTextFormControlElement::setInnerTextValue explicitly creates another EventAllowedScope to mark
3298         the shadow tree into which the fragment is inserted safe.
3299         (WebCore::HTMLElement::setOuterText):
3300         * html/HTMLElement.h:
3301         * html/HTMLScriptElement.cpp:
3302         (WebCore::HTMLScriptElement::childrenChanged):
3303         * html/HTMLTextFormControlElement.cpp:
3304         (WebCore::HTMLTextFormControlElement::setInnerTextValue): See above (setInnerText).
3305         * html/track/VTTCue.cpp:
3306         (WebCore::VTTCue::createCueRenderingTree): Create EventAllowedScope for the cloned fragment here since
3307         the VTT tree is never exposed to author scripts.
3308         (WebCore::VTTCue::updateDisplayTree): Ditto.
3309         * loader/cache/CachedSVGFont.cpp:
3310         (WebCore::CachedSVGFont::ensureCustomFontData): Use EventAllowedScope to disable assertions only on
3311         the new SVG document we just created instead of disabling for all DOM trees.
3312         * svg/SVGScriptElement.cpp:
3313         (WebCore::SVGScriptElement::childrenChanged):
3314
3315 2017-02-09  Andreas Kling  <akling@apple.com>
3316
3317         Document should always have a Settings.
3318         <https://webkit.org/b/120172>
3319
3320         Reviewed by Antti Koivisto.
3321
3322         Since a Document can't move between Frames, and it's either frameless
3323         or partnered with a Frame provided at construction time, we know that
3324         it will never need to switch between different Settings objects either.
3325
3326         Give Document a Ref<Settings> that contains either the Frame's Settings
3327         or a default-constructed Settings object if frameless.
3328         Document::settings() is promoted to a reference getter.
3329
3330         The bulk of this patch is removing now-unnecessary null checks.
3331
3332         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
3333         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
3334         * Modules/plugins/PluginReplacement.h:
3335         (WebCore::ReplacementPlugin::isEnabledBySettings):
3336         * Modules/plugins/QuickTimePluginReplacement.h:
3337         * Modules/plugins/QuickTimePluginReplacement.mm:
3338         (WebCore::QuickTimePluginReplacement::isEnabledBySettings):
3339         * Modules/plugins/YouTubePluginReplacement.cpp:
3340         (WebCore::YouTubePluginReplacement::isEnabledBySettings):
3341         * Modules/plugins/YouTubePluginReplacement.h:
3342         * Modules/webaudio/AudioContext.cpp:
3343         (WebCore::AudioContext::constructCommon):
3344         * bindings/js/CachedScriptFetcher.cpp:
3345         (WebCore::CachedScriptFetcher::requestScriptWithCache):
3346         * css/CSSFontFace.cpp:
3347         (WebCore::CSSFontFace::appendSources):
3348         (WebCore::CSSFontFace::webFontsShouldAlwaysFallBack):
3349         * css/CSSFontSelector.cpp:
3350         (WebCore::CSSFontSelector::fallbackFontCount):
3351         (WebCore::CSSFontSelector::fallbackFontAt):
3352         * css/StyleBuilderConverter.h:
3353         (WebCore::StyleBuilderConverter::convertResize):
3354         * css/StyleBuilderCustom.h:
3355         (WebCore::StyleBuilderCustom::applyValueFontFamily):
3356         * css/StyleResolver.cpp:
3357         (WebCore::StyleResolver::StyleResolver):
3358         (WebCore::StyleResolver::defaultStyleForElement):
3359         (WebCore::StyleResolver::adjustRenderStyle):
3360         (WebCore::StyleResolver::checkForGenericFamilyChange):
3361         (WebCore::StyleResolver::initializeFontStyle):
3362         * css/StyleResolver.h:
3363         (WebCore::StyleResolver::settings):
3364         (WebCore::StyleResolver::documentSettings): Deleted.
3365         * css/parser/CSSParser.cpp:
3366         (WebCore::CSSParserContext::CSSParserContext):
3367         * dom/Document.cpp:
3368         (WebCore::Document::Document):
3369         (WebCore::Document::setReadyState):
3370         (WebCore::Document::setVisualUpdatesAllowed):
3371         (WebCore::Document::defaultCharsetForLegacyBindings):
3372         (WebCore::Document::recalcStyle):
3373         (WebCore::Document::implicitClose):
3374         (WebCore::Document::minimumLayoutDelay):
3375         (WebCore::Document::setDomain):
3376         (WebCore::Document::audioPlaybackRequiresUserGesture):
3377         (WebCore::Document::videoPlaybackRequiresUserGesture):
3378         (WebCore::Document::storageBlockingStateDidChange):
3379         (WebCore::Document::isTelephoneNumberParsingEnabled):
3380         (WebCore::Document::initSecurityContext):
3381         (WebCore::Document::initDNSPrefetch):
3382         (WebCore::Document::getCachedLocale):
3383         (WebCore::Document::shouldEnforceContentDispositionAttachmentSandbox):
3384         (WebCore::Document::settings): Deleted.
3385         * dom/Document.h:
3386         (WebCore::Document::settings):
3387         * dom/Element.cpp:
3388         (WebCore::subpixelMetricsEnabled):
3389         * dom/ExtensionStyleSheets.cpp:
3390         (WebCore::ExtensionStyleSheets::pageUserSheet):
3391         * dom/ScriptExecutionContext.cpp:
3392         (WebCore::ScriptExecutionContext::dispatchErrorEvent):
3393         * dom/ScriptableDocumentParser.cpp:
3394         (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
3395         * dom/ScriptedAnimationController.cpp:
3396         (WebCore::ScriptedAnimationController::requestAnimationFrameEnabled):
3397         * dom/make_names.pl:
3398         (printConstructorInterior):
3399         * editing/Editor.cpp:
3400         * editing/markup.cpp:
3401         (WebCore::createMarkupInternal):
3402         * html/FTPDirectoryDocument.cpp:
3403         (WebCore::createTemplateDocumentData):
3404         * html/HTMLAnchorElement.cpp:
3405         (WebCore::HTMLAnchorElement::setActive):
3406         (WebCore::HTMLAnchorElement::sendPings):
3407         (WebCore::HTMLAnchorElement::treatLinkAsLiveForEventType):
3408         * html/HTMLAppletElement.cpp:
3409         (WebCore::HTMLAppletElement::canEmbedJava):
3410         * html/HTMLCanvasElement.cpp:
3411         (WebCore::HTMLCanvasElement::getContext2d):
3412         (WebCore::shouldEnableWebGL):
3413         (WebCore::HTMLCanvasElement::shouldAccelerate):
3414         * html/HTMLFormElement.cpp:
3415         (WebCore::HTMLFormElement::submitImplicitly):
3416         * html/HTMLFrameElementBase.cpp:
3417         (WebCore::HTMLFrameElementBase::setLocation):
3418         * html/HTMLImageElement.cpp:
3419         (WebCore::HTMLImageElement::updateImageControls):
3420         * html/HTMLImageLoader.cpp:
3421         (WebCore::HTMLImageLoader::sourceURI):
3422         * html/HTMLInputElement.cpp:
3423         (WebCore::HTMLInputElement::setupDateTimeChooserParameters):
3424         * html/HTMLLinkElement.cpp:
3425         (WebCore::HTMLLinkElement::process):
3426         * html/HTMLMediaElement.cpp:
3427         (WebCore::HTMLMediaElement::HTMLMediaElement):
3428         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory):
3429         (WebCore::HTMLMediaElement::mediaPlayerAcceleratedCompositingEnabled):
3430         (WebCore::HTMLMediaElement::enterFullscreen):
3431         (WebCore::HTMLMediaElement::exitFullscreen):
3432         (WebCore::HTMLMediaElement::mediaPlayerNeedsSiteSpecificHacks):
3433         (WebCore::HTMLMediaElement::mediaPlayerNetworkInterfaceName):
3434         (WebCore::HTMLMediaElement::setMediaControlsDependOnPageScaleFactor):
3435         (WebCore::HTMLMediaElement::doesHaveAttribute):
3436         * html/HTMLVideoElement.cpp:
3437         (WebCore::HTMLVideoElement::HTMLVideoElement):
3438         * html/MediaElementSession.cpp:
3439         (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled):
3440         (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
3441         (WebCore::MediaElementSession::allowsAutomaticMediaDataLoading):
3442         (WebCore::MediaElementSession::allowsPictureInPicture):
3443         (WebCore::MediaElementSession::maximumMediaSourceBufferSize):
3444         * html/parser/HTMLParserOptions.cpp:
3445         (WebCore::HTMLParserOptions::HTMLParserOptions):
3446         * html/shadow/MediaControlElements.cpp:
3447         (WebCore::MediaControlFullscreenButtonElement::defaultEventHandler):
3448         * loader/LinkLoader.cpp:
3449         (WebCore::LinkLoader::loadLink):
3450         * page/csp/ContentSecurityPolicy.cpp:
3451         (WebCore::ContentSecurityPolicy::allowContentSecurityPolicySourceStarToMatchAnyProtocol):
3452         * rendering/SimpleLineLayout.cpp:
3453         (WebCore::SimpleLineLayout::toggleSimpleLineLayout):
3454         * style/StyleFontSizeFunctions.cpp:
3455         (WebCore::Style::computedFontSizeFromSpecifiedSize):
3456         (WebCore::Style::fontSizeForKeyword):
3457         (WebCore::Style::legacyFontSizeForPixelSize):
3458         * style/StyleScope.cpp:
3459         (WebCore::Style::Scope::collectActiveStyleSheets):
3460         * xml/XMLHttpRequest.cpp:
3461         (WebCore::XMLHttpRequest::usesDashboardBackwardCompatibilityMode):
3462
3463 2017-02-09  Antti Koivisto  <antti@apple.com>
3464
3465         Use all cacheable speculatively loaded responses
3466         https://bugs.webkit.org/show_bug.cgi?id=168052
3467
3468         Reviewed by Andreas Kling.
3469
3470         * platform/network/CacheValidation.cpp:
3471         (WebCore::isStatusCodeCacheableByDefault):
3472         (WebCore::isStatusCodePotentiallyCacheable):
3473
3474         Moved here from WebKit2.
3475
3476         * platform/network/CacheValidation.h:
3477
3478 2017-02-09  Eric Carlson  <eric.carlson@apple.com>
3479
3480         [MediaStream] Remove legacy Navigator.webkitGetUserMedia
3481         https://bugs.webkit.org/show_bug.cgi?id=168016
3482
3483         Reviewed by Youenn Fablet.
3484
3485         No new tests, existing tests updated.
3486
3487         * WebCore.xcodeproj/project.pbxproj: NavigatorUserMedia.
3488         * DerivedSources.make: Ditto.
3489         * CMakeLists.txt: Ditto.
3490         * Modules/mediastream/NavigatorUserMedia.idl: Removed.
3491         * Modules/mediastream/NavigatorUserMedia.js: Removed.
3492         * WebCore.xcodeproj/project.pbxproj:
3493         * page/Navigator.idl: Add some whitespace to force derived sources to be rebuild correctly.
3494
3495 2017-02-09  Antoine Quint  <graouts@apple.com>
3496
3497         [Modern Media Controls] Tapping the skip back button on iOS inline media controls make the controls disappear
3498         https://bugs.webkit.org/show_bug.cgi?id=168049
3499         <rdar://problem/30442660>
3500
3501         Reviewed by Eric Carlson.
3502
3503         Calling elementAtPoint() on the Document will not return an element in the ShadowRoot,
3504         we need to call it on the ShadowRoot. So we now iterate over ancestors of the controls
3505         bar to find the ShadowRoot, if any, and check whether the tapped element is contained
3506         within the controls bar. We only fade the controls bar out if the tapped element is
3507         outside of the controls bar hierarchy.
3508
3509         Test: media/modern-media-controls/media-controller/media-controller-ios-do-not-hide-controls-when-tapping-button.html
3510
3511         * Modules/modern-media-controls/controls/controls-bar.js:
3512         (ControlsBar.prototype.gestureRecognizerStateDidChange):
3513
3514 2017-02-09  Jer Noble  <jer.noble@apple.com>
3515
3516         Configure MockRealtimeAudioSourceMac to generate stereo audio
3517         https://bugs.webkit.org/show_bug.cgi?id=168027
3518
3519         Reviewed by Eric Carlson.
3520
3521         Update MockRealtimeAudioSourceMac to generate stereo audio.
3522
3523         First, because the pattern of creating a AudioBufferList structure (with all it's quirks and
3524         weird requirements) was repeated multiple places, add a new wrapper around ABL called
3525         WebAudioBufferList which takes care of correctly initializing the ABL structure and manages
3526         the lifetime of its data members.
3527
3528         * WebCore.xcodeproj/project.pbxproj:
3529         * platform/audio/PlatformAudioData.h: Added.
3530         (WebCore::PlatformAudioData::kind):
3531         * platform/audio/WebAudioBufferList.cpp: Added.
3532         (WebCore::WebAudioBufferList::WebAudioBufferList):
3533         (WebCore::WebAudioBufferList::buffers):
3534         (WebCore::WebAudioBufferList::bufferCount):
3535         (WebCore::WebAudioBufferList::buffer):
3536         * platform/audio/WebAudioBufferList.h: Added.
3537         (WebCore::WebAudioBufferList::list):
3538         (WebCore::WebAudioBufferList::operator AudioBufferList&):
3539         (WebCore::WebAudioBufferList::kind):
3540         (isType):
3541
3542         Then update existing code to work in terms of WebAudioBufferList:
3543
3544         * platform/audio/mac/AudioSampleBufferList.cpp:
3545         (WebCore::AudioSampleBufferList::AudioSampleBufferList):
3546         (WebCore::AudioSampleBufferList::mixFrom):
3547         (WebCore::AudioSampleBufferList::copyFrom):
3548         (WebCore::AudioSampleBufferList::copyTo):
3549         (WebCore::AudioSampleBufferList::reset):
3550         (WebCore::AudioSampleBufferList::configureBufferListForStream): Deleted.
3551         * platform/audio/mac/AudioSampleBufferList.h:
3552         (WebCore::AudioSampleBufferList::bufferList):
3553         * platform/audio/mac/AudioSampleDataSource.cpp:
3554         (WebCore::AudioSampleDataSource::pushSamples):
3555         * platform/audio/mac/AudioSampleDataSource.h:
3556         * platform/mediastream/RealtimeMediaSource.cpp:
3557         (WebCore::RealtimeMediaSource::audioSamplesAvailable):
3558         * platform/mediastream/RealtimeMediaSource.h:
3559         (WebCore::RealtimeMediaSource::Observer::audioSamplesAvailable):
3560         * platform/mediastream/mac/AVAudioCaptureSource.h:
3561         * platform/mediastream/mac/AVAudioCaptureSource.mm:
3562         (WebCore::AVAudioCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
3563         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3564         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
3565         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
3566         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
3567         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
3568         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
3569
3570         Finally, actually update MockRealtimeAudioSource to emit stereo samples. Importantly, set
3571         the correct values for the m_streamFormat; mBytesPerFrame and mBytesPerPacket are not
3572         multiplied by the channelCount. When generating audio, write to both channels of data.
3573
3574         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
3575         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
3576         (WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers):
3577         (WebCore::MockRealtimeAudioSourceMac::reconfigure):
3578         (WebCore::MockRealtimeAudioSourceMac::render):
3579
3580 2017-02-09  Antti Koivisto  <antti@apple.com>
3581
3582         Nullptr crash under styleForFirstLetter
3583         https://bugs.webkit.org/show_bug.cgi?id=167756
3584         rdar://problem/30029354
3585
3586         Reviewed by Zalan Bujtas.
3587
3588         Don't know how we get here. Paper over the crash.
3589
3590         * rendering/RenderBlock.cpp:
3591         (WebCore::styleForFirstLetter):
3592
3593             Use parent first line style if we compute null style for the first letter renderer.
3594
3595 2017-02-09  Antoine Quint  <graouts@apple.com>
3596
3597         [Modern Media Controls] Playing an <audio> element on iOS makes the controls disappear
3598         https://bugs.webkit.org/show_bug.cgi?id=168047
3599         <rdar://problem/30441939>
3600
3601         Reviewed by Eric Carlson.
3602
3603         The controls bar auto-hide behavior is disabled for <audio> elements, but on iOS we have
3604         a TapGestureRecognizer to identify when controls are tapped to toggle controls visibility.
3605         This gesture recognizer would be on at all times, but it should only be enabled when
3606         fadesToIdle is set to true.
3607
3608         Test: media/modern-media-controls/media-controller/media-controller-ios-only-enable-tap-gesture-recognizer-with-fades-when-idle.html
3609
3610         * Modules/modern-media-controls/controls/controls-bar.js:
3611         (ControlsBar.prototype.set fadesWhileIdle):
3612
3613 2017-02-09  Antoine Quint  <graouts@apple.com>
3614
3615         [Modern Media Controls] <audio> element does not show any background on iOS
3616         https://bugs.webkit.org/show_bug.cgi?id=168046
3617         <rdar://problem/30441872>
3618
3619         Reviewed by Eric Carlson.
3620
3621         Use a solid gray background for <audio> elements on iOS.
3622
3623         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-audio-background.html
3624
3625         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
3626         (:host(audio) .media-controls.ios.inline > .controls-bar:before):
3627
3628 2017-02-09  Antoine Quint  <graouts@apple.com>
3629
3630         [Modern Media Controls] Controls fail to instantiate in an XHTML document
3631         https://bugs.webkit.org/show_bug.cgi?id=168045
3632         <rdar://problem/30290095>
3633
3634         Reviewed by Eric Carlson.
3635
3636         Always use valid HTML and XHTML strings when creating HTML elements.
3637
3638         Test: media/modern-media-controls/media-controller/media-controller-in-xhtml.xhtml
3639
3640         * Modules/modern-media-controls/controls/button.js:
3641         (Button):
3642         * Modules/modern-media-controls/controls/buttons-container.js:
3643         * Modules/modern-media-controls/controls/controls-bar.js:
3644         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
3645         * Modules/modern-media-controls/controls/media-controls.js:
3646         * Modules/modern-media-controls/controls/slider.js:
3647         * Modules/modern-media-controls/controls/status-label.js:
3648         * Modules/modern-media-controls/controls/time-control.js:
3649         * Modules/modern-media-controls/controls/time-label.js:
3650         * Modules/modern-media-controls/controls/tracks-panel.js:
3651
3652 2017-02-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3653
3654         Unreviewed, fix typo in comment
3655
3656         * loader/DocumentWriter.cpp:
3657         (WebCore::DocumentWriter::replaceDocument):
3658
3659 2017-02-09  Andreas Kling  <akling@apple.com>
3660
3661         Disallow accelerated rendering for ginormous 2D canvases.
3662         <https://webkit.org/b/167968>
3663         <rdar://problem/30119483>
3664
3665         Reviewed by Antti Koivisto.
3666
3667         Add a "maximumAccelerated2dCanvasSize" setting that defaults to 5120x2880
3668         which is the 5K resolution for 16:9.
3669
3670         Also added a way to include the "accelerates drawing" flag in layer tree dumps.
3671
3672         Test: compositing/canvas/accelerated-canvas-compositing-size-limit.html
3673
3674         * html/HTMLCanvasElement.cpp:
3675         (WebCore::HTMLCanvasElement::shouldAccelerate):
3676         * page/Frame.h:
3677         * page/Settings.in:
3678         * platform/graphics/GraphicsLayer.cpp:
3679         (WebCore::GraphicsLayer::dumpProperties):
3680         * platform/graphics/GraphicsLayerClient.h:
3681         * rendering/RenderLayerCompositor.cpp:
3682         (WebCore::RenderLayerCompositor::layerTreeAsText):
3683         * testing/Internals.cpp:
3684         (WebCore::toLayerTreeFlags):
3685         * testing/Internals.h:
3686         * testing/Internals.idl:
3687
3688 2017-02-09  Antti Koivisto  <antti@apple.com>
3689
3690         Remove most cases of #if ENABLE(CACHE_PARTITIONING)
3691         https://bugs.webkit.org/show_bug.cgi?id=167990
3692
3693         Reviewed by Sam Weinig.
3694
3695         We'll just return empty string for the partition if partitioning is not enabled.
3696
3697         * html/DOMURL.cpp:
3698         (WebCore::DOMURL::revokeObjectURL):
3699         * inspector/InspectorPageAgent.cpp:
3700         (WebCore::InspectorPageAgent::cachedResource):
3701         * loader/FrameLoader.cpp:
3702         (WebCore::FrameLoader::loadURL):
3703         * loader/archive/cf/LegacyWebArchive.cpp:
3704         (WebCore::LegacyWebArchive::create):
3705         * loader/cache/CachedResource.h:
3706         (WebCore::CachedResource::url):
3707         (WebCore::CachedResource::cachePartition):
3708         * loader/cache/CachedResourceLoader.cpp:
3709         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
3710         (WebCore::CachedResourceLoader::requestResource):
3711         * loader/cache/CachedResourceRequest.cpp:
3712         (WebCore::CachedResourceRequest::setDomainForCachePartition):
3713         * loader/cache/CachedResourceRequest.h:
3714         * loader/cache/MemoryCache.cpp:
3715         (WebCore::MemoryCache::add):
3716         (WebCore::MemoryCache::revalidationSucceeded):
3717         (WebCore::MemoryCache::resourceForRequestImpl):
3718         (WebCore::MemoryCache::addImageToCache):
3719         (WebCore::MemoryCache::removeImageFromCache):
3720         (WebCore::MemoryCache::remove):
3721         (WebCore::MemoryCache::removeResourcesWithOrigin):
3722         (WebCore::MemoryCache::removeResourcesWithOrigins):
3723         (WebCore::MemoryCache::getOriginsWithCache):
3724         (WebCore::MemoryCache::originsWithCache):
3725         * loader/cache/MemoryCache.h:
3726         * page/SecurityOrigin.cpp:
3727         (WebCore::SecurityOrigin::domainForCachePartition):
3728         * page/SecurityOrigin.h:
3729         * platform/SchemeRegistry.cpp:
3730         (WebCore::cachePartitioningSchemes):
3731         (WebCore::SchemeRegistry::shouldPartitionCacheForURLScheme):
3732         * platform/SchemeRegistry.h:
3733         * platform/ios/WebCoreSystemInterfaceIOS.mm:
3734         * platform/mac/WebCoreSystemInterface.h:
3735         * platform/mac/WebCoreSystemInterface.mm:
3736         * platform/network/ResourceRequestBase.cpp:
3737         (WebCore::ResourceRequestBase::setAsIsolatedCopy):
3738         (WebCore::ResourceRequestBase::setCachePartition):
3739         (WebCore::ResourceRequestBase::partitionName):
3740         * platform/network/ResourceRequestBase.h:
3741         (WebCore::ResourceRequestBase::cachePartition):
3742         (WebCore::ResourceRequestBase::setDomainForCachePartition):
3743         * platform/network/cf/ResourceRequest.h:
3744         (WebCore::ResourceRequest::cachePartition): Deleted.
3745         (WebCore::ResourceRequest::setCachePartition): Deleted.
3746         (WebCore::ResourceRequest::setDomainForCachePartition): Deleted.
3747         * platform/network/cf/ResourceRequestCFNet.cpp:
3748         (WebCore::ResourceRequest::doUpdatePlatformRequest):
3749         (WebCore::ResourceRequest::doUpdateResourceRequest):
3750         (WebCore::ResourceRequest::partitionName): Deleted.
3751         (WebCore::ResourceRequest::doPlatformSetAsIsolatedCopy): Deleted.
3752         * platform/network/cf/ResourceResponse.h:
3753         * platform/network/cocoa/ResourceRequestCocoa.mm:
3754         (WebCore::ResourceRequest::doUpdateResourceRequest):
3755         (WebCore::ResourceRequest::doUpdatePlatformRequest):
3756         * testing/Internals.cpp:
3757         (WebCore::Internals::isLoadingFromMemoryCache):
3758
3759 2017-02-09  Ryosuke Niwa  <rniwa@webkit.org>
3760
3761         Add Web Bluetooth as Not Considering
3762         https://bugs.webkit.org/show_bug.cgi?id=168042
3763
3764         Reviewed by Yusuke Suzuki.
3765
3766         Add Web Bluetooth as a feature not being considered to be implemented in WebKit.
3767
3768         * features.json:
3769
3770 2017-02-08  Simon Fraser  <simon.fraser@apple.com>
3771
3772         Put names on more UIViews for ease of debugging
3773         https://bugs.webkit.org/show_bug.cgi?id=168035
3774
3775         Reviewed by Tim Horton.
3776
3777         Name the page overlay layers.
3778
3779         * page/PageOverlayController.cpp:
3780         (WebCore::PageOverlayController::createRootLayersIfNeeded):
3781         (WebCore::PageOverlayController::installPageOverlay):
3782
3783 2017-02-08  Commit Queue  <commit-queue@webkit.org>
3784
3785         Unreviewed, rolling out r211912.
3786         https://bugs.webkit.org/show_bug.cgi?id=168034
3787
3788         http/tests/media/media-stream/disconnected-frame-permission-
3789         denied.html should be updated (Requested by youenn on
3790         #webkit).
3791
3792         Reverted changeset:
3793
3794         "[MediaStream] Remove legacy Navigator.webkitGetUserMedia"
3795         https://bugs.webkit.org/show_bug.cgi?id=168016
3796         http://trac.webkit.org/changeset/211912
3797
3798 2017-02-08  Youenn Fablet  <youennf@gmail.com>
3799
3800         HTML Link elements should load data URLs as same origin
3801         https://bugs.webkit.org/show_bug.cgi?id=168032
3802         <rdar://problem/30275036>
3803
3804         Reviewed by Alex Christensen.
3805
3806         Test: fast/dom/data-url-css-link-element-cors-active.html
3807
3808         Making CSS data URLs resources considered as same origin when loaded through link elements.
3809         In the future, we should consider remove the data URL same origin flag and fully align with the fetch and HTML spec.
3810
3811         * html/HTMLLinkElement.cpp:
3812         (WebCore::HTMLLinkElement::process):
3813
3814 2017-02-08  Sam Weinig  <sam@webkit.org>
3815
3816         REGRESSION (r193286): Promise chain no longer prevent UI refresh
3817         <rdar://problem/28062149>
3818         https://bugs.webkit.org/show_bug.cgi?id=161291
3819
3820         Reviewed by Geoffrey Garen.
3821
3822         Add new subtest to js/dom/Promise.html
3823
3824         * dom/Microtasks.cpp:
3825         (WebCore::MicrotaskQueue::append):
3826         (WebCore::MicrotaskQueue::remove):
3827         (WebCore::MicrotaskQueue::performMicrotaskCheckpoint):
3828         * dom/Microtasks.h:
3829         The microtask queue needs to be completely drained, even of new microtasks added while
3830         the previous task was run. Remove the m_tasksAppendedDuringMicrotaskCheckpoint as it is
3831         no longer needed.
3832
3833 2017-02-08  Eric Carlson  <eric.carlson@apple.com>
3834
3835         [MediaStream] Remove legacy Navigator.webkitGetUserMedia
3836         https://bugs.webkit.org/show_bug.cgi?id=168016
3837
3838         Reviewed by Youenn Fablet.
3839
3840         No new tests, existing tests updated.
3841
3842         * WebCore.xcodeproj/project.pbxproj: NavigatorUserMedia.
3843         * DerivedSources.make: Ditto.
3844         * CMakeLists.txt: Ditto.
3845         * Modules/mediastream/NavigatorUserMedia.idl: Removed.
3846         * Modules/mediastream/NavigatorUserMedia.js: Removed.
3847         * WebCore.xcodeproj/project.pbxproj:
3848         * page/Navigator.idl: Add some whitespace to force derived sources to be rebuild correctly.
3849
3850 2017-02-08  Chris Dumez  <cdumez@apple.com>
3851
3852         Use smaller tiles in windows that are not active to facilitate App Napping
3853         https://bugs.webkit.org/show_bug.cgi?id=167997
3854         <rdar://problem/30358835>
3855
3856         Reviewed by Simon Fraser.
3857
3858         Use smaller / non-adaptative tiles in windows that are not active to facilitate
3859         App Napping after <https://trac.webkit.org/r197594>.
3860
3861         Test: compositing/tiling/non-active-window-tiles-size.html
3862
3863         * page/FrameView.cpp:
3864         (WebCore::FrameView::contentsResized):
3865         (WebCore::FrameView::addedOrRemovedScrollbar):
3866         (WebCore::FrameView::computeScrollability):
3867         (WebCore::FrameView::updateTiledBackingAdaptiveSizing):
3868         (WebCore::FrameView::unobscuredContentSizeChanged):
3869         (WebCore::FrameView::setViewExposedRect):
3870         * page/FrameView.h:
3871         * page/Page.cpp:
3872         (WebCore::Page::setActivityState):
3873         (WebCore::Page::isWindowActive):
3874         * page/Page.h:
3875         * platform/graphics/TiledBacking.h:
3876         * platform/graphics/ca/TileController.cpp:
3877         (WebCore::TileController::setTileSizeUpdateDelayDisabledForTesting):
3878         (WebCore::TileController::notePendingTileSizeChange):
3879         * platform/graphics/ca/TileController.h:
3880         * testing/Internals.cpp:
3881         (WebCore::Internals::resetToConsistentState):
3882         (WebCore::Internals::disableTileSizeUpdateDelay):
3883         * testing/Internals.h:
3884         * testing/Internals.idl:
3885
3886 2017-02-08  Chris Dumez  <cdumez@apple.com>
3887
3888         Unreviewed, rolling out r211907.
3889
3890         Broke the build
3891
3892         Reverted changeset:
3893
3894         "[MediaStream] Remove legacy Navigator.webkitGetUserMedia"
3895         https://bugs.webkit.org/show_bug.cgi?id=168016
3896         http://trac.webkit.org/changeset/211907
3897
3898 2017-02-08  Eric Carlson  <eric.carlson@apple.com>
3899
3900         [MediaStream] Remove legacy Navigator.webkitGetUserMedia
3901         https://bugs.webkit.org/show_bug.cgi?id=168016
3902
3903         Reviewed by Youenn Fablet.
3904
3905         No new tests, existing tests updated.
3906
3907         * WebCore.xcodeproj/project.pbxproj: NavigatorUserMedia.
3908         * DerivedSources.make: Ditto.
3909         * CMakeLists.txt: Ditto.
3910         * Modules/mediastream/NavigatorUserMedia.idl: Removed.
3911         * Modules/mediastream/NavigatorUserMedia.js: Removed.
3912         * WebCore.xcodeproj/project.pbxproj:
3913
3914 2017-02-08  Wenson Hsieh  <wenson_hsieh@apple.com>
3915
3916         Add kUTTypeUTF8PlainText and kUTTypeJPEG to the list of compatible content types in DragData
3917         https://bugs.webkit.org/show_bug.cgi?id=167942
3918         <rdar://problem/30315079>
3919
3920         Reviewed by Tim Horton.
3921
3922         Adds UTI types for dragging UTF8 plain text and JPEG images to the list of supported types in DragDataMac.mm.
3923         Also handles reading these types in PasteboardMac.mm. I verified manually with a test app that if a platform
3924         NSView vends only UTF8 plaintext or JPEG images when dragging, WebKit is able to read the contents of the
3925         pasteboard as text and an image, respectively.
3926
3927         New TestWebKitAPI tests in DragAndDropPasteboardTests.mm.
3928
3929         * platform/mac/DragDataMac.mm:
3930         (WebCore::DragData::containsCompatibleContent):
3931         * platform/mac/PasteboardMac.mm:
3932         (WebCore::Pasteboard::read):
3933
3934 2017-02-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
3935
3936         getIntersectionList always returns empty NodeList until layout is complete
3937         https://bugs.webkit.org/show_bug.cgi?id=81423
3938
3939         Reviewed by Simon Fraser.
3940
3941         Layout needs to be forced before trying to figure out which SVGElements
3942         intersect with a given SVGRect. We do the same thing in the DOM API
3943         Element::getBoundingClientRect().
3944
3945         Test: svg/custom/intersection-list-before-layout.html
3946
3947         * svg/SVGSVGElement.cpp:
3948         (WebCore::SVGSVGElement::getIntersectionList):
3949
3950 2017-02-08  Antoine Quint  <graouts@apple.com>
3951
3952         [Modern Media Controls] Implement reduced and tight padding modes
3953         https://bugs.webkit.org/show_bug.cgi?id=167933
3954         <rdar://problem/30396994>
3955
3956         Reviewed by Dean Jackson.
3957
3958         The design specs for modern media controls mandate the following for inline media controls:
3959
3960             - controls at or below 300pt width use a 12pt left margin for the left buttons container,
3961             and a 12pt right margin for the right buttons container, and 16pth button margin inside
3962             both containers ("reduced padding mode").
3963
3964             - when dropping at or below 120pt width, controls use an 8pt left margin for
3965             the left buttons container, and an 8pt right margin for the right buttons container, and
3966             12pt button margin inside both containers and a shorter bar (25pt) ("compact mode").
3967
3968             - in the case of audio controls, at 400pt or less, controls switch to 12pt margins and
3969             button margins for both buttons containers ("tight padding mode").
3970
3971         The "compact" mode was already implemented as a dedicated MacOSInlineMediaControls subclass.
3972         Since we now have a more generic need to vary the metrics used for inline media controls on
3973         macOS, we add new features to MacOSInlineMediaControls to support varying metrics based on
3974         the controls' "layoutTraits" property.
3975
3976         So MediaController is changed such that it knows to use the new TightPadding and ReducedPadding
3977         layout traits based on the conditions defined above, and _updateControlsIfNeeded() is changed
3978         to set the "layoutTraits" property on the controls whenever called, which in our case is most
3979         relevantly a "resize" event on the shadow root or a TrackEvent on the video tracks (to determine
3980         when we're possibly changing between a video and audio file).
3981
3982         As a result, the "layoutTraits" setter is called on MacOSInlineMediaControls, which updates
3983         the metrics for the various buttons containers, but also notifies the buttons contained
3984         within that layout traits may have changed, since some buttons support a "compact" appearance
3985         that is shorter and require a different image file. To that end, IconButton has been updated
3986         so that it may be notified of a layout traits change through a new layoutTraitsDidChange()
3987         method, that checks whether the current layout traits differ from those last used when loading
3988         the icon.
3989
3990         Tests: media/modern-media-controls/icon-button/icon-button-change-layout-traits.html
3991                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-compact-buttons-styles.html
3992                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-compact-controls-bar-styles.html
3993                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-compact.html
3994                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-reduced-padding.html
3995                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-tight-padding.html
3996                media/modern-media-controls/media-controller/media-controller-compact.html
3997                media/modern-media-controls/media-controller/media-controller-reduced-padding.html
3998                media/modern-media-controls/media-controller/media-controller-tight-padding.html
3999
4000         * Modules/modern-media-controls/controls/icon-button.js:
4001         (IconButton.prototype.set iconName):
4002         (IconButton.prototype.layoutTraitsDidChange):
4003         (IconButton.prototype._loadImage):
4004         * Modules/modern-media-controls/controls/layout-item.js:
4005         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.js: Removed.
4006         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
4007         (MacOSInlineMediaControls.prototype.get layoutTraits):
4008         (MacOSInlineMediaControls.prototype.set layoutTraits):
4009         (MacOSInlineMediaControls.prototype._matchLayoutTraits):
4010         * Modules/modern-media-controls/js