[LFC] Update the block box/container list
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2021-02-12  Zalan Bujtas  <zalan@apple.com>
2
3         [LFC] Update the block box/container list
4         https://bugs.webkit.org/show_bug.cgi?id=221800
5         <rdar://problem/74178203>
6
7         Reviewed by Antti Koivisto.
8
9         Add DisplayType::FlowRoot to isBlockContainer/isBlockLevelBox and DisplayType::Grid to isBlockLevelBox. 
10
11         * layout/layouttree/LayoutBox.cpp:
12         (WebCore::Layout::Box::isBlockLevelBox const):
13         (WebCore::Layout::Box::isBlockContainer const):
14
15 2021-02-12  Zalan Bujtas  <zalan@apple.com>
16
17         [LFC][IFC] LineLayout::enclosingBorderBoxRectFor reports content box size
18         https://bugs.webkit.org/show_bug.cgi?id=221778
19
20         Reviewed by Antti Koivisto.
21
22         Before 272724, inline boxes included their paddings and borders in the content box geometry.
23         Now we can just simply return the border box rect.
24
25         * layout/integration/LayoutIntegrationLineLayout.cpp:
26         (WebCore::LayoutIntegration::LineLayout::enclosingBorderBoxRectFor const):
27
28 2021-02-10  Sergio Villar Senin  <svillar@igalia.com>
29
30         Crash in InsertTextCommand::doApply
31         https://bugs.webkit.org/show_bug.cgi?id=213514
32
33         Reviewed by Ryosuke Niwa.
34
35         The InsertTextCommand might delete the current selection before inserting the text. In that case and when
36         the selection was ending inside an empty row of a table the code was calling CompositeEditCommand::removeNode()
37         directly to delete the empty row. That method however does not properly update the m_endingPosition of
38         the CompositeEditCommand leaving the current selection in an inconsistent state. Replaced that call by
39         removeNodeUpdatingStates() which ends up calling removeNode() but only after updating the selection state.
40
41         Test: editing/deleting/insert-in-orphaned-selection-crash.html
42
43         * editing/DeleteSelectionCommand.cpp:
44         (WebCore::DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows): Replaced
45         CompositeEditCommand::removeNode() by removeNodeUpdatingStates().
46
47 2021-02-12  Youenn Fablet  <youenn@apple.com>
48
49         Make RemoteRealtimeVideoSource a RealtimeVideoCaptureSource
50         https://bugs.webkit.org/show_bug.cgi?id=221747
51
52         Reviewed by Eric Carlson.
53
54         Introduce isVideoSource to be able to get presets data from RealtimeVideoSource.
55         Expose presets in RealtimeVideoSource for GPUProcess to send it to WebProcess.
56         Remove no longer used m_defaultSize member.
57         Update RealtimeVideoSource to set some of its members when its capture source is ready,
58         including settings, size, frame rate and name.
59         Covered by existing tests.
60
61         * platform/mediastream/RealtimeMediaSource.h:
62         * platform/mediastream/RealtimeVideoCaptureSource.cpp:
63         (WebCore::RealtimeVideoCaptureSource::prepareToProduceData):
64         (WebCore::RealtimeVideoCaptureSource::presetsData):
65         * platform/mediastream/RealtimeVideoCaptureSource.h:
66         * platform/mediastream/RealtimeVideoSource.cpp:
67         (WebCore::RealtimeVideoSource::whenReady):
68         * platform/mediastream/RealtimeVideoSource.h:
69
70 2021-02-12  Ryosuke Niwa  <rniwa@webkit.org>
71
72         Nullopt crash in DOMSelection::getRangeAt
73         https://bugs.webkit.org/show_bug.cgi?id=221786
74
75         Reviewed by Darin Adler.
76
77         No new tests since we don't have any way to reproduce this crash.
78
79         * page/DOMSelection.cpp:
80         (WebCore::DOMSelection::getRangeAt): Added a nullopt check with an assertion.
81
82 2021-02-12  Said Abou-Hallawa  <said@apple.com>
83
84         Make Pattern hold a NativeImage instead of an Image
85         https://bugs.webkit.org/show_bug.cgi?id=221637
86
87         Reviewed by Simon Fraser.
88
89         This will make caching the Pattern data in the GPUP straightforward since
90         all we need is to cache the NativeImage and encode the pattern data.
91
92         * html/canvas/CanvasPattern.cpp:
93         (WebCore::CanvasPattern::create):
94         (WebCore::CanvasPattern::CanvasPattern):
95         * html/canvas/CanvasPattern.h:
96         * html/canvas/CanvasRenderingContext2DBase.cpp:
97         (WebCore::CanvasRenderingContext2DBase::createPattern):
98         * inspector/InspectorCanvas.cpp:
99         (WebCore::InspectorCanvas::buildArrayForCanvasPattern):
100         Extract a NativeImage of an Image. The platform Patterns deal with
101         NativeImages only.
102
103         * platform/graphics/Image.h:
104         Remove ImageHandle.
105
106         * platform/graphics/Pattern.cpp:
107         (WebCore::Pattern::create):
108         (WebCore::Pattern::Pattern):
109         (WebCore::Pattern::setPatternSpaceTransform):
110         * platform/graphics/Pattern.h:
111         (WebCore::Pattern::Parameters::encode const):
112         (WebCore::Pattern::Parameters::decode):
113         (WebCore::Pattern::encode const): Deleted.
114         (WebCore::Pattern::decode): Deleted.
115         Make the new struct 'Parameters' holds all the members other than the
116         NativeImage. This struct + RenderingResourceIdentifer of the NativeImage
117         will be recorded for the strokePattern and the fillPattern.
118
119         * platform/graphics/cairo/CairoOperations.cpp:
120         (WebCore::Cairo::FillSource::FillSource):
121         * platform/graphics/cairo/PatternCairo.cpp:
122         (WebCore::Pattern::createPlatformPattern const):
123         * platform/graphics/cg/PatternCG.cpp:
124         (WebCore::Pattern::createPlatformPattern const):
125         The platform Pattern deals only with NativeImages.
126
127         * platform/graphics/displaylists/DisplayList.cpp:
128         (WebCore::DisplayList::DisplayList::shouldDumpForFlags):
129         SetState::state() is renamed to SetStateItem::stateChange() since it 
130         returns GraphicsContextStateChange.
131
132         * platform/graphics/displaylists/DisplayListItemBuffer.cpp:
133         (WebCore::DisplayList::ItemHandle::apply):
134         SetState::apply() has to be a special case.
135
136         * platform/graphics/displaylists/DisplayListItems.cpp:
137         (WebCore::DisplayList::SetState::SetState):
138         (WebCore::DisplayList::SetState::apply):
139         (WebCore::DisplayList::operator<<):
140         (WebCore::DisplayList::SetState::apply const): Deleted.
141         Add a new constructor for SetState to be used by the decoder. All the
142         members of GraphicsContextStateChange will be copied but strokePattern
143         and fillPattern will be created only when their NativeImages are resolved
144         in the SetState::apply().
145
146         * platform/graphics/displaylists/DisplayListItems.h:
147         (WebCore::DisplayList::SetState::stateChange const):
148         (WebCore::DisplayList::SetState::strokePatternParameters const):
149         (WebCore::DisplayList::SetState::fillPatternParameters const):
150         (WebCore::DisplayList::SetState::strokePatternImageIdentifier const):
151         (WebCore::DisplayList::SetState::fillPatternImageIdentifier const):
152         (WebCore::DisplayList::SetState::encode const):
153         (WebCore::DisplayList::SetState::decode):
154         (WebCore::DisplayList::SetState::state const): Deleted.
155         Specialize the encode and the decoding of strokePattern and fillPattern 
156         by using the Pattern::Parameters and the RenderingResourceIdentifer of
157         the NativeImage.
158
159         * platform/graphics/displaylists/DisplayListRecorder.cpp:
160         (WebCore::DisplayList::Recorder::cacheNativeImage):
161         (WebCore::DisplayList::Recorder::appendStateChangeItem):
162         (WebCore::DisplayList::Recorder::drawNativeImage):
163         (WebCore::DisplayList::Recorder::drawPattern):
164         * platform/graphics/displaylists/DisplayListRecorder.h:
165         Cache the NativeImages of strokePattern and fillPattern.
166
167         * platform/graphics/displaylists/DisplayListReplayer.cpp:
168         (WebCore::DisplayList::applySetStateItem):
169         (WebCore::DisplayList::Replayer::applyItem):
170         Resolve the NativeImages of strokePattern and fillPattern from the cached
171         NativeImages.
172
173         * platform/graphics/filters/FETile.cpp:
174         (WebCore::FETile::platformApplySoftware):
175         * rendering/RenderLayerBacking.cpp:
176         (WebCore::patternForDescription):
177         * rendering/svg/RenderSVGResourcePattern.cpp:
178         (WebCore::RenderSVGResourcePattern::buildPattern):
179         Patterns should be created with NativeImages.
180
181 2021-02-11  Myles C. Maxfield  <mmaxfield@apple.com>
182
183         drawGlyphs() should take a Glyph* and an Advance* instead of a GlyphBuffer
184         https://bugs.webkit.org/show_bug.cgi?id=221765
185
186         Reviewed by Simon Fraser.
187
188         Making it take a GlyphBuffer is misleading because it only uses the glyph array and the advance array
189         from inside the GlyphBuffer. A GlyphBuffer also holds a bunch of extra data like glyph origins and an
190         initial advance. GlyphBuffers internally have a flatten() function which incorporate the origins into
191         the advances, and this flatten() function needs to have been called before calling drawGlyphs(). Our
192         code ASSERT()s this, and after the assertion, we shouldn't need the entire GlyphBuffer any more.
193
194         No new tests because there is no behavior change.
195
196         * platform/graphics/Font.cpp:
197         * platform/graphics/FontCascade.cpp:
198         (WebCore::FontCascade::drawGlyphBuffer const):
199         * platform/graphics/FontCascade.h:
200         * platform/graphics/GlyphBufferMembers.h:
201         * platform/graphics/GraphicsContext.cpp:
202         (WebCore::GraphicsContext::drawGlyphs):
203         * platform/graphics/GraphicsContext.h:
204         * platform/graphics/GraphicsContextImpl.h:
205         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
206         (WebCore::GraphicsContextImplCairo::drawGlyphs):
207         * platform/graphics/cairo/FontCairo.cpp:
208         (WebCore::FontCascade::drawGlyphs):
209         * platform/graphics/cairo/GraphicsContextImplCairo.h:
210         * platform/graphics/coretext/FontCascadeCoreText.cpp:
211         (WebCore::FontCascade::drawGlyphs):
212         * platform/graphics/displaylists/DisplayListDrawGlyphsRecorder.h:
213         * platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp:
214         (WebCore::DisplayList::DrawGlyphsRecorder::drawGlyphs):
215         * platform/graphics/displaylists/DisplayListDrawGlyphsRecorderHarfBuzz.cpp:
216         (WebCore::DisplayList::DrawGlyphsRecorder::drawGlyphs):
217         * platform/graphics/displaylists/DisplayListDrawGlyphsRecorderWin.cpp:
218         (WebCore::DisplayList::DrawGlyphsRecorder::drawGlyphs):
219         * platform/graphics/displaylists/DisplayListItems.cpp:
220         (WebCore::DisplayList::DrawGlyphs::apply const):
221         (WebCore::DisplayList::DrawGlyphs::generateGlyphBuffer const): Deleted.
222         * platform/graphics/displaylists/DisplayListItems.h:
223         * platform/graphics/displaylists/DisplayListRecorder.cpp:
224         (WebCore::DisplayList::Recorder::drawGlyphs):
225         * platform/graphics/displaylists/DisplayListRecorder.h:
226         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
227         (Nicosia::CairoOperationRecorder::drawGlyphs):
228         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:
229         * rendering/mathml/MathOperator.cpp:
230         (WebCore::MathOperator::paintGlyph):
231         (WebCore::MathOperator::paint):
232         * rendering/mathml/RenderMathMLToken.cpp:
233         (WebCore::RenderMathMLToken::paint):
234
235 2021-02-11  Zalan Bujtas  <zalan@apple.com>
236
237         [LFC][Integration] The root box's display type should stay Display::Block
238         https://bugs.webkit.org/show_bug.cgi?id=221801
239
240         Reviewed by Antti Koivisto.
241
242         * layout/integration/LayoutIntegrationBoxTree.cpp:
243         (WebCore::LayoutIntegration::BoxTree::updateStyle):
244
245 2021-02-11  Jer Noble  <jer.noble@apple.com>
246
247         Unreviewed build fix after r272758; include missing change to RuntimeEnabledFeatures.
248
249         * page/RuntimeEnabledFeatures.h:
250         (WebCore::RuntimeEnabledFeatures::setOpusDecoderEnabled):
251         (WebCore::RuntimeEnabledFeatures::opusDecoderEnabled const):
252
253 2021-02-11  Nikita Vasilyev  <nvasilyev@apple.com>
254
255         Web Inspector: "Show Extended Gridlines" option for grid overlay does not work
256         https://bugs.webkit.org/show_bug.cgi?id=221775
257
258         Reviewed by Devin Rousso.
259
260         Replace all mentions of "Gridlines" with "GridLines" (camelcase).
261
262         * inspector/InspectorOverlay.h:
263         * inspector/agents/InspectorDOMAgent.cpp:
264         (WebCore::InspectorDOMAgent::showGridOverlay):
265         * inspector/agents/InspectorDOMAgent.h:
266
267 2021-02-11  Alex Christensen  <achristensen@webkit.org>
268
269         REGRESSION(r272293) WebGL 1.0.2 test expectations say HTTPS
270         https://bugs.webkit.org/show_bug.cgi?id=221774
271         <rdar://problem/74149867>
272
273         Reviewed by Geoff Garen.
274
275         www.opengl.org is in the list of hosts that support HTTPS, which affected our test expectations.
276         Since we need a domain to test with anyways for bug 221591, we may as well use this one.
277
278         * contentextensions/ContentExtensionsBackend.cpp:
279         (WebCore::ContentExtensions::makeSecureIfNecessary):
280
281 2021-02-11  Alex Christensen  <achristensen@webkit.org>
282
283         Unreviewed, reverting r272603.
284
285         Broke test, has room for improvement
286
287         Reverted changeset:
288
289         "Synthesize range responses if needed in WebCoreNSURLSession"
290         https://bugs.webkit.org/show_bug.cgi?id=221072
291         https://trac.webkit.org/changeset/272603
292
293 2021-02-11  Chris Dumez  <cdumez@apple.com>
294
295         Review usage of adoptNS()
296         https://bugs.webkit.org/show_bug.cgi?id=221779
297
298         Reviewed by Alex Christensen.
299
300         Review usage of adoptNS():
301         1. Make sure we call adoptNS() as soon as we allocate the object instead of doing it later on, as this is less error-prone
302         2. Fix cases where we called adoptNS() but really should have retained instead of adopting
303
304         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
305         (WebCore::PlatformCAFilters::filterValueForOperation):
306         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
307         (WebCore::PlatformCALayerCocoa::addAnimationForKey):
308         * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm:
309         (WebCore::AudioSampleBufferCompressor::gradualDecoderRefreshCount):
310         * platform/network/cocoa/ResourceRequestCocoa.mm:
311         (WebCore::ResourceRequest::doUpdatePlatformRequest):
312         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
313         * platform/text/cocoa/LocaleCocoa.mm:
314         (WebCore::createDateTimeFormatter):
315         * testing/Internals.mm:
316         (WebCore::Internals::encodedPreferenceValue):
317
318 2021-02-11  Zalan Bujtas  <zalan@apple.com>
319
320         [LFC][Integration] Add scrollable overflow support
321         https://bugs.webkit.org/show_bug.cgi?id=221777
322
323         Reviewed by Simon Fraser.
324
325         Normally inline level boxes stretch the line box with their margin box. However inline boxes
326         behave differently. They stretch the line box with their layout bounds (->glyph sizes)
327         and they contribute to scrollable overflow with their border boxes (note that vertical margin is ignored on inline boxes).
328         e.g <div><span style="padding: 100px">text</span></div>
329         ^^ the line will not be stretched to include the 200px vertical padding, but instead the padding is added to the scrollable overflow area.
330         (see fast/inline/inline-content-with-padding-left-right.html)
331
332         * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
333         (WebCore::LayoutIntegration::InlineContentBuilder::build const):
334         (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
335
336 2021-02-11  Jer Noble  <jer.noble@apple.com>
337
338         [Mac] Add Experimental Opus Codec support
339         https://bugs.webkit.org/show_bug.cgi?id=221745
340
341         Reviewed by Eric Carlson.
342
343         Add support for the Opus Codec in a WebM container by parsing the Opus private
344         codec data into a CoreAudio-specific magic cookie, and using that cookie to
345         initialize an AudioFormatDescription necessary to instantiate the CoreAudio
346         Opus decoder.
347
348         This magic cookie requires information both from the private codec data, but
349         also requires information parsed directly from the stream itself; update the
350         createOpusAudioFormatDescription() to take frame data as well as cookie data.
351
352         * platform/audio/PlatformMediaSessionManager.cpp:
353         (WebCore::PlatformMediaSessionManager::opusDecoderEnabled):
354         (WebCore::PlatformMediaSessionManager::setOpusDecoderEnabled):
355         * platform/audio/PlatformMediaSessionManager.h:
356         * platform/graphics/cocoa/SourceBufferParserWebM.cpp:
357         (WebCore::SourceBufferParserWebM::AudioTrackData::consumeFrameData):
358         * platform/graphics/cocoa/WebMAudioUtilitiesCocoa.h:
359         * platform/graphics/cocoa/WebMAudioUtilitiesCocoa.mm:
360         (WebCore::createAudioFormatDescriptionForFormat):
361         (WebCore::opusConfigToFrameDuration):
362         (WebCore::opusConfigToBandwidth):
363         (WebCore::cookieFromOpusCodecPrivate):
364         (WebCore::isOpusDecoderAvailable):
365         (WebCore::createOpusAudioFormatDescription):
366         (WebCore::createVorbisAudioFormatDescription):
367
368 2021-02-11  Said Abou-Hallawa  <said@apple.com>
369
370         Unreviewed, reverting r270578.
371         https://bugs.webkit.org/show_bug.cgi?id=221110
372
373         Caused incorrect image layout inside a flexbox container.
374
375         * rendering/RenderFlexibleBox.cpp:
376         (WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing const):
377         (WebCore::RenderFlexibleBox::childCrossSizeIsDefinite const):
378
379 2021-02-11  Chris Dumez  <cdumez@apple.com>
380
381         [GPUP] <audio> won't load when URL ends with .php causing some tests to time out
382         https://bugs.webkit.org/show_bug.cgi?id=221695
383
384         Reviewed by Eric Carlson.
385
386         No new tests, covered by unskipped layout tests.
387
388         * html/HTMLMediaElement.cpp:
389         (WebCore::HTMLMediaElement::mediaPlayerEngineUpdated):
390         (WebCore::HTMLMediaElement::mediaPlayerDidInitializeMediaEngine):
391         We were calling HTMLMediaElement::audioSourceProvider() in mediaPlayerEngineUpdated() which
392         happens right after we've constructed the MediaPlayerPrivate but before we've called
393         load() on the MediaPlayerPrivate. The issue was that calling audioSourceProvider() would
394         initialize the AudioSourceProvider and end up sending the RemoteMediaPlayerProxy::CreateAudioSourceProvider
395         IPC to the GPUProcess. RemoteMediaPlayerProxy::createAudioSourceProvider() would return early
396         because m_player->audioSourceProvider() returns null. The reason m_player->audioSourceProvider()
397         returns null is because it's MediaPlayerPrivate is still a NullMediaPlayerPrivate, because
398         MediaPlayer::load() has not been called in the GPUProcess yet. For this reason, I moved the
399         audioSourceProvider() initialization from mediaPlayerEngineUpdated() to
400         mediaPlayerDidInitializeMediaEngine(). mediaPlayerDidInitializeMediaEngine() happens right
401         after we've called MediaPlayerPrivate::load() which will end up calling MediaPlayer::load()
402         in the GPUProcess.
403
404         * platform/graphics/MediaPlayer.cpp:
405         (WebCore::MediaPlayer::loadWithNextMediaEngine):
406         Pass an empty ContentType to MediaPlayerPrivate::load() when we did not have a content type
407         but guessed one based on the extension. This ends up getting passed to the MediaPlayer
408         in the GPUProcess and it is important it knows it does not have a content type so that
409         it can guess one from the extension and try the next media engine if it cannot find one.
410
411 2021-02-11  Aditya Keerthi  <akeerthi@apple.com>
412
413         [iOS] Some checkboxes and radio buttons are clipped on top
414         https://bugs.webkit.org/show_bug.cgi?id=221736
415         <rdar://problem/73956812>
416
417         Reviewed by Simon Fraser.
418
419         The clipping occurs due to integral rounding of the paint rect in
420         both RenderBox::paintBoxDecorations, as well as using the integral
421         rect in RenderTheme::paint. To fix, use FloatRect and the device
422         pixel snapped rect when painting these elements.
423
424         Tests: fast/forms/ios/form-control-refresh/checkbox/subpixel-clipping.html
425                fast/forms/ios/form-control-refresh/radio/subpixel-clipping.html
426
427         * rendering/RenderBox.cpp:
428         (WebCore::RenderBox::paintBoxDecorations):
429
430         Moved into RenderTheme to avoid duplication.
431
432         * rendering/RenderElement.cpp:
433         (WebCore::RenderElement::paintOutline):
434
435         Moved into RenderTheme to avoid duplication.
436
437         * rendering/RenderTheme.cpp:
438         (WebCore::RenderTheme::paint):
439
440         Use the device pixel snapped rect when painting checkboxes and radio
441         buttons.
442
443         * rendering/RenderTheme.h:
444         (WebCore::RenderTheme::adjustedPaintRect):
445
446         On most platforms, no adjustment is performed.
447
448         (WebCore::RenderTheme::paintCheckbox):
449         (WebCore::RenderTheme::paintRadio):
450         * rendering/RenderThemeIOS.h:
451         * rendering/RenderThemeIOS.mm:
452         (WebCore::RenderThemeIOS::adjustedPaintRect):
453
454         On iOS, radio buttons and checkboxes always have a square painting
455         rect. Updated to use FloatRect, rather than IntRect, to avoid
456         clipping.
457
458         (WebCore::RenderThemeIOS::paintCheckbox):
459         (WebCore::RenderThemeIOS::paintRadio):
460         * rendering/RenderThemeWin.h:
461
462 2021-02-11  Jer Noble  <jer.noble@apple.com>
463
464         [Cocoa][GPUP] Move RemoteCommandListener into the GPU Process
465         https://bugs.webkit.org/show_bug.cgi?id=221732
466
467         Reviewed by Eric Carlson.
468
469         Refactor RemoteCommandListener to allow its methods to work over XPC:
470
471         - Rather than having a synchronous client method to query whether seeking is
472           supported, require clients to set seekability explicitly.
473         - Change the RemoteCommandArgument from a union to an Optional<double>.
474         - Allow clients to query the MediaPlaybackTarget through the session rather
475           than wait for a notification that the playback target changed.
476
477         Additionally, add a mini-factory functionality to RemoteCommandListener to allow
478         clients to specify a different subclass to be created at runtime.
479
480         * Modules/webaudio/AudioContext.h:
481         * html/HTMLMediaElement.cpp:
482         (WebCore::HTMLMediaElement::didReceiveRemoteControlCommand):
483         * html/HTMLMediaElement.h:
484         * html/MediaElementSession.cpp:
485         (WebCore::MediaElementSession::didReceiveRemoteControlCommand):
486         * html/MediaElementSession.h:
487         * platform/NowPlayingManager.cpp:
488         (WebCore::NowPlayingManager::didReceiveRemoteControlCommand):
489         (WebCore::NowPlayingManager::setNowPlayingInfo):
490         (WebCore::NowPlayingManager::supportsSeeking const): Deleted.
491         * platform/NowPlayingManager.h:
492         * platform/RemoteCommandListener.cpp:
493         (WebCore::remoteCommandListenerCreationFunction):
494         (WebCore::RemoteCommandListener::setCreationFunction):
495         (WebCore::RemoteCommandListener::resetCreationFunction):
496         (WebCore::RemoteCommandListener::create):
497         (WebCore::RemoteCommandListener::RemoteCommandListener):
498         (WebCore::RemoteCommandListener::setSupportsSeeking):
499         * platform/RemoteCommandListener.h:
500         (WebCore::RemoteCommandListener::RemoteCommandListener): Deleted.
501         (WebCore::RemoteCommandListener::updateSupportedCommands): Deleted.
502         (WebCore::RemoteCommandListener::client const): Deleted.
503         * platform/audio/PlatformMediaSession.cpp:
504         (WebCore::PlatformMediaSession::didReceiveRemoteControlCommand):
505         * platform/audio/PlatformMediaSession.h:
506         * platform/audio/PlatformMediaSessionManager.cpp:
507         (WebCore::PlatformMediaSessionManager::processDidReceiveRemoteControlCommand):
508         * platform/audio/PlatformMediaSessionManager.h:
509         * platform/audio/cocoa/MediaSessionManagerCocoa.h:
510         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
511         (WebCore::MediaSessionManagerCocoa::scheduleSessionStatusUpdate):
512         * platform/audio/ios/MediaSessionHelperIOS.h:
513         * platform/audio/ios/MediaSessionHelperIOS.mm:
514         (MediaSessionHelperiOS::activeVideoRouteDidChange):
515         * platform/audio/ios/MediaSessionManagerIOS.mm:
516         (WebCore::MediaSessionManageriOS::sessionWillBeginPlayback):
517         * platform/ios/RemoteCommandListenerIOS.h:
518         * platform/ios/RemoteCommandListenerIOS.mm:
519         (WebCore::RemoteCommandListenerIOS::create):
520         (WebCore::RemoteCommandListenerIOS::RemoteCommandListenerIOS):
521         (WebCore::RemoteCommandListenerIOS::updateSupportedCommands):
522         (WebCore::RemoteCommandListener::create): Deleted.
523         * platform/mac/RemoteCommandListenerMac.h:
524         * platform/mac/RemoteCommandListenerMac.mm:
525         (WebCore::RemoteCommandListenerMac::create):
526         (WebCore::RemoteCommandListenerMac::updateSupportedCommands):
527         (WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac):
528         (WebCore::RemoteCommandListener::create): Deleted.
529         * testing/Internals.cpp:
530         (WebCore::Internals::postRemoteControlCommand):
531
532 2021-02-11  Darin Adler  <darin@apple.com>
533
534         Use a template to simplify repetitive code in ColorSpaceCG.cpp
535         https://bugs.webkit.org/show_bug.cgi?id=221770
536
537         Reviewed by Sam Weinig.
538
539         * platform/graphics/cg/ColorSpaceCG.cpp:
540         (WebCore::namedColorSpace): Added.
541         (WebCore::sRGBColorSpaceRef): Use namedColorSpace. Also took out long-obsolete
542         workaround for a bug in pre-2013 versions of Core Graphics on Windows.
543         (WebCore::adobeRGB1998ColorSpaceRef): Ditto.
544         (WebCore::displayP3ColorSpaceRef): Ditto.
545         (WebCore::extendedSRGBColorSpaceRef): Ditto.
546         (WebCore::ITUR_2020ColorSpaceRef): Ditto.
547         (WebCore::linearSRGBColorSpaceRef): Ditto.
548         (WebCore::ROMMRGBColorSpaceRef): Ditto.
549         (WebCore::xyzColorSpaceRef): Ditto.
550
551 2021-02-11  Aditya Keerthi  <akeerthi@apple.com>
552
553         [iOS][FCR] Range inputs have an incorrect RTL appearance
554         https://bugs.webkit.org/show_bug.cgi?id=221758
555         <rdar://problem/74236993>
556
557         Reviewed by Wenson Hsieh.
558
559         Test: fast/forms/ios/form-control-refresh/range/rtl-appearance.html
560
561         * rendering/RenderThemeIOS.mm:
562         (WebCore::RenderThemeIOS::paintSliderTrackWithFormControlRefresh):
563
564         In a right-to-left appearance, the track should begin filling from
565         the right.
566
567 2021-02-11  Razvan Caliman  <rcaliman@apple.com>
568
569         Web Inspector: Grid section in Layout panel gets out of sync with grid overlay after reopening Web Inspector
570         https://bugs.webkit.org/show_bug.cgi?id=221728
571         <rdar://problem/74212444>
572
573         Reviewed by BJ Burg.
574
575         Hide all shown grid overlays when the WebInspector is closed.
576
577         * inspector/agents/InspectorDOMAgent.cpp:
578         (WebCore::InspectorDOMAgent::willDestroyFrontendAndBackend):
579         (WebCore::InspectorDOMAgent::highlightNodeList):
580         (WebCore::InspectorDOMAgent::buildObjectForNode):
581         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
582
583 2021-02-11  Sam Weinig  <weinig@apple.com>
584
585         Returning sRGB from CG color space functions on failure is too error prone
586         https://bugs.webkit.org/show_bug.cgi?id=221676
587
588         Reviewed by Darin Adler.
589
590         * platform/graphics/cg/ColorCG.cpp:
591         (WebCore::leakCGColor):
592         Switch to checking for nullptr rather than sRGB and be explicit about where we can
593         and cannot use conversion to ExtendedSRGB, rather than the old behavior where we
594         would secretly use sRGB on platforms without ExtendedSRGB and expect CG to clamp for
595         us.
596
597         * platform/graphics/cg/ColorSpaceCG.cpp:
598         (WebCore::sRGBColorSpaceRef):
599         (WebCore::adobeRGB1998ColorSpaceRef):
600         (WebCore::displayP3ColorSpaceRef):
601         (WebCore::extendedSRGBColorSpaceRef):
602         (WebCore::ITUR_2020ColorSpaceRef):
603         (WebCore::labColorSpaceRef):
604         (WebCore::linearSRGBColorSpaceRef):
605         (WebCore::ROMMRGBColorSpaceRef):
606         (WebCore::xyzColorSpaceRef):
607         * platform/graphics/cg/ColorSpaceCG.h:
608         (WebCore::cachedNullableCGColorSpace):
609         (WebCore::cachedCGColorSpace):
610         Rename cachedCGColorSpace to cachedNullableCGColorSpace to indicate that it can
611         now return nullptr for unsupported color spaces. Add explicit guards around color
612         space accessors to ensure they are only called on platforms where they are known
613         to be supported.
614
615         * platform/graphics/cg/GradientCG.cpp:
616         (WebCore::Gradient::createCGGradient):
617         Be explicit about which color space is being used for the gradien when extended colors are present.
618         This is the same behavior as before, but previously it would happen silently beneath extendedSRGBColorSpaceRef()
619         which is a suprising result.
620
621 2021-02-11  Sergio Villar Senin  <svillar@igalia.com> and Imanol Fernandez  <ifernandez@igalia.com>
622
623         Complete XRSession::requestAnimationFrame implementation
624         https://bugs.webkit.org/show_bug.cgi?id=220979
625
626         Reviewed by Youenn Fablet.
627
628         - Implement the render loop for immersive and inline XR sessions.
629         - Implement WebXR render state updates.
630         - Create the FrameData struct used to query frame specific data from XR devices.
631         - Use window RAF for inline XR sessions.
632         - Implement WebFakeXRDevice testing rendering loop using a timer.
633         - Implement OpenXR session states and session tracking.
634         - Improve OpenXR event handling.
635
636         Tested by the WebXR platform tests.
637
638         * Modules/webxr/WebXRFrame.cpp: Add m_active, m_time and m_session members
639         (WebCore::WebXRFrame::create):
640         (WebCore::WebXRFrame::WebXRFrame):
641         * Modules/webxr/WebXRFrame.h:
642         (WebCore::WebXRFrame::setTime):
643         (WebCore::WebXRFrame::setActive):
644         (WebCore::WebXRFrame::isActive const):
645
646         * Modules/webxr/WebXRRenderState.h: Add m_compositionDisabled member and output canvas setter
647         (WebCore::WebXRRenderState::setOutputCanvas):
648         (WebCore::WebXRRenderState::compositionDisabled const):
649         (WebCore::WebXRRenderState::setCompositionDisabled):
650
651         * Modules/webxr/WebXRSession.cpp:
652         (WebCore::WebXRSession::create):
653         (WebCore::WebXRSession::WebXRSession):
654         (WebCore::WebXRSession::initialize): required to creat the XRFrame with makeRef(this)
655         (WebCore::WebXRSession::requestReferenceSpace): implement reference space creation
656         (WebCore::WebXRSession::requestAnimationFrame): implement render loop for immersive and inline sessions
657         (WebCore::WebXRSession::applyPendingRenderState): implement WebXR render state updates
658         (WebCore::WebXRSession::frameShouldBeRendered const): add check based on the spec 
659         (WebCore::WebXRSession::requestFrame): implement helper function to dispatch a frame request to XR devices
660         (WebCore::WebXRSession::onFrame): process the XR frame and call the RAF callbacks
661         * Modules/webxr/WebXRSession.h:
662
663         * Modules/webxr/WebXRSystem.cpp: Implement render loop using window raf loop.
664         (WebCore::WebXRSystem::WebXRSystem):
665         (WebCore::WebXRSystem::DummyInlineDevice::DummyInlineDevice): Add ScriptExecutionContext
666         (WebCore::WebXRSystem::DummyInlineDevice::requestFrame): Adapt to the new interface
667
668         * Modules/webxr/WebXRSystem.h:
669         * Modules/webxr/WebXRWebGLLayer.cpp:
670         (WebCore::WebXRWebGLLayer::canvas const): Implement canvas getter
671         * Modules/webxr/WebXRWebGLLayer.h:
672         (WebCore::WebXRWebGLLayer::compositionDisabled const): add
673         (WebCore::WebXRWebGLLayer::setCompositionDisabled): add
674
675         * platform/xr/PlatformXR.h: Add FrameData struct
676
677         * platform/xr/openxr/PlatformXROpenXR.cpp: Implement render loop using OpenXR API
678         (PlatformXR::OpenXRDevice::resetSession):
679         (PlatformXR::OpenXRDevice::shutDownTrackingAndRendering):
680         (PlatformXR::OpenXRDevice::pollEvents): Implement event loop to query m_sessionState
681         (PlatformXR::sessionIsActive): add
682         (PlatformXR::sessionIsRunning): add
683         (PlatformXR::OpenXRDevice::beginSession):
684         (PlatformXR::xrViewToViewData): helper function to convert data from OpenXR
685         (PlatformXR::OpenXRDevice::requestFrame): start OpenXR frame, query pose and view data 
686         (PlatformXR::OpenXRDevice::waitUntilStopping): properly wait for OpenXR event before ending the session.
687         * platform/xr/openxr/PlatformXROpenXR.h:
688
689
690         * testing/WebFakeXRDevice.cpp: Implement render loop using a timer
691         (WebCore::SimulatedXRDevice::SimulatedXRDevice):
692         (WebCore::SimulatedXRDevice::~SimulatedXRDevice):
693         (WebCore::SimulatedXRDevice::shutDownTrackingAndRendering):
694         (WebCore::SimulatedXRDevice::stopTimer):
695         (WebCore::SimulatedXRDevice::frameTimerFired):
696         (WebCore::SimulatedXRDevice::requestFrame):
697         * testing/WebFakeXRDevice.h:
698
699 2021-02-11  Sam Weinig  <weinig@apple.com>
700
701         Rework RGB color types to be more declarative to reduce code duplication and make progress toward better automatic conversion
702         https://bugs.webkit.org/show_bug.cgi?id=221677
703
704         Reviewed by Darin Adler.
705
706         The "RGB" family of colors (those inheriting from RGBType) all share a common structure
707         can be generalized to simplify their conversions and centralize their definitions.
708         
709         To do this, each RGB color type now defines a "Descriptor" type (e.g. SRGBDescriptor for 
710         SRGBA) which includes:
711             - What transfer function it uses (e.g. SRGBTransferFunction)
712             - What whitePoint it is defined for (e.g. WhitePoint::D65)
713             - What matrices it uses to convert from linear to xyz and from xyz to linear.
714
715         Then using type aliases, the color type is defined using the descriptor and one of the four
716         base types: BoundedGammaEncoded, BoundedLinearEncoded, ExtendedGammaEncoded, and ExtendedLinearEncoded.
717         So, for the SRGBA family of color types, they are defined as:
718         
719             template<typename T> using SRGBA = BoundedGammaEncoded<T, SRGBADescriptor<T>>;
720             template<typename T> using LinearSRGBA = BoundedLinearEncoded<T, SRGBADescriptor<T>>;
721             template<typename T> using ExtendedSRGBA = ExtendedGammaEncoded<T, SRGBADescriptor<T>>;
722             template<typename T> using LinearExtendedSRGBA = ExtendedLinearEncoded<T, SRGBADescriptor<T>>;
723
724         By using type aliases like this, we gain the ability to easily set up relationships between
725         the types. For instance, the BoundedGammaEncoded type has the following members:
726
727             using LinearCounterpart = BoundedLinearEncoded<T, D>;
728             using ExtendedCounterpart = ExtendedGammaEncoded<T, D>;
729
730         Where D is the "Descriptor" it was made with. This allows helper functions such as the conversion
731         functions to automatically know what counterpart to use without having to write specialized versions
732         for each pair. This will aid in unifying conversion functions further.
733
734         This change also removes the XYZReference member of the color types, replacing it with the
735         WhitePoint, which can be used to construct the XYZReference as is done by the new XYZFor<> alias.
736         This will allow for straigthforward comparisons when we stop always converting through XYZA.
737
738         As a result of moving the matrices to the color type descriptors, we can now simplify all the
739         linear to xyz and xyz to linear conversions to use generic functions (called linearToXYZ and 
740         xyzToLinear not suprisingly) and since the descriptors also include the transfer function we
741         can further simplify the gamma conversion functions to no longer explicitly passing the transfer
742         function.
743
744         Two consequenes of using complex type aliases for the color types, rather than direct structs, is 
745         that we can no longer easily forward declare the color types, so ColorTypes.h is included in a few
746         more places now, and the deduction guides we had been using don't work, so we must explicitly specify
747         the type in a few places. We should be able to reduce the amount included in most places by splitting
748         up the color types into their own headers, and only including the needed color type, only SRGBA in
749         practice.
750
751         This also adds back a missing clamp to the conversion from SRGBA<float> to SRGBA<uint8_t> that I didn't
752         intend to remove in a previous patch, but I am not actual sure is necessary. While I work that out, 
753         better to add it back.
754
755         * css/parser/CSSParser.h:
756         * css/parser/CSSParserFastPaths.h:
757         * platform/graphics/Color.cpp:
758         (WebCore::Color::lightened const):
759         (WebCore::Color::darkened const):
760         * platform/graphics/ColorComponents.h:
761         (WebCore::mapColorComponents):
762         * platform/graphics/ColorConversion.cpp:
763         (WebCore::toLinear):
764         (WebCore::toGammaEncoded):
765         (WebCore::A98RGB<float>>::convert):
766         (WebCore::LinearA98RGB<float>>::convert):
767         (WebCore::DisplayP3<float>>::convert):
768         (WebCore::LinearDisplayP3<float>>::convert):
769         (WebCore::ExtendedSRGBA<float>>::convert):
770         (WebCore::LinearExtendedSRGBA<float>>::convert):
771         (WebCore::ProPhotoRGB<float>>::convert):
772         (WebCore::LinearProPhotoRGB<float>>::convert):
773         (WebCore::Rec2020<float>>::convert):
774         (WebCore::LinearRec2020<float>>::convert):
775         (WebCore::SRGBA<float>>::convert):
776         (WebCore::LinearSRGBA<float>>::convert):
777         (WebCore::xyzToLinear):
778         (WebCore::linearToXYZ):
779         (WebCore::XYZFor<LinearA98RGB<float>>>::convert):
780         (WebCore::XYZFor<LinearDisplayP3<float>>>::convert):
781         (WebCore::XYZFor<LinearExtendedSRGBA<float>>>::convert):
782         (WebCore::XYZFor<LinearProPhotoRGB<float>>>::convert):
783         (WebCore::XYZFor<LinearRec2020<float>>>::convert):
784         (WebCore::XYZFor<LinearSRGBA<float>>>::convert):
785         (WebCore::Lab<float>>::convert):
786         (WebCore::XYZFor<Lab<float>>>::convert):
787         (WebCore::XYZFor<A98RGB<float>>>::convert):
788         (WebCore::XYZFor<DisplayP3<float>>>::convert):
789         (WebCore::XYZFor<ExtendedSRGBA<float>>>::convert):
790         (WebCore::HSLA<float>>::convert):
791         (WebCore::XYZFor<HSLA<float>>>::convert):
792         (WebCore::HWBA<float>>::convert):
793         (WebCore::XYZFor<HWBA<float>>>::convert):
794         (WebCore::LCHA<float>>::convert):
795         (WebCore::XYZFor<LCHA<float>>>::convert):
796         (WebCore::XYZFor<ProPhotoRGB<float>>>::convert):
797         (WebCore::XYZFor<Rec2020<float>>>::convert):
798         (WebCore::XYZFor<SRGBA<float>>>::convert):
799         (WebCore::LinearA98RGB<float>::ReferenceXYZ>::convert): Deleted.
800         (WebCore::LinearDisplayP3<float>::ReferenceXYZ>::convert): Deleted.
801         (WebCore::LinearExtendedSRGBA<float>::ReferenceXYZ>::convert): Deleted.
802         (WebCore::LinearProPhotoRGB<float>::ReferenceXYZ>::convert): Deleted.
803         (WebCore::LinearRec2020<float>::ReferenceXYZ>::convert): Deleted.
804         (WebCore::LinearSRGBA<float>::ReferenceXYZ>::convert): Deleted.
805         (WebCore::Lab<float>::ReferenceXYZ>::convert): Deleted.
806         (WebCore::A98RGB<float>::ReferenceXYZ>::convert): Deleted.
807         (WebCore::DisplayP3<float>::ReferenceXYZ>::convert): Deleted.
808         (WebCore::ExtendedSRGBA<float>::ReferenceXYZ>::convert): Deleted.
809         (WebCore::HSLA<float>::ReferenceXYZ>::convert): Deleted.
810         (WebCore::HWBA<float>::ReferenceXYZ>::convert): Deleted.
811         (WebCore::LCHA<float>::ReferenceXYZ>::convert): Deleted.
812         (WebCore::ProPhotoRGB<float>::ReferenceXYZ>::convert): Deleted.
813         (WebCore::Rec2020<float>::ReferenceXYZ>::convert): Deleted.
814         (WebCore::SRGBA<float>::ReferenceXYZ>::convert): Deleted.
815         * platform/graphics/ColorConversion.h:
816         (WebCore::ColorConversion::convert):
817         * platform/graphics/ColorTypes.h:
818         (WebCore::asColorComponents):
819         * platform/graphics/ImageBackingStore.h:
820         (WebCore::ImageBackingStore::blendPixel):
821         (WebCore::ImageBackingStore::pixelValue const):
822         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
823         (WebCore::makeSimpleColorFromARGBCFArray):
824         * platform/graphics/cg/ColorCG.cpp:
825         (WebCore::roundAndClampToSRGBALossy):
826         * platform/graphics/filters/FilterOperation.h:
827         * platform/graphics/mac/ColorMac.mm:
828         (WebCore::makeSimpleColorFromNSColor):
829         * platform/ios/ColorIOS.mm:
830         (WebCore::colorFromUIColor):
831
832 2021-02-11  Chris Dumez  <cdumez@apple.com>
833
834         Audio is sometimes distorted when using createMediaElementSource
835         https://bugs.webkit.org/show_bug.cgi?id=221553
836
837         Reviewed by Eric Carlson.
838
839         AudioSourceProviderAVFObjC::provideInput() was calculating the number of
840         frames available in the RingBuffer like so:
841         `endFrame - (m_readCount + writeAheadCount)`
842
843         The issue is that when writeAheadCount is greater than 0, (m_readCount + writeAheadCount)
844         can become greater than endFrame, causing us to end up with a super large number of
845         available frames. This can lead us to render garbage because we may be reading more
846         frames than available the RingBuffer.
847
848         I have also made a change in the case where rendering has already started were we ignore
849         writeAheadCount and render whatever we have in the RingBuffer. After we've started rendering,
850         deciding not to render because of writeAheadCount, even though there are available frames
851         in the RingBuffer, is really hurtful to user experience. This was reproducible on
852         https://www.waveplayer.info/createmediaelementsource-test/ where we would start rendering
853         for a bit, then output silence and then pick up rendering again (this time for good).
854
855         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
856         (WebCore::AudioSourceProviderAVFObjC::provideInput):
857
858 2021-02-11  Chris Lord  <clord@igalia.com>
859
860         Remove FontSelector dependence in CSSFontFace when creating a new FontFace wrapper
861         https://bugs.webkit.org/show_bug.cgi?id=221753
862
863         Reviewed by Myles C. Maxfield.
864
865         Add a parameter to the CSSFontFace-based FontFace constructor to allow
866         specifying the ScriptExecutionContext and therefore allow removal of
867         another dependence on m_fontSelector in CSSFontFace.
868
869         No new tests because there is no behavior change.
870
871         * css/CSSFontFace.cpp:
872         (WebCore::CSSFontFace::wrapper):
873         * css/CSSFontFace.h:
874         * css/FontFace.cpp:
875         (WebCore::FontFace::create):
876         (WebCore::FontFace::FontFace):
877         * css/FontFace.h:
878         * css/FontFaceSet.cpp:
879         (WebCore::FontFaceSet::Iterator::next):
880         (WebCore::FontFaceSet::load):
881
882 2021-02-11  Zalan Bujtas  <zalan@apple.com>
883
884         [LFC][IFC] Introduce dedicated logical rect getter for each inline level box type
885         https://bugs.webkit.org/show_bug.cgi?id=221725
886
887         Reviewed by Antti Koivisto.
888
889         This helps when different type of rects (margin vs. border) are returned for different type of boxes.
890
891         * layout/inlineformatting/InlineFormattingContext.cpp:
892         (WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
893         * layout/inlineformatting/InlineLineBox.cpp:
894         (WebCore::Layout::LineBox::logicalRectForTextRun const):
895         (WebCore::Layout::LineBox::logicalRectForLineBreakBox const):
896         (WebCore::Layout::LineBox::logicalRectForInlineLevelBox const):
897         (WebCore::Layout::LineBox::logicalMarginRectForAtomicInlineLevelBox const):
898         (WebCore::Layout::LineBox::logicalRectForInlineBox const):
899         (WebCore::Layout::LineBox::logicalMarginRectForInlineLevelBox const): Deleted.
900         * layout/inlineformatting/InlineLineBox.h:
901         * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
902         (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayNonRootInlineBoxes const):
903         * layout/layouttree/LayoutTreeBuilder.cpp:
904         (WebCore::Layout::showInlineTreeAndRuns):
905
906 2021-02-11  Zalan Bujtas  <zalan@apple.com>
907
908         [LFC][IFC] Inline boxes have incorrect content box height/width values
909         https://bugs.webkit.org/show_bug.cgi?id=221739
910
911         Reviewed by Antti Koivisto.
912
913         Do not include horizontal and vertical padding and borders when computing the content box size.
914
915         * layout/inlineformatting/InlineFormattingContext.cpp:
916         (WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
917         * layout/inlineformatting/InlineLineBox.cpp:
918         (WebCore::Layout::LineBox::logicalRectForInlineBox const):
919
920 2021-02-11  Sergio Villar Senin  <svillar@igalia.com>
921
922         Non unified build fixes for mid February 2021
923         https://bugs.webkit.org/show_bug.cgi?id=221749
924
925         Reviewed by Youenn Fablet.
926
927         * CMakeLists.txt:
928         * Modules/mediastream/SFrameUtils.cpp:
929         * Modules/mediastream/STUNMessageParsing.h:
930         * bindings/js/WebCoreBuiltinNames.h:
931         * dom/EventTargetFactory.in:
932         * inspector/InspectorFrontendAPIDispatcher.cpp:
933         (WebCore::InspectorFrontendAPIDispatcher::evaluateOrQueueExpression):
934         * workers/DedicatedWorkerGlobalScope.cpp:
935         * workers/Worker.cpp:
936
937 2021-02-11  Rob Buis  <rbuis@igalia.com>
938
939         Handle min-width/min-height:auto for aspect-ratio
940         https://bugs.webkit.org/show_bug.cgi?id=220582
941
942         Reviewed by Antti Koivisto.
943
944         Implement automatic minimum size [1] handling for aspect-ratio
945         as specified here [2].
946
947         [1] https://drafts.csswg.org/css-sizing-3/#automatic-minimum-size
948         [2] https://drafts.csswg.org/css-sizing-4/#aspect-ratio-minimum
949
950         * rendering/RenderBox.cpp:
951         (WebCore::RenderBox::constrainLogicalWidthInFragmentByMinMax const):
952         (WebCore::RenderBox::constrainLogicalHeightByMinMax const):
953         (WebCore::RenderBox::computePositionedLogicalWidthUsing const):
954         (WebCore::RenderBox::computePositionedLogicalHeight const):
955         (WebCore::RenderBox::computePositionedLogicalHeightUsing const):
956
957 2021-02-11  Myles C. Maxfield  <mmaxfield@apple.com>
958
959         Remove another use of FontSelector from within CSSFontFace
960         https://bugs.webkit.org/show_bug.cgi?id=221071
961
962         Reviewed by Darin Adler.
963
964         Instead of CSSFontFace directly knowing about CSSFontSelector, we can just make CSSFontSelector
965         inherit from CSSFontFace::Client.
966
967         Also, clean up the callback methods a little bit.
968
969         Tests: fast/text/font-loading-multiple-documents.html
970                fast/text/font-loading-multiple-sets.html
971
972         * css/CSSFontFace.cpp:
973         (WebCore::iterateClients):
974         (WebCore::CSSFontFace::CSSFontFace):
975         (WebCore::CSSFontFace::fontLoadEventOccurred):
976         (WebCore::CSSFontFace::updateStyleIfNeeded):
977         * css/CSSFontFace.h:
978         * css/CSSFontSelector.cpp:
979         (WebCore::CSSFontSelector::fontLoaded):
980         (WebCore::CSSFontSelector::fontStyleUpdateNeeded):
981         * css/CSSFontSelector.h:
982
983 2021-02-11  Ziran Sun  <zsun@igalia.com>
984
985         the nested grid container which has replaced item with 'max-height' has wrong width(0px).
986         https://bugs.webkit.org/show_bug.cgi?id=219194
987
988         Reviewed by Javier Fernandez.
989      
990         Width of a nested grid container with margin:auto returns 0 when their item has "max-height".
991         This causes the grid item's position wrong due to the wrongly comuputed auto-margin value.
992         This change is to check whether the preferred logical width is dirty when the grid area changes. 
993
994         It's a reland of r272338, which got reverted because it broken 
995         imported/w3c/web-platform-tests/css/css-sizing/percentage-height-in-flexbox.html on ios. This change
996         actually fixes the test failure in the flexbox test. Hence, updating test expectation file of
997         the flexbox test seems working.
998
999         This is an import of Chromium change at 
1000         https://chromium-review.googlesource.com/c/chromium/src/+/2503910
1001         This change also imported needsPreferredWidthsRecalculation() from Chromium to RenderReplaced to
1002         address the test case specified here.
1003         
1004         Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-auto-margin-and-replaced-item-001.html
1005
1006         * rendering/GridTrackSizingAlgorithm.cpp:
1007         (WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild const):
1008         (WebCore::GridTrackSizingAlgorithmStrategy::maxContentForChild const):
1009         * rendering/RenderReplaced.cpp:
1010         (WebCore::RenderReplaced::needsPreferredWidthsRecalculation const):
1011         * rendering/RenderReplaced.h:
1012
1013 2021-02-10  Jer Noble  <jer.noble@apple.com>
1014
1015         Move AudioHardwareListener into the GPU Process
1016         https://bugs.webkit.org/show_bug.cgi?id=221455
1017
1018         Reviewed by Eric Carlson.
1019
1020         Allow clients to override the creation method for AudioHardwareListener::create().
1021
1022         * platform/audio/AudioHardwareListener.cpp:
1023         (WebCore::audioHardwareListenerCreationFunction):
1024         (WebCore::AudioHardwareListener::setCreationFunction):
1025         (WebCore::AudioHardwareListener::resetCreationFunction):
1026         (WebCore::AudioHardwareListener::create):
1027         * platform/audio/AudioHardwareListener.h:
1028         * platform/audio/mac/AudioHardwareListenerMac.cpp:
1029         (WebCore::AudioHardwareListener::create): Deleted.
1030
1031 2021-02-10  Rob Buis  <rbuis@igalia.com>
1032
1033         Use event loop to set title
1034         https://bugs.webkit.org/show_bug.cgi?id=218496
1035
1036         Reviewed by Darin Adler.
1037
1038         Use event loop to set title to avoid calling WebFrameLoaderClient
1039         within HTMLTitleElement::insertedIntoAncestor.
1040
1041         * dom/Document.cpp:
1042         (WebCore::Document::updateTitle):
1043         * dom/Document.h:
1044         (WebCore::Document::titleWithDirection const):
1045         * loader/DocumentLoader.cpp:
1046         (WebCore::DocumentLoader::setTitle):
1047         * loader/EmptyClients.h:
1048         * page/Chrome.cpp:
1049         (WebCore::Chrome::print):
1050         * page/ChromeClient.h:
1051
1052 2021-02-10  Myles C. Maxfield  <mmaxfield@apple.com>
1053
1054         Move pal/spi/cocoa/CoreTextSPI.h to pal/spi/cf/CoreTextSPI.h
1055         https://bugs.webkit.org/show_bug.cgi?id=221683
1056
1057         Reviewed by Simon Fraser.
1058
1059         Core Text has a C API, and doesn't depend on UIKit/AppKit. It also exists on Windows,
1060         where there is no Cocoa. And pal/spi/cf already includes things like CoreAudioSPI.h
1061         and CoreVideoSPI.h
1062
1063         No new tests because there is no behavior change.
1064
1065         * platform/cocoa/DragImageCocoa.mm:
1066         * platform/graphics/Font.cpp:
1067         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1068         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
1069         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
1070         * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
1071         * platform/graphics/coretext/FontCascadeCoreText.cpp:
1072         * platform/graphics/coretext/FontCoreText.cpp:
1073         * platform/graphics/coretext/FontPlatformDataCoreText.cpp:
1074         * platform/graphics/coretext/GlyphPageCoreText.cpp:
1075         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
1076         * platform/graphics/mac/FontCustomPlatformData.cpp:
1077         * platform/graphics/mac/SimpleFontDataCoreText.cpp:
1078         * rendering/RenderThemeCocoa.mm:
1079         * rendering/RenderThemeIOS.mm:
1080         * testing/Internals.cpp:
1081
1082 2021-02-10  Ryosuke Niwa  <rniwa@webkit.org>
1083
1084         Reduce the overhead of DocumentFragment in innerHTML & outerHTML
1085         https://bugs.webkit.org/show_bug.cgi?id=221535
1086         <rdar://problem/73861015>
1087
1088         Reviewed by Geoffrey Garen.
1089
1090         This patch reduces the overhead of using DocumentFragment in innerHTMl and outerHTML setters by
1091         1. Cache DocumentFragment used for innerHTML and outerHTML.
1092         2. Adding a fast path to removeAllChildrenWithScriptAssertion when removing child nodes from (1)
1093         immediately before appending it to the new parent. This is safe for now since no DOM nodes or API
1094         store information about its root node or parent node when it's DocumentFragment, and and there
1095         are no node flags to be updated or invalidated since we're removing already-disconnected nodes
1096         to which no script ever had access up until this point. We release-assert these conditions before
1097         going into the fast path.
1098
1099         No new tests since there should be no observable behavior change.
1100
1101         * dom/ContainerNode.cpp:
1102         (WebCore::ContainerNode::removeAllChildrenWithScriptAssertion): Added a fast path. See above.
1103         * dom/Document.cpp:
1104         (WebCore::Document::commonTeardown): Clear m_documentFragmentForInnerOuterHTML as it would keep
1105         the ownewr document (this Document) alive otherwise.
1106         (WebCore::Document::documentFragmentForInnerOuterHTML): Added. Lazily create a DocumentFragment
1107         used to parse the fragment for innerHTML and outerHTML setters. Remove any child nodes left in
1108         the document fragment in the case the last call to replaceChildrenWithFragment took a fast path
1109         for a single text node, which case we don't remove any child nodes from DocumentFragment.
1110         * dom/Document.h:
1111         * dom/DocumentFragment.h:
1112         (WebCore::DocumentFragment::setIsDocumentFragmentForInnerOuterHTML): Added.
1113         * dom/Node.h:
1114         (WebCore::Node::isDocumentFragmentForInnerOuterHTML const): Added.
1115         * editing/markup.cpp:
1116         (WebCore::createFragmentForMarkup): Extracted from createFragmentForInnerOuterHTML to share code
1117         between createFragmentForInnerOuterHTML and createContextualFragment.
1118         (WebCore::createFragmentForInnerOuterHTML): Reuse the fragment in createFragmentForMarkup.
1119         (WebCore::createContextualFragment): Don't reuse the fragment in createFragmentForMarkup as this
1120         function is used by Range::createContextualFragment which exposes the document fragment to
1121         arbitrary author scripts.
1122         (WebCore::hasOneChild): Deleted since we now have Node::hasOneChild.
1123         (WebCore::hasOneTextChild): Use Node::hasOneChild.
1124         (WebCore::replaceChildrenWithFragment): Added assertions to make sure we don't have any child nodes
1125         left after replacing the children.
1126
1127 2021-02-10  Zalan Bujtas  <zalan@apple.com>
1128
1129         [LFC][IFC] Logical width of a line box is equal to the inner logical width of its containing block
1130         https://bugs.webkit.org/show_bug.cgi?id=221648
1131
1132         Reviewed by Antti Koivisto.
1133
1134         This is is used when horizontal scrolling is allowed (not supported atm).
1135
1136         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
1137         (WebCore::Layout::LineBoxBuilder::build):
1138         (WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
1139         * layout/inlineformatting/InlineLineBox.cpp:
1140         (WebCore::Layout::LineBox::LineBox):
1141         (WebCore::Layout::m_contentLogicalWidth):
1142         * layout/inlineformatting/InlineLineBox.h:
1143         (WebCore::Layout::LineBox::contentLogicalWidth const):
1144
1145 2021-02-10  David Kilzer  <ddkilzer@apple.com>
1146
1147         WebCore::genericFamily() should use checked_cf_cast<>
1148         <https://webkit.org/b/221521>
1149
1150         Reviewed by Sam Weinig.
1151
1152         * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
1153         (WebCore::genericFamily):
1154         - Switch from dynamic_cf_cast<> to checked_cf_cast<> because we
1155           always expect a CFStringRef type object to be returned from
1156           CTFontDescriptorCopyAttribute().
1157
1158 2021-02-10  Christopher Reid  <chris.reid@sony.com>
1159
1160         [PlayStation] Add initial RESOURCE_USAGE implementation
1161         https://bugs.webkit.org/show_bug.cgi?id=221706
1162
1163         Reviewed by Ross Kirsling.
1164
1165         Add initial RESOURCE_USAGE data for the inspector.
1166         CPU usage and total memory information is just stubbed out for now.
1167
1168         * PlatformPlayStation.cmake:
1169         * page/playstation/ResourceUsageOverlayPlayStation.cpp: Added.
1170         * page/playstation/ResourceUsageThreadPlayStation.cpp: Added.
1171
1172 2021-02-10  Peng Liu  <peng.liu6@apple.com>
1173
1174         Remove MediaSourcePrivateClient::monitorSourceBuffers()
1175         https://bugs.webkit.org/show_bug.cgi?id=220945
1176
1177         Reviewed by Youenn Fablet.
1178
1179         Remove MediaSourcePrivateClient::monitorSourceBuffers() for all ports except GStreamer
1180         port because MediaSourcePrivate does not call it. This patch also adds some log messages
1181         related to seeking.
1182
1183         No new tests, no functional change.
1184
1185         * Modules/mediasource/MediaSource.h:
1186         * html/HTMLMediaElement.cpp:
1187         (WebCore::HTMLMediaElement::seekWithTolerance):
1188         * platform/graphics/MediaSourcePrivateClient.h:
1189         * platform/graphics/SourceBufferPrivate.cpp:
1190         (WebCore::SourceBufferPrivate::appendCompleted):
1191         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
1192
1193 2021-02-10  Don Olmstead  <don.olmstead@sony.com>
1194
1195         Non-unified build fixes, early February 2021 edition
1196         https://bugs.webkit.org/show_bug.cgi?id=221701
1197
1198         Unreviewed non-unified build fixes.
1199
1200         * rendering/RenderImage.cpp:
1201
1202 2021-02-10  BJ Burg  <bburg@apple.com>
1203
1204         [Cocoa] Web Inspector: add support for evaluating script on the inspected page via _WKInspectorExtension
1205         https://bugs.webkit.org/show_bug.cgi?id=221567
1206         <rdar://71208534>
1207
1208         Reviewed by Devin Rousso.
1209
1210         This patch adds support for handling returned Promise values in an intelligent way.
1211         If a callback was supplied, then wait for the promise to settle and invoke the
1212         callback with its settled result. To support this, the dispatcher keeps a map of
1213         unfulfilled DOMPromises and the callback that is chained to the DOMPromise.
1214
1215         * inspector/InspectorFrontendAPIDispatcher.h:
1216         * inspector/InspectorFrontendAPIDispatcher.cpp:
1217         (WebCore::InspectorFrontendAPIDispatcher::~InspectorFrontendAPIDispatcher):
1218         (WebCore::InspectorFrontendAPIDispatcher::reset):
1219         Clear the pending responses map when destructing or resetting the dispatcher.
1220
1221         (WebCore::InspectorFrontendAPIDispatcher::frontendGlobalObject):
1222         Upgrade from JSGlobalObject to JSDOMGlobalObject, which is needed to call JSDOMPromise methods.
1223
1224         (WebCore::InspectorFrontendAPIDispatcher::evaluateOrQueueExpression):
1225         The meat of this patch. Chain a Function onto the JSDOMPromise. Inside the lambda function,
1226         try to look up and invoke the corresponding EvaluationResultHandler for this evaluation result.
1227
1228         (WebCore::InspectorFrontendAPIDispatcher::invalidatePendingResponses):
1229         Since these are CompletionHandlers we need to call them one way or another.
1230
1231 2021-02-10  Alexey Proskuryakov  <ap@apple.com>
1232
1233         Do not differentiate between Release and Production via ENABLE_DEVELOPER_MODE
1234         https://bugs.webkit.org/show_bug.cgi?id=221684
1235
1236         Reviewed by Sam Weinig.
1237
1238         It is invalid to create behaviors that are different between these. There is
1239         almost no difference in usage scenarios between build modes - either can be
1240         produced by CI for validation, either can be used for local testing, etc.
1241
1242         * Configurations/Base.xcconfig:
1243         * Configurations/DebugRelease.xcconfig:
1244         * html/HTMLMediaElement.cpp:
1245         (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
1246
1247 2021-02-10  Chris Dumez  <cdumez@apple.com>
1248
1249         WebCore::createBusFromInMemoryAudioFile() may crash under ExtAudioFileRead()
1250         https://bugs.webkit.org/show_bug.cgi?id=221642
1251         <rdar://72789841>
1252
1253         Reviewed by Geoffrey Garen.
1254
1255         The crash seems to indicate we are passing an AudioBufferList to ExtAudioFileRead()
1256         that contains a null buffer. It is not obvious how this is happening but I have made
1257         the following changes:
1258         1. createAudioBufferList() / destroyAudioListBuffer() implementation is now shared
1259            on both macOS and iOS. The implementation now uses fastCalloc and returns null
1260            in case of failure to allocate.
1261         2. createAudioBufferList() was renamed to tryCreateAudioBufferList() to make it clear
1262            it can return null. All call sites now properly deal with tryCreateAudioBufferList()
1263            potentially return null
1264         3. Add a new validateAudioBufferList() function which makes sure that the AudioBufferList
1265            we are about to pass to ExtAudioFileRead() does not contain any null buffer. In case
1266            of validation failure, we log an error, generate a simulated crash log and early return
1267            gracefully instead of crashing later on.
1268         4. Added more assertions to help catch bugs.
1269
1270         * SourcesCocoa.txt:
1271         * WebCore.xcodeproj/project.pbxproj:
1272         * platform/audio/cocoa/AudioFileReaderCocoa.cpp: Added.
1273         (WebCore::tryCreateAudioBufferList):
1274         (WebCore::destroyAudioBufferList):
1275         (WebCore::validateAudioBufferList):
1276         * platform/audio/cocoa/AudioFileReaderCocoa.h: Added.
1277         * platform/audio/ios/AudioFileReaderIOS.cpp:
1278         (WebCore::AudioFileReader::createBus):
1279         (WebCore::createAudioBufferList): Deleted.
1280         (WebCore::destroyAudioBufferList): Deleted.
1281         * platform/audio/mac/AudioFileReaderMac.cpp:
1282         (WebCore::AudioFileReader::createBus):
1283         (WebCore::createAudioBufferList): Deleted.
1284         (WebCore::destroyAudioBufferList): Deleted.
1285
1286 2021-02-10  Aditya Keerthi  <akeerthi@apple.com>
1287
1288         [iOS][FCR] Add reduced motion animation for indeterminate progress bars
1289         https://bugs.webkit.org/show_bug.cgi?id=221680
1290         <rdar://problem/74191515>
1291
1292         Reviewed by Wenson Hsieh.
1293
1294         The reduced motion animation for indeterminate progress bars is an
1295         opacity pulse from 30% to 60%.
1296
1297         * rendering/RenderThemeIOS.mm:
1298         (WebCore::RenderThemeIOS::paintProgressBarWithFormControlRefresh):
1299
1300 2021-02-10  Antti Koivisto  <antti@apple.com>
1301
1302         [LFC][Integration] Paint invalidation for inline element style changes
1303         https://bugs.webkit.org/show_bug.cgi?id=221669
1304
1305         Reviewed by Zalan Bujtas.
1306
1307         Test: fast/repaint/inline-style-change.html
1308
1309         Compute the repaint rect for RenderInline.
1310
1311         * layout/integration/LayoutIntegrationLineLayout.cpp:
1312         (WebCore::LayoutIntegration::LineLayout::visualOverflowBoundingBoxRectFor const):
1313         * layout/integration/LayoutIntegrationLineLayout.h:
1314         * rendering/RenderInline.cpp:
1315         (WebCore::RenderInline::linesVisualOverflowBoundingBox const):
1316         (WebCore::RenderInline::clippedOverflowRectForRepaint const):
1317
1318 2021-02-10  Chris Dumez  <cdumez@apple.com>
1319
1320         Unreviewed build fix.
1321
1322         Add missing header include.
1323
1324         * platform/gamepad/mac/GenericHIDGamepad.cpp:
1325
1326 2021-02-10  Myles C. Maxfield  <mmaxfield@apple.com>
1327
1328         REGRESSION(r263255): Text styles without an explicit language tag do not honor the system language
1329         https://bugs.webkit.org/show_bug.cgi?id=221598
1330         <rdar://problem/69194294>
1331
1332         Reviewed by Zalan Bujtas.
1333
1334         The distinction between NULL and CFSTR("") strikes again!
1335
1336         Test: fast/text/international/system-language/jp-circled.html
1337
1338         * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
1339         (WebCore::SystemFontDatabaseCoreText::createTextStyleFont):
1340
1341 2021-02-10  Zalan Bujtas  <zalan@apple.com>
1342
1343         [LFC][IFC] Pass in sane content width values to InlineContentBreaker
1344         https://bugs.webkit.org/show_bug.cgi?id=221628
1345         rdar://problem/73874164
1346
1347         Reviewed by Antti Koivisto.
1348
1349         Insanely large zoom value could produce Nan letter-spacing values.
1350         Let's tighten the inline content width values so that InlineContentBreaker can always expect valid InlineLayoutUnit values.
1351
1352         Test: fast/text/letter-spacing-produces-nan-width.html
1353
1354         * layout/inlineformatting/InlineContentBreaker.cpp:
1355         (WebCore::Layout::InlineContentBreaker::ContinuousContent::append):
1356         * layout/inlineformatting/text/TextUtil.cpp:
1357         (WebCore::Layout::TextUtil::width):
1358
1359 2021-02-10  Zalan Bujtas  <zalan@apple.com>
1360
1361         [LFC][IFC] Add inline box vertical border/padding to enclosing top and bottom
1362         https://bugs.webkit.org/show_bug.cgi?id=221647
1363
1364         Reviewed by Antti Koivisto.
1365
1366         While inline boxes (<span>) don't stretch the line box vertically with their paddings and borders,
1367         we need those boxes to be included in the enclosing top/bottom geometries.
1368         This is also in preparation for supporting inline box overflow scroll. 
1369
1370         * layout/inlineformatting/InlineFormattingContext.cpp:
1371         (WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
1372         * layout/integration/LayoutIntegrationCoverage.cpp:
1373
1374 2021-02-10  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1375
1376         [GStreamer] Make m_client WeakPtr in AudioSourceProviderGStreamer
1377         https://bugs.webkit.org/show_bug.cgi?id=217952
1378
1379         Reviewed by Carlos Garcia Campos.
1380
1381         * platform/audio/AudioSourceProviderClient.h: Turned into
1382         CanMakeWeakPtr.
1383         * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
1384         (WebCore::AudioSourceProviderGStreamer::setClient): Adapt to use
1385         WeakPtr.
1386         * platform/audio/gstreamer/AudioSourceProviderGStreamer.h: Turned
1387         m_client into WeakPtr.
1388
1389 2021-02-10  Carlos Garcia Campos  <cgarcia@igalia.com>
1390
1391         [SOUP] Simplify ResourceRequest and ResourceResponse
1392         https://bugs.webkit.org/show_bug.cgi?id=221543
1393
1394         Reviewed by Adrian Perez de Castro.
1395
1396         There's unused code there and it can be refactored.
1397
1398         - ResourceRequest:
1399           - Remove unused member m_soupFlags.
1400           - Remove updateSoupMessage() that is always called after a SoupMessage has been created and add
1401             createSoupMessage() to return a new SoupMessage.
1402           - Set the message priority in the createSoupMessage() too.
1403           - Remove updateFromSoupMessage() that is curently used only by WebSockets to update the request headers after
1404             the request is sent to include cookies and other headers set by libsoup. We can simply use
1405             updateFromSoupMessageHeaders() for that case instead.
1406
1407         - ResourceResponse:
1408           - Remove unused member m_soupFlags.
1409           - Remove updateFromSoupMessage() that is always used with a newly created ResourceResponse and use the
1410             ResourceResponse constructor that receives a SoupMessage instead.
1411           - Sniffed content type is now received as an optional parameter of the ResourceResponse constructor that
1412             receives a SoupMessage, and used to set the MIME type and text encoding.
1413           - Remove unused certificate info getters and the encode/decode methods that are no longer needed.
1414
1415         * platform/network/soup/ResourceRequest.h:
1416         (WebCore::ResourceRequest::encodeWithPlatformData const):
1417         (WebCore::ResourceRequest::decodeWithPlatformData):
1418         * platform/network/soup/ResourceRequestSoup.cpp:
1419         (WebCore::toSoupMessagePriority):
1420         (WebCore::ResourceRequest::createSoupMessage const):
1421         * platform/network/soup/ResourceResponse.h:
1422         (WebCore::ResourceResponse::ResourceResponse):
1423         (WebCore::ResourceResponse::soupMessageCertificate const):
1424         (WebCore::ResourceResponse::soupMessageTLSErrors const):
1425         * platform/network/soup/ResourceResponseSoup.cpp:
1426         (WebCore::ResourceResponse::ResourceResponse):
1427         (WebCore::ResourceResponse::updateSoupMessageHeaders const):
1428         (WebCore::ResourceResponse::updateFromSoupMessageHeaders):
1429
1430 2021-02-10  Rob Buis  <rbuis@igalia.com>
1431
1432         Do not schedule update on embed creation
1433         https://bugs.webkit.org/show_bug.cgi?id=221375
1434
1435         Reviewed by Ryosuke Niwa.
1436
1437         Do not schedule update on embed creation.
1438
1439         Test: plugins/embed-creation-crash.html
1440
1441         * html/HTMLEmbedElement.cpp:
1442         (WebCore::HTMLEmbedElement::create):
1443         * html/HTMLObjectElement.cpp:
1444         (WebCore::HTMLObjectElement::create):
1445         * html/HTMLPlugInImageElement.cpp:
1446         (WebCore::HTMLPlugInImageElement::finishCreating): Deleted.
1447         * html/HTMLPlugInImageElement.h:
1448
1449 2021-02-09  Eric Carlson  <eric.carlson@apple.com>
1450
1451         REGRESSION: (r272458): [BigSur Debug] ASSERTION FAILED: m_haveAddedMediaUsageManagerSession in WebCore::MediaElementSession::updateMediaUsageIfChanged()
1452         https://bugs.webkit.org/show_bug.cgi?id=221634
1453         <rdar://problem/74161017>
1454
1455         Reviewed by Ryosuke Niwa.
1456
1457         No new tests, this fixes an assertion in an existing test.
1458
1459         * html/MediaElementSession.cpp:
1460         (WebCore::MediaElementSession::MediaElementSession):
1461         (WebCore::MediaElementSession::addMediaUsageManagerSessionIfNecessary):
1462         (WebCore::MediaElementSession::inActiveDocumentChanged):
1463         (WebCore::MediaElementSession::updateMediaUsageIfChanged):
1464         (WebCore::MediaElementSession::addedMediaUsageManagerSessionIfNecessary): Deleted.
1465         * html/MediaElementSession.h:
1466
1467 2021-02-09  Don Olmstead  <don.olmstead@sony.com>
1468
1469         [GTK] Export additional methods of SourceBufferPrivate to support hidden visibility
1470         https://bugs.webkit.org/show_bug.cgi?id=221625
1471
1472         Reviewed by Michael Catanzaro.
1473
1474         Add additional WEBCORE_EXPORTs to SourceBufferPrivate that were found when linking GTK with
1475         hidden visibility turned on.
1476
1477         * platform/graphics/SourceBufferPrivate.h:
1478         (WebCore::SourceBufferPrivate::removeCodedFrames):
1479
1480 2021-02-09  Devin Rousso  <drousso@apple.com>
1481
1482         [iOS] Add support for the language/subtitle tracks button using `UIMenu`
1483         https://bugs.webkit.org/show_bug.cgi?id=221594
1484         <rdar://problem/74129129>
1485
1486         Reviewed by Eric Carlson and Wenson Hsieh.
1487
1488         Tests: media/modern-media-controls/tracks-support/ios/tracks-support-auto-text-track.html
1489                media/modern-media-controls/tracks-support/ios/tracks-support-click-track-in-contextmenu.html
1490                media/modern-media-controls/tracks-support/ios/tracks-support-hidden-tracks.html
1491                media/modern-media-controls/tracks-support/ios/tracks-support-off-text-track.html
1492                media/modern-media-controls/tracks-support/ios/tracks-support-show-contextmenu-then-double-click-on-tracks-button.html
1493                media/modern-media-controls/tracks-support/ios/tracks-support-text-track-selected-via-media-api.html
1494                media/modern-media-controls/tracks-support/mac/tracks-support-auto-text-track.html
1495                media/modern-media-controls/tracks-support/mac/tracks-support-click-track-in-panel.html
1496                media/modern-media-controls/tracks-support/mac/tracks-support-hidden-tracks.html
1497                media/modern-media-controls/tracks-support/mac/tracks-support-off-text-track.html
1498                media/modern-media-controls/tracks-support/mac/tracks-support-show-and-populate-panel.html
1499                media/modern-media-controls/tracks-support/mac/tracks-support-show-panel-after-dragging-controls.html
1500                media/modern-media-controls/tracks-support/mac/tracks-support-show-panel-fullscreen.html
1501                media/modern-media-controls/tracks-support/mac/tracks-support-show-panel-then-double-click-on-tracks-button.html
1502                media/modern-media-controls/tracks-support/mac/tracks-support-text-track-selected-via-media-api.html
1503
1504         * page/MediaControlsContextMenuItem.h: Added.
1505         (WebCore::MediaControlsContextMenuItem::encode const):
1506         (WebCore::MediaControlsContextMenuItem::decode):
1507         Simple POD object for sending data from the WebProcess to the UIProcess for the `UIMenu`.
1508
1509         * Modules/modern-media-controls/media/tracks-support.js:
1510         (TracksSupport.prototype.buttonWasPressed):
1511         (TracksSupport.prototype.syncControl):
1512         * Modules/mediacontrols/MediaControlsHost.idl:
1513         * Modules/mediacontrols/MediaControlsHost.h:
1514         * Modules/mediacontrols/MediaControlsHost.cpp:
1515         (WebCore::MediaControlsHost::showMediaControlsContextMenu): Added.
1516         * page/ChromeClient.h:
1517         (WebCore::ChromeClient::showMediaControlsContextMenu):
1518         Provide a host hook for generating and sending the `UIMenu` data. When a `UIAction` is
1519         selected or the menu is dismissed, the relevant `MediaControlsContextMenuItem::ID` is sent
1520         back as the response to the async message and is used to perform the action related to the
1521         type of the object (e.g. `AudioTrack`, `TextTrack`, etc.) that was previously associated
1522         with that `MediaControlsContextMenuItem::ID`.
1523
1524         * en.lproj/Localizable.strings:
1525         * platform/LocalizedStrings.h:
1526         * platform/LocalizedStrings.cpp:
1527         (WebCore::textTrackSubtitlesText): Deleted.
1528         Add localizable strings for "Languages" and "Subtitles" headers/submenus.
1529
1530         * Headers.cmake:
1531         * WebCore.xcodeproj/project.pbxproj:
1532
1533 2021-02-09  Andres Gonzalez  <andresg_22@apple.com>
1534
1535         Descendants of row and column headers should expose the aria-sort attribute.
1536         https://bugs.webkit.org/show_bug.cgi?id=221590
1537
1538         Reviewed by Chris Fleizach.
1539
1540         Tests:
1541         accessibility/aria-sort.html
1542         accessibility/ios-simulator/aria-sort-ios.html
1543
1544         Walk up the accessibility hierarchy to check for an inherited aria-sort
1545         attribute present in a row or column header ancestor.
1546
1547         * accessibility/AccessibilityObject.cpp:
1548         (WebCore::AccessibilityObject::sortDirection const):
1549
1550 2021-02-09  Peng Liu  <peng.liu6@apple.com>
1551
1552         [GPUP] Run ImageDecoderAVFObjC in the GPU Process
1553         https://bugs.webkit.org/show_bug.cgi?id=221317
1554
1555         Reviewed by Jer Noble.
1556
1557         Modify `ImageDecoder` and `ImageDecoderAVFObjC` classes in order to run `ImageDecoderAVFObjC`
1558         in the GPU process.
1559         - Add install/reset factory methods to `ImageDecoder` class.
1560         - Add a struct `FrameInfo`.
1561         - Export some methods of `ImageDecoderAVFObjC` to WebKit.
1562
1563         * WebCore.xcodeproj/project.pbxproj:
1564         * platform/graphics/ImageDecoder.cpp:
1565         (WebCore::platformRegisterFactories):
1566         (WebCore::installedFactories):
1567         (WebCore::ImageDecoder::installFactory):
1568         (WebCore::ImageDecoder::resetFactories):
1569         (WebCore::ImageDecoder::clearFactories):
1570         (WebCore::ImageDecoder::create):
1571         (WebCore::ImageDecoder::supportsMediaType):
1572         * platform/graphics/ImageDecoder.h:
1573         (WebCore::ImageDecoder::FrameInfo::encode const):
1574         (WebCore::ImageDecoder::FrameInfo::decode):
1575         * platform/graphics/ImageDecoderIdentifier.h: Added.
1576         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
1577         (WebCore::ImageDecoderAVFObjC::hasTrack const):
1578         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
1579         (WebCore::ImageDecoderAVFObjC::frameInfos const):
1580         (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex):
1581         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
1582         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
1583         (WebCore::WebCoreDecompressionSession::ensureDecompressionSessionForSample):
1584         Update the attribute so that we can create an IOSurface from a decoded frame.
1585
1586 2021-02-09  Ryosuke Niwa  <rniwa@webkit.org>
1587
1588         Reduce the overhead of HTMLDocumentParser in innerHTML setter
1589         https://bugs.webkit.org/show_bug.cgi?id=221596
1590
1591         Reviewed by Simon Fraser.
1592
1593         This patch reduces the overhead of HTMLDocumentParser for innerHTML.
1594         This appears to be ~0.5% Speedometer progression.
1595
1596         No new tests since there should be no observable behavior differences.
1597
1598         * dom/ScriptableDocumentParser.h:
1599         (WebCore::ScriptableDocumentParser:isWaitingForScripts): Removed since this abstract
1600         virtual function is only used in HTMLDocumentParser.
1601         * html/FTPDirectoryDocument.cpp:
1602         (WebCore::FTPDirectoryDocument::isWaitingForScripts): Removed. There are no scripts
1603         in ftp directory document but there is no need to override it here.
1604         * html/parser/HTMLDocumentParser.cpp:
1605         (WebCore::HTMLDocumentParser::pumpTokenizer): Exit early when we're parsing a fragment
1606         to avoid accessing the scheduler, preloader, and document loader for various things
1607         since they're all irrelevant for fragment parsing.
1608         (WebCore::HTMLDocumentParser::isWaitingForScripts const): Return false immediately when
1609         parsing a document fragment as a fast path.
1610         * html/parser/HTMLDocumentParser.h:
1611         * xml/parser/XMLDocumentParser.cpp:
1612         (WebCore::XMLDocumentParser::isWaitingForScripts const): Removed. Unused.
1613         * xml/parser/XMLDocumentParser.h:
1614
1615 2021-02-09  Chris Dumez  <cdumez@apple.com>
1616
1617         Rename SecurityOrigin's canAccess() to isSameOriginDomain() to match HTML specification naming
1618         https://bugs.webkit.org/show_bug.cgi?id=221630
1619
1620         Reviewed by Geoffrey Garen.
1621
1622         Rename SecurityOrigin's canAccess() to isSameOriginDomain() to match HTML specification naming:
1623         - https://html.spec.whatwg.org/#same-origin-domain
1624
1625         * bindings/js/JSDOMBindingSecurity.cpp:
1626         (WebCore::canAccessDocument):
1627         * bindings/js/ScriptController.cpp:
1628         (WebCore::ScriptController::canAccessFromCurrentOrigin):
1629         (WebCore::ScriptController::executeJavaScriptURL):
1630         * dom/Document.cpp:
1631         (WebCore::canAccessAncestor):
1632         (WebCore::Document::supportsPaintTiming const):
1633         (WebCore::Document::domTimerAlignmentInterval const):
1634         (WebCore::Document::isNavigationBlockedByThirdPartyIFrameRedirectBlocking):
1635         (WebCore::Document::initContentSecurityPolicy):
1636         (WebCore::Document::requestAnimationFrame):
1637         (WebCore::Document::updateIntersectionObservations):
1638         * dom/Element.cpp:
1639         (WebCore::Element::focus):
1640         * dom/SecurityContext.cpp:
1641         (WebCore::SecurityContext::isSecureTransitionTo const):
1642         * dom/UserGestureIndicator.cpp:
1643         (WebCore::UserGestureToken::UserGestureToken):
1644         * html/HTMLFormControlElement.cpp:
1645         (WebCore::shouldAutofocus):
1646         * html/HTMLPlugInImageElement.cpp:
1647         (WebCore::HTMLPlugInImageElement::canLoadURL const):
1648         * loader/DocumentLoader.cpp:
1649         (WebCore::shouldUseActiveServiceWorkerFromParent):
1650         * loader/DocumentWriter.cpp:
1651         (WebCore::canReferToParentFrameEncoding):
1652         * loader/FrameLoader.cpp:
1653         (WebCore::FrameLoader::dispatchBeforeUnloadEvent):
1654         * loader/LinkLoader.cpp:
1655         (WebCore::LinkLoader::preconnectIfNeeded):
1656         * loader/ResourceLoadInfo.cpp:
1657         (WebCore::ContentExtensions::ResourceLoadInfo::isThirdParty const):
1658         * page/DOMWindow.cpp:
1659         (WebCore::DOMWindow::alert):
1660         (WebCore::DOMWindow::confirmForBindings):
1661         (WebCore::DOMWindow::prompt):
1662         (WebCore::DOMWindow::isSameSecurityOriginAsMainFrame const):
1663         (WebCore::DOMWindow::crossDomainAccessErrorMessage):
1664         (WebCore::DOMWindow::isInsecureScriptAccess):
1665         * page/FrameView.cpp:
1666         (WebCore::FrameView::safeToPropagateScrollToParent const):
1667         * page/Location.cpp:
1668         (WebCore::Location::reload):
1669         * page/SecurityOrigin.cpp:
1670         (WebCore::SecurityOrigin::isSameOriginDomain const):
1671         (WebCore::SecurityOrigin::canReceiveDragData const):
1672         (WebCore::SecurityOrigin::canAccess const): Deleted.
1673         * page/SecurityOrigin.h:
1674         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1675         (WebCore::MediaPlayerPrivateGStreamer::wouldTaintOrigin const):
1676         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1677         (webKitSrcWouldTaintOrigin):
1678         * platform/network/cocoa/WebCoreNSURLSession.mm:
1679         (-[WebCoreNSURLSession wouldTaintOrigin:]):
1680         * rendering/RenderWidget.cpp:
1681         (WebCore::RenderWidget::paintContents):
1682
1683 2021-02-09  Devin Rousso  <drousso@apple.com>
1684
1685         [Cocoa] rename `ENGINEERING_BUILD` to `ENABLE_DEVELOPER_MODE` to match other platforms
1686         https://bugs.webkit.org/show_bug.cgi?id=221621
1687
1688         Reviewed by Michael Catanzaro.
1689
1690         * Configurations/Base.xcconfig:
1691         * Configurations/DebugRelease.xcconfig:
1692         (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
1693
1694 2021-02-09  Simon Fraser  <simon.fraser@apple.com>
1695
1696         Change release log to mention IOSurface
1697         https://bugs.webkit.org/show_bug.cgi?id=221629
1698
1699         Reviewed by Tim Horton.
1700
1701         It's more memorable to search logs for "IOSurface".
1702
1703         * platform/graphics/cocoa/IOSurface.mm:
1704         (WebCore::IOSurface::IOSurface):
1705
1706 2021-02-09  Eric Carlson  <eric.carlson@apple.com>
1707
1708         [macOS] Add internal preference to control how AVOutputContext is allocated
1709         https://bugs.webkit.org/show_bug.cgi?id=221583
1710         <rdar://73830632>
1711
1712         Reviewed by Jer Noble.
1713
1714         No new tests, this can only be tested manually.
1715
1716         * Modules/airplay/WebMediaSessionManager.cpp:
1717         (WebCore::WebMediaSessionManager::showPlaybackTargetPicker):
1718         * Modules/airplay/WebMediaSessionManagerClient.h:
1719         (WebCore::WebMediaSessionManagerClient::alwaysOnLoggingAllowed const):
1720         (WebCore::WebMediaSessionManagerClient::useiTunesAVOutputContext const):
1721         (WebCore::WebMediaSessionManagerClient::alwaysOnLoggingAllowed): Deleted.
1722         * platform/graphics/MediaPlaybackTargetPicker.cpp:
1723         (WebCore::MediaPlaybackTargetPicker::showPlaybackTargetPicker):
1724         * platform/graphics/MediaPlaybackTargetPicker.h:
1725         * platform/graphics/avfoundation/objc/AVOutputDeviceMenuControllerTargetPicker.h:
1726         * platform/graphics/avfoundation/objc/AVOutputDeviceMenuControllerTargetPicker.mm:
1727         (WebCore::AVOutputDeviceMenuControllerTargetPicker::showPlaybackTargetPicker):
1728         * platform/graphics/avfoundation/objc/AVPlaybackTargetPicker.h:
1729         * platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.h:
1730         * platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.mm:
1731         (WebCore::AVRoutePickerViewTargetPicker::outputContextInternal):
1732         (WebCore::AVRoutePickerViewTargetPicker::showPlaybackTargetPicker):
1733         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h:
1734         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
1735         (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker):
1736         * platform/mock/MediaPlaybackTargetPickerMock.cpp:
1737         (WebCore::MediaPlaybackTargetPickerMock::showPlaybackTargetPicker):
1738         * platform/mock/MediaPlaybackTargetPickerMock.h:
1739
1740 2021-02-09  Martin Robinson  <mrobinson@webkit.org>
1741
1742         Implement scroll-snap-stop for scroll snapping
1743         https://bugs.webkit.org/show_bug.cgi?id=197744
1744         <rdar://problem/50708356>
1745
1746         Reviewed by Simon Fraser.
1747
1748         No new tests. This is tested by existing, imported WPT tests:
1749             imported/w3c/web-platform-tests/css/css-scroll-snap/inheritance-expected.txt:
1750             imported/w3c/web-platform-tests/css/css-scroll-snap/parsing/scroll-snap-stop-computed-expected.txt:
1751             imported/w3c/web-platform-tests/css/css-scroll-snap/parsing/scroll-snap-stop-valid-expected.txt:
1752             imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-snap-stop-change-expected.txt:
1753             imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-snap-stop-expected.txt:
1754             imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-snap-type-on-root-element-expected.txt:
1755
1756         * css/CSSComputedStyleDeclaration.cpp:
1757         (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): Add support the new CSS property.
1758         * css/CSSPrimitiveValueMappings.h:
1759         (WebCore::CSSPrimitiveValue::operator ScrollSnapAxisAlignType const): Ditto.
1760         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Ditto.
1761         (WebCore::CSSPrimitiveValue::operator ScrollSnapStop const): ditto.
1762         * css/CSSProperties.json: Ditto.
1763         * css/parser/CSSPropertyParser.cpp:
1764         (WebCore::CSSPropertyParser::parseSingleValue): Ditto.
1765         * page/scrolling/ScrollSnapOffsetsInfo.cpp:
1766         (WebCore::indicesOfNearestSnapOffsets): Update to accept SnapOffset instead of a raw
1767         value.
1768         (WebCore::findFirstSnapStopOffsetBetweenOriginAndDestination): Added this helper which looks
1769         between the scroll origin and destination to find a candidate scroll offset with ScrollSnapStop::Always.
1770         This offset will always be chosen for directional scrolls.
1771         (WebCore::closestSnapOffsetWithOffsetsAndRanges): Use new helper to find offsets with ScrollSnapStop::Always.
1772         (WebCore::computeAxisProximitySnapOffsetRanges): Deal with SnapOffset instead of raw values.
1773         (WebCore::updateSnapOffsetsForScrollableArea): Ditto.
1774         (WebCore::convertOffsetInfo): Ditto.
1775         * page/scrolling/ScrollSnapOffsetsInfo.h:
1776         (WebCore::ScrollSnapOffsetsInfo::offsetsForAxis const): Ditto.
1777         (WebCore::operator<<): Consolidated all TextStream implementations here instead of repeating
1778         them throughout the code.
1779         * platform/ScrollableArea.cpp:
1780         (WebCore::ScrollableArea::setScrollSnapOffsetInfo): Set the scroll snap offset info all at once.
1781         (WebCore::ScrollableArea::clearSnapOffsets): We no longer clear horizontal and vertical offsets separately.
1782         (WebCore::ScrollableArea::nearestActiveSnapPoint): Access the offset value.
1783         * platform/ScrollableArea.h:
1784         * platform/cocoa/ScrollController.mm:
1785         (WebCore::ScrollController::setNearestScrollSnapIndexForAxisAndOffset): Ditto.
1786         * platform/cocoa/ScrollSnapAnimatorState.h:
1787         (WebCore::ScrollSnapAnimatorState::snapOffsetsForAxis const): Deal with SnapOffsets instead of raw values.
1788         (WebCore::ScrollSnapAnimatorState::setSnapOffsetsAndPositionRangesForAxis): Ditto.
1789         * platform/cocoa/ScrollSnapAnimatorState.mm:
1790         * rendering/RenderLayerModelObject.cpp:
1791         (WebCore::RenderLayerModelObject::styleDidChange): Update scroll snap information when the `scroll-snap-stop`
1792         property changes. Also ensure that we update everything for FrameView's instead of only some properties.
1793         * rendering/style/RenderStyle.cpp:
1794         (WebCore::RenderStyle::initialScrollSnapStop): Added for new CSS property.
1795         (WebCore::RenderStyle::scrollSnapStop const): Ditto.
1796         (WebCore::RenderStyle::setScrollSnapStop): Ditto.
1797         * rendering/style/RenderStyle.h:
1798         * rendering/style/RenderStyleConstants.cpp:
1799         (WebCore::operator<<): Ditto.
1800         * rendering/style/RenderStyleConstants.h:
1801         * rendering/style/StyleRareNonInheritedData.h:
1802         * style/StyleBuilderConverter.h:
1803         (WebCore::Style::BuilderConverter::convertScrollSnapStop): Ditto.
1804         * testing/Internals.cpp:
1805         (WebCore::appendOffsets): Handle the case where we are printing an offset with ScrollSnapStop::Always.
1806
1807 2021-02-09  Chris Dumez  <cdumez@apple.com>
1808
1809         Disallow alert/confirm/prompt in cross-origin-domain subframes
1810         https://bugs.webkit.org/show_bug.cgi?id=221568
1811
1812         Reviewed by Geoff Garen.
1813
1814         Disallow alert/confirm/prompt in cross-origin-domain subframes as per the latest HTML specification:
1815         - https://github.com/whatwg/html/pull/6297
1816
1817         Tests: http/tests/security/cross-origin-js-prompt-forbidden.html
1818                http/tests/security/same-origin-different-domain-js-prompt-forbidden.html
1819
1820         * page/DOMWindow.cpp:
1821         (WebCore::DOMWindow::alert):
1822         (WebCore::DOMWindow::confirmForBindings):
1823         (WebCore::DOMWindow::prompt):
1824         * page/SecurityOrigin.cpp:
1825         * page/SecurityOrigin.h:
1826
1827 2021-02-09  Alex Christensen  <achristensen@webkit.org>
1828
1829         Synthesize range responses if needed in WebCoreNSURLSession
1830         https://bugs.webkit.org/show_bug.cgi?id=221072
1831
1832         Reviewed by Geoff Garen.
1833
1834         When we make a media request with a Range HTTP header field and the server doesn't respond with a 206 with Content-Range header field,
1835         until now we would just fail to play the video.  In order to successfully play these videos, I introduce the RangeResponseGenerator class,
1836         which will receive the data for a request for such a video and feed the data into WebCoreNSURLSession as the requested ranges are received.
1837         Seeking is problematic, but at least we will try our best to play the video.
1838
1839         I added API tests that try to play a video that didn't play before using a server that doesn't support range requests.  Manual verification is also necessary.
1840
1841         * Sources.txt:
1842         * SourcesCocoa.txt:
1843         * WebCore.xcodeproj/project.pbxproj:
1844         * platform/graphics/PlatformMediaResourceLoader.h:
1845         (WebCore::PlatformMediaResource::setClient):
1846         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
1847         (WebCore::PlatformResourceMediaLoader::create):
1848         * platform/network/ParsedRequestRange.cpp: Added.
1849         (WebCore::ParsedRequestRange::parse):
1850         * platform/network/ParsedRequestRange.h: Added.
1851         (WebCore::ParsedRequestRange::begin const):
1852         (WebCore::ParsedRequestRange::end const):
1853         (WebCore::ParsedRequestRange::ParsedRequestRange):
1854         * platform/network/cocoa/RangeResponseGenerator.h: Added.
1855         * platform/network/cocoa/RangeResponseGenerator.mm: Added.
1856         (WebCore::RangeResponseGenerator::Data::Data):
1857         (WebCore::RangeResponseGenerator::Data::TaskData::TaskData):
1858         (WebCore::synthesizedResponseForRange):
1859         (WebCore::RangeResponseGenerator::removeTask):
1860         (WebCore::RangeResponseGenerator::giveResponseToTaskIfBytesInRangeReceived):
1861         (WebCore::RangeResponseGenerator::expectedContentLengthFromData):
1862         (WebCore::RangeResponseGenerator::giveResponseToTasksWithFinishedRanges):
1863         (WebCore::RangeResponseGenerator::willHandleRequest):
1864         (WebCore::RangeResponseGenerator::willSynthesizeRangeResponses):
1865         * platform/network/cocoa/WebCoreNSURLSession.h:
1866         * platform/network/cocoa/WebCoreNSURLSession.mm:
1867         (-[WebCoreNSURLSession rangeResponseGenerator]):
1868         (-[WebCoreNSURLSession dataTaskWithURL:]):
1869         (WebCore::WebCoreNSURLSessionDataTaskClient::dataSent):
1870         (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived):
1871         (WebCore::WebCoreNSURLSessionDataTaskClient::shouldCacheResponse):
1872         (WebCore::WebCoreNSURLSessionDataTaskClient::dataReceived):
1873         (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived):
1874         (WebCore::WebCoreNSURLSessionDataTaskClient::accessControlCheckFailed):
1875         (WebCore::WebCoreNSURLSessionDataTaskClient::loadFailed):
1876         (WebCore::WebCoreNSURLSessionDataTaskClient::loadFinished):
1877         (-[WebCoreNSURLSessionDataTask _restart]):
1878         (-[WebCoreNSURLSessionDataTask _finish]):
1879         (-[WebCoreNSURLSessionDataTask resource:sentBytes:totalBytesToBeSent:]):
1880         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:completionHandler:]):
1881         (-[WebCoreNSURLSessionDataTask resource:shouldCacheResponse:]):
1882         (-[WebCoreNSURLSessionDataTask resource:receivedData:length:]):
1883         (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:completionHandler:]):
1884         (-[WebCoreNSURLSessionDataTask _resource:loadFinishedWithError:metrics:]):
1885         (-[WebCoreNSURLSessionDataTask resource:accessControlCheckFailedWithError:]):
1886         (-[WebCoreNSURLSessionDataTask resource:loadFailedWithError:]):
1887         (-[WebCoreNSURLSessionDataTask resourceFinished:metrics:]):
1888         (-[WebCoreNSURLSessionDataTask initWithSession:identifier:URL:]): Deleted.
1889
1890 2021-02-09  Zalan Bujtas  <zalan@apple.com>
1891
1892         [LFC][IFC] Disable BIDI processing for modern line layout
1893         https://bugs.webkit.org/show_bug.cgi?id=221615
1894
1895         Reviewed by Sam Weinig.
1896
1897         This was added in preparation for BIDI content support but we are not there yet. Let's just disable it for now.
1898
1899         * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
1900         (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLineRuns const):
1901
1902 2021-02-09  Zalan Bujtas  <zalan@apple.com>
1903
1904         [LFC][Integration] Style change on an inline box should trigger invalidation
1905         https://bugs.webkit.org/show_bug.cgi?id=221573
1906
1907         Reviewed by Antti Koivisto.
1908
1909         Invalidate the line layout path when the inline box (RenderInline) needs layout.
1910         e.g. the font-family property change in imported/w3c/web-platform-tests/css/css-fonts/generic-family-keywords-001.html
1911         (This is sadly a full invalidation at this point.)
1912
1913         * rendering/RenderInline.cpp:
1914         (WebCore::RenderInline::styleDidChange):
1915
1916 2021-02-09  Aditya Keerthi  <akeerthi@apple.com>
1917
1918         [iOS][FCR] Use UIColorPickerViewController for color inputs
1919         https://bugs.webkit.org/show_bug.cgi?id=221572
1920         <rdar://problem/72183130>
1921
1922         Reviewed by Sam Weinig.
1923
1924         * html/HTMLInputElement.h:
1925
1926         Export function so it can be called from WebKit layer.
1927
1928 2021-02-09  Eric Carlson  <eric.carlson@apple.com>
1929
1930         [Mac] Connect MediaSession with MediaRemote and NowPlaying
1931         https://bugs.webkit.org/show_bug.cgi?id=221431
1932         <rdar://problem/74000363>
1933
1934         Unreviewed, fix a layout test assert.
1935
1936         * Modules/mediasession/MediaSession.cpp:
1937         (WebCore::platformCommandForMediaSessionAction): Map "skipad" to "nexttrack".
1938         (WebCore::MediaSession::setActionHandler): Don't try to register media session actions
1939         for which there is no platform command.
1940
1941 2021-02-09  Youenn Fablet  <youenn@apple.com>
1942
1943         MediaStream-backed video elements should not compute the mediaType based on track muted states
1944         https://bugs.webkit.org/show_bug.cgi?id=221601
1945
1946         Reviewed by Eric Carlson.
1947
1948         In case of entering background, two things happen:
1949         - video elements get paused
1950         - local video capture track gets muted
1951         When entering foreground:
1952         - video element should resume but did not as the local video track was muted and video element was considered as an audio element.
1953         - local video capture track gets unmuted but this is too late.
1954         To fix this, compute hasVideo/hasAudio based on available tracks, no matter their active state.
1955
1956         Test: fast/mediastream/MediaStream-video-element-enter-background.html
1957
1958         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1959         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::hasVideo const):
1960         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::hasAudio const):
1961
1962 2021-02-09  Zalan Bujtas  <zalan@apple.com>
1963
1964         [LFC][IFC] canUseForText should also check if the space glyph comes from the primary font
1965         https://bugs.webkit.org/show_bug.cgi?id=221592
1966
1967         Reviewed by Antti Koivisto.
1968
1969         Currently all the glyphs in the content have to come from the primary font, including the space.
1970         (see fast/text/multiple-feature-properties.html)
1971
1972         * layout/integration/LayoutIntegrationCoverage.cpp:
1973         (WebCore::LayoutIntegration::canUseForText):
1974
1975 2021-02-09  Zalan Bujtas  <zalan@apple.com>
1976
1977         [LFC][IFC] Remove misleading TextUtil::fixedPitchWidth
1978         https://bugs.webkit.org/show_bug.cgi?id=221581
1979
1980         Reviewed by Antti Koivisto.
1981
1982         Fonts lie about being monospaced. see webkit.org/b/162546
1983
1984         * layout/inlineformatting/text/TextUtil.cpp:
1985         (WebCore::Layout::TextUtil::width):
1986         (WebCore::Layout::TextUtil::fixedPitchWidth): Deleted.
1987         * layout/inlineformatting/text/TextUtil.h:
1988
1989 2021-02-09  Philippe Normand  <pnormand@igalia.com>
1990
1991         Permission request API for MediaKeySystem access support
1992         https://bugs.webkit.org/show_bug.cgi?id=221187
1993
1994         Reviewed by Jer Noble.
1995
1996         Support for user permission requesting when access to an EME MediaKeySystem is being
1997         requested by the page. This is similar to the mediaDevices access guards.
1998
1999         Existing test media/encrypted-media/mock-MediaKeySystemAccess.html was updated to cover this
2000         new code path and WPE/GTK API tests as well.
2001
2002         * CMakeLists.txt:
2003         * Headers.cmake:
2004         * Modules/encryptedmedia/MediaKeySystemClient.h: Added.
2005         * Modules/encryptedmedia/MediaKeySystemController.cpp: Added.
2006         (WebCore::MediaKeySystemController::supplementName):
2007         (WebCore::MediaKeySystemController::MediaKeySystemController):
2008         (WebCore::MediaKeySystemController::~MediaKeySystemController):
2009         (WebCore::provideMediaKeySystemTo):
2010         (WebCore::MediaKeySystemController::logRequestMediaKeySystemDenial):
2011         * Modules/encryptedmedia/MediaKeySystemController.h: Added.
2012         (WebCore::MediaKeySystemController::client const):
2013         (WebCore::MediaKeySystemController::from):
2014         (WebCore::MediaKeySystemController::requestMediaKeySystem):
2015         (WebCore::MediaKeySystemController::cancelMediaKeySystemRequest):
2016         * Modules/encryptedmedia/MediaKeySystemRequest.cpp: Added.
2017         (WebCore::MediaKeySystemRequest::create):
2018         (WebCore::MediaKeySystemRequest::MediaKeySystemRequest):
2019         (WebCore::MediaKeySystemRequest::~MediaKeySystemRequest):
2020         (WebCore::MediaKeySystemRequest::topLevelDocumentOrigin const):
2021         (WebCore::MediaKeySystemRequest::start):
2022         (WebCore::MediaKeySystemRequest::allow):
2023         (WebCore::MediaKeySystemRequest::deny):
2024         (WebCore::MediaKeySystemRequest::stop):
2025         (WebCore::MediaKeySystemRequest::activeDOMObjectName const):
2026         (WebCore::MediaKeySystemRequest::document const):
2027         * Modules/encryptedmedia/MediaKeySystemRequest.h: Added.
2028         (WebCore::MediaKeySystemRequest::setAllowCallback):
2029         (WebCore::MediaKeySystemRequest::identifier const):
2030         (WebCore::MediaKeySystemRequest::keySystem const):
2031         * Modules/encryptedmedia/NavigatorEME.cpp:
2032         (WebCore::NavigatorEME::requestMediaKeySystemAccess):
2033
2034 2021-02-09  Imanol Fernandez  <ifernandez@igalia.com>
2035
2036         Rename XRWebGLLayer m_IscompositionDisabled to m_IscompositionEnabled
2037         https://bugs.webkit.org/show_bug.cgi?id=221599
2038
2039         Reviewed by Sergio Villar Senin.
2040
2041         The spec agreed to rename this to avoid double negations in code.
2042         See https://github.com/immersive-web/webxr/pull/1172.
2043
2044         * Modules/webxr/WebXRWebGLLayer.cpp:
2045         (WebCore::WebXRWebGLLayer::create):
2046         (WebCore::WebXRWebGLLayer::WebXRWebGLLayer):
2047         * Modules/webxr/WebXRWebGLLayer.h:
2048
2049 2021-02-08  Rob Buis  <rbuis@igalia.com>
2050
2051         Make auto && <ratio> use content box-sizing
2052         https://bugs.webkit.org/show_bug.cgi?id=221527
2053
2054         Reviewed by Simon Fraser.
2055
2056         Make auto && <ratio> aspect-ratio use content box-sizing as specified:
2057         https://drafts.csswg.org/css-sizing-4/#valdef-aspect-ratio-auto--ratio
2058
2059         * rendering/RenderBlock.cpp:
2060         (WebCore::RenderBlock::availableLogicalHeightForPercentageComputation const):
2061         * rendering/RenderBox.cpp:
2062         (WebCore::RenderBox::computeLogicalHeight const):
2063         (WebCore::RenderBox::availableLogicalHeightUsing const):
2064         (WebCore::RenderBox::computePositionedLogicalHeightUsing const):
2065         (WebCore::RenderBox::computeLogicalWidthFromAspectRatio const):
2066         (WebCore::RenderBox::computeMinMaxLogicalWidthFromAspectRatio const):
2067         * rendering/style/RenderStyle.h:
2068         (WebCore::RenderStyle::boxSizingForAspectRatio const):
2069
2070 2021-02-08  Simon Fraser  <simon.fraser@apple.com>
2071
2072         REGRESSION (r269458): yahoo.com social / comments bar shows as transparent when scrolling page
2073         https://bugs.webkit.org/show_bug.cgi?id=221582
2074         <rdar://problem/73795359>
2075
2076         Reviewed by Tim Horton.
2077         
2078         Fix some copypasta in r269458 that resulted in scrolling state fixed nodes failing to get
2079         the right dirty bits after attach, resulting bad viewport constraint data.
2080
2081         Test: scrollingcoordinator/fixed-node-reattach.html
2082
2083         * page/scrolling/ScrollingStateFixedNode.cpp:
2084         (WebCore::ScrollingStateFixedNode::applicableProperties const):
2085
2086 2021-02-08  Patrick Angle  <pangle@apple.com>
2087
2088         Web Inspector: Add `CSS.setLayoutContextTypeChangedMode` for getting information about all layout contexts
2089         https://bugs.webkit.org/show_bug.cgi?id=221449
2090
2091         Reviewed by Devin Rousso.
2092
2093         Test: inspector/css/setLayoutContextTypeChangedMode.html
2094
2095         Backend support for changing the `LayoutContextTypeChangedMode`.
2096
2097         * inspector/agents/InspectorCSSAgent.cpp:
2098         (WebCore::pushChildrenNodesToFrontendIfLayoutContextTypePresent):
2099         - Recursively pushes children node paths to the frontend if a `LayoutContextType` exists for the node, which
2100         allows the frontend to have a complete picture of the layout contexts in the document.
2101         (WebCore::InspectorCSSAgent::setLayoutContextTypeChangedMode):
2102         - If the mode is changed to `All`, then make sure any node with a `LayoutContextType` inside any document is
2103         sent to the frontend.
2104         (WebCore::InspectorCSSAgent::nodeLayoutContextTypeChanged):
2105         - If the `LayoutContextTypeChangedMode` is `All`, inform the frontend of the node when it changes layout
2106         context, even if the node was not previously instrumented.
2107         * inspector/agents/InspectorCSSAgent.h:
2108
2109 2021-02-08  Don Olmstead  <don.olmstead@sony.com>
2110
2111         [CMake] Cleanup ENABLE_ENCRYPTED_MEDIA build
2112         https://bugs.webkit.org/show_bug.cgi?id=221578
2113
2114         Reviewed by Michael Catanzaro.
2115
2116         Move missing shared files in platform/encryptedmedia to the Sources.txt. Update the XCode
2117         project to reflect them moving to the unified build.
2118
2119         Move common configuration into the root CMakeLists.txt. Cleanup the related platform CMake
2120         code to reflect the updated build.
2121
2122         * CMakeLists.txt:
2123         * PlatformMac.cmake:
2124         * Sources.txt:
2125         * WebCore.xcodeproj/project.pbxproj:
2126         * platform/GStreamer.cmake:
2127         * platform/gamepad/mac/HIDGamepad.cpp: Unrelated unified build fix
2128
2129 2021-02-08  Commit Queue  <commit-queue@webkit.org>
2130
2131         Unreviewed, reverting r272480, r272481, and r272500.
2132         https://bugs.webkit.org/show_bug.cgi?id=221586
2133
2134         Caused assertion failure seen with EME tests
2135
2136         Reverted changesets:
2137
2138         "Permission request API for MediaKeySystem access support"
2139         https://bugs.webkit.org/show_bug.cgi?id=221187
2140         https://trac.webkit.org/changeset/272480
2141
2142         "Unreviewed, build fix after r272480"
2143         https://trac.webkit.org/changeset/272481
2144
2145         "Permission request API for MediaKeySystem access support"
2146         https://bugs.webkit.org/show_bug.cgi?id=221187
2147         https://trac.webkit.org/changeset/272500
2148
2149 2021-02-08  Don Olmstead  <don.olmstead@sony.com>
2150
2151         Fix MSVC build with ENCRYPTED_MEDIA enabled
2152         https://bugs.webkit.org/show_bug.cgi?id=177803
2153         <rdar://problem/34920322>
2154
2155         Reviewed by Alex Christensen.
2156
2157         MSVC has a bug of a outer lambda's captured `this` can't be used as
2158         a lambda capture initializer of an inner lambda.
2159
2160         * Modules/encryptedmedia/MediaKeySession.cpp:
2161         (WebCore::MediaKeySession::generateRequest):
2162         (WebCore::MediaKeySession::load):
2163         (WebCore::MediaKeySession::update):
2164         (WebCore::MediaKeySession::close):
2165         (WebCore::MediaKeySession::remove):
2166         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
2167         (WebCore::CDMInstanceSessionClearKey::requestLicense):
2168         (WebCore::CDMInstanceSessionClearKey::updateLicense):
2169         (WebCore::CDMInstanceSessionClearKey::removeSessionData):
2170
2171 2021-02-08  Rob Buis  <rbuis@igalia.com>
2172
2173         Make getStartEndListChildren check renderers
2174         https://bugs.webkit.org/show_bug.cgi?id=221388
2175
2176         Reviewed by Alex Christensen.
2177
2178         Require the list to have non-null renderers for start
2179         and end.
2180
2181         Test: editing/execCommand/insert-nested-lists-crash.html
2182
2183         * editing/ModifySelectionListLevel.cpp:
2184         (WebCore::getStartEndListChildren):
2185
2186 2021-02-08  Brady Eidson  <beidson@apple.com>
2187
2188         Make the UserContentController for ServiceWorker pages be non-optional.
2189         <rdar://problem/71434565> and https://bugs.webkit.org/show_bug.cgi?id=221503
2190
2191         Reviewed by Alex Christensen.
2192
2193         * loader/EmptyClients.cpp:
2194         (WebCore::pageConfigurationWithEmptyClients):
2195
2196         * page/Page.cpp:
2197         (WebCore::Page::Page):
2198
2199         * page/PageConfiguration.cpp:
2200         (WebCore::PageConfiguration::PageConfiguration):
2201         * page/PageConfiguration.h:
2202
2203 2021-02-08  Said Abou-Hallawa  <said@apple.com>
2204
2205         A Pattern with an SVG image is not rendered correctly
2206         https://bugs.webkit.org/show_bug.cgi?id=221550
2207
2208         Reviewed by Simon Fraser.
2209
2210         Implement SVGImage::nativeImage() and nativeImageForCurrentFrame() for
2211         all platforms. This will make Pattern::createPlatformPattern() creates
2212         CGPatternRef with a valid CGImageRef.
2213
2214         * svg/graphics/SVGImage.cpp:
2215         (WebCore::SVGImage::nativeImageForCurrentFrame):
2216         (WebCore::SVGImage::nativeImage):
2217         * svg/graphics/SVGImage.h:
2218
2219 2021-02-08  Eric Carlson  <eric.carlson@apple.com>
2220
2221         [Mac] Connect MediaSession with MediaRemote and NowPlaying
2222         https://bugs.webkit.org/show_bug.cgi?id=221431
2223         <rdar://problem/74000363>
2224
2225         Unreviewed, fix the NowPlayingInfo encoder after r272445.
2226
2227         * platform/audio/NowPlayingInfo.h:
2228         (WebCore::NowPlayingInfo::encode const): Update the encoder for new fields added.
2229
2230 2021-02-08  Lauro Moura  <lmoura@igalia.com>
2231
2232         Unreviewed. Tentative build fix for WPE/GTK after r272504.
2233
2234         Somehow r272504 went green in gtk/wpe EWS but failed in post commit
2235         bots.
2236
2237         Remove the WebCore prefix to follow the include scheme used in other
2238         mediastream module files.
2239
2240         * Modules/mediastream/STUNMessageParsing.cpp:
2241
2242 2021-02-08  Jer Noble  <jer.noble@apple.com>
2243
2244         [Cocoa] Encrypted media segments should generate a parser error if no encrypted media handler is present.
2245         https://bugs.webkit.org/show_bug.cgi?id=221496
2246
2247         Reviewed by Eric Carlson.
2248
2249         The WebM format reader does not support encrypted media parsing, so the parser must generate an error rather
2250         than continuing to parse encrypted media data.
2251
2252         * platform/graphics/cocoa/SourceBufferParserWebM.cpp:
2253         (WebCore::SourceBufferParserWebM::OnElementEnd):
2254         (WebCore::SourceBufferParserWebM::OnTrackEntry):
2255         * platform/graphics/cocoa/SourceBufferParserWebM.h:
2256
2257 2021-02-08  Youenn Fablet  <youenn@apple.com>
2258
2259         NetworkRTCSocketCocoa extractDataMessages should not read too much data
2260         https://bugs.webkit.org/show_bug.cgi?id=221544
2261
2262         Reviewed by Eric Carlson.
2263
2264         Move STUN/TURN message parsing to its own file routine so that we can add API test.
2265         Code is taken from Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocketCocoa.mm.
2266         Fix the test verifying we can actually read a message given its expected length.
2267
2268         Covered by API test.
2269
2270         * Headers.cmake:
2271         * Modules/mediastream/STUNMessageParsing.cpp: Added.
2272         (WebCore::isStunMessage):
2273         (WebCore::getSTUNOrTURNMessageLengths):
2274         (WebCore::extractSTUNOrTURNMessages):
2275         (WebCore::extractDataMessages):
2276         (WebCore::extractMessages):
2277         * Modules/mediastream/STUNMessageParsing.h: Added.
2278         * Sources.txt:
2279         * WebCore.xcodeproj/project.pbxproj:
2280
2281 2021-02-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2282
2283         Adjust EventHandler to account for image extraction content
2284         https://bugs.webkit.org/show_bug.cgi?id=221274
2285
2286         Reviewed by Tim Horton.
2287
2288         Avoid extending the selection to the hit-tested position when dragging over an image overlay container (as
2289         opposed to one of the children with text inside the image overlay container).
2290
2291         * html/HTMLElement.cpp:
2292         (WebCore::HTMLElement::shouldUpdateSelectionForMouseDrag):
2293         * html/HTMLElement.h:
2294         * page/EventHandler.cpp:
2295         (WebCore::EventHandler::updateSelectionForMouseDrag):
2296
2297 2021-02-08  Alicia Boya García  <aboya@igalia.com>
2298
2299         Add ConsoleMessage::toString()
2300         https://bugs.webkit.org/show_bug.cgi?id=221539
2301
2302         Reviewed by Eric Carlson.
2303
2304         Use ConsoleMessage::toString() instead of ConsoleMessage::message().
2305
2306         * page/PageConsoleClient.cpp:
2307         (WebCore::PageConsoleClient::addMessage):
2308
2309 2021-02-08  Sam Weinig  <weinig@apple.com>
2310
2311         Update sRGB <-> XYZ conversion matrix values to match values in latest spec
2312         https://bugs.webkit.org/show_bug.cgi?id=221533
2313
2314         Reviewed by Alex Christensen.
2315
2316         Update values to keep in sync with https://github.com/w3c/csswg-drafts/issues/5922.
2317
2318         Updates ExtendedColor API test.
2319
2320         * platform/graphics/ColorConversion.cpp:
2321         Update values to keep in sync with the values used in the CSS Color 4 spec. This
2322         doesn't have any user visible effect, but would reduce errors if round tripping
2323         through this ever became necessary. 
2324
2325 2021-02-08  Rob Buis  <rbuis@igalia.com>
2326
2327         Null check document element in createGradient
2328         https://bugs.webkit.org/show_bug.cgi?id=221378
2329
2330         Reviewed by Alex Christensen.
2331
2332         The document element is not guaranteed to exist so null
2333         check it before determining the root style.
2334
2335         Tests: fast/css/conic-gradient-no-document-element-crash.html
2336                fast/css/linear-gradient-no-document-element-crash.html
2337                fast/css/radial-gradient-no-document-element-crash.html
2338
2339         * css/CSSGradientValue.cpp:
2340         (WebCore::CSSLinearGradientValue::createGradient):
2341         (WebCore::CSSRadialGradientValue::createGradient):
2342         (WebCore::CSSConicGradientValue::createGradient):
2343
2344 2021-02-08  Aditya Keerthi  <akeerthi@apple.com>
2345
2346         [macOS] Return key binding for date inputs conflicts with return to submit form
2347         https://bugs.webkit.org/show_bug.cgi?id=221532
2348         <rdar://problem/74039204>
2349
2350         Reviewed by Wenson Hsieh.
2351
2352         Currently, pressing the return key within a focused date input presents
2353         the calendar view, rather than submitting an associated form. This is a
2354         usability issue for keyboard users, and is different from the behavior
2355         in Chrome. This patch matches the behavior in Chrome, and makes it so
2356         that a return keypress submits an associated form.
2357
2358         However, since the return key is now reserved for form submission, we
2359         need a new key to present the calendar view for the date input. Chrome
2360         and Firefox use the space key for this functionality, so this patch
2361         matches that behavior.
2362
2363         Note that r267281 updated date inputs to focus the next editable component
2364         when pressing the space key. This behavior is now removed in favor of
2365         presenting the calendar. Other separator keys, and arrow keys, can still be
2366         used to focus the next editable component.
2367
2368         Tests: fast/forms/date/date-editable-components/date-picker-show-on-space-keypress.html
2369                fast/forms/date/date-editable-components/form-submit-on-return-keypress.html
2370
2371         * html/BaseDateAndTimeInputType.cpp:
2372         (WebCore::BaseDateAndTimeInputType::handleKeypressEvent):
2373
2374         Date and time inputs are BaseClickableWithKeyInputTypes. This gives them
2375         activation behavior on return and space keypresses, similar to button and
2376         color inputs. However, since date/time inputs are closer to textfields,
2377         than buttons, we elide activation behavior on a return keypress, allowing
2378         the event to submit an associated form. Activation behavior on a space
2379         keypress is supported by going through the existing code path.
2380
2381         * html/shadow/DateTimeFieldElement.cpp:
2382         (WebCore::DateTimeFieldElement::defaultKeyboardEventHandler):
2383
2384         Remove "Space" from the list of separator keys that focus the next
2385         editable component.
2386
2387 2021-02-08  Antti Koivisto  <antti@apple.com>
2388
2389         [LFC][Integration] Hit test inline boxes
2390         https://bugs.webkit.org/show_bug.cgi?id=221545
2391
2392         Reviewed by Zalan Bujtas.
2393
2394         Fix fast/dom/nodesFromRect/nodesFromRect-inline-image.html and similar by allowing hitting non-root inline boxes.
2395
2396         * layout/integration/LayoutIntegrationInlineContent.h:
2397
2398         Add a new vector for inlines.
2399
2400         * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
2401         (WebCore::LayoutIntegration::InlineContentBuilder::build const):
2402         (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayNonRootInlineBoxes const):
2403
2404         Build the vector.
2405
2406         * layout/integration/LayoutIntegrationInlineContentBuilder.h:
2407         * layout/integration/LayoutIntegrationLine.h:
2408         (WebCore::LayoutIntegration::NonRootInlineBox::NonRootInlineBox):
2409         (WebCore::LayoutIntegration::NonRootInlineBox::layoutBox const):
2410         (WebCore::LayoutIntegration::NonRootInlineBox::style const):
2411         (WebCore::LayoutIntegration::NonRootInlineBox::lineIndex const):
2412         (WebCore::LayoutIntegration::NonRootInlineBox::rect const):
2413         * layout/integration/LayoutIntegrationLineLayout.cpp:
2414         (WebCore::LayoutIntegration::LineLayout::hitTest):
2415
2416         Hit test using the inline vector.
2417
2418 2021-02-08  Imanol Fernandez  <ifernandez@igalia.com>
2419
2420         WebXRSystem::RequestSession with 'viewer' as a required feature should succeed
2421         https://bugs.webkit.org/show_bug.cgi?id=221267
2422
2423         Reviewed by Sergio Villar Senin.
2424
2425         Tested by wpt/webxr/xrSession_viewer_availability.html
2426
2427         * Modules/webxr/WebXRSystem.cpp:
2428         (WebCore::WebXRSystem::inlineSessionRequestIsAllowedForGlobalObject const):
2429
2430 2021-02-08  Imanol Fernandez  <ifernandez@igalia.com>
2431
2432         Fix WebXRWebGLLayer m_isCompositionDisabled checks
2433         https://bugs.webkit.org/show_bug.cgi?id=221551
2434
2435         Reviewed by Sergio Villar Senin.
2436
2437         Fix reversed m_isCompositionDisabled checks.
2438
2439         * Modules/webxr/WebXRWebGLLayer.cpp:
2440         (WebCore::WebXRWebGLLayer::create):
2441         (WebCore::WebXRWebGLLayer::WebXRWebGLLayer):
2442
2443 2021-02-08  Andres Gonzalez  <andresg_22@apple.com>
2444
2445         Add support for aria-sort change notifications.
2446         https://bugs.webkit.org/show_bug.cgi?id=221495
2447
2448         Reviewed by Chris Fleizach.
2449
2450         Test: accessibility/aria-sort-changed-notification.html
2451
2452         This patch adds support for aria-sort changes. Some code cleanup by
2453         using the notificationPlatformName helper function.
2454
2455         * accessibility/AXLogger.cpp:
2456         (WebCore::operator<<):
2457         Logging of the new notification.
2458         * accessibility/AXObjectCache.cpp:
2459         Handles the aria-sort change notification. Updates the isolated tree.
2460         (WebCore::AXObjectCache::handleAttributeChange):
2461         (WebCore::AXObjectCache::updateIsolatedTree):
2462         * accessibility/AXObjectCache.h:
2463         * accessibility/ios/AXObjectCacheIOS.mm:
2464         (WebCore::AXObjectCache::notificationPlatformName):
2465         Helper to map AXCore notifications to platform notifications.
2466         (WebCore::AXObjectCache::postPlatformNotification):
2467         Handles the AXSortDirectionChanged notification. Some code cleanup using
2468         the notificationPlatformName helper.
2469         * accessibility/ios/WebAccessibilityObjectWrapperIOS.h:
2470         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2471         (-[WebAccessibilityObjectWrapper postNotification:]):
2472         To be overridden by system AX bundles.
2473         (-[WebAccessibilityObjectWrapper accessibilitySortDirection]):
2474         Only ascending and descending sort directions are relevant for clients.
2475         * accessibility/isolatedtree/AXIsolatedTree.cpp:
2476         (WebCore::AXIsolatedTree::updateNodeProperty):
2477         Updates the SortDirection property.
2478         * accessibility/mac/AXObjectCacheMac.mm:
2479         (WebCore::AXObjectCache::postPlatformNotification):
2480         Handles the AXSortDirectionChanged notification.
2481
2482 2021-02-08  Frédéric Wang  <fwang@igalia.com>
2483
2484         Perform layout before running Editor::findString
2485         https://bugs.webkit.org/show_bug.cgi?id=220384
2486
2487         Reviewed by Ryosuke Niwa.
2488
2489         This ensures that the layout is up-to-date before performing any search.
2490         Also disable any post-resolution that could cause more changes to happen.
2491
2492         * editing/Editor.cpp:
2493         (WebCore::Editor::findString):
2494
2495 2021-02-08  Antoine Quint  <graouts@webkit.org>
2496
2497         Deprecation warnings for NSImageHintSymbolFont and NSImageHintSymbolScale
2498         https://bugs.webkit.org/show_bug.cgi?id=221541
2499
2500         Unreviewed build fix.
2501
2502         * rendering/RenderThemeMac.mm:
2503         (WebCore::createAttachmentPlaceholderImage):
2504
2505 2021-02-08  Carlos Garcia Campos  <cgarcia@igalia.com>
2506
2507         Nullptr crash in editingIgnoresContent via InsertParagraphSeparatorCommand::doApply
2508         https://bugs.webkit.org/show_bug.cgi?id=220349
2509
2510         Reviewed by Ryosuke Niwa.
2511
2512         Add an early return to InsertParagraphSeparatorCommand::doApply if insert position is null.
2513
2514         * editing/CompositeEditCommand.cpp:
2515         (WebCore::CompositeEditCommand::insertNodeBefore): Return early if a InsertNodeBeforeCommand can't be created.
2516         * editing/InsertParagraphSeparatorCommand.cpp:
2517         (WebCore::InsertParagraphSeparatorCommand::doApply): Abort the insertion if the insert position is null.
2518
2519 2021-02-08  Philippe Normand  <pnormand@igalia.com>
2520
2521         Permission request API for MediaKeySystem access support
2522         https://bugs.webkit.org/show_bug.cgi?id=221187
2523
2524         Reviewed by Jer Noble.
2525
2526         Support for user permission requesting when access to an EME MediaKeySystem is being
2527         requested by the page. This is similar to the mediaDevices access guards.
2528
2529         Existing test media/encrypted-media/mock-MediaKeySystemAccess.html was updated to cover this
2530         new code path and WPE/GTK API tests as well.
2531
2532         * CMakeLists.txt:
2533         * Headers.cmake:
2534         * Modules/encryptedmedia/MediaKeySystemClient.h: Added.
2535         * Modules/encryptedmedia/MediaKeySystemController.cpp: Added.
2536         (WebCore::MediaKeySystemController::supplementName):
2537         (WebCore::MediaKeySystemController::MediaKeySystemController):
2538         (WebCore::MediaKeySystemController::~MediaKeySystemController):
2539         (WebCore::provideMediaKeySystemTo):
2540         (WebCore::MediaKeySystemController::logRequestMediaKeySystemDenial):
2541         * Modules/encryptedmedia/MediaKeySystemController.h: Added.
2542         (WebCore::MediaKeySystemController::client const):
2543         (WebCore::MediaKeySystemController::from):
2544         (WebCore::MediaKeySystemController::requestMediaKeySystem):
2545         (WebCore::MediaKeySystemController::cancelMediaKeySystemRequest):
2546         * Modules/encryptedmedia/MediaKeySystemRequest.cpp: Added.
2547         (WebCore::MediaKeySystemRequest::create):
2548         (WebCore::MediaKeySystemRequest::MediaKeySystemRequest):
2549         (WebCore::MediaKeySystemRequest::~MediaKeySystemRequest):
2550         (WebCore::MediaKeySystemRequest::topLevelDocumentOrigin const):
2551         (WebCore::MediaKeySystemRequest::start):
2552         (WebCore::MediaKeySystemRequest::allow):
2553         (WebCore::MediaKeySystemRequest::deny):
2554         (WebCore::MediaKeySystemRequest::stop):
2555         (WebCore::MediaKeySystemRequest::activeDOMObjectName const):
2556         (WebCore::MediaKeySystemRequest::document const):
2557         * Modules/encryptedmedia/MediaKeySystemRequest.h: Added.
2558         (WebCore::MediaKeySystemRequest::setAllowCallback):
2559         (WebCore::MediaKeySystemRequest::identifier const):
2560         (WebCore::MediaKeySystemRequest::keySystem const):
2561         * Modules/encryptedmedia/NavigatorEME.cpp:
2562         (WebCore::NavigatorEME::requestMediaKeySystemAccess):
2563
2564 2021-02-07  Lauro Moura  <lmoura@igalia.com>
2565
2566         REGRESSION(r272379) [WPE] imported/w3c/web-platform-tests/mathml/relations/css-styling/mathvariant tests are Image Failing
2567         https://bugs.webkit.org/show_bug.cgi?id=221523
2568
2569         Reviewed by Adrian Perez de Castro.
2570
2571         Covered by existing tests.
2572
2573         This change makes the mathml tests pass again, but still does not
2574         fixes fast/text/multi-code-unit-simple-path.html, which is still not
2575         mismatching on both GTK/WPE.
2576
2577         * platform/graphics/WidthIterator.cpp:
2578         (WebCore::WidthIterator::advanceInternal): Avoid inserting the
2579         trailing zero for GLIB.
2580
2581 2021-02-07  Zalan Bujtas  <zalan@apple.com>
2582
2583         [LFC][IFC] ASSERT(constraints.left->x <= constraints.right->x) when left and right floats run out of space
2584         https://bugs.webkit.org/show_bug.cgi?id=220963
2585         <rdar://problem/73861675>
2586
2587         Reviewed by Simon Fraser.
2588
2589         Remove the incorrect assert. It's valid to have "horizontally overlapping" floats here since
2590         we probe for a vertical range (not just a point) and vertical ranges can have
2591         multiple left and right floats where they simply "overlap" each other when only x is taken into account.
2592
2593         When two floats (left and right) line up like this:
2594          _______
2595         |  LF   |
2596         |_______|
2597              _______
2598             |  RF   |
2599             |_______|
2600         and as we try to find space for the inline content, we may end up with a vertical range (candidate line position + line height)
2601         where we find both LF and RF. In this range the float boxes do overlap horizontally.
2602         It simply means that at that vertical position there's no available space for the inline content.  
2603
2604         Test: fast/inline/intrusive-left-right-floats-assert.html
2605
2606         * layout/inlineformatting/InlineLineBuilder.cpp:
2607         (WebCore::Layout::LineBuilder::floatConstraints const):
2608
2609 2021-02-07  Wenson Hsieh  <wenson_hsieh@apple.com>
2610
2611         Remove a duplicate implementation of EventHandler::mouseDownMayStartSelect()
2612         https://bugs.webkit.org/show_bug.cgi?id=221531
2613
2614         Reviewed by Tim Horton.
2615
2616         Remove the current `bool mouseDownMayStartSelect() const` method which just returns `m_mouseDownMayStartSelect`,
2617         and make the current non-`const` version of the method `const` instead. Since `mouseDownMayStartSelect()` was
2618         only invoked from non-const methods, the former `const` version was unused.
2619
2620         No change in behavior.
2621
2622         * page/EventHandler.cpp:
2623         (WebCore::EventHandler::mouseDownMayStartSelect const):
2624         (WebCore::EventHandler::mouseDownMayStartSelect): Deleted.
2625         * page/EventHandler.h:
2626         (WebCore::EventHandler::mouseDownMayStartSelect const): Deleted.
2627         * page/Page.h:
2628         (WebCore::Page::textInteractionEnabled const):
2629
2630         Make this getter `const`, so that we can call it in `mouseDownMayStartSelect() const`.
2631
2632         (WebCore::Page::textInteractionEnabled): Deleted.
2633
2634 2021-02-07  Sam Weinig  <weinig@apple.com>
2635
2636         Differentiate between color spaces used to tag colors and color spaces used to tag destinations
2637         https://bugs.webkit.org/show_bug.cgi?id=221520
2638
2639         Reviewed by Antti Koivisto.
2640
2641         Replace use of the ColorSpace enum in destination contexts (ImageBuffer, Filters, etc.)
2642         with a new DestinationColorSpace enum that is just the limited set of color spaces
2643         supported in that context, just SRGB and LinearSRGB. We may need to expand this to
2644         other supported destination color spaces in the future, but currently only those two
2645         are actually used, and color space information for higher gamut spaces like DisplayP3
2646         are communicated differently.
2647
2648         This will allow us to more clearly see these two concepts as different and ensure we
2649         we support all cases for each, without having to know to ignore some color spaces in
2650         the destination contexts.
2651
2652         While changing a bunch of names, also take the oppertunity to rename ColorSpace::LinearRGB
2653         to ColorSpace::LinearSRGB to match ColorSpace::SRGB (also done for the new 
2654         DestinationColorSpace::LinearSRGB).
2655
2656         * html/CustomPaintCanvas.cpp:
2657         (WebCore::CustomPaintCanvas::copiedImage const):
2658         * html/HTMLCanvasElement.cpp:
2659         (WebCore::HTMLCanvasElement::createImageBuffer const):
2660         * html/HTMLVideoElement.cpp:
2661         (WebCore::HTMLVideoElement::createBufferForPainting const):
2662         * html/ImageBitmap.cpp:
2663         (WebCore::ImageBitmap::createImageBuffer):
2664         * html/OffscreenCanvas.cpp:
2665         (WebCore::OffscreenCanvas::commitToPlaceholderCanvas):
2666         * html/canvas/CanvasRenderingContext2DBase.cpp:
2667         (WebCore::CanvasRenderingContext2DBase::drawImage):
2668         (WebCore::CanvasRenderingContext2DBase::drawTextUnchecked):
2669         * page/Chrome.cpp:
2670         (WebCore::Chrome::createImageBuffer const):
2671         * page/Chrome.h:
2672         * page/ChromeClient.h:
2673         (WebCore::ChromeClient::createImageBuffer const):
2674         * page/cocoa/ResourceUsageOverlayCocoa.mm:
2675         (WebCore::createColor):
2676         * platform/HostWindow.h:
2677         * platform/graphics/BitmapImage.cpp:
2678         (WebCore::BitmapImage::drawPattern):
2679         * platform/graphics/ColorSerialization.cpp:
2680         (WebCore::serialization):
2681         * platform/graphics/ColorSpace.cpp:
2682         (WebCore::operator<<):
2683         * platform/graphics/ColorSpace.h:
2684         (WebCore::callWithColorType):
2685         * platform/graphics/ConcreteImageBuffer.h:
2686         (WebCore::ConcreteImageBuffer::create):
2687         * platform/graphics/CustomPaintImage.cpp:
2688         (WebCore::CustomPaintImage::drawPattern):
2689         * platform/graphics/GradientImage.cpp:
2690         (WebCore::GradientImage::drawPattern):
2691         * platform/graphics/GraphicsContext.cpp:
2692         (WebCore::GraphicsContext::clipToDrawingCommands):
2693         * platform/graphics/GraphicsContext.h:
2694         * platform/graphics/GraphicsContextImpl.h:
2695         * platform/graphics/ImageBuffer.cpp:
2696         (WebCore::ImageBuffer::create):
2697         (WebCore::ImageBuffer::createCompatibleBuffer):
2698         (WebCore::ImageBuffer::copyRectToBuffer):
2699         * platform/graphics/ImageBuffer.h:
2700         * platform/graphics/ImageBufferBackend.h:
2701         (WebCore::ImageBufferBackend::transformColorSpace):
2702         (WebCore::ImageBufferBackend::colorSpace const):
2703         * platform/graphics/cairo/GraphicsContextImplCairo.h:
2704         * platform/graphics/cairo/ImageBufferCairoBackend.cpp:
2705         (WebCore::ImageBufferCairoBackend::transformColorSpace):
2706         * platform/graphics/cairo/ImageBufferCairoBackend.h:
2707         * platform/graphics/cg/ColorSpaceCG.h:
2708         (WebCore::cachedCGColorSpace):
2709         * platform/graphics/displaylists/DisplayListImageBuffer.h:
2710         (WebCore::DisplayList::ImageBuffer::create):
2711         * platform/graphics/displaylists/DisplayListItems.h:
2712         (WebCore::DisplayList::ClipToDrawingCommands::ClipToDrawingCommands):
2713         (WebCore::DisplayList::ClipToDrawingCommands::colorSpace const):
2714         (WebCore::DisplayList::ClipToDrawingCommands::decode):
2715         * platform/graphics/displaylists/DisplayListRecorder.cpp:
2716         (WebCore::DisplayList::Recorder::clipToDrawingCommands):
2717         * platform/graphics/displaylists/DisplayListRecorder.h:
2718         * platform/graphics/filters/FEDisplacementMap.cpp:
2719         (WebCore::FEDisplacementMap::setResultColorSpace):
2720         * platform/graphics/filters/FEDisplacementMap.h:
2721         * platform/graphics/filters/FEFlood.h:
2722         * platform/graphics/filters/FELighting.cpp:
2723         (WebCore::FELighting::drawLighting):
2724         * platform/graphics/filters/FETile.cpp:
2725         (WebCore::FETile::platformApplySoftware):
2726         * platform/graphics/filters/FilterEffect.cpp:
2727         (WebCore::FilterEffect::unmultipliedResult):
2728         (WebCore::FilterEffect::premultipliedResult):
2729         (WebCore::FilterEffect::convertImageDataToColorSpace):
2730         (WebCore::FilterEffect::convertImageBufferToColorSpace):
2731         (WebCore::FilterEffect::copyConvertedImageBufferToDestination):
2732         (WebCore::FilterEffect::copyConvertedImageDataToDestination):
2733         (WebCore::FilterEffect::copyUnmultipliedResult):
2734         (WebCore::FilterEffect::copyPremultipliedResult):
2735         (WebCore::FilterEffect::requiresImageDataColorSpaceConversion):
2736         (WebCore::FilterEffect::transformResultColorSpace):
2737         * platform/graphics/filters/FilterEffect.h:
2738         (WebCore::FilterEffect::operatingColorSpace const):
2739         (WebCore::FilterEffect::setOperatingColorSpace):
2740         (WebCore::FilterEffect::resultColorSpace const):
2741         (WebCore::FilterEffect::setResultColorSpace):
2742         * platform/graphics/filters/SourceGraphic.h:
2743         (WebCore::SourceGraphic::SourceGraphic):
2744         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
2745         (Nicosia::CairoOperationRecorder::clipToDrawingCommands):
2746         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h:
2747         * platform/graphics/win/GraphicsContextImplDirect2D.cpp:
2748         * platform/graphics/win/GraphicsContextImplDirect2D.h:
2749         * platform/graphics/win/ImageBufferDirect2DBackend.cpp:
2750         (WebCore::ImageBufferDirect2DBackend::create):
2751         (WebCore::ImageBufferDirect2DBackend::ImageBufferDirect2DBackend):
2752         * platform/mac/ThemeMac.mm:
2753         (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
2754         * rendering/CSSFilter.cpp:
2755         (WebCore::CSSFilter::buildReferenceFilter):
2756         (WebCore::CSSFilter::build):
2757         (WebCore::CSSFilter::apply):
2758         * rendering/RenderBoxModelObject.cpp:
2759         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
2760         * rendering/RenderLayerBacking.cpp:
2761         (WebCore::patternForDescription):
2762         * rendering/RenderThemeMac.mm:
2763         (WebCore::RenderThemeMac::paintProgressBar):
2764         * rendering/svg/RenderSVGResourceClipper.cpp:
2765         (WebCore::RenderSVGResourceClipper::applyClippingToContext):
2766         * rendering/svg/RenderSVGResourceFilter.cpp:
2767         (WebCore::RenderSVGResourceFilter::buildPrimitives const):
2768         (WebCore::RenderSVGResourceFilter::applyResource):
2769         (WebCore::RenderSVGResourceFilter::postApplyResource):
2770         * rendering/svg/RenderSVGResourceGradient.cpp:
2771         (WebCore::createMaskAndSwapContextForTextGradient):
2772         * rendering/svg/RenderSVGResourceMasker.cpp:
2773         (WebCore::RenderSVGResourceMasker::applyResource):
2774         (WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):
2775         * rendering/svg/RenderSVGResourceMasker.h:
2776         * rendering/svg/RenderSVGResourcePattern.cpp:
2777         (WebCore::RenderSVGResourcePattern::createTileImage const):
2778         * rendering/svg/SVGRenderingContext.cpp:
2779         (WebCore::SVGRenderingContext::createImageBuffer):
2780         (WebCore::SVGRenderingContext::bufferForeground):
2781         * rendering/svg/SVGRenderingContext.h:
2782         * svg/graphics/SVGImage.cpp:
2783         (WebCore::SVGImage::drawPatternForContainer):
2784         * svg/graphics/filters/SVGFEImage.cpp:
2785         (WebCore::FEImage::platformApplySoftware):
2786
2787 2021-02-07  Sam Weinig  <weinig@apple.com>
2788
2789         Remove more special cases from color conversion
2790         https://bugs.webkit.org/show_bug.cgi?id=221519
2791
2792         Reviewed by Antti Koivisto.
2793
2794         - Remove specialized convertTo<> function which only did component
2795           type conversion with the fully general convertColor<> function.
2796
2797         - Make ColorComponents a bit more ready for non-4 component colors by
2798           reworking member functionality based on a new mapColorComponents function
2799           which maps a function F over all the components of a set of ColorComponents.
2800           e.g.
2801
2802               auto colorComponentsC = mapColorComponents([] (auto a, auto b) { return a + b; }, colorComponentsA, colorComponentsB);
2803
2804           will create a new ColorComponents where each component is the sum of the 
2805           corresponding components in colorComponentsA and colorComponentsB. It's
2806           variadic so it can take any number of ColorComponents. This allows rewriting
2807           all of the members to be size invariant and a little less verbose.
2808
2809         - Replace special case for the identity conversion in the fallback color conversion
2810           code path, and move it into it's own partial specialization of ColorConversion.
2811
2812         - Replace special case for chromatic adaptation conversions and have them just
2813           use specializations of ColorConversion like all other conversions.
2814
2815         * platform/graphics/ColorComponents.h:
2816         (WebCore::mapColorComponents):
2817         (WebCore::ColorComponents<T>::map const):
2818         (WebCore::ColorComponents<T>::operator const):
2819         (WebCore::ColorComponents<T>::abs const):
2820         (WebCore::perComponentMax):
2821         (WebCore::perComponentMin):
2822         Add map and mapColorComponents and re-implement existing
2823         functionality in terms of them.
2824
2825         * platform/graphics/ColorConversion.cpp:
2826         (WebCore::WhitePoint::D50>>::convert):
2827         (WebCore::WhitePoint::D65>>::convert):
2828         (WebCore::SRGBA<uint8_t>>::convert):
2829         (WebCore::SRGBA<float>>::convert):
2830         (WebCore::SRGBA<uint8_t>::ReferenceXYZ>::convert):
2831         (WebCore::convertFromD50WhitePointToD65WhitePoint): Deleted.
2832         (WebCore::convertFromD65WhitePointToD50WhitePoint): Deleted.
2833         * platform/graphics/ColorConversion.h:
2834         (WebCore::ColorConversion::convert):
2835         (WebCore::performChomaticAdapatation): Deleted.
2836         Use ColorConversion specializations for the identity conversion, chomatic 
2837         adapatation, and component type conversions, rather than hard coding them
2838         in the fallback conversion.
2839
2840         * platform/graphics/ColorUtilities.h:
2841         (WebCore::convertTo): Deleted.
2842         Remove convertTo<>, which is now superseded by the general convertColor<>.
2843
2844         * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
2845         (webkitAccessibleTextGetText):
2846         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2847         (-[WebAccessibilityObjectWrapper accessibilityColorStringValue]):
2848         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2849         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2850         * html/canvas/CanvasRenderingContext2DBase.cpp:
2851         (WebCore::CanvasRenderingContext2DBase::setShadow):
2852         * html/canvas/CanvasStyle.cpp:
2853         (WebCore::CanvasStyle::CanvasStyle):
2854         (WebCore::CanvasStyle::isEquivalent const):
2855         * platform/graphics/Color.cpp:
2856         (WebCore::Color::lightened const):
2857         (WebCore::Color::darkened const):
2858         (WebCore::Color::colorSpaceAndComponents const):
2859         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
2860         (WebCore::makeSimpleColorFromARGBCFArray):
2861         * platform/graphics/filters/FilterOperations.cpp:
2862         (WebCore::FilterOperations::transformColor const):
2863         (WebCore::FilterOperations::inverseTransformColor const):
2864         * platform/graphics/gtk/ColorGtk.cpp:
2865         (WebCore::Color::Color):
2866         * platform/graphics/mac/ColorMac.mm:
2867         (WebCore::makeSimpleColorFromNSColor):
2868         * platform/graphics/win/ColorDirect2D.cpp:
2869         (WebCore::Color::Color):
2870         * platform/graphics/win/PlatformContextDirect2D.cpp:
2871         (WebCore::PlatformContextDirect2D::brushWithColor):
2872         * platform/ios/ColorIOS.mm:
2873         (WebCore::colorFromUIColor):
2874         Adopt convertColor<> to replace convertTo<>.
2875
2876 2021-02-07  Antti Koivisto  <antti@apple.com>
2877
2878         [LFC][Integration] Fix http/wpt/css/css-highlight-api/ tests with inlines enabled
2879         https://bugs.webkit.org/show_bug.cgi?id=221529
2880
2881         Reviewed by Zalan Bujtas.
2882
2883         Highlight painting code is currently tied to legacy line boxes. Disallow LFC.
2884
2885         * layout/integration/LayoutIntegrationCoverage.cpp:
2886         (WebCore::LayoutIntegration::printReason):
2887         (WebCore::LayoutIntegration::canUseForLineLayoutWithReason):
2888         * layout/integration/LayoutIntegrationCoverage.h:
2889
2890 2021-02-07  Zalan Bujtas  <zalan@apple.com>
2891
2892         [LFC][IFC] A line with no content should always take the fast vertical alignment path
2893         https://bugs.webkit.org/show_bug.cgi?id=221524
2894
2895         Reviewed by Antti Koivisto.
2896
2897         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
2898         (WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
2899         (WebCore::Layout::LineBoxBuilder::computeLineBoxHeightAndAlignInlineLevelBoxesVertically):
2900
2901 2021-02-06  Alex Christensen  <achristensen@webkit.org>
2902
2903         Non-special URLs should have an opaque origin
2904         https://bugs.webkit.org/show_bug.cgi?id=162254
2905
2906         Reviewed by Geoff Garen.
2907
2908         This matches the behavior of Chrome, Firefox, and the URL specification.
2909         In order to maintain compatibility with existing apps, we do a linkedOnOrAfter check for the new behavior.
2910         In order to allow things like web extensions to continue to work, we allow non-null origins for schemes
2911         for which a WKURLSchemeHandler has been registered.  We learned this lesson 4 years ago when we tried this change.
2912         This also makes sense conceptually because those schemes will be handled by the containing application,
2913         so they can be an "origin" for a page.
2914
2915         * page/SecurityOrigin.cpp:
2916         (WebCore::shouldTreatAsUniqueOrigin):
2917         * platform/LegacySchemeRegistry.cpp:
2918         (WebCore::schemesHandledBySchemeHandler):
2919         (WebCore::LegacySchemeRegistry::registerURLSchemeAsHandledBySchemeHandler):
2920         (WebCore::LegacySchemeRegistry::schemeIsHandledBySchemeHandler):
2921         * platform/LegacySchemeRegistry.h:
2922         * platform/cocoa/VersionChecks.h:
2923
2924 2021-02-06  Zalan Bujtas  <zalan@apple.com>
2925
2926         [LFC][IFC] Incorrect line box height when line-height is set on an empty root inline box
2927         https://bugs.webkit.org/show_bug.cgi?id=221522
2928
2929         Reviewed by Antti Koivisto.
2930
2931         The root inline box with non-initial line height value stretches the line box even when root has no content.
2932
2933         e.g. <div style="line-height: 100px;"><span>content</span></div>
2934         This content produces a ~100px tall line box.
2935
2936         * layout/inlineformatting/InlineFormattingContextQuirks.cpp:
2937         (WebCore::Layout::InlineFormattingContext::Quirks::inlineLevelBoxAffectsLineBox const):
2938
2939 2021-02-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2940
2941         Introduce image overlays and add UA shadow root support for image extraction
2942         https://bugs.webkit.org/show_bug.cgi?id=221236
2943
2944         Reviewed by Ryosuke Niwa.
2945
2946         This patch restores some of the logic previously introduced in r164457 (and removed with r272117) to render
2947         service button cells over images, and additionally renames and repurposes it for image extraction, a new
2948         accessibility feature. See comments below for more details.
2949
2950         * CMakeLists.txt:
2951         * DerivedSources-input.xcfilelist:
2952         * DerivedSources.make:
2953         * WebCore.xcodeproj/project.pbxproj:
2954         * html/HTMLElement.cpp:
2955         (WebCore::imageOverlayElementIdentifier):
2956         (WebCore::HTMLElement::hasImageOverlay const):
2957
2958         Add a helper to determine whether or not an element's UA shadow root has an image overlay element. This is
2959         consulted in the constructor of `RenderImage`.
2960
2961         (WebCore::HTMLElement::updateWithImageExtractionResult):
2962
2963         Add a helper method to install image extraction content in the shadow root of an element, given an
2964         `ImageExtractionResult`. This consists of an image overlay container (a relatively positioned `div`), which then
2965         contains some number of absolutely positioned child `div` elements. Additionally load the image overlay
2966         stylesheet as text within a style element when creating the UA shadow root.
2967
2968         * html/HTMLElement.h:
2969         * html/shadow/imageOverlay.css: Added.
2970         (div#image-overlay):
2971         (div.image-overlay-text):
2972
2973         Add a new UA stylesheet for the image overlay shadow DOM subtree. The overlay contains a number of absolutely
2974         positoned `div` elements, which are positioned inside the overlay element using using CSS transforms.
2975
2976         * rendering/RenderImage.cpp:
2977         (WebCore::RenderImage::RenderImage):
2978         (WebCore::RenderImage::canHaveChildren const):
2979
2980         Return `true` if we require children in the shadow root (for either media controls, or this new image overlay).
2981
2982         (WebCore::RenderImage::layout):
2983         (WebCore::RenderImage::layoutShadowContent):
2984         (WebCore::RenderImage::layoutShadowControls): Deleted.
2985
2986         Rename `layoutShadowControls` to `layoutShadowContent`, and allow it to support both the "shadow controls" case
2987         (i.e. `RenderMedia`) and the "image extraction content" case. Additonally, remove the check for
2988         `shadowControlsNeedCustomLayoutMetrics()` when setting child renderer width/height. This is currently only used
2989         for laying out media controls in `RenderMedia`, but we'll need it now for all `RenderImage`s.
2990
2991         * rendering/RenderImage.h:
2992         (WebCore::RenderImage::setHasImageOverlay):
2993         (WebCore::RenderImage::hasShadowContent const):
2994
2995         Add a helper method to return whether or not the `RenderImage` should expect shadow root content. This is true
2996         for both media controls (`m_hasShadowControls`) and for the new image overlay content (`m_hasImageOverlay`).
2997
2998         (WebCore::RenderImage::shadowControlsNeedCustomLayoutMetrics const): Deleted.
2999         * rendering/RenderMedia.h:
3000
3001         See `RenderImage::layoutShadowControls` above.
3002
3003 2021-02-06  Zalan Bujtas  <zalan@apple.com>
3004
3005         [LFC][IFC] Continuation pre and post block inline boxes should not have both the start and end decorations of the original inline box
3006         https://bugs.webkit.org/show_bug.cgi?id=221502
3007
3008         Reviewed by Antti Koivisto.
3009
3010         The generated inline boxes inside the pre/post block containers of a continuation "inherit" all the original styles e.g.
3011         
3012         <span style="margin-left: 10px"><div></div></span>
3013         
3014         We turn this into a continuation by constructing a set of pre and a post block containers.
3015         
3016         (pre)Block container (anonymous)
3017           Inline container (<span>)
3018         Block container (<div></div>)
3019         (post)Block container (anonymous)
3020           Inline container (</span>)
3021
3022         Now the border box of the inline container inside the post block container should not have a 1px margin offset. Only the inline container in the pre block should "inherit" the left margin from the original <span>.
3023         Legacy line layout solves this issue by calling hasInlineDirectionBordersPaddingOrMargin() during layout to decide which side of the decorations to apply,
3024         but these inline boxes should not have those start/end values the first place.
3025         (see fast/inline/inline-with-empty-inline-continuations.html)
3026
3027         * layout/integration/LayoutIntegrationBoxTree.cpp:
3028         (WebCore::LayoutIntegration::BoxTree::buildTree):
3029         * layout/integration/LayoutIntegrationLineLayout.cpp:
3030         (WebCore::LayoutIntegration::LineLayout::updateInlineBoxDimensions):
3031
3032 2021-02-06  Zalan Bujtas  <zalan@apple.com>
3033
3034         [LFC][IFC][Quirk] Keep the root inline box baseline anchored at 0
3035         https://bugs.webkit.org/show_bug.cgi?id=221517
3036
3037         Reviewed by Antti Koivisto.
3038
3039         In quirks mode when the root inline box has no content, a negative baseline value should not push the root baseline upwards.
3040         e.g.
3041         <div><span style="vertical-align: -300px">this text should be ~300px while the root baseline is at 0px</span></div>
3042         However an inline box with negative ascent (e.g. large enough negative margin-top value) can pull the root inline box up.
3043
3044         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
3045         (WebCore::Layout::LineBoxBuilder::computeLineBoxHeightAndAlignInlineLevelBoxesVertically):
3046
3047 2021-02-06  Zalan Bujtas  <zalan@apple.com>
3048
3049         ASSERT NOT REACHED in WebCore::Layout::LineBuilder::candidateContentForLine
3050         https://bugs.webkit.org/show_bug.cgi?id=221492
3051         <rdar://problem/74032439>
3052
3053         Reviewed by Antti Koivisto.
3054
3055         Floats are not part of the inline content and they should be ignored while checking if the continuous candidate content ends in a wrap opportunity.
3056
3057         * layout/inlineformatting/InlineLineBuilder.cpp:
3058         (WebCore::Layout::LineBuilder::candidateContentForLine):
3059
3060 2021-02-05  Ricky Mondello  <rmondello@apple.com>
3061
3062         Deploy WTFMove in the constructor for AutofillElements
3063         https://bugs.webkit.org/show_bug.cgi?id=221507
3064
3065         Reviewed by Wenson Hsieh.
3066
3067         * editing/cocoa/AutofillElements.cpp:
3068         (WebCore::AutofillElements::AutofillElements):
3069
3070 2021-02-05  Sihui Liu  <sihui_liu@appe.com>
3071
3072         REGRESSION(r272337): crash under WebCore::SpeechRecognizer::setInactive()
3073         https://bugs.webkit.org/show_bug.cgi?id=221451
3074
3075         Reviewed by Youenn Fablet.
3076
3077         Stop sending final update in SpeechRecognizer's destructor and send it in prepareForDestruction() instead, so 
3078         that no update will be sent for a destroyed SpeechRecognizer.
3079
3080         API test: WebKit2.SpeechRecognitionWebProcessCrash.
3081
3082         * Modules/speech/SpeechRecognizer.cpp:
3083         (WebCore::SpeechRecognizer::prepareForDestruction):
3084         (WebCore::SpeechRecognizer::~SpeechRecognizer): Deleted.
3085         * Modules/speech/SpeechRecognizer.h:
3086
3087 2021-02-05  Ricky Mondello  <rmondello@apple.com>
3088
3089         Allow Password AutoFill in more text field configurations
3090
3091         https://bugs.webkit.org/show_bug.cgi?id=221429
3092         rdar://problem/73899947
3093
3094         Reviewed by Wenson Hsieh.
3095
3096         Extend where we'll offer Password AutoFill in web views. Allow all type=password fields. Allow in situations
3097         with back-to-back type=password fields, but only attempt to fill the second password field when it's empty,
3098         to flexibly accomodate account creation and password change scenarios.
3099
3100         I did a round of manual testing with the related existing OS feature.
3101
3102         * editing/cocoa/AutofillElements.cpp:
3103         (WebCore::AutofillElements::AutofillElements): Add secondPassword to initializer.
3104         (WebCore::AutofillElements::computeAutofillElements): Change the algorithm as described above.
3105         (WebCore::AutofillElements::autofill): Also fill the secondPassword, if applicable.
3106         * editing/cocoa/AutofillElements.h: Change constructor and add member variable.
3107
3108 2021-02-05  Eric Carlson  <eric.carlson@apple.com>
3109
3110         [Mac] Connect MediaSession with MediaRemote and NowPlaying
3111         https://bugs.webkit.org/show_bug.cgi?id=221431
3112         <rdar://problem/74000363>
3113
3114         Reviewed by Jer Noble.
3115
3116         Route all remote control commands to navigator.mediaSession when it has any 
3117         registered action handlers, and pass navigator.mediaSession.metadata to NowPlaying.
3118
3119         Tested with new API tests in Tools/TestWebKitAPI/Tests/WebKitCocoa/MediaSession.mm.
3120
3121         * Modules/mediasession/MediaImage.h:
3122         (WebCore::MediaImage::encode const):
3123         (WebCore::MediaImage::decode):
3124         * Modules/mediasession/MediaMetadata.cpp:
3125         (WebCore::MediaMetadata::setTitle):
3126         (WebCore::MediaMetadata::setArtist):
3127         (WebCore::MediaMetadata::setAlbum):
3128         (WebCore::MediaMetadata::setArtwork):
3129         * Modules/mediasession/MediaMetadata.h:
3130         (WebCore::MediaMetadata::title const):
3131         (WebCore::MediaMetadata::artist const):
3132         (WebCore::MediaMetadata::album const):
3133         (WebCore::MediaMetadata::artwork const):
3134         (WebCore::MediaMetadata::metadata const):
3135         * Modules/mediasession/MediaMetadataInit.h:
3136         (WebCore::MediaMetadataInit::encode const):
3137         (WebCore::MediaMetadataInit::decode):
3138         * Modules/mediasession/MediaSession.cpp:
3139         (WebCore::nextLogIdentifier):
3140         (WebCore::logChannel):
3141         (WebCore::logClassName):
3142         (WebCore::platformCommandForMediaSessionAction):
3143         (WebCore::MediaSession::MediaSession):
3144         (WebCore::MediaSession::setMetadata):
3145         (WebCore::MediaSession::setPlaybackState):
3146         (WebCore::MediaSession::setActionHandler):
3147         (WebCore::MediaSession::setPositionState):
3148         * Modules/mediasession/MediaSession.h:
3149         (WebCore::MediaSession::hasActiveActionHandlers const):
3150         (WebCore::MediaSession::logger const):
3151         (WebCore::MediaSession::logIdentifier const):
3152         (WTF::LogArgument<WebCore::MediaSessionPlaybackState>::toString):
3153         (WTF::LogArgument<WebCore::MediaSessionAction>::toString):
3154         * WebCore.xcodeproj/project.pbxproj:
3155         * html/HTMLMediaElement.cpp:
3156         (WebCore::HTMLMediaElement::didReceiveRemoteControlCommand):
3157         * html/MediaElementSession.cpp:
3158         (WebCore::MediaElementSession::didReceiveRemoteControlCommand):
3159         (WebCore::MediaElementSession::nowPlayingInfo const):
3160         * html/MediaElementSession.h:
3161         * page/ChromeClient.h:
3162         * platform/RemoteCommandListener.cpp:
3163         (WebCore::RemoteCommandListener::scheduleSupportedCommandsUpdate):
3164         (WebCore::RemoteCommandListener::addSupportedCommand):
3165         (WebCore::RemoteCommandListener::removeSupportedCommand):
3166         * platform/RemoteCommandListener.h:
3167         * platform/audio/NowPlayingInfo.h:
3168         (WebCore::NowPlayingInfo::decode):
3169         * platform/audio/PlatformMediaSession.cpp:
3170         (WebCore::convertEnumerationToString):
3171         * platform/audio/PlatformMediaSession.h:
3172         * platform/audio/PlatformMediaSessionManager.h:
3173         (WebCore::PlatformMediaSessionManager::addSupportedCommand):
3174         (WebCore::PlatformMediaSessionManager::removeSupportedCommand):
3175         * platform/audio/cocoa/MediaSessionManagerCocoa.h:
3176         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
3177         (WebCore::MediaSessionManagerCocoa::scheduleSessionStatusUpdate):
3178         (WebCore::MediaSessionManagerCocoa::sessionCanProduceAudioChanged):
3179         (WebCore::MediaSessionManagerCocoa::addSupportedCommand):
3180         (WebCore::MediaSessionManagerCocoa::removeSupportedCommand):
3181         (WebCore::MediaSessionManagerCocoa::setNowPlayingInfo):
3182         * platform/mac/MediaRemoteSoftLink.cpp:
3183         * platform/mac/MediaRemoteSoftLink.h:
3184         * platform/mac/RemoteCommandListenerMac.h:
3185         * platform/mac/RemoteCommandListenerMac.mm:
3186         (WebCore::mediaRemoteCommandForPlatformCommand):
3187         (WebCore::RemoteCommandListenerMac::defaultCommands):
3188         (WebCore::isSeekCommand):
3189         (WebCore::RemoteCommandListenerMac::updateSupportedCommands):
3190         (WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac):
3191
3192 2021-02-05  Jer Noble  <jer.noble@apple.com>
3193
3194         [Cocoa] CRASH in MediaPlayerPrivateMediaSourceAVFObjC::removeAudioRenderer()
3195         https://bugs.webkit.org/show_bug.cgi?id=221490
3196         <rdar://73966316>
3197
3198         Reviewed by Eric Carlson.
3199
3200         Add null-checks to every use of player() in SourceBufferPrivateAVFObjC.
3201
3202         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
3203         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3204         (WebCore::SourceBufferPrivateAVFObjC::didParseInitializationData):
3205         (WebCore::SourceBufferPrivateAVFObjC::willProvideContentKeyRequestInitializationDataForTrackID):
3206         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
3207         (WebCore::SourceBufferPrivateAVFObjC::appendCompleted):
3208         (WebCore::SourceBufferPrivateAVFObjC::destroyParser):
3209         (WebCore::SourceBufferPrivateAVFObjC::destroyRenderers):
3210         (WebCore::SourceBufferPrivateAVFObjC::readyState const):
3211         (WebCore::SourceBufferPrivateAVFObjC::setReadyState):
3212         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
3213         (WebCore::SourceBufferPrivateAVFObjC::flushVideo):
3214         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
3215         (WebCore::SourceBufferPrivateAVFObjC::bufferWasConsumed):
3216         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession):
3217         (WebCore::SourceBufferPrivateAVFObjC::player const):
3218
3219 2021-02-05  Devin Rousso  <drousso@apple.com>
3220
3221         [macOS] REGRESSION(r272352): missing track for videos that haven't fully loaded
3222         https://bugs.webkit.org/show_bug.cgi?id=221500
3223
3224         Reviewed by Eric Carlson.
3225
3226         r272352 removed the `.track.fill` that was used as a "background" for the slider. For videos
3227         that aren't fully loaded and are buffering, that "background" is necessary to indicate where
3228         the slider is as the `.track.secondary` only represents what's been buffered not the entire
3229         length of the video/slider.
3230
3231         * Modules/modern-media-controls/controls/slider.js:
3232         (Slider.prototype.commit):
3233         * Modules/modern-media-controls/controls/slider.css:
3234         (.slider > .custom-slider > .fill.primary): Added.
3235         (.slider > .custom-slider > .fill.track): Added.
3236         (.slider > .custom-slider > .fill.secondary): Added.
3237         (.slider > .custom-slider > .primary): Deleted.
3238         (.slider > .custom-slider > .secondary): Deleted.
3239         Add back the background fill track removed in r272352, but adjust it so that it only draws
3240         after the knob so that on macOS it doesn't draw in the space around the knob.
3241
3242         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
3243         (MacOSFullscreenMediaControls):
3244         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
3245         (MacOSInlineMediaControls):
3246         Remove the `secondaryValue` calls since the background fill track has been added back.
3247
3248 2021-02-05  Sam Weinig  <weinig@apple.com>
3249
3250         Generalize color conversion code to reduce number of overloads required
3251         https://bugs.webkit.org/show_bug.cgi?id=221443
3252
3253         Reviewed by Darin Adler.
3254
3255         Replace overloaded named conversion functions (e.g. toSRGBA(), toLab(), etc.)
3256         with template specializion of a new ColorConversion struct:
3257         
3258             template<> struct ColorConversion<Output, Input> {
3259                 Output convert(const Input& color) { ... }
3260             };
3261
3262         which is accessed via a new generic convertColor<ColorType>() function.
3263
3264         This allows for a few improvements:
3265           - Removes the need for each color type to define an identity conversion.
3266           - Removes the need for each color type to define an generic conversion.
3267           - Allows integration with component type conversion so a call like
3268           
3269               convertTo<SRGBA<uint8_t>>(toSRGBA(hsla))
3270             
3271             can now be written just as
3272             
3273               convertColor<SRGBA<uint8_t>>(hsla)
3274         
3275         This also provides a path forward for more optimizations / simplifications
3276         since we can now reason about conversion based purely on types.
3277
3278         * css/parser/CSSPropertyParserHelpers.cpp:
3279         (WebCore::CSSPropertyParserHelpers::parseRGBParameters):
3280         (WebCore::CSSPropertyParserHelpers::parseHSLParameters):
3281         (WebCore::CSSPropertyParserHelpers::parseHWBParameters):
3282         (WebCore::CSSPropertyParserHelpers::parseLabParameters):
3283         (WebCore::CSSPropertyParserHelpers::parseLCHParameters):
3284         (WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
3285         Switch to convertColor<> and replace some unnecessary type with auto.
3286
3287         * editing/cocoa/DataDetection.mm:
3288         (WebCore::DataDetection::detectContentInRange):
3289         Adopt Color::toColorTypeLossy<> and convertColor<>.
3290
3291         * platform/graphics/Color.cpp:
3292         (WebCore::Color::invertedColorWithAlpha const):
3293         Adopt convertColor<>.
3294
3295         * platform/graphics/Color.h:
3296         (WebCore::Color::toSRGBALossy const):
3297         (WebCore::Color::toColorTypeLossy const):
3298         Add generic conversion function toColorTypeLossy<>() and re-implement
3299         toSRGBALossy<>() using it.
3300
3301         * platform/graphics/ColorConversion.cpp:
3302         * platform/graphics/ColorConversion.h:
3303         Replace function overloads with explicit specialization of the new ColorConversion
3304         struct. Replace identity functions and fallback functions with a single non-specialized
3305         ColorConversion which uses constexpr to handle the identity case, conversion to/from
3306         SRGBA<uint8_t> (the only non-float color) and the fallback case.
3307
3308         * platform/graphics/ColorUtilities.cpp:
3309         (WebCore::luminance):
3310         Adopt convertColor<>.
3311
3312         * platform/graphics/cg/ColorCG.cpp:
3313         (WebCore::roundAndClampToSRGBALossy):
3314         (WebCore::leakCGColor):
3315         Adopt convertColor<>.
3316
3317         * platform/graphics/filters/FELighting.cpp:
3318         (WebCore::FELighting::drawLighting):
3319         Adopt toColorTypeLossy<>.
3320
3321         * rendering/RenderTheme.cpp:
3322         (WebCore::RenderTheme::datePlaceholderTextColor const):
3323         Adopt Color::toColorTypeLossy<> and convertColor<>.
3324
3325 2021-02-05  Antti Koivisto  <antti@apple.com>
3326
3327         [LFC][Integration] Hit testing broken for descendants of pointer-events:none boxes
3328         https://bugs.webkit.org/show_bug.cgi?id=221460
3329
3330         Reviewed by Zalan Bujtas.
3331
3332         Descendants of pointer-events:none boxes may still be hittestable if they override the value.
3333         LFC integration hit testing code didn't take this into account.
3334
3335         Test: fast/events/hittest-pointer-event-none-descendants.html
3336
3337         * layout/integration/LayoutIntegrationLineLayout.cpp:
3338         (WebCore::LayoutIntegration::LineLayout::hitTest):
3339
3340         Replaced and inline-block boxes do the visibility/pointer-events test themselves.
3341         This code just needs to take care of text boxes.
3342
3343 2021-02-05  Youenn Fablet  <youenn@apple.com>
3344
3345         Enable audio capture for speech recognition in GPUProcess
3346         https://bugs.webkit.org/show_bug.cgi?id=221457
3347
3348         Reviewed by Eric Carlson.
3349
3350         Add fake deviceId to play nice with capture ASSERTs.
3351         Covered by updated tests.
3352
3353         * Modules/speech/SpeechRecognitionCaptureSource.cpp:
3354         (WebCore::SpeechRecognitionCaptureSource::createRealtimeMediaSource):
3355
3356 2021-02-05  Patrick Angle  <pangle@apple.com>
3357
3358         Web Inspector: Implement backend support for maintaining a list of Grid layout contexts
3359         https://bugs.webkit.org/show_bug.cgi?id=221228
3360
3361         Reviewed by Devin Rousso.
3362
3363         Test: inspector/dom/layout-context.html
3364
3365         Implemented support for getting the layout context for `grid` nodes as part of the existing `DOM.Node` protocol
3366         object as well as firing an event when the layout context type changes for a node.
3367
3368         * dom/Element.cpp:
3369         (WebCore::Element::didChangeRenderer):
3370         - Handle the underlying RenderObject changing.
3371         * dom/Element.h:
3372         * dom/Node.h:
3373         (WebCore::Node::didChangeRenderer):
3374         * inspector/InspectorInstrumentation.cpp:
3375         (WebCore::InspectorInstrumentation::nodeLayoutContextChangedImpl):
3376         * inspector/InspectorInstrumentation.h:
3377         (WebCore::InspectorInstrumentation::nodeLayoutContextChanged):
3378         - Add instrumentation for layout context changes.
3379         * inspector/agents/InspectorCSSAgent.cpp:
3380         (WebCore::InspectorCSSAgent::layoutContextTypeForRenderer):
3381         (WebCore::InspectorCSSAgent::nodeLayoutContextTypeChanged):
3382         - Inform the frontend when a known node changes its layout context.
3383         * inspector/agents/InspectorCSSAgent.h:
3384         * inspector/agents/InspectorDOMAgent.cpp:
3385         (WebCore::InspectorDOMAgent::buildObjectForNode):
3386         - Set the layout context for nodes that will be new to the frontend.
3387         * rendering/RenderObject.h:
3388         (WebCore::Node::setRenderer):
3389
3390 2021-02-05  Chris Dumez  <cdumez@apple.com>
3391
3392         [GPUProcess] If the GPUProcess crashes during fullscreen playback, video pauses and exits fullscreen
3393         https://bugs.webkit.org/show_bug.cgi?id=221485
3394
3395         Reviewed by Eric Carlson.
3396
3397         If the GPUProcess crashed during fullscreen playback, video would pause and exit fullscreen. This was suboptimal.
3398         The video now just resumes playing while in fullscreen, just like we do when inline.
3399
3400         * html/HTMLMediaElement.cpp:
3401         (WebCore::HTMLMediaElement::mediaPlayerReloadAndResumePlaybackIfNeeded):
3402
3403 2021-02-05  Youenn Fablet  <youenn@apple.com>
3404
3405         Make sure click attribution is processed in case of redirected kept alive loads
3406         https://bugs.webkit.org/show_bug.cgi?id=221453