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