f57f0bae437b620ff6f69a11ceae011b50fdb1a5
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-09-28  Jer Noble  <jer.noble@apple.com>
2
3         Refactoring: eliminate raw pointer usage in Fullscreen code
4         https://bugs.webkit.org/show_bug.cgi?id=188747
5         <rdar://problem/43541164>
6
7         Reviewed by Alex Christensen.
8
9         Two sources of raw pointers in the Fullscreen code:
10         - Model classes (PlaybackSessionModel and VideoFullscreenModel) aren't ref-able, so
11           they are passed around as raw references.
12         - Observer classes (PlaybackSessionModelClient and VideoFullscreenModelClient, and
13           VideoFullscreenChangeObserver) are also passed around as raw pointers, but shouldn't
14           be ref-able.
15
16         Make Model classes ref-able by adding ref() and deref() which call virtual refModel and
17         derefModel methods, overridden by implementing subclasses. Make every concrete observer
18         inherit from CanMakeWeakPtr, and every registration method take WeakPtr wrappers around
19         the client interface.
20
21         Since every Interface class now holds a strong reference to its Model classes, and each
22         Model class holds a weak reference to all its clients, no explicit invalidate() method
23         is necessary.
24
25         Notes:
26
27         - Since the weak pointer methods need to be able to downcast to the abstract base class,
28           observers need to inherit publically (rather than privately) from those base classes.
29         - Media element Models should compose EventListener rather than inheriting from it, since
30           EventListener has its own RefCount.
31         - WeakPtrs can't be held in HashSets (because they change value, and therefore hash, when
32           their underlying object is destroyed), so clients should be stored in a Vector instead.
33         - Interfaces should be given all required Refs at creation time, so that they can store
34           those parameters as Refs instead of RefPtrs.
35
36         * platform/cocoa/PlaybackSessionInterface.h:
37         (WebCore::PlaybackSessionInterface::~PlaybackSessionInterface): Deleted.
38         * platform/cocoa/PlaybackSessionModel.h:
39         (WebCore::PlaybackSessionModel::ref):
40         (WebCore::PlaybackSessionModel::deref):
41         (WebCore::PlaybackSessionModel::~PlaybackSessionModel): Deleted.
42         * platform/cocoa/PlaybackSessionModelMediaElement.h:
43         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
44         (WebCore::PlaybackSessionModelMediaElement::PlaybackSessionModelMediaElement):
45         (WebCore::PlaybackSessionModelMediaElement::~PlaybackSessionModelMediaElement):
46         (WebCore::PlaybackSessionModelMediaElement::setMediaElement):
47         (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
48         (WebCore::PlaybackSessionModelMediaElement::addClient):
49         (WebCore::PlaybackSessionModelMediaElement::removeClient):
50         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionOptions):
51         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionIndices):
52         (WebCore::PlaybackSessionModelMediaElement::handleEvent): Deleted.
53         * platform/cocoa/VideoFullscreenChangeObserver.h:
54         (WebCore::VideoFullscreenChangeObserver::~VideoFullscreenChangeObserver): Deleted.
55         * platform/cocoa/VideoFullscreenModel.h:
56         (WebCore::VideoFullscreenModel::ref):
57         (WebCore::VideoFullscreenModel::deref):
58         (WebCore::VideoFullscreenModel::~VideoFullscreenModel): Deleted.
59         * platform/cocoa/VideoFullscreenModelVideoElement.h:
60         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
61         (VideoFullscreenModelVideoElement::VideoFullscreenModelVideoElement):
62         (VideoFullscreenModelVideoElement::setVideoElement):
63         (VideoFullscreenModelVideoElement::addClient):
64         (VideoFullscreenModelVideoElement::removeClient):
65         (VideoFullscreenModelVideoElement::setHasVideo):
66         (VideoFullscreenModelVideoElement::setVideoDimensions):
67         (VideoFullscreenModelVideoElement::willEnterPictureInPicture):
68         (VideoFullscreenModelVideoElement::didEnterPictureInPicture):
69         (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture):
70         (VideoFullscreenModelVideoElement::willExitPictureInPicture):
71         (VideoFullscreenModelVideoElement::didExitPictureInPicture):
72         (VideoFullscreenModelVideoElement::handleEvent): Deleted.
73         * platform/ios/PlaybackSessionInterfaceAVKit.h:
74         (WebCore::PlaybackSessionInterfaceAVKit::create):
75         (WebCore::PlaybackSessionInterfaceAVKit::playbackSessionModel const):
76         (): Deleted.
77         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
78         (WebCore::PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit):
79         (WebCore::PlaybackSessionInterfaceAVKit::~PlaybackSessionInterfaceAVKit):
80         (WebCore::PlaybackSessionInterfaceAVKit::invalidate): Deleted.
81         * platform/ios/VideoFullscreenInterfaceAVKit.h:
82         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
83         (-[WebAVPlayerLayer layoutSublayers]):
84         (-[WebAVPlayerLayer resolveBounds]):
85         (-[WebAVPlayerLayer setVideoGravity:]):
86         (VideoFullscreenInterfaceAVKit::create):
87         (VideoFullscreenInterfaceAVKit::VideoFullscreenInterfaceAVKit):
88         (VideoFullscreenInterfaceAVKit::~VideoFullscreenInterfaceAVKit):
89         (VideoFullscreenInterfaceAVKit::setVideoFullscreenChangeObserver):
90         (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
91         (VideoFullscreenInterfaceAVKit::setupFullscreen):
92         (VideoFullscreenInterfaceAVKit::presentingViewController):
93         (VideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen):
94         (VideoFullscreenInterfaceAVKit::preparedToExitFullscreen):
95         (VideoFullscreenInterfaceAVKit::willStartPictureInPicture):
96         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
97         (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture):
98         (VideoFullscreenInterfaceAVKit::willStopPictureInPicture):
99         (VideoFullscreenInterfaceAVKit::didStopPictureInPicture):
100         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
101         (VideoFullscreenInterfaceAVKit::doSetup):
102         (VideoFullscreenInterfaceAVKit::setMode):
103         (VideoFullscreenInterfaceAVKit::clearMode):
104         (VideoFullscreenInterfaceAVKit::setVideoFullscreenModel): Deleted.
105         (VideoFullscreenInterfaceAVKit::invalidate): Deleted.
106         * platform/ios/WebAVPlayerController.h:
107         * platform/ios/WebAVPlayerController.mm:
108         (-[WebAVPlayerController delegate]):
109         (-[WebAVPlayerController playbackSessionInterface]):
110         (-[WebAVPlayerController setPlaybackSessionInterface:]):
111         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
112         (VideoFullscreenControllerContext::didCleanupFullscreen):
113         (VideoFullscreenControllerContext::addClient):
114         (VideoFullscreenControllerContext::removeClient):
115         (VideoFullscreenControllerContext::willEnterPictureInPicture):
116         (VideoFullscreenControllerContext::didEnterPictureInPicture):
117         (VideoFullscreenControllerContext::failedToEnterPictureInPicture):
118         (VideoFullscreenControllerContext::willExitPictureInPicture):
119         (VideoFullscreenControllerContext::didExitPictureInPicture):
120         (VideoFullscreenControllerContext::setUpFullscreen):
121         * platform/mac/PlaybackSessionInterfaceMac.h:
122         * platform/mac/PlaybackSessionInterfaceMac.mm:
123         (WebCore::PlaybackSessionInterfaceMac::create):
124         (WebCore::PlaybackSessionInterfaceMac::PlaybackSessionInterfaceMac):
125         (WebCore::PlaybackSessionInterfaceMac::playbackSessionModel const):
126         (WebCore::PlaybackSessionInterfaceMac::rateChanged):
127         (WebCore::PlaybackSessionInterfaceMac::beginScrubbing):
128         (WebCore::PlaybackSessionInterfaceMac::endScrubbing):
129         (WebCore::PlaybackSessionInterfaceMac::setPlayBackControlsManager):
130         (WebCore::PlaybackSessionInterfaceMac::updatePlaybackControlsManagerTiming):
131         (WebCore::PlaybackSessionInterfaceMac::~PlaybackSessionInterfaceMac): Deleted.
132         (WebCore::PlaybackSessionInterfaceMac::invalidate): Deleted.
133         * platform/mac/VideoFullscreenInterfaceMac.h:
134         (WebCore::VideoFullscreenInterfaceMac::create):
135         (WebCore::VideoFullscreenInterfaceMac::videoFullscreenModel const):
136         (WebCore::VideoFullscreenInterfaceMac::playbackSessionModel const):
137         (WebCore::VideoFullscreenInterfaceMac::videoFullscreenChangeObserver const):
138         * platform/mac/VideoFullscreenInterfaceMac.mm:
139         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]):
140         (-[WebVideoFullscreenInterfaceMacObjC boundsDidChangeForVideoViewContainer:]):
141         (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]):
142         (-[WebVideoFullscreenInterfaceMacObjC pipActionPlay:]):
143         (-[WebVideoFullscreenInterfaceMacObjC pipActionPause:]):
144         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]):
145         (WebCore::VideoFullscreenInterfaceMac::VideoFullscreenInterfaceMac):
146         (WebCore::VideoFullscreenInterfaceMac::~VideoFullscreenInterfaceMac):
147         (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenChangeObserver):
148         (WebCore::VideoFullscreenInterfaceMac::setMode):
149         (WebCore::VideoFullscreenInterfaceMac::clearMode):
150         (WebCore::VideoFullscreenInterfaceMac::invalidate):
151         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitPiP):
152         (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenModel): Deleted.
153         * platform/mac/WebPlaybackControlsManager.mm:
154         (-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]):
155         (-[WebPlaybackControlsManager setCurrentAudioTouchBarMediaSelectionOption:]):
156         (-[WebPlaybackControlsManager setCurrentLegibleTouchBarMediaSelectionOption:]):
157         (-[WebPlaybackControlsManager togglePlayback]):
158         (-[WebPlaybackControlsManager setPlaying:]):
159         (-[WebPlaybackControlsManager isPlaying]):
160         (-[WebPlaybackControlsManager togglePictureInPicture]):
161
162 2018-09-28  Chris Dumez  <cdumez@apple.com>
163
164         Drop iOS specific quirk in SettingsBase::scriptEnabledChanged()
165         https://bugs.webkit.org/show_bug.cgi?id=190077
166         <rdar://problem/44812613>
167
168         Reviewed by Zalan Bujtas.
169
170         Drop iOS specific quirk in SettingsBase::scriptEnabledChanged() that would dirty style after the
171         "JavaScriptEnabled" setting's state is toggled. I do not see a good reason to do this given that
172         scripts would not get executed until a reload.
173
174         If we find out after dropping this that this is actually useful for some reason, then we can
175         always bring it back and consider making this non-iOS specific, as well as documenting why this
176         it is needed.
177
178         * page/Settings.yaml:
179         * page/SettingsBase.cpp:
180         (WebCore::SettingsBase::scriptEnabledChanged): Deleted.
181         * page/SettingsBase.h:
182
183 2018-09-27  Basuke Suzuki  <Basuke.Suzuki@sony.com>
184
185         [Curl] Fix priority issue with multiple cookies with different level of path.
186         https://bugs.webkit.org/show_bug.cgi?id=189920
187
188         Reviewed by Fujii Hironori.
189
190         When multiple cookies are stored in the database for same site, the priority of
191         multiple cookies which matches path criteria was not defined. The backend
192         implementation `sqlite` then returns the first matching result, which is the one
193         stored earlier.
194
195         Test: http/tests/cookies/cookie-with-multiple-level-path.html
196
197         * platform/network/curl/CookieJarDB.cpp:
198         (WebCore::CookieJarDB::searchCookies):
199
200 2018-09-26  Ryosuke Niwa  <rniwa@webkit.org>
201
202         Use enum class in createMarkup arguments
203         https://bugs.webkit.org/show_bug.cgi?id=190028
204
205         Reviewed by Wenson Hsieh.
206
207         Replaced enums used by createMarkup with equivalent enum classes: EChildrenOnly with SerializedNodes,
208         EAbsoluteURLs with ResolveURLs, and EFragmentSerialization with SerializationSyntax.
209
210         Also replaced the boolean convertBlocksToInlines with an enum class of the same name.
211
212         Finally, renamed the createMarkup variant which doesn't serialize style and used for innerHTML and XMLSerializer
213         to serializeFragment.
214
215         * dom/Element.cpp:
216         (WebCore::Element::innerHTML const):
217         (WebCore::Element::outerHTML const):
218         * dom/ShadowRoot.cpp:
219         (WebCore::ShadowRoot::innerHTML const):
220         * editing/CompositeEditCommand.cpp:
221         (WebCore::CompositeEditCommand::moveParagraphs):
222         * editing/HTMLInterchange.h:
223         (WebCore::AnnotateForInterchange): Renamed from EAnnotateForInterchange.
224         * editing/MarkupAccumulator.cpp:
225         (WebCore::MarkupAccumulator::MarkupAccumulator):
226         (WebCore::MarkupAccumulator::serializeNodes):
227         (WebCore::MarkupAccumulator::serializeNodesWithNamespaces):
228         (WebCore::MarkupAccumulator::resolveURLIfNeeded const):
229         * editing/MarkupAccumulator.h:
230         (WebCore::MarkupAccumulator::inXMLFragmentSerialization const):
231         * editing/ReplaceRangeWithTextCommand.cpp:
232         (WebCore::ReplaceRangeWithTextCommand::inputEventDataTransfer const):
233         * editing/ReplaceSelectionCommand.cpp:
234         (WebCore::ReplaceSelectionCommand::willApplyCommand):
235         * editing/SpellingCorrectionCommand.cpp:
236         (WebCore::SpellingCorrectionCommand::inputEventDataTransfer const):
237         * editing/cocoa/EditorCocoa.mm:
238         (WebCore::Editor::selectionInHTMLFormat):
239         * editing/cocoa/WebContentReaderCocoa.mm:
240         (WebCore::WebContentMarkupReader::readRTFD):
241         (WebCore::WebContentMarkupReader::readRTF):
242         * editing/gtk/EditorGtk.cpp:
243         (WebCore::Editor::writeImageToPasteboard):
244         (WebCore::Editor::writeSelectionToPasteboard):
245         * editing/markup.cpp:
246         (WebCore::StyledMarkupAccumulator::StyledMarkupAccumulator):
247         (WebCore::StyledMarkupAccumulator::serializeNodes):
248         (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
249         (WebCore::highestAncestorToWrapMarkup):
250         (WebCore::createMarkupInternal):
251         (WebCore::createMarkup):
252         (WebCore::sanitizedMarkupForFragmentInDocument):
253         (WebCore::serializeFragment): Renamed from createMarkup. This is used for innerHTML and XMLSerializer,
254         which faithfully serializes the fragment without any computed style as inline styles.
255         (WebCore::documentTypeString):
256         (WebCore::createFullMarkup): Deleted two varinats used in WebKitLegacy.
257         * editing/markup.h:
258         (WebCore::ResolveURLs): Renamed from EAbsoluteURLs.
259         (WebCore::ConvertBlocksToInlines): Added.
260         (WebCore::SerializedNodes): Renamed from EChildrenOnly.
261         (WebCore::SerializationSyntax): Renamed from EFragmentSerialization.
262         * editing/wpe/EditorWPE.cpp:
263         (WebCore::Editor::writeSelectionToPasteboard):
264         * inspector/DOMEditor.cpp:
265         * inspector/agents/InspectorDOMAgent.cpp:
266         (WebCore::InspectorDOMAgent::getOuterHTML):
267         * loader/archive/cf/LegacyWebArchive.cpp:
268         (WebCore::LegacyWebArchive::create):
269         (WebCore::LegacyWebArchive::createFromSelection):
270         * page/PageSerializer.cpp:
271         (WebCore::PageSerializer::SerializerMarkupAccumulator::SerializerMarkupAccumulator):
272         (WebCore::PageSerializer::serializeFrame):
273         * page/win/DragControllerWin.cpp:
274         (WebCore::DragController::declareAndWriteDragImage):
275         * Source/WebCore/platform/win/PasteboardWin.cpp:
276         (WebCore::Pasteboard::writeRangeToDataObject):
277         (WebCore::Pasteboard::writeSelection):
278         * xml/XMLHttpRequest.cpp:
279         (WebCore::XMLHttpRequest::send):
280         * xml/XMLSerializer.cpp:
281         (WebCore::XMLSerializer::serializeToString):
282         * xml/XSLTProcessorLibxslt.cpp:
283         (WebCore::xsltStylesheetPointer):
284         (WebCore::xmlDocPtrFromNode):
285
286 2018-09-27  John Wilander  <wilander@apple.com>
287
288         Resource Load Statistics: Non-redirected top frame navigation should not get captured in statistics
289         https://bugs.webkit.org/show_bug.cgi?id=190055
290         <rdar://problem/44843460>
291
292         Reviewed by Chris Dumez.
293
294         Test: http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html
295
296         * loader/ResourceLoadStatistics.cpp:
297         (WebCore::ResourceLoadStatistics::decode):
298             Corrects legacy statistics for frames and triggers a re-classification.
299
300 2018-09-27  Jer Noble  <jer.noble@apple.com>
301
302         Unreviewed watchOS build fix; Fix declaration for ports which USE(ENCRYPTED_MEDIA) but don't
303         HAVE(AVCONTENTKEYSESSION).
304
305         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
306
307 2018-09-27  Justin Michaud  <justin_michaud@apple.com>
308
309         Remove duplicate CSS Properties and Values feature on status page
310         https://bugs.webkit.org/show_bug.cgi?id=189909
311
312         Reviewed by Simon Fraser.
313
314         Update CSS properties and values api feature in features.json
315
316         * features.json:
317
318 2018-09-27  Jer Noble  <jer.noble@apple.com>
319
320         MediaPlayer should have mediaPlayerWaitingForKeyChanged() / bool waitingForKey() accessor
321         https://bugs.webkit.org/show_bug.cgi?id=189951
322
323         Reviewed by Eric Carlson.
324
325         In order to implement the "Resume Playback" section of EME, part 4, we need to be able
326         to query whether the MediaPlayer is still waiting for a key after attemptToDecrypt()
327         has been called. Currently this involves no behavioral changes, as all modern EME ports
328         will still just notify the media element that they no longer need keys after one has
329         been added, but future ports may be able to wait for multiple keys before reporting
330         that it is no longer waiting for keys.
331
332         * html/HTMLMediaElement.cpp:
333         (WebCore::HTMLMediaElement::mediaPlayerWaitingForKeyChanged):
334         (WebCore::HTMLMediaElement::attemptToResumePlaybackIfNecessary):
335         (WebCore::HTMLMediaElement::mediaPlayerWaitingForKey): Deleted.
336         * html/HTMLMediaElement.h:
337         * platform/graphics/MediaPlayer.cpp:
338         (WebCore::MediaPlayer::waitingForKeyChanged):
339         (WebCore::MediaPlayer::waitingForKey const):
340         (WebCore::MediaPlayer::waitingForKey): Deleted.
341         * platform/graphics/MediaPlayer.h:
342         (WebCore::MediaPlayerClient::mediaPlayerWaitingForKeyChanged):
343         (WebCore::MediaPlayerClient::mediaPlayerWaitingForKey): Deleted.
344         * platform/graphics/MediaPlayerPrivate.h:
345         (WebCore::MediaPlayerPrivateInterface::waitingForKey const):
346         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
347         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
348         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
349         (WebCore::MediaPlayerPrivateAVFoundationObjC::attemptToDecryptWithInstance):
350         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
351         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
352         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::attemptToDecryptWithInstance):
353         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitingForKey const):
354         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitingForKeyChanged):
355         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::initializationDataEncountered):
356         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
357         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
358         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
359         (WebCore::SourceBufferPrivateAVFObjC::attemptToDecrypt):
360         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
361         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
362         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
363         (WebCore::MediaPlayerPrivateGStreamerBase::reportWaitingForKey):
364         (WebCore::MediaPlayerPrivateGStreamerBase::setWaitingForKey):
365         (WebCore::MediaPlayerPrivateGStreamerBase::waitingForKey const):
366         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
367         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
368         (webkitMediaCommonEncryptionDecryptSinkEventHandler):
369
370 2018-09-27  Alicia Boya García  <aboya@igalia.com>
371
372         [MSE] Fix unwanted sample erase from the decode queue
373         https://bugs.webkit.org/show_bug.cgi?id=180643
374
375         Reviewed by Jer Noble.
376
377         Test: media/media-source/media-source-append-acb-no-frame-lost.html
378
379         This bug reproduced when unordered appends were made. For instance, if
380         the application appended [0, 10) and then [20, 30), the frame at 20
381         would be wrongly discarded from the decode queue.
382
383         Later the application could append [10, 20) and the gap at [20, 21)
384         would persist in the decode queue, even if the frame remained in the
385         track buffer table.
386
387         Thanks to Daniel Zhang for reporting the issue.
388
389         * Modules/mediasource/SourceBuffer.cpp:
390         (WebCore::SourceBuffer::provideMediaData):
391
392 2018-09-27  Alex Christensen  <achristensen@webkit.org>
393
394         URLParser should use TextEncoding through an abstract class
395         https://bugs.webkit.org/show_bug.cgi?id=190027
396
397         Reviewed by Andy Estes.
398
399         URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings.
400         There are 3 call sites that specify the TextEncoding to use from the Document, and even those call sites use a UTF encoding most of the time.
401         All other URL parsing is done using a well-optimized path which assumes UTF-8 encoding and uses macros from ICU headers, not a TextEncoding.
402         Moving the logic in this way breaks URL and URLParser's dependency on TextEncoding, which makes it possible to use in a lower-level project
403         without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore.
404
405         There is no observable change in behavior.  There is now one virtual function call in a code path in URLParser that is not performance-sensitive,
406         and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit.
407
408         * css/parser/CSSParserContext.h:
409         (WebCore::CSSParserContext::completeURL const):
410         * css/parser/CSSParserIdioms.cpp:
411         (WebCore::completeURL):
412         * dom/Document.cpp:
413         (WebCore::Document::completeURL const):
414         * html/HTMLBaseElement.cpp:
415         (WebCore::HTMLBaseElement::href const):
416         Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document.
417         * loader/FormSubmission.cpp:
418         (WebCore::FormSubmission::create):
419         * loader/TextResourceDecoder.cpp:
420         (WebCore::TextResourceDecoder::encodingForURLParsing):
421         * loader/TextResourceDecoder.h:
422         * platform/URL.cpp:
423         (WebCore::URL::URL):
424         * platform/URL.h:
425         (WebCore::URLTextEncoding::~URLTextEncoding):
426         * platform/URLParser.cpp:
427         (WebCore::URLParser::encodeNonUTF8Query):
428         (WebCore::URLParser::copyURLPartsUntil):
429         (WebCore::URLParser::URLParser):
430         (WebCore::URLParser::parse):
431         (WebCore::URLParser::encodeQuery): Deleted.
432         A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding.
433         Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding.
434         * platform/URLParser.h:
435         (WebCore::URLParser::URLParser):
436         * platform/text/TextEncoding.cpp:
437         (WebCore::UTF7Encoding):
438         (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const):
439         (WebCore::ASCIIEncoding):
440         (WebCore::Latin1Encoding):
441         (WebCore::UTF16BigEndianEncoding):
442         (WebCore::UTF16LittleEndianEncoding):
443         (WebCore::UTF8Encoding):
444         (WebCore::WindowsLatin1Encoding):
445         (WebCore::TextEncoding::encodingForFormSubmission const): Deleted.
446         Use NeverDestroyed because TextEncoding now has a virtual destructor.
447         * platform/text/TextEncoding.h:
448         Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both.
449
450 2018-09-27  John Wilander  <wilander@apple.com>
451
452         Resource Load Statistics: Remove temporary compatibility fix for auto-dismiss popups
453         https://bugs.webkit.org/show_bug.cgi?id=189980
454         <rdar://problem/44780645>
455
456         Reviewed by Alex Christensen.
457
458         Test: http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss.html
459
460         The change in https://bugs.webkit.org/show_bug.cgi?id=183620 was a temporary
461         compatibility fix as explained in:
462         https://webkit.org/blog/8311/intelligent-tracking-prevention-2-0/. We should
463         remove it.
464
465         Most of these changes remove the parameter isTriggeredByUserGesture since it's no longer needed.
466
467         * loader/ResourceLoadObserver.cpp:
468         (WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback):
469         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
470         (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener):
471         (WebCore::ResourceLoadObserver::logWindowCreation): Deleted.
472         * loader/ResourceLoadObserver.h:
473         * page/DOMWindow.cpp:
474         (WebCore::DOMWindow::createWindow):
475             Now no longer logs anything to ResourceLoadObserver.
476
477 2018-09-27  Ryan Haddad  <ryanhaddad@apple.com>
478
479         Unreviewed, rolling out r236557.
480
481         Really roll out r236557 this time because it breaks internal
482         builds.
483
484         Reverted changeset:
485
486         "Add VP8 support to WebRTC"
487         https://bugs.webkit.org/show_bug.cgi?id=189976
488         https://trac.webkit.org/changeset/236557
489
490 2018-09-27  Chris Dumez  <cdumez@apple.com>
491
492         Fragment should be stripped from document URL during document.open() URL propagation
493         https://bugs.webkit.org/show_bug.cgi?id=189374
494         <rdar://problem/44282736>
495
496         Reviewed by Alex Christensen.
497
498         Strip the Document URL fragment during document.open() URL propagation if the entry document
499         is not the current document, as per:
500         - https://html.spec.whatwg.org/#document-open-steps (Step 11.2.)
501
502         No new tests, rebaselined existing test.
503
504         * dom/Document.cpp:
505         (WebCore::Document::open):
506
507 2018-09-27  Youenn Fablet  <youenn@apple.com>
508
509         Add VP8 support to WebRTC
510         https://bugs.webkit.org/show_bug.cgi?id=189976
511
512         Reviewed by Eric Carlson.
513
514         Add a runtime flag to control activation of VP8 codec.
515         Bind this runtime flag to the video codec factories.
516         Test: webrtc/video-mute-vp8.html
517
518         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
519         (WebCore::createLibWebRTCPeerConnectionBackend):
520         * page/RuntimeEnabledFeatures.h:
521         (WebCore::RuntimeEnabledFeatures::webRTCVP8CodecEnabled const):
522         (WebCore::RuntimeEnabledFeatures::setWebRTCVP8CodecEnabled):
523         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
524         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
525         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
526         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
527         * testing/Internals.cpp:
528         (WebCore::Internals::resetToConsistentState):
529         Enable VP8 codec for tests.
530
531 2018-09-27  Chris Dumez  <cdumez@apple.com>
532
533         Crash under WebCore::deleteCookiesForHostnames()
534         https://bugs.webkit.org/show_bug.cgi?id=190040
535         <rdar://problem/38020368>
536
537         Reviewed by Alex Christensen.
538
539         Update NetworkStorageSession::deleteCookiesForHostnames() to properly deal with the fact
540         that NSHTTPCookie.domain can return nil.
541
542         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
543         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
544
545 2018-09-27  Youenn Fablet  <youenn@apple.com>
546
547         Use kCVPixelFormatType_420YpCbCr8Planar for capturing frames
548         https://bugs.webkit.org/show_bug.cgi?id=190014
549
550         Reviewed by Eric Carlson.
551
552         On Mac, rely on the monoplanar format which can be displayed without any issue.
553         Once rendering is fixed, we should change it back to biplanar as it is closer to what libwebrtc consumes.
554         Covered by manual testing.
555
556         * platform/mediastream/mac/AVVideoCaptureSource.mm:
557         (WebCore::avVideoCapturePixelBufferFormat):
558         (WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset):
559         (WebCore::AVVideoCaptureSource::setupCaptureSession):
560         (WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
561
562 2018-09-27  Andy Estes  <aestes@apple.com>
563
564         [Apple Pay] Support granular errors in PaymentDetailsUpdate
565         https://bugs.webkit.org/show_bug.cgi?id=189938
566
567         Reviewed by Youenn Fablet.
568
569         Implemented the shippingAddressErrors, payerErrors, and paymentMethodErrors properties on
570         PaymentDetailsUpdate, as specified in the Payment Request API W3C Editor's Draft of
571         26 September 2018.
572
573         When these errors are specified in a PaymentDetailsUpdate, map them to PaymentErrors. For
574         shippingAddressErrors and payerErrors, we use the "shippingContactInvalid" code and a
575         contact field that matches the shippingAddressError or payerError property specified.
576
577         For paymentMethodErrors, we interpret this as a sequence of ApplePayErrors, which are
578         converted to PaymentErrors as in Apple Pay JS.
579
580         Tests: http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrors.https.html
581                http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrorsV3.https.html
582
583         * DerivedSources.make: Removed some tabs and added new .idl files.
584         * Modules/applepay/ApplePayError.idl: Moved ApplePayErrorCode and ApplePayErrorContactField
585         into their own .idl files so they can be used in MockPaymentError.
586         * Modules/applepay/ApplePayErrorCode.h: Added.
587         * Modules/applepay/ApplePayErrorCode.idl: Added.
588         * Modules/applepay/ApplePayErrorContactField.h: Added.
589         * Modules/applepay/ApplePayErrorContactField.idl: Added.
590
591         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
592         (WebCore::appendShippingContactInvalidError): Appended a "shippingContactInvalid"
593         PaymentError to errors if the message is non-null.
594         (WebCore::ApplePayPaymentHandler::computeErrors const):
595         (WebCore::ApplePayPaymentHandler::detailsUpdated):
596         (WebCore::ApplePayPaymentHandler::shippingAddressUpdated): Computed a vector of PaymentErrors
597         based on shippingAddressErrors, payerErrors, and paymentMethodErrors.
598
599         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
600
601         * Modules/paymentrequest/PaymentDetailsUpdate.h:
602         * Modules/paymentrequest/PaymentDetailsUpdate.idl: Defined shippingAddressErrors,
603         payerErrors, and paymentMethodErrors.
604
605         * Modules/paymentrequest/PaymentHandler.h:
606         * Modules/paymentrequest/PaymentRequest.cpp:
607         (WebCore::PaymentRequest::paymentMethodChanged):
608         (WebCore::PaymentRequest::settleDetailsPromise): Passed shippingAddressErrors, payerErrors,
609         and paymentMethodErrors to the payment handler.
610
611         * SourcesCocoa.txt:
612         * WebCore.xcodeproj/project.pbxproj:
613
614         * testing/MockPaymentCoordinator.cpp:
615         (WebCore::MockPaymentCoordinator::completeShippingContactSelection): Stored errors in m_errors.
616         * testing/MockPaymentCoordinator.h:
617         * testing/MockPaymentCoordinator.idl: Added an errors attribute.
618
619         * testing/MockPaymentError.h: Added.
620         * testing/MockPaymentError.idl: Added.
621
622 2018-09-27  Alex Christensen  <achristensen@webkit.org>
623
624         URLWithUserTypedString should return nil for URLs deemed to be invalid by WebCore::URL
625         https://bugs.webkit.org/show_bug.cgi?id=189979
626
627         Reviewed by Youenn Fablet.
628
629         * platform/mac/WebCoreNSURLExtras.mm:
630         (WebCore::URLWithUserTypedString):
631         (WebCore::dataForURLComponentType):
632         (WebCore::URLByRemovingComponentAndSubsequentCharacter):
633         (WebCore::URLByCanonicalizingURL):
634         (WebCore::originalURLData):
635         (WebCore::userVisibleString):
636
637 2018-09-27  Chris Dumez  <cdumez@apple.com>
638
639         document.open() should not propagate URLs to non-fully active documents
640         https://bugs.webkit.org/show_bug.cgi?id=189375
641         <rdar://problem/44282755>
642
643         Reviewed by Youenn Fablet.
644
645         Update our document.open() to not propagate URLs to non-fully active documents, as per:
646         - https://html.spec.whatwg.org/#document-open-steps (Step 11)
647
648         A "fully active" document is defined by at:
649         - https://html.spec.whatwg.org/#fully-active
650
651         No new tests, rebaselined existing test.
652
653         * dom/Document.cpp:
654         (WebCore::Document::open):
655         (WebCore::Document::isFullyActive const):
656         * dom/Document.h:
657         * dom/Document.idl:
658
659 2018-09-27  Alicia Boya García  <aboya@igalia.com>
660
661         [MSE][GStreamer] Use sentinel buffer to detect end of append
662         https://bugs.webkit.org/show_bug.cgi?id=189924
663
664         Reviewed by Philippe Normand.
665
666         This patch introduces a new mechanism to detect when an append has
667         been consumed completely by the demuxer. It takes advantage of the
668         fact that buffer pushing is synchronous: both the appsrc and the
669         demuxer live in the same streaming thread. When appsrc pushes a
670         buffer, it's actually making a qtdemux function call (it calls its
671         "chain" function). The demuxer will return from that call when it has
672         finished processing that buffer; only then the control returns to
673         appsrc, that can push the next buffer.
674
675         By pushing an additional buffer and capturing it in a probe we can
676         detect reliably when the previous buffer has been processed.
677         Because the pipeline only has one thread, at this point no more frames
678         can arrive to the appsink.
679
680         This replaces the old method of detecting end of append which relied
681         on the `need-data` event, which is more difficult to handle correctly
682         because it fires whenever the appsrc is empty (or below a given
683         level), which also happens when a buffer has not been pushed yet or
684         in response to a flush.
685
686         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
687         (WebCore::EndOfAppendMeta::init):
688         (WebCore::EndOfAppendMeta::transform):
689         (WebCore::EndOfAppendMeta::free):
690         (WebCore::AppendPipeline::staticInitialization):
691         (WebCore::AppendPipeline::AppendPipeline):
692         (WebCore::AppendPipeline::~AppendPipeline):
693         (WebCore::AppendPipeline::appsrcEndOfAppendCheckerProbe):
694         (WebCore::AppendPipeline::handleApplicationMessage):
695         (WebCore::AppendPipeline::handleEndOfAppend):
696         (WebCore::AppendPipeline::consumeAppsinkAvailableSamples):
697         (WebCore::AppendPipeline::resetPipeline):
698         (WebCore::AppendPipeline::pushNewBuffer):
699         (WebCore::AppendPipeline::handleAppsrcNeedDataReceived): Deleted.:
700         (WebCore::AppendPipeline::handleAppsrcAtLeastABufferLeft): Deleted.
701         (WebCore::AppendPipeline::checkEndOfAppend): Deleted.
702         (WebCore::AppendPipeline::setAppsrcDataLeavingProbe): Deleted.
703         (WebCore::AppendPipeline::removeAppsrcDataLeavingProbe): Deleted.
704         (WebCore::AppendPipeline::reportAppsrcAtLeastABufferLeft): Deleted.
705         (WebCore::AppendPipeline::reportAppsrcNeedDataReceived): Deleted.
706         (WebCore::appendPipelineAppsrcDataLeaving): Deleted.
707         (WebCore::appendPipelineAppsrcNeedData): Deleted.
708         * platform/graphics/gstreamer/mse/AppendPipeline.h:
709
710 2018-09-27  Chris Dumez  <cdumez@apple.com>
711
712         The WebContent process should not process incoming IPC while waiting for a sync IPC reply
713         https://bugs.webkit.org/show_bug.cgi?id=184183
714         <rdar://problem/36800576>
715
716         Reviewed by Ryosuke Niwa.
717
718         Drop test infrastructure for the DoNotProcessIncomingMessagesWhenWaitingForSyncReply IPC::SendOption
719         given that this SendOption was removed from this patch.
720
721         * page/ChromeClient.h:
722         * testing/Internals.cpp:
723         * testing/Internals.h:
724         * testing/Internals.idl:
725
726 2018-09-27  Philippe Normand  <pnormand@igalia.com>
727
728         Unreviewed, GTK Ubuntu LTS build fix attempt after r236396.
729
730         * platform/graphics/gstreamer/GStreamerCommon.h:
731
732 2018-09-27  Antoine Quint  <graouts@apple.com>
733
734         [Web Animations] Turn Web Animations with CSS integration on
735         https://bugs.webkit.org/show_bug.cgi?id=184819
736         <rdar://problem/39597337>
737
738         Reviewed by Dean Jackson.
739
740         * page/RuntimeEnabledFeatures.h:
741
742 2018-09-26  YUHAN WU  <yuhan_wu@apple.com>
743
744         Video track clone cannot preserve original property
745         https://bugs.webkit.org/show_bug.cgi?id=189872
746         <rdar://problem/44706579>
747
748         Reviewed by Youenn Fablet.
749
750         Fix the issue that the cloned track created by canvas.captureStream().getVideoTracks() cannot keep some attributes, such as enabled.
751         Updated a testcase expected result:
752         LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/MediaStreamTrack-contentHint.html
753
754         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
755         (WebCore::CanvasCaptureMediaStreamTrack::CanvasCaptureMediaStreamTrack):
756         (WebCore::CanvasCaptureMediaStreamTrack::create):
757         (WebCore::CanvasCaptureMediaStreamTrack::clone):
758         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
759         * Modules/mediastream/MediaStreamTrack.h:
760
761 2018-09-26  Alex Christensen  <achristensen@webkit.org>
762
763         Unreviewed, rolling out r236524.
764
765         Broke API tests
766
767         Reverted changeset:
768
769         "URLWithUserTypedString should return nil for URLs deemed to
770         be invalid by WebCore::URL"
771         https://bugs.webkit.org/show_bug.cgi?id=189979
772         https://trac.webkit.org/changeset/236524
773
774 2018-09-26  Per Arne Vollan  <pvollan@apple.com>
775
776         WebVTT cue alignment broken
777         https://bugs.webkit.org/show_bug.cgi?id=190004
778
779         Reviewed by Eric Carlson.
780
781         If the position of the queue is unspecified, the default value of 50 was used, which is incorrect.
782         This patch also updates the API according to https://w3c.github.io/webvtt/#the-vttcue-interface.
783         The position attribute should not be a double, but either a double or the "auto" keyword. Parts
784         of this patch is inspired by the associated code in the Chromium project.
785
786         Test: media/track/track-cue-left-align.html
787
788         * html/track/TextTrackCueGeneric.cpp:
789         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
790         (WebCore::TextTrackCueGeneric::setPosition):
791         * html/track/TextTrackCueGeneric.h:
792         * html/track/VTTCue.cpp:
793         (WebCore::VTTCueBox::applyCSSProperties):
794         (WebCore::VTTCue::initialize):
795         (WebCore::VTTCue::position const):
796         (WebCore::VTTCue::setPosition):
797         (WebCore::VTTCue::textPositionIsAuto const):
798         (WebCore::VTTCue::calculateComputedTextPosition const):
799         (WebCore::VTTCue::calculateDisplayParameters):
800         (WebCore::VTTCue::toJSON const):
801         * html/track/VTTCue.h:
802         (WebCore::VTTCue::position const): Deleted.
803         * html/track/VTTCue.idl:
804
805 2018-09-26  James Savage  <james.savage@apple.com>
806
807         Allow override of viewport configuration.
808         https://bugs.webkit.org/show_bug.cgi?id=188772.
809         <rdar://problem/43538892>.
810
811         Reviewed by Simon Fraser.
812
813         * page/Settings.yaml:
814         * page/ViewportConfiguration.cpp:
815         (WebCore::ViewportConfiguration::nativeWebpageParameters): Provide a viewport configuration
816         similar to width=device-width, with initial scale set to 1.
817         * page/ViewportConfiguration.h:
818
819 2018-09-26  Alex Christensen  <achristensen@webkit.org>
820
821         URLs with mismatched surrogate pairs in the host should fail to parse
822         https://bugs.webkit.org/show_bug.cgi?id=190005
823
824         Reviewed by Chris Dumez.
825
826         Elsewhere in the URLParser, when we encounter mismatched surrogate pairs we use the replacement character,
827         but that just fails later on in domainToASCII, so we may as well just fail.
828         This behavior matches Chrome, but is unclear in the spec.  There are no valid uses of hosts containing mismatched surrogate pairs.
829         Covered by new API tests.
830
831         * platform/URLParser.cpp:
832         (WebCore::URLParser::parseHostAndPort):
833
834 2018-09-26  Alex Christensen  <achristensen@webkit.org>
835
836         uidna_nameToASCII only needs a buffer capacity of 64
837         https://bugs.webkit.org/show_bug.cgi?id=190006
838
839         Reviewed by Chris Dumez.
840
841         This is specified in https://www.unicode.org/reports/tr46/#ToASCII
842         This is how Chrome and Firefox also behave with long unicode hosts.
843
844         * platform/URLParser.cpp:
845         (WebCore::URLParser::domainToASCII):
846
847 2018-09-26  Alex Christensen  <achristensen@webkit.org>
848
849         URLWithUserTypedString should return nil for URLs deemed to be invalid by WebCore::URL
850         https://bugs.webkit.org/show_bug.cgi?id=189979
851         <rdar://problem/44119696>
852
853         Reviewed by Chris Dumez.
854
855         Covered by an API test.
856
857         * platform/mac/WebCoreNSURLExtras.mm:
858         (WebCore::URLWithData):
859
860 2018-09-26  Ryosuke Niwa  <rniwa@webkit.org>
861
862         Selection should work across shadow boundary when initiated by a mouse drag
863         https://bugs.webkit.org/show_bug.cgi?id=151380
864         <rdar://problem/24363872>
865
866         Revert the change that I said I would from r236519.
867
868         * editing/VisibleSelection.cpp:
869         (WebCore::VisibleSelection::adjustSelectionToAvoidCrossingShadowBoundaries):
870
871 2018-09-26  Commit Queue  <commit-queue@webkit.org>
872
873         Unreviewed, rolling out r236511.
874         https://bugs.webkit.org/show_bug.cgi?id=190008
875
876         It is breaking some WebRTC tests (Requested by youenn on
877         #webkit).
878
879         Reverted changeset:
880
881         "[MediaStream] Clean up RealtimeMediaSource settings change
882         handling"
883         https://bugs.webkit.org/show_bug.cgi?id=189998
884         https://trac.webkit.org/changeset/236511
885
886 2018-09-26  Ryosuke Niwa  <rniwa@webkit.org>
887
888         Selection should work across shadow boundary when initiated by a mouse drag
889         https://bugs.webkit.org/show_bug.cgi?id=151380
890         <rdar://problem/24363872>
891
892         Reviewed by Antti Koivisto and Wenson Hsieh.
893
894         This patch adds the basic support for selecting content across shadow DOM boundaries to VisibleSelection,
895         which is enough to allow users to select content across shadow DOM boundaries via a mouse drag.
896
897         This is the first step in allowing users to select, copy and paste content across shadow DOM boundaries,
898         which is a serious user experience regression right now. The new behavior is disabled by default under
899         an interal debug feature flag: selectionAcrossShadowBoundariesEnabled.
900
901         Like Chrome, we are not going to support selecting editable content across shadow DOM boundaries since
902         we'd have to generalize every editing commands to make that work, and there aren't any HTML editors that
903         use shadow DOM boundaries within an editable region yet. For simplicity, we also don't support extending
904         a selection out of a shadow root which resides inside an editing region.
905
906         The keyboard based navigation & manipulation of selection as well as allowing copy & paste of content
907         across shadow DOM boundaries will be implemented by separate patches. DOMSelection will not expose this new
908         behavior either. This is tracked in the spec as https://github.com/w3c/webcomponents/issues/79
909
910         Tests: editing/selection/selection-across-shadow-boundaries-mixed-editability-1.html
911                editing/selection/selection-across-shadow-boundaries-mixed-editability-2.html
912                editing/selection/selection-across-shadow-boundaries-mixed-editability-3.html
913                editing/selection/selection-across-shadow-boundaries-mixed-editability-4.html
914                editing/selection/selection-across-shadow-boundaries-mixed-editability-5.html
915                editing/selection/selection-across-shadow-boundaries-readonly-1.html
916                editing/selection/selection-across-shadow-boundaries-readonly-2.html
917                editing/selection/selection-across-shadow-boundaries-readonly-3.html
918                editing/selection/selection-across-shadow-boundaries-user-select-all-1.html
919
920         * editing/VisibleSelection.cpp:
921         (WebCore::isInUserAgentShadowRootOrHasEditableShadowAncestor): Added.
922         (WebCore::VisibleSelection::adjustSelectionToAvoidCrossingShadowBoundaries): When the feature is enabled,
923         allow crossing shadow DOM boundaries except when either end is inside an user agent shadow root, or one of
924         its shadow includign ancestor is inside an editable region. The latter check is needed to disallow
925         an extension of a selection starting in a shadow tree inside a non-editable region inside an editable region
926         to outside the editable region. The rest of the editing code is not ready to deal with selection like that.
927         * page/Settings.yaml: Added an internal debug feature to enable this new behavior.
928
929 2018-09-26  Chris Dumez  <cdumez@apple.com>
930
931         Ignore-opens-during-unload counter of a parent should apply to its children during beforeunload event
932         https://bugs.webkit.org/show_bug.cgi?id=189376
933         <rdar://problem/44282754>
934
935         Reviewed by Ryosuke Niwa.
936
937         Make sure the Ignore-opens-during-unload counter of a parent stays incremented while we are firing the
938         beforeunload event for its descendants, as per:
939         - https://html.spec.whatwg.org/multipage/browsing-the-web.html#prompt-to-unload-a-document
940
941         No new tests, rebaselined existing tests.
942
943         * loader/FrameLoader.cpp:
944         (WebCore::FrameLoader::shouldClose):
945         (WebCore::FrameLoader::dispatchBeforeUnloadEvent):
946
947 2018-09-26  Justin Fan  <justin_fan@apple.com>
948
949         WebGL 2: Adding logging to in-progress features
950         https://bugs.webkit.org/show_bug.cgi?id=189978
951
952         Reviewed by Jon Lee.
953
954         Logging will allow us to better identify the most in-demand WebGL 2 features and prioritize our efforts.
955
956         No tests as no change in WebGL functionality.
957
958         * html/canvas/WebGL2RenderingContext.cpp: Added logging statement to every function not yet implemented.
959         (WebCore::WebGL2RenderingContext::blitFramebuffer):
960         (WebCore::WebGL2RenderingContext::framebufferTextureLayer):
961         (WebCore::WebGL2RenderingContext::invalidateFramebuffer):
962         (WebCore::WebGL2RenderingContext::invalidateSubFramebuffer):
963         (WebCore::WebGL2RenderingContext::readBuffer):
964         (WebCore::WebGL2RenderingContext::texStorage3D):
965         (WebCore::WebGL2RenderingContext::texImage2D):
966         (WebCore::WebGL2RenderingContext::texImage3D):
967         (WebCore::WebGL2RenderingContext::texSubImage2D):
968         (WebCore::WebGL2RenderingContext::texSubImage3D):
969         (WebCore::WebGL2RenderingContext::copyTexSubImage3D):
970         (WebCore::WebGL2RenderingContext::compressedTexImage2D):
971         (WebCore::WebGL2RenderingContext::compressedTexImage3D):
972         (WebCore::WebGL2RenderingContext::compressedTexSubImage3D):
973         (WebCore::WebGL2RenderingContext::getFragDataLocation):
974         (WebCore::WebGL2RenderingContext::uniform1ui):
975         (WebCore::WebGL2RenderingContext::uniform2ui):
976         (WebCore::WebGL2RenderingContext::uniform3ui):
977         (WebCore::WebGL2RenderingContext::uniform4ui):
978         (WebCore::WebGL2RenderingContext::uniform1uiv):
979         (WebCore::WebGL2RenderingContext::uniform2uiv):
980         (WebCore::WebGL2RenderingContext::uniform3uiv):
981         (WebCore::WebGL2RenderingContext::uniform4uiv):
982         (WebCore::WebGL2RenderingContext::uniformMatrix2x3fv):
983         (WebCore::WebGL2RenderingContext::uniformMatrix3x2fv):
984         (WebCore::WebGL2RenderingContext::uniformMatrix2x4fv):
985         (WebCore::WebGL2RenderingContext::uniformMatrix4x2fv):
986         (WebCore::WebGL2RenderingContext::uniformMatrix3x4fv):
987         (WebCore::WebGL2RenderingContext::uniformMatrix4x3fv):
988         (WebCore::WebGL2RenderingContext::vertexAttribI4i):
989         (WebCore::WebGL2RenderingContext::vertexAttribI4iv):
990         (WebCore::WebGL2RenderingContext::vertexAttribI4ui):
991         (WebCore::WebGL2RenderingContext::vertexAttribI4uiv):
992         (WebCore::WebGL2RenderingContext::vertexAttribIPointer):
993         (WebCore::WebGL2RenderingContext::drawRangeElements):
994         (WebCore::WebGL2RenderingContext::createQuery):
995         (WebCore::WebGL2RenderingContext::deleteQuery):
996         (WebCore::WebGL2RenderingContext::isQuery):
997         (WebCore::WebGL2RenderingContext::beginQuery):
998         (WebCore::WebGL2RenderingContext::endQuery):
999         (WebCore::WebGL2RenderingContext::getQuery):
1000         (WebCore::WebGL2RenderingContext::getQueryParameter):
1001         (WebCore::WebGL2RenderingContext::createSampler):
1002         (WebCore::WebGL2RenderingContext::deleteSampler):
1003         (WebCore::WebGL2RenderingContext::isSampler):
1004         (WebCore::WebGL2RenderingContext::bindSampler):
1005         (WebCore::WebGL2RenderingContext::samplerParameteri):
1006         (WebCore::WebGL2RenderingContext::samplerParameterf):
1007         (WebCore::WebGL2RenderingContext::getSamplerParameter):
1008         (WebCore::WebGL2RenderingContext::fenceSync):
1009         (WebCore::WebGL2RenderingContext::isSync):
1010         (WebCore::WebGL2RenderingContext::deleteSync):
1011         (WebCore::WebGL2RenderingContext::clientWaitSync):
1012         (WebCore::WebGL2RenderingContext::waitSync):
1013         (WebCore::WebGL2RenderingContext::getSyncParameter):
1014         (WebCore::WebGL2RenderingContext::createTransformFeedback):
1015         (WebCore::WebGL2RenderingContext::deleteTransformFeedback):
1016         (WebCore::WebGL2RenderingContext::isTransformFeedback):
1017         (WebCore::WebGL2RenderingContext::bindTransformFeedback):
1018         (WebCore::WebGL2RenderingContext::beginTransformFeedback):
1019         (WebCore::WebGL2RenderingContext::endTransformFeedback):
1020         (WebCore::WebGL2RenderingContext::transformFeedbackVaryings):
1021         (WebCore::WebGL2RenderingContext::getTransformFeedbackVarying):
1022         (WebCore::WebGL2RenderingContext::pauseTransformFeedback):
1023         (WebCore::WebGL2RenderingContext::resumeTransformFeedback):
1024         (WebCore::WebGL2RenderingContext::bindBufferBase):
1025         (WebCore::WebGL2RenderingContext::bindBufferRange):
1026         (WebCore::WebGL2RenderingContext::getUniformIndices):
1027         (WebCore::WebGL2RenderingContext::getUniformBlockIndex):
1028         (WebCore::WebGL2RenderingContext::getActiveUniformBlockParameter):
1029         (WebCore::WebGL2RenderingContext::getActiveUniformBlockName):
1030         (WebCore::WebGL2RenderingContext::uniformBlockBinding):
1031
1032 2018-09-26  Eric Carlson  <eric.carlson@apple.com>
1033
1034         [MediaStream] Clean up RealtimeMediaSource settings change handling
1035         https://bugs.webkit.org/show_bug.cgi?id=189998
1036         <rdar://problem/44797884>
1037
1038         Reviewed by Youenn Fablet.
1039
1040         No new tests, no change in functionality.
1041
1042         * platform/mediastream/RealtimeMediaSource.cpp:
1043         (WebCore::RealtimeMediaSource::notifySettingsDidChangeObservers):
1044         (WebCore::RealtimeMediaSource::setSize):
1045         (WebCore::RealtimeMediaSource::setFrameRate):
1046         (WebCore::RealtimeMediaSource::setAspectRatio):
1047         (WebCore::RealtimeMediaSource::setFacingMode):
1048         (WebCore::RealtimeMediaSource::setVolume):
1049         (WebCore::RealtimeMediaSource::setSampleRate):
1050         (WebCore::RealtimeMediaSource::setSampleSize):
1051         (WebCore::RealtimeMediaSource::setEchoCancellation):
1052         (WebCore::RealtimeMediaSource::settingsDidChange): Deleted.
1053         * platform/mediastream/RealtimeMediaSource.h:
1054         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1055         (WebCore::AVVideoCaptureSource::settingsDidChange):
1056         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1057         (WebCore::CoreAudioCaptureSource::settingsDidChange):
1058         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
1059         (WebCore::DisplayCaptureSourceCocoa::settingsDidChange):
1060         * platform/mock/MockRealtimeAudioSource.cpp:
1061         (WebCore::MockRealtimeAudioSource::settingsDidChange):
1062         * platform/mock/MockRealtimeVideoSource.cpp:
1063         (WebCore::MockRealtimeVideoSource::settingsDidChange):
1064
1065 2018-09-26  Antoine Quint  <graouts@apple.com>
1066
1067         [Web Animations] Ensure renderers with accelerated animations have layers
1068         https://bugs.webkit.org/show_bug.cgi?id=189990
1069         <rdar://problem/44791222>
1070
1071         Reviewed by Zalan Bujtas.
1072
1073         We have done some work already in webkit.org/b/189784 to prevent never-ending calls to DocumentTimeline::updateAnimations(). This was due to
1074         the change made for webkit.org/b/186930 where we queued calls to updateAnimations() in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
1075         while we were waiting for a renderer with a layer backing for a given animation target. Instead of doing this, we now ensure renderers always
1076         have a layer when they have an accelerated animation applied.
1077
1078         No new tests, this is already covered by webanimations/accelerated-animation-with-delay.html and webanimations/opacity-animation-yields-compositing-span.html
1079         which respectively check that we can apply an accelerated animation to a non-positioned block and an inline element.
1080
1081         * animation/DocumentTimeline.cpp:
1082         (WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated const): This method should have been marked const all along and it is
1083         now required so it can be called through RenderBox::requiresLayer() and RenderInline::requiresLayer().
1084         (WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated): Deleted.
1085         * animation/DocumentTimeline.h:
1086         * animation/KeyframeEffectReadOnly.cpp:
1087         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Stop enqueuing the accelerated actions in case we're lacking a composited renderer
1088         since this situation should no longer arise.
1089         * rendering/RenderBox.h: Make requiresLayer() return true if this renderer's element is the target of accelerated animations.
1090         * rendering/RenderBoxModelObject.cpp:
1091         (WebCore::RenderBoxModelObject::hasRunningAcceleratedAnimations const): Query the document timeline, if it exists, to check that this renderer's element
1092         has accelerated animations applied.
1093         * rendering/RenderBoxModelObject.h:
1094         * rendering/RenderInline.h: Make requiresLayer() return true if this renderer's element is the target of accelerated animations.
1095
1096 2018-09-25  Eric Carlson  <eric.carlson@apple.com>
1097
1098         [MediaStream] Add Mac window capture source
1099         https://bugs.webkit.org/show_bug.cgi?id=189958
1100         <rdar://problem/44767616>
1101
1102         Reviewed by Youenn Fablet.
1103
1104         * SourcesCocoa.txt: Add WindowDisplayCaptureSourceMac.
1105         * WebCore.xcodeproj/project.pbxproj: Ditto.
1106
1107         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
1108         (WebCore::DisplayCaptureManagerCocoa::captureDevices): Include window "devices".
1109         (WebCore::DisplayCaptureManagerCocoa::updateWindowCaptureDevices): New.
1110         (WebCore::DisplayCaptureManagerCocoa::windowCaptureDeviceWithPersistentID): New.
1111         (WebCore::DisplayCaptureManagerCocoa::captureDeviceWithPersistentID): Include window devices.
1112         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
1113
1114         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
1115         (WebCore::DisplayCaptureSourceCocoa::DisplayCaptureSourceCocoa):
1116         (WebCore::DisplayCaptureSourceCocoa::settings): Use frameSize, report surface type and 
1117         logical surface.
1118         (WebCore::DisplayCaptureSourceCocoa::settingsDidChange): Clear m_lastSampleBuffer when size changes.
1119         (WebCore::DisplayCaptureSourceCocoa::frameSize const): New, return size() or intrinsic size.
1120         (WebCore::DisplayCaptureSourceCocoa::setIntrinsicSize): New.
1121         (WebCore::DisplayCaptureSourceCocoa::emitFrame): generateFrame now returns a CVPixelBuffer
1122         so derived classes don't have to deal with resizing/transforming.
1123         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
1124
1125         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1126
1127         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
1128         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
1129         (WebCore::ScreenDisplayCaptureSourceMac::ScreenDisplayCaptureSourceMac): Add fixme.
1130         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Update intrinsic size when
1131         width/height changes.
1132         (WebCore::ScreenDisplayCaptureSourceMac::generateFrame): Return a CVPixelBuffer.
1133
1134         * platform/mediastream/mac/WindowDisplayCaptureSourceMac.h: Added.
1135         * platform/mediastream/mac/WindowDisplayCaptureSourceMac.mm: Added.
1136         (WebCore::anyOfCGWindow):
1137         (WebCore::windowDescription):
1138         (WebCore::WindowDisplayCaptureSourceMac::create):
1139         (WebCore::WindowDisplayCaptureSourceMac::WindowDisplayCaptureSourceMac):
1140         (WebCore::WindowDisplayCaptureSourceMac::windowImage):
1141         (WebCore::WindowDisplayCaptureSourceMac::generateFrame):
1142         (WebCore::WindowDisplayCaptureSourceMac::pixelBufferFromCGImage):
1143         (WebCore::WindowDisplayCaptureSourceMac::windowCaptureDeviceWithPersistentID):
1144         (WebCore::WindowDisplayCaptureSourceMac::windowCaptureDevices):
1145
1146 2018-09-25  Justin Fan  <justin_fan@apple.com>
1147
1148         WebGL 2 Conformance: primitive restart and draw_primitive_restart WebGL2 sample
1149         https://bugs.webkit.org/show_bug.cgi?id=189625
1150         <rdar://problem/42882620>
1151
1152         Reviewed by Dean Jackson.
1153
1154         Ref test: webgl/webgl2-primitive-restart.html.
1155
1156         Implement support for Primitive Restart Fixed Index as expected 
1157         by the WebGL 2 specifications. 
1158
1159         * html/canvas/WebGL2RenderingContext.cpp:
1160         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
1161         * html/canvas/WebGLRenderingContextBase.h:
1162         (WebCore::WebGLRenderingContextBase::getLastIndex): Template that must be defined in header.
1163         * html/canvas/WebGLRenderingContextBase.cpp:
1164         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
1165         * platform/graphics/GraphicsContext3D.h:
1166         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
1167         (WebCore::GraphicsContext3D::GraphicsContext3D):
1168         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1169         (WebCore::GraphicsContext3D::primitiveRestartIndex):
1170
1171 2018-09-25  John Wilander  <wilander@apple.com>
1172
1173         Change from HAVE(CFNETWORK_STORAGE_PARTITIONING) to ENABLE(RESOURCE_LOAD_STATISTICS)
1174         https://bugs.webkit.org/show_bug.cgi?id=189959
1175         <rdar://problem/44767642>
1176
1177         Reviewed by Chris Dumez.
1178
1179         No new tests because of no code change.
1180
1181         We no longer make use of CFNetwork's cookie partitioning so we should
1182         change the compile-time flag to something that makes sense. This should
1183         also make it easier/cleaner for other ports.
1184
1185         * dom/Document.cpp:
1186         (WebCore::Document::hasStorageAccess):
1187         (WebCore::Document::requestStorageAccess):
1188         (WebCore::Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction):
1189         * dom/Document.h:
1190         * loader/EmptyFrameLoaderClient.h:
1191         * loader/FrameLoaderClient.h:
1192         * loader/ResourceLoadObserver.cpp:
1193         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1194         (WebCore::ResourceLoadObserver::logWindowCreation):
1195         * loader/ResourceLoadObserver.h:
1196         * page/DOMWindow.cpp:
1197         (WebCore::DOMWindow::createWindow):
1198         * platform/network/NetworkStorageSession.h:
1199         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1200         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1201         (WebCore::cookiesForURL):
1202         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
1203
1204 2018-09-25  Jiewen Tan  <jiewen_tan@apple.com>
1205
1206         [WebAuthN] Make AuthenticatorManager
1207         https://bugs.webkit.org/show_bug.cgi?id=189279
1208         <rdar://problem/44116792>
1209
1210         Reviewed by Chris Dumez.
1211
1212         This patch does the following things in WebCore in order to support AuthenticatorManager:
1213         1) It separates AuthenticatorTransport from PublicKeyCredentialDescriptor such that the enum
1214         can be queried from WebKit directly.
1215         2) It adds AuthenticatorAttachment to PublicKeyCredentialCreationOptions such that relying parties
1216         could express their interests in cross platform authenticators.
1217         3) It enhances IPC encoder/decoder of a few such that Vectors and empty objects can be correctly coded.
1218         4) It moves the LocalAuthenticator implementation to WebKit to better integrate with AuthenticatorManager.
1219         5) It moves linking to LocalAuthentication.framework to WebKit as well.
1220         6) It temporarily bans old mock test mechanism in Internals so we could enable the new mock test mechanism in
1221         WebKitTestRunner which we will have a better coverage of codes in UI Process. Those tests will be either
1222         removed or ported to the new mechanism in Bug 189283.
1223         7) It also removes "using namespace WebCore" from the top namespace in some .mm files as they are reordered
1224         to where they could introduce name confusions.
1225
1226         Tests: http/wpt/webauthn/public-key-credential-create-failure-local.https.html
1227                http/wpt/webauthn/public-key-credential-create-success-local.https.html
1228                http/wpt/webauthn/public-key-credential-get-failure-local.https.html
1229                http/wpt/webauthn/public-key-credential-get-success-local.https.html
1230                http/wpt/webauthn/public-key-credential-is-user-verifying-platform-authenticator-available.html
1231
1232         * CMakeLists.txt:
1233         * Configurations/WebCore.xcconfig:
1234         * DerivedSources.make:
1235         * Modules/webauthn/AuthenticatorTransport.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1236         * Modules/webauthn/AuthenticatorTransport.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialDescriptor.idl.
1237         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
1238         (WebCore::PublicKeyCredentialCreationOptions::encode const):
1239         (WebCore::PublicKeyCredentialCreationOptions::decode):
1240         * Modules/webauthn/PublicKeyCredentialCreationOptions.idl:
1241         * Modules/webauthn/PublicKeyCredentialData.h:
1242         (WebCore::PublicKeyCredentialData::encode const):
1243         (WebCore::PublicKeyCredentialData::decode):
1244         * Modules/webauthn/PublicKeyCredentialDescriptor.h:
1245         (WebCore::PublicKeyCredentialDescriptor::encode const):
1246         * Modules/webauthn/PublicKeyCredentialDescriptor.idl:
1247         * Modules/webauthn/cocoa/LocalAuthenticator.mm: Removed.
1248         * Sources.txt:
1249         * SourcesCocoa.txt:
1250         * WebCore.xcodeproj/project.pbxproj:
1251         * dom/ExceptionData.h:
1252         * platform/cocoa/LocalAuthenticationSoftLink.mm: Removed.
1253         * platform/cocoa/SharedBufferCocoa.mm:
1254         (-[WebCoreSharedBufferData initWithSharedBufferDataSegment:]):
1255         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
1256         (VideoFullscreenModelVideoElement::VideoFullscreenModelVideoElement): Deleted.
1257         (VideoFullscreenModelVideoElement::~VideoFullscreenModelVideoElement): Deleted.
1258         (VideoFullscreenModelVideoElement::setVideoElement): Deleted.
1259         (VideoFullscreenModelVideoElement::handleEvent): Deleted.
1260         (VideoFullscreenModelVideoElement::updateForEventName): Deleted.
1261         (VideoFullscreenModelVideoElement::willExitFullscreen): Deleted.
1262         (VideoFullscreenModelVideoElement::setVideoFullscreenLayer): Deleted.
1263         (VideoFullscreenModelVideoElement::waitForPreparedForInlineThen): Deleted.
1264         (VideoFullscreenModelVideoElement::requestFullscreenMode): Deleted.
1265         (VideoFullscreenModelVideoElement::setVideoLayerFrame): Deleted.
1266         (VideoFullscreenModelVideoElement::setVideoLayerGravity): Deleted.
1267         (VideoFullscreenModelVideoElement::observedEventNames): Deleted.
1268         (VideoFullscreenModelVideoElement::eventNameAll): Deleted.
1269         (VideoFullscreenModelVideoElement::fullscreenModeChanged): Deleted.
1270         (VideoFullscreenModelVideoElement::addClient): Deleted.
1271         (VideoFullscreenModelVideoElement::removeClient): Deleted.
1272         (VideoFullscreenModelVideoElement::isVisible const): Deleted.
1273         (VideoFullscreenModelVideoElement::setHasVideo): Deleted.
1274         (VideoFullscreenModelVideoElement::setVideoDimensions): Deleted.
1275         (VideoFullscreenModelVideoElement::willEnterPictureInPicture): Deleted.
1276         (VideoFullscreenModelVideoElement::didEnterPictureInPicture): Deleted.
1277         (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture): Deleted.
1278         (VideoFullscreenModelVideoElement::willExitPictureInPicture): Deleted.
1279         (VideoFullscreenModelVideoElement::didExitPictureInPicture): Deleted.
1280         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
1281         (WebCore::hasExplicitBeginTime):
1282         (WebCore::setHasExplicitBeginTime):
1283         (WebCore::toCAFillModeType):
1284         (WebCore::toCAValueFunctionType):
1285         (WebCore::toCAMediaTimingFunction):
1286         (WebCore::PlatformCAAnimationCocoa::setFromValue):
1287         (WebCore::PlatformCAAnimationCocoa::setToValue):
1288         (WebCore::PlatformCAAnimationCocoa::setValues):
1289         (fromCAFillModeType): Deleted.
1290         (fromCAValueFunctionType): Deleted.
1291         (PlatformCAAnimationCocoa::create): Deleted.
1292         (PlatformCAAnimationCocoa::PlatformCAAnimationCocoa): Deleted.
1293         (PlatformCAAnimationCocoa::~PlatformCAAnimationCocoa): Deleted.
1294         (PlatformCAAnimationCocoa::copy const): Deleted.
1295         (PlatformCAAnimationCocoa::platformAnimation const): Deleted.
1296         (PlatformCAAnimationCocoa::keyPath const): Deleted.
1297         (PlatformCAAnimationCocoa::beginTime const): Deleted.
1298         (PlatformCAAnimationCocoa::setBeginTime): Deleted.
1299         (PlatformCAAnimationCocoa::duration const): Deleted.
1300         (PlatformCAAnimationCocoa::setDuration): Deleted.
1301         (PlatformCAAnimationCocoa::speed const): Deleted.
1302         (PlatformCAAnimationCocoa::setSpeed): Deleted.
1303         (PlatformCAAnimationCocoa::timeOffset const): Deleted.
1304         (PlatformCAAnimationCocoa::setTimeOffset): Deleted.
1305         (PlatformCAAnimationCocoa::repeatCount const): Deleted.
1306         (PlatformCAAnimationCocoa::setRepeatCount): Deleted.
1307         (PlatformCAAnimationCocoa::autoreverses const): Deleted.
1308         (PlatformCAAnimationCocoa::setAutoreverses): Deleted.
1309         (PlatformCAAnimationCocoa::fillMode const): Deleted.
1310         (PlatformCAAnimationCocoa::setFillMode): Deleted.
1311         (PlatformCAAnimationCocoa::setTimingFunction): Deleted.
1312         (PlatformCAAnimationCocoa::copyTimingFunctionFrom): Deleted.
1313         (PlatformCAAnimationCocoa::isRemovedOnCompletion const): Deleted.
1314         (PlatformCAAnimationCocoa::setRemovedOnCompletion): Deleted.
1315         (PlatformCAAnimationCocoa::isAdditive const): Deleted.
1316         (PlatformCAAnimationCocoa::setAdditive): Deleted.
1317         (PlatformCAAnimationCocoa::valueFunction const): Deleted.
1318         (PlatformCAAnimationCocoa::setValueFunction): Deleted.
1319         (PlatformCAAnimationCocoa::setFromValue): Deleted.
1320         (PlatformCAAnimationCocoa::copyFromValueFrom): Deleted.
1321         (PlatformCAAnimationCocoa::setToValue): Deleted.
1322         (PlatformCAAnimationCocoa::copyToValueFrom): Deleted.
1323         (PlatformCAAnimationCocoa::setValues): Deleted.
1324         (PlatformCAAnimationCocoa::copyValuesFrom): Deleted.
1325         (PlatformCAAnimationCocoa::setKeyTimes): Deleted.
1326         (PlatformCAAnimationCocoa::copyKeyTimesFrom): Deleted.
1327         (PlatformCAAnimationCocoa::setTimingFunctions): Deleted.
1328         (PlatformCAAnimationCocoa::copyTimingFunctionsFrom): Deleted.
1329         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
1330         (PlatformCAFilters::filterValueForOperation): Deleted.
1331         (PlatformCAFilters::colorMatrixValueForFilter): Deleted.
1332         (PlatformCAFilters::setBlendingFiltersOnLayer): Deleted.
1333         (PlatformCAFilters::numAnimatedFilterProperties): Deleted.
1334         (PlatformCAFilters::animatedFilterPropertyName): Deleted.
1335         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
1336         (-[WebAnimationDelegate animationDidStart:]):
1337         (-[WebAnimationDelegate animationDidStop:finished:]):
1338         (-[WebAnimationDelegate setOwner:]):
1339         (PlatformCALayerCocoa::create): Deleted.
1340         (PlatformCALayer::platformCALayer): Deleted.
1341         (mediaTimeToCurrentTime): Deleted.
1342         (PlatformCALayerCocoa::setOwner): Deleted.
1343         (toCAFilterType): Deleted.
1344         (PlatformCALayerCocoa::layerTypeForPlatformLayer): Deleted.
1345         (PlatformCALayerCocoa::PlatformCALayerCocoa): Deleted.
1346         (PlatformCALayerCocoa::commonInit): Deleted.
1347         (PlatformCALayerCocoa::clone const): Deleted.
1348         (PlatformCALayerCocoa::~PlatformCALayerCocoa): Deleted.
1349         (PlatformCALayerCocoa::animationStarted): Deleted.
1350         (PlatformCALayerCocoa::animationEnded): Deleted.
1351         (PlatformCALayerCocoa::setNeedsDisplay): Deleted.
1352         (PlatformCALayerCocoa::setNeedsDisplayInRect): Deleted.
1353         (PlatformCALayerCocoa::copyContentsFromLayer): Deleted.
1354         (PlatformCALayerCocoa::superlayer const): Deleted.
1355         (PlatformCALayerCocoa::removeFromSuperlayer): Deleted.
1356         (PlatformCALayerCocoa::setSublayers): Deleted.
1357         (PlatformCALayerCocoa::removeAllSublayers): Deleted.
1358         (PlatformCALayerCocoa::appendSublayer): Deleted.
1359         (PlatformCALayerCocoa::insertSublayer): Deleted.
1360         (PlatformCALayerCocoa::replaceSublayer): Deleted.
1361         (PlatformCALayerCocoa::adoptSublayers): Deleted.
1362         (PlatformCALayerCocoa::addAnimationForKey): Deleted.
1363         (PlatformCALayerCocoa::removeAnimationForKey): Deleted.
1364         (PlatformCALayerCocoa::animationForKey): Deleted.
1365         (PlatformCALayerCocoa::setMask): Deleted.
1366         (PlatformCALayerCocoa::isOpaque const): Deleted.
1367         (PlatformCALayerCocoa::setOpaque): Deleted.
1368         (PlatformCALayerCocoa::bounds const): Deleted.
1369         (PlatformCALayerCocoa::setBounds): Deleted.
1370         (PlatformCALayerCocoa::position const): Deleted.
1371         (PlatformCALayerCocoa::setPosition): Deleted.
1372         (PlatformCALayerCocoa::anchorPoint const): Deleted.
1373         (PlatformCALayerCocoa::setAnchorPoint): Deleted.
1374         (PlatformCALayerCocoa::transform const): Deleted.
1375         (PlatformCALayerCocoa::setTransform): Deleted.
1376         (PlatformCALayerCocoa::sublayerTransform const): Deleted.
1377         (PlatformCALayerCocoa::setSublayerTransform): Deleted.
1378         (PlatformCALayerCocoa::isHidden const): Deleted.
1379         (PlatformCALayerCocoa::setHidden): Deleted.
1380         (PlatformCALayerCocoa::contentsHidden const): Deleted.
1381         (PlatformCALayerCocoa::setContentsHidden): Deleted.
1382         (PlatformCALayerCocoa::userInteractionEnabled const): Deleted.
1383         (PlatformCALayerCocoa::setUserInteractionEnabled): Deleted.
1384         (PlatformCALayerCocoa::setBackingStoreAttached): Deleted.
1385         (PlatformCALayerCocoa::backingStoreAttached const): Deleted.
1386         (PlatformCALayerCocoa::geometryFlipped const): Deleted.
1387         (PlatformCALayerCocoa::setGeometryFlipped): Deleted.
1388         (PlatformCALayerCocoa::isDoubleSided const): Deleted.
1389         (PlatformCALayerCocoa::setDoubleSided): Deleted.
1390         (PlatformCALayerCocoa::masksToBounds const): Deleted.
1391         (PlatformCALayerCocoa::setMasksToBounds): Deleted.
1392         (PlatformCALayerCocoa::acceleratesDrawing const): Deleted.
1393         (PlatformCALayerCocoa::setAcceleratesDrawing): Deleted.
1394         (PlatformCALayerCocoa::wantsDeepColorBackingStore const): Deleted.
1395         (PlatformCALayerCocoa::setWantsDeepColorBackingStore): Deleted.
1396         (PlatformCALayerCocoa::supportsSubpixelAntialiasedText const): Deleted.
1397         (PlatformCALayerCocoa::setSupportsSubpixelAntialiasedText): Deleted.
1398         (PlatformCALayerCocoa::hasContents const): Deleted.
1399         (PlatformCALayerCocoa::contents const): Deleted.
1400         (PlatformCALayerCocoa::setContents): Deleted.
1401         (PlatformCALayerCocoa::setContentsRect): Deleted.
1402         (PlatformCALayerCocoa::setMinificationFilter): Deleted.
1403         (PlatformCALayerCocoa::setMagnificationFilter): Deleted.
1404         (PlatformCALayerCocoa::backgroundColor const): Deleted.
1405         (PlatformCALayerCocoa::setBackgroundColor): Deleted.
1406         (PlatformCALayerCocoa::setBorderWidth): Deleted.
1407         (PlatformCALayerCocoa::setBorderColor): Deleted.
1408         (PlatformCALayerCocoa::opacity const): Deleted.
1409         (PlatformCALayerCocoa::setOpacity): Deleted.
1410         (PlatformCALayerCocoa::setFilters): Deleted.
1411         (PlatformCALayerCocoa::copyFiltersFrom): Deleted.
1412         (PlatformCALayerCocoa::filtersCanBeComposited): Deleted.
1413         (PlatformCALayerCocoa::setBlendMode): Deleted.
1414         (PlatformCALayerCocoa::setName): Deleted.
1415         (PlatformCALayerCocoa::setSpeed): Deleted.
1416         (PlatformCALayerCocoa::setTimeOffset): Deleted.
1417         (PlatformCALayerCocoa::contentsScale const): Deleted.
1418         (PlatformCALayerCocoa::setContentsScale): Deleted.
1419         (PlatformCALayerCocoa::cornerRadius const): Deleted.
1420         (PlatformCALayerCocoa::setCornerRadius): Deleted.
1421         (PlatformCALayerCocoa::setEdgeAntialiasingMask): Deleted.
1422         (PlatformCALayerCocoa::shapeRoundedRect const): Deleted.
1423         (PlatformCALayerCocoa::setShapeRoundedRect): Deleted.
1424         (PlatformCALayerCocoa::shapeWindRule const): Deleted.
1425         (PlatformCALayerCocoa::setShapeWindRule): Deleted.
1426         (PlatformCALayerCocoa::shapePath const): Deleted.
1427         (PlatformCALayerCocoa::setShapePath): Deleted.
1428         (PlatformCALayerCocoa::requiresCustomAppearanceUpdateOnBoundsChange const): Deleted.
1429         (PlatformCALayerCocoa::updateCustomAppearance): Deleted.
1430         (layerContentsFormat): Deleted.
1431         (PlatformCALayerCocoa::updateContentsFormat): Deleted.
1432         (PlatformCALayerCocoa::tiledBacking): Deleted.
1433         (PlatformCALayer::isWebLayer): Deleted.
1434         (PlatformCALayer::setBoundsOnMainThread): Deleted.
1435         (PlatformCALayer::setPositionOnMainThread): Deleted.
1436         (PlatformCALayer::setAnchorPointOnMainThread): Deleted.
1437         (PlatformCALayer::collectRectsToPaint): Deleted.
1438         (PlatformCALayer::drawLayerContents): Deleted.
1439         (PlatformCALayer::frameForLayer): Deleted.
1440         (PlatformCALayerCocoa::createCompatibleLayer const): Deleted.
1441         (PlatformCALayerCocoa::enumerateRectsBeingDrawn): Deleted.
1442         (PlatformCALayerCocoa::backingStoreBytesPerPixel const): Deleted.
1443         (PlatformCALayerCocoa::avPlayerLayer const): Deleted.
1444         * platform/graphics/ca/cocoa/WebSystemBackdropLayer.mm:
1445         (-[WebLightSystemBackdropLayer init]):
1446         (-[WebDarkSystemBackdropLayer init]):
1447         * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
1448         (-[WebTiledBackingLayer createTileController:]):
1449         (-[WebTiledBackingLayer setNeedsDisplayInRect:]):
1450         (-[WebTiledBackingLayer setBorderColor:]):
1451         * testing/Internals.cpp:
1452         (WebCore::Internals::Internals):
1453
1454 2018-09-25  YUHAN WU  <yuhan_wu@apple.com>
1455
1456         Implement MediaStreamTrack Content Hints
1457         https://bugs.webkit.org/show_bug.cgi?id=189262
1458         <rdar://problem/44101773>
1459
1460         Reviewed by Youenn Fablet.
1461
1462         contentHint is a new attribute which is stored in MediaStreamTrackPrivate.
1463         https://w3c.github.io/mst-content-hint/
1464
1465         Covered by tests: 
1466         LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/MediaStreamTrack-contentHint.html
1467         LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/idlharness.window.html
1468
1469         * Modules/mediastream/MediaStreamTrack.cpp:
1470         (WebCore::MediaStreamTrack::contentHint const):
1471         (WebCore::MediaStreamTrack::setContentHint):
1472         * Modules/mediastream/MediaStreamTrack.h:
1473         * Modules/mediastream/MediaStreamTrack.idl:
1474         * platform/mediastream/MediaStreamTrackPrivate.cpp:
1475         (WebCore::MediaStreamTrackPrivate::setContentHint):
1476         (WebCore::MediaStreamTrackPrivate::clone):
1477         * platform/mediastream/MediaStreamTrackPrivate.h:
1478         (WebCore::MediaStreamTrackPrivate::contentHint):
1479
1480 2018-09-25  Alex Christensen  <achristensen@webkit.org>
1481
1482         Allow for suffixes to com.apple.WebKit.WebContent
1483         https://bugs.webkit.org/show_bug.cgi?id=189972
1484
1485         Reviewed by Chris Dumez.
1486
1487         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
1488         (WebCore::isInWebProcess):
1489
1490 2018-09-25  Wenson Hsieh  <wenson_hsieh@apple.com>
1491
1492         [iOS] Fix the open source iOS 12 build after r236445
1493         https://bugs.webkit.org/show_bug.cgi?id=189953
1494
1495         Reviewed by Alex Christensen.
1496
1497         Remove soft-linking macros from several sources in WebCore, and instead import UIKitSoftLink from PAL. This
1498         allows different WebCore sources to soft-link UIKit (and its classes and symbols) without reimplementing
1499         WebCore::UIKitLibrary.
1500
1501         * editing/cocoa/FontAttributesCocoa.mm:
1502         * editing/cocoa/FontShadowCocoa.mm:
1503         (WebCore::FontShadow::createShadow const):
1504         * platform/graphics/cocoa/ColorCocoa.mm:
1505         (WebCore::platformColor):
1506         * platform/ios/PlatformScreenIOS.mm:
1507         (WebCore::screenIsMonochrome):
1508         (WebCore::screenHasInvertedColors):
1509         (WebCore::screenSize):
1510         (WebCore::availableScreenSize):
1511         (WebCore::screenScaleFactor):
1512
1513 2018-09-25  Thibault Saunier  <tsaunier@igalia.com>
1514
1515         [WPE][GTK][WebRTC] Fixup VP8 encoding support
1516         https://bugs.webkit.org/show_bug.cgi?id=189921
1517
1518         Previous leak fixing commit introduced a regression in
1519         the way the encoded buffer were prepared in the default
1520         GStreamerVideoEncoder::Fragmentize implementation (when
1521         encoding with VP8 basically).
1522
1523         + Fix a build warning in the decoder.
1524         + Fix some wrong object members namings.
1525         + Properly move the caps reference when setting restriction caps.
1526         + Do not raise a GStreamer error when GStreamerVideoEncoder::OnEncodedImage
1527           fails - this might be a network issue and other encoders do not consider that
1528           fatal.
1529         + Use GstMappedBuffer where appropriate.
1530
1531         Reviewed by Philippe Normand.
1532
1533         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
1534         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
1535         (WebCore::GStreamerVideoEncoder::InitEncode):
1536         (WebCore::GStreamerVideoEncoder::newSampleCallback):
1537         (WebCore::GStreamerVideoEncoder::Fragmentize):
1538         (WebCore::GStreamerVideoEncoder::SetRestrictionCaps):
1539
1540 2018-09-25  Eric Carlson  <eric.carlson@apple.com>
1541
1542         [MediaStream] Update constraints supported by getDisplayMedia
1543         https://bugs.webkit.org/show_bug.cgi?id=189930
1544
1545         Reviewed by Youenn Fablet.
1546
1547         No new tests, updated http/tests/media/media-stream/get-display-media-prompt.html.
1548
1549         * Modules/mediastream/MediaDevices.cpp:
1550         (WebCore::MediaDevices::getDisplayMedia const): Ignore audio constraints.
1551
1552         * Modules/mediastream/UserMediaRequest.cpp:
1553         (WebCore::hasInvalidGetDisplayMediaConstraint): Check for invalid constraints.
1554         (WebCore::UserMediaRequest::start): Check for invalid constraints.
1555         (WebCore::UserMediaRequest::deny): Support new error.
1556         * Modules/mediastream/UserMediaRequest.h:
1557
1558         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1559         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
1560
1561 2018-09-25  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1562
1563         [EME] Fix variable name that should have gone in r236317
1564         https://bugs.webkit.org/show_bug.cgi?id=189944
1565
1566         Reviewed by Jer Noble.
1567
1568         m_cdmInstanceClientWeakPtrFactory becomes
1569         m_cdmInstanceSessionClientWeakPtrFactory as its type changes to
1570         CDMInstanceSessionClient.
1571
1572         * Modules/encryptedmedia/MediaKeySession.cpp:
1573         (WebCore::MediaKeySession::MediaKeySession):
1574         * Modules/encryptedmedia/MediaKeySession.h:
1575
1576 2018-09-25  Simon Fraser  <simon.fraser@apple.com>
1577
1578         Clean up code around RenderLayer's "has accelerated scrolling" functions
1579         https://bugs.webkit.org/show_bug.cgi?id=189932
1580
1581         Reviewed by Zalan Bujtas.
1582         
1583         RenderLayer had:
1584         
1585         bool hasAcceleratedTouchScrolling()
1586         bool hasTouchScrollableOverflow()
1587         bool usesAcceleratedScrolling()
1588         bool usesCompositedScrolling()
1589         bool usesAsyncScrolling()
1590         
1591         which are hard to keep in your head. Removed usesAcceleratedScrolling() since it just returns hasTouchScrollableOverflow().
1592         Renamed hasAcceleratedTouchScrolling() to canUseAcceleratedTouchScrolling() to indicate that it just looks at style,
1593         not whether layout has given the layer scrollable overflow yet. Tidy up some #ifdefs.
1594         
1595         usesCompositedScrolling() and usesAsyncScrolling() are ScrollableArea overrides, and
1596         look at backing layers, so require that compositing has run already. Note this in comments.
1597
1598         * rendering/RenderLayer.cpp:
1599         (WebCore::RenderLayer::canUseAcceleratedTouchScrolling const):
1600         (WebCore::RenderLayer::hasTouchScrollableOverflow const):
1601         (WebCore::RenderLayer::handleTouchEvent):
1602         (WebCore::RenderLayer::usesAsyncScrolling const):
1603         (WebCore::RenderLayer::showsOverflowControls const):
1604         (WebCore::RenderLayer::calculateClipRects const):
1605         (WebCore::RenderLayer::hasAcceleratedTouchScrolling const): Deleted.
1606         (WebCore::RenderLayer::usesAcceleratedScrolling const): Deleted.
1607         * rendering/RenderLayer.h:
1608         * rendering/RenderLayerBacking.cpp:
1609         (WebCore::layerOrAncestorIsTransformedOrUsingCompositedScrolling):
1610         (WebCore::RenderLayerBacking::updateConfiguration):
1611         * rendering/RenderLayerCompositor.cpp:
1612         (WebCore::RenderLayerCompositor::useCoordinatedScrollingForLayer const):
1613         (WebCore::RenderLayerCompositor::requiresCompositingForOverflowScrolling const):
1614
1615 2018-09-24  Fujii Hironori  <Hironori.Fujii@sony.com>
1616
1617         Rename WTF_COMPILER_GCC_OR_CLANG to WTF_COMPILER_GCC_COMPATIBLE
1618         https://bugs.webkit.org/show_bug.cgi?id=189733
1619
1620         Reviewed by Michael Catanzaro.
1621
1622         No new tests (No behavior change).
1623
1624         * platform/graphics/cpu/arm/filters/FELightingNEON.cpp:
1625         * platform/graphics/cpu/arm/filters/FELightingNEON.h:
1626         * platform/graphics/filters/FELighting.cpp:
1627         (WebCore::FELighting::platformApply):
1628         * platform/graphics/filters/FELighting.h:
1629
1630 2018-09-24  John Wilander  <wilander@apple.com>
1631
1632         Cap lifetime of persistent cookies created client-side through document.cookie
1633         https://bugs.webkit.org/show_bug.cgi?id=189933
1634         <rdar://problem/44741888>
1635
1636         Reviewed by Chris Dumez.
1637
1638         Test: http/tests/cookies/capped-lifetime-for-cookie-set-in-js.html
1639
1640         As pointed out in https://github.com/mikewest/http-state-tokens:
1641
1642         1) Cookies are available to JavaScript by default via document.cookie, which
1643         enables a smooth upgrade from one-time XSS to theft of persistent credentials
1644         and also makes cookies available to Spectre-like attacks on memory.
1645
1646         2) Though the HttpOnly attribute was introduced well over a decade ago, only
1647         ~8.31% of Set-Cookie operations use it today (stats from Chrome). We need
1648         developer incentives to put proper protections in place.
1649
1650         3) The median (uncompressed) Cookie request header is 409 bytes, while the 90th
1651         percentile is 1,589 bytes, the 95th 2,549 bytes, the 99th 4,601 bytes, and
1652         ~0.1% of Cookie headers are over 10kB (stats from Chrome). This is bad for load
1653         performance.
1654
1655         In addition to this, third-party scripts running in first-party contexts can
1656         read user data through document.cookie and even store cross-site tracking data
1657         in them.
1658
1659         Authentication cookies should be HttpOnly and thus not be affected by
1660         restrictions to document.cookie. Cookies that persist for a long time should
1661         be Secure, HttpOnly, and SameSite to provide good security and privacy.
1662
1663         By capping the lifetime of persistent cookies set through document.cookie we
1664         embark on a journey towards better cookie management on the web.
1665
1666         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1667         (WebCore::filterCookies):
1668             Now caps the life time of persistent cookies to one week (seven days).
1669         * testing/Internals.cpp:
1670         (WebCore::Internals::getCookies const):
1671             New test function to get to cookie meta data such as expiry.
1672         * testing/Internals.h:
1673         * testing/Internals.idl:
1674
1675 2018-09-24  Simon Fraser  <simon.fraser@apple.com>
1676
1677         Remove filterRes parameter from SVG filters
1678         https://bugs.webkit.org/show_bug.cgi?id=129565
1679         <rdar://problem/44714340>
1680
1681         Reviewed by Dean Jackson.
1682         
1683         Remove support for the "filterRes" attribute on SVG filters. It's marked as
1684         deprecated in https://drafts.fxtf.org/filter-effects/#element-attrdef-filter-filterres
1685         and no longer supported by Chrome or Firefox.
1686         
1687         Removed existing filterRes tests, added new test checking that it has no effect.
1688
1689         Tests: svg/filters/filterRes-is-noop.svg
1690
1691         * rendering/svg/RenderSVGResourceFilter.cpp:
1692         (WebCore::RenderSVGResourceFilter::applyResource):
1693         * svg/SVGElement.cpp:
1694         (WebCore::SVGElement::animatableAttributeForName):
1695         * svg/SVGFilterElement.cpp:
1696         (WebCore::SVGFilterElement::registerAttributes):
1697         (WebCore::SVGFilterElement::parseAttribute):
1698         (WebCore::SVGFilterElement::filterResXIdentifier): Deleted.
1699         (WebCore::SVGFilterElement::filterResYIdentifier): Deleted.
1700         (WebCore::SVGFilterElement::setFilterRes): Deleted.
1701         * svg/SVGFilterElement.h:
1702         * svg/SVGFilterElement.idl:
1703         * svg/svgattrs.in:
1704
1705 2018-09-24  Ryosuke Niwa  <rniwa@webkit.org>
1706
1707         Don't cause a crash even when some IDL attribute is missing CEReactions
1708         https://bugs.webkit.org/show_bug.cgi?id=189937
1709
1710         Reviewed by Simon Fraser.
1711
1712         Replaced release assertions in ElementQueue::add and ElementQueue::invokeAll by debug assertions
1713         since a missing CEReactions resulting in a crash is a terrible user experience.
1714
1715         Also made the iteration in invokeAll safe when more elements were added to m_elements.
1716
1717         No new tests since we would still hit debug assertions, and this behavior should only come up
1718         when some IDL attribute is erroneously missing CEReactions.
1719
1720         * dom/CustomElementReactionQueue.cpp:
1721         (WebCore::CustomElementReactionQueue::ElementQueue::add):
1722         (WebCore::CustomElementReactionQueue::ElementQueue::invokeAll):
1723
1724 2018-09-24  Wenson Hsieh  <wenson_hsieh@apple.com>
1725
1726         Refactor Editor::fontAttributesForSelectionStart to be platform-agnostic
1727         https://bugs.webkit.org/show_bug.cgi?id=189918
1728         Work towards <rdar://problem/44648705>
1729
1730         Reviewed by Tim Horton.
1731
1732         Refactors the functionality in Editor::fontAttributesForSelectionStart to not be Cocoa-only. Rename this to
1733         fontAttributesAtSelectionStart (to be consistent with `EditingStyle::styleAtSelectionStart`) and move it from
1734         EditorCocoa.mm to Editor.cpp; instead of creating and populating an NSDictionary with font attribute
1735         information, create and populate a new `FontAttributes` struct that contains the same information. Cocoa clients
1736         in WebKitLegacy may then create an `NSDictionary` as needed from the `FontAttributes`.
1737
1738         * SourcesCocoa.txt:
1739         * WebCore.xcodeproj/project.pbxproj:
1740         * editing/Editor.cpp:
1741         (WebCore::Editor::platformFontAttributesAtSelectionStart const):
1742
1743         Add a hook to allow platforms to supply additional information in FontAttributes. On Cocoa, this adds a UIFont
1744         or NSFont to FontAttributes; otherwise, this is a no-op.
1745
1746         (WebCore::Editor::fontAttributesAtSelectionStart const):
1747         * editing/Editor.h:
1748         * editing/FontAttributeChanges.cpp:
1749         (WebCore::cssValueListForShadow):
1750         * editing/FontAttributeChanges.h:
1751         (): Deleted.
1752         (WebCore::FontShadow::encode const): Deleted.
1753         (WebCore::FontShadow::decode): Deleted.
1754         * editing/FontAttributes.h: Added.
1755
1756         Introduce a new struct that contains font attribute information. May be converted into an NSDictionary for use
1757         by Cocoa clients in WebKitLegacy and WebKit. In a future patch, this will become serializable over IPC for use
1758         in WebKit2.
1759
1760         * editing/FontShadow.h: Added.
1761
1762         Move FontShadow out into a separate header file, included in `FontAttributeChanges.h` and `FontAttributes.h`.
1763
1764         (WebCore::FontShadow::encode const):
1765         (WebCore::FontShadow::decode):
1766         * editing/cocoa/EditorCocoa.mm:
1767
1768         Add a helper function to convert a WebCore::Color to either `UIColor` on iOS or `NSColor` when AppKit is being
1769         used.
1770
1771         (WebCore::Editor::platformFontAttributesAtSelectionStart const):
1772         (WebCore::Editor::getTextDecorationAttributesRespectingTypingStyle const): Deleted.
1773
1774         Remove a helper function that was only used to compute text decoration attributes in
1775         fontAttributesForSelectionStart.
1776
1777         (WebCore::Editor::fontAttributesForSelectionStart const): Deleted.
1778         * editing/cocoa/FontAttributesCocoa.mm: Added.
1779         (WebCore::FontAttributes::createDictionary const):
1780         * editing/cocoa/FontShadowCocoa.mm: Added.
1781         (WebCore::FontShadow::createShadow const):
1782         * editing/cocoa/HTMLConverter.mm:
1783         (_webKitBundle):
1784         (HTMLConverter::_colorForElement):
1785         (_platformColor): Deleted.
1786
1787         Adopt platformColor().
1788
1789         * platform/graphics/cocoa/ColorCocoa.h: Added.
1790         * platform/graphics/cocoa/ColorCocoa.mm: Added.
1791         (WebCore::platformColor):
1792         * platform/graphics/metal/GPURenderPassDescriptorMetal.mm:
1793
1794         Build fix due to changes in unified sources.
1795
1796         * platform/mac/WebCoreNSFontManagerExtras.mm:
1797         (WebCore::computedFontAttributeChanges):
1798         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
1799         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
1800
1801         More build fixes due to changes in unified sources.
1802
1803 2018-09-24  Jer Noble  <jer.noble@apple.com>
1804
1805         SharedBuffer should have an equality test
1806         https://bugs.webkit.org/show_bug.cgi?id=189919
1807
1808         Reviewed by Alex Christensen.
1809
1810         Test: TestWebKitAPI SharedBuffer.isEqualTo.
1811
1812         * platform/SharedBuffer.cpp:
1813         * platform/SharedBuffer.h:
1814         (WebCore::operator==):
1815         (WebCore::operator!=):
1816
1817 2018-09-24  Ryosuke Niwa  <rniwa@webkit.org>
1818
1819         imported/w3c/web-platform-tests/shadow-dom/slotchange.html is a flaky failure
1820         https://bugs.webkit.org/show_bug.cgi?id=167652
1821
1822         Reviewed by Saam Barati.
1823
1824         The bug appears to be caused by the JS wrappers of slot elements getting prematurely collected.
1825         Deployed GCReachableRef introduced in r236376 to fix the bug.
1826
1827         Test: fast/shadow-dom/signal-slot-list-retains-js-wrappers.html
1828
1829         * dom/MutationObserver.cpp:
1830         (WebCore::signalSlotList):
1831         (WebCore::MutationObserver::enqueueSlotChangeEvent):
1832         (WebCore::MutationObserver::notifyMutationObservers):
1833
1834 2018-09-24  Ryosuke Niwa  <rniwa@webkit.org>
1835
1836         Release assert when using paper-textarea due to autocorrect IDL attribute missing CEReactions
1837         https://bugs.webkit.org/show_bug.cgi?id=174629
1838         <rdar://problem/33407620>
1839
1840         Reviewed by Simon Fraser.
1841
1842         The bug was caused by autocorrect and autocapitalize IDL attributes missing CEReactions.
1843
1844         Test: fast/custom-elements/autocorrect-autocapitalize-idl-attributes-crash.html
1845
1846         * html/HTMLElement.idl:
1847
1848 2018-09-24  Chris Dumez  <cdumez@apple.com>
1849
1850         No-op document.open() calls should not have any side effects
1851         https://bugs.webkit.org/show_bug.cgi?id=189373
1852         <rdar://problem/44282702>
1853
1854         Reviewed by Geoffrey Garen.
1855
1856         Update document.open() implementation to match the specification [1] more closely.
1857         In particular, URLs updates should happen much later, at step 11. They were happening
1858         too early and would cause side effects when returning early.
1859
1860         [1] https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#document-open-steps
1861
1862         No new tests, rebaselined existing test.
1863
1864         * dom/Document.cpp:
1865         (WebCore::Document::open):
1866
1867 2018-09-24  Daniel Bates  <dabates@apple.com>
1868
1869         Include more headers in IOSurface.mm, PixelBufferResizer.{h, mm}
1870         https://bugs.webkit.org/show_bug.cgi?id=189928
1871
1872         Reviewed by Andy Estes.
1873
1874         Make building IOSurface.mm and PixelBufferResizer.mm deterministic regardless of
1875         which bundle of unified sources they are built in.
1876
1877         * platform/graphics/cocoa/IOSurface.mm: Include headers HostWindow.h and PlatformScreen.h
1878         since we make use of functionality from these headers.
1879         * platform/graphics/cv/PixelBufferResizer.h: Include header IntSize.h since
1880         we need the size of an IntSize for m_size.
1881         * platform/graphics/cv/PixelBufferResizer.mm: Include header Logging.h since
1882         this file makes use of logging facilities. Also substitute #import for #include
1883         while I am here since this file is an Objective-C++ file.
1884
1885 2018-09-24  Andy Estes  <aestes@apple.com>
1886
1887         [Payment Request] Events cleanup
1888         https://bugs.webkit.org/show_bug.cgi?id=189925
1889
1890         Reviewed by Simon Fraser.
1891
1892         1. Constructed MerchantValidationEvents (and ApplePayValidateMerchantEvents) with rvalue
1893         references to validationURLs.
1894         2. Instead of MerchantValidationEvent and PaymentRequestUpdateEvent having a
1895         RefPtr<PaymentRequest>, downcasted their target to a PaymentRequest. Trusted versions of
1896         these events are always dispatched to a PaymentRequest object.
1897         3. Defined MerchantValidationEventInit in MerchantValidationEvent.idl instead of having a
1898         separate .idl and .h for this dictionary.
1899
1900         No new tests. No change in behavior.
1901
1902         * CMakeLists.txt:
1903         * DerivedSources.make:
1904         * Modules/applepay/ApplePaySession.cpp:
1905         (WebCore::ApplePaySession::validateMerchant):
1906         * Modules/applepay/ApplePaySession.h:
1907         * Modules/applepay/ApplePayValidateMerchantEvent.cpp:
1908         (WebCore::ApplePayValidateMerchantEvent::ApplePayValidateMerchantEvent):
1909         * Modules/applepay/ApplePayValidateMerchantEvent.h:
1910         (WebCore::ApplePayValidateMerchantEvent::create):
1911         * Modules/applepay/PaymentCoordinator.cpp:
1912         (WebCore::PaymentCoordinator::validateMerchant):
1913         * Modules/applepay/PaymentCoordinator.h:
1914         * Modules/applepay/PaymentSession.h:
1915         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1916         (WebCore::ApplePayPaymentHandler::validateMerchant):
1917         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
1918         * Modules/paymentrequest/MerchantValidationEvent.cpp:
1919         (WebCore::MerchantValidationEvent::create):
1920         (WebCore::MerchantValidationEvent::MerchantValidationEvent):
1921         (WebCore::MerchantValidationEvent::complete):
1922         * Modules/paymentrequest/MerchantValidationEvent.h:
1923         * Modules/paymentrequest/MerchantValidationEvent.idl:
1924         * Modules/paymentrequest/MerchantValidationEventInit.h: Removed.
1925         * Modules/paymentrequest/MerchantValidationEventInit.idl: Removed.
1926         * Modules/paymentrequest/PaymentMethodChangeEvent.cpp:
1927         (WebCore::PaymentMethodChangeEvent::PaymentMethodChangeEvent):
1928         * Modules/paymentrequest/PaymentMethodChangeEvent.h:
1929         * Modules/paymentrequest/PaymentRequest.cpp:
1930         (WebCore::PaymentRequest::shippingAddressChanged):
1931         (WebCore::PaymentRequest::shippingOptionChanged):
1932         (WebCore::PaymentRequest::paymentMethodChanged):
1933         * Modules/paymentrequest/PaymentRequest.h:
1934         (isType):
1935         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp:
1936         (WebCore::PaymentRequestUpdateEvent::PaymentRequestUpdateEvent):
1937         (WebCore::PaymentRequestUpdateEvent::updateWith):
1938         * Modules/paymentrequest/PaymentRequestUpdateEvent.h:
1939         * Sources.txt:
1940         * WebCore.xcodeproj/project.pbxproj:
1941         * dom/EventTarget.cpp:
1942         (WebCore::EventTarget::isPaymentRequest const):
1943         * dom/EventTarget.h:
1944
1945 2018-09-24  Daniel Bates  <dabates@apple.com>
1946
1947         Separate Mac and iOS implementation of windowsKeyCodeForCharCode()
1948         https://bugs.webkit.org/show_bug.cgi?id=189898
1949
1950         Reviewed by Tim Horton.
1951
1952         Extract the Mac and iOS implementations into a windowsKeyCodeForCharCode() defined in file
1953         KeyEventMac.mm and file KeyEventIOS, respectively.
1954
1955         Mac and iOS have significant differences in how they represent function keys. It is not worthwhile
1956         to share windowsKeyCodeForCharCode() between them given these differences. On Mac function keys
1957         are represented by a char code in the range 0xF700-0xF8FF. On iOS these keys may not have a unique
1958         char code (e.g. F1 = 0x10 = F10) and must be identified either by special string (e.g. UIKeyInputUpArrow)
1959         or key code.
1960
1961         * platform/cocoa/KeyEventCocoa.mm:
1962         (WebCore::windowsKeyCodeForCharCode): Deleted.
1963         * platform/ios/KeyEventIOS.mm:
1964         (WebCore::windowsKeyCodeForCharCode): Added. Remove the handling of NS*FunctionKey char codes
1965         as function keys are not represented using them as of iOS 12.
1966         * platform/mac/KeyEventMac.mm:
1967         (WebCore::windowsKeyCodeForCharCode): Added.
1968
1969 2018-09-21  Simon Fraser  <simon.fraser@apple.com>
1970
1971         Remove the old "AcceleratedCompositingForOverflowScroll" code
1972         https://bugs.webkit.org/show_bug.cgi?id=189870
1973
1974         Reviewed by Zalan Bujtas.
1975
1976         The "AcceleratedCompositingForOverflowScroll" code was added to allow overflow:scroll to use
1977         composited scrolling if an overflow:scroll could be made a stacking context without affecting
1978         z-order. We need overflow:scroll to be accelerated always, so a different approach is needed.
1979         Remove this old code (unused by any platform?) to make working on new code easier.
1980
1981         * page/Settings.yaml:
1982         * rendering/RenderLayer.cpp:
1983         (WebCore::RenderLayer::RenderLayer):
1984         (WebCore::RenderLayer::setHasVisibleContent):
1985         (WebCore::RenderLayer::updateDescendantDependentFlags):
1986         (WebCore::RenderLayer::dirty3DTransformedDescendantStatus):
1987         (WebCore::RenderLayer::stackingContext const):
1988         (WebCore::compositingContainer):
1989         (WebCore::RenderLayer::addChild):
1990         (WebCore::RenderLayer::removeChild):
1991         (WebCore::RenderLayer::hasAcceleratedTouchScrolling const):
1992         (WebCore::RenderLayer::usesAcceleratedScrolling const):
1993         (WebCore::adjustedScrollDelta):
1994         (WebCore::RenderLayer::updateCompositingLayersAfterScroll):
1995         (WebCore::RenderLayer::updateScrollInfoAfterLayout):
1996         (WebCore::RenderLayer::enclosingFragmentedFlowAncestor const):
1997         (WebCore::RenderLayer::calculateClipRects const):
1998         (WebCore::RenderLayer::acceleratedCompositingForOverflowScrollEnabled const): Deleted.
1999         (WebCore::RenderLayer::updateDescendantsAreContiguousInStackingOrder): Deleted.
2000         (WebCore::RenderLayer::updateDescendantsAreContiguousInStackingOrderRecursive): Deleted.
2001         (WebCore::RenderLayer::positionNewlyCreatedOverflowControls): Deleted.
2002         (WebCore::RenderLayer::canBeStackingContainer const): Deleted.
2003         (WebCore::RenderLayer::stackingContainer const): Deleted.
2004         (WebCore::RenderLayer::needsCompositedScrolling const): Deleted.
2005         (WebCore::RenderLayer::updateNeedsCompositedScrolling): Deleted.
2006         * rendering/RenderLayer.h:
2007         (WebCore::RenderLayer::clearZOrderLists):
2008         (WebCore::RenderLayer::updateZOrderLists):
2009         * rendering/RenderLayerBacking.cpp:
2010         (WebCore::RenderLayerBacking::updateAfterLayout):
2011         (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect const):
2012         (WebCore::RenderLayerBacking::updateGeometry):
2013         (WebCore::RenderLayerBacking::requiresHorizontalScrollbarLayer const):
2014         (WebCore::RenderLayerBacking::requiresVerticalScrollbarLayer const):
2015         (WebCore::RenderLayerBacking::requiresScrollCornerLayer const):
2016         (WebCore::RenderLayerBacking::compositingOpacity const):
2017         (WebCore::traverseVisibleNonCompositedDescendantLayers):
2018         (WebCore::RenderLayerBacking::hasUnpositionedOverflowControlsLayers const): Deleted.
2019         * rendering/RenderLayerBacking.h:
2020         * rendering/RenderLayerCompositor.cpp:
2021         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlush):
2022         (WebCore::RenderLayerCompositor::updateCustomLayersAfterFlush):
2023         (WebCore::styleChangeRequiresLayerRebuild):
2024         (WebCore::RenderLayerCompositor::enclosingNonStackingClippingLayer const):
2025         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
2026         (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
2027         (WebCore::RenderLayerCompositor::requiresCompositingLayer const):
2028         (WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
2029         (WebCore::RenderLayerCompositor::reasonsForCompositing const):
2030         (WebCore::RenderLayerCompositor::requiresCompositingForBackfaceVisibility const):
2031         (WebCore::RenderLayerCompositor::isViewportConstrainedFixedOrStickyLayer const):
2032         (WebCore::RenderLayerCompositor::requiresCompositingForPosition const):
2033         (WebCore::RenderLayerCompositor::requiresCompositingForOverflowScrolling const):
2034         (WebCore::RenderLayerCompositor::requiresCompositingForScrolling const): Deleted.
2035         * rendering/RenderLayerCompositor.h:
2036
2037 2018-09-24  Youenn Fablet  <youenn@apple.com>
2038
2039         Enable conversion of libwebrtc internal frames as CVPixelBuffer
2040         https://bugs.webkit.org/show_bug.cgi?id=189892
2041
2042         Reviewed by Eric Carlson.
2043
2044         Make sure to handle the case of libwebrtc frames that are not backed by CVPixelBuffer.
2045         No observable change of behavior.
2046
2047         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
2048         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
2049         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
2050         Update according renamed methods.
2051         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h:
2052         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
2053         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
2054         In case of libwebrtc frame that are not backed by CVPixelBuffer, we create
2055         a CVPixelBuffer from a pixel buffer pool.
2056         This CVPixelBuffer is then filled as part of webrtc::pixelBufferFromFrame.
2057         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm:
2058         (WebCore::RealtimeOutgoingVideoSourceCocoa::convertToYUV):
2059         Make sure to use preferred pixel buffer format.
2060
2061 2018-09-24  Eric Carlson  <eric.carlson@apple.com>
2062
2063         [MediaStream] Add mock window capture source
2064         https://bugs.webkit.org/show_bug.cgi?id=189843
2065         <rdar://problem/44687445>
2066
2067         Reviewed by Youenn Fablet.
2068
2069         No new tests, the API is disabled and it isn't possible to test yet.
2070
2071         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2072         (WebCore::AVVideoCaptureSource::processNewFrame): Remove an extra blank line.
2073
2074         * platform/mock/MockMediaDevice.h:
2075         (WebCore::MockDisplayProperties::encode const): Get rid of defaultFrameRate, add type.
2076         (WebCore::MockDisplayProperties::decode): Ditto.
2077         (WebCore::MockMediaDevice::type const):
2078
2079         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2080         (WebCore::defaultDevices): Add mock window devices.
2081         (WebCore::MockRealtimeMediaSourceCenter::audioDevices): Cleanup.
2082         (WebCore::MockRealtimeMediaSourceCenter::videoDevices): Cleanup.
2083         (WebCore::MockRealtimeMediaSourceCenter::displayDevices): New.
2084
2085         * platform/mock/MockRealtimeVideoSource.cpp:
2086         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): Set default size on displays.
2087         (WebCore::MockRealtimeVideoSource::supportsSizeAndFrameRate): Call RealtimeVideoSource for 
2088         mock camera, base class for device.
2089         (WebCore::MockRealtimeVideoSource::setSizeAndFrameRate): Ditto.
2090         (WebCore::MockRealtimeVideoSource::generatePresets): ASSERT if called as a camera.
2091         (WebCore::MockRealtimeVideoSource::capabilities): updateCapabilities is only appropriate for cameras.
2092         (WebCore::MockRealtimeVideoSource::settings): Camera and Device are different surface types.
2093         (WebCore::MockRealtimeVideoSource::drawText): Render name, not ID.
2094         (WebCore::MockRealtimeVideoSource::mockDisplayType const):
2095
2096         * platform/mock/MockRealtimeVideoSource.h:
2097         (WebCore::MockRealtimeVideoSource::mockDisplay const):
2098         (WebCore::MockRealtimeVideoSource::mockScreen const):
2099         (WebCore::MockRealtimeVideoSource::mockWindow const):
2100
2101 2018-09-24  Daniel Bates  <dabates@apple.com>
2102
2103         [iOS] Key code is 0 for many hardware keyboard keys
2104         https://bugs.webkit.org/show_bug.cgi?id=189604
2105
2106         Reviewed by Wenson Hsieh.
2107
2108         Based off a patch by Jeremy Jones.
2109
2110         Add iOS-specific implementation of windowsKeyCodeForKeyCode() to map an iOS virtual key code to
2111         the corresponding Windows virtual key code. Only hardware keyboard-generated events have a
2112         virtual key code. For software-generated keyboard events we do what we do now and compute the
2113         Windows virtual key code from the character string associated with the event.
2114
2115         When a WebEvent is instantiated with a non-zero iOS virtual key code (keyCode) we now always
2116         convert it to its corresponding Windows virtual key code without considering the specified
2117         charactersIgnoringModifiers character string. Currently we prefer computing the key code from
2118         charactersIgnoringModifiers regardless of whether a non-zero iOS virtual key code was given.
2119         However this causes special keys, including function keys (e.g. F10) to be misidentified because
2120         keyboard layouts in iOS (at least iOS 12) map such special keys to ASCII control characters (e.g.
2121         F10 maps to ASCII control character "data link escape" = 0x10) as opposed to special 16-bit
2122         integral constants as we do on Mac (e.g. F10 maps to NSF10FunctionKey = 0xF70D on Mac). I will
2123         look to fix up the computation of a Windows virtual key code from a char code on iOS in a
2124         subsequent commit(s). For now, computing the Windows virtual key code directly from the iOS
2125         virtual key code specified to the WebEvent constructor avoids the misidentification using
2126         an ANSI US keyboard layout.
2127
2128         * platform/cocoa/KeyEventCocoa.mm:
2129         (WebCore::windowsKeyCodeForKeyCode): Deleted; moved to KeyEventMac.mm as this mapping is specific to Mac.
2130         * platform/ios/KeyEventIOS.mm:
2131         (WebCore::windowsKeyCodeForKeyCode): Added.
2132         * platform/ios/WebEvent.mm:
2133         (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:keyCode:isTabKey:characterSet:]): Address the NOTE comment and compute the Windows virtual key code from
2134         the iOS virtual key code when we have one. Also inline the value of an unncessary local variable.
2135         (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:withInputManagerHint:keyCode:isTabKey:]): Ditto.
2136         * platform/mac/KeyEventMac.mm:
2137         (WebCore::windowsKeyCodeForKeyCode): Moved from KeyEventCocoa.mm. Updated code to make use of WTF_ARRAY_LENGTH() instead
2138         of hardcoding the upper bound of the lookup table.
2139
2140 2018-09-24  Simon Fraser  <simon.fraser@apple.com>
2141
2142         feMorphology filter in CSS doesn't update when element moves
2143         https://bugs.webkit.org/show_bug.cgi?id=189895
2144
2145         Reviewed by Dean Jackson.
2146         
2147         SourceAlpha needs to be invalidated from clearIntermediateResults(),
2148         so get it from the SVGFilterBuilder (which always creates one) and store in
2149         a member variable.
2150
2151         Test: css3/filters/invalidate-sourceAlpha.html
2152
2153         * rendering/CSSFilter.cpp:
2154         (WebCore::CSSFilter::buildReferenceFilter):
2155         (WebCore::CSSFilter::clearIntermediateResults):
2156         * rendering/CSSFilter.h:
2157         * svg/graphics/filters/SVGFilterBuilder.h:
2158
2159 2018-09-24  Simon Fraser  <simon.fraser@apple.com>
2160
2161         CSS reference filter with feDisplacementMap shows buffer corruption on Retina displays
2162         https://bugs.webkit.org/show_bug.cgi?id=188486
2163         <rdar://problem/43189750>
2164
2165         Reviewed by Dean Jackson.
2166         
2167         The paintSize needs to be scaled by filterScale on Retina displays.
2168
2169         Test: css3/filters/hidpi-feDisplacementMap.html
2170
2171         * platform/graphics/filters/FEDisplacementMap.cpp:
2172         (WebCore::FEDisplacementMap::platformApplySoftware):
2173         * platform/graphics/filters/FEDisplacementMap.h:
2174
2175 2018-09-24  Simon Fraser  <simon.fraser@apple.com>
2176
2177         ReferenceFilterOperation doesn't need to store the FilterEffect
2178         https://bugs.webkit.org/show_bug.cgi?id=189904
2179
2180         Reviewed by Dean Jackson.
2181
2182         ReferenceFilterOperation doesn't do anything with m_filterEffect so don't store it.
2183
2184         * platform/graphics/filters/FilterOperation.cpp:
2185         (WebCore::ReferenceFilterOperation::setFilterEffect): Deleted.
2186         * platform/graphics/filters/FilterOperation.h:
2187         (WebCore::ReferenceFilterOperation::filterEffect const): Deleted.
2188         * rendering/CSSFilter.cpp:
2189         (WebCore::CSSFilter::build):
2190
2191 2018-09-24  Simon Fraser  <simon.fraser@apple.com>
2192
2193         Garbled rendering of image when applied feConvolveMatrix to it, on Retina display
2194         https://bugs.webkit.org/show_bug.cgi?id=189748
2195         <rdar://problem/44621494>
2196
2197         Reviewed by Jon Lee.
2198         
2199         feConvolveMatrix needs to scale the paintSize by the filter scale (2x on Retina displays),
2200         otherwise parts of the output buffer are uninitialized and the result is incorrect.
2201
2202         Test: css3/filters/hidpi-feConvolveMatrix.html
2203
2204         * platform/graphics/filters/FEConvolveMatrix.cpp:
2205         (WebCore::FEConvolveMatrix::platformApplySoftware):
2206
2207 2018-09-22  Dean Jackson  <dino@apple.com>
2208
2209         Ensure PointerEvent is not visible when disabled
2210         https://bugs.webkit.org/show_bug.cgi?id=189889
2211         <rdar://problem/44708253>
2212
2213         Reviewed by Eric Carlson.
2214
2215         Test: pointerevents/disabled.html
2216
2217         * bindings/js/WebCoreBuiltinNames.h: Now that it is enabled at runtime, it needs
2218         a built-in name.
2219         * dom/PointerEvent.idl: Add EnabledAtRuntime.
2220
2221 2018-09-24  Alicia Boya García  <aboya@igalia.com>
2222
2223         [MSE][GStreamer] Pull demuxed samples in batches
2224         https://bugs.webkit.org/show_bug.cgi?id=189871
2225
2226         Reviewed by Xabier Rodriguez-Calvar.
2227
2228         After this patch, only the notifications of "new samples available"
2229         (appsink-new-sample bus messages) travel from the streaming thread to
2230         the main thread through the bus and the main thread is the responsible
2231         of pulling as many samples as it can from appsink. Before, the samples
2232         were pulled from appsink in the non-main thread and traveled to the
2233         main thread through the bus one by one.
2234
2235         This reduces drastically the amount of context switches and waiting
2236         time in the streaming thread, resulting in a noticeable performance
2237         improvement.
2238
2239         This fixes stutter while loading YouTube videos.
2240
2241         * platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
2242         (WebCore::MediaSampleGStreamer::MediaSampleGStreamer):
2243         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2244         (WebCore::AppendPipeline::AppendPipeline):
2245         (WebCore::AppendPipeline::~AppendPipeline):
2246         (WebCore::AppendPipeline::clearPlayerPrivate):
2247         (WebCore::AppendPipeline::handleApplicationMessage):
2248         (WebCore::AppendPipeline::appsinkNewSample):
2249         (WebCore::AppendPipeline::consumeAppSinkAvailableSamples):
2250         (WebCore::AppendPipeline::resetPipeline):
2251         (WebCore::AppendPipeline::handleNewAppsinkSample):
2252         * platform/graphics/gstreamer/mse/AppendPipeline.h:
2253
2254 2018-09-24  Per Arne Vollan  <pvollan@apple.com>
2255
2256         [WebVTT] Change name of WebVTT region attribute 'height' to 'lines'.
2257         https://bugs.webkit.org/show_bug.cgi?id=189862
2258
2259         Reviewed by Eric Carlson.
2260
2261         The WebVTT region attribute 'height' has been renamed to 'lines', see https://w3c.github.io/webvtt/#region-settings.
2262
2263         No new tests, covered by existing tests.
2264
2265         * html/track/VTTRegion.cpp:
2266         (WebCore::VTTRegion::setLines):
2267         (WebCore::VTTRegion::updateParametersFromRegion):
2268         (WebCore::VTTRegion::scanSettingName):
2269         (WebCore::VTTRegion::parseSettingValue):
2270         (WebCore::VTTRegion::prepareRegionDisplayTree):
2271         (WebCore::VTTRegion::setHeight): Deleted.
2272         * html/track/VTTRegion.h:
2273         * html/track/VTTRegion.idl:
2274
2275 2018-09-24  Alicia Boya García  <aboya@igalia.com>
2276
2277         [MSE][GStreamer] Use no-more-pads event for noticing initialization segments
2278         https://bugs.webkit.org/show_bug.cgi?id=189868
2279
2280         Reviewed by Xabier Rodriguez-Calvar.
2281
2282         Fixes the following YTTV 2018 tests:
2283         62.VideoDimensionVP9
2284         63.PlaybackStateVP9
2285
2286         This removes the hack that was making supporting multiple tracks in
2287         the same file in MSE impossible.
2288
2289         For WebM, this GStreamer patch is required:
2290         https://bugzilla.gnome.org/show_bug.cgi?id=797187
2291         "matroskademux: Emit no-more-pads after parsing Tracks"
2292
2293         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2294         (WebCore::AppendPipeline::AppendPipeline):
2295         (WebCore::AppendPipeline::handleApplicationMessage):
2296         (WebCore::AppendPipeline::demuxerNoMorePads):
2297         (WebCore::AppendPipeline::appsinkCapsChanged):
2298         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
2299         (WebCore::AppendPipeline::appendPipelineDemuxerNoMorePadsFromAnyThread):
2300         (WebCore::appendPipelineDemuxerNoMorePads):
2301         * platform/graphics/gstreamer/mse/AppendPipeline.h:
2302
2303 2018-09-24  Thibault Saunier  <tsaunier@igalia.com>
2304
2305         [WPE][GTK][WebRTC] Fix leaks in the libwebrtc Decoder and Encoder
2306         https://bugs.webkit.org/show_bug.cgi?id=189835
2307
2308         Reviewed by Philippe Normand.
2309
2310         - Rework memory management to avoid leaking encoded frames (basically use the same
2311           strategy as other libwebrtc encoder implementation).
2312         - Plug a GstCaps leak.
2313
2314         * platform/mediastream/gstreamer/GStreamerVideoCapturer.cpp:
2315         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
2316         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
2317         (WebCore::GStreamerVideoEncoder::InitEncode):
2318         (WebCore::GStreamerVideoEncoder::newSampleCallback):
2319         (WebCore::GStreamerVideoEncoder::Fragmentize):
2320         (WebCore::GStreamerVideoEncoder::SetRestrictionCaps):
2321
2322 2018-09-24  Philippe Normand  <pnormand@igalia.com>
2323
2324         [GStreamer] Utilities cleanups
2325         https://bugs.webkit.org/show_bug.cgi?id=189699
2326         <rdar://problem/44634143>
2327
2328         Reviewed by Xabier Rodriguez-Calvar.
2329
2330         The GstMappedBuffer now has a move constructor so that it can be easily
2331         reused in the webaudiosrc element. The now-unused corresponding
2332         buffer-mapping utilities are removed from the code-base.
2333
2334         The HTTP source element used to handle a GstBuffer in its private
2335         structure but this is no longer required since data is now pushed
2336         in chunks, see bug #182829.
2337
2338         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
2339         (webKitWebAudioSrcLoop):
2340         * platform/graphics/gstreamer/GStreamerCommon.cpp:
2341         (WebCore::createGstBuffer): Deleted.
2342         (WebCore::createGstBufferForData): Deleted.
2343         (WebCore::getGstBufferDataPointer): Deleted.
2344         (WebCore::mapGstBuffer): Deleted.
2345         (WebCore::unmapGstBuffer): Deleted.
2346         * platform/graphics/gstreamer/GStreamerCommon.h:
2347         (WebCore::GstMappedBuffer::create): New method returning a
2348         reference to a newly created GstMappedBuffer instance.
2349         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2350         (webKitWebSrcStop): Remove reference to unused GstBuffer.
2351         (CachedResourceStreamingClient::dataReceived): Ditto.
2352
2353 2018-09-24  Enrique Ocaña González  <eocanha@igalia.com>
2354
2355         [MSE][GStreamer] Don't update duration when it was not previously NaN
2356         https://bugs.webkit.org/show_bug.cgi?id=189869
2357
2358         Reviewed by Xabier Rodriguez-Calvar.
2359
2360         This is what the spec mandates. The spec doesn't say anything about
2361         updating duration when it had been previously set, even if the new
2362         init segment says that the duration is growing.
2363
2364         This fixes MSE YTTV 2018 69.MediaSourceDurationVP9.
2365
2366         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2367         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
2368
2369 2018-09-23  Frederic Wang  <fwang@igalia.com>
2370
2371         Add missing includes in TextCodecReplacement.cpp
2372         https://bugs.webkit.org/show_bug.cgi?id=189894
2373
2374         Reviewed by Darin Adler.
2375
2376         No new tests, behavior unchanged.
2377
2378         * platform/text/TextCodecReplacement.cpp: Add missing headers.
2379
2380 2018-09-22  Adrian Perez de Castro  <aperez@igalia.com>
2381
2382         [ARM] Building FELightingNEON.cpp fails due to missing lightVector member
2383         https://bugs.webkit.org/show_bug.cgi?id=189890
2384
2385         Reviewed by Darin Adler.
2386
2387         No new tests needed.
2388
2389         * platform/graphics/cpu/arm/filters/FELightingNEON.h:
2390         (WebCore::FELighting::platformApplyNeon): Adapt to new layout of "struct PaintingData" after r225122.
2391
2392 2018-09-22  Zan Dobersek  <zdobersek@igalia.com>
2393
2394         [Cairo] Null-check cairo_pattern_t gradient objects
2395         https://bugs.webkit.org/show_bug.cgi?id=189820
2396
2397         Reviewed by Alex Christensen.
2398
2399         Cairo-specific implementation of Gradient::createPlatformGradient() can
2400         now return a nullptr value when a conic gradient is described by the
2401         Gradient object. Cairo doesn't have a way to create cairo_pattern_t
2402         objects for such gradients.
2403
2404         Null-checks are now done on return values of createPlatformGradient(),
2405         in order to avoid proceeding to paint a null cairo_pattern_t object.
2406
2407         * platform/graphics/cairo/GradientCairo.cpp:
2408         (WebCore::Gradient::fill):
2409         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
2410         (WebCore::GraphicsContextImplCairo::fillRect):
2411
2412 2018-09-21  Ryosuke Niwa  <rniwa@webkit.org>
2413
2414         Cannot start a drag inside a shadow tree when an inclusive-ancestor of its shadow host is a draggable element
2415         https://bugs.webkit.org/show_bug.cgi?id=136836
2416
2417         Reviewed by Wenson Hsieh.
2418
2419         Fixed the bug by simply generalizing the existing code path existed for video / input type=color.
2420
2421         Tests: fast/shadow-dom/dragging-element-inside-shadow-tree.html
2422                fast/shadow-dom/dragging-element-with-shadow-tree.html
2423
2424         * page/DragController.cpp:
2425         (WebCore::DragController::startDrag):
2426
2427 2018-09-22  Chris Dumez  <cdumez@apple.com>
2428
2429         FontDataCache should use Ref<Font> instead of a RefPtr<Font>
2430         https://bugs.webkit.org/show_bug.cgi?id=189861
2431
2432         Reviewed by Antti Koivisto.
2433
2434         * platform/graphics/FontCache.cpp:
2435         (WebCore::FontCache::fontForPlatformData):
2436         (WebCore::FontCache::purgeInactiveFontData):
2437
2438 2018-09-21  Justin Michaud  <justin_michaud@apple.com>
2439
2440         Implement initialValue support for CSS Custom Properties and Values API
2441         https://bugs.webkit.org/show_bug.cgi?id=189819
2442
2443         Reviewed by Simon Fraser.
2444
2445         * css/CSSComputedStyleDeclaration.cpp:
2446         (WebCore::ComputedStyleExtractor::customPropertyValue):
2447         * css/CSSCustomPropertyValue.cpp:
2448         (WebCore::CSSCustomPropertyValue::resolveVariableReferences const):
2449         * css/CSSCustomPropertyValue.h:
2450         * css/CSSRegisteredCustomProperty.h:
2451         * css/CSSVariableData.cpp:
2452         (WebCore::CSSVariableData::resolveVariableFallback const):
2453         (WebCore::CSSVariableData::resolveVariableReference const):
2454         (WebCore::CSSVariableData::resolveVariableReferences const):
2455         (WebCore::CSSVariableData::resolveTokenRange const):
2456         * css/CSSVariableData.h:
2457         * css/DOMCSSRegisterCustomProperty.cpp:
2458         (WebCore::DOMCSSRegisterCustomProperty::registerProperty):
2459         * css/DOMCSSRegisterCustomProperty.h:
2460         * css/DOMCSSRegisterCustomProperty.idl:
2461         * css/StyleResolver.cpp:
2462         (WebCore::StyleResolver::resolvedVariableValue):
2463         (WebCore::StyleResolver::applyCascadedProperties):
2464         * css/parser/CSSParser.cpp:
2465         (WebCore::CSSParser::parseValueWithVariableReferences):
2466         * css/parser/CSSParser.h:
2467         * dom/Document.h:
2468         (WebCore::Document::getCSSRegisteredCustomPropertySet const):
2469         * rendering/style/RenderStyle.cpp:
2470         (WebCore::RenderStyle::checkVariablesInCustomProperties):
2471         * rendering/style/RenderStyle.h:
2472
2473 2018-09-21  Dean Jackson  <dino@apple.com>
2474
2475         Add PointerEvent, plus feature flag, plus Web Platform Tests
2476         https://bugs.webkit.org/show_bug.cgi?id=189867
2477         <rdar://problem/44697384>
2478
2479         Reviewed by Simon Fraser.
2480
2481         Add the PointerEvent interface.
2482
2483         Tests: imported/w3c/web-platform-tests/pointerevents/extension/idlharness.window.html
2484                imported/w3c/web-platform-tests/pointerevents/extension/pointerevent_constructor.html
2485                imported/w3c/web-platform-tests/pointerevents/extension/pointerevent_touch-action-verification.html
2486                imported/w3c/web-platform-tests/pointerevents/idlharness.window.html
2487                imported/w3c/web-platform-tests/pointerevents/pointerevent_constructor.html
2488                imported/w3c/web-platform-tests/pointerevents/pointerevent_on_event_handlers.html
2489                imported/w3c/web-platform-tests/pointerevents/pointerevent_touch-action-illegal.html
2490                imported/w3c/web-platform-tests/pointerevents/pointerevent_touch-action-verification.html
2491
2492         * DerivedSources.make:
2493         * Sources.txt:
2494         * WebCore.xcodeproj/project.pbxproj:
2495                 Add the new files.
2496
2497         * dom/Event.h:
2498         (WebCore::Event::isPointerEvent const): New virtual identification method.
2499
2500         * dom/EventNames.in: Add PointerEvent so the InterfaceType code is generated.
2501
2502         * dom/PointerEvent.cpp: The PointerEvent interface, as specified by W3C.
2503         (WebCore::PointerEvent::PointerEvent):
2504         (WebCore::PointerEvent::eventInterface const):
2505         * dom/PointerEvent.h: Added.
2506         * dom/PointerEvent.idl: Added.
2507
2508         * page/RuntimeEnabledFeatures.h: Clean up the ordering of the features, so there aren't
2509         confusing blank lines interspersed with #if USE macros.
2510         (WebCore::RuntimeEnabledFeatures::setPointerEventsEnabled): Add a new flag for Pointer Events.
2511         (WebCore::RuntimeEnabledFeatures::pointerEventsEnabled const):
2512
2513 2018-09-21  Ryosuke Niwa  <rniwa@webkit.org>
2514
2515         Custom elements in a reaction queue can lose its JS wrapper and become HTMLUnknownElement
2516         https://bugs.webkit.org/show_bug.cgi?id=184307
2517
2518         Reviewed by Keith Miller.
2519
2520         The bug was caused by the custom elements reaction queue not reporting its content to GC during marking.
2521
2522         When there is no JS reference to the JS wrappers of those custom element, and if those custom elements
2523         are disconnected, GC would happily collect those the wrappers. Unfortunately, the same bug exists for
2524         any asynchronous events and other WebCore code which keeps elements alive for a later use but doesn't
2525         report them to GC (e.g. during visitChildren).
2526
2527         This patch, therefore, introduces a generic mechanism to keep these elements' wrappers alive. Namely,
2528         we introduce GCReachableRef, a new smart pointer type for Node's subclasses, which keeps element as well
2529         as its wrappers alive. GCReachableRef works by adding its Node to a global hash counted set when it's
2530         created and making JSNodeOwner::isReachableFromOpaqueRoots return true when the node is in the set.
2531
2532         Test: fast/custom-elements/custom-elements-reaction-queue-retains-js-wrapper.html
2533
2534         * Sources.txt:
2535         * WebCore.xcodeproj/project.pbxproj:
2536         * bindings/js/JSNodeCustom.cpp:
2537         (WebCore::isReachableFromDOM):
2538         * dom/CustomElementReactionQueue.cpp:
2539         (WebCore::CustomElementReactionQueue::ElementQueue::invokeAll): Don't swap the vector of elements in
2540         in the queue. Assuming each DOM API has an appropriate CustomElementsReactionStack, we should never
2541         append a new element to this queue while invoking custom element reactions.
2542         * dom/CustomElementReactionQueue.h:
2543         * dom/GCReachableRef.cpp: Added.
2544         * dom/GCReachableRef.h: Added.
2545         (WebCore::GCReachableRefMap::contains): Added.
2546         (WebCore::GCReachableRefMap::add): Added.
2547         (WebCore::GCReachableRefMap::remove): Added.
2548         (WebCore::GCReachableRef::GCReachableRef): Added. We need isNull() check since WTFMove may have been
2549         called on the source GCReachableRef.
2550         (WebCore::GCReachableRef::~GCReachableRef): Ditto.
2551         (WebCore::GCReachableRef::operator-> const): Added.
2552         (WebCore::GCReachableRef::get const): Added.
2553         (WebCore::GCReachableRef::operator T& const): Added.
2554         (WebCore::GCReachableRef::operator! const): Added.
2555         (WebCore::GCReachableRef::isNull const): Added. Returns true if WTFMove had been called on Ref.
2556
2557 2018-09-21  Alex Christensen  <achristensen@webkit.org>
2558
2559         Use a Variant for FormDataElement
2560         https://bugs.webkit.org/show_bug.cgi?id=189777
2561
2562         Reviewed by Chris Dumez.
2563
2564         * platform/network/FormData.cpp:
2565         (WebCore::FormData::FormData):
2566         (WebCore::FormDataElement::lengthInBytes const):
2567         (WebCore::FormDataElement::isolatedCopy const):
2568         (WebCore::FormData::appendData):
2569         (WebCore::FormData::flatten const):
2570         (WebCore::FormData::resolveBlobReferences):
2571         (WebCore::FormData::generateFiles):
2572         (WebCore::FormData::hasGeneratedFiles const):
2573         (WebCore::FormData::hasOwnedGeneratedFiles const):
2574         (WebCore::FormData::removeGeneratedFilesIfNeeded):
2575         (WebCore::FormData::asSharedBuffer const):
2576         (WebCore::FormData::asBlobURL const):
2577         (WebCore::FormData::expandDataStore): Deleted.
2578         * platform/network/FormData.h:
2579         (WebCore::FormDataElement::FormDataElement):
2580         (WebCore::FormDataElement::encode const):
2581         (WebCore::FormDataElement::decode):
2582         (WebCore::FormDataElement::EncodedFileData::isolatedCopy const):
2583         (WebCore::FormDataElement::EncodedFileData::operator== const):
2584         (WebCore::FormDataElement::EncodedFileData::encode const):
2585         (WebCore::FormDataElement::EncodedFileData::decode):
2586         (WebCore::FormDataElement::EncodedBlobData::operator== const):
2587         (WebCore::FormDataElement::EncodedBlobData::encode const):
2588         (WebCore::FormDataElement::EncodedBlobData::decode):
2589         (WebCore::FormDataElement::operator== const):
2590         (WebCore::FormDataElement::operator!= const):
2591         * platform/network/cf/FormDataStreamCFNet.cpp:
2592         (WebCore::advanceCurrentStream):
2593         (WebCore::createHTTPBodyCFReadStream):
2594         (WebCore::setHTTPBody):
2595         * platform/network/curl/CurlFormDataStream.cpp:
2596         (WebCore::CurlFormDataStream::computeContentLength):
2597         (WebCore::CurlFormDataStream::read):
2598         (WebCore::CurlFormDataStream::readFromFile):
2599         (WebCore::CurlFormDataStream::readFromData):
2600         * platform/network/curl/CurlFormDataStream.h:
2601
2602 2018-09-20  Simon Fraser  <simon.fraser@apple.com>
2603
2604         Simplify the logic around has*ScrollbarWithAutoBehavior
2605         https://bugs.webkit.org/show_bug.cgi?id=189813
2606
2607         Reviewed by Zalan Bujtas.
2608
2609         The boolean logic in scrollsOverflowX() and hasHorizontalScrollbarWithAutoBehavior() (and the vertical
2610         equivalents) reduces simply to hasOverflowClip() && (style().overflowX() == Overflow::Scroll || style().overflowX() == Overflow::Auto);
2611         
2612         Similarly, RenderBox::intrinsicScrollbarLogicalWidth() just needs the part of the logic
2613         that asks whether the theme uses overlay scrollbars which are not customized (and thus
2614         turned into non-overlay scrollbars).
2615
2616         * rendering/RenderBox.cpp:
2617         (WebCore::RenderBox::intrinsicScrollbarLogicalWidth const):
2618         (WebCore::RenderBox::canUseOverlayScrollbars const):
2619         (WebCore::RenderBox::hasVerticalScrollbarWithAutoBehavior const):
2620         (WebCore::RenderBox::hasHorizontalScrollbarWithAutoBehavior const):
2621         * rendering/RenderBox.h:
2622         (WebCore::RenderBox::scrollsOverflowX const):
2623         (WebCore::RenderBox::scrollsOverflowY const):
2624         * rendering/RenderLayer.cpp:
2625         (WebCore::RenderLayer::updateScrollbarsAfterLayout):
2626
2627 2018-09-21  Michael Catanzaro  <mcatanzaro@igalia.com>
2628
2629         Unreviewed, rolling out r236255.
2630
2631         Many WebAudio crashes
2632
2633         Reverted changeset:
2634
2635         "[GStreamer] Utilities cleanups"
2636         https://bugs.webkit.org/show_bug.cgi?id=189699
2637         https://trac.webkit.org/changeset/236255
2638
2639 2018-09-21  Jer Noble  <jer.noble@apple.com>
2640
2641         Move AVVideoPerformanceMetrics into AVFoundationSPI.h
2642         https://bugs.webkit.org/show_bug.cgi?id=189842
2643
2644         Reviewed by Jon Lee.
2645
2646         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2647
2648 2018-09-21  Chris Dumez  <cdumez@apple.com>
2649
2650         WebSQL: User cannot grant quota increase if the JS provides an expected usage value that is too low
2651         https://bugs.webkit.org/show_bug.cgi?id=189801
2652         <rdar://problem/43592498>
2653
2654         Reviewed by Youenn Fablet.
2655
2656         User was unable to grant a quota increase for WebSQL if the JS provided an expected usage value that
2657         is too low. This is because WebKit was passing this provided expectedUsage value to the client for
2658         the purpose of quota increase, even when this expectedUsage value does not make any sense (i.e. it
2659         is lower than the current database size). As a result, the client would grant a quota that is equal
2660         to the previous quota and the JS would not be able to insert any data.
2661
2662         In order to address the issue, when the current quota is exceeded and Database::didExceedQuota()
2663         is called, we now make sure that the expectedUsage value is greater than the current quota. If it
2664         is not, we provide `current quota + 5MB` as expected usage to the client. This way, the client will
2665         grant a quota that is actually increased (provided that the user accepts).
2666
2667         Test: storage/websql/transaction-database-expand-quota.html
2668
2669         * Modules/webdatabase/Database.cpp:
2670         (WebCore::Database::setEstimatedSize):
2671         (WebCore::Database::didExceedQuota):
2672         * Modules/webdatabase/Database.h:
2673
2674 2018-09-21  Youenn Fablet  <youenn@apple.com>
2675
2676         Use biplanar CVPixelBuffer for black frames sent to libwebrtc
2677         https://bugs.webkit.org/show_bug.cgi?id=189837
2678
2679         Reviewed by Eric Carlson.
2680
2681         Covered by webrtc/video-mute.html.
2682
2683         Add support to call CVPixelBufferGetBytesPerRowOfPlane.
2684         Make createBlackPixelBuffer use a biplanar CVPixelBuffer as this is better supported in libwebrtc.
2685         It is also what is being used in iOS for capture.
2686
2687         * platform/cocoa/CoreVideoSoftLink.cpp:
2688         * platform/cocoa/CoreVideoSoftLink.h:
2689         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
2690         (WebCore::createBlackPixelBuffer):
2691
2692 2018-09-21  Youenn Fablet  <youenn@apple.com>
2693
2694         Add RTCCodecStats support
2695         https://bugs.webkit.org/show_bug.cgi?id=189792
2696         <rdar://problem/32370668>
2697
2698         Reviewed by Eric Carlson.
2699
2700         Covered by updated and rebased tests.
2701
2702         * Modules/mediastream/RTCStatsReport.h:
2703         Removed fields that are already defined in the base class.
2704         (WebCore::RTCStatsReport::CodecStats::CodecStats):
2705         Add support for RTCCodecStats.
2706         * Modules/mediastream/RTCStatsReport.idl:
2707         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2708         (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
2709         * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp:
2710         (WebCore::fillRTCRTPStreamStats):
2711         (WebCore::fillRTCCodecStats):
2712         (WebCore::LibWebRTCStatsCollector::OnStatsDelivered):
2713         Add routines to fill RTCCodecStats from libwebrtc stats.
2714
2715 2018-09-20  Simon Fraser  <simon.fraser@apple.com>
2716
2717         Make "overflow: overlay" a synonym for "overflow: auto"
2718         https://bugs.webkit.org/show_bug.cgi?id=189811
2719
2720         Reviewed by Zalan Bujtas.
2721         
2722         The "overlay" value for overflow was added for an internal Safari feature, and only has
2723         an effect (allow the scrollbar to overlap the content) with legacy scrollbars on macOS.
2724         It's little used on the web.
2725
2726         To simplify code in rendering, just make "overflow: overlay" behave like "overflow: auto".
2727         It's still parsed, but turns into an "auto" value internally, and will be returned from getComputedStyle
2728         as "auto".
2729
2730         Test: fast/css/getComputedStyle/getComputedStyle-overflow.html
2731
2732         * css/CSSPrimitiveValueMappings.h:
2733         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2734         (WebCore::CSSPrimitiveValue::operator Overflow const):
2735         * css/CSSProperties.json:
2736         * css/CSSValueKeywords.in:
2737         * css/StyleResolver.cpp:
2738         (WebCore::isScrollableOverflow):
2739         * css/parser/CSSParserFastPaths.cpp:
2740         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2741         * page/ios/FrameIOS.mm:
2742         (WebCore::Frame::nodeRespondingToScrollWheelEvents):
2743         * rendering/RenderBox.cpp:
2744         (WebCore::RenderBox::hasVerticalScrollbarWithAutoBehavior const):
2745         (WebCore::RenderBox::hasHorizontalScrollbarWithAutoBehavior const):
2746         * rendering/RenderLayer.cpp:
2747         (WebCore::styleDefinesAutomaticScrollbar):
2748         * rendering/RenderLayerCompositor.cpp:
2749         (WebCore::isScrollableOverflow):
2750         * rendering/style/RenderStyleConstants.h:
2751
2752 2018-09-21  Youenn Fablet  <youenn@apple.com>
2753
2754         Centralize which CVPixelBuffer format is being used
2755         https://bugs.webkit.org/show_bug.cgi?id=189772
2756
2757         Reviewed by Eric Carlson.
2758
2759         Get the format type from a single point.
2760         This changes the video capture and mock realtime video sources on Mac to use a biplanar format. 
2761         No observable change of behavior.
2762
2763         * WebCore.xcodeproj/project.pbxproj:
2764         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2765         (WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset):
2766         (WebCore::AVVideoCaptureSource::setupCaptureSession):
2767         (WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
2768         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
2769         (WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer):
2770         (WebCore::MockRealtimeVideoSourceMac::setSizeAndFrameRateWithPreset):
2771         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
2772         (WebCore::createBlackPixelBuffer):
2773         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
2774         (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated):
2775         * platform/mediastream/mac/RealtimeVideoUtilities.h: Added.
2776
2777 2018-09-21  Antoine Quint  <graouts@apple.com>
2778
2779         REGRESSION (r235962-r235963): Layout Test animations/suspend-resume-animation-events.html is a flaky failure
2780         https://bugs.webkit.org/show_bug.cgi?id=189607
2781         <rdar://problem/44652315>
2782
2783         Reviewed by Dean Jackson.
2784
2785         There is no reason we shouldn't return the document timeline's time when suspended as otherwise animations may
2786         report an unresolved current time when suspended which would wreak havoc when invalidating what DOM events to
2787         dispatch for CSS Animations and Transitions. We also shouldn't be invalidation DOM events when suspended.
2788
2789         * animation/DocumentTimeline.cpp:
2790         (WebCore::DocumentTimeline::currentTime):
2791         (WebCore::DocumentTimeline::DocumentTimeline::performInvalidationTask):
2792
2793 2018-09-21  Mike Gorse  <mgorse@suse.com>
2794
2795         Build tools should work when the /usr/bin/python is python3
2796         https://bugs.webkit.org/show_bug.cgi?id=156674
2797
2798         Reviewed by Michael Catanzaro.
2799
2800         No new tests (no behavior change).
2801
2802         * platform/network/create-http-header-name-table: remove xreadlines.
2803
2804 2018-09-21  Jer Noble  <jer.noble@apple.com>
2805
2806         [EME] Introduce the concept of CDMInstanceSession.
2807         https://bugs.webkit.org/show_bug.cgi?id=189725
2808
2809         Reviewed by Eric Carlson.
2810
2811         Currently, the same CDMInstance owned by a MediaKeys object is passed to every MediaKeySession created by that
2812         MediaKeys, and since the CDMInstance has only a single CDMInstanceClient, subsequent MediaKeySessions prevent
2813         previous ones from getting updates.
2814
2815         Add a new virtual interface, CDMInstanceSession, to be passed to MediaKeySession upon creation. Refactor
2816         CDMInstanceClearKey and CDMInstanceFairPlayStreamingAVFObjC to adopt this new interface.
2817
2818         Drive-by fixes: Made a number of virtual overrides in final classes final themselves.
2819
2820         * Modules/encryptedmedia/MediaKeySession.cpp:
2821         (WebCore::MediaKeySession::create):
2822         (WebCore::MediaKeySession::MediaKeySession):
2823         (WebCore::MediaKeySession::generateRequest):
2824         (WebCore::MediaKeySession::load):
2825         (WebCore::MediaKeySession::update):
2826         (WebCore::MediaKeySession::remove):
2827         (WebCore::MediaKeySession::updateKeyStatuses):
2828         * Modules/encryptedmedia/MediaKeySession.h:
2829         * Modules/encryptedmedia/MediaKeys.cpp:
2830         (WebCore::MediaKeys::createSession):
2831         * WebCore.xcodeproj/project.pbxproj:
2832         * platform/encryptedmedia/CDMInstance.h:
2833         (WebCore::CDMInstance::setHDCPStatus):
2834         (WebCore::CDMInstance::setClient): Deleted.
2835         (WebCore::CDMInstance::clearClient): Deleted.
2836         * platform/encryptedmedia/CDMInstanceSession.h: Copied from Source/WebCore/platform/encryptedmedia/CDMInstance.h.
2837         (WebCore::CDMInstanceSession::setClient):
2838         (WebCore::CDMInstanceSession::clearClient):
2839         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
2840         (WebCore::parseLicenseFormat):
2841         (WebCore::CDMInstanceClearKey::keySystem const):
2842         (WebCore::CDMInstanceClearKey::createSession):
2843         (WebCore::CDMInstanceSessionClearKey::requestLicense):
2844         (WebCore::CDMInstanceSessionClearKey::keys const):
2845         (WebCore::CDMInstanceSessionClearKey::updateLicense):
2846         (WebCore::CDMInstanceSessionClearKey::loadSession):
2847         (WebCore::CDMInstanceSessionClearKey::closeSession):
2848         (WebCore::CDMInstanceSessionClearKey::removeSessionData):
2849         (WebCore::CDMInstanceSessionClearKey::storeRecordOfKeyUsage):
2850         (WebCore::CDMInstanceClearKey::requestLicense): Deleted.
2851         (WebCore::CDMInstanceClearKey::keys const): Deleted.
2852         (WebCore::CDMInstanceClearKey::updateLicense): Deleted.
2853         (WebCore::CDMInstanceClearKey::loadSession): Deleted.
2854         (WebCore::CDMInstanceClearKey::closeSession): Deleted.
2855         (WebCore::CDMInstanceClearKey::removeSessionData): Deleted.
2856         (WebCore::CDMInstanceClearKey::storeRecordOfKeyUsage): Deleted.
2857         * platform/encryptedmedia/clearkey/CDMClearKey.h:
2858         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
2859         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2860         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::createSession):
2861         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::processContentKeyRequestForSession):
2862         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::processNextContentKeyRequest):
2863         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::keySystem const):
2864         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
2865         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRenewingRequest):
2866         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvidePersistableRequest):
2867         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
2868         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestDidSucceed):
2869         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::shouldRetryRequestForReason):
2870         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionIdentifierChanged):
2871         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
2872         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::CDMInstanceSessionFairPlayStreamingAVFObjC):
2873         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyIDs):
2874         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestLicense):
2875         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
2876         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::loadSession):
2877         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::closeSession):
2878         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData):
2879         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::storeRecordOfKeyUsage):
2880         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::setClient):
2881         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::clearClient):
2882         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest):
2883         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRenewingRequest):
2884         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvidePersistableRequest):
2885         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didFailToProvideRequest):
2886         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestDidSucceed):
2887         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::shouldRetryRequestForReason):
2888         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::sessionIdentifierChanged):
2889         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
2890         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::isLicenseTypeSupported const):
2891         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::isLicenseTypeSupported const): Deleted.
2892         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::keyIDs): Deleted.
2893         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestLicense): Deleted.
2894         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense): Deleted.
2895         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::loadSession): Deleted.
2896         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::closeSession): Deleted.
2897         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::removeSessionData): Deleted.
2898         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::storeRecordOfKeyUsage): Deleted.
2899         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setClient): Deleted.
2900         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::clearClient): Deleted.
2901         * testing/MockCDMFactory.cpp:
2902         (WebCore::MockCDMInstance::keySystem const):
2903         (WebCore::MockCDMInstance::createSession):
2904         (WebCore::MockCDMInstanceSession::MockCDMInstanceSession):
2905         (WebCore::MockCDMInstanceSession::requestLicense):
2906         (WebCore::MockCDMInstanceSession::updateLicense):
2907         (WebCore::MockCDMInstanceSession::loadSession):
2908         (WebCore::MockCDMInstanceSession::closeSession):
2909         (WebCore::MockCDMInstanceSession::removeSessionData):
2910         (WebCore::MockCDMInstanceSession::storeRecordOfKeyUsage):
2911         (WebCore::MockCDMInstance::requestLicense): Deleted.
2912         (WebCore::MockCDMInstance::updateLicense): Deleted.
2913         (WebCore::MockCDMInstance::loadSession): Deleted.
2914         (WebCore::MockCDMInstance::closeSession): Deleted.
2915         (WebCore::MockCDMInstance::removeSessionData): Deleted.
2916         (WebCore::MockCDMInstance::storeRecordOfKeyUsage): Deleted.
2917         * testing/MockCDMFactory.h:
2918         (WebCore::MockCDMInstance::factory const):
2919         (WebCore::MockCDMInstance::distinctiveIdentifiersAllowed const):
2920         (WebCore::MockCDMInstance::persistentStateAllowed const):
2921
2922 2018-09-21  Alicia Boya García  <aboya@igalia.com>
2923
2924         [MSE] Fix comparsion with uninitialized greatestDecodeDuration
2925         https://bugs.webkit.org/show_bug.cgi?id=189805
2926
2927         Reviewed by Michael Catanzaro.
2928
2929         This bug was causing greatestDecodeDuration to never be initialized,
2930         which in turned caused unintended frame erase as distant appends where
2931         not being recognized as distinct coded frame groups.
2932
2933         A test reproducing the sequence of appends that caused unintended
2934         frame deletion has also been added (media-source-append-out-of-order.html).
2935
2936         * Modules/mediasource/SourceBuffer.cpp:
2937         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
2938
2939 2018-09-21  Antoine Quint  <graouts@apple.com>
2940
2941         [Web Animations] Accelerated animations don't get suspended
2942         https://bugs.webkit.org/show_bug.cgi?id=189783
2943         <rdar://problem/44652315>
2944
2945         Unreviewed, correct a merge error in the previous commit.
2946
2947         * animation/DocumentTimeline.cpp:
2948         (WebCore::DocumentTimeline::performInvalidationTask):
2949
2950 2018-09-21  Antoine Quint  <graouts@apple.com>
2951
2952         [Web Animations] Accelerated animations don't get suspended
2953         https://bugs.webkit.org/show_bug.cgi?id=189783
2954         <rdar://problem/43033568>
2955
2956         Reviewed by Dean Jackson.
2957
2958         Test: webanimations/accelerated-animation-suspension.html
2959
2960         We used to set the flag that marked the timeline as suspended prior to notifying animations that they need to be suspended.
2961         However, since the timeline was marked as suspended, querying the running state of the animations would indicate that the
2962         animations weren't running since a suspended timeline would identify its animations as not running. As such we would fail
2963         to pause the accelerated animations because they were already not marked as running. We now set the suspended flag on the
2964         timeline _after_ suspending its animations.
2965
2966         We also fix a bug in the new internals.acceleratedAnimationsForElement() test function so that we read from the actual
2967         CA animations and not from a stale list of animations which would not indicate the correct animation speeds.
2968
2969         * animation/DocumentTimeline.cpp:
2970         (WebCore::DocumentTimeline::suspendAnimations):
2971         * platform/graphics/ca/GraphicsLayerCA.cpp:
2972         (WebCore::GraphicsLayerCA::acceleratedAnimationsForTesting):
2973
2974 2018-09-21  Zan Dobersek  <zdobersek@igalia.com>
2975
2976         TransformationMatrix::toColumnMajorFloatArray() should return a std::array<> object
2977         https://bugs.webkit.org/show_bug.cgi?id=189823
2978
2979         Reviewed by Michael Catanzaro.
2980
2981         Alias the TransformationMatrix::FloatMatrix4 type to
2982         std::array<float, 16>. Instead of filling out the array object that's
2983         passed in through a reference parameter, return the std::array<>
2984         object from the function.
2985
2986         * Modules/webvr/VRFrameData.cpp:
2987         (WebCore::matrixToArray):
2988         * Modules/webvr/VRStageParameters.cpp:
2989         (WebCore::VRStageParameters::sittingToStandingTransform const):
2990         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
2991         (WebCore::TextureMapperShaderProgram::setMatrix):
2992         * platform/graphics/transforms/TransformationMatrix.cpp:
2993         (WebCore::TransformationMatrix::toColumnMajorFloatArray const):
2994         * platform/graphics/transforms/TransformationMatrix.h:
2995
2996 2018-09-21  Zan Dobersek  <zdobersek@igalia.com>
2997
2998         FloatQuad point getters should return const references
2999         https://bugs.webkit.org/show_bug.cgi?id=189821
3000
3001         Reviewed by Yusuke Suzuki.
3002
3003         Be pedantic and have the FloatQuad point getters return const references
3004         to the FloatPoint member variables, instead of technically creating
3005         copies of them (though much of this copying is eliminated when the
3006         getters are inlined).
3007
3008         * platform/graphics/FloatQuad.h:
3009         (WebCore::FloatQuad::p1 const):
3010         (WebCore::FloatQuad::p2 const):
3011         (WebCore::FloatQuad::p3 const):
3012         (WebCore::FloatQuad::p4 const):
3013
3014 2018-09-20  Antoine Quint  <graouts@apple.com>
3015
3016         [Web Animations] DocumentTimeline::updateAnimations() is called endlessly
3017         https://bugs.webkit.org/show_bug.cgi?id=189784
3018         <rdar://problem/41705679>
3019
3020         Reviewed by Dean Jackson.
3021
3022         Test: webanimations/accelerated-animation-interruption-display-none.html
3023
3024         We have code that keeps queueing pending accelerated actions for an animation that does not have a renderer until it has one
3025         so that we can deal with situations where animations are ready to commited before its composited renderer is available. This
3026         code ended up running continuously when an element with an accelerated animation had its renderer removed without the animation
3027         being removed itself, such as setting "display: none" on an element with an acceelerated CSS Animation targeting it.
3028
3029         We fix this by queueing up a "Stop" accelerated action when updating the accelerated state if there is no renderer for the current
3030         animation target. Then, we no longer re-queue pending accelerated actions if the last queued operation is "Stop". This ensures that
3031         we no longer queue actions endlessly when there is no longer a visible animation.
3032
3033         To test this, we add a new internals.numberOfAnimationTimelineInvalidations() method that indicates the number of times the current
3034         document's animation timeline was invalidated.
3035
3036         * animation/DocumentTimeline.cpp:
3037         (WebCore::DocumentTimeline::updateAnimations):
3038         (WebCore::DocumentTimeline::numberOfAnimationTimelineInvalidationsForTesting const):
3039         * animation/DocumentTimeline.h:
3040         * animation/KeyframeEffectReadOnly.cpp:
3041         (WebCore::KeyframeEffectReadOnly::updateAcceleratedAnimationState): If the animation target does not have a renderer and it's still
3042         marked as running, enqueue a "Stop" accelerated action.
3043         (WebCore::KeyframeEffectReadOnly::addPendingAcceleratedAction): If we enqueue a "Stop" accelerated action, remove any other queued
3044         action so that we only process the "Stop" action, which would have superseded all previously queued actions anyway.
3045         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Only re-queue pending accelerated actions when a composited renderer
3046         is not yet available if we don't have a "Stop" action queued.
3047         * testing/Internals.cpp:
3048         (WebCore::Internals::numberOfAnimationTimelineInvalidations const):
3049         * testing/Internals.h:
3050         * testing/Internals.idl:
3051
3052 2018-09-21  Yacine Bandou  <yacine.bandou@softathome.com>
3053
3054         [EME] Fix typo in WebM sanitization variable
3055         https://bugs.webkit.org/show_bug.cgi?id=189789
3056
3057         Reviewed by Xabier Rodriguez-Calvar.
3058
3059         This commit corrects a typo in the name of a local variable, sanitizedBuffer
3060         instead of sanitazedBuffer.
3061
3062         * Modules/encryptedmedia/InitDataRegistry.cpp:
3063         (WebCore::extractKeyIDsWebM):
3064
3065 2018-09-20  Dean Jackson  <dino@apple.com>
3066
3067         Restrict the total combined size of backdrop filters
3068         https://bugs.webkit.org/show_bug.cgi?id=189812
3069         <rdar://problem/44532782>
3070
3071         Reviewed by Simon Fraser.
3072
3073         If the total area of all backdrop filters on the page gets
3074         too large, the universe collapses in on itself and we enter
3075         the Quantum Realm (i.e. crash horribly).
3076
3077         Put a hard limit on the total coverage, and ignore any backdrop
3078         filters after the limit. This might break some content, but
3079         such content is likely not doing things in the most optimal manner.
3080         There isn't any reason to have a backdrop larger than the size of
3081         the screen, because you'd be better off applying a foreground
3082         filter to the main content and showing something above it.
3083
3084         Tests: css3/filters/backdrop/resource-use-add-more-layers.html
3085                css3/filters/backdrop/resource-use-excessive.html
3086                css3/filters/backdrop/resource-use-ok.html
3087                css3/filters/backdrop/resource-use-remove-some-layers.html
3088
3089         * platform/graphics/ca/GraphicsLayerCA.cpp: Pick a fairly small maximum size. We
3090         can consider increasing this if necessary, and as devices with less RAM are
3091         upgraded.
3092         (WebCore::GraphicsLayerCA::recursiveCommitChanges): Gather the accumulated size
3093         of backdrop filters into the commit state as we are recursing through the tree.
3094         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): Force any layer
3095         with backdrop filters, or any that is removing backdrop filters, into an update.
3096         (WebCore::GraphicsLayerCA::updateBackdropFilters): Update the logic to first
3097         check if this backdrop layer causes us to exceed the total allowed size, and if
3098         it does, forbid it from getting the GraphicsLayer that composits the backdrop.
3099
3100         * platform/graphics/ca/GraphicsLayerCA.h: Remove const from some parameters so
3101         that we can use the CommitState to hold the accumulated size.
3102
3103 2018-09-20  Benjamin Poulain  <benjamin@webkit.org>
3104
3105         Adopt safe-area-insets on ImageDocument
3106         https://bugs.webkit.org/show_bug.cgi?id=189774
3107
3108         Reviewed by Tim Horton.
3109         rdar://problem/44624432
3110
3111         By having the safe-area insets on the image, we ensure that they only
3112         grow the document if there is not enough space. This also ensures the image
3113         does not have parts under UI elements.
3114
3115         * html/ImageDocument.cpp:
3116         (WebCore::ImageDocument::createDocumentStructure):
3117         (WebCore::ImageDocument::imageUpdated):
3118
3119 2018-09-20  Zalan Bujtas  <zalan@apple.com>
3120
3121         Release assert under RenderView::pageOrViewLogicalHeight
3122         https://bugs.webkit.org/show_bug.cgi?id=189798
3123         <rdar://problem/43659749>
3124
3125         Reviewed by Simon Fraser.
3126
3127         Only the mainframe's render view is sized to the page while printing.
3128         Use the matching check (see RenderView::layout) when accessing m_pageLogicalSize.
3129
3130         Test: printing/crash-while-formatting-subframe-for-printing.html
3131
3132         * rendering/RenderView.cpp:
3133         (WebCore::RenderView::pageOrViewLogicalHeight const):
3134
3135 2018-09-20  Sihui Liu  <sihui_liu@apple.com>
3136
3137         REGRESSION(r196265): WKWebView fires mouseover, mouseenter, and mouseleave events even when it's in a background window
3138         https://bugs.webkit.org/show_bug.cgi?id=187545
3139         <rdar://problem/42401575>
3140
3141         Reviewed by Ryosuke Niwa.
3142
3143         When the window is not active, we should only update the scrollbar for mouse events. GTK
3144         apps have different expectation on this behavior.
3145
3146         Test: fast/events/inactive-window-no-mouse-event.html
3147
3148         * page/EventHandler.cpp:
3149         (WebCore::EventHandler::handleMouseMoveEvent):
3150         (WebCore::EventHandler::shouldSendMouseEventsToInactiveWindows const):
3151         * page/EventHandler.h:
3152
3153 2018-09-20  Alex Christensen  <achristensen@webkit.org>
3154
3155         Unreviewed, rolling out r235976.
3156
3157         Broke ARM
3158
3159         Reverted changeset:
3160
3161         "Use a Variant instead of a union in CSSSelector"
3162         https://bugs.webkit.org/show_bug.cgi?id=188559
3163         https://trac.webkit.org/changeset/235976
3164
3165 2018-09-20  Oriol Brufau  <obrufau@igalia.com>
3166
3167         Fix 'border' serialization with both common and uncommon values
3168         https://bugs.webkit.org/show_bug.cgi?id=189597
3169
3170         Reviewed by Simon Fraser.
3171
3172         Remove CommonValueMode enum and make borderPropertyValue always return null
3173         when there are uncommon values (the previous ReturnNullOnUncommonValues mode).
3174
3175         Test: fast/css/getPropertyValue-border.html
3176         Test: fast/dom/css-shorthand-common-value.html
3177
3178         * css/StyleProperties.cpp:
3179         (WebCore::StyleProperties::getPropertyValue const):
3180         (WebCore::StyleProperties::borderPropertyValue const):
3181         (WebCore::StyleProperties::asText const):
3182         * css/StyleProperties.h:
3183
3184 2018-09-20  Justin Michaud  <justin_michaud@apple.com>
3185
3186         Implement CSS Custom Properties and Values Skeleton
3187         https://bugs.webkit.org/show_bug.cgi?id=189694
3188
3189         Reviewed by Simon Fraser.
3190
3191         Add feature flag, CSS.registerProperty binding and registered property set in Document.h
3192         for the css custom properties and values api.
3193
3194         Test: css-properties-values-api/registerProperty.html
3195
3196         * CMakeLists.txt:
3197         * DerivedSources.make:
3198         * Sources.txt:
3199         * WebCore.xcodeproj/project.pbxproj:
3200         * css/CSSRegisteredCustomProperty.h: Added.
3201         * css/DOMCSSCustomPropertyDescriptor.h: Added.
3202         * css/DOMCSSCustomPropertyDescriptor.idl: Added.
3203         * css/DOMCSSNamespace.h:
3204         * css/DOMCSSRegisterCustomProperty.cpp: Added.
3205         (WebCore::DOMCSSRegisterCustomProperty::registerProperty):
3206         (WebCore::DOMCSSRegisterCustomProperty::from):
3207         (WebCore::DOMCSSRegisterCustomProperty::supplementName):
3208         * css/DOMCSSRegisterCustomProperty.h: Added.
3209         * css/DOMCSSRegisterCustomProperty.idl: Added.
3210         * css/parser/CSSParserContext.cpp:
3211         * dom/Document.cpp:
3212         (WebCore::Document::registerCSSProperty):
3213         * dom/Document.h:
3214         * features.json:
3215         * page/RuntimeEnabledFeatures.h:
3216         (WebCore::RuntimeEnabledFeatures::setCSSCustomPropertiesAndValuesEnabled):
3217         (WebCore::RuntimeEnabledFeatures::cssCustomPropertiesAndValuesEnabled const):
3218
3219 2018-09-20  Justin Michaud  <justin_michaud@apple.com>
3220
3221         JS bindings generator should support EnabledAtRuntime for static methods
3222         https://bugs.webkit.org/show_bug.cgi?id=189729
3223
3224         Reviewed by Chris Dumez.
3225
3226         Add support for EnabledAtRuntime to static methods in the JS bindings
3227         code generator.
3228
3229         * bindings/scripts/CodeGeneratorJS.pm:
3230         (GenerateRuntimeEnableConditionalStringForExposed):
3231         (GenerateRuntimeEnableConditionalString):
3232         (GetRuntimeEnabledStaticProperties):
3233         (GenerateConstructorHelperMethods):
3234         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
3235         (WebCore::JSTestGlobalObjectConstructor::initializeProperties):
3236         (WebCore::JSTestGlobalObject::finishCreation):
3237         (WebCore::jsTestGlobalObjectConstructorFunctionEnabledAtRuntimeOperationStaticBody):
3238         (WebCore::jsTestGlobalObjectConstructorFunctionEnabledAtRuntimeOperationStatic):
3239         * bindings/scripts/test/JS/JSTestObj.cpp:
3240         (WebCore::JSTestObjConstructor::initializeProperties):
3241         (WebCore::jsTestObjConstructorEnabledAtRuntimeAttributeStaticGetter):
3242         (WebCore::jsTestObjConstructorEnabledAtRuntimeAttributeStatic):
3243         (WebCore::setJSTestObjConstructorEnabledAtRuntimeAttributeStaticSetter):
3244         (WebCore::setJSTestObjConstructorEnabledAtRuntimeAttributeStatic):
3245         (WebCore::jsTestObjConstructorFunctionEnabledAtRuntimeOperationStaticBody):
3246         (WebCore::jsTestObjConstructorFunctionEnabledAtRuntimeOperationStatic):
3247         * bindings/scripts/test/TestGlobalObject.idl:
3248         * bindings/scripts/test/TestObj.idl:
3249
3250 2018-09-20  Per Arne Vollan  <pvollan@apple.com>
3251
3252         [WebVTT] Update the parser according to the new region syntax.
3253         https://bugs.webkit.org/show_bug.cgi?id=189767
3254
3255         Reviewed by Eric Carlson.
3256
3257         The majority of the code added in this patch is adopted from the Chromium project, which has added
3258         support for the new region syntax. The complete parser specification can be found at
3259         https://w3c.github.io/webvtt/#file-parsing. One small difference in behavior is that the new parser
3260         will not add regions with empty id.
3261
3262         No new tests, covered by existing tests.
3263
3264         * html/track/WebVTTParser.cpp:
3265         (WebCore::WebVTTParser::getNewRegions):
3266         (WebCore::WebVTTParser::parse):
3267         (WebCore::WebVTTParser::collectRegionSettings):
3268         (WebCore::WebVTTParser::collectWebVTTBlock):
3269         (WebCore::WebVTTParser::checkAndRecoverCue):
3270         (WebCore::WebVTTParser::checkAndCreateRegion):
3271         (WebCore::WebVTTParser::checkAndStoreRegion):
3272         (WebCore::WebVTTParser::collectMetadataHeader): Deleted.
3273         (WebCore::WebVTTParser::createNewRegion): Deleted.
3274         * html/track/WebVTTParser.h:
3275
3276 2018-09-20  Alicia Boya García  <aboya@igalia.com>
3277
3278         [GStreamer][MSE] Add a default sample duration
3279         https://bugs.webkit.org/show_bug.cgi?id=189788
3280
3281         Some WebM files don't provide sample durations, so we need to provide
3282         a safe default in order for them to be playable.
3283
3284         Reviewed by Michael Catanzaro.
3285
3286         * platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
3287         (WebCore::MediaSampleGStreamer::MediaSampleGStreamer):
3288
3289 2018-09-20  Alicia Boya García  <aboya@igalia.com>
3290
3291         [MSE] Use some tolerance when deciding whether a frame should be appended to the decode queue
3292         https://bugs.webkit.org/show_bug.cgi?id=189782
3293
3294         Reviewed by Xabier Rodriguez-Calvar.
3295
3296         Ideally, container formats should use exact timestamps and frames
3297         should not overlap. Unfortunately, there are lots of files out there
3298         where this is not always the case.
3299
3300         This is particularly a problem in WebM, where timestamps are expressed
3301         in a power of 10 timescale, which forces some rounding.
3302
3303         This patch makes SourceBuffer allow frames with a small overlaps
3304         (<=1ms) as those usually found in WebM. 1 ms is chosen because it's
3305         the default time scale of WebM files.
3306
3307         * Modules/mediasource/SourceBuffer.cpp:
3308         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
3309
3310 2018-09-20  Yacine Bandou  <yacine.bandou@softathome.com>
3311
3312         [EME] Add WebM sanitization
3313         https://bugs.webkit.org/show_bug.cgi?id=189740
3314
3315         Reviewed by Xabier Rodriguez-Calvar.
3316
3317         This patch adds support for sanitizing the WebM initialization data,
3318         ensures there are no bogus values.
3319         See https://www.w3.org/TR/encrypted-media/#dom-mediakeysession-generaterequest.
3320
3321         Tests: imported/w3c/web-platform-tests/encrypted-media/clearkey-generate-request-disallowed-input.https.html
3322
3323         * Modules/encryptedmedia/InitDataRegistry.cpp:
3324         (WebCore::sanitizeWebM): Added implementation, check if the initialization data doesn't empty and its size
3325         should be less than 64KB, return the buffer copy if it is ok, otherwise a nullptr.
3326         (WebCore::extractKeyIDsWebM): Added implementation.
3327
3328 2018-09-20  Philippe Normand  <pnormand@igalia.com>
3329
3330         [GStreamer] Utilities cleanups
3331         https://bugs.webkit.org/show_bug.cgi?id=189699
3332
3333         Reviewed by Xabier Rodriguez-Calvar.
3334
3335         The GstMappedBuffer now has a move constructor so that it can be easily
3336         reused in the webaudiosrc element. The now-unused corresponding
3337         buffer-mapping utilities are removed from the code-base.
3338
3339         The HTTP source element used to handle a GstBuffer in its private
3340         structure but this is no longer required since data is now pushed
3341         in chunks, see bug #182829.
3342
3343         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
3344         (webKitWebAudioSrcLoop):
3345         * platform/graphics/gstreamer/GStreamerCommon.cpp:
3346         (WebCore::createGstBuffer): Deleted.
3347         (WebCore::createGstBufferForData): Deleted.
3348         (WebCore::getGstBufferDataPointer): Deleted.
3349         (WebCore::mapGstBuffer): Deleted.
3350         (WebCore::unmapGstBuffer): Deleted.
3351         * platform/graphics/gstreamer/GStreamerCommon.h:
3352         (WebCore::GstMappedBuffer::create): New method returning a
3353         reference to a newly created GstMappedBuffer instance.
3354         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3355         (webKitWebSrcStop): Remove reference to unused GstBuffer.
3356         (CachedResourceStreamingClient::dataReceived): Ditto.
3357
3358 2018-09-20  Simon Fraser  <simon.fraser@apple.com>
3359
3360         Fix crash under FontCache::purgeInactiveFontData() when a memory warning fires
3361         https://bugs.webkit.org/show_bug.cgi?id=189722
3362         rdar://problem/44182860
3363
3364         Reviewed by Myles C. Maxfield.
3365         
3366         Hashing of FontPlatformData for cachedFonts() is somewhat broken because CFEqual() on CTFont
3367         can return false when the fonts are actually the same, and have the same CFHash(). This 
3368         can result in multiple entries in cachedFonts() with the same Font.
3369         
3370         Then in FontCache::purgeInactiveFontData(), the loop that appends fonts to fontsToDelete
3371         gets the value by reference, and WTFMoves it into fontsToDelete. This nulls out all
3372         the entries sharing the same value, leaving null entries in the hash table.
3373         We later crash at font->hasOneRef() when using one of those null entries.
3374         
3375         Fix by making a copy of the RefPtr<Font> in the loop, so the WTFMove doesn't nuke
3376         the hash table entries. The entries will get removed at cachedFonts().remove() lower down.
3377
3378         * platform/graphics/FontCache.cpp:
3379         (WebCore::FontCache::purgeInactiveFontData):
3380
3381 2018-09-20  Antoine Quint  <graouts@apple.com>
3382
3383         [Web Animations] Provide a way to query accelerated animations for internal testing
3384         https://bugs.webkit.org/show_bug.cgi?id=189762
3385
3386         Reviewed by Dean Jackson.
3387
3388         Expose a new internals.acceleratedAnimationsForElement(element) method to allow layout tests to query the current list
3389         of accelerated animations for a given element. Currently only the animated property and animation speed are exposed, which
3390         will allow us to identify missing, running and paused accelerated animations.
3391
3392         * animation/DocumentTimeline.cpp:
3393         (WebCore::DocumentTimeline::acceleratedAnimationsForElement const):
3394         * animation/DocumentTimeline.h:
3395         * platform/graphics/GraphicsLayer.h:
3396         (WebCore::GraphicsLayer::acceleratedAnimationsForTesting const):
3397         * platform/graphics/ca/GraphicsLayerCA.cpp:
3398         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
3399         * platform/graphics/ca/GraphicsLayerCA.h:
3400         * testing/Internals.cpp:
3401         (WebCore::Internals::acceleratedAnimationsForElement):
3402         * testing/Internals.h:
3403         * testing/Internals.idl:
3404
3405 2018-09-19  Ryosuke Niwa  <rniwa@webkit.org>
3406
3407         Improve node statistics for rare data
3408         https://bugs.webkit.org/show_bug.cgi?id=189775
3409
3410         Reviewed by Simon Fraser.
3411
3412         Report reasons we created NodeRareData and ElementRareData in node statistics.
3413
3414         Added NodeRareData::useTypes and ElementRareData::useTypes which returns OptionSet<NodeRareData::UseType>
3415         indicating which instance member of the rare data is currently in use.
3416
3417         * dom/Element.cpp:
3418         * dom/Element.h:
3419         * dom/ElementRareData.h:
3420         (WebCore::defaultMinimumSizeForResizing):
3421         (WebCore::ElementRareData::useTypes const):
3422         * dom/Node.cpp:
3423         (WebCore::stringForRareDataUseType):
3424         (WebCore::Node::dumpStatistics):
3425         * dom/NodeRareData.cpp:
3426         * dom/NodeRareData.h:
3427         (WebCore::NodeRareData::useTypes const):
3428
3429 2018-09-19  Ryosuke Niwa  <rniwa@webkit.org>
3430
3431         REGRESSION(r235917): 2% regression in Dromaeo CSS selector on MacBookPro11,4
3432         https://bugs.webkit.org/show_bug.cgi?id=189738
3433
3434         Reviewed by Yusuke Suzuki.
3435
3436         The regression was caused by the regundant walk to the parent element. Removed it to fix the regression.
3437
3438         * cssjit/SelectorCompiler.cpp:
3439         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateNthChildParentCheckAndRelationUpdate):
3440         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateNthLastChildParentCheckAndRelationUpdate):
3441
3442 2018-09-19  John Wilander  <wilander@apple.com>
3443
3444         Resource Load Statistics: Add optional cap on partitioned cache max age
3445         https://bugs.webkit.org/show_bug.cgi?id=189711
3446         <rdar://problem/39246837>
3447
3448         Reviewed by Antti Koivisto and Chris Dumez.
3449
3450         Test: http/tests/resourceLoadStatistics/cap-cache-max-age-for-prevalent-resource.html
3451
3452         * platform/network/NetworkStorageSession.h:
3453         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3454         (WebCore::NetworkStorageSession::maxAgeCacheCap):
3455             Checks if a max age cap is set and returns it if the request
3456             represents a prevalent resource.
3457         (WebCore::NetworkStorageSession::setCacheMaxAgeCapForPrevalentResources):
3458         (WebCore::NetworkStorageSession::resetCacheMaxAgeCapForPrevalentResources):
3459             New functionality to receive a max age cap setting in the session.
3460
3461 2018-09-19  Youenn Fablet  <youenn@apple.com>
3462
3463         Layout Test webrtc/video-mute.html is flaky.
3464         https://bugs.webkit.org/show_bug.cgi?id=177501
3465
3466         Reviewed by Eric Carlson.
3467
3468         Covered by updated test expectation.
3469
3470         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
3471         (WebCore::createBlackPixelBuffer): Make sure the whole buffer is properly initialized.
3472
3473 2018-09-19  David Kilzer  <ddkilzer@apple.com>
3474
3475         WebCoreNSURLSession leaks an NSString (_sessionDescription) in -dealloc
3476         <https://webkit.org/b/189742>
3477         <rdar://problem/44589774>
3478
3479         Reviewed by Joseph Pecoraro.
3480
3481         * platform/network/cocoa/WebCoreNSURLSession.h:
3482         (WebCoreNSURLSession._sessionDescription): Change type from
3483         NSString * to RetainPtr<NSString>.
3484         * platform/network/cocoa/WebCoreNSURLSession.mm: Remove
3485         @synthesized statement for sessionDescription so that custom
3486         methods can be implemented to handle RetainPtr<NSString>.
3487         (-[WebCoreNSURLSession sessionDescription]): Add.
3488         (-[WebCoreNSURLSession setSessionDescription:]): Add.
3489
3490 2018-09-19  Youenn Fablet  <youenn@apple.com>
3491
3492         Implement sender/receiver getStats
3493         https://bugs.webkit.org/show_bug.cgi?id=189707
3494
3495         Reviewed by Eric Carlson.
3496
3497         Add support for sender and receiver getStats.
3498         Also add support for peer connection selector parameter.
3499
3500         Add the plumbing of the selector to LibWebRTCMediaEndpoint.
3501         Then make use of libwebrtc overloaded methods to retrieve the right stats.
3502
3503         Covered by updated/rebased tests.
3504
3505         * Modules/mediastream/PeerConnectionBackend.h:
3506         * Modules/mediastream/RTCPeerConnection.cpp:
3507         (WebCore::RTCPeerConnection::getStats):
3508         * Modules/mediastream/RTCPeerConnection.h:
3509         * Modules/mediastream/RTCPeerConnection.idl:
3510         * Modules/mediastream/RTCRtpReceiver.cpp:
3511         (WebCore::RTCRtpReceiver::RTCRtpReceiver):
3512         (WebCore::RTCRtpReceiver::getStats):
3513         * Modules/mediastream/RTCRtpReceiver.h:
3514         (WebCore::RTCRtpReceiver::create):
3515         (WebCore::RTCRtpReceiver::backend):
3516         * Modules/mediastream/RTCRtpReceiver.idl:
3517         * Modules/mediastream/RTCRtpSender.cpp:
3518         (WebCore::RTCRtpSender::create):
3519         (WebCore::RTCRtpSender::RTCRtpSender):
3520         (WebCore::RTCRtpSender::getStats):
3521         * Modules/mediastream/RTCRtpSender.h:
3522         * Modules/mediastream/RTCRtpSender.idl:
3523         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3524         (WebCore::LibWebRTCMediaEndpoint::getStats):
3525         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
3526         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3527         (WebCore::LibWebRTCPeerConnectionBackend::getStats):
3528         (WebCore::backendFromRTPSender):
3529         (WebCore::createReceiverForSource):
3530         (WebCore::LibWebRTCPeerConnectionBackend::createReceiver):
3531         (WebCore::LibWebRTCPeerConnectionBackend::videoReceiver):
3532         (WebCore::LibWebRTCPeerConnectionBackend::audioReceiver):
3533         (WebCore::LibWebRTCPeerConnectionBackend::addTrack):
3534         (WebCore::LibWebRTCPeerConnectionBackend::addUnifiedPlanTransceiver):
3535         (WebCore::LibWebRTCPeerConnectionBackend::addTransceiver):
3536         (WebCore::LibWebRTCPeerConnectionBackend::newRemoteTransceiver):
3537         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
3538         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h:
3539
3540 2018-09-19  Jer Noble  <jer.noble@apple.com>
3541
3542         REGRESSION (r236006): New waitingForKey() requirement breaks Modern EME tests.
3543         https://bugs.webkit.org/show_bug.cgi?id=189720
3544         <rdar://problem/44572140>
3545
3546         Reviewed by Xabier Rodriguez-Calvar.
3547
3548         Always call waitingForKey() after calling initializationDataEncountered().
3549
3550         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3551         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
3552         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3553         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::initializationDataEncountered):
3554
3555 2018-09-19  Philippe Normand <pnormand@igalia.com>
3556
3557         [GStreamer] Add support for AV1 decoding
3558         https://bugs.webkit.org/show_bug.cgi?id=189647
3559
3560         Tweaked by Xabier Rodriguez Calvar <calvaris@igalia.com>.
3561         Reviewed by Žan Doberšek.
3562
3563         AV1 can be muxed in MP4 and WebM containers. The test is an adaptation from Chromium's unittest:
3564         https://chromium.googlesource.com/chromium/src/+/master/content/browser/media/media_canplaytype_browsertest.cc
3565
3566         Test: media/media-can-play-av1.html
3567
3568         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3569         (WebCore::MediaPlayerPrivateGStreamer::supportsType): Add AV1
3570         support. The av01 codec has to be explicitely checked, along with
3571         the presence of a compatible AV1 decoder.
3572
3573 2018-09-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3574
3575         [Curl] Limit capturing extra metrics for Web Inspector when not required.
3576         https://bugs.webkit.org/show_bug.cgi?id=189520
3577
3578         Reviewed by Alex Christensen.
3579
3580         Respect the value of NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics() to reduce the process
3581         time when they are not needed.
3582
3583         No new tests because there's no behavior change.
3584
3585         * platform/network/curl/CurlContext.cpp:
3586         (WebCore::CurlHandle::getNetworkLoadMetrics):
3587         (WebCore::CurlHandle::addExtraNetworkLoadMetrics):
3588         * platform/network/curl/CurlContext.h:
3589         * platform/network/curl/CurlRequest.cpp:
3590         (WebCore::CurlRequest::CurlRequest):
3591         (WebCore::CurlRequest::updateNetworkLoadMetrics):
3592         * platform/network/curl/CurlRequest.h:
3593         (WebCore::CurlRequest::create):
3594         * platform/network/curl/ResourceHandleCurl.cpp:
3595         (WebCore::ResourceHandle::createCurlRequest):
3596
3597 2018-09-18  Megan Gardner  <megan_gardner@apple.com>
3598
3599         Support Images Module Level 4's double-position gradient color stop syntax
3600         https://bugs.webkit.org/show_bug.cgi?id=186154
3601         <rdar://problem/44158152>
3602
3603         Reviewed by Simon Fraser.
3604
3605         The CSS spec for all gradients allows for each color stop to have two angles to be used for hints.
3606         This makes pie chart and checkerboard conic gradients much simpler to write.
3607         Any time you want to have a hard line in a gradient, this syntax simplifies the gradient specification.
3608
3609         Test: fast/gradients/conic-two-hints.html
3610         Test: fast/gradients/linear-two-hints-angle.html
3611         Test: fast/gradients/linear-two-hints.html
3612         Test: fast/gradients/radial-two-hints.html
3613
3614         * css/parser/CSSPropertyParserHelpers.cpp:
3615         (WebCore::CSSPropertyParserHelpers::consumeAngularGradientColorStops): Removed.
3616         (WebCore::CSSPropertyParserHelpers::consumeGradientColorStops):
3617
3618 2018-09-18  Simon Fraser  <simon.fraser@apple.com>
3619
3620         Remove the unused RenderLayerCompositor::enclosingCompositorFlushingLayers()
3621         https://bugs.webkit.org/show_bug.cgi?id=189689
3622
3623         Reviewed by Alex Christensen.
3624
3625         enclosingCompositorFlushingLayers() was added in r76196 but never used. Also use
3626         a SetForScope<>.
3627
3628         * rendering/RenderLayerCompositor.cpp:
3629         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
3630         (WebCore::RenderLayerCompositor::enclosingCompositorFlushingLayers const): Deleted.
3631         * rendering/RenderLayerCompositor.h:
3632
3633 2018-09-18  Joseph Pecoraro  <pecoraro@apple.com>
3634
3635         [macOS] Frequent leaks seen under WebCore::gpuIDForDisplayMask
3636         https://bugs.webkit.org/show_bug.cgi?id=189685
3637         <rdar://problem/44541974>
3638
3639         Reviewed by Per Arne Vollan.
3640
3641         * platform/mac/PlatformScreenMac.mm:
3642         (WebCore::gpuIDForDisplayMask):
3643
3644 2018-09-18  Youenn Fablet  <youenn@apple.com>
3645
3646         Implement RTCRtpReceiver getContributingSources/getSynchronizationSources
3647         https://bugs.webkit.org/show_bug.cgi?id=189671
3648
3649         Reviewed by Eric Carlson.
3650
3651         Introduce implementation of these two methods by calling the libwebrtc corresponding method.
3652         Add corresponding IDL as per spec.
3653         Covered by rebased WPT tests.
3654
3655         * CMakeLists.txt:
3656         * DerivedSources.make:
3657         * Modules/mediastream/RTCRtpContributingSource.h: Added.
3658         * Modules/mediastream/RTCRtpContributingSource.idl: Added.
3659         * Modules/mediastream/RTCRtpReceiver.h:
3660         (WebCore::RTCRtpReceiver::getContributingSources const):
3661         (WebCore::RTCRtpReceiver::getSynchronizationSources const):
3662         * Modules/mediastream/RTCRtpReceiver.idl:
3663         * Modules/mediastream/RTCRtpReceiverBackend.h:
3664         (WebCore::RTCRtpReceiverBackend::getContributingSources const):
3665         (WebCore::RTCRtpReceiverBackend::getSynchronizationSources const):
3666         * Modules/mediastream/RTCRtpSynchronizationSource.h: Added.
3667         * Modules/mediastream/RTCRtpSynchronizationSource.idl: Added.
3668         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.cpp:
3669         (WebCore::fillRTCRtpContributingSource):
3670         (WebCore::toRTCRtpContributingSource):
3671         (WebCore::toRTCRtpSynchronizationSource):
3672         (WebCore::LibWebRTCRtpReceiverBackend::getContributingSources const):
3673         (WebCore::LibWebRTCRtpReceiverBackend::getSynchronizationSources const):
3674         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h:
3675         * Sources.txt:
3676         * WebCore.xcodeproj/project.pbxproj:
3677
3678 2018-09-18  Youenn Fablet  <youenn@apple.com>
3679
3680         Enable Unified Plan by default
3681         https://bugs.webkit.org/show_bug.cgi?id=189675
3682
3683         Reviewed by Eric Carlson.
3684
3685         RTCRtpTransceiver.currentDirection is now gated by the unified plan runtime flag.
3686         This will allow easy feature detection of unified plan support.
3687         Covered by updated test.
3688
3689         * Modules/mediastream/RTCRtpTransceiver.idl:
3690
3691 2018-09-18  Per Arne Vollan  <pvollan@apple.com>
3692
3693         [WebVTT] change "middle" to "center" for consistency with CSS
3694         https://bugs.webkit.org/show_bug.cgi?id=158478
3695
3696         Reviewed by Eric Carlson.
3697
3698         No new tests, covered by existing tests.
3699
3700         * html/track/TextTrackCueGeneric.cpp:
3701         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
3702         * html/track/VTTCue.cpp:
3703         (WebCore::centerKeyword):
3704         (WebCore::VTTCue::initialize):
3705         (WebCore::VTTCue::align const):
3706         (WebCore::VTTCue::setAlign):
3707         (WebCore::VTTCue::calculateDisplayParameters):
3708         (WebCore::VTTCue::setCueSettings):
3709         (WebCore::middleKeyword): Deleted.
3710         * html/track/VTTCue.h:
3711         * html/track/WebVTTParser.cpp:
3712         (WebCore::WebVTTTreeBuilder::buildFromString):
3713
3714 2018-09-18  Chris Dumez  <cdumez@apple.com>
3715
3716         "DidFirstVisuallyNonEmptyLayout" callback does not get called when restoring a page from PageCache
3717         https://bugs.webkit.org/show_bug.cgi?id=189681
3718         <rdar://problem/44526171>
3719
3720         Reviewed by Alex Christensen and Zalan Bujtas.
3721
3722         The "DidFirstVisuallyNonEmptyLayout" callback was not getting called when restoring a page from PageCache
3723         because the FrameView is restored from PageCache and we would fail to restore its flags (such as
3724         m_firstVisuallyNonEmptyLayoutCallbackPending) when entering Page Cache. We now call reset those flags that
3725         are related to layout miletones when entering PageCache so that layout milestone events properly get sent
3726         again when restoring from Page Cache.
3727
3728         * history/CachedFrame.cpp:
3729         (WebCore::CachedFrame::CachedFrame):
3730
3731 2018-09-18  Manuel Rego Casasnovas  <rego@igalia.com>
3732
3733         [css-grid] Static position should use content-box, not padding-box
3734         https://bugs.webkit.org/show_bug.cgi?id=189698
3735
3736         Reviewed by Javier Fernandez.
3737
3738         This is a recent change by the CSSWG:
3739         https://github.com/w3c/csswg-drafts/issues/3020
3740
3741         The spec text (https://drafts.csswg.org/css-grid/#static-position):
3742           "The static position of an absolutely-positioned child
3743            of a grid container is determined as if it were the sole grid item
3744            in a grid area whose edges coincide with the content edges
3745            of the grid container."
3746
3747         Test: imported/w3c/web-platform-tests/css/css-grid/abspos/absolute-positioning-grid-container-parent-001.html
3748
3749         * rendering/RenderGrid.cpp:
3750         (WebCore::RenderGrid::prepareChildForPositionedLayout):
3751         Simple change to use border and padding.
3752
3753 2018-09-18  Xabier Rodriguez Calvar  <calvaris@igalia.com>
3754
3755         [EME][GStreamer] The current EME implementation doesn't support the waitingforkey event
3756         https://bugs.webkit.org/show_bug.cgi?id=185590
3757
3758         Reviewed by Philippe Normand.
3759
3760         When decryptors are blocked waiting for the key, instruct the
3761         player to run the Wait for key algorithm. As per spec, if we run
3762         out of blocks pending to decrypt because we don't have the key, we
3763         request running the algorithm again.
3764
3765         Test: imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-waitingforkey.https.html.
3766
3767         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3768         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
3769         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3770         (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered):
3771         (WebCore::MediaPlayerPrivateGStreamerBase::reportWaitingForKey):
3772         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3773         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
3774         (webkitMediaCommonEncryptionDecryptTransformInPlace):
3775         (webkitMediaCommonEncryptionDecryptSinkEventHandler):
3776
3777 2018-09-12  Ryosuke Niwa  <rniwa@webkit.org>
3778
3779         Update composedPath to match the latest spec
3780         https://bugs.webkit.org/show_bug.cgi?id=180378
3781         <rdar://problem/42843004>
3782
3783         Reviewed by Darin Adler.
3784
3785         This patch makes the check for whether a given node in the event path be included in composedPath
3786         pre-determined at the time of the event dispatching per https://github.com/whatwg/dom/issues/525.
3787         This was a fix for the issue that if an event listener in a closed shadow tree removes a node in the
3788         same tree in the event path, then composedPath called on its shadow host, for example, will include
3789         the removed node since it's no longer in the closed shadow tree.
3790
3791         Naively, implementing this behavior would require remembering the original document or shadow root
3792         of each node in the event path as well as its parent shadow root, or worse which node is disclosed
3793         to every other node at the time of computing the event path.
3794
3795         This patch takes a more novel and efficient approach to implement the new behavior by adding a single
3796         integer indicating the number of closed-mode shadow root ancestors of each node in the event path.
3797         In computePathUnclosedToTarget, any node whose *depth* is greater than the context object is excluded.
3798
3799         Consider the following example:
3800         div ------- ShadowRoot (closed)
3801           +- span     +- slot
3802         If an event is dispatched on span, then the event path would be [span, slot, ShadowRoot, div]. Then
3803         the values of integers assigned to each node would be: [0, 1, 1, 0] respectively. When composedPath
3804         is called on span or div, slot and ShadowRoot are excluded because they have a greater *depth* value.
3805
3806         Unfortunately, this simplistic solution doesn't work when there are multiple shadow roots of the same
3807         depth through which an event is dispatched as in:
3808         section -- ShadowRoot (closed, SR2)
3809           |          +- slot (s2)
3810           +div ------ ShadowRoot (closed, SR1)
3811             +- span     +- slot (s1)
3812         If an event is dispatched on span, the event path would be [span, s1, SR1, div, s2, SR2, section].
3813         The values of integers assigned are: [0, 1, 1, 0, 1, 1, 0] respectively. When composedPath is called
3814         on SR1, the simplistic approach would include s2 and SR2, which would be wrong.
3815
3816         To account for this case, in computePathUnclosedToTarget, we traverse the event path upwards (i.e.
3817         ancestors) and downwards (i.e. descendants) from the context object and decrease the *allowed depth*
3818         of shadow trees when we traverse out of a shadow tree in either direction. When traversing upwards,
3819         therefore, moving out of a shadow root to its host would would decrease the allowed depth. When
3820         traversing dowards, moving from a slot element to its assigned node would decrease the allowed depth.
3821
3822         Note that the depths can be negative when a composed event is dispatched inside a closed shadow tree,
3823         and it gets out of its shadow host.
3824
3825         Unfortunately, the latest DOM specification has a bug and doesn't match the behavior of Chrome. This
3826         patch proposes a new algorithm which can be adopted in https://github.com/whatwg/dom/issues/684.
3827
3828         Test: imported/w3c/web-platform-tests/shadow-dom/event-composed-path-after-dom-mutation.html
3829
3830         * dom/EventContext.cpp:
3831         (WebCore::EventContext::EventContext):
3832         (WebCore::MouseOrFocusEventContext::MouseOrFocusEventContext):
3833         (WebCore::TouchEventContext::TouchEventContext):
3834         * dom/EventContext.h:
3835         (WebCore::EventContext::closedShadowDepth const): Added.
3836         * dom/EventPath.cpp:
3837         (WebCore::WindowEventContext::WindowEventContext):
3838         (WebCore::EventPath::buildPath): Compute the closed shadow tree's depths for each node in the path.
3839         (WebCore::computePathUnclosedToTarget const): Implemented the aforementioned algorithm.
3840         (WebCore::EventPath::EventPath):
3841
3842 2018-09-17  Yusuke Suzuki  <utatane.tea@gmail.com>
3843
3844         [WTF] Use Semaphore and BinarySemaphore instead of dispatch_semaphore_t
3845         https://bugs.webkit.org/show_bug.cgi?id=185339
3846
3847         Reviewed by Mark Lam.
3848
3849         * fileapi/ThreadableBlobRegistry.cpp:
3850         (WebCore::ThreadableBlobRegistry::blobSize):
3851         * platform/cocoa/NetworkExtensionContentFilter.h:
3852         * platform/cocoa/NetworkExtensionContentFilter.mm:
3853         (WebCore::NetworkExtensionContentFilter::initialize):
3854         (WebCore::NetworkExtensionContentFilter::willSendRequest):
3855         (WebCore::NetworkExtensionContentFilter::responseReceived):
3856         (WebCore::NetworkExtensionContentFilter::addData):
3857         (WebCore::NetworkExtensionContentFilter::finishedAddingData):
3858         (WebCore::NetworkExtensionContentFilter::handleDecision):
3859         Use per-function BinarySemaphore instead of holding it in NetworkExtensionContentFilter's field.
3860
3861         * platform/glib/FileMonitorGLib.cpp:
3862         (WebCore::FileMonitor::FileMonitor):
3863         (WebCore::FileMonitor::~FileMonitor):
3864         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3865         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3866         (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
3867         (WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC):
3868         (WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange):
3869         (WebCore::MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange):
3870         Use BinarySemaphore. And remove unused dispatch_semaphore_t.
3871
3872         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
3873         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3874         (-[WebAVStreamDataParserListener streamDataParserWillProvideContentKeyRequestInitializationData:forTrackID:]):
3875         (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]):
3876         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
3877         (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
3878         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
3879         (WebCore::SourceBufferPrivateAVFObjC::abort):
3880         (WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
3881         (WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):
3882         Use Box<Semaphore> and Box<BinarySemaphore>.
3883
3884         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
3885         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
3886         (WebCore::WebCoreDecompressionSession::WebCoreDecompressionSession):
3887         Remove unused dispatch_semaphore_t.
3888
3889         * platform/network/cf/ResourceHandleCFNet.cpp:
3890         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
3891         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
3892         (WebCore::getRunLoop):
3893         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
3894         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
3895         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
3896         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
3897         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
3898         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
3899         (-[WebCoreResourceHandleAsOperationQueueDelegate initWithHandle:messageQueue:]):
3900         (-[WebCoreResourceHandleAsOperationQueueDelegate detachHandle]):
3901         (-[WebCoreResourceHandleAsOperationQueueDelegate dealloc]):
3902         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
3903         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
3904         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
3905         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
3906         Use BinarySemaphore instead.
3907
3908 2018-09-17  Simon Fraser  <simon.fraser@apple.com>
3909
3910         Many modern media control tests leak documents in testing
3911         https://bugs.webkit.org/show_bug.cgi?id=189437
3912
3913         Reviewed by Darin Adler.
3914
3915         In order to accurately detect leaks in media controls tests which use lots of
3916         SVGImages, we have to:
3917         - Fire a zero-delay timer after the postTask, in order for ImagesLoader's m_derefElementTimer
3918           to clear references to elements.
3919         - Have releaseCriticalMemory() call CachedResourceLoader's garbageCollectDocumentResources()
3920           to drop the last handle to the CachedResource for an SVGImage.
3921         - Call WKBundleReleaseMemory() after the GC and timer, since we need garbageCollectDocumentResources()
3922           to run again after that timer has fired.
3923         
3924         This should fix most of the spurious leak reports involving SVGImage documents.
3925
3926         * page/MemoryRelease.cpp:
3927         (WebCore::releaseCriticalMemory):
3928
3929 2018-09-17  Jer Noble  <jer.noble@apple.com>
3930
3931         Add support for HEVC codec types in Media Capabilities
3932         https://bugs.webkit.org/show_bug.cgi?id=189565
3933
3934         Reviewed by Eric Carlson.
3935
3936         Test: media/hevc-codec-parameters.html
3937
3938         Add some utility methods for parsing HEVC codec strings, and using those parsed
3939         values to query the platform for detailed support for HEVC decoding.
3940
3941         Drive-by fix: Modify MediaEngineConfigurationFactory to allow for null function
3942         pointers in the encode/decode factory pair.
3943
3944         * Sources.txt:
3945         * SourcesCocoa.txt:
3946         * WebCore.xcodeproj/project.pbxproj:
3947         * platform/cocoa/VideoToolboxSoftLink.cpp:
3948         * platform/cocoa/VideoToolboxSoftLink.h:
3949         * platform/graphics/HEVCUtiliti