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