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