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