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