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