8320c1a002656287d6cadeccdb70349087597297
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-05-16  Zan Dobersek  <zdobersek@igalia.com>
2
3         [GLib] Name more GSource-based RunLoop::Timers
4         https://bugs.webkit.org/show_bug.cgi?id=172158
5
6         Reviewed by Carlos Garcia Campos.
7
8         * platform/glib/MainThreadSharedTimerGLib.cpp:
9         (WebCore::MainThreadSharedTimer::MainThreadSharedTimer):
10         Specify 'MainThreadSharedTimer' as the name of this GSource-based RunLoop::Timer.
11
12 2017-05-16  Romain Bellessort  <romain.bellessort@crf.canon.fr>
13
14         [Readable Streams API] Implement ReadableStreamBYOBReader releaseLock()
15         https://bugs.webkit.org/show_bug.cgi?id=172111
16
17         Reviewed by Chris Dumez.
18
19         Implemented ReadableStreamBYOBReader releaseLock():
20         - https://streams.spec.whatwg.org/#byob-reader-release-lock;
21         - https://streams.spec.whatwg.org/#readable-stream-reader-generic-release.
22
23         Added tests to check releaseLock behavior.
24
25         * Modules/streams/ReadableStreamBYOBReader.js:
26         (releaseLock): Implemented.
27         * Modules/streams/ReadableStreamInternals.js:
28         (readableStreamReaderGenericRelease): Aligned with spec.
29
30 2017-05-16  Carlos Garcia Campos  <cgarcia@igalia.com>
31
32         Unreviewed. Try to fix GTK+ build with MEDIA_STREAM enabled after r216918.
33
34         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
35         (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
36
37 2017-05-16  Youenn Fablet  <youenn@apple.com>
38
39         Remove MediaConstraintsData and MediaConstraintsImpl
40         https://bugs.webkit.org/show_bug.cgi?id=172132
41
42         Reviewed by Eric Carlson.
43
44         No observable change of behavior.
45
46         Removing MediaConstraintsData and MediaConstraintsImpl allows simplifying the code.
47         Further simplified the code by making MediaConstraints no longer ref counted and now a struct.
48         Simplified some RealtimeMediaSource subclasses by removing unused MediaConstraints class members.
49
50         * CMakeLists.txt: Removing MediaConstraintsImpl.cpp.
51         * Modules/mediastream/MediaConstraintsImpl.cpp: Removed.
52         * Modules/mediastream/MediaConstraintsImpl.h: Removed.
53         * Modules/mediastream/MediaDevices.cpp:
54         (WebCore::createMediaConstraints):
55         (WebCore::MediaDevices::getUserMedia):
56         (WebCore::createMediaConstraintsImpl): Deleted.
57         * Modules/mediastream/MediaStreamTrack.cpp:
58         (WebCore::createMediaConstraints):
59         (WebCore::MediaStreamTrack::applyConstraints):
60         (WebCore::createMediaConstraintsImpl): Deleted.
61         * Modules/mediastream/MediaTrackConstraints.cpp:
62         (WebCore::createMediaConstraints):
63         (WebCore::createMediaConstraintsImpl): Deleted.
64         * Modules/mediastream/MediaTrackConstraints.h:
65         * Modules/mediastream/UserMediaRequest.cpp:
66         (WebCore::UserMediaRequest::start):
67         (WebCore::UserMediaRequest::UserMediaRequest):
68         (WebCore::UserMediaRequest::allow):
69         * Modules/mediastream/UserMediaRequest.h:
70         (WebCore::UserMediaRequest::audioConstraints):
71         (WebCore::UserMediaRequest::videoConstraints):
72         * WebCore.xcodeproj/project.pbxproj:
73         * platform/mediastream/MediaConstraints.cpp:
74         (WebCore::addDefaultVideoConstraints):
75         (WebCore::MediaConstraints::isConstraintSet):
76         (WebCore::MediaConstraints::setDefaultVideoConstraints):
77         * platform/mediastream/MediaConstraints.h:
78         (WebCore::MediaConstraints::~MediaConstraints): Deleted.
79         (WebCore::MediaConstraints::MediaConstraints): Deleted.
80         * platform/mediastream/MediaStreamConstraintsValidationClient.h:
81         * platform/mediastream/RealtimeMediaSource.cpp:
82         (WebCore::RealtimeMediaSource::selectSettings):
83         (WebCore::RealtimeMediaSource::supportsConstraints):
84         (WebCore::RealtimeMediaSource::applyConstraints):
85         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
86         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
87         * platform/mediastream/RealtimeMediaSourceCenter.h:
88         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
89         (WebCore::RealtimeIncomingAudioSource::supportedConstraints): Deleted.
90         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
91         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
92         (WebCore::RealtimeIncomingVideoSource::supportedConstraints): Deleted.
93         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
94         * platform/mock/MockRealtimeMediaSource.h:
95         (WebCore::MockRealtimeMediaSource::constraints): Deleted.
96
97 2017-05-16  Andy Estes  <aestes@apple.com>
98
99         [Cocoa] Tell NEFilterSource about the presenting app's PID
100         https://bugs.webkit.org/show_bug.cgi?id=172152
101         <rdar://problem/32197740>
102
103         Reviewed by Dan Bernstein.
104
105         * platform/cocoa/NetworkExtensionContentFilter.mm:
106         (WebCore::NetworkExtensionContentFilter::initialize):
107         * platform/spi/cocoa/NEFilterSourceSPI.h:
108
109 2017-05-16  Manuel Rego Casasnovas  <rego@igalia.com>
110
111         [css-grid] Fix static position of positioned grid items
112         https://bugs.webkit.org/show_bug.cgi?id=172108
113
114         Reviewed by Sergio Villar Senin.
115
116         This patch makes us follow the text on the spec
117         (https://drafts.csswg.org/css-grid/#static-position):
118         "The static position of an absolutely-positioned child
119          of a grid container is determined as if it were the sole grid item
120          in a grid area whose edges coincide with the padding edges
121          of the grid container."
122
123         Test: fast/css-grid-layout/absolute-positioning-grid-container-parent.html
124
125         * rendering/RenderGrid.cpp:
126         (WebCore::RenderGrid::prepareChildForPositionedLayout): Modified to avoid
127         including padding to match the spec behavior.
128
129 2017-05-16  Per Arne Vollan  <pvollan@apple.com>
130
131         Compile error, include file is not found.
132         https://bugs.webkit.org/show_bug.cgi?id=172105
133
134         Reviewed by Brent Fulgham.
135
136         Use __has_include to detect if include file exists.
137
138         * platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm:
139
140 2017-05-15  Andy Estes  <aestes@apple.com>
141
142         Make the application PID available to WebCore
143         https://bugs.webkit.org/show_bug.cgi?id=172133
144
145         Reviewed by Andreas Kling.
146
147         * CMakeLists.txt:
148         * PlatformMac.cmake:
149         * WebCore.xcodeproj/project.pbxproj:
150         * platform/RuntimeApplicationChecks.cpp: Added.
151         (WebCore::presentingApplicationPIDOverride):
152         (WebCore::presentingApplicationPID): Returns the override PID if set, or getCurrentProcessID()
153         otherwise.
154         (WebCore::setPresentingApplicationPID):
155         * platform/RuntimeApplicationChecks.h:
156         * platform/cocoa/RuntimeApplicationChecksCocoa.mm: Renamed from Source/WebCore/platform/RuntimeApplicationChecks.mm.
157
158 2017-05-15  Antti Koivisto  <antti@apple.com>
159
160         RenderTheme does not need to be per-page
161         https://bugs.webkit.org/show_bug.cgi?id=172116
162         <rdar://problem/30426457>
163
164         Reviewed by Zalan Bujtas.
165
166         There are no implementations of RenderTheme::themeForPage that actually care about the page.
167         It can be replaced with a singleton, simplifying a bunch of code.
168
169         * Modules/mediacontrols/MediaControlsHost.cpp:
170         (WebCore::MediaControlsHost::shadowRootCSSText):
171         (WebCore::MediaControlsHost::base64StringForIconNameAndType):
172         * css/CSSDefaultStyleSheets.cpp:
173         (WebCore::CSSDefaultStyleSheets::loadFullDefaultStyle):
174         (WebCore::CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement):
175
176             Fix a potential crash if we get here when page is null (though it doesn't appear to repro on trunk).
177
178         * css/StyleColor.cpp:
179         (WebCore::StyleColor::colorFromKeyword):
180         * css/StyleResolver.cpp:
181         (WebCore::StyleResolver::adjustRenderStyle):
182         * css/parser/CSSParser.cpp:
183         (WebCore::CSSParser::parseSystemColor):
184         * css/parser/CSSParser.h:
185         * css/parser/CSSPropertyParser.cpp:
186         (WebCore::CSSPropertyParser::consumeSystemFont):
187         * editing/FrameSelection.cpp:
188         (WebCore::FrameSelection::updateAppearance):
189         * html/HTMLMediaElement.cpp:
190         (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
191         * html/HTMLMeterElement.cpp:
192         (WebCore::HTMLMeterElement::createElementRenderer):
193         * html/HTMLSelectElement.cpp:
194         (WebCore::HTMLSelectElement::usesMenuList):
195         (WebCore::HTMLSelectElement::platformHandleKeydownEvent):
196         (WebCore::HTMLSelectElement::menuListDefaultEventHandler):
197         * html/HTMLTextFormControlElement.cpp:
198         (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle):
199         * html/InputType.cpp:
200         (WebCore::InputType::themeSupportsDataListUI):
201         * html/TextFieldInputType.cpp:
202         (WebCore::TextFieldInputType::shouldHaveSpinButton):
203         (WebCore::TextFieldInputType::shouldHaveCapsLockIndicator):
204         * html/canvas/CanvasRenderingContext2D.cpp:
205         (WebCore::CanvasRenderingContext2D::setStrokeColor):
206         (WebCore::CanvasRenderingContext2D::setFillColor):
207         * html/canvas/CanvasStyle.cpp:
208         (WebCore::parseColor):
209         (WebCore::parseColorOrCurrentColor):
210         (WebCore::CanvasStyle::createFromString):
211         * html/canvas/CanvasStyle.h:
212         * html/shadow/MediaControlElements.cpp:
213         (WebCore::MediaControlPanelElement::startTimer):
214         (WebCore::MediaControlPanelElement::makeOpaque):
215         (WebCore::MediaControlPanelElement::makeTransparent):
216         * html/shadow/MediaControls.cpp:
217         (WebCore::MediaControls::reset):
218         (WebCore::MediaControls::reportedError):
219         (WebCore::MediaControls::updateCurrentTimeDisplay):
220         * html/shadow/mac/ImageControlsButtonElementMac.cpp:
221         (WebCore::ImageControlsButtonElementMac::tryCreate):
222         * page/MemoryRelease.cpp:
223         (WebCore::releaseNoncriticalMemory):
224         * page/Page.cpp:
225         (WebCore::Page::Page):
226         * page/Page.h:
227         (WebCore::Page::theme): Deleted.
228         * platform/wpe/RenderThemeWPE.cpp:
229         (WebCore::RenderTheme::singleton):
230         (WebCore::RenderTheme::themeForPage): Deleted.
231         * rendering/RenderEmbeddedObject.cpp:
232         (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
233         * rendering/RenderObject.cpp:
234         (WebCore::RenderObject::theme):
235         * rendering/RenderTheme.cpp:
236         (WebCore::RenderTheme::focusRingColor):
237         * rendering/RenderTheme.h:
238         (WebCore::RenderTheme::defaultTheme): Deleted.
239         * rendering/RenderThemeGtk.cpp:
240         (WebCore::RenderTheme::singleton):
241         (WebCore::RenderTheme::themeForPage): Deleted.
242         * rendering/RenderThemeIOS.mm:
243         (WebCore::RenderTheme::singleton):
244         (WebCore::RenderTheme::themeForPage): Deleted.
245         * rendering/RenderThemeMac.mm:
246         (WebCore::RenderTheme::singleton):
247         (WebCore::RenderTheme::themeForPage): Deleted.
248         * rendering/RenderThemeWin.cpp:
249         (WebCore::RenderTheme::singleton):
250         (WebCore::RenderTheme::themeForPage): Deleted.
251         * rendering/TextPaintStyle.cpp:
252         (WebCore::computeTextPaintStyle):
253
254 2017-05-15  Said Abou-Hallawa  <sabouhallawa@apple.com>
255
256         Do not delete asynchronously decoded frames for large images if their clients are in the viewport
257         https://bugs.webkit.org/show_bug.cgi?id=170640
258
259         Reviewed by Simon Fraser.
260
261         The image flickering problem happens when a large image is visible in the
262         view port and for some reason, the decoded frame gets destroyed. When this
263         image is repainted, BitmapImage::draw() does not find a valid decoded frame
264         for that image. It then requests an async decoding for the image and just
265         draws nothing in the image rectangle. Drawing no content between two drawing
266         phases in which the image is drawn causes the unwanted flickering.
267
268         To fix this issue we need to protect the decoded frames of all the images
269         in the view port from being destroyed. When BitmapImage::destroyDecodedData()
270         is called, it is going to check, through the ImageObserver, whether any
271         of its clients is visible. And if so, the current decoded frame won't be
272         destroyed.
273
274         Tests: Modifying existing tests.
275
276         * loader/cache/CachedImage.cpp:
277         (WebCore::CachedImage::CachedImageObserver::decodedSizeChanged):
278         (WebCore::CachedImage::CachedImageObserver::didDraw):
279         (WebCore::CachedImage::CachedImageObserver::canDestroyDecodedData):
280         (WebCore::CachedImage::CachedImageObserver::imageFrameAvailable):
281         (WebCore::CachedImage::CachedImageObserver::changedInRect):
282         (WebCore::CachedImage::decodedSizeChanged):
283         (WebCore::CachedImage::didDraw):
284         (WebCore::CachedImage::canDestroyDecodedData): Finds out whether it's okay
285         to discard the image decoded data or not.
286         (WebCore::CachedImage::imageFrameAvailable):
287         (WebCore::CachedImage::changedInRect):
288         * loader/cache/CachedImage.h:
289         * loader/cache/CachedImageClient.h:
290         (WebCore::CachedImageClient::canDestroyDecodedData):
291         * loader/cache/MemoryCache.cpp:
292         (WebCore::MemoryCache::destroyDecodedDataForAllImages): This function is
293         currently not used. Use in the internal destroyDecodedDataForAllImages()
294         but unlike what CachedImage::destroyDecodedData() does, make it destroy
295         the decoded frames without deleting the image itself.
296         * loader/cache/MemoryCache.h:
297         * platform/graphics/BitmapImage.cpp:
298         (WebCore::BitmapImage::destroyDecodedData):
299         (WebCore::BitmapImage::draw):
300         (WebCore::BitmapImage::canDestroyCurrentFrameDecodedData): 
301         (WebCore::BitmapImage::advanceAnimation):
302         (WebCore::BitmapImage::internalAdvanceAnimation):
303         (WebCore::BitmapImage::imageFrameAvailableAtIndex):
304         * platform/graphics/BitmapImage.h:
305         * platform/graphics/GraphicsContext3D.cpp:
306         (WebCore::GraphicsContext3D::packImageData):
307         * platform/graphics/ImageFrameCache.cpp:
308         (WebCore::ImageFrameCache::decodedSizeChanged):
309         (ImageFrameCache::cacheAsyncFrameNativeImageAtIndex): The assertion in this
310         function is wrong. frameIsCompleteAtIndex() can be false when the an image
311         decoding is requested but can be true when the decoding finishes.
312         * platform/graphics/ImageObserver.h:
313         * platform/graphics/cairo/ImageCairo.cpp:
314         (WebCore::Image::drawPattern):
315         * platform/graphics/cg/ImageCG.cpp:
316         (WebCore::Image::drawPattern):
317         * platform/graphics/cg/ImageDecoderCG.cpp:
318         (WebCore::ImageDecoder::frameIsCompleteAtIndex):
319         * platform/graphics/cg/PDFDocumentImage.cpp:
320         (WebCore::PDFDocumentImage::decodedSizeChanged):
321         (WebCore::PDFDocumentImage::draw):
322         * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
323         (WebCore::TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded):
324         * platform/graphics/win/ImageDirect2D.cpp:
325         (WebCore::Image::drawPattern):
326         * rendering/RenderElement.cpp:
327         (WebCore::RenderElement::isVisibleInDocumentRect):
328         (WebCore::RenderElement::isVisibleInViewport):
329         (WebCore::RenderElement::imageFrameAvailable):
330         (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded):
331         (WebCore::RenderElement::shouldRepaintInVisibleRect): Deleted. Function
332         is renamed to isVisibleInViewport() for better readability.
333         * rendering/RenderElement.h:
334         * svg/graphics/SVGImage.cpp:
335         (WebCore::SVGImage::draw):
336         * svg/graphics/SVGImageClients.h:
337         * testing/Internals.cpp:
338         (WebCore::Internals::destroyDecodedDataForAllImages):
339         * testing/Internals.h:
340         * testing/Internals.idl:
341
342 2017-05-15  Youenn Fablet  <youenn@apple.com>
343
344         Simplify RealtimeMediaSource data production and state
345         https://bugs.webkit.org/show_bug.cgi?id=171999
346
347         Reviewed by Eric Carlson.
348
349         RealtimeMediaSource takes 3 booleans:
350         - m_isProducingData tells whether data is produced or not. In the case of capturing, it tells whether capture
351           happens.
352         - m_muted/m_enabled allows JS or WebKit level to start/stop the source.
353
354         Changed MediaStream capture state computation so that capture is reported as follows:
355         - m_isProducing is true, capture is happenning and is active
356         - m_muted is true, capture is happening but is inactive.
357
358         Except in the case of WebRTC incoming sources, for which sources may be created as muted as per the spec,
359         all sources are unmuted, enabled and not producing data when created.
360
361         RealtimeMediaSource is now activable either by calling start/stop or by calling setMuted/setEnabled.
362         This in turns will set the boolean values accordingly and will call the underlying
363         startProducingData/stopProducingData methods doing the actual stuff.
364
365         Removing from all RealtimeMediaSource subclasses the handling of producing data.
366         Making more methods non-virtual/member fields private to simplify the model.
367
368         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
369         (WebCore::CanvasCaptureMediaStreamTrack::Source::create):
370         (WebCore::CanvasCaptureMediaStreamTrack::Source::startProducingData):
371         (WebCore::CanvasCaptureMediaStreamTrack::Source::stopProducingData):
372         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasDestroyed):
373         (WebCore::CanvasCaptureMediaStreamTrack::Source::captureCanvas):
374         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
375         * Modules/mediastream/MediaStream.cpp:
376         (WebCore::MediaStream::mediaState):
377         * platform/mediastream/MediaStreamTrackPrivate.h:
378         (WebCore::MediaStreamTrackPrivate::startProducingData):
379         (WebCore::MediaStreamTrackPrivate::stopProducingData):
380         * platform/mediastream/RealtimeMediaSource.cpp:
381         (WebCore::RealtimeMediaSource::setMuted):
382         (WebCore::RealtimeMediaSource::notifyMutedChange):
383         (WebCore::RealtimeMediaSource::setEnabled):
384         (WebCore::RealtimeMediaSource::start):
385         (WebCore::RealtimeMediaSource::stop):
386         (WebCore::RealtimeMediaSource::requestStop):
387         (WebCore::RealtimeMediaSource::reset): Deleted.
388         * platform/mediastream/RealtimeMediaSource.h:
389         * platform/mediastream/mac/AVMediaCaptureSource.h:
390         * platform/mediastream/mac/AVMediaCaptureSource.mm:
391         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource):
392         (WebCore::AVMediaCaptureSource::captureSessionIsRunningDidChange):
393         (WebCore::AVMediaCaptureSource::reset): Deleted.
394         (WebCore::AVMediaCaptureSource::isProducingData): Deleted.
395         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
396         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
397         (WebCore::CoreAudioCaptureSource::startProducingData):
398         (WebCore::CoreAudioCaptureSource::stopProducingData):
399         (WebCore::CoreAudioCaptureSource::audioSourceProvider):
400         * platform/mediastream/mac/CoreAudioCaptureSource.h:
401         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
402         (WebCore::MockRealtimeAudioSourceMac::render):
403         (WebCore::MockRealtimeAudioSource::createMuted): Deleted.
404         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
405         (WebCore::MockRealtimeVideoSource::createMuted): Deleted.
406         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
407         (WebCore::RealtimeIncomingAudioSource::create):
408         (WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource):
409         (WebCore::RealtimeIncomingAudioSource::~RealtimeIncomingAudioSource):
410         (WebCore::RealtimeIncomingAudioSource::startProducingData):
411         (WebCore::RealtimeIncomingAudioSource::stopProducingData):
412         (WebCore::RealtimeIncomingAudioSource::setSourceTrack):
413         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
414         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
415         (WebCore::RealtimeIncomingVideoSource::create):
416         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
417         (WebCore::RealtimeIncomingVideoSource::startProducingData):
418         (WebCore::RealtimeIncomingVideoSource::setSourceTrack):
419         (WebCore::RealtimeIncomingVideoSource::stopProducingData):
420         (WebCore::RealtimeIncomingVideoSource::OnFrame):
421         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
422         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
423         (WebCore::WebAudioSourceProviderAVFObjC::setClient):
424         * platform/mock/MockMediaEndpoint.cpp:
425         (WebCore::MockMediaEndpoint::createMutedRemoteSource):
426         (WebCore::MockMediaEndpoint::unmuteTimerFired):
427         * platform/mock/MockRealtimeAudioSource.cpp:
428         (WebCore::MockRealtimeAudioSource::createMuted):
429         (WebCore::MockRealtimeAudioSource::startProducingData):
430         (WebCore::MockRealtimeAudioSource::stopProducingData):
431         * platform/mock/MockRealtimeAudioSource.h:
432         * platform/mock/MockRealtimeMediaSource.cpp:
433         (WebCore::MockRealtimeMediaSource::startProducingData): Deleted.
434         (WebCore::MockRealtimeMediaSource::stopProducingData): Deleted.
435         * platform/mock/MockRealtimeMediaSource.h:
436         * platform/mock/MockRealtimeVideoSource.cpp:
437         (WebCore::MockRealtimeVideoSource::createMuted):
438         (WebCore::MockRealtimeVideoSource::startProducingData):
439         (WebCore::MockRealtimeVideoSource::stopProducingData):
440         (WebCore::MockRealtimeVideoSource::generateFrame):
441         * platform/mock/MockRealtimeVideoSource.h:
442
443 2017-05-15  Myles C. Maxfield  <mmaxfield@apple.com>
444
445         Migrate Font constructor from bools to enums
446         https://bugs.webkit.org/show_bug.cgi?id=172140
447
448         Reviewed by Tim Horton.
449
450         In https://bugs.webkit.org/show_bug.cgi?id=168487, I'm adding a new flag to Font. We can't
451         keep having just a pile of bools in this class. Instead, we should be using enums.
452
453         No new tests because there is no behavior change.
454
455         * css/CSSFontFace.cpp:
456         (WebCore::CSSFontFace::font):
457         * css/CSSFontFaceSource.cpp:
458         (WebCore::CSSFontFaceSource::font):
459         * css/CSSSegmentedFontFace.cpp:
460         * loader/cache/CachedFont.cpp:
461         (WebCore::CachedFont::createFont):
462         * platform/graphics/Font.cpp:
463         (WebCore::Font::Font):
464         (WebCore::Font::verticalRightOrientationFont):
465         (WebCore::Font::uprightOrientationFont):
466         (WebCore::Font::brokenIdeographFont):
467         (WebCore::Font::description):
468         (WebCore::Font::mathData):
469         * platform/graphics/Font.h:
470         (WebCore::Font::create):
471         (WebCore::Font::origin):
472         (WebCore::Font::isInterstitial):
473         (WebCore::Font::widthForGlyph):
474         (WebCore::Font::isCustomFont): Deleted.
475         (WebCore::Font::isLoading): Deleted.
476         * platform/graphics/FontRanges.cpp:
477         * platform/graphics/cocoa/FontCocoa.mm:
478         (WebCore::Font::platformInit):
479         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
480         (WebCore::Font::platformCreateScaledFont):
481         * platform/graphics/win/SimpleFontDataCGWin.cpp:
482         (WebCore::Font::platformInit):
483         * platform/graphics/win/SimpleFontDataDirect2D.cpp:
484         (WebCore::Font::platformInit):
485         * platform/graphics/win/SimpleFontDataWin.cpp:
486         (WebCore::Font::platformCreateScaledFont):
487         (WebCore::Font::determinePitch):
488         * rendering/SimpleLineLayout.cpp:
489         (WebCore::SimpleLineLayout::canUseForFontAndText):
490
491 2017-05-15  Youenn Fablet  <youenn@apple.com>
492
493         WebRTC outgoing muted video sources should send black frames
494         https://bugs.webkit.org/show_bug.cgi?id=170627
495         <rdar://problem/31513869>
496
497         Reviewed by Eric Carlson.
498
499         Covered by updated test.
500
501         Instead of sending one black frame and then another one asynchronously,
502         we use the timer to send a black frame every second when outgoing source is muted.
503
504         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
505         (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
506         (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
507         (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames):
508         (WebCore::RealtimeOutgoingVideoSource::sendBlackFrame): Deleted.
509         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
510         * testing/Internals.cpp:
511         (WebCore::Internals::videoSampleAvailable):
512
513 2017-05-15  David Kilzer  <ddkilzer@apple.com>
514
515         Crash in libxml2.2.dylib: xmlDictReference
516         <https://webkit.org/b/172086>
517         <rdar://problem/23643436>
518
519         Reviewed by Daniel Bates.
520
521         Speculative fix and code clean-up based on source code
522         inspection.  The fix for the crash is in two parts that change
523         XSLStyleSheet::parseString():
524         1. Always set m_stylesheetDoc to nullptr after freeing it via
525            XSLStyleSheet::clearXSLStylesheetDocument().
526         2. Add nullptr check before using m_stylesheetDoc from parent.
527
528         Broadly speaking, the changes are:
529         - Extract code to reset m_stylesheetDoc into new private
530           XSLStyleSheet::clearXSLStylesheetDocument() method.  There is
531           a special contract between m_stylesheetDoc and
532           m_stylesheetDocTaken that wasn't being followed every time.
533           See comment in XSLStyleSheet::compileStyleSheet().
534         - XSLStyleSheet::clearDocuments() now calls new
535           clearXSLStylesheetDocument() method.  Previously, it was not
536           checking or resetting m_stylesheetDocTaken, and it might have
537           leaked an xmlDocPtr if m_stylesheetDoc was set and
538           m_stylesheetDocTaken was false.
539         - XSLStyleSheet::parseString() now calls new
540           clearXSLStylesheetDocument() method.  Previously, it did not
541           clear m_stylesheetDoc after freeing it, and it could return
542           early due to a failure in xmlCreateMemoryParserCtxt().
543         - In XSLStyleSheet::parseString() use checked arithmetic when
544           calculating 'size' for xmlCreateMemoryParserCtxt() and
545           xmlCtxtReadMemory().  This code used to do an implicit
546           unsigned -> signed integer conversion that could overflow.
547         - Always iterate m_children using an 'auto& import' variable.
548
549         * xml/XSLStyleSheet.h:
550         (WebCore::XSLStyleSheet::clearXSLStylesheetDocument): Add declaration.
551         (WebCore::XSLStyleSheet::m_disabled): Add default initializer.
552         (WebCore::XSLStyleSheet::m_stylesheetDoc): Ditto.
553         (WebCore::XSLStyleSheet::m_stylesheetDocTaken): Ditto.
554         (WebCore::XSLStyleSheet::m_parentStyleSheet): Ditto.
555
556         * xml/XSLStyleSheetLibxslt.cpp:
557         (WebCore::XSLStyleSheet::XSLStyleSheet): Get rid of redundant
558         initializers.  Set m_parentStyleSheet if needed.
559         (WebCore::XSLStyleSheet::~XSLStyleSheet): Call
560         clearXSLStylesheetDocument() instead of custom code.  Switch
561         m_children fast iteration to use 'auto& import' variable.
562         (WebCore::XSLStyleSheet::isLoading): Switch m_children fast
563         iteration to use 'auto& import' variable.
564         (WebCore::XSLStyleSheet::clearDocuments): Call
565         clearXSLStylesheetDocument() instead of setting m_stylesheetDoc
566         to nullptr.  This might fix an occasional xmlDocPtr leak.
567         (WebCore::XSLStyleSheet::clearXSLStylesheetDocument): Add.  This
568         method always sets m_stylesheetDoc to nullptr (after freeing it
569         if necessary) and sets m_stylesheetDocTaken to false.
570         (WebCore::XSLStyleSheet::parseString): Call
571         clearXSLStylesheetDocument().  Prior to this, m_stylesheetDoc
572         might be left pointing to a freed value, and this method could
573         return early if xmlCreateMemoryParserCtxt() failed.  Switch to
574         using Checked<> to compute required buffer size to parse XSL
575         stylesheet, and return early on overflow.  Clean up existing
576         return statements to use boolean expressions.  Add nullptr check
577         for m_parentStyleSheet->m_stylesheetDoc before using it.
578         (WebCore::XSLStyleSheet::loadChildSheet): Get rid of local
579         variable by calling loadSheet() from last array element.
580         (WebCore::XSLStyleSheet::compileStyleSheet): Add debug assert
581         that m_stylesheetDoc is not nullptr.
582
583 2017-05-15  Jer Noble  <jer.noble@apple.com>
584
585         Add experimental setting to allow document gesture interaction to fulfill media playback gesture requirement
586         https://bugs.webkit.org/show_bug.cgi?id=172131
587
588         Reviewed by Eric Carlson.
589
590         Test: media/restricted-audio-playback-with-document-gesture.html
591
592         Move all calls to ScriptController::processingUserGestureForMedia() to the new Document equivalent. In Document,
593         if the new setting is enabled, return true from processingUserGestureForMedia() if the top-level document has had
594         a user gesture interaction.
595
596         * Modules/mediastream/MediaStream.cpp:
597         (WebCore::MediaStream::processingUserGestureForMedia):
598         * Modules/mediastream/MediaStream.h:
599         * Modules/webaudio/AudioContext.cpp:
600         (WebCore::AudioContext::processingUserGestureForMedia):
601         (WebCore::AudioContext::willBeginPlayback):
602         (WebCore::AudioContext::willPausePlayback):
603         * Modules/webaudio/AudioContext.h:
604         * dom/Document.cpp:
605         (WebCore::Document::processingUserGestureForMedia):
606         * dom/Document.h:
607         * html/HTMLMediaElement.cpp:
608         (WebCore::HTMLMediaElement::load):
609         (WebCore::HTMLMediaElement::audioTrackEnabledChanged):
610         (WebCore::HTMLMediaElement::seekWithTolerance):
611         (WebCore::HTMLMediaElement::play):
612         (WebCore::HTMLMediaElement::playInternal):
613         (WebCore::HTMLMediaElement::pause):
614         (WebCore::HTMLMediaElement::pauseInternal):
615         (WebCore::HTMLMediaElement::setMuted):
616         (WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker):
617         (WebCore::HTMLMediaElement::processingUserGestureForMedia):
618         * html/HTMLMediaElement.h:
619         * html/MediaElementSession.cpp:
620         (WebCore::MediaElementSession::playbackPermitted):
621         (WebCore::MediaElementSession::dataLoadingPermitted):
622         (WebCore::MediaElementSession::fullscreenPermitted):
623         (WebCore::MediaElementSession::canShowControlsManager):
624         (WebCore::MediaElementSession::showPlaybackTargetPicker):
625         * page/Settings.in:
626         * platform/audio/PlatformMediaSession.h:
627
628 2017-05-15  Jer Noble  <jer.noble@apple.com>
629
630         Only ever initialize LibWebRTCProvider's staticFactoryAndThreads() factories once.
631         https://bugs.webkit.org/show_bug.cgi?id=172047
632
633         Reviewed by Youenn Fablet.
634
635         Wrap the initilization of the factories contained in staticFactoryAndThreads() in a call_once to ensure
636         new factories aren't created every time it's called.
637
638         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
639         (WebCore::staticFactoryAndThreads):
640
641 2017-05-15  Joseph Pecoraro  <pecoraro@apple.com>
642
643         Web Inspector: CRASH seen with DOM.setOuterHTML when there is no documentElement
644         https://bugs.webkit.org/show_bug.cgi?id=172135
645         <rdar://problem/32175860>
646
647         Reviewed by Brian Burg.
648
649         Test: inspector/dom/setOuterHTML-no-document-element.html
650
651         * inspector/DOMPatchSupport.cpp:
652         (WebCore::DOMPatchSupport::patchDocument):
653         Null check the document element which might not exist.
654
655 2017-05-15  Said Abou-Hallawa  <sabouhallawa@apple.com>
656
657         REGRESSION (216471): Infinite repaint-drawing loop when asynchronously decoding incomplete image frames
658         https://bugs.webkit.org/show_bug.cgi?id=171900
659
660         Reviewed by Tim Horton.
661
662         -- Don't destroy incomplete decoded image frames for large images. This
663         is to avoid flickering while decoding another image frame with the new
664         data. The old incomplete image frame will be destroyed once the newer one
665         finishes decoding.
666
667         -- Extend the enum ImageFrame::DecodingStatus by adding a new value called
668         'Decoding'. This new value will never be cached in the ImageFrame::
669         m_decodingStatus. Add a member m_currentFrameDecodingStatus to BitmapImage.
670         The purpose of this member is to invalidate the current frame, without
671         deleting it, when new encoded data is received.
672
673         -- Don't wait until the native image is decoded to cache the ImageFrame
674         decodingStatus. There is a big chance that more data arrives between
675         starting the decoding and finishing it such that the decoding changes
676         from Partial to Complete. We need to prevent keeping incomplete ImageFrames
677         cached because we mistakenly assume they are complete. To fix this issue
678         we need to know the ImageFrame decodingStatus when the decoding is requested.
679
680         * platform/graphics/BitmapImage.cpp:
681         (WebCore::BitmapImage::destroyDecodedData):
682         (WebCore::BitmapImage::dataChanged):
683         (WebCore::BitmapImage::draw):
684         (WebCore::BitmapImage::internalStartAnimation): At the beginning of this 
685         function we check whether the next frame is being decoded or not and we 
686         return DecodingActive if it is. Let's handle the second check here also 
687         before requesting the decoding of nextFrame. We need to check whether the
688         nextFrame has a native image with decoded with the native size or not.
689         (WebCore::BitmapImage::internalAdvanceAnimation):
690         (WebCore::BitmapImage::imageFrameAvailableAtIndex):
691         * platform/graphics/BitmapImage.h:
692         * platform/graphics/ImageFrame.cpp:
693         (WebCore::ImageFrame::operator=):
694         (WebCore::ImageFrame::setDecodingStatus):
695         (WebCore::ImageFrame::decodingStatus):
696         * platform/graphics/ImageFrame.h:
697         (WebCore::ImageFrame::isInvalid):
698         (WebCore::ImageFrame::isPartial):
699         (WebCore::ImageFrame::isComplete):
700         (WebCore::ImageFrame::setDecoding): Deleted.
701         (WebCore::ImageFrame::decoding): Deleted.
702         (WebCore::ImageFrame::isEmpty): Deleted.
703         * platform/graphics/ImageFrameCache.cpp:
704         (WebCore::ImageFrameCache::setNativeImage):
705         (WebCore::ImageFrameCache::cacheMetadataAtIndex):
706         (WebCore::ImageFrameCache::cacheNativeImageAtIndex):
707         (WebCore::ImageFrameCache::cacheNativeImageAtIndexAsync):
708         (WebCore::ImageFrameCache::startAsyncDecodingQueue):
709         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex):
710         (WebCore::ImageFrameCache::stopAsyncDecodingQueue):
711         (WebCore::ImageFrameCache::frameAtIndexCacheIfNeeded):
712         (WebCore::ImageFrameCache::frameDecodingStatusAtIndex):
713         (WebCore::ImageFrameCache::cacheFrameMetadataAtIndex): Deleted.
714         (WebCore::ImageFrameCache::cacheFrameNativeImageAtIndex): Deleted.
715         (WebCore::ImageFrameCache::cacheAsyncFrameNativeImageAtIndex): Deleted.
716         (WebCore::ImageFrameCache::frameIsCompleteAtIndex): Deleted.
717         * platform/graphics/ImageFrameCache.h:
718         (WebCore::ImageFrameCache::ImageFrameRequest::operator==):
719         * platform/graphics/ImageSource.cpp:
720         (WebCore::ImageSource::dataChanged):
721         * platform/graphics/ImageSource.h:
722         (WebCore::ImageSource::destroyIncompleteDecodedData):
723         (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex): Let the caller
724         decide whether another request for the same image frame is allowed or not.
725         (WebCore::ImageSource::frameDecodingStatusAtIndex):
726         (WebCore::ImageSource::frameIsCompleteAtIndex): Deleted.
727         * platform/image-decoders/ImageDecoder.cpp:
728         (WebCore::ImageDecoder::frameDurationAtIndex):
729         (WebCore::ImageDecoder::createFrameImageAtIndex):
730         * platform/image-decoders/bmp/BMPImageReader.cpp:
731         (WebCore::BMPImageReader::decodeBMP):
732         * platform/image-decoders/gif/GIFImageDecoder.cpp:
733         (WebCore::GIFImageDecoder::clearFrameBufferCache):
734         (WebCore::GIFImageDecoder::haveDecodedRow):
735         (WebCore::GIFImageDecoder::frameComplete):
736         (WebCore::GIFImageDecoder::initFrameBuffer):
737         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
738         (WebCore::JPEGImageDecoder::outputScanlines):
739         (WebCore::JPEGImageDecoder::jpegComplete):
740         * platform/image-decoders/png/PNGImageDecoder.cpp:
741         (WebCore::PNGImageDecoder::rowAvailable):
742         (WebCore::PNGImageDecoder::pngComplete):
743         (WebCore::PNGImageDecoder::clearFrameBufferCache):
744         (WebCore::PNGImageDecoder::frameComplete):
745         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
746         (WebCore::WEBPImageDecoder::decode):
747
748 2017-05-15  Chris Dumez  <cdumez@apple.com>
749
750         Align WebKitCSSMatrix stringifier with spec for DOMMatrix
751         https://bugs.webkit.org/show_bug.cgi?id=172114
752
753         Reviewed by Simon Fraser.
754
755         Align WebKitCSSMatrix stringifier with spec for DOMMatrix after:
756         - https://github.com/w3c/fxtf-drafts/pull/148
757
758         The following changes were made:
759         - Use EcmaScript's ToString() to convert floating point values to string
760         - Throw an invalid state error if the matrix contains non-finite values
761         - Made WebKitCSSMatrix.toString enumerable as per [1].
762
763         [1] https://heycam.github.io/webidl/#es-stringifier
764
765         Test: fast/css/matrix-stringifier.html
766
767         * css/WebKitCSSMatrix.cpp:
768         (WebCore::WebKitCSSMatrix::toString):
769         * css/WebKitCSSMatrix.h:
770         * css/WebKitCSSMatrix.idl:
771         * platform/graphics/transforms/TransformationMatrix.cpp:
772         (WebCore::TransformationMatrix::containsOnlyFiniteValues):
773         * platform/graphics/transforms/TransformationMatrix.h:
774
775 2017-05-15  Mark Lam  <mark.lam@apple.com>
776
777         WorkerRunLoop::Task::performTask() should check !scriptController->isTerminatingExecution().
778         https://bugs.webkit.org/show_bug.cgi?id=171775
779         <rdar://problem/30975761>
780
781         Reviewed by Filip Pizlo.
782
783         Currently, WorkerThread::stop() calls scheduleExecutionTermination() to terminate
784         JS execution first, followed by posting a cleanup task to the worker, and lastly,
785         it invokes terminate() on the WorkerRunLoop.
786
787         As a result, before the run loop is terminated, the worker thread may observe the
788         TerminatedExecutionException in JS code, bail out, see another JS task to run,
789         re-enters the VM to run said JS code, and fails with an assertion due to the
790         TerminatedExecutionException still being pending on VM entry.
791
792         WorkerRunLoop::Task::performTask() already has a check to only allow a task to
793         run if and only if !runLoop.terminated() and the task is not a clean up task.
794         We'll fix the above race by changing WorkerRunLoop::Task::performTask() to check
795         !context->script()->isTerminatingExecution() instead of !runLoop.terminated().
796         Since WorkerThread::stop() always scheduleExecutionTermination() before it
797         terminates the run loop, !context->script()->isTerminatingExecution() implies
798         !runLoop.terminated().
799
800         The only time that runLoop is terminated without scheduleExecutionTermination()
801         being called is when WorkerThread::stop() is called before the WorkerThread has
802         finished creating its WorkerGlobalScope.  In this scenario, WorkerThread::stop()
803         will still terminate the run loop.  Hence, after the WorkerGlobalScope is created
804         (in WorkerThread::workerThread()), we will check if the run loop has been
805         terminated (i.e. stop() was called).  If so, we'll scheduleExecutionTermination()
806         there, and guarantee that if runloop.terminated() is true, then
807         context->script()->isTerminatingExecution() is also true.
808
809         Solutions that were considered but did not work (recorded for future reference):
810
811         1. In WorkerThread::stop(), call scheduleExecutionTermination() only after it
812            posts the cleanup task and terminate the run loop.
813
814            This did not work because this creates a race where the worker thread may run
815            the cleanup task before WorkerThread::stop() finishes.  As a result, the
816            scriptController may be deleted before we get to invoke scheduleExecutionTermination()
817            on it, thereby resulting in a use after free.
818
819            To make this work, we would have to change the life cycle management strategy
820            of the WorkerScriptController.  This is a more risky change that we would
821            want to take on at this time, and may also not be worth the gain.
822
823         2. Break scheduleExecutionTermination() up into 2 parts i.e. WorkerThread::stop()
824            will:
825            1. set the scriptControllers m_isTerminatingExecution flag before
826               posting the cleanup task and terminating the run loop, and
827            2. invoke VM::notifyNeedsTermination() after posting the cleanup task and
828               terminating the run loop.
829
830            This requires that we protect the liveness of the VM until we can invoke
831            notifyNeedsTermination() on it.
832
833            This did not work because:
834            1. We may end up destructing the VM in WorkerThread::stop() i.e. in the main
835               web frame, but only the worker thread holds the JS lock for the VM.
836
837               We can make the WorkerThread::stop() acquire the JS lock just before it
838               releases the protected VM's RefPtr, but that would mean the main thread
839               may be stuck waiting a bit for the worker thread to release its JSLock.
840               This is not desirable.
841
842            2. In practice, changing the liveness period of the Worker VM relative to its
843               WorkerScriptController and WorkerGlobalScope also has unexpected
844               ramifications.  We observed many worker tests failing with assertion
845               failures and crashes due to this change.
846
847            Hence, this approach is also a more risky change than it appears on the
848            surface, and is not worth exploring at this time.
849
850         In the end, changing WorkerRunLoop::Task::performTask() to check for
851         !scriptController->isTerminatingExecution() is the most straight forward solution
852         that is easy to prove correct.
853
854         Also fixed a race in WorkerThread::workerThread() where it can delete the
855         WorkerGlobalScope while WorkerThread::stop() is in the midst of accessing it.
856         We now guard the the nullifying of m_workerGlobalScope with the
857         m_threadCreationAndWorkerGlobalScopeMutex as well.
858
859         UPDATE: the only new thing in this patch for re-landing (vs one previously landed)
860         is that instead of nullifying m_workerGlobalScope directly (thereby deleting the
861         WorkerGlobalScope context), we'll swap it out and delete it only after we've
862         unlocked the m_threadCreationAndWorkerGlobalScopeMutex.  This is needed because
863         the destruction of the WorkerGlobalScope will cause the main thread to race against
864         the worker thread to delete the WorkerThread object, and the WorkerThread object
865         owns the mutex that we need to unlock after nullifying the m_workerGlobalScope
866         field.
867
868         This issue is covered by an existing test that I just unskipped in TestExpectations.
869
870         * bindings/js/JSDOMPromiseDeferred.cpp:
871         (WebCore::DeferredPromise::callFunction):
872
873         * bindings/js/WorkerScriptController.cpp:
874         (WebCore::WorkerScriptController::scheduleExecutionTermination):
875         - Added a check to do nothing and return early if the scriptController is already
876           terminating execution.
877
878         * workers/WorkerRunLoop.cpp:
879         (WebCore::WorkerRunLoop::runInMode):
880         (WebCore::WorkerRunLoop::runCleanupTasks):
881         (WebCore::WorkerRunLoop::Task::performTask):
882
883         * workers/WorkerRunLoop.h:
884         - Made Task::performTask() private and make Task befriend the WorkerRunLoop class.
885           This ensures that only the WorkerRunLoop may call performTask().
886           Note: this change only formalizes and hardens a relationship that was already
887           in place before this.
888
889         * workers/WorkerThread.cpp:
890         (WebCore::WorkerThread::start):
891         (WebCore::WorkerThread::workerThread):
892         (WebCore::WorkerThread::stop):
893         * workers/WorkerThread.h:
894         - Renamed m_threadCreationMutex to m_threadCreationAndWorkerGlobalScopeMutex so
895           that it more accurately describes what it guards.
896
897 2017-05-15  Myles C. Maxfield  <mmaxfield@apple.com>
898
899         Unicode characters which can't be rendered in any font are invisible
900         https://bugs.webkit.org/show_bug.cgi?id=171942
901         <rdar://problem/32054234>
902
903         Reviewed by Tim Horton.
904
905         There are some Unicode characters which don't have any font on the system which can render them.
906         These characters should be drawn as the .notdef "tofu." This is for security and usability, as
907         well as what Firefox and Chrome do. However, we still shouldn't draw characters with the
908         Default_Ignorable_Code_Point property, because this is what CoreText does.
909
910         This behavior is also what the Unicode spec recommends: In UTR #36 Unicode Security Considerations:
911         http://www.unicode.org/reports/tr36/#Recommendations_General
912         "If there is no available glyph for a character, never show a simple "?" or omit the character."
913
914         Also relevant is the Unicode Standard section 5.3 Unknown and MIssing Characters, starting at page
915         marked 203 in the following: http://www.unicode.org/versions/Unicode9.0.0/ch05.pdf
916
917         Tests: fast/text/default-ignorable.html
918                fast/text/unknown-char-notdef.html
919
920         * platform/graphics/WidthIterator.cpp:
921         (WebCore::characterMustDrawSomething):
922
923 2017-05-15  Timothy Horton  <timothy_horton@apple.com>
924
925         Null deref under WebContentReader::readURL when interacting with a file URL
926         https://bugs.webkit.org/show_bug.cgi?id=172045
927         <rdar://problem/25880647>
928
929         Reviewed by Wenson Hsieh.
930
931         * editing/ios/EditorIOS.mm:
932         (WebCore::Editor::WebContentReader::readURL):
933         The AppSupport soft link was wrong, as there is no such framework in /System/Library/Frameworks.
934         Thus, any time we hit this codepath, the soft linked function would be null, and calling it would crash.
935         Instead of just fixing the soft link, remove the code, because it does not seem necessary to
936         special-case fileURLs to images in the media directory.
937
938 2017-05-15  Eric Carlson  <eric.carlson@apple.com>
939
940         ASSERTION FAILED: wasRemoved in WebCore::RealtimeMediaSourceCenter::removeDevicesChangedObserver(DevicesChangedObserverToken)
941         https://bugs.webkit.org/show_bug.cgi?id=171529
942         <rdar://problem/31945791>
943
944         Reviewed by Jer Noble.
945
946         No new tests, fixes a crash in existing tests.
947
948         * Modules/mediastream/MediaDevices.cpp:
949         (WebCore::MediaDevices::MediaDevices): Use a weak ptr.
950
951         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
952         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
953         (WebCore::observerMap):  Use a static hash map for observers because the
954         source center can change at runtime.
955         (WebCore::RealtimeMediaSourceCenter::addDevicesChangedObserver):
956         (WebCore::RealtimeMediaSourceCenter::removeDevicesChangedObserver):
957         (WebCore::RealtimeMediaSourceCenter::captureDevicesChanged):
958
959 2017-05-15  Brent Fulgham  <bfulgham@apple.com>
960
961         [iOS WK1] Do not try to dispatch messages to subframes if their documents have not been constructed yet.
962         https://bugs.webkit.org/show_bug.cgi?id=172059
963         <rdar://problem/31963192>
964
965         Reviewed by Zalan Bujtas.
966
967         On iOS WK1 we can end up in an inconsistent state, where
968         1. The web thread is inside a newly-injected iframe's document's constructor and
969         2. waiting on a delegate callback on the main thread
970         while the main thread
971         (a) Evaluates arbitrary JavaScript that modifies storage which
972         (b) Triggers an event dispatch.
973  
974         * storage/StorageEventDispatcher.cpp:
975         (WebCore::StorageEventDispatcher::dispatchSessionStorageEvents): If the sub-frame's document
976         is in an inconsistent state, skip it.
977         (WebCore::StorageEventDispatcher::dispatchLocalStorageEvents): Ditto.
978         (WebCore::StorageEventDispatcher::dispatchSessionStorageEventsToFrames): Ditto.
979         (WebCore::StorageEventDispatcher::dispatchLocalStorageEventsToFrames): Ditto.
980
981 2017-05-15  Zalan Bujtas  <zalan@apple.com>
982
983         Simple line layout: Leading whitespace followed by a <br> produces an extra linebreak.
984         https://bugs.webkit.org/show_bug.cgi?id=172076
985
986         Reviewed by Antti Koivisto.
987
988         When the collapsed whitespace does not fit the line, we need to push it to the next line
989         so that we can decide whether any soft/hard linebreak should be skipped (to avoid double line breaks) or not.
990
991         Test: fast/text/simple-line-layout-leading-whitespace-with-soft-hard-linebreak.html
992
993         * rendering/SimpleLineLayout.cpp:
994         (WebCore::SimpleLineLayout::consumeLineBreakIfNeeded): special handling <br>
995         (WebCore::SimpleLineLayout::firstFragment): Now we need to deal with leading collapsed whitespace.
996         (WebCore::SimpleLineLayout::createLineRuns): We need to push even the collapsed whitespace to the next line.
997
998 2017-05-15  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
999
1000         Invalid MediaSource duration value should throw TyperError instead of InvalidStateError
1001         https://bugs.webkit.org/show_bug.cgi?id=171653
1002
1003         Reviewed by Chris Dumez.
1004
1005         Modify MediaSource::setDuration to throw a TypeError when duration value is invalid as per MSE specification
1006         (https://www.w3.org/TR/2016/REC-media-source-20161117/#dom-mediasource-duration).
1007
1008         Update expectations of corresponding WPT test.
1009
1010         * Modules/mediasource/MediaSource.cpp:
1011         (WebCore::MediaSource::setDuration):
1012         (WebCore::MediaSource::setDurationInternal):
1013
1014 2017-05-15  Gwang Yoon Hwang  <yoon@igalia.com>
1015
1016         [CAIRO] Painting an image mask with a matrix above Pixman's limit breaks internal states of Cairo
1017         https://bugs.webkit.org/show_bug.cgi?id=169094
1018
1019         Reviewed by Žan Doberšek.
1020
1021         It is the same problem which addressed in r212431.
1022         In HiDPI situation, it happens easily due to the size of coordinates.
1023         Also, if this bug happens, it will break the rendering continuously
1024         since we are reusing graphics contexts to render webpages in same
1025         webview.
1026
1027         Test: fast/hidpi/hidpi-long-page-with-inset-element.html
1028
1029         * platform/graphics/cairo/PlatformContextCairo.cpp:
1030         (WebCore::PlatformContextCairo::pushImageMask):
1031         We can avoid the limit of the Pixman by reducing the source surface's
1032         size, and it will create a minimal pattern matrix.
1033
1034 2017-05-14  Zan Dobersek  <zdobersek@igalia.com>
1035
1036         Unreviewed build fix with newer Perl versions.
1037
1038         * bindings/scripts/CodeGeneratorJS.pm:
1039         (AddLegacyCallerOperationIfNeeded): Support for experimental push on scalar (and
1040         other auto-dereferencing) was removed in Perl 5.24. Instead, the LegacyCallers array
1041         has to be dereferenced when pushing new values to it.
1042
1043 2017-05-14  Sam Weinig  <sam@webkit.org>
1044
1045         [WebIDL/DOM] Remove need for custom bindings for HTMLAllCollection and bring up to spec
1046         https://bugs.webkit.org/show_bug.cgi?id=172095
1047
1048         Reviewed by Darin Adler.
1049
1050         - Adds support for the legacycaller WebIDL special annotation.
1051         - Updates implementation of HTMLAllCollection to match the current HTML spec.
1052
1053         Test: fast/dom/document-all.html
1054
1055         * CMakeLists.txt:
1056         * WebCore.xcodeproj/project.pbxproj:
1057         * bindings/js/JSBindingsAllInOne.cpp:
1058         * bindings/js/JSHTMLAllCollectionCustom.cpp: Removed.
1059         Removed JSHTMLAllCollectionCustom.cpp
1060
1061         * bindings/scripts/CodeGeneratorJS.pm:
1062         (GenerateInterface):
1063         (AddLegacyCallerOperationIfNeeded):
1064         Before code generation, clone all the legacycaller operations and put them
1065         in their own set, so they can form an overload set.
1066         
1067         (AddStringifierOperationIfNeeded):
1068         Use IDLParser::cloneType as the FIXME suggested.
1069
1070         (GenerateHeader):
1071         Group call related functionality together and use new IsCallable predicate.
1072
1073         (GenerateOverloadedFunctionOrConstructor):
1074         Generalize a little bit to allow the function being overloaded to be an overloaded legacycaller.
1075
1076         (GenerateImplementation):
1077         Add call to generate the legacycaller code.
1078
1079         (GenerateLegacyCallerDefinitions):
1080         (GenerateLegacyCallerDefinition):
1081         Generate the legacycaller definition, using GenerateArgumentsCountCheck, GenerateParametersCheck
1082         and GenerateImplementationFunctionCall to do all the heavy lifting.
1083
1084         (IsCallable):
1085         Add helper predicate for both custom calls and legacycaller.
1086
1087         * bindings/scripts/IDLParser.pm:
1088         (cloneType):.
1089         (cloneArgument):.
1090         (cloneOperation):
1091         Add cloning functions for IDLArgument and IDLOperation, and make IDLType's
1092         clone feasible for calling outside the package by removing the unneeded 
1093         self parameter.
1094
1095         * bindings/scripts/test/JS/JSTestObj.cpp
1096         * bindings/scripts/test/JS/JSTestObj.h
1097         * bindings/scripts/test/TestObj.idl:
1098         Add testing of legacycaller overloading.
1099
1100         * dom/Document.cpp:
1101         (WebCore::Document::allFilteredByName):
1102         * dom/Document.h:
1103         Add new collection access for the HTMLAllNamedSubCollection.
1104
1105         * html/CachedHTMLCollection.h:
1106         (WebCore::nameShouldBeVisibleInDocumentAll):
1107         Update list of tags to match the current spec.
1108
1109         * html/CollectionType.h:
1110         Add new type for HTMLAllNamedSubCollection.
1111
1112         * html/GenericCachedHTMLCollection.cpp:
1113         (WebCore::GenericCachedHTMLCollection<traversalType>::elementMatches):
1114         Specify that DocumentAllNamedItems does not want
1115         the default elementMatches.
1116  
1117         * html/HTMLAllCollection.cpp:
1118         (WebCore::HTMLAllCollection::namedOrIndexedItemOrItems):
1119         (WebCore::HTMLAllCollection::namedItemOrItems):
1120         (WebCore::HTMLAllNamedSubCollection::~HTMLAllNamedSubCollection):
1121         (WebCore::HTMLAllNamedSubCollection::elementMatches):
1122         * html/HTMLAllCollection.h:
1123         Move implementations from the custom binding, and re-implement to
1124         match the spec. Alternate names to item/namedItem were needed to not
1125         shadow the existing ones in HTMLCollection. HTMLAllNamedSubCollection
1126         is a simple HTMLCollection that matches on a name, following the rules
1127         of document.all about which tags can have name attributes.
1128
1129         * html/HTMLAllCollection.idl:
1130         Remove custom annotations and add legacycaller which is now supported.
1131
1132         * html/HTMLCollection.cpp:
1133         (WebCore::invalidationTypeExcludingIdAndNameAttributes):
1134         (WebCore::HTMLCollection::~HTMLCollection):
1135         Add DocumentAllNamedItems.
1136
1137 2017-05-14  Zalan Bujtas  <zalan@apple.com>
1138
1139         Remove unused lambda in TextFragmentIterator::TextFragment::split() and cleanup dependencies.
1140         https://bugs.webkit.org/show_bug.cgi?id=172089
1141
1142         Reviewed by David Kilzer.
1143
1144         * rendering/SimpleLineLayout.cpp:
1145         (WebCore::SimpleLineLayout::splitFragmentToFitLine):
1146         * rendering/SimpleLineLayoutTextFragmentIterator.h:
1147         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::split):
1148         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::splitWithHyphen):
1149
1150 2017-05-13  David Kilzer  <ddkilzer@apple.com>
1151
1152         Unused lambda in JSWebKitSubtleCrypto::wrapKey()
1153         <https://webkit.org/b/172087>
1154
1155         Reviewed by Chris Dumez.
1156
1157         Fixes the following warning with newer clang:
1158
1159             Source/WebCore/bindings/js/JSWebKitSubtleCryptoCustom.cpp:594:35: error: lambda capture 'keyFormat' is not used [-Werror,-Wunused-lambda-capture]
1160                 auto exportSuccessCallback = [keyFormat, algorithm, parameters, wrappingKey, wrapper](const Vector<uint8_t>& exportedKeyData) mutable {
1161                                               ^
1162
1163         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
1164         (WebCore::JSWebKitSubtleCrypto::wrapKey): Remove unused lambda.
1165
1166 2017-05-13  Eric Carlson  <eric.carlson@apple.com>
1167
1168         [MediaStream] deviceId constraint doesn't work with getUserMedia
1169         https://bugs.webkit.org/show_bug.cgi?id=171877
1170         <rdar://problem/31899730>
1171
1172         Reviewed by Jer Noble.
1173
1174         Test: fast/mediastream/get-user-media-device-id.html
1175
1176         * Modules/mediastream/MediaConstraintsImpl.h:
1177         (WebCore::MediaConstraintsData::MediaConstraintsData): Add a constructor that 
1178         takes a const MediaConstraints&.
1179
1180         * Modules/mediastream/MediaDevices.cpp:
1181         (WebCore::MediaDevices::~MediaDevices): m_deviceChangedToken is a std::optional<>.
1182         * Modules/mediastream/MediaDevices.h:
1183
1184         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
1185         (WebCore::MediaDevicesEnumerationRequest::topLevelDocumentOrigin): Don't return
1186         NULL for the main frame so the origin matches that returned for a UserMediaRequest.
1187
1188         * Modules/mediastream/UserMediaController.h:
1189         (WebCore::UserMediaController::setDeviceIDHashSalt): Deleted, not used.
1190         (WebCore::UserMediaController::deviceIDHashSalt): Deleted, not used.
1191
1192         * Modules/mediastream/UserMediaRequest.cpp:
1193         (WebCore::UserMediaRequest::allow): Add device ID hash salt parameter, set it on
1194         constraints.
1195         * Modules/mediastream/UserMediaRequest.h:
1196
1197         * platform/mediastream/MediaConstraints.h:
1198         * platform/mediastream/RealtimeMediaSource.cpp:
1199         (WebCore::RealtimeMediaSource::fitnessDistance): ASSERT if called for DeviceId.
1200         (WebCore::RealtimeMediaSource::selectSettings): Special case DeviceId because it
1201         we have to hash the device ID before comparing, and because the DeviceId can't be
1202         changed so it should never be added to the flattened constraints.
1203         (WebCore::RealtimeMediaSource::supportsConstraints):
1204         (WebCore::RealtimeMediaSource::applyConstraints):
1205         * platform/mediastream/RealtimeMediaSource.h:
1206
1207         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1208         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): Implement.
1209         * platform/mediastream/RealtimeMediaSourceCenter.h:
1210
1211         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp:
1212         (WebCore::RealtimeMediaSourceSupportedConstraints::nameForConstraint): Deleted, unused.
1213         (WebCore::RealtimeMediaSourceSupportedConstraints::constraintFromName): Deleted, unused.
1214         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.h:
1215
1216         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1217         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1218         (WebCore::RealtimeMediaSourceCenterMac::bestSourcesForTypeAndConstraints): Pass device
1219         id, not empty string.
1220         (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints): Deleted.
1221         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
1222
1223         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1224         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints): Deleted.
1225         * platform/mock/MockRealtimeMediaSourceCenter.h:
1226
1227 2017-05-13  Chris Dumez  <cdumez@apple.com>
1228
1229         Stop using RefPtr::release()
1230         https://bugs.webkit.org/show_bug.cgi?id=172074
1231
1232         Reviewed by Geoffrey Garen.
1233
1234         * css/parser/CSSPropertyParser.cpp:
1235         (WebCore::FontVariantLigaturesParser::finalizeValue):
1236         (WebCore::FontVariantNumericParser::finalizeValue):
1237         * css/parser/CSSPropertyParserHelpers.cpp:
1238         (WebCore::CSSPropertyParserHelpers::CalcParser::consumeValue):
1239         * loader/SubresourceLoader.cpp:
1240         (WebCore::SubresourceLoader::create):
1241         * loader/archive/mhtml/MHTMLArchive.cpp:
1242         (WebCore::MHTMLArchive::generateMHTMLData):
1243         * loader/archive/mhtml/MHTMLArchive.h:
1244         * loader/archive/mhtml/MHTMLParser.cpp:
1245         (WebCore::MHTMLParser::parseArchiveWithHeader):
1246         * platform/audio/ios/AudioFileReaderIOS.cpp:
1247         (WebCore::AudioFileReader::createBus):
1248         * platform/glib/SharedBufferGlib.cpp:
1249         (WebCore::SharedBuffer::createFromReadingFile):
1250         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
1251         (WebCore::CACFLayerTreeHost::create):
1252         * platform/graphics/cairo/CairoUtilities.cpp:
1253         (WebCore::copyCairoImageSurface):
1254         * platform/graphics/cairo/ImageBufferCairo.cpp:
1255         (WebCore::getImageData):
1256         * platform/graphics/gtk/IconGtk.cpp:
1257         (WebCore::Icon::createIconForFiles):
1258         * platform/graphics/win/FontCacheWin.cpp:
1259         (WebCore::FontCache::systemFallbackForCharacters):
1260         * platform/win/SharedBufferWin.cpp:
1261         (WebCore::SharedBuffer::createFromReadingFile):
1262
1263 2017-05-13  Javier Fernandez  <jfernandez@igalia.com>
1264
1265         [css-align] Implement the place-self shorthand
1266         https://bugs.webkit.org/show_bug.cgi?id=168846
1267
1268         Reviewed by Zalan Bujtas.
1269
1270         The CSS Box Alignment specification defines a new shorthand to set the
1271         Content Alignment properties (align-self and justify-self) at the
1272         same time.
1273
1274         This patch provides the implementation of the CSS parsing logic and the
1275         required regression tests.
1276
1277         Test: css3/parse-place-self.html
1278
1279         * css/CSSComputedStyleDeclaration.cpp:
1280         (WebCore::ComputedStyleExtractor::propertyValue):
1281         * css/CSSProperties.json:
1282         * css/StyleProperties.cpp:
1283         (WebCore::StyleProperties::getPropertyValue):
1284         * css/parser/CSSPropertyParser.cpp:
1285         (WebCore::CSSPropertyParser::consumePlaceSelfShorthand):
1286         (WebCore::CSSPropertyParser::parseShorthand):
1287         * css/parser/CSSPropertyParser.h:
1288
1289 2017-05-13  Commit Queue  <commit-queue@webkit.org>
1290
1291         Unreviewed, rolling out r216801.
1292         https://bugs.webkit.org/show_bug.cgi?id=172072
1293
1294         Many memory corruption crashes on worker threads (Requested by
1295         ap on #webkit).
1296
1297         Reverted changeset:
1298
1299         "WorkerRunLoop::Task::performTask() should check
1300         !scriptController->isTerminatingExecution()."
1301         https://bugs.webkit.org/show_bug.cgi?id=171775
1302         http://trac.webkit.org/changeset/216801
1303
1304 2017-05-13  Zalan Bujtas  <zalan@apple.com>
1305
1306         AccessibilityRenderObject::textUnderElement needs to assert on unclean tree.
1307         https://bugs.webkit.org/show_bug.cgi?id=172065
1308
1309         Reviewed by Simon Fraser.
1310
1311         r192103 changed the assert logic incorrectly. If the tree is dirty, regardless of the renderer's type,
1312         TextIterator will end up forcing style update/layout on the render tree.
1313         The original assert would have hit with bug 171546 prior to r216726.
1314
1315         * accessibility/AccessibilityRenderObject.cpp:
1316         (WebCore::AccessibilityRenderObject::textUnderElement):
1317
1318 2017-05-12  Simon Fraser  <simon.fraser@apple.com>
1319
1320         event.clientX/clientY should be in layout viewport coordinates
1321         https://bugs.webkit.org/show_bug.cgi?id=172018
1322
1323         Reviewed by Zalan Bujtas.
1324
1325         Fix clientX and clientY on mouse events to be relative to the layout viewport, to match
1326         getBoundingClientRect(), getClientRects() and fixed-position objects.
1327
1328         Also minor cleanup of MouseRelatedEvent to use initializers.
1329
1330         Test: fast/visual-viewport/client-coordinates-relative-to-layout-viewport.html
1331
1332         * dom/MouseRelatedEvent.cpp:
1333         (WebCore::MouseRelatedEvent::MouseRelatedEvent):
1334         (WebCore::MouseRelatedEvent::init):
1335         (WebCore::MouseRelatedEvent::initCoordinates):
1336         (WebCore::contentsScrollOffset): Deleted.
1337         * dom/MouseRelatedEvent.h:
1338
1339 2017-05-12  Sam Weinig  <sam@webkit.org>
1340
1341         [WebIDL] Remove need for custom binding for Worker constructor
1342         https://bugs.webkit.org/show_bug.cgi?id=172050
1343
1344         Reviewed by Chris Dumez.
1345
1346         * CMakeLists.txt:
1347         * WebCore.xcodeproj/project.pbxproj:
1348         * bindings/js/JSWorkerCustom.cpp: Removed.
1349         Remove JSWorkerCustom.cpp
1350
1351         * bindings/scripts/CodeGeneratorJS.pm:
1352         (GenerateCallWith):
1353         * bindings/scripts/IDLAttributes.json:
1354         Add RuntimeFlags as a new option for the ConstructorCallWith extended attribute.
1355
1356         * workers/Worker.cpp:
1357         (WebCore::Worker::create):
1358         * workers/Worker.h:
1359         Update order of arguments to appease the generator.
1360
1361         * workers/Worker.idl:
1362         Add extended attributes for the constructor.
1363
1364 2017-05-12  Simon Fraser  <simon.fraser@apple.com>
1365
1366         The rects returned by Element/Range.getClientRects() should not be rounded
1367         https://bugs.webkit.org/show_bug.cgi?id=172057
1368
1369         Reviewed by Chris Dumez.
1370
1371         Fix createDOMRectVector() to not expand the rects to integer boundaries (which
1372         quad.enclosingBoundingBox() does), but to return rects with floating point
1373         values. This matches Chrome and Firefox, and matches getBoundingClientRect(),
1374         which does not integral snap.
1375
1376         * dom/DOMRect.cpp:
1377         (WebCore::createDOMRectVector):
1378
1379 2017-05-12  Jiewen Tan  <jiewen_tan@apple.com>
1380
1381         Elements should be inserted into a template element as its content's last child
1382         https://bugs.webkit.org/show_bug.cgi?id=171373
1383         <rdar://problem/31862949>
1384
1385         Reviewed by Ryosuke Niwa.
1386
1387         Before this change, our HTML parser obeys the following premises:
1388         1) A fostering child whose parent is a table should be inserted before its parent and under its grandparent.
1389         2) When inserting into a template element, an element should be inserted into its content.
1390
1391         Let's walk through the example:
1392         a) Before eventhandler takes place
1393         template
1394         table
1395             svg <- parser
1396         b) After eventhandler takes place
1397         template
1398             table
1399                 svg <- parser
1400         c) after parsing svg
1401         template
1402             content
1403                 svg
1404                 (table)
1405             table
1406
1407         Finally, in the example, the svg element will be inserted into the content of the template element while
1408         having its next sibling point to the table element. However, the table element is actually under the
1409         template element not its content.
1410
1411         This messy tree is constructed because the second premise is incompleted. It should be: When inserting into
1412         a template element, an element should be inserted into its content as its last child.
1413         Quoted from Step 3 of https://html.spec.whatwg.org/multipage/syntax.html#appropriate-place-for-inserting-a-node
1414         A correct tree will then looks like:
1415         template
1416             content
1417                 svg
1418             table
1419
1420         Tests: fast/dom/HTMLTemplateElement/insert-fostering-child-crash.html
1421                fast/dom/HTMLTemplateElement/insert-fostering-child.html
1422
1423         * html/parser/HTMLConstructionSite.cpp:
1424         (WebCore::insert):
1425         By nullifying task.nextChild, it will force the parser to append the element as task.parent's last child.
1426
1427 2017-05-12  Alex Christensen  <achristensen@webkit.org>
1428
1429         Rename WKContentExtension to WKContentRuleList
1430         https://bugs.webkit.org/show_bug.cgi?id=172053
1431         <rdar://problem/32141005>
1432
1433         Reviewed by Geoffrey Garen.
1434
1435         Covered by existing API tests.
1436
1437         * English.lproj/Localizable.strings:
1438
1439 2017-05-12  Timothy Horton  <timothy_horton@apple.com>
1440
1441         Don't use LinkPresentation URL shortening if it's not available
1442         https://bugs.webkit.org/show_bug.cgi?id=172064
1443         <rdar://problem/32169232>
1444
1445         Rubber-stamped by Wenson Hsieh.
1446
1447         * platform/mac/DragImageMac.mm:
1448         (WebCore::LinkImageLayout::LinkImageLayout):
1449         * platform/spi/cocoa/LinkPresentationSPI.h:
1450
1451 2017-05-11  Simon Fraser  <simon.fraser@apple.com>
1452
1453         Incorrect position when dragging jQuery Draggable elements with position fixed after pinch zoom
1454         https://bugs.webkit.org/show_bug.cgi?id=171113
1455         rdar://problem/31746516
1456
1457         Reviewed by Tim Horton.
1458
1459         Make getBoundingClientRect() and getClientRects() return rects which are relative to the layout
1460         viewport, rather than the visual viewport. This goes part of the way to fixing webkit.org/b/170981,
1461         which aims to make pinch-zoom invisible to web pages ("inert visual viewport"). It fixes issues on various
1462         sites like Facebook when zoomed.
1463
1464         Factor coordinate conversion code into functions on FrameView, which now documents
1465         the various coordinate systems in a big comment. Document::adjustFloatQuadsForScrollAndAbsoluteZoomAndFrameScale()
1466         and Document::adjustFloatRectForScrollAndAbsoluteZoomAndFrameScale() are renamed and factored
1467         to use these helpers.
1468
1469         There are two behavior changes here:
1470
1471         1. FrameView::documentToClientOffset() now uses the origin of the layout viewport in the "document to client"
1472            coordinate mapping.
1473            
1474         2. The two document functions would apply the scale and offset in the wrong order. We need
1475            to first undo the effects of CSS zoom, page zoom and page scale, and then map from document
1476            to client coordinates.
1477
1478         Tests: fast/visual-viewport/client-rects-relative-to-layout-viewport.html
1479                fast/zooming/client-rects-with-css-and-page-zoom.html
1480
1481         * dom/Document.cpp:
1482         (WebCore::Document::convertAbsoluteToClientQuads):
1483         (WebCore::Document::convertAbsoluteToClientRect):
1484         (WebCore::Document::adjustFloatQuadsForScrollAndAbsoluteZoomAndFrameScale): Deleted.
1485         (WebCore::Document::adjustFloatRectForScrollAndAbsoluteZoomAndFrameScale): Deleted.
1486         * dom/Document.h:
1487         * dom/Element.cpp:
1488         (WebCore::Element::getClientRects):
1489         (WebCore::Element::getBoundingClientRect):
1490         * dom/Range.cpp:
1491         (WebCore::Range::borderAndTextQuads):
1492         * page/FrameView.cpp:
1493         (WebCore::FrameView::absoluteToDocumentScaleFactor):
1494         (WebCore::FrameView::absoluteToDocumentRect):
1495         (WebCore::FrameView::absoluteToDocumentPoint):
1496         (WebCore::FrameView::documentToClientOffset):
1497         (WebCore::FrameView::documentToClientRect):
1498         (WebCore::FrameView::documentToClientPoint):
1499         * page/FrameView.h:
1500         * platform/ScrollableArea.h: #pragma once
1501         * platform/Scrollbar.h: #pragma once
1502         * platform/Widget.h: #pragma once
1503
1504 2017-05-12  Mark Lam  <mark.lam@apple.com>
1505
1506         WorkerRunLoop::Task::performTask() should check !scriptController->isTerminatingExecution().
1507         https://bugs.webkit.org/show_bug.cgi?id=171775
1508         <rdar://problem/30975761>
1509
1510         Reviewed by Saam Barati.
1511
1512         Currently, WorkerThread::stop() calls scheduleExecutionTermination() to terminate
1513         JS execution first, followed by posting a cleanup task to the worker, and lastly,
1514         it invokes terminate() on the WorkerRunLoop.
1515
1516         As a result, before the run loop is terminated, the worker thread may observe the
1517         TerminatedExecutionException in JS code, bail out, see another JS task to run,
1518         re-enters the VM to run said JS code, and fails with an assertion due to the
1519         TerminatedExecutionException still being pending on VM entry.
1520
1521         WorkerRunLoop::Task::performTask() already has a check to only allow a task to
1522         run if and only if !runLoop.terminated() and the task is not a clean up task.
1523         We'll fix the above race by changing WorkerRunLoop::Task::performTask() to check
1524         !context->script()->isTerminatingExecution() instead of !runLoop.terminated().
1525         Since WorkerThread::stop() always scheduleExecutionTermination() before it
1526         terminates the run loop, !context->script()->isTerminatingExecution() implies
1527         !runLoop.terminated().
1528
1529         The only time that runLoop is terminated without scheduleExecutionTermination()
1530         being called is when WorkerThread::stop() is called before the WorkerThread has
1531         finished creating its WorkerGlobalScope.  In this scenario, WorkerThread::stop()
1532         will still terminate the run loop.  Hence, after the WorkerGlobalScope is created
1533         (in WorkerThread::workerThread()), we will check if the run loop has been
1534         terminated (i.e. stop() was called).  If so, we'll scheduleExecutionTermination()
1535         there, and guarantee that if runloop.terminated() is true, then
1536         context->script()->isTerminatingExecution() is also true.
1537
1538         Solutions that were considered but did not work (recorded for future reference):
1539
1540         1. In WorkerThread::stop(), call scheduleExecutionTermination() only after it
1541            posts the cleanup task and terminate the run loop.
1542
1543            This did not work because this creates a race where the worker thread may run
1544            the cleanup task before WorkerThread::stop() finishes.  As a result, the
1545            scriptController may be deleted before we get to invoke scheduleExecutionTermination()
1546            on it, thereby resulting in a use after free.
1547
1548            To make this work, we would have to change the life cycle management strategy
1549            of the WorkerScriptController.  This is a more risky change that we would
1550            want to take on at this time, and may also not be worth the gain.
1551
1552         2. Break scheduleExecutionTermination() up into 2 parts i.e. WorkerThread::stop()
1553            will:
1554            1. set the scriptControllers m_isTerminatingExecution flag before
1555               posting the cleanup task and terminating the run loop, and
1556            2. invoke VM::notifyNeedsTermination() after posting the cleanup task and
1557               terminating the run loop.
1558
1559            This requires that we protect the liveness of the VM until we can invoke
1560            notifyNeedsTermination() on it.
1561
1562            This did not work because:
1563            1. We may end up destructing the VM in WorkerThread::stop() i.e. in the main
1564               web frame, but only the worker thread holds the JS lock for the VM.
1565
1566               We can make the WorkerThread::stop() acquire the JS lock just before it
1567               releases the protected VM's RefPtr, but that would mean the main thread
1568               may be stuck waiting a bit for the worker thread to release its JSLock.
1569               This is not desirable.
1570
1571            2. In practice, changing the liveness period of the Worker VM relative to its
1572               WorkerScriptController and WorkerGlobalScope also has unexpected
1573               ramifications.  We observed many worker tests failing with assertion
1574               failures and crashes due to this change.
1575
1576            Hence, this approach is also a more risky change than it appears on the
1577            surface, and is not worth exploring at this time.
1578
1579         In the end, changing WorkerRunLoop::Task::performTask() to check for
1580         !scriptController->isTerminatingExecution() is the most straight forward solution
1581         that is easy to prove correct.
1582
1583         Also fixed a race in WorkerThread::workerThread() where it can delete the
1584         WorkerGlobalScope while WorkerThread::stop() is in the midst of accessing it.
1585         We now guard the the nullifying of m_workerGlobalScope with the
1586         m_threadCreationAndWorkerGlobalScopeMutex as well.
1587
1588         This issue is covered by an existing test that I just unskipped in TestExpectations.
1589
1590         * bindings/js/JSDOMPromiseDeferred.cpp:
1591         (WebCore::DeferredPromise::callFunction):
1592
1593         * bindings/js/WorkerScriptController.cpp:
1594         (WebCore::WorkerScriptController::scheduleExecutionTermination):
1595         - Added a check to do nothing and return early if the scriptController is already
1596           terminating execution.
1597
1598         * workers/WorkerRunLoop.cpp:
1599         (WebCore::WorkerRunLoop::runInMode):
1600         (WebCore::WorkerRunLoop::runCleanupTasks):
1601         (WebCore::WorkerRunLoop::Task::performTask):
1602
1603         * workers/WorkerRunLoop.h:
1604         - Made Task::performTask() private and make Task befriend the WorkerRunLoop class.
1605           This ensures that only the WorkerRunLoop may call performTask().
1606           Note: this change only formalizes and hardens a relationship that was already
1607           in place before this.
1608
1609         * workers/WorkerThread.cpp:
1610         (WebCore::WorkerThread::start):
1611         (WebCore::WorkerThread::workerThread):
1612         (WebCore::WorkerThread::stop):
1613         * workers/WorkerThread.h:
1614         - Renamed m_threadCreationMutex to m_threadCreationAndWorkerGlobalScopeMutex so
1615           that it more accurately describes what it guards.
1616
1617 2017-05-12  Zalan Bujtas  <zalan@apple.com>
1618
1619         [iOS WK1] Do not try to layout a subframe if its document has not been constructed yet.
1620         https://bugs.webkit.org/show_bug.cgi?id=172042
1621         <rdar://problem/32084098>
1622
1623         Reviewed by Antti Koivisto.
1624
1625         On iOS WK1 we can end up in an inconsistent state, where 
1626         1. the web thread is inside a newly injected iframe's document's c'tor and 
1627         2. waiting on a delegate callback on the main thread
1628         while the main thread
1629         1. executes a pending didLayout() task
1630         2. triggers layout on the newly injected iframe.
1631
1632         * rendering/RenderWidget.cpp:
1633         (WebCore::RenderWidget::updateWidgetPosition):
1634
1635 2017-05-11  Jiewen Tan  <jiewen_tan@apple.com>
1636
1637         Check existence of a page before accessing its plugins
1638         https://bugs.webkit.org/show_bug.cgi?id=171712
1639         <rdar://problem/32007806>
1640
1641         Reviewed by Brent Fulgham.
1642
1643         Test: plugins/navigator-plugin-crash.html
1644
1645         * plugins/DOMPlugin.cpp:
1646         (WebCore::DOMPlugin::item):
1647         (WebCore::DOMPlugin::namedItem):
1648
1649 2017-05-12  Simon Fraser  <simon.fraser@apple.com>
1650
1651         Add some logging for layer tree commits, and resize and orientation change events
1652         https://bugs.webkit.org/show_bug.cgi?id=172041
1653
1654         Reviewed by Tim Horton.
1655
1656         Add some logging that's useful during rotation investigations.
1657
1658         * dom/Document.cpp:
1659         (WebCore::Document::orientationChanged):
1660         * page/FrameView.cpp:
1661         (WebCore::FrameView::sendResizeEventIfNeeded):
1662
1663 2017-05-12  Romain Bellessort  <romain.bellessort@crf.canon.fr>
1664
1665         [Readable Streams API] Add ReadableStreamBYOBReader closed getter
1666         https://bugs.webkit.org/show_bug.cgi?id=172024
1667
1668         Reviewed by Youenn Fablet.
1669
1670         Added tests to check closed getter behaviour.
1671
1672         * Modules/streams/ReadableStreamBYOBReader.js:
1673         (closed): Implemented.
1674
1675 2017-05-12  Andreas Kling  <akling@apple.com>
1676
1677         MediaResourceLoader shouldn't keep its HTMLMediaElement alive.
1678         https://bugs.webkit.org/show_bug.cgi?id=172032
1679         <rdar://problem/30816144>
1680
1681         Reviewed by Joseph Pecoraro.
1682
1683         Use a WeakPtr<HTMLMediaElement> in MediaResourceLoader instead, since the loader
1684         is retained by a NSURLSession object we hand over to AVFoundation.
1685
1686         This prevents AVFoundation from keeping entire documents alive outside our control.
1687
1688         * html/HTMLMediaElement.cpp:
1689         (WebCore::HTMLMediaElement::HTMLMediaElement):
1690         * html/HTMLMediaElement.h:
1691         (WebCore::HTMLMediaElement::createWeakPtr):
1692         * loader/MediaResourceLoader.cpp:
1693         (WebCore::MediaResourceLoader::MediaResourceLoader):
1694         (WebCore::MediaResourceLoader::requestResource):
1695         * loader/MediaResourceLoader.h:
1696
1697 2017-05-12  Andreas Kling  <akling@apple.com>
1698
1699         Memory pressure response should only do sync bmalloc scavenge in sync mode.
1700         https://bugs.webkit.org/show_bug.cgi?id=172035
1701
1702         Reviewed by Michael Saboff.
1703
1704         Only call WTF::releaseFastMallocFreeMemory() and his threading-related friends
1705         when releaseMemory() is invoked with Synchronous::Yes, or if it's a critical
1706         pressure response (maintaining the behavior added in r215775.)
1707
1708         * page/MemoryRelease.cpp:
1709         (WebCore::releaseMemory):
1710
1711 2017-05-12  Daniel Bates  <dabates@apple.com>
1712
1713         Cleanup: Use Ref instead of RefPtr to hold DOMWrapperWorld
1714         https://bugs.webkit.org/show_bug.cgi?id=171988
1715
1716         Reviewed by Chris Dumez.
1717
1718         * bindings/js/JSCustomElementInterface.cpp:
1719         (WebCore::JSCustomElementInterface::JSCustomElementInterface):
1720         (WebCore::JSCustomElementInterface::upgradeElement):
1721         (WebCore::JSCustomElementInterface::invokeCallback):
1722         * bindings/js/JSCustomElementInterface.h:
1723         * bindings/js/JSMutationCallback.cpp:
1724         (WebCore::JSMutationCallback::JSMutationCallback):
1725         (WebCore::JSMutationCallback::call):
1726         * bindings/js/JSMutationCallback.h:
1727         * bindings/js/ScheduledAction.cpp:
1728         (WebCore::ScheduledAction::ScheduledAction):
1729         (WebCore::ScheduledAction::execute):
1730         * bindings/js/ScheduledAction.h:
1731         (WebCore::ScheduledAction::ScheduledAction):
1732         * page/DOMWindowExtension.cpp:
1733         (WebCore::DOMWindowExtension::DOMWindowExtension):
1734         * page/DOMWindowExtension.h:
1735         (WebCore::DOMWindowExtension::world):
1736
1737 2017-05-12  Daniel Bates  <dabates@apple.com>
1738
1739         Cleanup: Make QueueTaskToEventLoopFunctionPtr take JSGlobalObject&
1740         https://bugs.webkit.org/show_bug.cgi?id=172021
1741
1742         Reviewed by Mark Lam.
1743
1744         * bindings/js/JSDOMGlobalObjectTask.cpp: Include header JSDOMGlobalObject.h.
1745         (WebCore::JSGlobalObjectTask::JSGlobalObjectTask): Change type of first argument from JSDOMGlobalObject*
1746         to JSDOMGlobalObject& and update code as necessary. Also, use C++11 brace initialization syntax
1747         for member initializer list.
1748         * bindings/js/JSDOMGlobalObjectTask.h: Remove header JSDOMGlobalObject.h and forward declare
1749         JSDOMGlobalObject and JSC::Microtask.
1750         * bindings/js/JSDOMWindowBase.cpp:
1751         (WebCore::JSDOMWindowMicrotaskCallback::create):
1752         (WebCore::JSDOMWindowMicrotaskCallback::JSDOMWindowMicrotaskCallback): Change type of first argument
1753         from JSDOMWindowBase* to JSDOMWindowBase& and update code as necessary. Also, use C++11 brace
1754         initialization syntax for member initializer list.
1755         (WebCore::JSDOMWindowBase::queueTaskToEventLoop):
1756         * bindings/js/JSDOMWindowBase.h:
1757         * bindings/js/JSWorkerGlobalScopeBase.cpp:
1758         (WebCore::JSWorkerGlobalScopeBase::queueTaskToEventLoop):
1759         * bindings/js/JSWorkerGlobalScopeBase.h:
1760
1761 2017-05-12  Jer Noble  <jer.noble@apple.com>
1762
1763         [MediaStream] Streams while play while page is in background can get "stuck" when page is forgrounded.
1764         https://bugs.webkit.org/show_bug.cgi?id=172022
1765
1766         Reviewed by Youenn Fablet.
1767
1768         When an AVSampleBufferDisplayLayer is disconnected from the CA renderer, none of its samples will be decoded
1769         and enqueued for rendering. Once the layer is attached to a renderer again, it's stuffed full of samples which
1770         will never be decoded as their decode time has long passed.
1771
1772         Pass the visibility state of the element through to the MediaPlayer so that MediaPlayerPrivateMediaStreamAVFObjC
1773         can flush its renderers when going from not visible -> visible.
1774
1775         * html/HTMLMediaElement.cpp:
1776         (WebCore::HTMLMediaElement::visibilityStateChanged):
1777         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1778         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1779         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVisible):
1780         * rendering/RenderVideo.cpp:
1781         (WebCore::RenderVideo::updatePlayer):
1782
1783 2017-05-12  Per Arne Vollan  <pvollan@apple.com>
1784
1785         Unreviewed Windows build fix.
1786
1787         * bindings/js/JSWebGLRenderingContextCustom.cpp:
1788
1789 2017-05-12  Antti Koivisto  <antti@apple.com>
1790
1791         Updating class name of a shadow host does not update the style applied by descendants of :host()
1792         https://bugs.webkit.org/show_bug.cgi?id=170762
1793         <rdar://problem/31572668>
1794
1795         Reviewed by Ryosuke Niwa.
1796
1797         We need to invalidate shadow tree style when host classes or attributes change if it may be
1798         affected by host rules.
1799
1800         Test: fast/shadow-dom/css-scoping-host-class-and-attribute-mutation.html
1801
1802         * css/RuleSet.cpp:
1803         (WebCore::isHostSelectorMatchingInShadowTree):
1804         (WebCore::RuleSet::addRule):
1805
1806             Check if we have :host selectors that affect shadow tree.
1807
1808         * css/RuleSet.h:
1809         (WebCore::RuleSet::hasHostPseudoClassRulesMatchingInShadowTree):
1810         * style/AttributeChangeInvalidation.cpp:
1811         (WebCore::Style::mayBeAffectedByHostRules):
1812         (WebCore::Style::AttributeChangeInvalidation::invalidateStyle):
1813
1814             Invalidate the whole subtree if there is a class change that may affect shadow tree style.
1815
1816         * style/ClassChangeInvalidation.cpp:
1817         (WebCore::Style::mayBeAffectedByHostRules):
1818         (WebCore::Style::ClassChangeInvalidation::invalidateStyle):
1819         * style/IdChangeInvalidation.cpp:
1820         (WebCore::Style::mayBeAffectedByHostRules):
1821         (WebCore::Style::IdChangeInvalidation::invalidateStyle):
1822
1823             Same for classes and ids.
1824             This should be refactored at some point to reduce copy-code.
1825
1826 2017-05-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1827
1828         [GTK] ASSERTION FAILED: !m_flushingLayers
1829         https://bugs.webkit.org/show_bug.cgi?id=172025
1830
1831         Reviewed by Žan Doberšek.
1832
1833         The problem is that syncImageBacking() is calling didChangeLayerState(). All sync methods are called by
1834         flushCompositingStateForThisLayerOnly() while flushing layers, so none of them should call didChange method that
1835         will schedule a new flush while flushing.
1836
1837         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1838         (WebCore::CoordinatedGraphicsLayer::syncImageBacking):
1839
1840 2017-05-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1841
1842         [GTK] GIF images are not properly loaded the first time
1843         https://bugs.webkit.org/show_bug.cgi?id=170432
1844
1845         Reviewed by Carlos Alberto Lopez Perez.
1846
1847         When the GIF image is loaded for the first time, it's always read from the network, and the decoder is usually
1848         fetched with chunks of data. Then the data is cached in disk by the network process, so that when loaded from
1849         the cache, the whole encoded data is available to fetch the encoder. The problem is that we are failing to
1850         decode the image when giving chunks of data, that's why it only happens the first time loaded. If the first
1851         chunk of data provided is enough to get some metadata, including the size, but not frame contents, the load fails
1852         in CachedImage::addIncrementalDataBuffer() because the EncodedDataStatus reported is SizeAvailable but
1853         Image::isNull() returns true. An Image is considered to be Null when its size is empty, and the size is
1854         calculated always using the first frame in ImageFrameCache. Since we still don't have frames, the image is
1855         always Null in this case. It is not expected that EncodedDataStatus returns SizeAvailable and the image is Null,
1856         that's why it's considered an error and the load finishes with a decode error. However, the non CG ImageDecoder
1857         has a m_size member to handle this particular case, and it's when m_size is set when EncodedDataStatus changes
1858         to SizeAvailable. We should return the ImageEncoder size as the ImageSize when we have a decoder but
1859         not frames yet.
1860
1861         Test: http/tests/images/gif-progressive-load.html
1862
1863         * platform/graphics/ImageFrameCache.cpp:
1864         (WebCore::ImageFrameCache::size): Return ImageDecoder::size() without caching it, if frame list is empty.
1865
1866 2017-05-12  Per Arne Vollan  <pvollan@apple.com>
1867
1868         The iBooks application is not able to get current position.
1869         https://bugs.webkit.org/show_bug.cgi?id=171982
1870         rdar://problem/29318409
1871
1872         Reviewed by Brent Fulgham.
1873
1874         Geolocation requests from iBooks are currently blocked. Make an exemption from the policy for iBooks.
1875
1876         No new tests since we currently can't mock the iBooks application bundle ID.
1877
1878         * Modules/geolocation/Geolocation.cpp:
1879         (WebCore::isRequestFromIBooks):
1880         (WebCore::Geolocation::shouldBlockGeolocationRequests):
1881
1882 2017-05-11  Per Arne Vollan  <pvollan@apple.com>
1883
1884         Geolocation requests should not be blocked when the security origin is local.
1885         https://bugs.webkit.org/show_bug.cgi?id=171857
1886         rdar://problem/29318409
1887
1888         Reviewed by Brent Fulgham.
1889
1890         Geolocation requests from security origins where the url scheme is registered as local,
1891         should not be blocked. This applies to the file url scheme, but also to other local url
1892         schemes.
1893
1894         Test: fast/misc/geolocation-local-security-origin.html
1895
1896         * Modules/geolocation/Geolocation.cpp:
1897         (WebCore::Geolocation::shouldBlockGeolocationRequests):
1898
1899 2017-05-11  Chris Dumez  <cdumez@apple.com>
1900
1901         Drop remaining uses of PassRefPtr in WebCore
1902         https://bugs.webkit.org/show_bug.cgi?id=172013
1903
1904         Reviewed by Yusuke Suzuki.
1905
1906         * bindings/js/ScriptController.cpp:
1907         (WebCore::ScriptController::createRootObject):
1908         * bindings/js/ScriptController.h:
1909         * bindings/js/ScriptControllerMac.mm:
1910         * bridge/objc/WebScriptObject.mm:
1911         (WebCore::createJSWrapper):
1912         (-[WebScriptObject _setImp:originRootObject:rootObject:]):
1913         (-[WebScriptObject _setOriginRootObject:andRootObject:]):
1914         (-[WebScriptObject _initWithJSObject:originRootObject:rootObject:]):
1915         * bridge/objc/WebScriptObjectPrivate.h:
1916
1917 2017-05-11  Zalan Bujtas  <zalan@apple.com>
1918
1919         RenderImageResource::hasImage is redundant and RenderImageResourceStyleImage's override is incorrect.
1920         https://bugs.webkit.org/show_bug.cgi?id=172010
1921         <rdar://problem/31086735>
1922
1923         Reviewed by Simon Fraser.
1924
1925         RenderImageResourceStyleImage::hasImage() always returns true even when ::cachedImage()
1926         returns nullptr (e.g. image is pending).
1927         Remove it and use cachedImage() instead.
1928
1929         Test: fast/images/missing-content-image-crash.html
1930
1931         * html/HTMLImageElement.cpp:
1932         (WebCore::HTMLImageElement::didAttachRenderers):
1933         * rendering/RenderImage.cpp:
1934         (WebCore::RenderImage::updateIntrinsicSizeIfNeeded):
1935         (WebCore::RenderImage::isShowingMissingOrImageError):
1936         (WebCore::RenderImage::hasNonBitmapImage):
1937         (WebCore::RenderImage::paintReplaced):
1938         (WebCore::RenderImage::paintIntoRect):
1939         (WebCore::RenderImage::foregroundIsKnownToBeOpaqueInRect):
1940         * rendering/RenderImageResource.h:
1941         (WebCore::RenderImageResource::cachedImage):
1942         (WebCore::RenderImageResource::hasImage): Deleted.
1943         * rendering/RenderImageResourceStyleImage.h:
1944         * rendering/svg/RenderSVGImage.cpp:
1945         (WebCore::RenderSVGImage::paint):
1946         * svg/SVGImageElement.cpp:
1947         (WebCore::SVGImageElement::hasSingleSecurityOrigin):
1948         (WebCore::SVGImageElement::didAttachRenderers):
1949
1950 2017-05-11  Zalan Bujtas  <zalan@apple.com>
1951
1952         AX: Defer text changes until after the tree is clean if needed.
1953         https://bugs.webkit.org/show_bug.cgi?id=171546
1954         <rdar://problem/31934942>
1955
1956         Reviewed by Simon Fraser.
1957
1958         While updating an accessibility object state, we might
1959         trigger unintentional style updates. This style update could
1960         end up destroying renderes that are still referenced by functions
1961         on the callstack.
1962         To avoid that, defer such changes and let AXObjectCache operate on a clean tree.         
1963
1964         Test: accessibility/crash-when-render-tree-is-not-clean.html
1965
1966         * accessibility/AXObjectCache.cpp:
1967         (WebCore::AXObjectCache::remove):
1968         (WebCore::AXObjectCache::handleAttributeChanged):
1969         (WebCore::AXObjectCache::labelChanged):
1970         (WebCore::AXObjectCache::performDeferredCacheUpdate):
1971         (WebCore::AXObjectCache::deferRecomputeIsIgnored):
1972         (WebCore::AXObjectCache::deferTextChangedIfNeeded):
1973         (WebCore::AXObjectCache::recomputeDeferredIsIgnored): Deleted.
1974         (WebCore::AXObjectCache::deferTextChanged): Deleted.
1975         * accessibility/AXObjectCache.h: Decouple different type of changes.
1976         (WebCore::AXObjectCache::deferRecomputeIsIgnored):
1977         (WebCore::AXObjectCache::deferTextChangedIfNeeded):
1978         (WebCore::AXObjectCache::recomputeDeferredIsIgnored): Deleted.
1979         (WebCore::AXObjectCache::deferTextChanged): Deleted.
1980         * rendering/RenderBlock.cpp:
1981         (WebCore::RenderBlock::deleteLines):
1982         * rendering/RenderBlockLineLayout.cpp:
1983         (WebCore::RenderBlockFlow::createAndAppendRootInlineBox):
1984         * rendering/RenderText.cpp:
1985         (WebCore::RenderText::setText):
1986
1987 2017-05-11  Chris Dumez  <cdumez@apple.com>
1988
1989         Drop remaining uses of PassRefPtr under platform/
1990         https://bugs.webkit.org/show_bug.cgi?id=172007
1991
1992         Reviewed by Geoffrey Garen.
1993
1994         * platform/graphics/wpe/ImageWPE.cpp:
1995         (WebCore::Image::loadPlatformResource):
1996         * platform/ios/LegacyTileGrid.h:
1997         * platform/ios/LegacyTileGrid.mm:
1998         (WebCore::LegacyTileGrid::tileForIndex):
1999         (WebCore::LegacyTileGrid::tileForPoint):
2000         * platform/ios/LegacyTileGridTile.h:
2001         (WebCore::LegacyTileGridTile::create):
2002         * platform/mediastream/RTCIceCandidateDescriptor.cpp:
2003         (WebCore::RTCIceCandidateDescriptor::create):
2004         * platform/mediastream/RTCIceCandidateDescriptor.h:
2005         * platform/mediastream/RTCPeerConnectionHandlerClient.h:
2006         * platform/mediastream/RTCSessionDescriptionDescriptor.cpp:
2007         (WebCore::RTCSessionDescriptionDescriptor::create):
2008         * platform/mediastream/RTCSessionDescriptionDescriptor.h:
2009         * platform/mediastream/RTCSessionDescriptionRequest.h:
2010         (WebCore::RTCSessionDescriptionRequest::extraData):
2011         (WebCore::RTCSessionDescriptionRequest::setExtraData):
2012         * platform/mediastream/RealtimeMediaSourceCenter.h:
2013         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
2014         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
2015         (WebCore::RealtimeMediaSourceCenterOwr::firstSource):
2016         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
2017         * platform/mock/DeviceOrientationClientMock.cpp:
2018         (WebCore::DeviceOrientationClientMock::setOrientation):
2019         * platform/mock/DeviceOrientationClientMock.h:
2020         * platform/mock/GeolocationClientMock.cpp:
2021         (WebCore::GeolocationClientMock::setPosition):
2022         * platform/mock/GeolocationClientMock.h:
2023         * platform/mock/RTCNotifiersMock.cpp:
2024         (WebCore::SessionRequestNotifier::SessionRequestNotifier):
2025         (WebCore::SessionRequestNotifier::fire):
2026         (WebCore::VoidRequestNotifier::VoidRequestNotifier):
2027         * platform/mock/RTCNotifiersMock.h:
2028         * platform/mock/TimerEventBasedMock.h:
2029         (WebCore::TimerEventBasedMock::removeEvent):
2030         (WebCore::TimerEvent::TimerEvent):
2031         (WebCore::TimerEvent::timerFired):
2032         * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
2033         (WebCore::MockSourceBufferPrivateHasAudio):
2034         (WebCore::MockSourceBufferPrivateHasVideo):
2035         * platform/wpe/RenderThemeWPE.h:
2036
2037 2017-05-11  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2038
2039         [WPE] Stop using PassRefPtr in platform/graphics/wpe
2040         https://bugs.webkit.org/show_bug.cgi?id=171977
2041
2042         Unreviewed build fix after r216702.
2043
2044         * platform/graphics/wpe/ImageWPE.cpp:
2045         (WebCore::Image::loadPlatformResource):
2046
2047 2017-05-11  Youenn Fablet  <youenn@apple.com>
2048
2049         [iOS] Unset active media capture source when stopped capturing
2050         https://bugs.webkit.org/show_bug.cgi?id=171815
2051         <rdar://problem/32117885>
2052
2053         Reviewed by Eric Carlson.
2054
2055         Test: platform/ios/mediastream/getUserMedia-single-capture.html
2056
2057         Introducing SingleSourceFactory template class to be used by capture factories for iOS.
2058         This class ensures that only one source is active at a time.
2059         Update all capture sources accordingly.
2060         Ensure sources are no longer considered as active sources when being destroyed.
2061         Add support for mock sources and introducing m_isProducingData for them as well.
2062
2063         Update WebRTC outgoing source classes to handle the case of replaced track and resetting the enabled/mute
2064         state according the new source.
2065
2066         Update the way we handle timestamps for audio data. We now consider that we read/write as a flow.
2067         This allows smooth audio track replacing.
2068
2069         * platform/mediastream/RealtimeMediaSource.h:
2070         * platform/mediastream/mac/AVAudioCaptureSource.mm:
2071         (WebCore::AVAudioCaptureSource::~AVAudioCaptureSource):
2072         (WebCore::AVAudioCaptureSourceFactory::setActiveSource): Deleted.
2073         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2074         (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
2075         (WebCore::AVVideoCaptureSourceFactory::setActiveSource): Deleted.
2076         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2077         (WebCore::CoreAudioCaptureSource::~CoreAudioCaptureSource):
2078         (WebCore::CoreAudioCaptureSource::stopProducingData):
2079         (WebCore::CoreAudioCaptureSourceFactory::setActiveSource): Deleted.
2080         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
2081         (WebCore::RealtimeOutgoingAudioSource::setSource):
2082         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
2083         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
2084         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
2085         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
2086         (WebCore::RealtimeOutgoingVideoSource::setSource):
2087         (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
2088         (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
2089         * platform/mock/MockRealtimeAudioSource.cpp:
2090         (WebCore::mockAudioCaptureSourceFactory):
2091         (WebCore::MockRealtimeAudioSource::factory):
2092         (WebCore::MockRealtimeAudioSource::~MockRealtimeAudioSource):
2093         (WebCore::MockRealtimeAudioSource::startProducingData):
2094         (WebCore::MockRealtimeAudioSource::stopProducingData):
2095         * platform/mock/MockRealtimeAudioSource.h:
2096         * platform/mock/MockRealtimeVideoSource.cpp:
2097         (WebCore::mockVideoCaptureSourceFactory):
2098         (WebCore::MockRealtimeVideoSource::factory):
2099         (WebCore::MockRealtimeVideoSource::~MockRealtimeVideoSource):
2100         (WebCore::MockRealtimeVideoSource::startProducingData):
2101         (WebCore::MockRealtimeVideoSource::stopProducingData):
2102         * platform/mock/MockRealtimeVideoSource.h:
2103         (WebCore::MockRealtimeVideoSource::~MockRealtimeVideoSource): Deleted.
2104
2105 2017-05-11  Timothy Horton  <timothy_horton@apple.com>
2106
2107         Fix the iOS build
2108
2109         * platform/spi/mac/NSSpellCheckerSPI.h:
2110
2111 2017-05-11  Matt Lewis  <jlewis3@apple.com>
2112
2113         Unreviewed, rolling out r216677.
2114
2115         Patch caused layout test crashes.
2116
2117         Reverted changeset:
2118
2119         "WorkerThread::stop() should call
2120         scheduleExecutionTermination() last."
2121         https://bugs.webkit.org/show_bug.cgi?id=171775
2122         http://trac.webkit.org/changeset/216677
2123
2124 2017-05-11  Don Olmstead  <don.olmstead@am.sony.com>
2125
2126         [CMake] Add HAVE check for regex.h
2127         https://bugs.webkit.org/show_bug.cgi?id=171950
2128
2129         Reviewed by Michael Catanzaro.
2130
2131         No new tests. No change in behavior.
2132
2133         * WebCorePrefix.h:
2134         * testing/js/WebCoreTestSupportPrefix.h:
2135
2136 2017-05-11  Tim Horton  <timothy_horton@apple.com>
2137
2138         Mail spins launching spell checker when typing
2139         https://bugs.webkit.org/show_bug.cgi?id=171986
2140         <rdar://problem/26305327>
2141
2142         Reviewed by Beth Dakin.
2143
2144         * platform/spi/mac/NSSpellCheckerSPI.h:
2145
2146 2017-05-11  Chris Dumez  <cdumez@apple.com>
2147
2148         Stop using PassRefPtr in platform/graphics
2149         https://bugs.webkit.org/show_bug.cgi?id=171977
2150
2151         Reviewed by Alex Christensen.
2152
2153         Stop using PassRefPtr in platform/graphics.
2154
2155         * css/CSSCrossfadeValue.cpp:
2156         (WebCore::CSSCrossfadeValue::image):
2157         * css/CSSFilterImageValue.cpp:
2158         (WebCore::CSSFilterImageValue::image):
2159         * loader/cache/CachedImage.cpp:
2160         (WebCore::CachedImage::brokenImage):
2161         (WebCore::CachedImage::image):
2162         (WebCore::CachedImage::imageForRenderer):
2163         * page/PageSerializer.cpp:
2164         (WebCore::PageSerializer::addImageToResources):
2165         * platform/ScrollView.cpp:
2166         (WebCore::ScrollView::paintPanScrollIcon):
2167         * platform/graphics/CrossfadeGeneratedImage.cpp:
2168         (WebCore::CrossfadeGeneratedImage::drawCrossfade):
2169         * platform/graphics/FontPlatformData.h:
2170         * platform/graphics/GraphicsContext.h:
2171         * platform/graphics/Image.cpp:
2172         (WebCore::Image::nullImage):
2173         * platform/graphics/Image.h:
2174         * platform/graphics/MediaPlayer.cpp:
2175         (WebCore::MediaPlayer::createResourceLoader):
2176         * platform/graphics/MediaPlayer.h:
2177         * platform/graphics/Pattern.cpp:
2178         (WebCore::Pattern::create):
2179         (WebCore::Pattern::Pattern):
2180         * platform/graphics/Pattern.h:
2181         * platform/graphics/PlatformTextTrack.h:
2182         (WebCore::PlatformTextTrack::create):
2183         (WebCore::PlatformTextTrack::createOutOfBand):
2184         (WebCore::PlatformTextTrack::captionMenuOffItem):
2185         (WebCore::PlatformTextTrack::captionMenuAutomaticItem):
2186         * platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.cpp:
2187         (WebCore::InbandMetadataTextTrackPrivateAVF::create):
2188         (WebCore::InbandMetadataTextTrackPrivateAVF::addDataCue):
2189         * platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.h:
2190         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
2191         (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings):
2192         * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h:
2193         * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm:
2194         (WebCore::MediaSelectionOptionAVFObjC::create):
2195         (WebCore::MediaSelectionGroupAVFObjC::create):
2196         (WebCore::MediaSelectionGroupAVFObjC::updateOptions):
2197         * platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.h:
2198         (WebCore::InbandTextTrackPrivateAVCF::create):
2199         * platform/graphics/avfoundation/cf/InbandTextTrackPrivateLegacyAVCF.h:
2200         (WebCore::InbandTextTrackPrivateLegacyAVCF::create):
2201         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
2202         (WebCore::WebCoreAVCFResourceLoader::create):
2203         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.h:
2204         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h:
2205         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
2206         (WebCore::CDMSessionAVContentKeySession::generateKeyReleaseMessage):
2207         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
2208         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
2209         (WebCore::CDMSessionAVStreamSession::generateKeyReleaseMessage):
2210         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.h:
2211         (WebCore::InbandTextTrackPrivateAVFObjC::create):
2212         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.h:
2213         (WebCore::InbandTextTrackPrivateLegacyAVFObjC::create):
2214         * platform/graphics/avfoundation/objc/OutOfBandTextTrackPrivateAVF.h:
2215         (WebCore::OutOfBandTextTrackPrivateAVF::create):
2216         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
2217         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2218         (WebCore::WebCoreAVFResourceLoader::create):
2219         * platform/graphics/ca/GraphicsLayerCA.cpp:
2220         (WebCore::GraphicsLayerCA::createPlatformCALayer):
2221         (WebCore::GraphicsLayerCA::createPlatformCAAnimation):
2222         (WebCore::GraphicsLayerCA::setContentsToPlatformLayer):
2223         (WebCore::GraphicsLayerCA::replicatedLayerRoot):
2224         (WebCore::GraphicsLayerCA::createAnimationFromKeyframes):
2225         (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
2226         (WebCore::GraphicsLayerCA::createBasicAnimation):
2227         (WebCore::GraphicsLayerCA::createKeyframeAnimation):
2228         (WebCore::GraphicsLayerCA::createSpringAnimation):
2229         * platform/graphics/ca/GraphicsLayerCA.h:
2230         (WebCore::GraphicsLayerCA::LayerPropertyAnimation::LayerPropertyAnimation):
2231         * platform/graphics/ca/PlatformCAAnimation.h:
2232         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.h:
2233         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
2234         (PlatformCAAnimationCocoa::create):
2235         (PlatformCAAnimationCocoa::copy):
2236         * platform/graphics/ca/win/AbstractCACFLayerTreeHost.h:
2237         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
2238         (WebCore::CACFLayerTreeHost::create):
2239         (WebCore::CACFLayerTreeHost::addPendingAnimatedLayer):
2240         * platform/graphics/ca/win/CACFLayerTreeHost.h:
2241         * platform/graphics/ca/win/PlatformCAAnimationWin.cpp:
2242         (PlatformCAAnimationWin::create):
2243         (PlatformCAAnimationWin::copy):
2244         * platform/graphics/ca/win/PlatformCAAnimationWin.h:
2245         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
2246         (PlatformCALayerWin::addAnimationForKey):
2247         * platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp:
2248         (WebCore::WKCACFViewLayerTreeHost::create):
2249         * platform/graphics/ca/win/WKCACFViewLayerTreeHost.h:
2250         * platform/graphics/cairo/PatternCairo.cpp:
2251         (WebCore::Pattern::createPlatformPattern):
2252         * platform/graphics/cairo/PlatformContextCairo.cpp:
2253         (WebCore::PlatformContextCairo::clipForPatternFilling):
2254         * platform/graphics/cg/PDFDocumentImage.h:
2255         * platform/graphics/cg/PatternCG.cpp:
2256         (WebCore::Pattern::createPlatformPattern):
2257         * platform/graphics/filters/FEDiffuseLighting.cpp:
2258         (WebCore::FEDiffuseLighting::FEDiffuseLighting):
2259         (WebCore::FEDiffuseLighting::create):
2260         (WebCore::FEDiffuseLighting::lightSource):
2261         * platform/graphics/filters/FEDiffuseLighting.h:
2262         * platform/graphics/filters/FELighting.cpp:
2263         (WebCore::FELighting::FELighting):
2264         (WebCore::FELighting::drawLighting):
2265         * platform/graphics/filters/FELighting.h:
2266         * platform/graphics/filters/FESpecularLighting.cpp:
2267         (WebCore::FESpecularLighting::FESpecularLighting):
2268         (WebCore::FESpecularLighting::create):
2269         (WebCore::FESpecularLighting::lightSource):
2270         * platform/graphics/filters/FESpecularLighting.h:
2271         * platform/graphics/filters/FETile.cpp:
2272         (WebCore::FETile::platformApplySoftware):
2273         * platform/graphics/filters/FilterEffect.cpp:
2274         (WebCore::FilterEffect::asUnmultipliedImage):
2275         (WebCore::FilterEffect::asPremultipliedImage):
2276         * platform/graphics/filters/FilterEffect.h:
2277         * platform/graphics/filters/FilterOperation.cpp:
2278         (WebCore::ReferenceFilterOperation::setFilterEffect):
2279         (WebCore::BasicColorMatrixFilterOperation::blend):
2280         (WebCore::BasicComponentTransferFilterOperation::blend):
2281         (WebCore::BlurFilterOperation::blend):
2282         (WebCore::DropShadowFilterOperation::blend):
2283         * platform/graphics/filters/FilterOperation.h:
2284         (WebCore::FilterOperation::blend):
2285         (WebCore::PassthroughFilterOperation::create):
2286         (WebCore::ReferenceFilterOperation::create):
2287         * platform/graphics/gpu/Texture.cpp:
2288         (WebCore::Texture::create):
2289         * platform/graphics/gpu/Texture.h:
2290         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
2291         * platform/graphics/gstreamer/ImageGStreamer.h:
2292         (WebCore::ImageGStreamer::createImage):
2293         (WebCore::ImageGStreamer::image):
2294         * platform/graphics/gstreamer/InbandMetadataTextTrackPrivateGStreamer.h:
2295         (WebCore::InbandMetadataTextTrackPrivateGStreamer::create):
2296         (WebCore::InbandMetadataTextTrackPrivateGStreamer::addGenericCue):
2297         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
2298         (WebCore::InbandTextTrackPrivateGStreamer::create):
2299         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2300         (WebCore::MediaPlayerPrivateGStreamer::processTableOfContentsEntry):
2301         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2302         (WebCore::MediaPlayerPrivateGStreamerBase::paint):
2303         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
2304         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
2305         (WebCore::MediaSourceClientGStreamerMSE::enqueueSample):
2306         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
2307         * platform/graphics/gstreamer/mse/MediaSourceGStreamer.cpp:
2308         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
2309         (WebCore::PlaybackPipeline::enqueueSample):
2310         * platform/graphics/gstreamer/mse/PlaybackPipeline.h:
2311         * platform/graphics/gtk/ImageGtk.cpp:
2312         (WebCore::loadImageFromGResource):
2313         (WebCore::loadResourceSharedBuffer):
2314         (WebCore::loadMissingImageIconFromTheme):
2315         (WebCore::Image::loadPlatformResource):
2316         * platform/graphics/harfbuzz/HarfBuzzFace.cpp:
2317         (WebCore::FaceCacheEntry::create):
2318         * platform/graphics/harfbuzz/HarfBuzzFace.h:
2319         (WebCore::HarfBuzzFace::create):
2320         * platform/graphics/mac/ImageMac.mm:
2321         (WebCore::Image::loadPlatformResource):
2322         * platform/graphics/opentype/OpenTypeMathData.h:
2323         (WebCore::OpenTypeMathData::create):
2324         * platform/graphics/texmap/BitmapTexture.h:
2325         (WebCore::BitmapTexture::applyFilters):
2326         * platform/graphics/texmap/BitmapTextureGL.cpp:
2327         (WebCore::BitmapTextureGL::applyFilters):
2328         * platform/graphics/texmap/BitmapTextureGL.h:
2329         (WebCore::BitmapTextureGL::FilterInfo::FilterInfo):
2330         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
2331         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
2332         * platform/graphics/texmap/TextureMapper.cpp:
2333         (WebCore::TextureMapper::acquireTextureFromPool):
2334         * platform/graphics/texmap/TextureMapper.h:
2335         * platform/graphics/texmap/TextureMapperGL.cpp:
2336         (WebCore::TextureMapperGL::createTexture):
2337         * platform/graphics/texmap/TextureMapperGL.h:
2338         * platform/graphics/texmap/TextureMapperLayer.cpp:
2339         (WebCore::TextureMapperLayer::paintIntoSurface):
2340         (WebCore::commitSurface):
2341         (WebCore::TextureMapperLayer::paintWithIntermediateSurface):
2342         (WebCore::TextureMapperLayer::setBackingStore):
2343         * platform/graphics/texmap/TextureMapperLayer.h:
2344         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
2345         (WebCore::TextureMapperTiledBackingStore::create):
2346         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2347         (WebCore::CoordinatedGraphicsLayer::syncImageBacking):
2348         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2349         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
2350         (WebCore::CoordinatedImageBacking::create):
2351         (WebCore::CoordinatedImageBacking::CoordinatedImageBacking):
2352         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
2353         * platform/graphics/win/ImageWin.cpp:
2354         (WebCore::Image::loadPlatformResource):
2355         * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp:
2356         (WebCore::MediaPlayerPrivateFullscreenWindow::setRootChildLayer):
2357         * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h:
2358         * platform/graphics/win/PatternDirect2D.cpp:
2359         (WebCore::Pattern::createPlatformPattern):
2360         * platform/graphics/win/SharedGDIObject.h:
2361         (WebCore::SharedGDIObject::create):
2362         * rendering/FilterEffectRenderer.cpp:
2363         (WebCore::FilterEffectRenderer::build):
2364         * rendering/RenderImageResource.cpp:
2365         (WebCore::RenderImageResource::image):
2366         * rendering/RenderLayer.cpp:
2367         (WebCore::RenderLayer::drawPlatformResizerImage):
2368         * rendering/svg/RenderSVGResourcePattern.cpp:
2369         (WebCore::RenderSVGResourcePattern::buildPattern):
2370         * svg/SVGFEDiffuseLightingElement.cpp:
2371         (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute):
2372         (WebCore::SVGFEDiffuseLightingElement::build):
2373         * svg/SVGFESpecularLightingElement.cpp:
2374         (WebCore::SVGFESpecularLightingElement::setFilterEffectAttribute):
2375         (WebCore::SVGFESpecularLightingElement::build):
2376         * svg/graphics/SVGImageCache.cpp:
2377         (WebCore::SVGImageCache::imageForRenderer):
2378
2379 2017-05-11  Joseph Pecoraro  <pecoraro@apple.com>
2380
2381         Remove Vibration API
2382         https://bugs.webkit.org/show_bug.cgi?id=171766
2383
2384         Rubber-stamped by Alexey Proskuryakov.
2385
2386         * features.json:
2387         Mark the Vibration API as removed.
2388
2389         * CMakeLists.txt:
2390         * DerivedSources.cpp:
2391         * Modules/vibration/NavigatorVibration.cpp: Removed.
2392         * Modules/vibration/NavigatorVibration.h: Removed.
2393         * Modules/vibration/NavigatorVibration.idl: Removed.
2394         * Modules/vibration/Vibration.cpp: Removed.
2395         * Modules/vibration/Vibration.h: Removed.
2396         * Modules/vibration/VibrationClient.h: Removed.
2397         * testing/Internals.cpp:
2398         (WebCore::Internals::isVibrating): Deleted.
2399         * testing/Internals.h:
2400         * testing/Internals.idl:
2401
2402 2017-05-11  Dean Jackson  <dino@apple.com>
2403
2404         WebGLRenderingContext should implement WebGLRenderingContextBase
2405         https://bugs.webkit.org/show_bug.cgi?id=171961
2406         <rdar://problem/32124920>
2407
2408         Reviewed by Sam Weinig.
2409
2410         WebGLRenderingContext and WebGL2RenderingContext are both
2411         defined to "implement" WebGLRenderingContextBase. However, we
2412         were doing it via inheritance, which meant that some things
2413         were not visible on the WebGLRenderingContext prototype.
2414
2415         Test: fast/canvas/webgl/constants-on-interface.html
2416
2417         * WebCore.xcodeproj/project.pbxproj: Move the Custom.cpp files
2418         out of the GC-only area now they have real content.
2419
2420         * bindings/js/JSDocumentCustom.cpp: Handle the fact that we
2421         don't use the base class from the bindings, so we need to
2422         translate WebGL1 and WebGL2 contexts into the right JS classes.
2423         (WebCore::JSDocument::getCSSCanvasContext):
2424         * bindings/js/JSHTMLCanvasElementCustom.cpp:
2425         (WebCore::JSHTMLCanvasElement::getContext):
2426
2427         * bindings/js/JSWebGL2RenderingContextCustom.cpp: Implement the
2428         custom methods. In this case, we don't yet expose any
2429         extensions for WebGL 2.
2430         (WebCore::toJS):
2431         (WebCore::JSWebGL2RenderingContext::getExtension):
2432
2433         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp: Removed.
2434
2435         * bindings/js/JSWebGLRenderingContextCustom.cpp:
2436         (WebCore::toJS):
2437         (WebCore::JSWebGLRenderingContext::getExtension):
2438
2439         * html/canvas/WebGL2RenderingContext.h: Make some things public.
2440         * html/canvas/WebGLRenderingContext.h: Ditto.
2441
2442         * html/canvas/WebGL2RenderingContext.idl: Use implements.
2443         * html/canvas/WebGLRenderingContext.idl: Ditto.
2444
2445         * testing/Internals.cpp: This now takes a WebGLRenderingContext.
2446         (WebCore::Internals::simulateWebGLContextChanged):
2447         * testing/Internals.h:
2448         * testing/Internals.idl:
2449
2450 2017-05-11  Andy Estes  <aestes@apple.com>
2451
2452         Fix a spelling mistake in ApplePayErrorCode
2453         https://bugs.webkit.org/show_bug.cgi?id=171981
2454         <rdar://problem/32136567>
2455
2456         Reviewed by Beth Dakin.
2457
2458         * Modules/applepay/ApplePayError.idl:
2459         * Modules/applepay/PaymentRequest.h:
2460
2461 2017-05-11  John Wilander  <wilander@apple.com>
2462
2463         Resource Load Statistics: Enable configuration through preferences
2464         https://bugs.webkit.org/show_bug.cgi?id=171949
2465         <rdar://problem/31894518>
2466
2467         Reviewed by Alex Christensen.
2468
2469         No new tests. Just an added setter.
2470
2471         * loader/ResourceLoadObserver.cpp:
2472         (WebCore::ResourceLoadObserver::setReducedTimestampResolution):
2473
2474 2017-05-11  Frederic Wang  <fwang@igalia.com>
2475
2476         Unify hasTouchScrollableOverflow/needsCompositedScrolling concepts
2477         https://bugs.webkit.org/show_bug.cgi?id=171974
2478
2479         Reviewed by Simon Fraser.
2480
2481         This commit moves the following pattern in a single RenderLayer::usesAcceleratedScrolling function:
2482         #if PLATFORM(IOS)
2483         ...hasTouchScrollableOverflow()...
2484         #else
2485         ...needsCompositedScrolling()...
2486         #endif
2487
2488         No new tests, behavior unchanged.
2489
2490         * rendering/RenderLayer.cpp:
2491         (WebCore::RenderLayer::usesAcceleratedScrolling): Introduce helper function.
2492         * rendering/RenderLayer.h: Declare the function.
2493         * rendering/RenderLayerBacking.cpp:
2494         (WebCore::layerOrAncestorIsTransformedOrUsingCompositedScrolling): Use the new function.
2495         (WebCore::RenderLayerBacking::updateConfiguration): Ditto.
2496         * rendering/RenderLayerCompositor.cpp:
2497         (WebCore::useCoordinatedScrollingForLayer): Ditto.
2498
2499 2017-05-11  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2500
2501         [Readable Streams API] Implement ReadableStreamBYOBReader cancel()
2502         https://bugs.webkit.org/show_bug.cgi?id=171919
2503
2504         Reviewed by Youenn Fablet.
2505
2506         Implemented ReadableStreamBYOBReader cancel() method.
2507
2508         Added tests checking cancel().
2509
2510         * Modules/streams/ReadableStreamBYOBReader.js:
2511         (cancel): Implemented.
2512         * Modules/streams/ReadableStreamInternals.js:
2513         (readableStreamError): Updated to support ReadableStreamBYOBReader case.
2514
2515 2017-05-11  Chris Dumez  <cdumez@apple.com>
2516
2517         Stop using PassRefPtr in WebGPU code
2518         https://bugs.webkit.org/show_bug.cgi?id=171965
2519
2520         Reviewed by Alex Christensen.
2521
2522         Stop using PassRefPtr in WebGPU code.
2523
2524         * html/canvas/WebGPUDrawable.cpp:
2525         (WebCore::WebGPUDrawable::WebGPUDrawable):
2526         * html/canvas/WebGPURenderingContext.cpp:
2527         (WebCore::WebGPURenderingContext::create):
2528         (WebCore::WebGPURenderingContext::WebGPURenderingContext):
2529         * html/canvas/WebGPURenderingContext.h:
2530         * html/canvas/WebGPUTexture.cpp:
2531         (WebCore::WebGPUTexture::createFromDrawableTexture):
2532         (WebCore::WebGPUTexture::WebGPUTexture):
2533         * html/canvas/WebGPUTexture.h:
2534
2535 2017-05-11  Youenn Fablet  <youenn@apple.com>
2536
2537         Name WebRTC Threads
2538         https://bugs.webkit.org/show_bug.cgi?id=171975
2539
2540         Reviewed by Eric Carlson.
2541
2542         No change of behavior.
2543
2544         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
2545         (WebCore::LibWebRTCAudioModule::LibWebRTCAudioModule): Setting audio module thread name.
2546         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
2547         (WebCore::initializePeerConnectionFactoryAndThreads): Setting signaling and networking thread names.
2548
2549 2017-05-11  Chris Dumez  <cdumez@apple.com>
2550
2551         Stop using PassRefPtr in platform/audio
2552         https://bugs.webkit.org/show_bug.cgi?id=171966
2553
2554         Reviewed by Ryosuke Niwa.
2555
2556         Stop using PassRefPtr in platform/audio.
2557
2558         * platform/audio/AudioBus.h:
2559         (WebCore::AudioBus::AudioBus):
2560         * platform/audio/AudioFileReader.h:
2561         * platform/audio/HRTFDatabaseLoader.cpp:
2562         (WebCore::HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary):
2563         * platform/audio/HRTFDatabaseLoader.h:
2564         * platform/audio/HRTFKernel.cpp:
2565         (WebCore::HRTFKernel::createInterpolatedKernel):
2566         * platform/audio/HRTFKernel.h:
2567         (WebCore::HRTFKernel::create):
2568         * platform/audio/glib/AudioBusGLib.cpp:
2569         (WebCore::AudioBus::loadPlatformResource):
2570         * platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
2571         (WebCore::AudioFileReader::createBus):
2572         (WebCore::createBusFromAudioFile):
2573         (WebCore::createBusFromInMemoryAudioFile):
2574         * platform/audio/ios/AudioFileReaderIOS.cpp:
2575         (WebCore::AudioFileReader::createBus):
2576         (WebCore::createBusFromAudioFile):
2577         (WebCore::createBusFromInMemoryAudioFile):
2578         * platform/audio/ios/AudioFileReaderIOS.h:
2579         * platform/audio/mac/AudioBusMac.mm:
2580         (WebCore::AudioBus::loadPlatformResource):
2581         * platform/audio/mac/AudioFileReaderMac.cpp:
2582         (WebCore::AudioFileReader::createBus):
2583         (WebCore::createBusFromAudioFile):
2584         (WebCore::createBusFromInMemoryAudioFile):
2585         * platform/audio/mac/AudioFileReaderMac.h:
2586
2587 2017-05-11  Mark Lam  <mark.lam@apple.com>
2588
2589         WorkerThread::stop() should call scheduleExecutionTermination() last.
2590         https://bugs.webkit.org/show_bug.cgi?id=171775
2591         <rdar://problem/30975761>
2592
2593         Reviewed by Geoffrey Garen.
2594
2595         Currently, WorkerThread::stop() calls scheduleExecutionTermination() to terminate
2596         JS execution first, followed by posting a cleanup task to the worker, and lastly,
2597         it invokes terminate() on the WorkerRunLoop.
2598
2599         As a result, before run loop is terminate, the worker thread may observe the
2600         TerminatedExecutionException in JS code, bail out, see another JS task to run,
2601         re-enters the VM to run said JS code, and fails with an assertion due to the
2602         TerminatedExecutionException still being pending on VM entry.
2603
2604         WorkerRunLoop::Task::performTask() already has a check to only allow a task to
2605         run if and only if !runLoop.terminated() and the task is not a clean up task.
2606         We'll fix the above race by ensuring that having WorkerThread::stop() terminate
2607         the run loop before it scheduleExecutionTermination() which throws the
2608         TerminatedExecutionException.  This way, by the time JS code unwinds out of the
2609         VM due to the TerminatedExecutionException, runLoop.terminated() is guaranteed
2610         to be true and thereby prevents re-entry into the VM.
2611
2612         This issue is covered by an existing test that I just unskipped in TestExpectations.
2613
2614         * bindings/js/JSDOMPromiseDeferred.cpp:
2615         (WebCore::DeferredPromise::callFunction):
2616         * workers/WorkerThread.cpp:
2617         (WebCore::WorkerThread::stop):
2618
2619 2017-05-11  Chris Dumez  <cdumez@apple.com>
2620
2621         Drop custom bindings code for HTMLFormControlsCollection's named property getter
2622         https://bugs.webkit.org/show_bug.cgi?id=171964
2623
2624         Reviewed by Sam Weinig.
2625
2626         Drop custom bindings code for HTMLFormControlsCollection's named property getter as
2627         we are able to generate it.
2628
2629         No new tests, no expected Web-facing behavior change.
2630
2631         * CMakeLists.txt:
2632         * WebCore.xcodeproj/project.pbxproj:
2633         * bindings/js/JSBindingsAllInOne.cpp:
2634         * bindings/js/JSHTMLFormControlsCollectionCustom.cpp: Removed.
2635         * bindings/scripts/CodeGeneratorJS.pm:
2636         (GenerateNamedGetter):
2637         * html/HTMLFormControlsCollection.cpp:
2638         (WebCore::HTMLFormControlsCollection::namedItemOrItems):
2639         * html/HTMLFormControlsCollection.h:
2640         * html/HTMLFormControlsCollection.idl:
2641
2642 2017-05-10  Eric Carlson  <eric.carlson@apple.com>
2643
2644         [MediaStream] CoreAudioCaptureSource claims to never be muted
2645         https://bugs.webkit.org/show_bug.cgi?id=171946
2646         <rdar://problem/32111991>
2647
2648         Reviewed by Jer Noble.
2649
2650         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2651         (WebCore::CoreAudioCaptureSource::stopProducingData): Set m_muted to true.
2652
2653 2017-05-10  Jer Noble  <jer.noble@apple.com>
2654
2655         RELEASE_ASSERT at WebAudioSourceProviderAVFObjC::provideInput()
2656         https://bugs.webkit.org/show_bug.cgi?id=171711
2657
2658         Reviewed by Youenn Fablet.
2659
2660         Before iterating over the channels in either the WebAudioBufferList or the AudioBus, ensure
2661         we don't walk over the end of either by only iterating over the minimum length of either.
2662         Also, when the internal format of WebAudioSourceProviderAVFObjC changes, notify the
2663         MediaStreamAudioSourceNode that the number of channels and sample rate have changed.
2664
2665         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
2666         (WebCore::WebAudioSourceProviderAVFObjC::provideInput):
2667         (WebCore::WebAudioSourceProviderAVFObjC::prepare):
2668
2669 2017-05-10  Andy Estes  <aestes@apple.com>
2670
2671         REGRESSION (r167845): ASSERT(!m_renderView.needsLayout()) in svg/custom/bug79798.html
2672         https://bugs.webkit.org/show_bug.cgi?id=132297
2673
2674         Reviewed by Simon Fraser.
2675
2676         We don't know why m_renderView needs layout in this case, but we know that we don't need to
2677         assert if the client hasn't set the ScrollableInnerFrameTrigger compositing trigger.
2678
2679         * rendering/RenderLayerCompositor.cpp:
2680         (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame):
2681
2682 2017-05-10  Ryan Haddad  <ryanhaddad@apple.com>
2683
2684         Unreviewed, rolling out r216630.
2685
2686         This change caused assertion failures with webrtc LayoutTests.
2687
2688         Reverted changeset:
2689
2690         "RELEASE_ASSERT at
2691         WebAudioSourceProviderAVFObjC::provideInput()"
2692         https://bugs.webkit.org/show_bug.cgi?id=171711
2693         http://trac.webkit.org/changeset/216630
2694
2695 2017-05-09  Sam Weinig  <sam@webkit.org>
2696
2697         Remove support for legacy Notifications
2698         https://bugs.webkit.org/show_bug.cgi?id=171487
2699
2700         Reviewed by Jon Lee.
2701
2702         * CMakeLists.txt:
2703         * WebCore.xcodeproj/project.pbxproj:
2704         Remove files.
2705
2706         * Configurations/FeatureDefines.xcconfig:
2707         Remove definition of ENABLE_LEGACY_NOTIFICATIONS.
2708
2709         * DerivedSources.make:
2710         Remove IDL files.
2711
2712         * Modules/notifications/DOMWindowNotifications.cpp: Removed.
2713         * Modules/notifications/DOMWindowNotifications.h: Removed.
2714         * Modules/notifications/DOMWindowNotifications.idl: Removed.
2715         * Modules/notifications/NotificationCenter.cpp: Removed.
2716         * Modules/notifications/NotificationCenter.h: Removed.
2717         * Modules/notifications/NotificationCenter.idl: Removed.
2718         * Modules/notifications/NotificationClient.h:
2719         * Modules/notifications/NotificationController.cpp:
2720         * Modules/notifications/NotificationController.h:
2721         * Modules/notifications/WorkerGlobalScopeNotifications.cpp: Removed.
2722         * Modules/notifications/WorkerGlobalScopeNotifications.h: Removed.
2723         * Modules/notifications/WorkerGlobalScopeNotifications.idl: Removed.
2724         * Modules/notifications/Notification.idl:
2725         * Modules/notifications/Notification.cpp:
2726         * Modules/notifications/Notification.h:
2727         * dom/EventTargetFactory.in:
2728         * page/DOMWindow.cpp:
2729         * workers/WorkerThread.h:
2730         Remove code legacy Notification code. Replace use of NotificationCenter with direct
2731         calls to the NotificationClient.
2732
2733 2017-05-10  Commit Queue  <commit-queue@webkit.org>
2734
2735         Unreviewed, rolling out r216635.
2736         https://bugs.webkit.org/show_bug.cgi?id=171953
2737
2738         "Some worker tests are failing". (Requested by mlam on #webkit).
2739
2740         Reverted changeset:
2741
2742         "WorkerThread::stop() should call
2743         scheduleExecutionTermination() last."
2744         https://bugs.webkit.org/show_bug.cgi?id=171775
2745         http://trac.webkit.org/changeset/216635
2746
2747 2017-05-10  Mark Lam  <mark.lam@apple.com>
2748
2749         WorkerThread::stop() should call scheduleExecutionTermination() last.
2750         https://bugs.webkit.org/show_bug.cgi?id=171775
2751         <rdar://problem/30975761>
2752
2753         Reviewed by Geoffrey Garen.
2754
2755         Currently, WorkerThread::stop() calls scheduleExecutionTermination() to terminate
2756         JS execution first, followed by posting a cleanup task to the worker, and lastly,
2757         it invokes terminate() on the WorkerRunLoop.
2758
2759         As a result, before run loop is terminate, the worker thread may observe the
2760         TerminatedExecutionException in JS code, bail out, see another JS task to run,
2761         re-enters the VM to run said JS code, and fails with an assertion due to the
2762         TerminatedExecutionException still being pending on VM entry.
2763
2764         WorkerRunLoop::Task::performTask() already has a check to only allow a task to
2765         run if and only if !runLoop.terminated() and the task is not a clean up task.
2766         We'll fix the above race by ensuring that having WorkerThread::stop() terminate
2767         the run loop before it scheduleExecutionTermination() which throws the
2768         TerminatedExecutionException.  This way, by the time JS code unwinds out of the
2769         VM due to the TerminatedExecutionException, runLoop.terminated() is guaranteed
2770         to be true and thereby prevents re-entry into the VM.
2771
2772         This issue is covered by an existing test that I just unskipped in TestExpectations.
2773
2774         * bindings/js/JSDOMPromiseDeferred.cpp:
2775         (WebCore::DeferredPromise::callFunction):
2776         * workers/WorkerThread.cpp:
2777         (WebCore::WorkerThread::stop):
2778
2779 2017-05-10  Tim Horton  <timothy_horton@apple.com>
2780
2781         Add an experimental feature flag for viewport-fit
2782         https://bugs.webkit.org/show_bug.cgi?id=171948
2783         <rdar://problem/31995518>
2784
2785         Reviewed by Simon Fraser.
2786
2787         * dom/ViewportArguments.cpp:
2788         (WebCore::setViewportFeature):
2789         * page/Settings.in:
2790         Disable parsing of viewport-fit if the experimental feature is disabled.
2791
2792 2017-05-10  Chris Dumez  <cdumez@apple.com>
2793
2794         Simplify relationship between Attr and Element now that Attr is childless
2795         https://bugs.webkit.org/show_bug.cgi?id=171909
2796
2797         Reviewed by Ryosuke Niwa.
2798
2799         Simplify relationship between Attr and Element now that Attr is childless
2800         after r216259.
2801
2802         No new tests, no Web facing behavior change.
2803
2804         * dom/Attr.cpp:
2805         (WebCore::Attr::setValue):
2806         Attr::setValue() was only called by Element::setAttributeInternal() to make sure
2807         we updated the Attr node's Text child. However, now that Attr has no Text child,
2808         Element no longer needs to update the Attr node's value.
2809         Attr::setValueForBindings() was thus renamed to setValue(). Its implementation
2810         was also simplified by calling Element::setAttribute() on its ownerElement, if
2811         it has one, instead of duplicating a bunch of code from Element::setAttributeInternal().
2812
2813         (WebCore::Attr::setNodeValue):
2814         Call setValue() instead of setValueForBindings() now that it has been renamed.
2815
2816         * dom/Attr.h:
2817         * dom/Attr.idl:
2818         Rename valueForBindings / setValueForBindings to value / setValue.
2819
2820         * dom/Document.h:
2821         Split shouldInvalidateNodeListAndCollectionCaches() into 2 methods, one taking an Attr name
2822         and another that does not. There are now 2 calls sites instead of one, so we no longer need
2823         to branch in this function.
2824
2825         * dom/Element.cpp:
2826         (WebCore::Element::setAttributeInternal):
2827         Drop code calling Attr::setValue() on the Attr node since Attr::setValue() was only
2828         duplicating logic from Element::setAttributeInternal() after r216259. There is nothing
2829         on Attr that needs updating when an element attribute gets updated.
2830
2831         (WebCore::Element::attributeChanged):
2832         Call the new invalidateNodeListAndCollectionCachesInAncestorsForAttribute(). This
2833         is the only call site that passes an attribute name.
2834
2835         * dom/Node.cpp:
2836         (WebCore::Document::shouldInvalidateNodeListAndCollectionCaches):
2837         (WebCore::Document::shouldInvalidateNodeListAndCollectionCachesForAttribute):
2838         Split into 2 to avoid branching, as explained above.
2839
2840         (WebCore::Node::invalidateNodeListAndCollectionCachesInAncestors):
2841         (WebCore::Node::invalidateNodeListAndCollectionCachesInAncestorsForAttribute):
2842         - invalidateNodeListAndCollectionCachesInAncestors() used to invalidate childNodeLists
2843           if the Node was an attribute node. Drop this as this is no longer needed as of r216259.
2844         - After the change to Attr::setValue(), call sites for
2845           invalidateNodeListAndCollectionCachesInAncestors() either had no parameters, or both
2846           parameters present and non-null. There is therefore no longer any need to handle
2847           having an attrName but no attributeOwnerElement. To make this obvious, I split this
2848           into 2 methods: invalidateNodeListAndCollectionCachesInAncestors() and
2849           invalidateNodeListAndCollectionCachesInAncestorsForAttribute(attrName). We no longer
2850           need the attributeOwnerElement parameter as it was only used to exit early.
2851
2852         * dom/Node.h:
2853
2854 2017-05-10  Antti Koivisto  <antti@apple.com>
2855
2856         REGRESSION (r207372) Visibility property is not inherited when used in an animation
2857         https://bugs.webkit.org/show_bug.cgi?id=171883
2858         <rdar://problem/32086550>
2859
2860         Reviewed by Simon Fraser.
2861
2862         The problem here is that our animation code is tied to renderers. We don't have renderers during
2863         the initial style resolution so animations are not applied yet. When constructing renderers we set
2864         their style to the initial animated style but this step can't implement inheritance.
2865
2866         Normally this is invisible as the first animation frame will immediately inherit the style correctly.
2867         However in this case the animation is discrete and the first frame is the same as the initial state.
2868         With r207372 we optimize the descendant style change away.
2869
2870         This patch fixes the problem by tracking that the renderer has initial animated style and inheriting
2871         it to descendants during next style resolution even if it doesn't change.
2872
2873         Test: animations/animation-initial-inheritance.html
2874
2875         * rendering/RenderElement.cpp:
2876         (WebCore::RenderElement::RenderElement):
2877         * rendering/RenderElement.h:
2878         (WebCore::RenderElement::hasInitialAnimatedStyle):
2879         (WebCore::RenderElement::setHasInitialAnimatedStyle):
2880         * style/RenderTreeUpdater.cpp:
2881         (WebCore::RenderTreeUpdater::createRenderer):
2882
2883             Set a bit on renderer indicating it has initial animated style.
2884
2885         * style/StyleTreeResolver.cpp:
2886         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
2887
2888             Return at least 'Inherit' for style change when updating renderer with initial animated style.
2889
2890 2017-05-10  Jer Noble  <jer.noble@apple.com>
2891
2892         RELEASE_ASSERT at WebAudioSourceProviderAVFObjC::provideInput()
2893         https://bugs.webkit.org/show_bug.cgi?id=171711
2894
2895         Reviewed by Youenn Fablet.
2896
2897         Before iterating over the channels in either the WebAudioBufferList or the AudioBus, ensure
2898         we don't walk over the end of either by only iterating over the minimum length of either.
2899         Also, when the internal format of WebAudioSourceProviderAVFObjC changes, notify the
2900         MediaStreamAudioSourceNode that the number of channels and sample rate have changed.
2901
2902         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
2903         (WebCore::WebAudioSourceProviderAVFObjC::provideInput):
2904         (WebCore::WebAudioSourceProviderAVFObjC::prepare):
2905
2906 2017-05-04  Filip Pizlo  <fpizlo@apple.com>
2907
2908         GCController.cpp's collect() should be Async
2909         https://bugs.webkit.org/show_bug.cgi?id=171708
2910
2911         Reviewed by Saam Barati and Geoffrey Garen.
2912
2913         No new tests because no change in behavior.
2914         
2915         This is one step towards not requesting sync GCs in WebCore. I'm landing this incrementally to
2916         make bisecting super easy.
2917         
2918         This is a ~7% JetStream iOS "regression", because JetStream has a bug where it allows trunk
2919         to sneakily hide GC work between when JetStream measures time. After this change, we are no
2920         longer trying to be sneaky.
2921
2922         * bindings/js/GCController.cpp:
2923         (WebCore::collect):
2924
2925 2017-05-10  Jer Noble  <jer.noble@apple.com>
2926
2927         CoreAudioCaptureSource reports 3 or 5 channel audio output; actually only mono
2928         https://bugs.webkit.org/show_bug.cgi?id=171940
2929
2930         Reviewed by Eric Carlson.
2931
2932         Asking for the Input VPIO stream format will return the internal mic format, before processing. Instead
2933         ask for the input bus's output format, which is post processing, which will return the correct number
2934         of channels (one).
2935
2936         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2937         (WebCore::CoreAudioSharedUnit::configureMicrophoneProc):
2938
2939 2017-05-10  Ryan Haddad  <ryanhaddad@apple.com>
2940
2941         Unreviewed, rolling out r216591.
2942
2943         This change broke an internal build.
2944
2945         Reverted changeset:
2946
2947         "REGRESSION (r207372) Visibility property is not inherited
2948         when used in an animation"
2949         https://bugs.webkit.org/show_bug.cgi?id=171883
2950         http://trac.webkit.org/changeset/216591
2951
2952 2017-05-10  Chris Dumez  <cdumez@apple.com>
2953
2954         Drop custom bindings code now window.open()
2955         https://bugs.webkit.org/show_bug.cgi?id=171933
2956
2957         Reviewed by Geoffrey Garen.
2958
2959         Drop custom bindings code now window.open() as it is not doing anything special.
2960
2961         * bindings/js/JSDOMWindowCustom.cpp:
2962         (WebCore::JSDOMWindow::open): Deleted.
2963         * page/DOMWindow.cpp:
2964         (WebCore::DOMWindow::open):
2965         * page/DOMWindow.h:
2966         * page/DOMWindow.idl:
2967         * testing/Internals.cpp:
2968         (WebCore::Internals::openDummyInspectorFrontend):
2969
2970 2017-05-10  Tim Horton  <timothy_horton@apple.com>
2971
2972         Add an experimental feature flag for constant properties
2973         https://bugs.webkit.org/show_bug.cgi?id=171913
2974         <rdar://problem/31995518>
2975
2976         Reviewed by Ryosuke Niwa.
2977
2978         * css/parser/CSSParser.cpp:
2979         (WebCore::CSSParserContext::CSSParserContext):
2980         (WebCore::operator==):
2981         * css/parser/CSSParserImpl.cpp:
2982         (WebCore::CSSParserImpl::consumeCustomPropertyValue):
2983         * css/parser/CSSParserMode.h:
2984         * css/parser/CSSPropertyParser.cpp:
2985         (WebCore::CSSPropertyParser::parseValueStart):
2986         * css/parser/CSSVariableParser.cpp:
2987         (WebCore::classifyBlock):
2988         (WebCore::isValidVariableReference):
2989         (WebCore::isValidConstantReference):
2990         (WebCore::classifyVariableRange):
2991         (WebCore::CSSVariableParser::containsValidVariableReferences):
2992         (WebCore::CSSVariableParser::parseDeclarationValue):
2993         * css/parser/CSSVariableParser.h:
2994         Plumb the experimental feature flag down into CSSVariableParser by way
2995         of CSSParserContext.
2996
2997         * page/Settings.in:
2998
2999 2017-05-10  Chris Dumez  <cdumez@apple.com>
3000
3001         REGRESSION (r206960): Possible null pointer dereference under DOMSelection::getRangeAt()
3002         https://bugs.webkit.org/show_bug.cgi?id=171925
3003         <rdar://problem/29931223>
3004
3005         Reviewed by Wenson Hsieh.
3006
3007         We have evidence that selection().firstRange() can return null in DOMSelection::getRangeAt().
3008         When this happens, we now throw an INDEX_SIZE_ERR instead of dereferencing it.
3009
3010         I believe this can happen if the VisibleSelection is orphaned but not none, because
3011         rangeCount() only checks for isNone() but VisibleSelection::firstRange() can return null
3012         if isNoneOrOrphaned().
3013
3014         No new tests, I do not know how to reproduce.
3015
3016         * page/DOMSelection.cpp:
3017         (WebCore::DOMSelection::getRangeAt):
3018
3019 2017-05-10  Matt Rajca  <mrajca@apple.com>
3020
3021         DumpRenderTree crashed in com.apple.WebCore: std::optional<WTF::MediaTime>::operator-> + 71 :: CRASHING TEST: fullscreen/video-controls-timeline.html
3022         https://bugs.webkit.org/show_bug.cgi?id=171932
3023
3024         Reviewed by Eric Carlson.
3025
3026         Explicitly initialize m_playbackWithoutUserGesture to "None".
3027
3028         * html/HTMLMediaElement.h:
3029
3030 2017-05-10  Andy Estes  <aestes@apple.com>
3031
3032         Keyboard input suppression should extend to subframes
3033         https://bugs.webkit.org/show_bug.cgi?id=171880
3034         <rdar://problem/31201793>
3035
3036         Reviewed by Ryosuke Niwa.
3037
3038         Test: http/tests/navigation/keyboard-events-during-provisional-subframe-navigation.html
3039
3040         * dom/EventDispatcher.cpp:
3041         (WebCore::shouldSuppressEventDispatchInDOM): Changed to call shouldSuppressKeyboardInput()
3042         on the main frame's loader.
3043         * editing/Editor.cpp:
3044         (WebCore::Editor::shouldInsertText): Ditto.
3045
3046 2017-05-10  Matt Lewis  <jlewis3@apple.com>
3047
3048         Unreviewed, rolling out r216563.
3049
3050         Revision caused 2 api failures
3051
3052         Reverted changeset:
3053
3054         "[MediaStream] deviceId constraint doesn't work with
3055         getUserMedia"
3056         https://bugs.webkit.org/show_bug.cgi?id=171877
3057         http://trac.webkit.org/changeset/216563
3058
3059 2017-05-10  Frederic Wang  <fwang@igalia.com>
3060
3061         Refactor ScrollingCoordinator::setSynchronousScrollingReasons to accept a FrameView
3062         https://bugs.webkit.org/show_bug.cgi?id=171923
3063
3064         Reviewed by Simon Fraser.
3065
3066         Currently ScrollingCoordinator::setSynchronousScrollingReasons implementations assumes
3067         SynchronousScrollingReasons apply to the main frame. This commit allows to specify
3068         a FrameView in order to prepare support for fast scrolling of frames.
3069
3070         No new tests, no behavior changes.
3071
3072         * page/scrolling/AsyncScrollingCoordinator.cpp:
3073         (WebCore::AsyncScrollingCoordinator::setSynchronousScrollingReasons): Use the FrameView to
3074         find the state node.
3075         (WebCore::AsyncScrollingCoordinator::updateScrollLayerPosition): Rename this function
3076         updateMainFrameScrollLayerPosition and use the specified FrameView.
3077         * page/scrolling/AsyncScrollingCoordinator.h: Add FrameView parameter.
3078         * page/scrolling/ScrollingCoordinator.cpp:
3079         (WebCore::ScrollingCoordinator::updateSynchronousScrollingReasons): Remove the const since
3080         AsyncScrollingCoordinator uses scrollLayerForFrameView. Pass the frameView to
3081         setSynchronousScrollingReasons.
3082         * page/scrolling/ScrollingCoordinator.h:
3083         (WebCore::ScrollingCoordinator::setSynchronousScrollingReasons): Add FrameView parameter.
3084
3085 2017-05-10  Antti Koivisto  <antti@apple.com>
3086
3087         REGRESSION (r207372) Visibility property is not inherited when used in an animation
3088         https://bugs.webkit.org/show_bug.cgi?id=171883
3089         <rdar://problem/32086550>
3090
3091         Reviewed by Simon Fraser.
3092
3093         The problem here is that our animation code is tied to renderers. We don't have renderers during
3094         the initial style resolution so animations are not applied yet. When constructing renderers we set
3095         their style to the initial animated style but this step can't implement inheritance.
3096
3097         Normally this is invisible as the first animation frame will immediately inherit the style correctly.
3098         However in this case the animation is discrete and the first frame is the same as the initial state.
3099         With r207372 we optimize the descendant style change away.
3100
3101         This patch fixes the problem by tracking that the renderer has initial animated style and inheriting
3102         it to descendants during next style resolution even if it doesn't change.
3103
3104         Test: animations/animation-initial-inheritance.html
3105
3106         * rendering/RenderElement.cpp:
3107         (WebCore::RenderElement::RenderElement):
3108         * rendering/RenderElement.h:
3109         (WebCore::RenderElement::hasInitialAnimatedStyle):
3110         (WebCore::RenderElement::setHasInitialAnimatedStyle):
3111         * style/RenderTreeUpdater.cpp:
3112         (WebCore::RenderTreeUpdater::createRenderer):
3113
3114             Set a bit on renderer indicating it has initial animated style.
3115
3116         * style/StyleTreeResolver.cpp:
3117         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
3118
3119             Return at least 'Inherit' for style change when updating renderer with initial animated style.
3120
3121 2017-05-10  Myles C. Maxfield  <mmaxfield@apple.com>
3122
3123         Tiny cleanup in Font::DerivedFonts
3124         https://bugs.webkit.org/show_bug.cgi?id=171893
3125
3126         Reviewed by Jon Lee.
3127
3128         This variable was written to but never read.
3129
3130         No new tests because there is no behavior change.
3131
3132         * css/CSSFontFaceSource.cpp:
3133         (WebCore::CSSFontFaceSource::font):
3134         * platform/graphics/Font.cpp:
3135         (WebCore::Font::verticalRightOrientationFont):
3136         (WebCore::Font::uprightOrientationFont):
3137         (WebCore::Font::smallCapsFont):
3138         (WebCore::Font::noSynthesizableFeaturesFont):
3139         (WebCore::Font::emphasisMarkFont):
3140         (WebCore::Font::brokenIdeographFont):
3141         (WebCore::Font::DerivedFonts::~DerivedFonts): Deleted.
3142         * platform/graphics/Font.h:
3143         (WebCore::Font::DerivedFonts::DerivedFonts): Deleted.
3144
3145 2017-05-10  Michael Catanzaro  <mcatanzaro@igalia.com>
3146
3147         Remove user agent quirk for Slack
3148         https://bugs.webkit.org/show_bug.cgi?id=171869
3149
3150         Reviewed by Carlos Garcia Campos.
3151
3152         The user agent quirk for Slack does not seem to be necessary anymore. I am able to use Slack
3153         without difficulty using our default user agent.
3154
3155         * platform/UserAgentQuirks.cpp:
3156         (WebCore::urlRequiresChromeBrowser):
3157
3158 2017-05-10  Hyungwook Lee  <hyungwook.lee@navercorp.com>
3159
3160         [GTK] Fix compile warnings in CryptoKeyECGCrypt.cpp
3161         https://bugs.webkit.org/show_bug.cgi?id=171851
3162
3163         Reviewed by Alex Christensen.
3164
3165         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
3166         (WebCore::curveSize):
3167         (WebCore::curveName):
3168         (WebCore::uncompressedPointSizeForCurve):
3169         (WebCore::uncompressedFieldElementSizeForCurve):
3170
3171 2017-05-08  Sergio Villar Senin  <svillar@igalia.com>
3172
3173         [css-grid] Remove Blink-specific code for handling orthogonal grid items
3174         https://bugs.webkit.org/show_bug.cgi?id=171807
3175
3176         Reviewed by Darin Adler.
3177
3178         This code was added in r203252 as part of a patch improving the handling of
3179         {min|max}-content with orthogonal flows. The original code came from Blink which performs a
3180         pre-layout of orthogonal boxes in FrameView. That is not true in the case of WebKit so we do
3181         not need this code at all. Actually it was causing incorrect renderings in some tests.
3182
3183         I'm also removing an invalid return statement just after another return.
3184
3185         * rendering/GridTrackSizingAlgorithm.cpp:
3186         (WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild):
3187         (WebCore::GridTrackSizingAlgorithmStrategy::maxContentForChild):
3188
3189 2017-05-09  Zan Dobersek  <zdobersek@igalia.com>
3190
3191         Unreviewed build fix.
3192
3193         * platform/wpe/WidgetWPE.cpp:
3194         (WebCore::Widget::paint): Add the missing SecurityOriginPaintPolicy parameter.
3195
3196 2017-05-09  Eric Carlson  <eric.carlson@apple.com>
3197
3198         [MediaStream] deviceId constraint doesn't work with getUserMedia
3199         https://bugs.webkit.org/show_bug.cgi?id=171877
3200         <rdar://problem/31899730>
3201
3202         Reviewed by Jer Noble.
3203
3204         Test: fast/mediastream/get-user-media-device-id.html
3205
3206         * Modules/mediastream/MediaConstraintsImpl.h:
3207         (WebCore::MediaConstraintsData::MediaConstraintsData): Add a constructor that 
3208         takes a const MediaConstraints&.
3209
3210         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
3211         (WebCore::MediaDevicesEnumerationRequest::topLevelDocumentOrigin): Don't return
3212         NULL for the main frame so the origin matches that returned for a UserMediaRequest.
3213
3214         * Modules/mediastream/UserMediaController.h:
3215         (WebCore::UserMediaController::setDeviceIDHashSalt): Deleted, not used.
3216         (WebCore::UserMediaController::deviceIDHashSalt): Deleted, not used.
3217
3218         * Modules/mediastream/UserMediaRequest.cpp:
3219         (WebCore::UserMediaRequest::allow): Add device ID hash salt parameter, set it on
3220         constraints.
3221         * Modules/mediastream/UserMediaRequest.h:
3222
3223         * platform/mediastream/MediaConstraints.h:
3224         * platform/mediastream/RealtimeMediaSource.cpp:
3225         (WebCore::RealtimeMediaSource::fitnessDistance): ASSERT if called for DeviceId.
3226         (WebCore::RealtimeMediaSource::selectSettings): Special case DeviceId because it
3227         we have to hash the device ID before comparing, and because the DeviceId can't be
3228         changed so it should never be added to the flattened constraints.
3229
3230         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp:
3231         (WebCore::RealtimeMediaSourceSupportedConstraints::nameForConstraint): Deleted, unused.
3232         (WebCore::RealtimeMediaSourceSupportedConstraints::constraintFromName): Deleted, unused.
3233         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.h:
3234
3235         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3236         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
3237         (WebCore::RealtimeMediaSourceCenterMac::bestSourcesForTypeAndConstraints): Pass device
3238         id, not empty string.
3239
3240 2017-05-09  Jeremy Jones  <jeremyj@apple.com>
3241
3242         Video fullscreen window level should be below status bar.
3243         https://bugs.webkit.org/show_bug.cgi?id=171892
3244         rdar://problem/31771707
3245
3246         Reviewed by Jer Noble.
3247
3248         No new tests because it only affects platform window level.
3249
3250         Move the fullscreen window below the status bar, but above the input field window level.
3251
3252         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
3253         (WebVideoFullscreenInterfaceAVKit::setupFullscreen):
3254
3255 2017-05-09  Sam Weinig  <sam@webkit.org>
3256
3257         Implement Subresource Integrity (SRI) [Part 2 - Fetch]
3258         https://bugs.webkit.org/show_bug.cgi?id=148363
3259         <rdar://problem/18945879>
3260
3261         Reviewed by Youenn Fablet.
3262
3263         Tests: http/tests/subresource-integrity/sri-fetch-worker.html
3264                http/tests/subresource-integrity/sri-fetch.html
3265
3266         * loader/FetchOptions.h:
3267         * loader/ThreadableLoader.cpp:
3268         (WebCore::ThreadableLoaderOptions::isolatedCopy):
3269         * loader/ThreadableLoader.h:
3270         * loader/WorkerThreadableLoader.cpp:
3271         (WebCore::LoaderTaskOptions::LoaderTaskOptions):
3272         Add integrity metadata to the fetch options, and fix the implementation of
3273         ThreadableLoaderOptions::isolatedCopy to work correctly (it was missing isolated
3274         copy derivedCachedDataTypesToRetrieve).
3275
3276         * Modules/fetch/FetchRequest.cpp:
3277         (WebCore::buildOptions):
3278         (WebCore::FetchRequest::initializeOptions):
3279         * Modules/fetch/FetchRequest.h:
3280         Switch to using the integrity metadata on the fetchOptions, removing the need to
3281         store them directly on the internal request.
3282
3283         * loader/DocumentThreadableLoader.cpp:
3284         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
3285         (WebCore::DocumentThreadableLoader::didReceiveResponse):
3286         (WebCore::DocumentThreadableLoader::didReceiveData):
3287         (WebCore::DocumentThreadableLoader::didFinishLoading):
3288         (WebCore::DocumentThreadableLoader::loadRequest):
3289         (WebCore::DocumentThreadableLoader::reportIntegrityMetadataError):
3290         * loader/DocumentThreadableLoader.h:
3291         Add a new flag, m_delayCallbacksForIntegrityCheck, which is used when integrity metadata
3292         is present, so we can implement the 'wait' concept from the fetch spec, and delay informing
3293         the clients until we have validated the integrity metadata.
3294
3295 2017-05-09  Commit Queue  <commit-queue@webkit.org>
3296
3297         Unreviewed, rolling out r216545.
3298         https://bugs.webkit.org/show_bug.cgi?id=171889
3299
3300         Caused a test failure (Requested by eric_carlson on #webkit).
3301
3302         Reverted changeset:
3303
3304         "[MediaStream] deviceId constraint doesn't work with
3305         getUserMedia"
3306         https://bugs.webkit.org/show_bug.cgi?id=171877
3307         http://trac.webkit.org/changeset/216545
3308
3309 2017-05-09  Zalan Bujtas  <zalan@apple.com>
3310
3311         resetFlowThreadContainingBlockAndChildInfoIncludingDescendants should not ignore RenderElement subtrees.
3312         https://bugs.webkit.org/show_bug.cgi?id=171873
3313         <rdar://problem/32004954>
3314
3315         Reviewed by Simon Fraser.
3316
3317         Normally a RenderBlock's parent is another RenderBlock, but In some cases (e.g. tables) a RenderBlock can
3318         have a non-RenderBlock(RenderBox) ancestor.
3319         While updating the flow thread state on a subtree, we should descent into subtrees with RenderElement
3320         roots and not just RenderBlocks so that we clear the state on the entire subtree.
3321
3322         Test: fast/multicol/crash-when-column-inside-table.html
3323
3324         * rendering/RenderBlock.cpp:
3325         (WebCore::RenderBlock::resetFlowThreadContainingBlockAndChildInfoIncludingDescendants):
3326         * rendering/RenderBlock.h:
3327         * rendering/RenderElement.cpp:
3328         (WebCore::RenderElement::resetFlowThreadContainingBlockAndChildInfoIncludingDescendants):
3329         * rendering/RenderElement.h:
3330
3331 2017-05-09  Eric Carlson  <eric.carlson@apple.com>
3332
3333         [MediaStream] deviceId constraint doesn't work with getUserMedia
3334         https://bugs.webkit.org/show_bug.cgi?id=171877
3335         <rdar://problem/31899730>
3336
3337         Reviewed by Jer Noble.
3338
3339         Test: fast/mediastream/get-user-media-device-id.html
3340
3341         * Modules/mediastream/MediaConstraintsImpl.h:
3342         (WebCore::MediaConstraintsData::MediaConstraintsData): Add a constructor that 
3343         takes a const MediaConstraints&.
3344
3345         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp:
3346         (WebCore::MediaDevicesEnumerationRequest::topLevelDocumentOrigin): Don't return
3347         NULL for the main frame so the origin matches that returned for a UserMediaRequest.
3348
3349         * Modules/mediastream/UserMediaController.h:
3350         (WebCore::UserMediaController::setDeviceIDHashSalt): Deleted, not used.
3351         (WebCore::UserMediaController::deviceIDHashSalt): Deleted, not used.
3352
3353         * Modules/mediastream/UserMediaRequest.cpp:
3354         (WebCore::UserMediaRequest::allow): Add device ID hash salt parameter, set it on
3355         constraints.
3356         * Modules/mediastream/UserMediaRequest.h:
3357
3358         * platform/mediastream/MediaConstraints.h:
3359         * platform/mediastream/RealtimeMediaSource.cpp:
3360         (WebCore::RealtimeMediaSource::fitnessDistance): ASSERT if called for DeviceId.
3361         (WebCore::RealtimeMediaSource::selectSettings): Special case DeviceId because it
3362         we have to hash the device ID before comparing, and because the DeviceId can't be
3363         changed so it should never be added to the flattened constraints.
3364
3365         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp:
3366         (WebCore::RealtimeMediaSourceSupportedConstraints::nameForConstraint): Deleted, unused.
3367         (WebCore::RealtimeMediaSourceSupportedConstraints::constraintFromName): Deleted, unused.
3368         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.h:
3369
3370         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3371         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
3372         (WebCore::RealtimeMediaSourceCenterMac::bestSourcesForTypeAndConstraints): Pass device
3373         id, not empty string.
3374
3375 2017-05-09  Antoine Quint  <graouts@apple.com>
3376
3377         [Modern Media Controls] Localized strings aren't loaded
3378         https://bugs.webkit.org/show_bug.cgi?id=171884
3379
3380         Reviewed by Dean Jackson.
3381
3382         Remove the extraneous file extension in the file name.
3383
3384         * rendering/RenderThemeIOS.mm:
3385         (WebCore::RenderThemeIOS::mediaControlsScript):
3386         * rendering/RenderThemeMac.mm:
3387         (WebCore::RenderThemeMac::mediaControlsScript):
3388
3389 2017-05-09  Chris Dumez  <cdumez@apple.com>
3390
3391         Introduce DocumentAndElementEventHandlers IDL interface
3392         https://bugs.webkit.org/show_bug.cgi?id=171879
3393
3394         Reviewed by Simon Fraser and Ryosuke Niwa.
3395
3396         Introduce DocumentAndElementEventHandlers IDL interface:
3397         - https://html.spec.whatwg.org/#documentandelementeventhandlers
3398
3399         This avoids duplication between Document.idl and Element.idl.
3400
3401         Also mark oncopy / oncut / onpaste EventHandlers as enumerable to match
3402         the specification.
3403
3404         Test: fast/events/DocumentAndElementEventHandlers.html
3405
3406         * CMakeLists.txt:
3407         * DerivedSources.make:
3408         * WebCore.xcodeproj/project.pbxproj:
3409         * dom/Document.idl:
3410         * dom/DocumentAndElementEventHandlers.idl: Added.
3411         * dom/Element.idl:
3412
3413 2017-05-10  Dean Jackson  <dino@apple.com>
3414
3415         Restrict SVG filters to accessible security origins
3416         https://bugs.webkit.org/show_bug.cgi?id=118689
3417         <rdar://problem/27362159>
3418
3419         Reviewed by Brent Fulgham.
3420
3421         Certain SVG filters should only be allowed to operate
3422         on content that is has SecurityOrigin access to. Implement
3423         this by including a flag in PaintInfo and LayerPaintingInfo,
3424         and have RenderWidget make sure the documents have acceptable
3425         SecurityOrigins as it goes to paint.
3426
3427         This could be used as the first step in a "safe painting"
3428         strategy, allowing some content to be rendered into a 
3429         canvas or via the element() CSS function... but it is only
3430         a small first step.
3431
3432         Test: http/tests/css/filters-on-iframes.html
3433
3434         * page/FrameView.cpp:
3435         (WebCore::FrameView::paintContents):
3436         * page/FrameView.h:
3437         * platform/ScrollView.cpp:
3438         (WebCore::ScrollView::paint):
3439         * platform/ScrollView.h:
3440         * platform/Scrollbar.cpp:
3441         (WebCore::Scrollbar::paint):
3442         * platform/Scrollbar.h:
3443         * platform/Widget.h:
3444         * platform/graphics/filters/FilterOperation.h:
3445         (WebCore::FilterOperation::shouldBeRestrictedBySecurityOrigin):
3446         * platform/graphics/filters/FilterOperations.cpp:
3447         (WebCore::FilterOperations::hasFilterThatShouldBeRestrictedBySecurityOrigin):
3448         * platform/graphics/filters/FilterOperations.h:
3449         * platform/mac/WidgetMac.mm:
3450         (WebCore::Widget::paint):
3451         * rendering/FilterEffectRenderer.cpp:
3452         (WebCore::FilterEffectRenderer::build):
3453         * rendering/FilterEffectRenderer.h:
3454         * rendering/PaintInfo.h:
3455         (WebCore::PaintInfo::PaintInfo):
3456         * rendering/RenderLayer.cpp:
3457         (WebCore::RenderLayer::paint):
3458         (WebCore::RenderLayer::setupFilters):
3459         (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
3460         * rendering/RenderLayer.h:
3461         * rendering/RenderScrollbar.cpp:
3462         (WebCore::RenderScrollbar::paint):
3463         * rendering/RenderScrollbar.h:
3464         * rendering/RenderWidget.cpp:
3465         (WebCore::RenderWidget::paintContents):
3466
3467 2017-05-09  Chris Dumez  <cdumez@apple.com>
3468
3469         Move onanimation* EventHandlers to GlobalEventHandlers
3470         https://bugs.webkit.org/show_bug.cgi?id=171874
3471
3472         Reviewed by Simon Fraser.
3473
3474         Move onanimation* EventHandlers to GlobalEventHandlers to match the specification:
3475         - https://drafts.csswg.org/css-animations/#interface-globaleventhandlers-idl
3476
3477         We previously have those on Window and Element only. Firefox complies with the
3478         specification.
3479
3480         Test: fast/css/onanimation-eventhandlers.html
3481
3482         * dom/Element.idl:
3483         * dom/GlobalEventHandlers.idl:
3484         * page/DOMWindow.idl:
3485
3486 2017-05-09  Youenn Fablet  <youenn@apple.com>
3487
3488         Refresh webrtc WPT tests
3489         https://bugs.webkit.org/show_bug.cgi?id=171878
3490
3491         Reviewed by Eric Carlson.
3492
3493         Tests: imported/w3c/web-platform-tests/webrtc/RTCConfiguration-iceCandidatePoolSize.html
3494                imported/w3c/web-platform-tests/webrtc/RTCDataChannel-id.html
3495                imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-canTrickleIceCandidates.html
3496                imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-constructor.html
3497                imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-createDataChannel.html
3498                imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-iceGatheringState.html
3499                imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-idl.html
3500                imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription.html
3501                imported/w3c/web-platform-tests/webrtc/datachannel-idlharness.html
3502                imported/w3c/web-platform-tests/webrtc/getstats.html
3503                imported/w3c/web-platform-tests/webrtc/interfaces.html
3504
3505         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3506         (WebCore::LibWebRTCMediaEndpoint::createDataChannel): exiting early if libwebrtc is not creating a data channel.
3507
3508 2017-05-09  Javier Fernandez  <jfernandez@igalia.com>
3509
3510         space-evenly misbehaves with flexbox
3511         https://bugs.webkit.org/show_bug.cgi?id=170445
3512
3513         Reviewed by David Hyatt.
3514
3515         The CSS Box Alignment specification defines the <content-distribution>
3516         set as some of the allowed values for the Content Distribution
3517         properties, align-content and justify-content. The 'space-evenly' value
3518         is not among the ones allowed for these properties according to the CSS
3519         Flexible Box specification.
3520
3521         The CSS Flexbible box specification states that it must follow the CSS
3522         Box Alignment specification, so this new value must be considered as
3523         part of an upgraded level of the spec, which should be implemented
3524         eventually.
3525
3526         Since we have already shipped an implementation of the new CSS Box
3527         Alignment values for CSS Grid Layout, we need to implement it for
3528         Flexbox as well.
3529
3530         No new tests, but several new test cases added.
3531
3532         * rendering/RenderFlexibleBox.cpp:
3533         (WebCore::initialJustifyContentOffset):
3534         (WebCore::justifyContentSpaceBetweenChildren):
3535         (WebCore::initialAlignContentOffset):
3536         (WebCore::alignContentSpaceBetweenChildren):
3537
3538 2017-05-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3539
3540         Avoid -Wformat warnings in RenderLayerCompositor.cpp and RenderLayerBacking.cpp
3541         https://bugs.webkit.org/show_bug.cgi?id=171875
3542
3543         Reviewed by Simon Fraser.
3544
3545         * rendering/RenderLayerBacking.cpp:
3546         (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
3547         * rendering/RenderLayerCompositor.cpp:
3548         (WebCore::RenderLayerCompositor::logLayerInfo):
3549         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
3550
3551 2017-05-09  Chris Dumez  <cdumez@apple.com>
3552
3553         Drop custom bindings code for Window.location setter
3554         https://bugs.webkit.org/show_bug.cgi?id=171846
3555
3556         Reviewed by Sam Weinig.
3557
3558         Drop custom bindings code for Window.location setter as the custom code was merely needed
3559         to address a very old Mac widget that has long been fixed (rdar://problem/5695330).
3560
3561         No new tests, no Web-facing behavior change.
3562
3563         * bindings/js/JSDOMWindowCustom.cpp:
3564         (WebCore::JSDOMWindow::setLocation): Deleted.
3565         Drop custom code.
3566
3567         * page/DOMWindow.idl:
3568         Align Window.location with https://html.spec.whatwg.org/#the-window-object:
3569         - Mark property as readonly.
3570         - Add [PutsForward=href] IDL extended attribute.
3571         Also, we need to mark the atribute as nullable as this reflects our current implementation.
3572         We currently return null if the associated Window does not have a frame. This does not match
3573         the specification and we should update our implementation in the future to never return null.
3574
3575 2017-05-09  Matt Lewis  <jlewis3@apple.com>
3576
3577         Unreviewed, rolling out r216508.
3578
3579         The layout test enabled in this change is failing on Sierra.
3580
3581         Reverted changeset:
3582
3583         "Invalid MediaSource duration value should throw TyperError
3584         instead of InvalidStateError"
3585         https://bugs.webkit.org/show_bug.cgi?id=171653
3586         http://trac.webkit.org/changeset/216508
3587
3588 2017-05-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3589
3590         Update Chrome and Firefox versions in user agent quirks
3591         https://bugs.webkit.org/show_bug.cgi?id=171823
3592
3593         Reviewed by Carlos Alberto Lopez Perez.
3594
3595         * platform/UserAgentQuirks.cpp:
3596         (WebCore::UserAgentQuirks::stringForQuirk):
3597         (WebCore::UserAgentQuirks::firefoxRevisionString):
3598
3599 2017-05-09  Youenn Fablet  <youenn@apple.com>
3600
3601         RealtimeOutgoingAudioSource is crashing when given data with more than two channels
3602         https://bugs.webkit.org/show_bug.cgi?id=171868
3603
3604         Reviewed by Eric Carlson.
3605
3606         Manual testing.
3607
3608         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
3609         (WebCore::libwebrtcAudioFormat): Capping the number of channels to 2.
3610         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
3611
3612 2017-05-09  Myles C. Maxfield  <mmaxfield@apple.com>
3613
3614         font-stretch: normal selects expanded fonts instead of condensed fonts
3615         https://bugs.webkit.org/show_bug.cgi?id=171838
3616         <rdar://problem/31005481>
3617
3618         Reviewed by Jon Lee.
3619
3620         CSS Fonts level 3 says: "If the value of ‘font-stretch’ is ‘normal’ or one of the condensed
3621         values, narrower width values are checked first, then wider values."
3622
3623         CSS Fonts level 4 erroneously was incompatible with this, but was updated in
3624         https://github.com/w3c/csswg-drafts/commit/4559389d183bbaaf3321af5ba1c924caa7c488bb
3625         to be consistent with this.
3626
3627         Now, CSS Fonts level 4 states: "If the desired stretch value is less than or equal to100,
3628         stretch values below the desired stretch value are checked in descending order followed by
3629         stretch values above the desired stretch value in ascending order"
3630
3631         Test: fast/text/font-width-100.html
3632
3633         * platform/graphics/FontSelectionAlgorithm.cpp:
3634
3635 2017-05-09  Romain Bellessort  <romain.bellessort@crf.canon.fr>
3636
3637         [Readable Streams API] Enable creation of ReadableStreamBYOBReader
3638         https://bugs.webkit.org/show_bug.cgi?id=171665
3639
3640         Reviewed by Youenn Fablet.
3641
3642         Enabled the creation of ReadableStreamBYOBReader.
3643
3644         Test: streams/readable-stream-byob-reader.html
3645
3646         * CMakeLists.txt: Updated to support ReadableStreamBYOBReader.
3647         * DerivedSources.cpp: Updated to support ReadableStreamBYOBReader.
3648         * DerivedSources.make: Updated to support ReadableStreamBYOBReader.
3649         * Modules/streams/ReadableByteStreamInternals.js: Updated to support ReadableStreamBYOBReader.
3650         (privateInitializeReadableStreamBYOBReader):
3651         (isReadableStreamBYOBReader):
3652         * Modules/streams/ReadableStream.js: Updated to support ReadableStreamBYOBReader.
3653         (getReader):
3654         * Modules/streams/ReadableStreamBYOBReader.idl: Added.
3655         * Modules/streams/ReadableStreamBYOBReader.js: Added.
3656         (cancel): To be implemented.
3657         (read): To be implemented.
3658         (releaseLock): To be implemented.
3659         (closed): To be implemented.
3660         * WebCore.xcodeproj/project.pbxproj: Updated to support ReadableStreamBYOBReader.
3661         * bindings/js/JSDOMGlobalObject.cpp: Updated to support ReadableStreamBYOBReader.
3662         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
3663         * bindings/js/JSReadableStreamPrivateConstructors.cpp: Updated to support ReadableStreamBYOBReader.
3664         (WebCore::constructJSReadableStreamReaderGeneric):
3665         (WebCore::constructJSReadableStreamDefaultReader):
3666         (WebCore::constructJSReadableStreamBYOBReader):
3667         (WebCore::JSBuiltinReadableStreamBYOBReaderPrivateConstructor::initializeExecutable):
3668         (WebCore::createReadableStreamBYOBReaderPrivateConstructor):
3669         * bindings/js/JSReadableStreamPrivateConstructors.h: Updated to support ReadableStreamBYOBReader.
3670         * bindings/js/WebCoreBuiltinNames.h: Updated to support ReadableStreamBYOBReader.
3671
3672 2017-05-09  Frederic Wang  <fwang@igalia.com>
3673
3674         Print more properties in the output of scrolling trees
3675         https://bugs.webkit.org/show_bug.cgi?id=171858
3676
3677         Reviewed by Simon Fraser.
3678
3679         No new tests, no behavior changes.
3680
3681         * page/scrolling/ScrollingCoordinator.cpp: Implement << operator to print ScrollableAreaParameters.
3682         (WebCore::operator<<):
3683         * page/scrolling/ScrollingCoordinator.h: Declare new << operator.
3684         * page/scrolling/ScrollingStateFrameScrollingNode.cpp: Print new properties.
3685         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties):
3686         * page/scrolling/ScrollingStateScrollingNode.cpp: ditto.
3687         (WebCore::ScrollingStateScrollingNode::dumpProperties):
3688         * page/scrolling/ScrollingTreeScrollingNode.cpp: ditto.
3689         (WebCore::ScrollingTreeScrollingNode::dumpProperties):
3690
3691 2017-05-09  Chris Dumez  <cdumez@apple.com>
3692
3693         ontransitionend eventHandler should be in GlobalEventHandlers
3694         https://bugs.webkit.org/show_bug.cgi?id=171836
3695
3696         Reviewed by Ryosuke Niwa.
3697
3698         ontransitionend eventHandler should be in GlobalEventHandlers:
3699         - https://drafts.csswg.org/css-transitions/#interface-globaleventhandlers-idl
3700
3701         WebKit currently has in on Window and Element only. Firefox matches the specification.
3702
3703         Test: fast/css/ontransitionend-eventhandler.html
3704
3705         * dom/Element.idl:
3706         * dom/GlobalEventHandlers.idl:
3707         * page/DOMWindow.idl:
3708
3709 2017-05-09  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
3710
3711         MediaSource.readyState should use an IDL enum
3712         https://bugs.webkit.org/show_bug.cgi?id=171672
3713
3714         Reviewed by Eric Carlson and Chris Dumez.
3715
3716         MediaSource.readyState should use an IDL enum as per specification
3717         (https://www.w3.org/TR/2016/CR-media-source-20160503/#idl-def-ReadyState).
3718
3719         No new tests required since no behavior change.
3720
3721         * Modules/mediasource/MediaSource.cpp:
3722         (WebCore::toString):
3723         (WebCore::MediaSource::MediaSource):
3724         (WebCore::MediaSource::setPrivateAndOpen):
3725         (WebCore::MediaSource::buffered):
3726         (WebCore::MediaSource::setReadyState):
3727         (WebCore::MediaSource::streamEndedWithError):
3728         (WebCore::MediaSource::isOpen):
3729         (WebCore::MediaSource::isClosed):
3730         (WebCore::MediaSource::isEnded):
3731         (WebCore::MediaSource::detachFromElement):
3732         (WebCore::MediaSource::openIfInEndedState):
3733         (WebCore::MediaSource::stop):
3734         (WebCore::MediaSource::onReadyStateChange):
3735         * Modules/mediasource/MediaSource.h:
3736         * Modules/mediasource/MediaSource.idl:
3737
3738 2017-05-09  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
3739
3740         Invalid MediaSource duration value should throw TyperError instead of InvalidStateError
3741         https://bugs.webkit.org/show_bug.cgi?id=171653
3742
3743         Reviewed by Youenn Fablet.
3744
3745         Modify MediaSource::setDuration to throw a TypeError when duration value is invalid as per MSE specification
3746         (https://www.w3.org/TR/2016/REC-media-source-20161117/#dom-mediasource-duration).
3747
3748         Update expectation of corresponding WPT test.
3749
3750         * Modules/mediasource/MediaSource.cpp:
3751         (WebCore::MediaSource::setDuration):
3752         (WebCore::MediaSource::setDurationInternal):
3753
3754 2017-05-09  Yusuke Suzuki  <utatane.tea@gmail.com>
3755
3756         Unreviewed, update binding-tests results
3757         https://bugs.webkit.org/show_bug.cgi?id=166752
3758
3759         * bindings/scripts/test/JS/JSTestNode.cpp:
3760         * bindings/scripts/test/JS/JSTestObj.cpp:
3761
3762 2017-05-09  Chris Dumez  <cdumez@apple.com>
3763
3764         Update DocumentOrShadowRoot.idl to match specifications
3765         https://bugs.webkit.org/show_bug.cgi?id=171845
3766
3767         Reviewed by Ryosuke Niwa.
3768
3769         Update DocumentOrShadowRoot.idl to match specifications:
3770         - https://dom.spec.whatwg.org/#mixin-documentorshadowroot
3771         - https://w3c.github.io/webcomponents/spec/shadow/#extensions-to-the-documentorshadowroot-mixin
3772         - https://w3c.github.io/pointerlock/#extensions-to-the-documentorshadowroot-mixin
3773
3774         No Web-facing behavior change. Things that do not match the specification were merely
3775         annotated with FIXME comments.
3776
3777         * dom/Document.idl:
3778         * dom/DocumentOrShadowRoot.idl:
3779
3780 2017-05-09  Yusuke Suzuki  <utatane.tea@gmail.com>
3781
3782         Unreviewed, attempt to fix macOS ports using ApplePay
3783         https://bugs.webkit.org/show_bug.cgi?id=166752
3784
3785         * bindings/scripts/CodeGeneratorJS.pm:
3786         (GenerateImplementation):
3787
3788 2017-05-09  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
3789
3790         [Coordinated Graphics] Debug Visuals don't hide
3791         https://bugs.webkit.org/show_bug.cgi?id=162704
3792
3793         Reviewed by Žan Doberšek.
3794
3795         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3796         (WebCore::CoordinatedGraphicsLayer::setShowDebugBorder):
3797         (WebCore::CoordinatedGraphicsLayer::setShowRepaintCounter):
3798         (WebCore::CoordinatedGraphicsLayer::syncLayerState):
3799         (WebCore::CoordinatedGraphicsLayer::setDebugBorder):
3800         showDebugBorders() and showRepaintCounter() of CoordinatedGraphicsLayer should reflect
3801         the "show" argument to the layer state.
3802
3803         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
3804         (WebCore::DebugVisuals::DebugVisuals):
3805         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
3806         To set the debug visuals of a layer, the visibility flags of the borders and the repaint
3807         counters as well as the border width and color are needed. Thus a new bundle struct
3808         DebugVisuals and its change flag debugVisualsChanged have been introduced in order to
3809         send the information at once.
3810
3811 2017-05-09  Yusuke Suzuki  <utatane.tea@gmail.com>
3812
3813         Handle IDLPromise<> properly
3814         https://bugs.webkit.org/show_bug.cgi?id=166752
3815
3816         Reviewed by Youenn Fablet.
3817
3818         This patch implements WebIDL Promise type conversion. According to the spec,
3819         Promise takes a value and convert it to Promise by using Promise.resolve function.
3820         We implement JSPromise::resolve in JSC and use it in JSDOMConvertPromise.
3821
3822         In conversion phase, we just convert the value to JSC::JSPromise* and hold it in
3823         PromiseRejectionEvent. On the other hand, In this patch, we newly introduce a new
3824         type DOMPromise and use it in RejectedPromiseTracker. And we also rename the previous
3825         DOMPromise to DOMPromiseDeferred since it is corresponding to JSPromiseDeferred.
3826         DOMPromise is DOMGuarded object. So it is strongly referenced from ScriptExecutionContext
3827         and it is weakly referenced from the object itself. This is important since Strong<JSPromise>
3828         reference in C++ object that has a wrapper (in this case, PromiseRejectionEvent) easily causes
3829         cyclic reference. We hold it as DOMPromise instead of Strong<JSPromise> in RejectedPromiseTracker
3830         to break the cyclic reference edge with weak reference.
3831
3832         In the meantime, we still use JSC::Strong<> in PromiseRejectionEvent. It leaks memory if promise
3833         refers the wrapper object of PromiseRejectionEvent. CustomEvent also has the same problem.
3834         This is a general problem that `attribute any` can create cyclic reference. And they should be
3835         fixed in a different patch.
3836
3837         Currently, we do not take the following approach. e.g. There is C++ object that represents Promise.
3838         And its wrapper object is JSPromise thing. When exposing the C++ object, it will be converted to a
3839         wrapper object. We do not take this approach because PromiseRejectionEvent can take user-provided promise.
3840         For example, users can create PromiseRejectionEvent in a form
3841         `new PromiseRejectionEvent("...", { promise: promise })`. In this case, `event.promise === promise`
3842         is required. And this is not suitable for the above C++ object model.
3843
3844         Large part of this patch is mechanical one to replace DOMPromise with DOMPromiseDeferred.
3845
3846         * CMakeLists.txt:
3847         * Modules/applepay/ApplePaySession.cpp:
3848         * Modules/encryptedmedia/MediaKeySession.h:
3849         * Modules/encryptedmedia/MediaKeySystemAccess.h:
3850         * Modules/encryptedmedia/MediaKeys.h:
3851         * Modules/encryptedmedia/NavigatorEME.h:
3852         * Modules/fetch/DOMWindowFetch.h:
3853         * Modules/fetch/FetchBody.h:
3854         * Modules/fetch/FetchBodyConsumer.h:
3855         * Modules/fetch/FetchResponse.h:
3856         * Modules/fetch/WorkerGlobalScopeFetch.h:
3857         * Modules/mediastream/MediaDevices.h:
3858         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3859         (WebCore::MediaEndpointPeerConnection::replaceTrack):
3860         (WebCore::MediaEndpointPeerConnection::replaceTrackTask):
3861         * Modules/mediastream/MediaEndpointPeerConnection.h:
3862         * Modules/mediastream/MediaStreamTrack.cpp:
3863         (WebCore::MediaStreamTrack::applyConstraints):
3864         * Modules/mediastream/MediaStreamTrack.h:
3865         * Modules/mediastream/PeerConnectionBackend.cpp:
3866         (WebCore::PeerConnectionBackend::setLocalDescription):
3867         (WebCore::PeerConnectionBackend::setRemoteDescription):
3868         (WebCore::PeerConnectionBackend::addIceCandidate):
3869         * Modules/mediastream/PeerConnectionBackend.h:
3870         (WebCore::PeerConnectionBackend::endOfIceCandidates):
3871         * Modules/mediastream/RTCPeerConnection.cpp:
3872         (WebCore::RTCPeerConnection::queuedSetLocalDescription):
3873         (WebCore::RTCPeerConnection::queuedSetRemoteDescription):
3874         (WebCore::RTCPeerConnection::queuedAddIceCandidate):
3875         (WebCore::RTCPeerConnection::enqueueReplaceTrackTask):
3876         (WebCore::RTCPeerConnection::replaceTrack):
3877         * Modules/mediastream/RTCPeerConnection.h:
3878         * Modules/mediastream/RTCRtpSender.cpp:
3879         (WebCore::RTCRtpSender::replaceTrack):
3880         * Modules/mediastream/RTCRtpSender.h:
3881         * Modules/mediastream/UserMediaRequest.cpp:
3882         (WebCore::UserMediaRequest::start):
3883         (WebCore::UserMediaRequest::UserMediaRequest):
3884         * Modules/mediastream/UserMediaRequest.h:
3885         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3886         (WebCore::LibWebRTCPeerConnectionBackend::replaceTrack):
3887         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
3888         * Modules/streams/ReadableStreamSource.h:
3889         (WebCore::ReadableStreamSource::start):
3890         (WebCore::ReadableStreamSource::pull):
3891         * Modules/webaudio/AudioContext.cpp:
3892         (WebCore::AudioContext::addReaction):
3893         (WebCore::AudioContext::setState):
3894         (WebCore::AudioContext::suspend):
3895         (WebCore::AudioContext::resume):
3896         (WebCore::AudioContext::close):
3897         * Modules/webaudio/AudioContext.h:
3898         * WebCore.xcodeproj/project.pbxproj:
3899         * bindings/IDLTypes.h:
3900         * bindings/js/CachedModuleScriptLoaderClient.h:
3901         * bindings/js/JSBindingsAllInOne.cpp:
3902         * bindings/js/JSCustomElementRegistryCustom.cpp:
3903         * bindings/js/JSDOMConvertPromise.h:
3904         (WebCore::Converter<IDLPromise<T>>::convert):
3905         (WebCore::JSConverter<IDLPromise<T>>::convert):
3906         * bindings/js/JSDOMExceptionHandling.cpp:
3907         * bindings/js/JSDOMGlobalObject.cpp:
3908         * bindings/js/JSDOMGuardedObject.h:
3909         * bindings/js/JSDOMPromise.h:
3910         (WebCore::DOMPromise::create):
3911         (WebCore::DOMPromise::promise):
3912         (WebCore::DOMPromise::DOMPromise):
3913         (WebCore::DeferredPromise::create): Deleted.
3914         (WebCore::DeferredPromise::resolve): Deleted.
3915         (WebCore::DeferredPromise::resolveWithNewlyCreated): Deleted.
3916         (WebCore::DeferredPromise::reject): Deleted.
3917         (WebCore::DeferredPromise::resolveWithCallback): Deleted.
3918         (WebCore::DeferredPromise::rejectWithCallback): Deleted.
3919         (WebCore::DeferredPromise::DeferredPromise): Deleted.
3920         (WebCore::DeferredPromise::deferred): Deleted.
3921         (WebCore::DOMPromiseBase::DOMPromiseBase): Deleted.
3922         (WebCore::DOMPromiseBase::operator=): Deleted.
3923         (WebCore::DOMPromiseBase::reject): Deleted.
3924         (WebCore::DOMPromiseBase::rejectType): Deleted.
3925         (WebCore::DOMPromiseBase::promise): Deleted.
3926         (WebCore::DOMPromise::resolve): Deleted.
3927         (WebCore::DOMPromise<void>::resolve): Deleted.
3928         (WebCore::callPromiseFunction): Deleted.
3929         (WebCore::bindingPromiseFunctionAdapter): Deleted.
3930         * bindings/js/JSDOMPromiseDeferred.cpp: Renamed from Source/WebCore/bindings/js/JSDOMPromise.cpp.
3931         (WebCore::DeferredPromise::promise):
3932         (WebCore::DeferredPromise::callFunction):
3933         (WebCore::DeferredPromise::reject):
3934         (WebCore::rejectPromiseWithExceptionIfAny):
3935         (WebCore::createDeferredPromise):
3936         (WebCore::createRejectedPromiseWithTypeError):
3937         (WebCore::parseAsJSON):
3938         (WebCore::fulfillPromiseWithJSON):
3939         (WebCore::fulfillPromiseWithArrayBuffer):
3940         * bindings/js/JSDOMPromiseDeferred.h: Copied from Source/WebCore/bindings/js/JSDOMPromise.h.
3941         (WebCore::DeferredPromise::create):
3942         (WebCore::DeferredPromise::resolve):
3943         (WebCore::DeferredPromise::resolveWithNewlyCreated):
3944         (WebCore::DeferredPromise::reject):
3945         (WebCore::DeferredPromise::resolveWithCallback):
3946         (WebCore::DeferredPromise::rejectWithCallback):
3947         (WebCore::DeferredPromise::DeferredPromise):
3948         (WebCore::DeferredPromise::deferred):
3949         (WebCore::DOMPromiseDeferredBase::DOMPromiseDeferredBase):
3950         (WebCore::DOMPromiseDeferredBase::operator=):
3951         (WebCore::DOMPromiseDeferredBase::reject):
3952         (WebCore::DOMPromiseDeferredBase::rejectType):
3953         (WebCore::DOMPromiseDeferredBase::promise):
3954         (WebCore::DOMPromiseDeferred::resolve):
3955         (WebCore::DOMPromiseDeferred<void>::resolve):
3956         (WebCore::callPromiseFunction):
3957         (WebCore::bindingPromiseFunctionAdapter):
3958         * bindings/js/JSSubtleCryptoCustom.cpp:
3959         * bindings/js/JSWebGPUCommandBufferCustom.cpp:
3960         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
3961         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: Added.
3962         (WebCore::convertDictionary<TestPromiseRejectionEvent::Init>):
3963         (WebCore::JSTestPromiseRejectionEventPrototype::create):
3964         (WebCore::JSTestPromiseRejectionEventPrototype::createStructure):
3965         (WebCore::JSTestPromiseRejectionEventPrototype::JSTestPromiseRejectionEventPrototype):
3966         (WebCore::JSTestPromiseRejectionEventConstructor::construct):
3967         (WebCore::JSTestPromiseRejectionEventConstructor::prototypeForStructure):
3968         (WebCore::JSTestPromiseRejectionEventConstructor::initializeProperties):
3969         (WebCore::JSTestPromiseRejectionEventPrototype::finishCreation):
3970         (WebCore::JSTestPromiseRejectionEvent::JSTestPromiseRejectionEvent):
3971         (WebCore::JSTestPromiseRejectionEvent::finishCreation):
3972         (WebCore::JSTestPromiseRejectionEvent::createPrototype):
3973         (WebCore::JSTestPromiseRejectionEvent::prototype):
3974         (WebCore::BindingCaller<JSTestPromiseRejectionEvent>::castForAttribute):
3975         (WebCore::jsTestPromiseRejectionEventPromise):
3976         (WebCore::jsTestPromiseRejectionEventPromiseGetter):
3977         (WebCore::jsTestPromiseRejectionEventReason):
3978         (WebCore::jsTestPromiseRejectionEventReasonGetter):
3979         (WebCore::jsTestPromiseRejectionEventConstructor):
3980         (WebCore::setJSTestPromiseRejectionEventConstructor):
3981         (WebCore::JSTestPromiseRejectionEvent::getConstructor):
3982         (WebCore::toJSNewlyCreated):
3983         (WebCore::toJS):
3984         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.h: Added.
3985         (WebCore::JSTestPromiseRejectionEvent::create):
3986         (WebCore::JSTestPromiseRejectionEvent::createStructure):
3987         (WebCore::JSTestPromiseRejectionEvent::wrapped):
3988         (WebCore::toJS):
3989         (WebCore::toJSNewlyCreated):
3990         * bindings/scripts/test/TestPromiseRejectionEvent.idl: Copied from Source/WebCore/bindings/js/CachedModuleScriptLoaderClient.h.
3991         * css/FontFace.h:
3992         * css/FontFaceSet.h:
3993         * dom/CustomElementRegistry.h:
3994         * dom/PromiseRejectionEvent.h:
3995         * dom/RejectedPromiseTracker.cpp:
3996         (WebCore::UnhandledPromise::UnhandledPromise):
3997         (WebCore::UnhandledPromise::callStack):
3998         (WebCore::UnhandledPromise::promise):
3999         (WebCore::RejectedPromiseTracker::promiseRejected):
4000         (WebCore::Reje