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