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