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