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