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