[EME] Introduce the concept of CDMInstanceSession.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-09-21  Jer Noble  <jer.noble@apple.com>
2
3         [EME] Introduce the concept of CDMInstanceSession.
4         https://bugs.webkit.org/show_bug.cgi?id=189725
5
6         Reviewed by Eric Carlson.
7
8         Currently, the same CDMInstance owned by a MediaKeys object is passed to every MediaKeySession created by that
9         MediaKeys, and since the CDMInstance has only a single CDMInstanceClient, subsequent MediaKeySessions prevent
10         previous ones from getting updates.
11
12         Add a new virtual interface, CDMInstanceSession, to be passed to MediaKeySession upon creation. Refactor
13         CDMInstanceClearKey and CDMInstanceFairPlayStreamingAVFObjC to adopt this new interface.
14
15         Drive-by fixes: Made a number of virtual overrides in final classes final themselves.
16
17         * Modules/encryptedmedia/MediaKeySession.cpp:
18         (WebCore::MediaKeySession::create):
19         (WebCore::MediaKeySession::MediaKeySession):
20         (WebCore::MediaKeySession::generateRequest):
21         (WebCore::MediaKeySession::load):
22         (WebCore::MediaKeySession::update):
23         (WebCore::MediaKeySession::remove):
24         (WebCore::MediaKeySession::updateKeyStatuses):
25         * Modules/encryptedmedia/MediaKeySession.h:
26         * Modules/encryptedmedia/MediaKeys.cpp:
27         (WebCore::MediaKeys::createSession):
28         * WebCore.xcodeproj/project.pbxproj:
29         * platform/encryptedmedia/CDMInstance.h:
30         (WebCore::CDMInstance::setHDCPStatus):
31         (WebCore::CDMInstance::setClient): Deleted.
32         (WebCore::CDMInstance::clearClient): Deleted.
33         * platform/encryptedmedia/CDMInstanceSession.h: Copied from Source/WebCore/platform/encryptedmedia/CDMInstance.h.
34         (WebCore::CDMInstanceSession::setClient):
35         (WebCore::CDMInstanceSession::clearClient):
36         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
37         (WebCore::parseLicenseFormat):
38         (WebCore::CDMInstanceClearKey::keySystem const):
39         (WebCore::CDMInstanceClearKey::createSession):
40         (WebCore::CDMInstanceSessionClearKey::requestLicense):
41         (WebCore::CDMInstanceSessionClearKey::keys const):
42         (WebCore::CDMInstanceSessionClearKey::updateLicense):
43         (WebCore::CDMInstanceSessionClearKey::loadSession):
44         (WebCore::CDMInstanceSessionClearKey::closeSession):
45         (WebCore::CDMInstanceSessionClearKey::removeSessionData):
46         (WebCore::CDMInstanceSessionClearKey::storeRecordOfKeyUsage):
47         (WebCore::CDMInstanceClearKey::requestLicense): Deleted.
48         (WebCore::CDMInstanceClearKey::keys const): Deleted.
49         (WebCore::CDMInstanceClearKey::updateLicense): Deleted.
50         (WebCore::CDMInstanceClearKey::loadSession): Deleted.
51         (WebCore::CDMInstanceClearKey::closeSession): Deleted.
52         (WebCore::CDMInstanceClearKey::removeSessionData): Deleted.
53         (WebCore::CDMInstanceClearKey::storeRecordOfKeyUsage): Deleted.
54         * platform/encryptedmedia/clearkey/CDMClearKey.h:
55         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
56         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
57         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::createSession):
58         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::processContentKeyRequestForSession):
59         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::processNextContentKeyRequest):
60         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::keySystem const):
61         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
62         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRenewingRequest):
63         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvidePersistableRequest):
64         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
65         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestDidSucceed):
66         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::shouldRetryRequestForReason):
67         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionIdentifierChanged):
68         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
69         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::CDMInstanceSessionFairPlayStreamingAVFObjC):
70         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyIDs):
71         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestLicense):
72         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
73         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::loadSession):
74         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::closeSession):
75         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData):
76         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::storeRecordOfKeyUsage):
77         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::setClient):
78         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::clearClient):
79         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest):
80         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRenewingRequest):
81         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvidePersistableRequest):
82         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didFailToProvideRequest):
83         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestDidSucceed):
84         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::shouldRetryRequestForReason):
85         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::sessionIdentifierChanged):
86         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
87         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::isLicenseTypeSupported const):
88         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::isLicenseTypeSupported const): Deleted.
89         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::keyIDs): Deleted.
90         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestLicense): Deleted.
91         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense): Deleted.
92         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::loadSession): Deleted.
93         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::closeSession): Deleted.
94         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::removeSessionData): Deleted.
95         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::storeRecordOfKeyUsage): Deleted.
96         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setClient): Deleted.
97         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::clearClient): Deleted.
98         * testing/MockCDMFactory.cpp:
99         (WebCore::MockCDMInstance::keySystem const):
100         (WebCore::MockCDMInstance::createSession):
101         (WebCore::MockCDMInstanceSession::MockCDMInstanceSession):
102         (WebCore::MockCDMInstanceSession::requestLicense):
103         (WebCore::MockCDMInstanceSession::updateLicense):
104         (WebCore::MockCDMInstanceSession::loadSession):
105         (WebCore::MockCDMInstanceSession::closeSession):
106         (WebCore::MockCDMInstanceSession::removeSessionData):
107         (WebCore::MockCDMInstanceSession::storeRecordOfKeyUsage):
108         (WebCore::MockCDMInstance::requestLicense): Deleted.
109         (WebCore::MockCDMInstance::updateLicense): Deleted.
110         (WebCore::MockCDMInstance::loadSession): Deleted.
111         (WebCore::MockCDMInstance::closeSession): Deleted.
112         (WebCore::MockCDMInstance::removeSessionData): Deleted.
113         (WebCore::MockCDMInstance::storeRecordOfKeyUsage): Deleted.
114         * testing/MockCDMFactory.h:
115         (WebCore::MockCDMInstance::factory const):
116         (WebCore::MockCDMInstance::distinctiveIdentifiersAllowed const):
117         (WebCore::MockCDMInstance::persistentStateAllowed const):
118
119 2018-09-21  Alicia Boya García  <aboya@igalia.com>
120
121         [MSE] Fix comparsion with uninitialized greatestDecodeDuration
122         https://bugs.webkit.org/show_bug.cgi?id=189805
123
124         Reviewed by Michael Catanzaro.
125
126         This bug was causing greatestDecodeDuration to never be initialized,
127         which in turned caused unintended frame erase as distant appends where
128         not being recognized as distinct coded frame groups.
129
130         A test reproducing the sequence of appends that caused unintended
131         frame deletion has also been added (media-source-append-out-of-order.html).
132
133         * Modules/mediasource/SourceBuffer.cpp:
134         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
135
136 2018-09-21  Antoine Quint  <graouts@apple.com>
137
138         [Web Animations] Accelerated animations don't get suspended
139         https://bugs.webkit.org/show_bug.cgi?id=189783
140         <rdar://problem/44652315>
141
142         Unreviewed, correct a merge error in the previous commit.
143
144         * animation/DocumentTimeline.cpp:
145         (WebCore::DocumentTimeline::performInvalidationTask):
146
147 2018-09-21  Antoine Quint  <graouts@apple.com>
148
149         [Web Animations] Accelerated animations don't get suspended
150         https://bugs.webkit.org/show_bug.cgi?id=189783
151         <rdar://problem/43033568>
152
153         Reviewed by Dean Jackson.
154
155         Test: webanimations/accelerated-animation-suspension.html
156
157         We used to set the flag that marked the timeline as suspended prior to notifying animations that they need to be suspended.
158         However, since the timeline was marked as suspended, querying the running state of the animations would indicate that the
159         animations weren't running since a suspended timeline would identify its animations as not running. As such we would fail
160         to pause the accelerated animations because they were already not marked as running. We now set the suspended flag on the
161         timeline _after_ suspending its animations.
162
163         We also fix a bug in the new internals.acceleratedAnimationsForElement() test function so that we read from the actual
164         CA animations and not from a stale list of animations which would not indicate the correct animation speeds.
165
166         * animation/DocumentTimeline.cpp:
167         (WebCore::DocumentTimeline::suspendAnimations):
168         * platform/graphics/ca/GraphicsLayerCA.cpp:
169         (WebCore::GraphicsLayerCA::acceleratedAnimationsForTesting):
170
171 2018-09-21  Zan Dobersek  <zdobersek@igalia.com>
172
173         TransformationMatrix::toColumnMajorFloatArray() should return a std::array<> object
174         https://bugs.webkit.org/show_bug.cgi?id=189823
175
176         Reviewed by Michael Catanzaro.
177
178         Alias the TransformationMatrix::FloatMatrix4 type to
179         std::array<float, 16>. Instead of filling out the array object that's
180         passed in through a reference parameter, return the std::array<>
181         object from the function.
182
183         * Modules/webvr/VRFrameData.cpp:
184         (WebCore::matrixToArray):
185         * Modules/webvr/VRStageParameters.cpp:
186         (WebCore::VRStageParameters::sittingToStandingTransform const):
187         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
188         (WebCore::TextureMapperShaderProgram::setMatrix):
189         * platform/graphics/transforms/TransformationMatrix.cpp:
190         (WebCore::TransformationMatrix::toColumnMajorFloatArray const):
191         * platform/graphics/transforms/TransformationMatrix.h:
192
193 2018-09-21  Zan Dobersek  <zdobersek@igalia.com>
194
195         FloatQuad point getters should return const references
196         https://bugs.webkit.org/show_bug.cgi?id=189821
197
198         Reviewed by Yusuke Suzuki.
199
200         Be pedantic and have the FloatQuad point getters return const references
201         to the FloatPoint member variables, instead of technically creating
202         copies of them (though much of this copying is eliminated when the
203         getters are inlined).
204
205         * platform/graphics/FloatQuad.h:
206         (WebCore::FloatQuad::p1 const):
207         (WebCore::FloatQuad::p2 const):
208         (WebCore::FloatQuad::p3 const):
209         (WebCore::FloatQuad::p4 const):
210
211 2018-09-20  Antoine Quint  <graouts@apple.com>
212
213         [Web Animations] DocumentTimeline::updateAnimations() is called endlessly
214         https://bugs.webkit.org/show_bug.cgi?id=189784
215         <rdar://problem/41705679>
216
217         Reviewed by Dean Jackson.
218
219         Test: webanimations/accelerated-animation-interruption-display-none.html
220
221         We have code that keeps queueing pending accelerated actions for an animation that does not have a renderer until it has one
222         so that we can deal with situations where animations are ready to commited before its composited renderer is available. This
223         code ended up running continuously when an element with an accelerated animation had its renderer removed without the animation
224         being removed itself, such as setting "display: none" on an element with an acceelerated CSS Animation targeting it.
225
226         We fix this by queueing up a "Stop" accelerated action when updating the accelerated state if there is no renderer for the current
227         animation target. Then, we no longer re-queue pending accelerated actions if the last queued operation is "Stop". This ensures that
228         we no longer queue actions endlessly when there is no longer a visible animation.
229
230         To test this, we add a new internals.numberOfAnimationTimelineInvalidations() method that indicates the number of times the current
231         document's animation timeline was invalidated.
232
233         * animation/DocumentTimeline.cpp:
234         (WebCore::DocumentTimeline::updateAnimations):
235         (WebCore::DocumentTimeline::numberOfAnimationTimelineInvalidationsForTesting const):
236         * animation/DocumentTimeline.h:
237         * animation/KeyframeEffectReadOnly.cpp:
238         (WebCore::KeyframeEffectReadOnly::updateAcceleratedAnimationState): If the animation target does not have a renderer and it's still
239         marked as running, enqueue a "Stop" accelerated action.
240         (WebCore::KeyframeEffectReadOnly::addPendingAcceleratedAction): If we enqueue a "Stop" accelerated action, remove any other queued
241         action so that we only process the "Stop" action, which would have superseded all previously queued actions anyway.
242         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Only re-queue pending accelerated actions when a composited renderer
243         is not yet available if we don't have a "Stop" action queued.
244         * testing/Internals.cpp:
245         (WebCore::Internals::numberOfAnimationTimelineInvalidations const):
246         * testing/Internals.h:
247         * testing/Internals.idl:
248
249 2018-09-21  Yacine Bandou  <yacine.bandou@softathome.com>
250
251         [EME] Fix typo in WebM sanitization variable
252         https://bugs.webkit.org/show_bug.cgi?id=189789
253
254         Reviewed by Xabier Rodriguez-Calvar.
255
256         This commit corrects a typo in the name of a local variable, sanitizedBuffer
257         instead of sanitazedBuffer.
258
259         * Modules/encryptedmedia/InitDataRegistry.cpp:
260         (WebCore::extractKeyIDsWebM):
261
262 2018-09-20  Dean Jackson  <dino@apple.com>
263
264         Restrict the total combined size of backdrop filters
265         https://bugs.webkit.org/show_bug.cgi?id=189812
266         <rdar://problem/44532782>
267
268         Reviewed by Simon Fraser.
269
270         If the total area of all backdrop filters on the page gets
271         too large, the universe collapses in on itself and we enter
272         the Quantum Realm (i.e. crash horribly).
273
274         Put a hard limit on the total coverage, and ignore any backdrop
275         filters after the limit. This might break some content, but
276         such content is likely not doing things in the most optimal manner.
277         There isn't any reason to have a backdrop larger than the size of
278         the screen, because you'd be better off applying a foreground
279         filter to the main content and showing something above it.
280
281         Tests: css3/filters/backdrop/resource-use-add-more-layers.html
282                css3/filters/backdrop/resource-use-excessive.html
283                css3/filters/backdrop/resource-use-ok.html
284                css3/filters/backdrop/resource-use-remove-some-layers.html
285
286         * platform/graphics/ca/GraphicsLayerCA.cpp: Pick a fairly small maximum size. We
287         can consider increasing this if necessary, and as devices with less RAM are
288         upgraded.
289         (WebCore::GraphicsLayerCA::recursiveCommitChanges): Gather the accumulated size
290         of backdrop filters into the commit state as we are recursing through the tree.
291         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): Force any layer
292         with backdrop filters, or any that is removing backdrop filters, into an update.
293         (WebCore::GraphicsLayerCA::updateBackdropFilters): Update the logic to first
294         check if this backdrop layer causes us to exceed the total allowed size, and if
295         it does, forbid it from getting the GraphicsLayer that composits the backdrop.
296
297         * platform/graphics/ca/GraphicsLayerCA.h: Remove const from some parameters so
298         that we can use the CommitState to hold the accumulated size.
299
300 2018-09-20  Benjamin Poulain  <benjamin@webkit.org>
301
302         Adopt safe-area-insets on ImageDocument
303         https://bugs.webkit.org/show_bug.cgi?id=189774
304
305         Reviewed by Tim Horton.
306         rdar://problem/44624432
307
308         By having the safe-area insets on the image, we ensure that they only
309         grow the document if there is not enough space. This also ensures the image
310         does not have parts under UI elements.
311
312         * html/ImageDocument.cpp:
313         (WebCore::ImageDocument::createDocumentStructure):
314         (WebCore::ImageDocument::imageUpdated):
315
316 2018-09-20  Zalan Bujtas  <zalan@apple.com>
317
318         Release assert under RenderView::pageOrViewLogicalHeight
319         https://bugs.webkit.org/show_bug.cgi?id=189798
320         <rdar://problem/43659749>
321
322         Reviewed by Simon Fraser.
323
324         Only the mainframe's render view is sized to the page while printing.
325         Use the matching check (see RenderView::layout) when accessing m_pageLogicalSize.
326
327         Test: printing/crash-while-formatting-subframe-for-printing.html
328
329         * rendering/RenderView.cpp:
330         (WebCore::RenderView::pageOrViewLogicalHeight const):
331
332 2018-09-20  Sihui Liu  <sihui_liu@apple.com>
333
334         REGRESSION(r196265): WKWebView fires mouseover, mouseenter, and mouseleave events even when it's in a background window
335         https://bugs.webkit.org/show_bug.cgi?id=187545
336         <rdar://problem/42401575>
337
338         Reviewed by Ryosuke Niwa.
339
340         When the window is not active, we should only update the scrollbar for mouse events. GTK
341         apps have different expectation on this behavior.
342
343         Test: fast/events/inactive-window-no-mouse-event.html
344
345         * page/EventHandler.cpp:
346         (WebCore::EventHandler::handleMouseMoveEvent):
347         (WebCore::EventHandler::shouldSendMouseEventsToInactiveWindows const):
348         * page/EventHandler.h:
349
350 2018-09-20  Alex Christensen  <achristensen@webkit.org>
351
352         Unreviewed, rolling out r235976.
353
354         Broke ARM
355
356         Reverted changeset:
357
358         "Use a Variant instead of a union in CSSSelector"
359         https://bugs.webkit.org/show_bug.cgi?id=188559
360         https://trac.webkit.org/changeset/235976
361
362 2018-09-20  Oriol Brufau  <obrufau@igalia.com>
363
364         Fix 'border' serialization with both common and uncommon values
365         https://bugs.webkit.org/show_bug.cgi?id=189597
366
367         Reviewed by Simon Fraser.
368
369         Remove CommonValueMode enum and make borderPropertyValue always return null
370         when there are uncommon values (the previous ReturnNullOnUncommonValues mode).
371
372         Test: fast/css/getPropertyValue-border.html
373         Test: fast/dom/css-shorthand-common-value.html
374
375         * css/StyleProperties.cpp:
376         (WebCore::StyleProperties::getPropertyValue const):
377         (WebCore::StyleProperties::borderPropertyValue const):
378         (WebCore::StyleProperties::asText const):
379         * css/StyleProperties.h:
380
381 2018-09-20  Justin Michaud  <justin_michaud@apple.com>
382
383         Implement CSS Custom Properties and Values Skeleton
384         https://bugs.webkit.org/show_bug.cgi?id=189694
385
386         Reviewed by Simon Fraser.
387
388         Add feature flag, CSS.registerProperty binding and registered property set in Document.h
389         for the css custom properties and values api.
390
391         Test: css-properties-values-api/registerProperty.html
392
393         * CMakeLists.txt:
394         * DerivedSources.make:
395         * Sources.txt:
396         * WebCore.xcodeproj/project.pbxproj:
397         * css/CSSRegisteredCustomProperty.h: Added.
398         * css/DOMCSSCustomPropertyDescriptor.h: Added.
399         * css/DOMCSSCustomPropertyDescriptor.idl: Added.
400         * css/DOMCSSNamespace.h:
401         * css/DOMCSSRegisterCustomProperty.cpp: Added.
402         (WebCore::DOMCSSRegisterCustomProperty::registerProperty):
403         (WebCore::DOMCSSRegisterCustomProperty::from):
404         (WebCore::DOMCSSRegisterCustomProperty::supplementName):
405         * css/DOMCSSRegisterCustomProperty.h: Added.
406         * css/DOMCSSRegisterCustomProperty.idl: Added.
407         * css/parser/CSSParserContext.cpp:
408         * dom/Document.cpp:
409         (WebCore::Document::registerCSSProperty):
410         * dom/Document.h:
411         * features.json:
412         * page/RuntimeEnabledFeatures.h:
413         (WebCore::RuntimeEnabledFeatures::setCSSCustomPropertiesAndValuesEnabled):
414         (WebCore::RuntimeEnabledFeatures::cssCustomPropertiesAndValuesEnabled const):
415
416 2018-09-20  Justin Michaud  <justin_michaud@apple.com>
417
418         JS bindings generator should support EnabledAtRuntime for static methods
419         https://bugs.webkit.org/show_bug.cgi?id=189729
420
421         Reviewed by Chris Dumez.
422
423         Add support for EnabledAtRuntime to static methods in the JS bindings
424         code generator.
425
426         * bindings/scripts/CodeGeneratorJS.pm:
427         (GenerateRuntimeEnableConditionalStringForExposed):
428         (GenerateRuntimeEnableConditionalString):
429         (GetRuntimeEnabledStaticProperties):
430         (GenerateConstructorHelperMethods):
431         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
432         (WebCore::JSTestGlobalObjectConstructor::initializeProperties):
433         (WebCore::JSTestGlobalObject::finishCreation):
434         (WebCore::jsTestGlobalObjectConstructorFunctionEnabledAtRuntimeOperationStaticBody):
435         (WebCore::jsTestGlobalObjectConstructorFunctionEnabledAtRuntimeOperationStatic):
436         * bindings/scripts/test/JS/JSTestObj.cpp:
437         (WebCore::JSTestObjConstructor::initializeProperties):
438         (WebCore::jsTestObjConstructorEnabledAtRuntimeAttributeStaticGetter):
439         (WebCore::jsTestObjConstructorEnabledAtRuntimeAttributeStatic):
440         (WebCore::setJSTestObjConstructorEnabledAtRuntimeAttributeStaticSetter):
441         (WebCore::setJSTestObjConstructorEnabledAtRuntimeAttributeStatic):
442         (WebCore::jsTestObjConstructorFunctionEnabledAtRuntimeOperationStaticBody):
443         (WebCore::jsTestObjConstructorFunctionEnabledAtRuntimeOperationStatic):
444         * bindings/scripts/test/TestGlobalObject.idl:
445         * bindings/scripts/test/TestObj.idl:
446
447 2018-09-20  Per Arne Vollan  <pvollan@apple.com>
448
449         [WebVTT] Update the parser according to the new region syntax.
450         https://bugs.webkit.org/show_bug.cgi?id=189767
451
452         Reviewed by Eric Carlson.
453
454         The majority of the code added in this patch is adopted from the Chromium project, which has added
455         support for the new region syntax. The complete parser specification can be found at
456         https://w3c.github.io/webvtt/#file-parsing. One small difference in behavior is that the new parser
457         will not add regions with empty id.
458
459         No new tests, covered by existing tests.
460
461         * html/track/WebVTTParser.cpp:
462         (WebCore::WebVTTParser::getNewRegions):
463         (WebCore::WebVTTParser::parse):
464         (WebCore::WebVTTParser::collectRegionSettings):
465         (WebCore::WebVTTParser::collectWebVTTBlock):
466         (WebCore::WebVTTParser::checkAndRecoverCue):
467         (WebCore::WebVTTParser::checkAndCreateRegion):
468         (WebCore::WebVTTParser::checkAndStoreRegion):
469         (WebCore::WebVTTParser::collectMetadataHeader): Deleted.
470         (WebCore::WebVTTParser::createNewRegion): Deleted.
471         * html/track/WebVTTParser.h:
472
473 2018-09-20  Alicia Boya García  <aboya@igalia.com>
474
475         [GStreamer][MSE] Add a default sample duration
476         https://bugs.webkit.org/show_bug.cgi?id=189788
477
478         Some WebM files don't provide sample durations, so we need to provide
479         a safe default in order for them to be playable.
480
481         Reviewed by Michael Catanzaro.
482
483         * platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
484         (WebCore::MediaSampleGStreamer::MediaSampleGStreamer):
485
486 2018-09-20  Alicia Boya García  <aboya@igalia.com>
487
488         [MSE] Use some tolerance when deciding whether a frame should be appended to the decode queue
489         https://bugs.webkit.org/show_bug.cgi?id=189782
490
491         Reviewed by Xabier Rodriguez-Calvar.
492
493         Ideally, container formats should use exact timestamps and frames
494         should not overlap. Unfortunately, there are lots of files out there
495         where this is not always the case.
496
497         This is particularly a problem in WebM, where timestamps are expressed
498         in a power of 10 timescale, which forces some rounding.
499
500         This patch makes SourceBuffer allow frames with a small overlaps
501         (<=1ms) as those usually found in WebM. 1 ms is chosen because it's
502         the default time scale of WebM files.
503
504         * Modules/mediasource/SourceBuffer.cpp:
505         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
506
507 2018-09-20  Yacine Bandou  <yacine.bandou@softathome.com>
508
509         [EME] Add WebM sanitization
510         https://bugs.webkit.org/show_bug.cgi?id=189740
511
512         Reviewed by Xabier Rodriguez-Calvar.
513
514         This patch adds support for sanitizing the WebM initialization data,
515         ensures there are no bogus values.
516         See https://www.w3.org/TR/encrypted-media/#dom-mediakeysession-generaterequest.
517
518         Tests: imported/w3c/web-platform-tests/encrypted-media/clearkey-generate-request-disallowed-input.https.html
519
520         * Modules/encryptedmedia/InitDataRegistry.cpp:
521         (WebCore::sanitizeWebM): Added implementation, check if the initialization data doesn't empty and its size
522         should be less than 64KB, return the buffer copy if it is ok, otherwise a nullptr.
523         (WebCore::extractKeyIDsWebM): Added implementation.
524
525 2018-09-20  Philippe Normand  <pnormand@igalia.com>
526
527         [GStreamer] Utilities cleanups
528         https://bugs.webkit.org/show_bug.cgi?id=189699
529
530         Reviewed by Xabier Rodriguez-Calvar.
531
532         The GstMappedBuffer now has a move constructor so that it can be easily
533         reused in the webaudiosrc element. The now-unused corresponding
534         buffer-mapping utilities are removed from the code-base.
535
536         The HTTP source element used to handle a GstBuffer in its private
537         structure but this is no longer required since data is now pushed
538         in chunks, see bug #182829.
539
540         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
541         (webKitWebAudioSrcLoop):
542         * platform/graphics/gstreamer/GStreamerCommon.cpp:
543         (WebCore::createGstBuffer): Deleted.
544         (WebCore::createGstBufferForData): Deleted.
545         (WebCore::getGstBufferDataPointer): Deleted.
546         (WebCore::mapGstBuffer): Deleted.
547         (WebCore::unmapGstBuffer): Deleted.
548         * platform/graphics/gstreamer/GStreamerCommon.h:
549         (WebCore::GstMappedBuffer::create): New method returning a
550         reference to a newly created GstMappedBuffer instance.
551         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
552         (webKitWebSrcStop): Remove reference to unused GstBuffer.
553         (CachedResourceStreamingClient::dataReceived): Ditto.
554
555 2018-09-20  Simon Fraser  <simon.fraser@apple.com>
556
557         Fix crash under FontCache::purgeInactiveFontData() when a memory warning fires
558         https://bugs.webkit.org/show_bug.cgi?id=189722
559         rdar://problem/44182860
560
561         Reviewed by Myles C. Maxfield.
562         
563         Hashing of FontPlatformData for cachedFonts() is somewhat broken because CFEqual() on CTFont
564         can return false when the fonts are actually the same, and have the same CFHash(). This 
565         can result in multiple entries in cachedFonts() with the same Font.
566         
567         Then in FontCache::purgeInactiveFontData(), the loop that appends fonts to fontsToDelete
568         gets the value by reference, and WTFMoves it into fontsToDelete. This nulls out all
569         the entries sharing the same value, leaving null entries in the hash table.
570         We later crash at font->hasOneRef() when using one of those null entries.
571         
572         Fix by making a copy of the RefPtr<Font> in the loop, so the WTFMove doesn't nuke
573         the hash table entries. The entries will get removed at cachedFonts().remove() lower down.
574
575         * platform/graphics/FontCache.cpp:
576         (WebCore::FontCache::purgeInactiveFontData):
577
578 2018-09-20  Antoine Quint  <graouts@apple.com>
579
580         [Web Animations] Provide a way to query accelerated animations for internal testing
581         https://bugs.webkit.org/show_bug.cgi?id=189762
582
583         Reviewed by Dean Jackson.
584
585         Expose a new internals.acceleratedAnimationsForElement(element) method to allow layout tests to query the current list
586         of accelerated animations for a given element. Currently only the animated property and animation speed are exposed, which
587         will allow us to identify missing, running and paused accelerated animations.
588
589         * animation/DocumentTimeline.cpp:
590         (WebCore::DocumentTimeline::acceleratedAnimationsForElement const):
591         * animation/DocumentTimeline.h:
592         * platform/graphics/GraphicsLayer.h:
593         (WebCore::GraphicsLayer::acceleratedAnimationsForTesting const):
594         * platform/graphics/ca/GraphicsLayerCA.cpp:
595         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
596         * platform/graphics/ca/GraphicsLayerCA.h:
597         * testing/Internals.cpp:
598         (WebCore::Internals::acceleratedAnimationsForElement):
599         * testing/Internals.h:
600         * testing/Internals.idl:
601
602 2018-09-19  Ryosuke Niwa  <rniwa@webkit.org>
603
604         Improve node statistics for rare data
605         https://bugs.webkit.org/show_bug.cgi?id=189775
606
607         Reviewed by Simon Fraser.
608
609         Report reasons we created NodeRareData and ElementRareData in node statistics.
610
611         Added NodeRareData::useTypes and ElementRareData::useTypes which returns OptionSet<NodeRareData::UseType>
612         indicating which instance member of the rare data is currently in use.
613
614         * dom/Element.cpp:
615         * dom/Element.h:
616         * dom/ElementRareData.h:
617         (WebCore::defaultMinimumSizeForResizing):
618         (WebCore::ElementRareData::useTypes const):
619         * dom/Node.cpp:
620         (WebCore::stringForRareDataUseType):
621         (WebCore::Node::dumpStatistics):
622         * dom/NodeRareData.cpp:
623         * dom/NodeRareData.h:
624         (WebCore::NodeRareData::useTypes const):
625
626 2018-09-19  Ryosuke Niwa  <rniwa@webkit.org>
627
628         REGRESSION(r235917): 2% regression in Dromaeo CSS selector on MacBookPro11,4
629         https://bugs.webkit.org/show_bug.cgi?id=189738
630
631         Reviewed by Yusuke Suzuki.
632
633         The regression was caused by the regundant walk to the parent element. Removed it to fix the regression.
634
635         * cssjit/SelectorCompiler.cpp:
636         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateNthChildParentCheckAndRelationUpdate):
637         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateNthLastChildParentCheckAndRelationUpdate):
638
639 2018-09-19  John Wilander  <wilander@apple.com>
640
641         Resource Load Statistics: Add optional cap on partitioned cache max age
642         https://bugs.webkit.org/show_bug.cgi?id=189711
643         <rdar://problem/39246837>
644
645         Reviewed by Antti Koivisto and Chris Dumez.
646
647         Test: http/tests/resourceLoadStatistics/cap-cache-max-age-for-prevalent-resource.html
648
649         * platform/network/NetworkStorageSession.h:
650         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
651         (WebCore::NetworkStorageSession::maxAgeCacheCap):
652             Checks if a max age cap is set and returns it if the request
653             represents a prevalent resource.
654         (WebCore::NetworkStorageSession::setCacheMaxAgeCapForPrevalentResources):
655         (WebCore::NetworkStorageSession::resetCacheMaxAgeCapForPrevalentResources):
656             New functionality to receive a max age cap setting in the session.
657
658 2018-09-19  Youenn Fablet  <youenn@apple.com>
659
660         Layout Test webrtc/video-mute.html is flaky.
661         https://bugs.webkit.org/show_bug.cgi?id=177501
662
663         Reviewed by Eric Carlson.
664
665         Covered by updated test expectation.
666
667         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
668         (WebCore::createBlackPixelBuffer): Make sure the whole buffer is properly initialized.
669
670 2018-09-19  David Kilzer  <ddkilzer@apple.com>
671
672         WebCoreNSURLSession leaks an NSString (_sessionDescription) in -dealloc
673         <https://webkit.org/b/189742>
674         <rdar://problem/44589774>
675
676         Reviewed by Joseph Pecoraro.
677
678         * platform/network/cocoa/WebCoreNSURLSession.h:
679         (WebCoreNSURLSession._sessionDescription): Change type from
680         NSString * to RetainPtr<NSString>.
681         * platform/network/cocoa/WebCoreNSURLSession.mm: Remove
682         @synthesized statement for sessionDescription so that custom
683         methods can be implemented to handle RetainPtr<NSString>.
684         (-[WebCoreNSURLSession sessionDescription]): Add.
685         (-[WebCoreNSURLSession setSessionDescription:]): Add.
686
687 2018-09-19  Youenn Fablet  <youenn@apple.com>
688
689         Implement sender/receiver getStats
690         https://bugs.webkit.org/show_bug.cgi?id=189707
691
692         Reviewed by Eric Carlson.
693
694         Add support for sender and receiver getStats.
695         Also add support for peer connection selector parameter.
696
697         Add the plumbing of the selector to LibWebRTCMediaEndpoint.
698         Then make use of libwebrtc overloaded methods to retrieve the right stats.
699
700         Covered by updated/rebased tests.
701
702         * Modules/mediastream/PeerConnectionBackend.h:
703         * Modules/mediastream/RTCPeerConnection.cpp:
704         (WebCore::RTCPeerConnection::getStats):
705         * Modules/mediastream/RTCPeerConnection.h:
706         * Modules/mediastream/RTCPeerConnection.idl:
707         * Modules/mediastream/RTCRtpReceiver.cpp:
708         (WebCore::RTCRtpReceiver::RTCRtpReceiver):
709         (WebCore::RTCRtpReceiver::getStats):
710         * Modules/mediastream/RTCRtpReceiver.h:
711         (WebCore::RTCRtpReceiver::create):
712         (WebCore::RTCRtpReceiver::backend):
713         * Modules/mediastream/RTCRtpReceiver.idl:
714         * Modules/mediastream/RTCRtpSender.cpp:
715         (WebCore::RTCRtpSender::create):
716         (WebCore::RTCRtpSender::RTCRtpSender):
717         (WebCore::RTCRtpSender::getStats):
718         * Modules/mediastream/RTCRtpSender.h:
719         * Modules/mediastream/RTCRtpSender.idl:
720         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
721         (WebCore::LibWebRTCMediaEndpoint::getStats):
722         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
723         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
724         (WebCore::LibWebRTCPeerConnectionBackend::getStats):
725         (WebCore::backendFromRTPSender):
726         (WebCore::createReceiverForSource):
727         (WebCore::LibWebRTCPeerConnectionBackend::createReceiver):
728         (WebCore::LibWebRTCPeerConnectionBackend::videoReceiver):
729         (WebCore::LibWebRTCPeerConnectionBackend::audioReceiver):
730         (WebCore::LibWebRTCPeerConnectionBackend::addTrack):
731         (WebCore::LibWebRTCPeerConnectionBackend::addUnifiedPlanTransceiver):
732         (WebCore::LibWebRTCPeerConnectionBackend::addTransceiver):
733         (WebCore::LibWebRTCPeerConnectionBackend::newRemoteTransceiver):
734         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
735         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h:
736
737 2018-09-19  Jer Noble  <jer.noble@apple.com>
738
739         REGRESSION (r236006): New waitingForKey() requirement breaks Modern EME tests.
740         https://bugs.webkit.org/show_bug.cgi?id=189720
741         <rdar://problem/44572140>
742
743         Reviewed by Xabier Rodriguez-Calvar.
744
745         Always call waitingForKey() after calling initializationDataEncountered().
746
747         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
748         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
749         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
750         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::initializationDataEncountered):
751
752 2018-09-19  Philippe Normand <pnormand@igalia.com>
753
754         [GStreamer] Add support for AV1 decoding
755         https://bugs.webkit.org/show_bug.cgi?id=189647
756
757         Tweaked by Xabier Rodriguez Calvar <calvaris@igalia.com>.
758         Reviewed by Žan Doberšek.
759
760         AV1 can be muxed in MP4 and WebM containers. The test is an adaptation from Chromium's unittest:
761         https://chromium.googlesource.com/chromium/src/+/master/content/browser/media/media_canplaytype_browsertest.cc
762
763         Test: media/media-can-play-av1.html
764
765         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
766         (WebCore::MediaPlayerPrivateGStreamer::supportsType): Add AV1
767         support. The av01 codec has to be explicitely checked, along with
768         the presence of a compatible AV1 decoder.
769
770 2018-09-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
771
772         [Curl] Limit capturing extra metrics for Web Inspector when not required.
773         https://bugs.webkit.org/show_bug.cgi?id=189520
774
775         Reviewed by Alex Christensen.
776
777         Respect the value of NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics() to reduce the process
778         time when they are not needed.
779
780         No new tests because there's no behavior change.
781
782         * platform/network/curl/CurlContext.cpp:
783         (WebCore::CurlHandle::getNetworkLoadMetrics):
784         (WebCore::CurlHandle::addExtraNetworkLoadMetrics):
785         * platform/network/curl/CurlContext.h:
786         * platform/network/curl/CurlRequest.cpp:
787         (WebCore::CurlRequest::CurlRequest):
788         (WebCore::CurlRequest::updateNetworkLoadMetrics):
789         * platform/network/curl/CurlRequest.h:
790         (WebCore::CurlRequest::create):
791         * platform/network/curl/ResourceHandleCurl.cpp:
792         (WebCore::ResourceHandle::createCurlRequest):
793
794 2018-09-18  Megan Gardner  <megan_gardner@apple.com>
795
796         Support Images Module Level 4's double-position gradient color stop syntax
797         https://bugs.webkit.org/show_bug.cgi?id=186154
798         <rdar://problem/44158152>
799
800         Reviewed by Simon Fraser.
801
802         The CSS spec for all gradients allows for each color stop to have two angles to be used for hints.
803         This makes pie chart and checkerboard conic gradients much simpler to write.
804         Any time you want to have a hard line in a gradient, this syntax simplifies the gradient specification.
805
806         Test: fast/gradients/conic-two-hints.html
807         Test: fast/gradients/linear-two-hints-angle.html
808         Test: fast/gradients/linear-two-hints.html
809         Test: fast/gradients/radial-two-hints.html
810
811         * css/parser/CSSPropertyParserHelpers.cpp:
812         (WebCore::CSSPropertyParserHelpers::consumeAngularGradientColorStops): Removed.
813         (WebCore::CSSPropertyParserHelpers::consumeGradientColorStops):
814
815 2018-09-18  Simon Fraser  <simon.fraser@apple.com>
816
817         Remove the unused RenderLayerCompositor::enclosingCompositorFlushingLayers()
818         https://bugs.webkit.org/show_bug.cgi?id=189689
819
820         Reviewed by Alex Christensen.
821
822         enclosingCompositorFlushingLayers() was added in r76196 but never used. Also use
823         a SetForScope<>.
824
825         * rendering/RenderLayerCompositor.cpp:
826         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
827         (WebCore::RenderLayerCompositor::enclosingCompositorFlushingLayers const): Deleted.
828         * rendering/RenderLayerCompositor.h:
829
830 2018-09-18  Joseph Pecoraro  <pecoraro@apple.com>
831
832         [macOS] Frequent leaks seen under WebCore::gpuIDForDisplayMask
833         https://bugs.webkit.org/show_bug.cgi?id=189685
834         <rdar://problem/44541974>
835
836         Reviewed by Per Arne Vollan.
837
838         * platform/mac/PlatformScreenMac.mm:
839         (WebCore::gpuIDForDisplayMask):
840
841 2018-09-18  Youenn Fablet  <youenn@apple.com>
842
843         Implement RTCRtpReceiver getContributingSources/getSynchronizationSources
844         https://bugs.webkit.org/show_bug.cgi?id=189671
845
846         Reviewed by Eric Carlson.
847
848         Introduce implementation of these two methods by calling the libwebrtc corresponding method.
849         Add corresponding IDL as per spec.
850         Covered by rebased WPT tests.
851
852         * CMakeLists.txt:
853         * DerivedSources.make:
854         * Modules/mediastream/RTCRtpContributingSource.h: Added.
855         * Modules/mediastream/RTCRtpContributingSource.idl: Added.
856         * Modules/mediastream/RTCRtpReceiver.h:
857         (WebCore::RTCRtpReceiver::getContributingSources const):
858         (WebCore::RTCRtpReceiver::getSynchronizationSources const):
859         * Modules/mediastream/RTCRtpReceiver.idl:
860         * Modules/mediastream/RTCRtpReceiverBackend.h:
861         (WebCore::RTCRtpReceiverBackend::getContributingSources const):
862         (WebCore::RTCRtpReceiverBackend::getSynchronizationSources const):
863         * Modules/mediastream/RTCRtpSynchronizationSource.h: Added.
864         * Modules/mediastream/RTCRtpSynchronizationSource.idl: Added.
865         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.cpp:
866         (WebCore::fillRTCRtpContributingSource):
867         (WebCore::toRTCRtpContributingSource):
868         (WebCore::toRTCRtpSynchronizationSource):
869         (WebCore::LibWebRTCRtpReceiverBackend::getContributingSources const):
870         (WebCore::LibWebRTCRtpReceiverBackend::getSynchronizationSources const):
871         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h:
872         * Sources.txt:
873         * WebCore.xcodeproj/project.pbxproj:
874
875 2018-09-18  Youenn Fablet  <youenn@apple.com>
876
877         Enable Unified Plan by default
878         https://bugs.webkit.org/show_bug.cgi?id=189675
879
880         Reviewed by Eric Carlson.
881
882         RTCRtpTransceiver.currentDirection is now gated by the unified plan runtime flag.
883         This will allow easy feature detection of unified plan support.
884         Covered by updated test.
885
886         * Modules/mediastream/RTCRtpTransceiver.idl:
887
888 2018-09-18  Per Arne Vollan  <pvollan@apple.com>
889
890         [WebVTT] change "middle" to "center" for consistency with CSS
891         https://bugs.webkit.org/show_bug.cgi?id=158478
892
893         Reviewed by Eric Carlson.
894
895         No new tests, covered by existing tests.
896
897         * html/track/TextTrackCueGeneric.cpp:
898         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
899         * html/track/VTTCue.cpp:
900         (WebCore::centerKeyword):
901         (WebCore::VTTCue::initialize):
902         (WebCore::VTTCue::align const):
903         (WebCore::VTTCue::setAlign):
904         (WebCore::VTTCue::calculateDisplayParameters):
905         (WebCore::VTTCue::setCueSettings):
906         (WebCore::middleKeyword): Deleted.
907         * html/track/VTTCue.h:
908         * html/track/WebVTTParser.cpp:
909         (WebCore::WebVTTTreeBuilder::buildFromString):
910
911 2018-09-18  Chris Dumez  <cdumez@apple.com>
912
913         "DidFirstVisuallyNonEmptyLayout" callback does not get called when restoring a page from PageCache
914         https://bugs.webkit.org/show_bug.cgi?id=189681
915         <rdar://problem/44526171>
916
917         Reviewed by Alex Christensen and Zalan Bujtas.
918
919         The "DidFirstVisuallyNonEmptyLayout" callback was not getting called when restoring a page from PageCache
920         because the FrameView is restored from PageCache and we would fail to restore its flags (such as
921         m_firstVisuallyNonEmptyLayoutCallbackPending) when entering Page Cache. We now call reset those flags that
922         are related to layout miletones when entering PageCache so that layout milestone events properly get sent
923         again when restoring from Page Cache.
924
925         * history/CachedFrame.cpp:
926         (WebCore::CachedFrame::CachedFrame):
927
928 2018-09-18  Manuel Rego Casasnovas  <rego@igalia.com>
929
930         [css-grid] Static position should use content-box, not padding-box
931         https://bugs.webkit.org/show_bug.cgi?id=189698
932
933         Reviewed by Javier Fernandez.
934
935         This is a recent change by the CSSWG:
936         https://github.com/w3c/csswg-drafts/issues/3020
937
938         The spec text (https://drafts.csswg.org/css-grid/#static-position):
939           "The static position of an absolutely-positioned child
940            of a grid container is determined as if it were the sole grid item
941            in a grid area whose edges coincide with the content edges
942            of the grid container."
943
944         Test: imported/w3c/web-platform-tests/css/css-grid/abspos/absolute-positioning-grid-container-parent-001.html
945
946         * rendering/RenderGrid.cpp:
947         (WebCore::RenderGrid::prepareChildForPositionedLayout):
948         Simple change to use border and padding.
949
950 2018-09-18  Xabier Rodriguez Calvar  <calvaris@igalia.com>
951
952         [EME][GStreamer] The current EME implementation doesn't support the waitingforkey event
953         https://bugs.webkit.org/show_bug.cgi?id=185590
954
955         Reviewed by Philippe Normand.
956
957         When decryptors are blocked waiting for the key, instruct the
958         player to run the Wait for key algorithm. As per spec, if we run
959         out of blocks pending to decrypt because we don't have the key, we
960         request running the algorithm again.
961
962         Test: imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-waitingforkey.https.html.
963
964         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
965         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
966         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
967         (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered):
968         (WebCore::MediaPlayerPrivateGStreamerBase::reportWaitingForKey):
969         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
970         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
971         (webkitMediaCommonEncryptionDecryptTransformInPlace):
972         (webkitMediaCommonEncryptionDecryptSinkEventHandler):
973
974 2018-09-12  Ryosuke Niwa  <rniwa@webkit.org>
975
976         Update composedPath to match the latest spec
977         https://bugs.webkit.org/show_bug.cgi?id=180378
978         <rdar://problem/42843004>
979
980         Reviewed by Darin Adler.
981
982         This patch makes the check for whether a given node in the event path be included in composedPath
983         pre-determined at the time of the event dispatching per https://github.com/whatwg/dom/issues/525.
984         This was a fix for the issue that if an event listener in a closed shadow tree removes a node in the
985         same tree in the event path, then composedPath called on its shadow host, for example, will include
986         the removed node since it's no longer in the closed shadow tree.
987
988         Naively, implementing this behavior would require remembering the original document or shadow root
989         of each node in the event path as well as its parent shadow root, or worse which node is disclosed
990         to every other node at the time of computing the event path.
991
992         This patch takes a more novel and efficient approach to implement the new behavior by adding a single
993         integer indicating the number of closed-mode shadow root ancestors of each node in the event path.
994         In computePathUnclosedToTarget, any node whose *depth* is greater than the context object is excluded.
995
996         Consider the following example:
997         div ------- ShadowRoot (closed)
998           +- span     +- slot
999         If an event is dispatched on span, then the event path would be [span, slot, ShadowRoot, div]. Then
1000         the values of integers assigned to each node would be: [0, 1, 1, 0] respectively. When composedPath
1001         is called on span or div, slot and ShadowRoot are excluded because they have a greater *depth* value.
1002
1003         Unfortunately, this simplistic solution doesn't work when there are multiple shadow roots of the same
1004         depth through which an event is dispatched as in:
1005         section -- ShadowRoot (closed, SR2)
1006           |          +- slot (s2)
1007           +div ------ ShadowRoot (closed, SR1)
1008             +- span     +- slot (s1)
1009         If an event is dispatched on span, the event path would be [span, s1, SR1, div, s2, SR2, section].
1010         The values of integers assigned are: [0, 1, 1, 0, 1, 1, 0] respectively. When composedPath is called
1011         on SR1, the simplistic approach would include s2 and SR2, which would be wrong.
1012
1013         To account for this case, in computePathUnclosedToTarget, we traverse the event path upwards (i.e.
1014         ancestors) and downwards (i.e. descendants) from the context object and decrease the *allowed depth*
1015         of shadow trees when we traverse out of a shadow tree in either direction. When traversing upwards,
1016         therefore, moving out of a shadow root to its host would would decrease the allowed depth. When
1017         traversing dowards, moving from a slot element to its assigned node would decrease the allowed depth.
1018
1019         Note that the depths can be negative when a composed event is dispatched inside a closed shadow tree,
1020         and it gets out of its shadow host.
1021
1022         Unfortunately, the latest DOM specification has a bug and doesn't match the behavior of Chrome. This
1023         patch proposes a new algorithm which can be adopted in https://github.com/whatwg/dom/issues/684.
1024
1025         Test: imported/w3c/web-platform-tests/shadow-dom/event-composed-path-after-dom-mutation.html
1026
1027         * dom/EventContext.cpp:
1028         (WebCore::EventContext::EventContext):
1029         (WebCore::MouseOrFocusEventContext::MouseOrFocusEventContext):
1030         (WebCore::TouchEventContext::TouchEventContext):
1031         * dom/EventContext.h:
1032         (WebCore::EventContext::closedShadowDepth const): Added.
1033         * dom/EventPath.cpp:
1034         (WebCore::WindowEventContext::WindowEventContext):
1035         (WebCore::EventPath::buildPath): Compute the closed shadow tree's depths for each node in the path.
1036         (WebCore::computePathUnclosedToTarget const): Implemented the aforementioned algorithm.
1037         (WebCore::EventPath::EventPath):
1038
1039 2018-09-17  Yusuke Suzuki  <utatane.tea@gmail.com>
1040
1041         [WTF] Use Semaphore and BinarySemaphore instead of dispatch_semaphore_t
1042         https://bugs.webkit.org/show_bug.cgi?id=185339
1043
1044         Reviewed by Mark Lam.
1045
1046         * fileapi/ThreadableBlobRegistry.cpp:
1047         (WebCore::ThreadableBlobRegistry::blobSize):
1048         * platform/cocoa/NetworkExtensionContentFilter.h:
1049         * platform/cocoa/NetworkExtensionContentFilter.mm:
1050         (WebCore::NetworkExtensionContentFilter::initialize):
1051         (WebCore::NetworkExtensionContentFilter::willSendRequest):
1052         (WebCore::NetworkExtensionContentFilter::responseReceived):
1053         (WebCore::NetworkExtensionContentFilter::addData):
1054         (WebCore::NetworkExtensionContentFilter::finishedAddingData):
1055         (WebCore::NetworkExtensionContentFilter::handleDecision):
1056         Use per-function BinarySemaphore instead of holding it in NetworkExtensionContentFilter's field.
1057
1058         * platform/glib/FileMonitorGLib.cpp:
1059         (WebCore::FileMonitor::FileMonitor):
1060         (WebCore::FileMonitor::~FileMonitor):
1061         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1062         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1063         (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
1064         (WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC):
1065         (WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange):
1066         (WebCore::MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange):
1067         Use BinarySemaphore. And remove unused dispatch_semaphore_t.
1068
1069         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1070         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1071         (-[WebAVStreamDataParserListener streamDataParserWillProvideContentKeyRequestInitializationData:forTrackID:]):
1072         (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]):
1073         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
1074         (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
1075         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
1076         (WebCore::SourceBufferPrivateAVFObjC::abort):
1077         (WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
1078         (WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):
1079         Use Box<Semaphore> and Box<BinarySemaphore>.
1080
1081         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
1082         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
1083         (WebCore::WebCoreDecompressionSession::WebCoreDecompressionSession):
1084         Remove unused dispatch_semaphore_t.
1085
1086         * platform/network/cf/ResourceHandleCFNet.cpp:
1087         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1088         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1089         (WebCore::getRunLoop):
1090         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
1091         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
1092         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
1093         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
1094         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
1095         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1096         (-[WebCoreResourceHandleAsOperationQueueDelegate initWithHandle:messageQueue:]):
1097         (-[WebCoreResourceHandleAsOperationQueueDelegate detachHandle]):
1098         (-[WebCoreResourceHandleAsOperationQueueDelegate dealloc]):
1099         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
1100         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
1101         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
1102         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
1103         Use BinarySemaphore instead.
1104
1105 2018-09-17  Simon Fraser  <simon.fraser@apple.com>
1106
1107         Many modern media control tests leak documents in testing
1108         https://bugs.webkit.org/show_bug.cgi?id=189437
1109
1110         Reviewed by Darin Adler.
1111
1112         In order to accurately detect leaks in media controls tests which use lots of
1113         SVGImages, we have to:
1114         - Fire a zero-delay timer after the postTask, in order for ImagesLoader's m_derefElementTimer
1115           to clear references to elements.
1116         - Have releaseCriticalMemory() call CachedResourceLoader's garbageCollectDocumentResources()
1117           to drop the last handle to the CachedResource for an SVGImage.
1118         - Call WKBundleReleaseMemory() after the GC and timer, since we need garbageCollectDocumentResources()
1119           to run again after that timer has fired.
1120         
1121         This should fix most of the spurious leak reports involving SVGImage documents.
1122
1123         * page/MemoryRelease.cpp:
1124         (WebCore::releaseCriticalMemory):
1125
1126 2018-09-17  Jer Noble  <jer.noble@apple.com>
1127
1128         Add support for HEVC codec types in Media Capabilities
1129         https://bugs.webkit.org/show_bug.cgi?id=189565
1130
1131         Reviewed by Eric Carlson.
1132
1133         Test: media/hevc-codec-parameters.html
1134
1135         Add some utility methods for parsing HEVC codec strings, and using those parsed
1136         values to query the platform for detailed support for HEVC decoding.
1137
1138         Drive-by fix: Modify MediaEngineConfigurationFactory to allow for null function
1139         pointers in the encode/decode factory pair.
1140
1141         * Sources.txt:
1142         * SourcesCocoa.txt:
1143         * WebCore.xcodeproj/project.pbxproj:
1144         * platform/cocoa/VideoToolboxSoftLink.cpp:
1145         * platform/cocoa/VideoToolboxSoftLink.h:
1146         * platform/graphics/HEVCUtilities.cpp: Added.
1147         (WebCore::parseHEVCCodecParameters):
1148         * platform/graphics/HEVCUtilities.h: Added.
1149         * platform/graphics/cocoa/HEVCUtilitiesCocoa.cpp: Added.
1150         (WebCore::validateHEVCParameters):
1151         * platform/graphics/cocoa/HEVCUtilitiesCocoa.h: Added.
1152         * platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp: Added.
1153         (WebCore::videoCodecTypeFromRFC4281Type):
1154         (WebCore::createMediaPlayerDecodingConfigurationCocoa):
1155         * platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.h: Added.
1156         * platform/mediacapabilities/MediaEngineConfigurationFactory.cpp:
1157         (WebCore::factories):
1158         (WebCore::MediaEngineConfigurationFactory::createDecodingConfiguration):
1159         (WebCore::MediaEngineConfigurationFactory::createEncodingConfiguration):
1160         * testing/Internals.cpp:
1161         (WebCore::Internals::parseHEVCCodecParameters):
1162         * testing/Internals.h:
1163         * testing/Internals.idl:
1164
1165 2018-09-17  Devin Rousso  <drousso@apple.com>
1166
1167         Web Inspector: generate CSSKeywordCompletions from backend values
1168         https://bugs.webkit.org/show_bug.cgi?id=189041
1169
1170         Reviewed by Joseph Pecoraro.
1171
1172         Modified existing test inspector/css/getSupportedCSSProperties.html.
1173
1174         * inspector/agents/InspectorCSSAgent.cpp:
1175         (WebCore::InspectorCSSAgent::getSupportedCSSProperties):
1176         Send alias and longhand information for all properties, and any known keyword values for
1177         those applicable. This makes use of `CSSParserFastPaths::isValidKeywordPropertyAndValue` to
1178         determine if a given keyword is a valid value for each property. This only generates a list
1179         for properties who have no non-keyword values.
1180
1181         * css/makeprop.pl:
1182         * css/makevalues.pl:
1183         Create additional helper functions/constants for retrieving strings of each CSS keyword.
1184
1185         * css/CSSProperty.h:
1186         (WebCore::CSSProperty::aliasesForProperty):
1187
1188         * css/CSSPrimitiveValue.cpp:
1189         (WebCore::valueName):
1190
1191         * css/CSSValuePool.cpp:
1192         (WebCore::CSSValuePool::CSSValuePool):
1193         (WebCore::CSSValuePool::createIdentifierValue):
1194
1195 2018-09-17  Youenn Fablet  <youenn@apple.com>
1196
1197         track.onmute isn't called for a remote MediaStreamTrack when its counter part track is removed from the peer connection
1198         https://bugs.webkit.org/show_bug.cgi?id=176281
1199         <rdar://problem/44525674>
1200
1201         Reviewed by Eric Carlson.
1202
1203         Listen to libwebrtc remove track callbacks.
1204         Implement handling as per https://w3c.github.io/webrtc-pc/#process-remote-track-removal.
1205         This triggers a mute event on the track.
1206
1207         Test: webrtc/remove-track.html
1208
1209         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1210         (WebCore::LibWebRTCMediaEndpoint::removeRemoteTrack):
1211         (WebCore::LibWebRTCMediaEndpoint::OnRemoveTrack):
1212         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
1213         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1214         (WebCore::LibWebRTCPeerConnectionBackend::shouldOfferAllowToReceive const):
1215         Drive by fix: Plan B code path does not mandate having an rtc backend for each sender.
1216
1217 2018-09-17  Simon Fraser  <simon.fraser@apple.com>
1218
1219         Add more Fullscreen logging
1220         https://bugs.webkit.org/show_bug.cgi?id=189656
1221
1222         Reviewed by Jer Noble.
1223
1224         Add some fullscreen logging so I can tell whether WebFullScreenManager ever releases
1225         the fullscreen element.
1226
1227         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
1228         (VideoFullscreenModelVideoElement::VideoFullscreenModelVideoElement):
1229         (VideoFullscreenModelVideoElement::~VideoFullscreenModelVideoElement):
1230         (VideoFullscreenModelVideoElement::setVideoElement):
1231
1232 2018-09-14  Simon Fraser  <simon.fraser@apple.com>
1233
1234         Add support for dumping the GraphicsLayer tree via notifyutil
1235         https://bugs.webkit.org/show_bug.cgi?id=189639
1236
1237         Reviewed by Zalan Bujtas.
1238
1239         Make "notifyutil -p com.apple.WebKit.showGraphicsLayerTree" work. It dumps the GraphicsLayer tree
1240         for each top-level document (GraphicsLayers are connected across frame boundaries, so this prints
1241         the entire tree for each main frame).
1242         
1243         It uses WTFLogAlways rather than fprintf() so output shows on all platforms (other tree dumps should
1244         be converted in the same way).
1245
1246         * page/mac/PageMac.mm:
1247         (WebCore::Page::platformInitialize):
1248         * platform/graphics/GraphicsLayer.cpp:
1249         (showGraphicsLayerTree):
1250         * rendering/RenderLayerCompositor.cpp:
1251         (showGraphicsLayerTreeForCompositor):
1252         * rendering/RenderLayerCompositor.h:
1253         * rendering/RenderObject.cpp:
1254         (WebCore::printGraphicsLayerTreeForLiveDocuments):
1255         * rendering/RenderObject.h:
1256
1257 2018-09-17  Christopher Reid  <chris.reid@sony.com>
1258
1259         [Curl] Add schema version and enable auto vacuum for cookie database.
1260         https://bugs.webkit.org/show_bug.cgi?id=189669
1261
1262         Reviewed by Alex Christensen.
1263
1264         Turning on auto incremental vacuuming and adding versioning to the database. Right now we
1265         reset tables if there's an unknown schema or if the none is set. There is placeholder logic
1266         in place to upgrade databases as the schema changes in the future.
1267
1268         Tested by checking the database manually after launching MiniBrowser.
1269
1270         * platform/network/curl/CookieJarDB.cpp:
1271         (WebCore::CookieJarDB::openDatabase):
1272         (WebCore::CookieJarDB::verifySchemaVersion):
1273         (WebCore::CookieJarDB::deleteAllTables):
1274         (WebCore::CookieJarDB::createPrepareStatement):
1275         (WebCore::CookieJarDB::getPrepareStatement):
1276         (WebCore::CookieJarDB::executeSimpleSql):
1277         * platform/network/curl/CookieJarDB.h:
1278         * platform/network/curl/NetworkStorageSessionCurl.cpp:
1279         (WebCore::defaultSession):
1280         * platform/sql/SQLiteDatabase.cpp:
1281         (WebCore::SQLiteDatabase::turnOnIncrementalAutoVacuum): fixed a bug.
1282
1283 2018-09-14  Ryosuke Niwa  <rniwa@webkit.org>
1284
1285         Re-order Node flags based on semantics
1286         https://bugs.webkit.org/show_bug.cgi?id=189643
1287
1288         Reviewed by Simon Fraser.
1289
1290         Re-ordered Node flags based on their category and subclasses of Node which use them.
1291
1292         * dom/Node.h:
1293
1294 2018-09-17  Simon Fraser  <simon.fraser@apple.com>
1295
1296         Add more ResourceLoading logging, particularly in MemoryCache code
1297         https://bugs.webkit.org/show_bug.cgi?id=189651
1298
1299         Reviewed by Tim Horton.
1300
1301         Adding more logging to the ResourceLoading log channel, which I found useful
1302         when trying to understand cached SVGImage lifetimes (bug 189437).
1303
1304         * loader/cache/CachedResource.cpp:
1305         (WebCore::CachedResource::deleteIfPossible):
1306         * loader/cache/CachedResourceLoader.cpp:
1307         (WebCore::CachedResourceLoader::requestResource):
1308         (WebCore::CachedResourceLoader::garbageCollectDocumentResources):
1309         * loader/cache/MemoryCache.cpp:
1310         (WebCore::MemoryCache::add):
1311         (WebCore::MemoryCache::pruneLiveResourcesToSize):
1312         (WebCore::MemoryCache::pruneDeadResources):
1313         (WebCore::MemoryCache::pruneDeadResourcesToSize):
1314         (WebCore::MemoryCache::remove):
1315         (WebCore::MemoryCache::dumpLRULists const):
1316
1317 2018-09-17  Jer Noble  <jer.noble@apple.com>
1318
1319         Enable USE_MEDIAREMOTE on iOS
1320         https://bugs.webkit.org/show_bug.cgi?id=189096
1321
1322         Reviewed by Eric Carlson.
1323
1324         Migrate to using MediaRemote.framework on iOS from MediaPlayer.framework. This unifies the
1325         Now Playing implementation on iOS and Mac.
1326
1327         * SourcesCocoa.txt:
1328         * WebCore.xcodeproj/project.pbxproj:
1329         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: Removed.
1330         * platform/audio/cocoa/MediaSessionManagerCocoa.h:
1331         * platform/audio/cocoa/MediaSessionManagerCocoa.mm: Renamed from Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm.
1332         (PlatformMediaSessionManager::sharedManager):
1333         (PlatformMediaSessionManager::sharedManagerIfExists):
1334         (MediaSessionManagerCocoa::updateSessionState):
1335         (MediaSessionManagerCocoa::beginInterruption):
1336         (MediaSessionManagerCocoa::scheduleUpdateNowPlayingInfo):
1337         (MediaSessionManagerCocoa::sessionWillBeginPlayback):
1338         (MediaSessionManagerCocoa::sessionDidEndRemoteScrubbing):
1339         (MediaSessionManagerCocoa::removeSession):
1340         (MediaSessionManagerCocoa::sessionWillEndPlayback):
1341         (MediaSessionManagerCocoa::clientCharacteristicsChanged):
1342         (MediaSessionManagerCocoa::sessionCanProduceAudioChanged):
1343         (MediaSessionManagerCocoa::nowPlayingEligibleSession):
1344         (MediaSessionManagerCocoa::updateNowPlayingInfo):
1345         * platform/audio/ios/MediaSessionManagerIOS.h:
1346         (): Deleted.
1347         * platform/audio/ios/MediaSessionManagerIOS.mm:
1348         (WebCore::MediaSessionManageriOS::nowPlayingEligibleSession): Deleted.
1349         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Deleted.
1350         (WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): Deleted.
1351         (WebCore::MediaSessionManageriOS::removeSession): Deleted.
1352         (WebCore::MediaSessionManageriOS::sessionWillEndPlayback): Deleted.
1353         (WebCore::MediaSessionManageriOS::clientCharacteristicsChanged): Deleted.
1354         * platform/audio/mac/MediaSessionManagerMac.h: Removed.
1355
1356 2018-09-17  Frederic Wang  <fwang@igalia.com>
1357
1358         Build error in ImageBufferCG when compiled with IOSurfacePool
1359         https://bugs.webkit.org/show_bug.cgi?id=189579
1360
1361         Reviewed by Tim Horton.
1362
1363         IOSurface.h might be included with different value of IOSURFACE_CANVAS_BACKING_STORE, causing
1364         compilation errors when files in the same unified source do not agree on the definition.
1365         This patch moves the definition of IOSURFACE_CANVAS_BACKING_STORE from ImageBufferDataCG.h
1366         to Platform.h so that IOSURFACE_CANVAS_BACKING_STORE is set to the same value in all files.
1367         Finally some minors changes to explicitly declare/define ImageBuffer are performed in order
1368         to prevent future issues with Unified build rotating.
1369
1370         No new tests, behavior unchanged.
1371
1372         * html/HTMLCanvasElement.cpp: Explicitly include ImageBuffer.h since it's used in this file.
1373         * platform/graphics/cg/ImageBufferDataCG.h: Move definition into Platform.h.
1374         * platform/graphics/cocoa/IOSurface.h: Forward-declare ImageBuffer since it's used in this
1375         header.
1376
1377 2018-09-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1378
1379         [Curl] Respond with requested authentication scheme for authentication challenge.
1380         https://bugs.webkit.org/show_bug.cgi?id=189318
1381
1382         Reviewed by Alex Christensen.
1383
1384         Curl port depends on libcurl's authentication handling by enabling CURLAUTH_ANY. With this
1385         mode, the round-trip communication between the client and the server is handled by libcurl
1386         internally. That's okay for many cases. But when initial request has a credentials
1387         (i.e. XMLHttpRequest), there's no valid chance to store credential to the storage because
1388         the returned response is not 401.
1389
1390         Passes following tests:
1391         - http/tests/websocket/tests/hybi/httponly-cookie.pl
1392         - http/tests/websocket/tests/hybi/secure-cookie-insecure-connection.pl
1393         - http/tests/websocket/tests/hybi/secure-cookie-secure-connection.pl
1394         - http/tests/xmlhttprequest/basic-auth-default.html
1395         - http/tests/xmlhttprequest/cross-origin-authorization.html
1396         - http/tests/xmlhttprequest/logout.html
1397         - http/tests/xmlhttprequest/null-auth.php
1398         - http/tests/xmlhttprequest/re-login-async.html
1399         - http/tests/xmlhttprequest/re-login.html
1400         - http/tests/xmlhttprequest/redirect-credentials-responseURL.html
1401         - http/tests/xmlhttprequest/remember-bad-password.html
1402
1403         * platform/network/ResourceHandle.h:
1404         * platform/network/curl/CurlContext.cpp:
1405         (WebCore::CurlHandle::setHttpAuthUserPass):
1406         (WebCore::CurlHandle::enableHttpAuthentication): Deleted.
1407         * platform/network/curl/CurlContext.h:
1408         * platform/network/curl/CurlRequest.cpp:
1409         (WebCore::CurlRequest::setAuthenticationScheme):
1410         (WebCore::CurlRequest::setupTransfer):
1411         * platform/network/curl/CurlRequest.h:
1412         * platform/network/curl/ResourceHandleCurl.cpp:
1413         (WebCore::ResourceHandle::start):
1414         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
1415         (WebCore::ResourceHandle::receivedCredential):
1416         (WebCore::ResourceHandle::getCredential):
1417         (WebCore::ResourceHandle::restartRequestWithCredential):
1418         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1419         (WebCore::ResourceHandle::continueAfterWillSendRequest):
1420
1421 2018-09-17  Youenn Fablet  <youenn@apple.com>
1422
1423         Enable VCP for iOS and reenable it for MacOS
1424         https://bugs.webkit.org/show_bug.cgi?id=189635
1425         <rdar://problem/43621029>
1426
1427         Reviewed by Eric Carlson.
1428
1429         Covered by exsiting and modified tests.
1430         Instead of using libwebrtc YUV frames for black frames, use CVPixelBuffer to make it efficient.
1431         Add internal API to know whether VCP is enabled so as to make capture-webrtc test pass on all platforms.
1432
1433         * platform/mediastream/RealtimeOutgoingVideoSource.cpp:
1434         (WebCore::RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded):
1435         * platform/mediastream/RealtimeOutgoingVideoSource.h:
1436         * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.h:
1437         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h:
1438         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
1439         (WebCore::createBlackPixelBuffer):
1440         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
1441         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
1442         (WebCore::RealtimeOutgoingVideoSourceCocoa::createBlackFrame):
1443         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h:
1444         * testing/Internals.cpp:
1445         (WebCore::Internals::supportsVCPEncoder):
1446         * testing/Internals.h:
1447         * testing/Internals.idl:
1448
1449 2018-09-17  Chris Dumez  <cdumez@apple.com>
1450
1451         PSON: window.open() with 'noopener' should only process-swap cross-site, not cross-origin
1452         https://bugs.webkit.org/show_bug.cgi?id=189602
1453         <rdar://problem/44430549>
1454
1455         Reviewed by Geoff Garen.
1456
1457         * loader/DocumentLoader.cpp:
1458         (WebCore::DocumentLoader::setTriggeringAction):
1459         * loader/DocumentLoader.h:
1460         * loader/FrameLoadRequest.h:
1461         * loader/FrameLoader.cpp:
1462         (WebCore::FrameLoader::loadURL):
1463         (WebCore::FrameLoader::loadWithNavigationAction):
1464         (WebCore::FrameLoader::loadWithDocumentLoader):
1465         (WebCore::FrameLoader::loadPostRequest):
1466         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
1467         (WebCore::FrameLoader::loadDifferentDocumentItem):
1468         Move NavigationAction's opener setting to loadWithNavigationAction() as this is a better bottleneck.
1469         Otherwise, we'd have to set it at several call sites. Also move the NavigationAction around instead
1470         of copying it.
1471
1472         * loader/FrameLoader.h:
1473         (WebCore::FrameLoader::loadWithNavigationAction):
1474         * loader/NavigationAction.h:
1475         (WebCore::NavigationAction::setShouldOpenExternalURLsPolicy):
1476         * loader/PolicyChecker.cpp:
1477         (WebCore::PolicyChecker::checkNavigationPolicy):
1478         * page/DOMWindow.cpp:
1479         (WebCore::DOMWindow::createWindow):
1480
1481 2018-09-17  Darin Adler  <darin@apple.com>
1482
1483         Use OpaqueJSString rather than JSRetainPtr inside WebKit
1484         https://bugs.webkit.org/show_bug.cgi?id=189652
1485
1486         Reviewed by Saam Barati.
1487
1488         * Modules/plugins/QuickTimePluginReplacement.mm:
1489         (WebCore::jsValueWithDictionaryInContext): Use OpaqueJSString::create.
1490         (WebCore::jsValueWithAVMetadataItemInContext): Use adoptCF.
1491
1492         * platform/mac/SerializedPlatformRepresentationMac.mm:
1493         (WebCore::jsValueWithDictionaryInContext): Use OpaqueJSString::create.
1494
1495 2018-09-08  Darin Adler  <darin@apple.com>
1496
1497         Streamline JSRetainPtr, fix leaks of JSString and JSGlobalContext
1498         https://bugs.webkit.org/show_bug.cgi?id=189455
1499
1500         Reviewed by Keith Miller.
1501
1502         * Modules/plugins/QuickTimePluginReplacement.mm:
1503         (WebCore::jsValueWithDictionaryInContext): Adding a missing
1504         JSStringRelease to fix a leak.
1505
1506 2018-09-15  Rob Buis  <rbuis@igalia.com>
1507
1508         XMLHttpRequest::createResponseBlob() should create a Blob with type for empty response
1509         https://bugs.webkit.org/show_bug.cgi?id=189627
1510
1511         Reviewed by Alexey Proskuryakov.
1512
1513         Right now we return an empty Blob without type when the response is empty, but
1514         it should always include the type [1].
1515
1516         Test: web-platform-tests/xhr/overridemimetype-blob.html
1517
1518         [1] https://xhr.spec.whatwg.org/#blob-response
1519
1520         * xml/XMLHttpRequest.cpp:
1521         (WebCore::XMLHttpRequest::createResponseBlob):
1522
1523 2018-09-14  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1524
1525         [Curl] Bug fix on some inaccurate values in NetworkLoadMetrics.
1526         https://bugs.webkit.org/show_bug.cgi?id=189530
1527
1528         Reviewed by Alex Christensen.
1529
1530         Curl port uses the start time libcurl provided. But there's a lug between main thread and Curl thread.
1531         Record the start time of request instead of libcurl's start timing and use it to measure the metrics.
1532         Also respondEnd was not correctly recorded and fixed.
1533
1534         No new tests because it cannot be measured from DRT.
1535
1536         * platform/network/ResourceHandleInternal.h:
1537         * platform/network/curl/CurlContext.cpp:
1538         (WebCore::CurlHandle::getNetworkLoadMetrics):
1539         * platform/network/curl/CurlContext.h:
1540         * platform/network/curl/CurlRequest.cpp:
1541         (WebCore::CurlRequest::start):
1542         (WebCore::CurlRequest::setupTransfer):
1543         (WebCore::CurlRequest::didCompleteTransfer):
1544         (WebCore::CurlRequest::updateNetworkLoadMetrics):
1545         * platform/network/curl/CurlRequest.h:
1546         (WebCore::CurlRequest::setStartTime):
1547         * platform/network/curl/ResourceHandleCurl.cpp:
1548         (WebCore::ResourceHandle::start):
1549         (WebCore::ResourceHandle::restartRequestWithCredential):
1550         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1551         (WebCore::ResourceHandle::willSendRequest):
1552         (WebCore::ResourceHandle::continueAfterWillSendRequest):
1553
1554 2018-09-14  Justin Fan  <justin_fan@apple.com>
1555
1556         WebGL 2 conformance: rgb-format-support.html
1557         https://bugs.webkit.org/show_bug.cgi?id=189610
1558         <rdar://problem/44403343>
1559
1560         Reviewed by Dean Jackson.
1561
1562         Implementing getInternalformatParameter (emulating on macOS) and updating 
1563         renderbufferStorage{Multisample} for WebGL 2 conformance. 
1564
1565         Test: webgl/2.0.0/conformance2/rendering/rgb-format-support.html enabled.
1566
1567         * html/canvas/WebGL2RenderingContext.cpp:
1568         (WebCore::isRenderableInternalformat):
1569         (WebCore::WebGL2RenderingContext::getInternalformatParameter):
1570         (WebCore::WebGL2RenderingContext::renderbufferStorageMultisample):
1571         (WebCore::WebGL2RenderingContext::renderbufferStorage):
1572         (WebCore::WebGL2RenderingContext::baseInternalFormatFromInternalFormat):
1573         (WebCore::WebGL2RenderingContext::isIntegerFormat):
1574         * platform/graphics/GraphicsContext3D.h:
1575         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1576         (WebCore::GraphicsContext3D::getInternalformativ):
1577         (WebCore::GraphicsContext3D::renderbufferStorageMultisample):
1578
1579 2018-09-14  Justin Michaud  <justin_michaud@apple.com>
1580
1581         Add support for spreadMethod=reflect and repeat on SVG gradients (for CoreGraphics platforms)
1582         https://bugs.webkit.org/show_bug.cgi?id=5968
1583
1584         Add support for spreadMethod=repeat and reflect. Also, the opacity of a gradient is now
1585         the result of multiplying stop-opacity with the opacity of the color.
1586
1587         Reviewed by Simon Fraser.
1588
1589         Tests: svg/gradients/spreadMethod-expected.svg
1590                svg/gradients/spreadMethod.svg
1591                svg/gradients/spreadMethodAlpha-expected.svg
1592                svg/gradients/spreadMethodAlpha.svg
1593                svg/gradients/spreadMethodClose0-expected-mismatch.svg
1594                svg/gradients/spreadMethodClose0.svg
1595                svg/gradients/spreadMethodClose1-expected-mismatch.svg
1596                svg/gradients/spreadMethodClose1.svg
1597                svg/gradients/spreadMethodClose2-expected.svg
1598                svg/gradients/spreadMethodClose2.svg
1599                svg/gradients/spreadMethodDiagonal-expected.svg
1600                svg/gradients/spreadMethodDiagonal.svg
1601                svg/gradients/spreadMethodDiagonal2-expected.svg
1602                svg/gradients/spreadMethodDiagonal2.svg
1603                svg/gradients/spreadMethodDuplicateStop-expected.svg
1604                svg/gradients/spreadMethodDuplicateStop.svg
1605                svg/gradients/spreadMethodReversed-expected.svg
1606                svg/gradients/spreadMethodReversed.svg
1607                svg/gradients/stopAlpha-expected.svg
1608                svg/gradients/stopAlpha.svg
1609
1610         * platform/graphics/cg/GradientCG.cpp:
1611         (WebCore::Gradient::paint):
1612         * svg/SVGStopElement.cpp:
1613         (WebCore::SVGStopElement::stopColorIncludingOpacity const):
1614
1615 2018-09-14  Ryan Haddad  <ryanhaddad@apple.com>
1616
1617         Unreviewed, attempt to fix the iOSMac build after r236015.
1618
1619         * platform/graphics/cv/PixelBufferResizer.mm:
1620         (WebCore::PixelBufferResizer::PixelBufferResizer):
1621
1622 2018-09-11  Simon Fraser  <simon.fraser@apple.com>
1623
1624         Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings
1625         https://bugs.webkit.org/show_bug.cgi?id=189521
1626
1627         Reviewed by Tim Horton.
1628         
1629         Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>.
1630         
1631         RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>.
1632         
1633         All the other changes are just to adapt to the new ownership patterns.
1634         
1635         I verified that no GraphicsLayers were leaked or abandoned after this change.
1636
1637         No behavior change.
1638
1639         * page/PageOverlayController.cpp:
1640         (WebCore::PageOverlayController::layerWithDocumentOverlays):
1641         (WebCore::PageOverlayController::layerWithViewOverlays):
1642         (WebCore::PageOverlayController::installPageOverlay):
1643         (WebCore::PageOverlayController::uninstallPageOverlay):
1644         (WebCore::PageOverlayController::setPageOverlayNeedsDisplay):
1645         (WebCore::PageOverlayController::didChangeViewSize):
1646         (WebCore::PageOverlayController::didChangeDocumentSize):
1647         (WebCore::PageOverlayController::didChangeSettings):
1648         (WebCore::PageOverlayController::paintContents):
1649         (WebCore::PageOverlayController::didChangeOverlayFrame):
1650         (WebCore::PageOverlayController::didChangeOverlayBackgroundColor):
1651         * page/PageOverlayController.h:
1652         * page/mac/ServicesOverlayController.h:
1653         (WebCore::ServicesOverlayController::Highlight::layer const):
1654         * page/mac/ServicesOverlayController.mm:
1655         (WebCore::ServicesOverlayController::Highlight::Highlight):
1656         (WebCore::ServicesOverlayController::Highlight::invalidate):
1657         (WebCore::ServicesOverlayController::Highlight::fadeIn):
1658         (WebCore::ServicesOverlayController::Highlight::fadeOut):
1659         (WebCore::ServicesOverlayController::Highlight::didFinishFadeOutAnimation):
1660         (WebCore::ServicesOverlayController::determineActiveHighlight):
1661         * platform/graphics/GraphicsLayer.cpp:
1662         (WebCore::GraphicsLayer::GraphicsLayer):
1663         (WebCore::GraphicsLayer::willBeDestroyed):
1664         (WebCore::GraphicsLayer::setChildren):
1665         (WebCore::GraphicsLayer::addChild):
1666         (WebCore::GraphicsLayer::addChildAtIndex):
1667         (WebCore::GraphicsLayer::addChildBelow):
1668         (WebCore::GraphicsLayer::addChildAbove):
1669         (WebCore::GraphicsLayer::replaceChild):
1670         (WebCore::GraphicsLayer::removeAllChildren):
1671         (WebCore::GraphicsLayer::removeFromParent):
1672         (WebCore::GraphicsLayer::setMaskLayer):
1673         (WebCore::GraphicsLayer::noteDeviceOrPageScaleFactorChangedIncludingDescendants):
1674         (WebCore::GraphicsLayer::distributeOpacity):
1675         (WebCore::GraphicsLayer::traverse):
1676         (WebCore::dumpChildren):
1677         * platform/graphics/GraphicsLayer.h:
1678         (WebCore::GraphicsLayer::children const):
1679         (WebCore::GraphicsLayer::children):
1680         (WebCore::GraphicsLayer::maskLayer const):
1681         (WebCore::GraphicsLayer::replicaLayer const):
1682         (WebCore::GraphicsLayer::beingDestroyed const):
1683         (WebCore::GraphicsLayer:: const): Deleted.
1684         * platform/graphics/GraphicsLayerFactory.h:
1685         * platform/graphics/ca/GraphicsLayerCA.cpp:
1686         (WebCore::GraphicsLayer::create):
1687         (WebCore::GraphicsLayerCA::setChildren):
1688         (WebCore::GraphicsLayerCA::addChild):
1689         (WebCore::GraphicsLayerCA::addChildAtIndex):
1690         (WebCore::GraphicsLayerCA::addChildBelow):
1691         (WebCore::GraphicsLayerCA::addChildAbove):
1692         (WebCore::GraphicsLayerCA::replaceChild):
1693         (WebCore::GraphicsLayerCA::setMaskLayer):
1694         (WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush const):
1695         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
1696         (WebCore::GraphicsLayerCA::updateSublayerList):
1697         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
1698         * platform/graphics/ca/GraphicsLayerCA.h:
1699         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
1700         (WebCore::GraphicsLayer::create):
1701         (WebCore::GraphicsLayerTextureMapper::setChildren):
1702         (WebCore::GraphicsLayerTextureMapper::addChild):
1703         (WebCore::GraphicsLayerTextureMapper::addChildAtIndex):
1704         (WebCore::GraphicsLayerTextureMapper::addChildAbove):
1705         (WebCore::GraphicsLayerTextureMapper::addChildBelow):
1706         (WebCore::GraphicsLayerTextureMapper::replaceChild):
1707         (WebCore::GraphicsLayerTextureMapper::setMaskLayer):
1708         (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIncludingSubLayers):
1709         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
1710         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1711         (WebCore::GraphicsLayer::create):
1712         (WebCore::CoordinatedGraphicsLayer::setShouldUpdateVisibleRect):
1713         (WebCore::CoordinatedGraphicsLayer::addChild):
1714         (WebCore::CoordinatedGraphicsLayer::addChildAtIndex):
1715         (WebCore::CoordinatedGraphicsLayer::addChildAbove):
1716         (WebCore::CoordinatedGraphicsLayer::addChildBelow):
1717         (WebCore::CoordinatedGraphicsLayer::replaceChild):
1718         (WebCore::CoordinatedGraphicsLayer::setMaskLayer):
1719         (WebCore::CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers):
1720         (WebCore::CoordinatedGraphicsLayer::updateContentBuffersIncludingSubLayers):
1721         (WebCore::CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded):
1722         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1723         * platform/graphics/win/GraphicsLayerDirect2D.cpp:
1724         (WebCore::GraphicsLayer::create):
1725         (WebCore::GraphicsLayerDirect2D::GraphicsLayerDirect2D): Deleted.
1726         (WebCore::GraphicsLayerDirect2D::initialize): Deleted.
1727         (WebCore::GraphicsLayerDirect2D::~GraphicsLayerDirect2D): Deleted.
1728         (WebCore::GraphicsLayerDirect2D::setNeedsDisplay): Deleted.
1729         (WebCore::GraphicsLayerDirect2D::setNeedsDisplayInRect): Deleted.
1730         * rendering/RenderLayerBacking.cpp:
1731         (WebCore::RenderLayerBacking::createGraphicsLayer):
1732         (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
1733         (WebCore::RenderLayerBacking::updateConfiguration):
1734         (WebCore::RenderLayerBacking::updateInternalHierarchy):
1735         (WebCore::RenderLayerBacking::updateMaskingLayer):
1736         (WebCore::RenderLayerBacking::updateChildClippingStrategy):
1737         (WebCore::RenderLayerBacking::updateScrollingLayers):
1738         * rendering/RenderLayerBacking.h:
1739         * rendering/RenderLayerCompositor.cpp:
1740         (WebCore::RenderLayerCompositor::updateCompositingLayers):
1741         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
1742         (WebCore::RenderLayerCompositor::setCompositingParent):
1743         (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
1744         (WebCore::RenderLayerCompositor::parentFrameContentLayers):
1745         (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea):
1746         (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea):
1747         (WebCore::RenderLayerCompositor::updateLayerForHeader):
1748         (WebCore::RenderLayerCompositor::updateLayerForFooter):
1749         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
1750         (WebCore::RenderLayerCompositor::ensureRootLayer):
1751         (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged):
1752         * rendering/RenderLayerCompositor.h:
1753
1754 2018-09-14  Eric Carlson  <eric.carlson@apple.com>
1755
1756         Support arbitrary video resolution in getUserMedia API
1757         https://bugs.webkit.org/show_bug.cgi?id=178109
1758         <rdar://problem/35083128>
1759
1760         Reviewed by Youenn Fablet.
1761
1762         Support arbitrary video resolutions by configuring the camera to capture at the closest
1763         larger size it supports and scaling/cropping frames as necessary.
1764
1765         No new tests, existing tests updated.
1766
1767         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
1768         * Modules/webaudio/MediaStreamAudioSource.cpp:
1769         (WebCore::MediaStreamAudioSource::capabilities): Make non-const, it wasn't helpful.
1770         (WebCore::MediaStreamAudioSource::settings): Ditto.
1771         (WebCore::MediaStreamAudioSource::capabilities const): Deleted.
1772         (WebCore::MediaStreamAudioSource::settings const): Deleted.
1773         * Modules/webaudio/MediaStreamAudioSource.h:
1774
1775         * SourcesCocoa.txt: Add PixelBufferResizer.
1776
1777         * WebCore.xcodeproj/project.pbxproj: Ditto.
1778
1779         * platform/cocoa/CoreVideoSoftLink.h:
1780         * platform/cocoa/VideoToolboxSoftLink.cpp:
1781         * platform/cocoa/VideoToolboxSoftLink.h:
1782
1783         * platform/graphics/cv/PixelBufferResizer.h: Added.
1784         (WebCore::PixelBufferResizer::canResizeTo):
1785         * platform/graphics/cv/PixelBufferResizer.mm: Added.
1786         (WebCore::PixelBufferResizer::PixelBufferResizer):
1787         (WebCore::PixelBufferResizer::resize):
1788
1789         * platform/mediastream/RealtimeIncomingAudioSource.cpp:
1790         (WebCore::RealtimeIncomingAudioSource::capabilities): Make non-const, it wasn't helpful.
1791         (WebCore::RealtimeIncomingAudioSource::settings): Ditto.
1792         (WebCore::RealtimeIncomingAudioSource::capabilities const): Deleted.
1793         (WebCore::RealtimeIncomingAudioSource::settings const): Deleted.
1794         * platform/mediastream/RealtimeIncomingAudioSource.h:
1795
1796         * platform/mediastream/RealtimeIncomingVideoSource.cpp:
1797         (WebCore::RealtimeIncomingVideoSource::capabilities): Make non-const, it wasn't helpful.
1798         (WebCore::RealtimeIncomingVideoSource::settings): Ditto.
1799         (WebCore::RealtimeIncomingVideoSource::capabilities const): Deleted.
1800         (WebCore::RealtimeIncomingVideoSource::settings const): Deleted.
1801         * platform/mediastream/RealtimeIncomingVideoSource.h:
1802
1803         * platform/mediastream/RealtimeMediaSource.cpp:
1804         (WebCore::RealtimeMediaSource::supportsConstraint):
1805         (WebCore::RealtimeMediaSource::supportsConstraint const): Deleted.
1806         * platform/mediastream/RealtimeMediaSource.h:
1807
1808         * platform/mediastream/RealtimeVideoSource.cpp:
1809         (WebCore::RealtimeVideoSource::presets):
1810         (WebCore::RealtimeVideoSource::setSupportedPresets):
1811         (WebCore::standardVideoSizes):
1812         (WebCore::RealtimeVideoSource::updateCapabilities): Make non-const, it wasn't helpful.
1813         (WebCore::presetSupportsFrameRate):
1814         (WebCore::RealtimeVideoSource::supportsCaptureSize):
1815         (WebCore::RealtimeVideoSource::shouldUsePreset):
1816         (WebCore::RealtimeVideoSource::bestSupportedSizeAndFrameRate):
1817         (WebCore::RealtimeVideoSource::setSizeAndFrameRate):
1818         (WebCore::RealtimeVideoSource::addSupportedCapabilities const): Deleted.
1819         * platform/mediastream/RealtimeVideoSource.h:
1820         (WebCore::VideoPresetData::encode const):
1821         (WebCore::VideoPresetData::decode):
1822         (WebCore::VideoPreset::create):
1823         (WebCore::VideoPreset::VideoPreset):
1824         (WebCore::RealtimeVideoSource::prefersPreset):
1825         (WebCore::RealtimeVideoSource::canResizeVideoFrames const):
1826         (WebCore::RealtimeVideoSource::setDefaultSize):
1827         (WebCore::RealtimeVideoSource::observedFrameRate const):
1828         (WebCore::VideoPreset::encode const): Deleted.
1829         (WebCore::VideoPreset::decode): Deleted.
1830
1831         * platform/mediastream/mac/AVVideoCaptureSource.h:
1832         (WebCore::AVVideoCaptureSource::videoPresets): Deleted.
1833         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1834         (WebCore::AVVideoPreset::create):
1835         (WebCore::AVVideoPreset::AVVideoPreset):
1836         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
1837         (WebCore::AVVideoCaptureSource::settings):
1838         (WebCore::AVVideoCaptureSource::capabilities): Make non-const, it wasn't helpful.
1839         (WebCore::AVVideoCaptureSource::setFrameRate):
1840         (WebCore::AVVideoCaptureSource::prefersPreset):
1841         (WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset):
1842         (WebCore::AVVideoCaptureSource::frameDurationForFrameRate):
1843         (WebCore::AVVideoCaptureSource::setupCaptureSession):
1844         (WebCore::AVVideoCaptureSource::processNewFrame):
1845         (WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
1846         (WebCore::AVVideoCaptureSource::isFrameRateSupported):
1847         (WebCore::AVVideoCaptureSource::generatePresets):
1848         (WebCore::updateSizeMinMax): Deleted.
1849         (WebCore::updateAspectRatioMinMax): Deleted.
1850         (WebCore::AVVideoCaptureSource::settings const): Deleted.
1851         (WebCore::AVVideoCaptureSource::capabilities const): Deleted.
1852         (WebCore::AVVideoCaptureSource::sizeForPreset): Deleted.
1853         (WebCore::AVVideoCaptureSource::setPreset): Deleted.
1854         (WebCore::AVVideoCaptureSource::setSizeAndFrameRate): Deleted.
1855         (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions): Deleted.
1856         (WebCore::AVVideoCaptureSource::supportsSizeAndFrameRate): Deleted.
1857
1858         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1859         (WebCore::CoreAudioCaptureSource::capabilities): Make non-const, it wasn't helpful.
1860         (WebCore::CoreAudioCaptureSource::settings): Ditto.
1861         (WebCore::CoreAudioCaptureSource::capabilities const): Deleted.
1862         (WebCore::CoreAudioCaptureSource::settings const): Deleted.
1863         * platform/mediastream/mac/CoreAudioCaptureSource.h:
1864
1865         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
1866         (WebCore::DisplayCaptureSourceCocoa::capabilities): Make non-const, it wasn't helpful.
1867         (WebCore::DisplayCaptureSourceCocoa::settings): Ditto.
1868         (WebCore::DisplayCaptureSourceCocoa::capabilities const): Deleted.
1869         (WebCore::DisplayCaptureSourceCocoa::settings const): Deleted.
1870         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
1871
1872         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
1873         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
1874         (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer):
1875         (WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer):
1876         (WebCore::MockRealtimeVideoSourceMac::setSizeAndFrameRateWithPreset):
1877         * platform/mock/MockMediaDevice.h:
1878         (WebCore::MockCameraProperties::decode):
1879
1880         * platform/mock/MockRealtimeAudioSource.cpp:
1881         (WebCore::MockRealtimeAudioSource::settings): Make non-const, it wasn't helpful.
1882         (WebCore::MockRealtimeAudioSource::capabilities): Ditto.
1883         (WebCore::MockRealtimeAudioSource::settings const): Deleted.
1884         (WebCore::MockRealtimeAudioSource::capabilities const): Deleted.
1885         * platform/mock/MockRealtimeAudioSource.h:
1886
1887         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1888         (WebCore::defaultDevices): Change video device presets to trigger resize code more often.
1889
1890         * platform/mock/MockRealtimeVideoSource.cpp:
1891         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
1892         (WebCore::MockRealtimeVideoSource::generatePresets):
1893         (WebCore::MockRealtimeVideoSource::capabilities): Make non-const, it wasn't helpful.
1894         (WebCore::MockRealtimeVideoSource::settings): Ditto.
1895         (WebCore::MockRealtimeVideoSource::capabilities const): Deleted.
1896         (WebCore::MockRealtimeVideoSource::settings const): Deleted.
1897         * platform/mock/MockRealtimeVideoSource.h:
1898
1899 2018-09-14  Frederic Wang  <fwang@igalia.com>
1900
1901         Bug 189541 - Build error in FontDescriptionKey::computeHash when compiling FontTaggedSettings and FontCascadeFonts together
1902         https://bugs.webkit.org/show_bug.cgi?id=189541
1903
1904         Reviewed by Alex Christensen.
1905
1906         FontDescriptionKey::computeHash() from In FontCache.h requires implicit instantiation of the
1907         FontTaggedSettings::hash() template function. This instantiation may happen before
1908         FontTaggedSettings::hash() is actually fully specialized in FontTaggedSettings.cpp. To avoid
1909         compiler errors when FontCache.h and FontTaggedSettings.cpp are in the same translation unit,
1910         we declare full specialization of the hash() functions in FontTaggedSettings.h.
1911
1912         No new tests, behavior unchanged.
1913
1914         * platform/graphics/FontCache.h: Explicitly include FontTaggedSettings to avoid possible future breakage.
1915         * platform/graphics/FontTaggedSettings.h: Declare full specialization of FontTaggedSettings::hash().
1916
1917 2018-09-14  Ryan Haddad  <ryanhaddad@apple.com>
1918
1919         Unreviewed, rolling out r235990.
1920
1921         Introduced TestWebKitAPI.NowPlayingTest timeouts on iOS
1922
1923         Reverted changeset:
1924
1925         "Enable USE_MEDIAREMOTE on iOS"
1926         https://bugs.webkit.org/show_bug.cgi?id=189096
1927         https://trac.webkit.org/changeset/235990
1928
1929 2018-09-14  Jer Noble  <jer.noble@apple.com>
1930
1931         Turn SourceBufferChangeTypeEnabled on by default
1932         https://bugs.webkit.org/show_bug.cgi?id=189527
1933
1934         Reviewed by Eric Carlson.
1935
1936         * page/Settings.yaml:
1937
1938 2018-09-14  Devin Rousso  <webkit@devinrousso.com>
1939
1940         Web Inspector: Record actions performed on ImageBitmapRenderingContext
1941         https://bugs.webkit.org/show_bug.cgi?id=181341
1942
1943         Reviewed by Joseph Pecoraro.
1944
1945         Test: inspector/canvas/recording-bitmaprenderer.html
1946
1947         * html/canvas/ImageBitmapRenderingContext.idl:
1948
1949         * inspector/InspectorCanvas.cpp:
1950         (WebCore::shouldSnapshotBitmapRendererAction):
1951         (WebCore::InspectorCanvas::recordAction):
1952
1953         * inspector/agents/InspectorCanvasAgent.cpp:
1954         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
1955
1956         * page/PageConsoleClient.cpp:
1957         (canvasRenderingContext):
1958
1959 2018-09-14  David Kilzer  <ddkilzer@apple.com>
1960
1961         REGRESSION (r235954): Fix build failure on watchOS
1962         <https://webkit.org/b/189605>
1963
1964         Reviewed by Geoffrey Garen.
1965
1966         Remove `using WebCore::IndexedDB::KeyType;` from
1967         Source/WebCore/Modules/indexeddb/IDBKey.h and fix all the
1968         resulting build failures.
1969
1970         * Modules/indexeddb/IDBKey.cpp:
1971         (WebCore::IDBKey::IDBKey):
1972         (WebCore::IDBKey::isValid const):
1973         (WebCore::IDBKey::compare const):
1974         * Modules/indexeddb/IDBKey.h:
1975         (WebCore::IDBKey::createNumber):
1976         (WebCore::IDBKey::createDate):
1977         (WebCore::IDBKey::type const):
1978         (WebCore::IDBKey::array const):
1979         (WebCore::IDBKey::string const):
1980         (WebCore::IDBKey::date const):
1981         (WebCore::IDBKey::number const):
1982         (WebCore::IDBKey::binary const):
1983         (WebCore::IDBKey::compareTypes):
1984         (WebCore::IDBKey::IDBKey):
1985         * Modules/indexeddb/IDBKeyData.cpp:
1986         (WebCore::IDBKeyData::IDBKeyData):
1987         (WebCore::IDBKeyData::maybeCreateIDBKey const):
1988         (WebCore::IDBKeyData::isolatedCopy):
1989         (WebCore::IDBKeyData::encode const):
1990         (WebCore::IDBKeyData::decode):
1991         (WebCore::IDBKeyData::compare const):
1992         (WebCore::IDBKeyData::loggingString const):
1993         (WebCore::IDBKeyData::setArrayValue):
1994         (WebCore::IDBKeyData::setBinaryValue):
1995         (WebCore::IDBKeyData::setStringValue):
1996         (WebCore::IDBKeyData::setDateValue):
1997         (WebCore::IDBKeyData::setNumberValue):
1998         (WebCore::IDBKeyData::isValid const):
1999         (WebCore::IDBKeyData::operator== const):
2000         * Modules/indexeddb/IDBKeyData.h:
2001         (WebCore::IDBKeyData::IDBKeyData):
2002         (WebCore::IDBKeyData::minimum):
2003         (WebCore::IDBKeyData::maximum):
2004         (WebCore::IDBKeyData::type const):
2005         (WebCore::IDBKeyData::hash const):
2006         (WebCore::IDBKeyData::string const):
2007         (WebCore::IDBKeyData::date const):
2008         (WebCore::IDBKeyData::number const):
2009         (WebCore::IDBKeyData::binary const):
2010         (WebCore::IDBKeyData::array const):
2011         (WebCore::IDBKeyData::encode const):
2012         (WebCore::IDBKeyData::decode):
2013         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2014         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey):
2015         * bindings/js/IDBBindingUtilities.cpp:
2016         (WebCore::toJS):
2017
2018 2018-09-14  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2019
2020         [EME] Add support the waitingforkey event
2021         https://bugs.webkit.org/show_bug.cgi?id=189616
2022
2023         Reviewed by Philippe Normand.
2024
2025         Crossplatform support to fire the waitingforkey event from the
2026         player to the element. The element implements the W3C specified
2027         algorithm.
2028
2029         * html/HTMLMediaElement.cpp:
2030         (WebCore::HTMLMediaElement::mediaPlayerWaitingForKey):
2031         (WebCore::HTMLMediaElement::attemptToResumePlaybackIfNecessary):
2032         * html/HTMLMediaElement.h:
2033         * platform/graphics/MediaPlayer.cpp:
2034         (WebCore::MediaPlayer::waitingForKey):
2035         * platform/graphics/MediaPlayer.h:
2036         (WebCore::MediaPlayerClient::mediaPlayerWaitingForKey):
2037
2038 2018-09-14  Mike Gorse  <mgorse@suse.com>
2039
2040         builtins directory causes name conflict on Python 3
2041         https://bugs.webkit.org/show_bug.cgi?id=189552
2042
2043         Reviewed by Michael Catanzaro.
2044
2045         No new tests (No behavior change).
2046
2047         * CMakeLists.txt: builtins -> wkbuiltins.
2048         * DerivedSources.make: builtins -> wkbuiltins.
2049
2050 2018-09-13  Ryosuke Niwa  <rniwa@webkit.org>
2051
2052         Capturing event listeners are called during bubbling phase for shadow hosts
2053         https://bugs.webkit.org/show_bug.cgi?id=174288
2054         <rdar://problem/33530455>
2055
2056         Reviewed by Darin Adler.
2057
2058         Implemented the new behavior proposed in https://github.com/whatwg/dom/pull/686 [1] to fix the problem
2059         that capturing event listeners on a shadow host is invoked during bubbling phase when an event is
2060         dispatched within its shadow tree.
2061
2062         To see why this is a problem, suppose we fire a composed event at span#target in the following DOM tree:
2063           section#hostParent
2064             + div#host -- ShadowRoot
2065                             - p#parent
2066                                 - span#target
2067         Then capturing and bubbling event listeners on #target, #parent, #host, and #hostParent are invoked in
2068         the following order in WebKit & Chrome right now:
2069
2070         1. #hostParent, capturing, eventPhase: CAPTURING_PHASE
2071         2. #parent, capturing, eventPhase: CAPTURING_PHASE
2072         3. #target, capturing, eventPhase: AT_TARGET
2073         4. #target, non-capturing, eventPhase: AT_TARGET
2074         5. #parent, non-capturing, eventPhase: BUBBLING_PHASE
2075         6. #host, capturing, eventPhase: AT_TARGET
2076         7. #host, non-capturing, eventPhase: AT_TARGET
2077         8. #hostParent, non-capturing, eventPhase: BUBBLING_PHASE
2078
2079         This is counter-intuitive because capturing event listeners on #host isn't invoked until bubblign phase
2080         started. A more natural ordering would be:
2081
2082         1. #hostParent, capturing, eventPhase: CAPTURING_PHASE
2083         2. #host, capturing, eventPhase: AT_TARGET
2084         3. #parent, capturing, eventPhase: CAPTURING_PHASE
2085         4. #target, capturing, eventPhase: AT_TARGET
2086         5. #target, non-capturing, eventPhase: AT_TARGET
2087         6. #parent, non-capturing, eventPhase: BUBBLING_PHASE
2088         7. #host, non-capturing, eventPhase: AT_TARGET
2089         8. #hostParent, non-capturing, eventPhase: BUBBLING_PHASE
2090
2091         This also happens to be the order by which Gecko's current shadow DOM implementation invoke event listners.
2092         This patch implements this new behavior using the spec-change proposed in [1]. Note that this patch also
2093         impacts the invocation order of event listeners when there is no shadow tree. Namely, before this patch,
2094         event listeners on the event's target is invoked in the registration order. After this patch, all capturing
2095         event listeners are invoked before bubbling event listeners are invoked.
2096
2097         To implement this behavior, this patch introduces EventTarget::EventInvokePhase indicating whether we're
2098         in the capturing phase or bubbling phase to EventTarget::fireEventListeners. We can't use Event's eventPhase
2099         enum because that's set to Event::Phase::AT_TARGET when we're at a shadow host.
2100
2101         Test: fast/shadow-dom/capturing-and-bubbling-event-listeners-across-shadow-trees.html
2102
2103         * Modules/modern-media-controls/media/media-controller-support.js:
2104         (MediaControllerSupport.prototype.enable): Use capturing event listeners so that we can update the states of
2105         media controls before author scripts recieve the event.
2106         (MediaControllerSupport.prototype.disable): Ditto.
2107         * dom/EventContext.cpp:
2108         (WebCore::EventContext::handleLocalEvents const):
2109         (WebCore::MouseOrFocusEventContext::handleLocalEvents const):
2110         (WebCore::TouchEventContext::handleLocalEvents const):
2111         * dom/EventContext.h:
2112         * dom/EventDispatcher.cpp:
2113         (WebCore::dispatchEventInDOM): Invoke capturing event listners even when target and current target are same.
2114         This happens when the current target is a shadow host and event's target is in its shadow tree. Also merged
2115         the special code path for the event's target with the code in the bubbling phase.
2116         * dom/EventPath.cpp:
2117         (WebCore::WindowEventContext::handleLocalEvents const):
2118         * dom/EventTarget.cpp:
2119         (WebCore::EventTarget::dispatchEvent): Invoke capturing and bubbling event listeners in the order.
2120         (WebCore::EventTarget::fireEventListeners):
2121         (WebCore::EventTarget::innerInvokeEventListeners): Renamed from fireEventListeners to match the spec. Use
2122         EventInvokePhase to filter out event listeners so that we can invoke capturing event listners before bubbling
2123         event listeners even when eventPhase is Event::Phase::AT_TARGET.
2124         * dom/EventTarget.h:
2125         * dom/Node.cpp:
2126         (WebCore::Node::handleLocalEvents):
2127         * dom/Node.h:
2128         * html/HTMLFormElement.cpp:
2129         (WebCore::HTMLFormElement::handleLocalEvents):
2130         * html/HTMLFormElement.h:
2131         * page/DOMWindow.cpp:
2132         (WebCore::DOMWindow::dispatchEvent):
2133
2134 2018-09-13  Megan Gardner  <megan_gardner@apple.com>
2135
2136         Fix color stop blending in conic gradients for stops past 1
2137         https://bugs.webkit.org/show_bug.cgi?id=189532
2138         <rdar://problem/44158221>
2139
2140         Reviewed by Simon Fraser.
2141
2142         Calculation was wrong, fixed it, and wrote a test that failed
2143         without the change, and passes with it.
2144
2145         Test: fast/gradients/conic-repeating-last-stop.html
2146
2147         * css/CSSGradientValue.cpp:
2148         (WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange):
2149
2150 2018-09-13  Chris Dumez  <cdumez@apple.com>
2151
2152         Regression(PSON): setting window.opener to null allows process swapping in cases that are not web-compatible
2153         https://bugs.webkit.org/show_bug.cgi?id=189590
2154         <rdar://problem/44422725>
2155
2156         Reviewed by Geoffrey Garen.
2157
2158         Set a flag on the navigation action to indicate if the page was opened via window.open() without 'noopener'.
2159
2160         Test: http/tests/navigation/window-open-cross-origin-then-navigated-back-same-origin.html
2161
2162         * loader/FrameLoader.cpp:
2163         (WebCore::FrameLoader::loadURL):
2164         * loader/NavigationAction.h:
2165         (WebCore::NavigationAction::openedViaWindowOpenWithOpener const):
2166         (WebCore::NavigationAction::setOpenedViaWindowOpenWithOpener):
2167         * page/DOMWindow.cpp:
2168         (WebCore::DOMWindow::createWindow):
2169         * page/Page.h:
2170         (WebCore::Page::openedViaWindowOpenWithOpener const):
2171         (WebCore::Page::setOpenedViaWindowOpenWithOpener):
2172
2173 2018-09-13  Jer Noble  <jer.noble@apple.com>
2174
2175         Enable USE_MEDIAREMOTE on iOS
2176         https://bugs.webkit.org/show_bug.cgi?id=189096
2177
2178         Reviewed by Eric Carlson.
2179
2180         Migrate to using MediaRemote.framework on iOS from MediaPlayer.framework. This unifies the
2181         Now Playing implementation on iOS and Mac.
2182
2183         * SourcesCocoa.txt:
2184         * WebCore.xcodeproj/project.pbxproj:
2185         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: Removed.
2186         * platform/audio/cocoa/MediaSessionManagerCocoa.h:
2187         * platform/audio/cocoa/MediaSessionManagerCocoa.mm: Renamed from Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm.
2188         (PlatformMediaSessionManager::sharedManager):
2189         (PlatformMediaSessionManager::sharedManagerIfExists):
2190         (MediaSessionManagerCocoa::updateSessionState):
2191         (MediaSessionManagerCocoa::beginInterruption):
2192         (MediaSessionManagerCocoa::scheduleUpdateNowPlayingInfo):
2193         (MediaSessionManagerCocoa::sessionWillBeginPlayback):
2194         (MediaSessionManagerCocoa::sessionDidEndRemoteScrubbing):
2195         (MediaSessionManagerCocoa::removeSession):
2196         (MediaSessionManagerCocoa::sessionWillEndPlayback):
2197         (MediaSessionManagerCocoa::clientCharacteristicsChanged):
2198         (MediaSessionManagerCocoa::sessionCanProduceAudioChanged):
2199         (MediaSessionManagerCocoa::nowPlayingEligibleSession):
2200         (MediaSessionManagerCocoa::updateNowPlayingInfo):
2201         * platform/audio/ios/MediaSessionManagerIOS.h:
2202         (): Deleted.
2203         * platform/audio/ios/MediaSessionManagerIOS.mm:
2204         (WebCore::MediaSessionManageriOS::nowPlayingEligibleSession): Deleted.
2205         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Deleted.
2206         (WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): Deleted.
2207         (WebCore::MediaSessionManageriOS::removeSession): Deleted.
2208         (WebCore::MediaSessionManageriOS::sessionWillEndPlayback): Deleted.
2209         (WebCore::MediaSessionManageriOS::clientCharacteristicsChanged): Deleted.
2210         * platform/audio/mac/MediaSessionManagerMac.h: Removed.
2211
2212 2018-09-13  Fujii Hironori  <Hironori.Fujii@sony.com>
2213
2214         Remove the workaround for friend class LazyNeverDestroyed<X> statements for MSVC
2215         https://bugs.webkit.org/show_bug.cgi?id=189576
2216
2217         Reviewed by Alex Christensen.
2218
2219         Old MSVC can't compile "friend class LazyNeverDestroyed<X>"
2220         statements, but "friend LazyNeverDestroyed<X>".
2221
2222         No new tests (No behavior change).
2223
2224         * css/CSSInheritedValue.h: Removed the code for COMPILER(MSVC).
2225         Removed 'class' keyword in "friend class LazyNeverDestroyed<X>"
2226         statement.
2227         * css/CSSInitialValue.h: Ditto.
2228         * css/CSSPrimitiveValue.h: Ditto.
2229         * css/CSSRevertValue.h: Ditto.
2230         * css/CSSUnsetValue.h: Ditto.
2231
2232 2018-09-13  Ms2ger  <Ms2ger@igalia.com>
2233
2234         [GLib] Fix format string in KeyedEncoderGlib::beginObject().
2235         https://bugs.webkit.org/show_bug.cgi?id=189585
2236
2237         Reviewed by Michael Catanzaro.
2238
2239         This appears to fix the following assertion locally:
2240
2241         GLib-CRITICAL **: g_variant_builder_add_value: assertion '!GVSB(builder)->expected_type || g_variant_is_of_type (value, GVSB(builder)->expected_type)' failed
2242
2243         Covered by existing tests.
2244
2245         * platform/glib/KeyedEncoderGlib.cpp:
2246         (WebCore::KeyedEncoderGlib::beginObject):
2247
2248 2018-09-13  Ryan Haddad  <ryanhaddad@apple.com>
2249
2250         Unreviewed, rolling out r235953.
2251
2252         Caused layout test crashes under GuardMalloc.
2253
2254         Reverted changeset:
2255
2256         "Make GraphicsLayers ref-counted, so their tree can persist
2257         when disconnected from RenderLayerBackings"
2258         https://bugs.webkit.org/show_bug.cgi?id=189521
2259         https://trac.webkit.org/changeset/235953
2260
2261 2018-09-13  Fujii Hironori  <Hironori.Fujii@sony.com>
2262
2263         Remove a MSVC workaround in XPath::Step::NodeTest
2264         https://bugs.webkit.org/show_bug.cgi?id=189578
2265
2266         Reviewed by Alex Christensen.
2267
2268         XPath::Step::NodeTest has a special code for MSVC bug workaround.
2269         It has been introduced in 5 years ago in Bug 121082 Comment 19.
2270
2271         I think it is safe just to remove the workaround.
2272
2273         No new tests (No behavior change).
2274
2275         * xml/XPathStep.h: Removed the MSVC workaround.
2276
2277 2018-09-13  Fujii Hironori  <Hironori.Fujii@sony.com>
2278
2279         Remove a MSVC workaround in InspectorStyle::styleWithProperties
2280         https://bugs.webkit.org/show_bug.cgi?id=189577
2281
2282         Reviewed by Alex Christensen.
2283
2284         No new tests (No behavior change).
2285
2286         * inspector/InspectorStyleSheet.cpp:
2287         (WebCore::InspectorStyle::styleWithProperties const): Use 'auto' for the type of 'status'.
2288
2289 2018-09-13  Alex Christensen  <achristensen@webkit.org>
2290
2291         Use a Variant instead of a union in CSSSelector
2292         https://bugs.webkit.org/show_bug.cgi?id=188559
2293
2294         Reviewed by Antti Koivisto.
2295
2296         No change in behavior. This just makes some of the existing problems more obvious and easy to fix.
2297
2298         I moved m_caseInsensitiveAttributeValueMatching to RareData because it's only used with RareData.
2299         I only have m_isForPage when assertions are enabled because it's only used for an assertion.
2300         The rest is pretty straightforward translating union syntax to Variant syntax.
2301         I use RefPtr for now where I could use Ref because it's never null to make copying easier, but that's temporary.
2302
2303         * css/CSSSelector.cpp:
2304         (WebCore::CSSSelector::CSSSelector):
2305         (WebCore::CSSSelector::createRareData):
2306         (WebCore::CSSSelector::setAttribute):
2307         (WebCore::CSSSelector::setArgument):
2308         (WebCore::CSSSelector::setLangArgumentList):
2309         (WebCore::CSSSelector::setSelectorList):
2310         (WebCore::CSSSelector::setNth):
2311         (WebCore::CSSSelector::matchNth const):
2312         (WebCore::CSSSelector::nthA const):
2313         (WebCore::CSSSelector::nthB const):
2314         (WebCore::CSSSelector::RareData::RareData):
2315         * css/CSSSelector.h:
2316         (WebCore::CSSSelector::argument const):
2317         (WebCore::CSSSelector::langArgumentList const):
2318         (WebCore::CSSSelector::selectorList const):
2319         (WebCore::CSSSelector::attribute const):
2320         (WebCore::CSSSelector::attributeCanonicalLocalName const):
2321         (WebCore::CSSSelector::setValue):
2322         (WebCore::CSSSelector::CSSSelector):
2323         (WebCore::CSSSelector::~CSSSelector):
2324         (WebCore::CSSSelector::tagQName const):
2325         (WebCore::CSSSelector::tagLowercaseLocalName const):
2326         (WebCore::CSSSelector::value const):
2327         (WebCore::CSSSelector::serializingValue const):
2328         (WebCore::CSSSelector::attributeValueMatchingIsCaseInsensitive const):
2329         (WebCore::CSSSelector::RareData::create): Deleted.
2330         * css/parser/CSSParserImpl.cpp:
2331         (WebCore::CSSParserImpl::parsePageSelector):
2332         * css/parser/CSSParserSelector.h:
2333
2334 2018-09-13  Fujii Hironori  <Hironori.Fujii@sony.com>
2335
2336         [Win][Clang] error: type 'float' cannot be narrowed to 'LONG' (aka 'long') in initializer list in WheelEventWin.cpp
2337         https://bugs.webkit.org/show_bug.cgi?id=189575
2338
2339         Reviewed by Alex Christensen.
2340
2341         No new tests (No behavior change).
2342
2343         * platform/win/WheelEventWin.cpp:
2344         (WebCore::PlatformWheelEvent::PlatformWheelEvent): Use flooredIntPoint to convert FloatPoint to POINT.
2345
2346 2018-09-13  Youenn Fablet  <youenn@apple.com>
2347
2348         Introduce RTCRtpSendParameters
2349         https://bugs.webkit.org/show_bug.cgi?id=189563
2350
2351         Reviewed by Eric Carlson.
2352
2353         Introduce RTCRtpSendParameters to match the WebRTC specification.
2354         Split RTCRtpPrameters fields accordingly and update call sites.
2355
2356         Covered by updated test.
2357
2358         * CMakeLists.txt:
2359         * DerivedSources.make:
2360         * Modules/mediastream/PeerConnectionBackend.h:
2361         * Modules/mediastream/RTCRtpCodingParameters.h: Added
2362         * Modules/mediastream/RTCRtpCodingParameters.idl: Added
2363         * Modules/mediastream/RTCRtpDecodingParameters.h: Added
2364         * Modules/mediastream/RTCRtpDecodingParameters.idl: Added
2365         * Modules/mediastream/RTCRtpEncodingParameters.h:
2366         * Modules/mediastream/RTCRtpEncodingParameters.idl:
2367         * Modules/mediastream/RTCRtpParameters.h:
2368         * Modules/mediastream/RTCRtpParameters.idl:
2369         * Modules/mediastream/RTCRtpReceiver.cpp:
2370         * Modules/mediastream/RTCRtpSendParameters.h: Added.
2371         (WebCore::RTCRtpSendParameters::RTCRtpSendParameters):
2372         * Modules/mediastream/RTCRtpSendParameters.idl: Added.
2373         * Modules/mediastream/RTCRtpSender.cpp:
2374         (WebCore::RTCRtpSender::getParameters):
2375         (WebCore::RTCRtpSender::setParameters):
2376         * Modules/mediastream/RTCRtpSender.h:
2377         * Modules/mediastream/RTCRtpSender.idl:
2378         * Modules/mediastream/RTCRtpSenderBackend.h:
2379         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
2380         (WebCore::LibWebRTCRtpSenderBackend::getParameters const):
2381         (WebCore::LibWebRTCRtpSenderBackend::setParameters):
2382         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
2383         * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
2384         (WebCore::toRTCRtpParameters):
2385         (WebCore::toRTCRtpSendParameters):
2386         (WebCore::fromRTCRtpSendParameters):
2387         * Modules/mediastream/libwebrtc/LibWebRTCUtils.h:
2388         * Sources.txt:
2389         * WebCore.xcodeproj/project.pbxproj:
2390
2391 2018-09-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2392
2393         [GStreamer][EME] decrypt-key-needed message renamed to drm-cdm-instance-needed
2394         https://bugs.webkit.org/show_bug.cgi?id=189547
2395
2396         Reviewed by Philippe Normand.
2397
2398         decrypt-key-needed message renamed to drm-cdm-instance-needed.
2399
2400         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2401         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Apart from
2402         renaming the message, removed the class prefix for
2403         dispatchCDMInstance.
2404         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
2405         (webkitMediaCommonEncryptionDecryptTransformInPlace):
2406
2407 2018-09-11  Ryosuke Niwa  <rniwa@webkit.org>
2408
2409         imported/w3c/web-platform-tests/shadow-dom/form-control-form-attribute.html hits assertion
2410         https://bugs.webkit.org/show_bug.cgi?id=189493
2411
2412         Reviewed by Alex Christensen.
2413
2414         The debug assertion was caused by RefPtr in FormAssociatedElement::formOwnerRemovedFromTree introduced
2415         by r224390 and r223644 ref'ing ShadowRoot while calling removeDetachedChildren inside ~ShadowRoot.
2416         When a form (or any other) element has more than one ref inside removeDetachedChildren,
2417         addChildNodesToDeletionQueue calls notifyChildNodeRemoved in the tree oreder.
2418
2419         However, when a form associated element of this form element appears later in the tree order,
2420         FormAssociatedElement::formOwnerRemovedFromTree can traverse up ancestors including the ShadowRoot.
2421
2422         Fixed the bug by using raw pointers instead. Luckily, there is no DOM mutations or other non-trivial
2423         operations happening in this function so this should be safe.
2424
2425         Test: imported/w3c/web-platform-tests/shadow-dom/form-control-form-attribute.html
2426
2427         * html/FormAssociatedElement.cpp:
2428         (WebCore::FormAssociatedElement::formOwnerRemovedFromTree): Fixed the bug.
2429
2430 2018-09-12  Dan Bernstein  <mitz@apple.com>
2431
2432         [Cocoa] Complete support for Paste as Quotation
2433         https://bugs.webkit.org/show_bug.cgi?id=189504
2434
2435         Reviewed by Wenson Hsieh.
2436
2437         Tests: editing/pasteboard/4930986-1-paste-as-quotation.html
2438                editing/pasteboard/4930986-2-paste-as-quotation.html
2439                editing/pasteboard/4930986-3-paste-as-quotation.html
2440
2441         * editing/Editor.cpp:
2442           Added ClipboardEventKind::PasteAsQuotation.
2443         (WebCore::eventNameForClipboardEvent): Map PasteAsQuotation to the "paste" DOM event name.
2444         (WebCore::createDataTransferForClipboardEvent): Place the unquoted content in the event.
2445           This means that currently event handlers can’t emulate pasting as quotation, because they
2446           neither have the quoted content nor knowledge that quoting has been requested. We could
2447           change this in the future if needed.
2448         (WebCore::Editor::paste): Updated for change in pasteWithPasteboard’s argument type.
2449         (WebCore::Editor::pasteAsQuotation): Added. Similar to paste, but passes
2450           PasteOption::AsQuotation to pasteWithPasteboard.
2451         (WebCore::Editor::quoteFragmentForPasting): Added. Quoting for pasting consists of enclosing
2452           the fragment in a blockquote element with the "type" attribute set to "cite" and the
2453           "class" attribute set to a well-known value, which is used to trigger special behavior in
2454           ReplaceSelectionCommand. The behavior includes removing the "class" attribute in the end,
2455           so eventually, we could stop using this form of in-band signaling.
2456         * editing/Editor.h: Declared PasteOption enum class to encompass the existing allowPlainText
2457           and MailBlockquoteHandling arguments to pasteWithPasteboard as well as the new AsQuotation
2458           behavior.
2459
2460         * editing/EditorCommand.cpp:
2461         (WebCore::executePasteAsQuotation): Added. Similar to executing Paste.
2462         (WebCore::createCommandMap): Added an entry for PasteAsQuotation, based on the Paste entry.
2463
2464         * editing/cocoa/EditorCocoa.mm:
2465         (WebCore::Editor::webContentFromPasteboard): Moved from EditorIOS.mm and EditorMac.mm to
2466           here.
2467
2468         * editing/gtk/EditorGtk.cpp:
2469         (WebCore::Editor::pasteWithPasteboard): Updated for new OptionSet argument, added a call to
2470           quote the fragment if needed.
2471
2472         * editing/ios/EditorIOS.mm:
2473         (WebCore::Editor::pasteWithPasteboard): Ditto.
2474         (WebCore::Editor::webContentFromPasteboard): Moved to EditorCocoa.mm.
2475
2476         * editing/mac/EditorMac.mm:
2477         (WebCore::Editor::pasteWithPasteboard): Updated for new OptionSet argument, added a call to
2478           quote the fragment if needed.
2479         (WebCore::Editor::readSelectionFromPasteboard): Updated for new OptionSet argument to
2480           pasteWithPasteboard.
2481         (WebCore::Editor::webContentFromPasteboard): Moved to EditorCocoa.mm.
2482
2483         * editing/win/EditorWin.cpp:
2484         (WebCore::Editor::pasteWithPasteboard): Updated for new OptionSet argument, added a call to
2485           quote the fragment if needed.
2486
2487         * editing/wpe/EditorWPE.cpp:
2488         (WebCore::Editor::pasteWithPasteboard): Ditto.
2489
2490 2018-09-11  Simon Fraser  <simon.fraser@apple.com>
2491
2492         Make GraphicsLayers ref-counted, so their tree can persist when disconnected from RenderLayerBackings
2493         https://bugs.webkit.org/show_bug.cgi?id=189521
2494
2495         Reviewed by Tim Horton.
2496         
2497         Make GraphicsLayer be RefCounted<GraphicsLayer>. GraphicsLayers own their children, via a Vector<Ref<GraphicsLayer>>.
2498         
2499         RenderLayerBacking and other holders of GraphicsLayers use RefPtr<GraphicsLayer>.
2500         
2501         All the other changes are just to adapt to the new ownership patterns.
2502         
2503         I verified that no GraphicsLayers were leaked or abandoned after this change.
2504
2505         No behavior change.
2506
2507         * page/PageOverlayController.cpp:
2508         (WebCore::PageOverlayController::layerWithDocumentOverlays):
2509         (WebCore::PageOverlayController::layerWithViewOverlays):
2510         (WebCore::PageOverlayController::installPageOverlay):
2511         (WebCore::PageOverlayController::uninstallPageOverlay):
2512         (WebCore::PageOverlayController::setPageOverlayNeedsDisplay):
2513         (WebCore::PageOverlayController::didChangeViewSize):
2514         (WebCore::PageOverlayController::didChangeDocumentSize):
2515         (WebCore::PageOverlayController::didChangeSettings):
2516         (WebCore::PageOverlayController::paintContents):
2517         (WebCore::PageOverlayController::didChangeOverlayFrame):
2518         (WebCore::PageOverlayController::didChangeOverlayBackgroundColor):
2519         * page/PageOverlayController.h:
2520         * page/mac/ServicesOverlayController.h:
2521         (WebCore::ServicesOverlayController::Highlight::layer const):
2522         * page/mac/ServicesOverlayController.mm:
2523         (WebCore::ServicesOverlayController::Highlight::Highlight):
2524         (WebCore::ServicesOverlayController::Highlight::invalidate):
2525         (WebCore::ServicesOverlayController::Highlight::fadeIn):
2526         (WebCore::ServicesOverlayController::Highlight::fadeOut):
2527         (WebCore::ServicesOverlayController::Highlight::didFinishFadeOutAnimation):
2528         (WebCore::ServicesOverlayController::determineActiveHighlight):
2529         * platform/graphics/GraphicsLayer.cpp:
2530         (WebCore::GraphicsLayer::GraphicsLayer):
2531         (WebCore::GraphicsLayer::willBeDestroyed):
2532         (WebCore::GraphicsLayer::setChildren):
2533         (WebCore::GraphicsLayer::addChild):
2534         (WebCore::GraphicsLayer::addChildAtIndex):
2535         (WebCore::GraphicsLayer::addChildBelow):
2536         (WebCore::GraphicsLayer::addChildAbove):
2537         (WebCore::GraphicsLayer::replaceChild):
2538         (WebCore::GraphicsLayer::removeAllChildren):
2539         (WebCore::GraphicsLayer::removeFromParent):
2540         (WebCore::GraphicsLayer::setMaskLayer):
2541         (WebCore::GraphicsLayer::noteDeviceOrPageScaleFactorChangedIncludingDescendants):
2542         (WebCore::GraphicsLayer::distributeOpacity):
2543         (WebCore::GraphicsLayer::traverse):
2544         (WebCore::dumpChildren):
2545         * platform/graphics/GraphicsLayer.h:
2546         (WebCore::GraphicsLayer::children const):
2547         (WebCore::GraphicsLayer::children):
2548         (WebCore::GraphicsLayer::maskLayer const):
2549         (WebCore::GraphicsLayer::replicaLayer const):
2550         (WebCore::GraphicsLayer::beingDestroyed const):
2551         (WebCore::GraphicsLayer:: const): Deleted.
2552         * platform/graphics/GraphicsLayerFactory.h:
2553         * platform/graphics/ca/GraphicsLayerCA.cpp:
2554         (WebCore::GraphicsLayer::create):
2555         (WebCore::GraphicsLayerCA::setChildren):
2556         (WebCore::GraphicsLayerCA::addChild):
2557         (WebCore::GraphicsLayerCA::addChildAtIndex):
2558         (WebCore::GraphicsLayerCA::addChildBelow):
2559         (WebCore::GraphicsLayerCA::addChildAbove):
2560         (WebCore::GraphicsLayerCA::replaceChild):
2561         (WebCore::GraphicsLayerCA::setMaskLayer):
2562         (WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush const):
2563         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
2564         (WebCore::GraphicsLayerCA::updateSublayerList):
2565         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
2566         * platform/graphics/ca/GraphicsLayerCA.h:
2567         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
2568         (WebCore::GraphicsLayer::create):
2569         (WebCore::GraphicsLayerTextureMapper::setChildren):
2570         (WebCore::GraphicsLayerTextureMapper::addChild):
2571         (WebCore::GraphicsLayerTextureMapper::addChildAtIndex):
2572         (WebCore::GraphicsLayerTextureMapper::addChildAbove):
2573         (WebCore::GraphicsLayerTextureMapper::addChildBelow):
2574         (WebCore::GraphicsLayerTextureMapper::replaceChild):
2575         (WebCore::GraphicsLayerTextureMapper::setMaskLayer):
2576         (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIncludingSubLayers):
2577         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
2578         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2579         (WebCore::GraphicsLayer::create):
2580         (WebCore::CoordinatedGraphicsLayer::setShouldUpdateVisibleRect):
2581         (WebCore::CoordinatedGraphicsLayer::addChild):
2582         (WebCore::CoordinatedGraphicsLayer::addChildAtIndex):
2583         (WebCore::CoordinatedGraphicsLayer::addChildAbove):
2584         (WebCore::CoordinatedGraphicsLayer::addChildBelow):
2585         (WebCore::CoordinatedGraphicsLayer::replaceChild):
2586         (WebCore::CoordinatedGraphicsLayer::setMaskLayer):
2587         (WebCore::CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers):
2588         (WebCore::CoordinatedGraphicsLayer::updateContentBuffersIncludingSubLayers):
2589         (WebCore::CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded):
2590         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2591         * platform/graphics/win/GraphicsLayerDirect2D.cpp:
2592         (WebCore::GraphicsLayer::create):
2593         (WebCore::GraphicsLayerDirect2D::GraphicsLayerDirect2D): Deleted.
2594         (WebCore::GraphicsLayerDirect2D::initialize): Deleted.
2595         (WebCore::GraphicsLayerDirect2D::~GraphicsLayerDirect2D): Deleted.
2596         (WebCore::GraphicsLayerDirect2D::setNeedsDisplay): Deleted.
2597         (WebCore::GraphicsLayerDirect2D::setNeedsDisplayInRect): Deleted.
2598         * rendering/RenderLayerBacking.cpp:
2599         (WebCore::RenderLayerBacking::createGraphicsLayer):
2600         (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
2601         (WebCore::RenderLayerBacking::updateConfiguration):
2602         (WebCore::RenderLayerBacking::updateInternalHierarchy):
2603         (WebCore::RenderLayerBacking::updateMaskingLayer):
2604         (WebCore::RenderLayerBacking::updateChildClippingStrategy):
2605         (WebCore::RenderLayerBacking::updateScrollingLayers):
2606         * rendering/RenderLayerBacking.h:
2607         * rendering/RenderLayerCompositor.cpp:
2608         (WebCore::RenderLayerCompositor::updateCompositingLayers):
2609         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
2610         (WebCore::RenderLayerCompositor::setCompositingParent):
2611         (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
2612         (WebCore::RenderLayerCompositor::parentFrameContentLayers):
2613         (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea):
2614         (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea):
2615         (WebCore::RenderLayerCompositor::updateLayerForHeader):
2616         (WebCore::RenderLayerCompositor::updateLayerForFooter):
2617         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
2618         (WebCore::RenderLayerCompositor::ensureRootLayer):
2619         (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged):
2620         * rendering/RenderLayerCompositor.h:
2621
2622 2018-09-12  Alex Christensen  <achristensen@webkit.org>
2623
2624         Expose fewer of URL's internal members
2625         https://bugs.webkit.org/show_bug.cgi?id=189528
2626
2627         Reviewed by Chris Dumez.
2628
2629         * loader/appcache/ApplicationCacheStorage.cpp:
2630         (WebCore::urlHostHash):
2631         * platform/URL.cpp:
2632         (WebCore::URL::hostStart const):
2633         (WebCore::protocolHostAndPortAreEqual):
2634         (WebCore::hostsAreEqual):
2635         * platform/URL.h:
2636         (WebCore::URL::hostStart const): Deleted.
2637         (WebCore::URL::hostEnd const): Deleted.
2638
2639 2018-09-12  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2640
2641         [Curl] Implement correct total received bytes.
2642         https://bugs.webkit.org/show_bug.cgi?id=189555
2643
2644         Reviewed by Alex Christensen.
2645
2646         Curl port only reported total network received bytes before decoding.
2647
2648         No new test. InspectorTest is only available for WebKitTestRunner.
2649
2650         * platform/network/curl/CurlRequest.cpp:
2651         (WebCore::CurlRequest::didReceiveData):
2652         (WebCore::CurlRequest::updateNetworkLoadMetrics):
2653         * platform/network/curl/CurlRequest.h:
2654
2655 2018-09-12  Youenn Fablet  <youenn@apple.com>
2656
2657         Split RTCRtpParameters idl and header file
2658         https://bugs.webkit.org/show_bug.cgi?id=189524
2659
2660         Reviewed by Eric Carlson.
2661
2662         This will be easier to manage and will allow to more easily introduce sender/receiver parameters.
2663         No change of behavior.
2664
2665         * CMakeLists.txt:
2666         * DerivedSources.make:
2667         * Modules/mediastream/RTCDegradationPreference.h: Copied from Source/WebCore/Modules/mediastream/RTCRtpParameters.h.
2668         * Modules/mediastream/RTCDegradationPreference.idl: Added.
2669         * Modules/mediastream/RTCDtxStatus.h: Copied from Source/WebCore/Modules/mediastream/RTCRtpParameters.h.
2670         * Modules/mediastream/RTCDtxStatus.idl: Added.
2671         * Modules/mediastream/RTCPriorityType.h: Copied from Source/WebCore/Modules/mediastream/RTCRtpParameters.h.
2672         * Modules/mediastream/RTCPriorityType.idl: Added.
2673         * Modules/mediastream/RTCRtpCodecParameters.h: Copied from Source/WebCore/Modules/mediastream/RTCRtpParameters.h.
2674         * Modules/mediastream/RTCRtpCodecParameters.idl: Added.
2675         * Modules/mediastream/RTCRtpEncodingParameters.h: Copied from Source/WebCore/Modules/mediastream/RTCRtpParameters.h.
2676         * Modules/mediastream/RTCRtpEncodingParameters.idl: Added.
2677         * Modules/mediastream/RTCRtpFecParameters.h: Copied from Source/WebCore/Modules/mediastream/RTCRtpParameters.h.
2678         * Modules/mediastream/RTCRtpFecParameters.idl: Added.
2679         * Modules/mediastream/RTCRtpHeaderExtensionParameters.h: Copied from Source/WebCore/Modules/mediastream/RTCRtpParameters.h.
2680         * Modules/mediastream/RTCRtpHeaderExtensionParameters.idl: Added.
2681         * Modules/mediastream/RTCRtpParameters.h:
2682         * Modules/mediastream/RTCRtpParameters.idl:
2683         * Modules/mediastream/RTCRtpRtxParameters.h: Copied from Source/WebCore/Modules/mediastream/RTCRtpParameters.h.
2684         * Modules/mediastream/RTCRtpRtxParameters.idl: Added.
2685         * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
2686         (WebCore::toRTCEncodingParameters):
2687         (WebCore::fromRTCEncodingParameters):
2688         (WebCore::toRTCHeaderExtensionParameters):
2689         (WebCore::fromRTCHeaderExtensionParameters):
2690         (WebCore::toRTCCodecParameters):
2691         (WebCore::toRTCRtpParameters):
2692         (WebCore::fromRTCRtpParameters):
2693         * Sources.txt:
2694         * WebCore.xcodeproj/project.pbxproj:
2695
2696 2018-09-12  Ali Juma  <ajuma@chromium.org>
2697
2698         [IntersectionObserver] Implement rootMargin expansion
2699         https://bugs.webkit.org/show_bug.cgi?id=189525
2700
2701         Reviewed by Simon Fraser.
2702
2703         Expand the root intersection rectangle by the observer's rootMargin when computing
2704         intersections.
2705
2706         Test: imported/w3c/web-platform-tests/intersection-observer/root-margin.html
2707
2708         * dom/Document.cpp:
2709         (WebCore::expandRootBoundsWithRootMargin):
2710         (WebCore::computeIntersectionRects):
2711         * page/IntersectionObserver.h:
2712         (WebCore::IntersectionObserver::rootMarginBox const):
2713         * platform/graphics/FloatRect.h:
2714         (WebCore::FloatRect::expand):
2715
2716 2018-09-12  Fujii Hironori  <Hironori.Fujii@sony.com>
2717
2718         [Win][Clang] error: non-constant-expression cannot be narrowed from type 'int' to 'SHORT'
2719         https://bugs.webkit.org/show_bug.cgi?id=189542
2720
2721         Reviewed by Alex Christensen.
2722
2723         No new tests (No behavior change).
2724
2725         * platform/graphics/win/IntPointWin.cpp:
2726         (WebCore::IntPoint::operator POINTS const): Narrowed m_x and m_y by using static_cast.
2727
2728 2018-09-12  Guillaume Emont  <guijemont@igalia.com>
2729
2730         Add IGNORE_WARNING_.* macros
2731         https://bugs.webkit.org/show_bug.cgi?id=188996
2732
2733         Reviewed by Michael Catanzaro.
2734
2735         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
2736         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2737         * accessibility/mac/AXObjectCacheMac.mm:
2738         (WebCore::AXObjectCache::postPlatformNotification):
2739         * accessibility/mac/AccessibilityObjectMac.mm:
2740         (WebCore::AccessibilityObject::overrideAttachmentParent):
2741         (WebCore::AccessibilityObject::accessibilityIgnoreAttachment const):
2742         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2743         (-[WebAccessibilityObjectWrapper renderWidgetChildren]):
2744         (-[WebAccessibilityObjectWrapper convertPointToScreenSpace:]):
2745         (-[WebAccessibilityObjectWrapper role]):
2746         (-[WebAccessibilityObjectWrapper roleDescription]):
2747         * bridge/objc/WebScriptObject.mm:
2748         * bridge/objc/objc_class.mm:
2749         (JSC::Bindings::ObjcClass::fieldNamed const):
2750         * crypto/CommonCryptoUtilities.cpp:
2751         (WebCore::getCommonCryptoDigestAlgorithm):
2752         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
2753         (WebCore::encryptAES_GCM):
2754         (WebCore::decyptAES_GCM):
2755         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
2756         (WebCore::wrapSerializedCryptoKey):
2757         (WebCore::unwrapSerializedCryptoKey):
2758         * css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
2759         * css/makeSelectorPseudoElementsMap.py:
2760         * editing/TextIterator.cpp:
2761         * editing/mac/EditorMac.mm:
2762         (WebCore::Editor::pasteWithPasteboard):
2763         (WebCore::Editor::takeFindStringFromSelection):
2764         (WebCore::Editor::replaceNodeFromPasteboard):
2765         * page/mac/EventHandlerMac.mm:
2766         (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
2767         * page/mac/ServicesOverlayController.mm:
2768         (WebCore::ServicesOverlayController::Highlight::paintContents):
2769         * platform/LocalizedStrings.cpp:
2770         (WebCore::formatLocalizedString):
2771         * platform/ScreenProperties.h:
2772         (WebCore::ScreenData::decode):
2773         * platform/gamepad/mac/HIDGamepadProvider.cpp:
2774         (WebCore::HIDGamepadProvider::stopMonitoringInput):
2775         * platform/graphics/PlatformDisplay.cpp:
2776         (WebCore::PlatformDisplay::sharedDisplay):
2777         * platform/graphics/SurrogatePairAwareTextIterator.cpp:
2778         * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm:
2779         (WebCore::MediaSelectionGroupAVFObjC::updateOptions):
2780         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
2781         (WebCore::CDMSessionAVStreamSession::update):
2782         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
2783         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2784         (WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTextTrack):
2785         (WebCore::MediaPlayerPrivateAVFoundationObjC::languageOfPrimaryAudioTrack const):
2786         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
2787         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2788         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2789         (WebCore::IGNORE_CLANG_WARNING_END):
2790         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2791         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2792         (-[WebAVSampleBufferErrorListener beginObservingRenderer:]):
2793         (-[WebAVSampleBufferErrorListener stopObservingRenderer:]):
2794         (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]):
2795         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
2796         (WebCore::IGNORE_CLANG_WARNING_END):
2797         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2798         (PlatformCALayer::drawLayerContents):
2799         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
2800         (WebCore::FontCascade::fontForCombiningCharacterSequence const):
2801         * platform/graphics/cg/ImageDecoderCG.cpp:
2802         (WebCore::ImageDecoderCG::createFrameImageAtIndex):
2803         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
2804         (WebCore::GraphicsContext::drawLineForDocumentMarker):
2805         * platform/graphics/cocoa/WebGLLayer.h:
2806         (IGNORE_CLANG_WARNING):
2807         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
2808         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
2809         * platform/graphics/mac/IconMac.mm:
2810         (WebCore::Icon::Icon):
2811         * platform/graphics/mac/PDFDocumentImageMac.mm:
2812         (WebCore::PDFDocumentImage::drawPDFPage):
2813         * platform/graphics/mac/WebKitNSImageExtras.mm:
2814         (-[NSImage _web_lockFocusWithDeviceScaleFactor:]):
2815         * platform/ios/DragImageIOS.mm:
2816         * platform/mac/DragImageMac.mm:
2817         (WebCore::scaleDragImage):
2818         (WebCore::createDragImageForLink):
2819         * platform/mac/LegacyNSPasteboardTypes.h:
2820         * platform/mac/LocalCurrentGraphicsContext.mm:
2821         (WebCore::LocalCurrentGraphicsContext::LocalCurrentGraphicsContext):
2822         * platform/mac/PasteboardMac.mm:
2823         (WebCore::Pasteboard::createForCopyAndPaste):
2824         (WebCore::Pasteboard::createForDragAndDrop):
2825         (WebCore::setDragImageImpl):
2826         * platform/mac/PlatformEventFactoryMac.mm:
2827         (WebCore::globalPoint):
2828         * platform/mac/SSLKeyGeneratorMac.mm:
2829         * platform/mac/ScrollViewMac.mm:
2830         (WebCore::ScrollView::platformContentsToScreen const):
2831         (WebCore::ScrollView::platformScreenToContents const):
2832         * platform/mac/ThemeMac.mm:
2833         (WebCore::drawCellFocusRingWithFrameAtTime):
2834         * platform/mac/WebPlaybackControlsManager.mm:
2835         * platform/mac/WidgetMac.mm:
2836         (WebCore::Widget::paint):
2837         * platform/mediastream/RealtimeIncomingAudioSource.h:
2838         * platform/mediastream/RealtimeIncomingVideoSource.h:
2839         * platform/mediastream/RealtimeOutgoingAudioSource.h:
2840         * platform/mediastream/RealtimeOutgoingVideoSource.h:
2841         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
2842         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
2843         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
2844         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
2845         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
2846         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2847         * platform/network/cf/ResourceHandleCFNet.cpp:
2848         (WebCore::ResourceHandle::createCFURLConnection):
2849         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
2850         (WebCore::SocketStreamHandleImpl::reportErrorToClient):
2851         * platform/network/create-http-header-name-table:
2852         * platform/text/TextEncoding.cpp:
2853         * testing/MockLibWebRTCPeerConnection.h:
2854         * xml/XPathGrammar.cpp:
2855
2856 2018-09-12  Pablo Saavedra  <psaavedra@igalia.com>
2857
2858         Linking against libWPEWebKit-0.1.so is not posible when WPE is build with ENABLE_VIDEO=OFF and ENABLE_WEB_AUDIO=OFF
2859         https://bugs.webkit.org/show_bug.cgi?id=189540
2860
2861         Reviewed by Philippe Normand.
2862
2863         Related issues:
2864
2865         This issue is related with changes in https://bugs.webkit.org/show_bug.cgi?id=183080
2866         This issue is introduced in https://bugs.webkit.org/show_bug.cgi?id=186547
2867
2868         No new tests, no changes in the functionality.
2869
2870         * platform/GStreamer.cmake:
2871         * platform/SourcesGLib.txt:
2872         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp:
2873         (WebCore::LibWebRTCProvider::webRTCAvailable):
2874
2875 2018-09-11  Zan Dobersek  <zdobersek@igalia.com>
2876
2877         Unreviewed WPE build fix.
2878
2879         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
2880         Add extra header inclusions to get this code building after the unified
2881         sources system shifted it into a different translation unit.
2882
2883 2018-09-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2884
2885         [Curl] WebInspector doesn't display request headers added during processing.
2886         https://bugs.webkit.org/show_bug.cgi?id=189531
2887
2888         Reviewed by Alex Christensen.
2889
2890         While processing the request, Curl port network layer adds some headers to the request
2891         such as cookies. Those headers should be displayed in the WebInspector.
2892
2893         Tested on MiniBrowser.
2894
2895         * platform/network/curl/CurlRequest.cpp:
2896         (WebCore::CurlRequest::didReceiveHeader):
2897         (WebCore::CurlRequest::didCompleteTransfer):
2898         (WebCore::CurlRequest::updateNetworkLoadMetrics):
2899         * platform/network/curl/CurlRequest.h:
2900
2901 2018-09-11  James Savage  <james.savage@apple.com>
2902
2903         Follow up to:
2904         Expose -apple-system-container-border color to internal web views.
2905         https://bugs.webkit.org/show_bug.cgi?id=189178.
2906
2907         Reviewed by Timothy Hatcher.
2908
2909         * rendering/RenderThemeMac.mm:
2910         (WebCore::RenderThemeMac::systemColor const): Add a separate #if block for
2911         Mojave. When I used CSSValueAppleSystemFindHighlightBackground as a template
2912         for this change, I had to write out the condition in the first change, but
2913         mistakenly thought I could reuse the block here. Turns out the versions were
2914         different, and I could not.
2915
2916 2018-09-11  Youenn Fablet  <youenn@apple.com>
2917
2918         Remove MediaDevices NoInterfaceObject
2919         https://bugs.webkit.org/show_bug.cgi?id=189512
2920
2921         Reviewed by Alex Christensen.
2922
2923         Covered by rebased WPT tests.
2924
2925         * Modules/mediastream/MediaDevices.idl:
2926
2927 2018-09-11  Jer Noble  <jer.noble@apple.com>
2928
2929         [MediaCapabilities] Implement MediaEngineConfigurationFactory registration
2930         https://bugs.webkit.org/show_bug.cgi?id=189438
2931
2932         Reviewed by Eric Carlson.
2933
2934         Implement a mechanism to register platform-specific MediaEngineConfigurationFactory methods, and a mechanism to iterate
2935         over those registered factories when createDecodingConfiguration() and createEncodingConfiguration() are called.
2936
2937         The Factory has been radically simplified; the concept of MediaEngineDecodingConfiguration
2938         and MediaEngineEncodingConfiguration and its subclasess have been removed. Since the primary
2939         objects representing video and audio configurations are IDLDictionaries, the native objects
2940         are just structs full of POD types (and Strings). Since these have no dependencies on
2941         higher-level HTML concepts, they can be moved into platform/ and accessed from there. This
2942         patch also converts MediaCapabilitiesInfo to an Interface, so its implementation also can
2943         become a struct and live in platform/. The MediaEngineDecodingConfigurationMock and
2944         MediaEngineEncodingConfigurationMock have been consolidated in a single class which simply
2945         parses MediaDecodingConfiguration and MediaEncodingConifguration objects (now that they live
2946         in Platform) and return a MediaCapabilitiesInfo object (now that it does too).
2947
2948         * Modules/mediacapabilities/MediaCapabilities.cpp:
2949         (WebCore::isValidVideoConfiguration):
2950         (WebCore::MediaCapabilities::decodingInfo):
2951         (WebCore::MediaCapabilities::encodingInfo):
2952         * Modules/mediacapabilities/MediaCapabilitiesInfo.h: Removed.
2953         * Modules/mediacapabilities/MediaCapabilitiesInfo.idl:
2954         * Modules/mediacapabilities/VideoConfiguration.idl:
2955         * Sources.txt:
2956         * WebCore.xcodeproj/project.pbxproj:
2957         * platform/MediaCapabilitiesInfo.h: Copied from Source/WebCore/Modules/mediacapabilities/MediaDecodingType.h.
2958         * platform/mediacapabilities/AudioConfiguration.h: Renamed from Source/WebCore/Modules/mediacapabilities/AudioConfiguration.h.
2959         * platform/mediacapabilities/MediaConfiguration.h: Renamed from Source/WebCore/Modules/mediacapabilities/MediaConfiguration.h.
2960         * platform/mediacapabilities/MediaDecodingConfiguration.h: Renamed from Source/WebCore/Modules/mediacapabilities/MediaDecodingConfiguration.h.
2961         * platform/mediacapabilities/MediaDecodingType.h: Renamed from Source/WebCore/Modules/mediacapabilities/MediaDecodingType.h.
2962         * platform/mediacapabilities/MediaEncodingConfiguration.h: Renamed from Source/WebCore/Modules/mediacapabilities/MediaEncodingConfiguration.h.
2963         * platform/mediacapabilities/MediaEncodingType.h: Renamed from Source/WebCore/Modules/mediacapabilities/MediaEncodingType.h.
2964         * platform/mediacapabilities/MediaEngineConfiguration.cpp: Removed.
2965         * platform/mediacapabilities/MediaEngineConfiguration.h: Removed.
2966         * platform/mediacapabilities/MediaEngineConfigurationFactory.cpp:
2967         (WebCore::factories):
2968         (WebCore::MediaEngineConfigurationFactory::createDecodingConfiguration):
2969         (WebCore::MediaEngineConfigurationFactory::createEncodingConfiguration):
2970         * platform/mediacapabilities/MediaEngineConfigurationFactory.h:
2971         * platform/mediacapabilities/MediaEngineEncodingConfiguration.h: Removed.
2972         * platform/mediacapabilities/VideoConfiguration.h: Renamed from Source/WebCore/Modules/mediacapabilities/VideoConfiguration.h.
2973         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
2974         * platform/mock/MediaEngineConfigurationFactoryMock.cpp: Added.
2975         (WebCore::canDecodeMedia):
2976         (WebCore::canSmoothlyDecodeMedia):
2977         (WebCore::canPowerEfficientlyDecodeMedia):
2978         (WebCore::canEncodeMedia):
2979         (WebCore::canSmoothlyEncodeMedia):
2980         (WebCore::canPowerEfficientlyEncodeMedia):
2981         (WebCore::MediaEngineConfigurationFactoryMock::createDecodingConfiguration):
2982         (WebCore::MediaEngineConfigurationFactoryMock::createEncodingConfiguration):
2983         * platform/mock/MediaEngineConfigurationFactoryMock.h: Renamed from Source/WebCore/platform/mediacapabilities/MediaEngineDecodingConfiguration.h.
2984         * platform/mock/MediaEngineDecodingConfigurationMock.cpp: Removed.
2985         * platform/mock/MediaEngineDecodingConfigurationMock.h: Removed.
2986         * platform/mock/MediaEngineEncodingConfigurationMock.cpp: Removed.
2987         * platform/mock/MediaEngineEncodingConfigurationMock.h: Removed.
2988
2989 2018-09-08  Ryosuke Niwa  <rniwa@webkit.org>
2990
2991         :first-child, :last-child, :nth-child, and :nth-of-type don't work on shadow root's children
2992         https://bugs.webkit.org/show_bug.cgi?id=166748
2993         <rdar://problem/29649177>
2994
2995         Reviewed by Yusuke Suzuki.
2996
2997         Added the support for matching positional pseudo classes. For now, we invalidate whenever a child node
2998         of a non-UA ShadowRoot is mutated instead of a fine-grained style invalidation as done for regular elements.
2999
3000         Tests: fast/shadow-dom/nth-node-on-shadow-child-invalidation.html
3001                fast/shadow-dom/nth-node-on-shadow-child-no-jit.html
3002                fast/shadow-dom/nth-node-on-shadow-child.html
3003
3004         * css/SelectorChecker.cpp:
3005         (WebCore::SelectorChecker::checkOne const):
3006         * cssjit/SelectorCompiler.cpp:
3007         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToParentElementOrShadowRoot):
3008         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsFirstChild):
3009         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsLastChild):
3010         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsOnlyChild):
3011         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateNthChildParentCheckAndRelationUpdate):
3012         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild):
3013         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChildOf):
3014         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateNthLastChildParentCheckAndRelationUpdate):
3015         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthLastChild):
3016         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthLastChildOf):
3017         * dom/ShadowRoot.cpp:
3018         (WebCore::ShadowRoot::childrenChanged): Invalidate the subtree whenever a child node is mutated.
3019         * dom/ShadowRoot.h:
3020         * domjit/DOMJITHelpers.h:
3021         (WebCore::DOMJIT::branchTestIsShadowRootFlagOnNode): Added.
3022         (WebCore::DOMJIT::branchTestIsElementOrShadowRootFlagOnNode): Added.
3023
3024 2018-09-11  Per Arne Vollan  <pvollan@apple.com>
3025
3026         Addressing post-review feedback on r235619.
3027         https://bugs.webkit.org/show_bug.cgi?id=187925
3028
3029         Unreviewed.
3030
3031         * testing/Internals.cpp:
3032         (WebCore::Internals::primaryScreenDisplayID):
3033         * testing/Internals.h:
3034
3035 2018-09-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3036
3037         [macOS] [WK2] Support changing foreground colors via color panel
3038         https://bugs.webkit.org/show_bug.cgi?id=189382
3039         <rdar://problem/44227311>
3040
3041         Reviewed by Ryosuke Niwa.
3042
3043         Small adjustments to support changing foreground text color using NSColorPanel in WebKit2. See comments below.
3044         Tested by FontManagerTests.ChangeFontColorWithColorPanel.
3045
3046         * editing/EditingStyle.cpp:
3047         (WebCore::StyleChange::extractTextStyles):
3048
3049         Support setting foreground text color with alpha by using a styled span element rather than a font element with
3050         attributes. To do this, only populate `StyleChange::m_applyFontColor` if the color is opaque. This is because
3051         the font element does not support `rgba()` syntax, so any font colors here with alpha that are serialized to
3052         `rgba()` result in a garbage value for the computed color style.
3053
3054         * editing/FontAttributeChanges.cpp:
3055         (WebCore::FontAttributeChanges::editAction const):
3056
3057         Add a helper to return the relevant EditAction describing this set of FontAttributeChanges.
3058
3059         * editing/FontAttributeChanges.h:
3060         (WebCore::FontChanges::isEmpty const):
3061
3062 2018-09-11  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
3063
3064         Shrink size of ResourseResponseBase
3065         https://bugs.webkit.org/show_bug.cgi?id=189501
3066
3067         Reviewed by Simon Fraser.
3068
3069         We reduce the size of ResourceResponseBase by the following two optimizations.
3070
3071         1. Use bitfields for bool flags and reorder them.
3072
3073         2. Use Markable<> in CacheControlDirectives, which is held by ResourceResponseBase.
3074
3075         This patch reduces the size of ResourceResponseBase from 416 to 392 bytes.
3076
3077         No behavior change.
3078
3079         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
3080         (WebCore::WebCoreAVFResourceLoader::responseReceived):
3081         (WebCore::WebCoreAVFResourceLoader::fulfillRequestWithResource):
3082         * platform/network/CacheValidation.h:
3083         (WebCore::CacheControlDirectives::CacheControlDirectives):
3084         * platform/network/ResourceResponseBase.cpp:
3085         (WebCore::ResourceResponseBase::ResourceResponseBase):
3086         (WebCore::ResourceResponseBase::contentRange const):
3087         * platform/network/ResourceResponseBase.h:
3088         (WebCore::ResourceResponseBase::decode):
3089
3090 2018-09-11  Michael Catanzaro  <mcatanzaro@igalia.com>
3091
3092         Unreviewed, fix some -Wreturn-type warnings
3093
3094         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3095         (WebCore::sourceFromNewReceiver):
3096         * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
3097         (WebCore::toRTCRtpTransceiverDirection):
3098         (WebCore::fromRTCRtpTransceiverDirection):
3099
3100 2018-09-11  Jiewen Tan  <jiewen_tan@apple.com>
3101
3102         Unreviewed, a speculative build fix for r235888.
3103
3104         * Modules/mediastream/MediaDevices.h:
3105         Add class Document forward declaration.
3106
3107 2018-09-11  Woodrow Wang  <woodrow_wang@apple.com>
3108
3109         Add Web API Statistics Collection
3110         https://bugs.webkit.org/show_bug.cgi?id=187773
3111         <rdar://problem/44155162>
3112
3113         Reviewed by Brent Fulgham.
3114
3115         Added data collection for web API statistics, specifically regarding the canvas, font loads, 
3116         screen functions, and navigator functions. The data collection code is placed under a runtime 
3117         enabled feature flag. The statistics are stored in a ResourceLoadStatistics object and written 
3118         to a plist on disk. Added a new file CanvasActivityRecord.h and CanvasActivityRecord.cpp which
3119         includes a struct to keep track of HTML5 canvas element read and writes. 
3120
3121         Tests: http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html
3122                http/tests/webAPIStatistics/font-load-data-collection.html
3123                http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html
3124                http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html
3125
3126         * Sources.txt:
3127         * WebCore.xcodeproj/project.pbxproj:
3128         * css/CSSFontFaceSource.cpp:
3129         (WebCore::CSSFontFaceSource::load):
3130         * css/CSSFontSelector.cpp:
3131         (WebCore::CSSFontSelector::fontRangesForFamily):
3132         (WebCore::CSSFontSelector::fallbackFontAt):
3133
3134         The following are the functions where we'd like to record a canvas read.
3135
3136         * html/HTMLCanvasElement.cpp:
3137         (WebCore::HTMLCanvasElement::toDataURL):
3138         (WebCore::HTMLCanvasElement::toBlob):
3139         (WebCore::HTMLCanvasElement::getImageData):
3140         (WebCore::HTMLCanvasElement::toMediaSample):
3141         (WebCore::HTMLCanvasElement::captureStream):
3142
3143         The following are the functions where we'd like to record a canvas write.
3144
3145         * html/canvas/CanvasRenderingContext2D.cpp:
3146         (WebCore::CanvasRenderingContext2D::measureText):
3147         (WebCore::CanvasRenderingContext2D::drawTextInternal):
3148
3149         The following files and functions handle the CanvasActivityRecord struct and
3150         its respective functions.
3151
3152         * loader/CanvasActivityRecord.cpp: Added.
3153         (WebCore::CanvasActivityRecord::recordWrittenOrMeasuredText):
3154         (WebCore::CanvasActivityRecord::mergeWith):
3155         * loader/CanvasActivityRecord.h: Added.
3156         (WebCore::CanvasActivityRecord::encode const):
3157         (WebCore::CanvasActivityRecord::decode):
3158
3159         * loader/DocumentThreadableLoader.cpp:
3160         * loader/FrameLoader.cpp:
3161         * loader/ResourceLoadObserver.cpp:
3162         (WebCore::ResourceLoadObserver::logFontLoad):
3163         (WebCore::ResourceLoadObserver::logCanvasRead):
3164         (WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure):
3165         (WebCore::ResourceLoadObserver::logNavigatorAPIAccessed):
3166         (WebCore::ResourceLoadObserver::logScreenAPIAccessed):
3167
3168         Before, entries in the ResourceLoadStatistics involving HashSets used "origin" as the key. 
3169         Now the encodeHashSet function has been generalized to take any key to encode the entries 
3170         in the HashSet. Also added functionality to encode an OptionSet by converting it to its 
3171         raw bitmask state. 
3172
3173         * loader/ResourceLoadObserver.h:
3174         * loader/ResourceLoadStatistics.cpp:
3175         (WebCore::encodeHashSet):
3176         (WebCore::encodeOriginHashSet):
3177         (WebCore::encodeOptionSet):
3178         (WebCore::encodeFontHashSet):
3179         (WebCore::encodeCanvasActivityRecord):
3180         (WebCore::ResourceLoadStatistics::encode const):
3181         (WebCore::decodeHashSet):
3182         (WebCore::decodeOriginHashSet):
3183         (WebCore::decodeOptionSet):
3184         (WebCore::decodeFontHashSet):
3185         (WebCore::decodeCanvasActivityRecord):
3186         (WebCore::ResourceLoadStatistics::decode):
3187         (WebCore::navigatorAPIEnumToString):
3188         (WebCore::screenAPIEnumToString):
3189         (WebCore::appendNavigatorAPIOptionSet):
3190         (WebCore::appendScreenAPIOptionSet):
3191         (WebCore::ResourceLoadStatistics::toString const):
3192         (WebCore::ResourceLoadStatistics::merge):
3193         * loader/ResourceLoadStatistics.h:
3194         * loader/ResourceTiming.cpp:
3195
3196         The following are the navigator functions recorded for the web API statistics.
3197
3198         * page/Navigator.cpp:
3199         (WebCore::Navigator::appVersion const):
3200         (WebCore::Navigator::userAgent const):
3201         (WebCore::Navigator::plugins):
3202         (WebCore::Navigator::mimeTypes):
3203         (WebCore::Navigator::cookieEnabled const):
3204         (WebCore::Navigator::javaEnabled const):
3205
3206         The following are the screen functions recorded for the web API statistics.
3207
3208         * page/Screen.cpp:
3209         (WebCore::Screen::height const):
3210         (WebCore::Screen::width const):
3211         (WebCore::Screen::colorDepth const):
3212         (WebCore::Screen::pixelDepth const):
3213         (WebCore::Screen::availLeft const):
3214         (WebCore::Screen::availTop const):
3215         (WebCore::Screen::availHeight const):
3216         (WebCore::Screen::availWidth const):
3217
3218 2018-09-11  Pablo Saavedra  <psaavedra@igalia.com>
3219
3220         playbackControlsManagerUpdateTimerFired and
3221         m_playbackControlsManagerUpdateTimer must be
3222         guarded with ENABLE(VIDEO), otherwise the following
3223         error occurs with the VIDEO feature turned off:
3224
3225           error: 'MediaElementSession' has not been declared
3226
3227         Add missing #if ENABLE(VIDEO) Page.cpp and Page.h
3228         https://bugs.webkit.org/show_bug.cgi?id=189500
3229
3230         Reviewed by Anders Carlsson.
3231
3232         * page/Page.cpp:
3233         (WebCore::Page::Page):
3234         (WebCore::Page::schedulePlaybackControlsManagerUpdate):
3235         * page/Page.h:
3236
3237 2018-09-11  Frederic Wang  <fwang@igalia.com>
3238
3239         Refactor filter list checking code
3240         https://bugs.webkit.org/show_bug.cgi?id=185087
3241
3242         Reviewed by Antonio Gomes.
3243
3244         No new tests, behavior unchanged.
3245
3246         * page/animation/KeyframeAnimation.h: Add missing forward-declaration FilterOperations.
3247
3248 == Rolled over to ChangeLog-2018-09-11 ==