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