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