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