a00d68cd364d1f753c36603670cf2e62cb5fcb97
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2021-05-17  Chris Dumez  <cdumez@apple.com>
2
3         Move more logic from AudioDestinationNode to its subclasses
4         https://bugs.webkit.org/show_bug.cgi?id=225849
5
6         Reviewed by Sam Weinig.
7
8         Move more logic from AudioDestinationNode to its subclasses. In particular, AudioDestinationNode
9         contains a lot of things that are specific to real-time audio rendering and those should go to
10         DefaultAudioDestinationNode.
11
12         This allows us to move isPlayingAudioDidChange() from BaseAudioContext to AudioContext also.
13
14         * Modules/webaudio/AudioContext.cpp:
15         (WebCore::AudioContext::isPlayingAudioDidChange):
16         * Modules/webaudio/AudioContext.h:
17         * Modules/webaudio/AudioDestinationNode.cpp:
18         (WebCore::AudioDestinationNode::renderQuantum):
19         * Modules/webaudio/AudioDestinationNode.h:
20         * Modules/webaudio/BaseAudioContext.cpp:
21         * Modules/webaudio/BaseAudioContext.h:
22         * Modules/webaudio/DefaultAudioDestinationNode.cpp:
23         (WebCore::DefaultAudioDestinationNode::createDestination):
24         (WebCore::DefaultAudioDestinationNode::framesPerBuffer const):
25         (WebCore::DefaultAudioDestinationNode::render):
26         (WebCore::DefaultAudioDestinationNode::setIsSilent):
27         (WebCore::DefaultAudioDestinationNode::isPlayingDidChange):
28         (WebCore::DefaultAudioDestinationNode::updateIsEffectivelyPlayingAudio):
29         * Modules/webaudio/DefaultAudioDestinationNode.h:
30         * Modules/webaudio/OfflineAudioDestinationNode.cpp:
31         (WebCore::OfflineAudioDestinationNode::OfflineAudioDestinationNode):
32         (WebCore::OfflineAudioDestinationNode::startRendering):
33         (WebCore::OfflineAudioDestinationNode::renderOnAudioThread):
34         * Modules/webaudio/OfflineAudioDestinationNode.h:
35
36 2021-05-17  Peng Liu  <peng.liu6@apple.com>
37
38         [GPUP] WebContent process should not pull audio session category from the GPU Process
39         https://bugs.webkit.org/show_bug.cgi?id=225826
40
41         Reviewed by Darin Adler.
42
43         Change AudioSession::Category to be an enum class.
44
45         * platform/audio/AudioSession.cpp:
46         (WebCore::AudioSession::categoryOverride const):
47         (WebCore::AudioSession::category const):
48         * platform/audio/AudioSession.h:
49         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
50         (WebCore::MediaSessionManagerCocoa::updateSessionState):
51         * platform/audio/ios/AudioSessionIOS.mm:
52         (WebCore::AudioSessionPrivate::AudioSessionPrivate):
53         (WebCore::AudioSession::setCategory):
54         (WebCore::AudioSession::category const):
55         * platform/audio/mac/AudioSessionMac.mm:
56         (WebCore::AudioSession::setCategory):
57         * platform/audio/mac/SharedRoutingArbitrator.h:
58         * platform/audio/mac/SharedRoutingArbitrator.mm:
59         (WebCore::SharedRoutingArbitrator::beginRoutingArbitrationForToken):
60         * platform/mediastream/mac/BaseAudioSharedUnit.cpp:
61         (WebCore::BaseAudioSharedUnit::startUnit):
62         * platform/mock/MockRealtimeAudioSource.cpp:
63         (WebCore::MockRealtimeAudioSource::startProducingData):
64         * testing/Internals.cpp:
65         (WebCore::Internals::audioSessionCategory const):
66
67 2021-05-17  Rob Buis  <rbuis@igalia.com>
68
69         will-change: contain should create a containing block
70         https://bugs.webkit.org/show_bug.cgi?id=225442
71
72         Reviewed by Antti Koivisto.
73
74         Make will-change: contain cause the element to be a containing block for both
75         position: fixed and position: absolute cases as well as create a CSS stacking
76         context for the element.
77
78         Tests: imported/w3c/web-platform-tests/css/css-contain/contain-paint-stacking-context-001b.html
79                imported/w3c/web-platform-tests/css/css-will-change/will-change-fixpos-cb-contain-1.html
80
81         * rendering/style/WillChangeData.cpp:
82         (WebCore::WillChangeData::createsContainingBlockForOutOfFlowPositioned const):
83         (WebCore::WillChangeData::propertyCreatesStackingContext):
84         * style/StyleBuilderCustom.h:
85         (WebCore::Style::BuilderCustom::applyValueWillChange):
86
87 2021-05-17  Tim Nguyen  <ntim@apple.com>
88
89         will-change: position should not create a containing block for position: fixed elements
90         https://bugs.webkit.org/show_bug.cgi?id=225443
91
92         Reviewed by Antti Koivisto.
93
94         This partially undoes r276627 which made will-change: position create a CB for all out-of-flow elements:
95
96         - Removed CSSPropertyPosition from createsContainingBlockForOutOfFlowPositioned() to not create a containing block
97         for position: fixed; children.
98         - Added createsContainingBlockForAbsolutelyPositioned() with CSSPropertyPosition to still create a containing block
99         for position: absolute; children.
100
101         Enabled WPT (which covers both cases): css/css-will-change/will-change-fixpos-cb-position-1.html
102
103         * rendering/RenderElement.h:
104         (WebCore::RenderElement::canContainAbsolutelyPositionedObjects const):
105         * rendering/style/WillChangeData.cpp:
106         (WebCore::WillChangeData::createsContainingBlockForAbsolutelyPositioned const):
107         (WebCore::WillChangeData::createsContainingBlockForOutOfFlowPositioned const):
108         * rendering/style/WillChangeData.h:
109
110 2021-05-17  Zan Dobersek  <zdobersek@igalia.com>
111
112         REGRESSION(r277560): conditional attribute typos in IDLs for OffscreenCanvas, OffscreenCanvasRenderingContext2D
113         https://bugs.webkit.org/show_bug.cgi?id=225858
114
115         Unreviewed. Tweaking the for-worker conditional attribute values for the
116         OffscreenCanvas and OffscreenCanvasRenderingContext2D interfaces after
117         the r277560 refactoring. The mismatch in the conditional values left the
118         two interfaces outside any worker global space.
119
120         * html/OffscreenCanvas.idl:
121         * html/canvas/OffscreenCanvasRenderingContext2D.idl:
122
123 2021-05-16  Sam Weinig  <weinig@apple.com>
124
125         Support serializing ImageData object colorSpace property in SerializedScriptValue
126         https://bugs.webkit.org/show_bug.cgi?id=225854
127
128         Reviewed by Chris Dumez.
129
130         Test: storage/indexeddb/structured-clone-image-data-display-p3.html
131
132         Update SerializedScriptValue schema to version 8 and add serialization
133         of the colorSpace property.
134
135         * bindings/js/SerializedScriptValue.cpp:
136         (WebCore::PredefinedColorSpaceTag):
137         Add copy of the PredefinedColorSpace values that are guaranteed to
138         stay consistent forever.
139
140         (WebCore::CloneSerializer::dumpIfTerminal):
141         Add encoding of the colorSpace when serializing ImageData.
142
143         (WebCore::CloneSerializer::write):
144         (WebCore::CloneDeserializer::read):
145         Add coders for PredefinedColorSpaceTag.
146
147         (WebCore::CloneDeserializer::getJSValue):
148         Replace multiple overloads with one perfect forwarding overload which does
149         what we want and works with r-values.
150
151         (WebCore::CloneDeserializer::readImageBitmap):
152         Use auto in two places.
153
154         (WebCore::CloneDeserializer::readTerminal):
155         Add decoding of the colorSpace when deserializing ImageData. For prior versions,
156         the colorSpace defaults to sRGB, which was the only color space supported.
157
158 2021-05-14  Jer Noble  <jer.noble@apple.com>
159
160         MediaSessionCoordinator survives page reload/navigation
161         https://bugs.webkit.org/show_bug.cgi?id=225822
162
163         Reviewed by Eric Carlson.
164
165         Because the MediaSessionCoordinator is created and owned by Page, it will survive
166         a reload (as Page is not re-created), and the same MediaSessionCoordinator object
167         will be added to MediaSession when the new Navigator is created.
168
169         Rather than have Page own the coordinator itself, it can instead own the
170         MediaSessionCoordinatorPrivate used to create the coordinator. When the MediaSession
171         is created, it will query the Page to ask for a MediaSessionCoordinatorPrivate to
172         use to create the coordinator, guaranteeing a new object is created.
173
174         The session itself should be left when the document is put into Back/Forward
175         Cache, or closed when the document is stopped entirely.
176
177         A few drive-by fixes:
178
179         The direction of coordinatorStateChanged() is now reversed; it flows down from the
180         UIProcess to update the state of the MediaSessionCoordinator. This allows the coordinator
181         to react when it's private implementation changes state.
182
183         Add a new upward notification when the trackIdentifier in MediaMetadata changes.
184
185         * Modules/mediasession/MediaSession.cpp:
186         (WebCore::MediaSession::MediaSession):
187         (WebCore::MediaSession::suspend):
188         (WebCore::MediaSession::stop):
189         (WebCore::MediaSession::createCoordinator):
190         (WebCore::MediaSession::setCoordinator): Deleted.
191         * Modules/mediasession/MediaSession.h:
192         * Modules/mediasession/MediaSessionCoordinator.cpp:
193         (WebCore::MediaSessionCoordinator::join):
194         (WebCore::MediaSessionCoordinator::leave):
195         (WebCore::MediaSessionCoordinator::close):
196         (WebCore::MediaSessionCoordinator::metadataChanged):
197         (WebCore::MediaSessionCoordinator::positionStateChanged):
198         (WebCore::MediaSessionCoordinator::playbackStateChanged):
199         (WebCore::MediaSessionCoordinator::readyStateChanged):
200         (WebCore::MediaSessionCoordinator::seekSessionToTime):
201         (WebCore::MediaSessionCoordinator::pauseSession):
202         (WebCore::MediaSessionCoordinator::coordinatorStateChanged):
203         * Modules/mediasession/MediaSessionCoordinator.h:
204         * Modules/mediasession/MediaSessionCoordinatorPrivate.h:
205         (WebCore::MediaSessionCoordinatorClient::coordinatorStateChanged):
206         * page/Page.cpp:
207         (WebCore::Page::setMediaSessionCoordinator):
208         (WebCore::Page::invalidateMediaSessionCoordinator):
209         * page/Page.h:
210         (WebCore::Page::mediaSessionCoordinator):
211         * testing/Internals.cpp:
212         (WebCore::Internals::registerMockMediaSessionCoordinator):
213         * testing/Internals.h:
214         * testing/MockMediaSessionCoordinator.cpp:
215         (WebCore::MockMediaSessionCoordinator::trackIdentifierChanged):
216         (WebCore::MockMediaSessionCoordinator::coordinatorStateChanged): Deleted.
217         * testing/MockMediaSessionCoordinator.h:
218
219 2021-05-16  Chris Dumez  <cdumez@apple.com>
220
221         Modernize / Optimize SQLiteStatement creation and preparation
222         https://bugs.webkit.org/show_bug.cgi?id=225791
223
224         Reviewed by Sam Weinig.
225
226         Modernize / Optimize SQLiteStatement creation and preparation:
227         - The SQLiteStatement constructor is now private so that we never have a
228           SQLiteStatement that has not been "prepared". Only the SQLiteDatabase
229           can now construct SQLiteStatement objects. We already needed to pass
230           a SQLiteDatabase reference when constructing the SQLiteStatement anyway.
231         - The construct AND prepare a SQLiteStatement, we now call
232           SQLiteDatabase::prepareStatement() to get a stack object or
233           SQLiteDatabase::prepareHeapStatement() to get a heap one. These functions
234           return an Expected<> type so they will either return a "prepared"
235           SQLiteStatement or an unexpected SQLite error code.
236         - The prepare*Statement() functions now avoid String allocations in most
237           cases thanks to overloads taking in the query as an ASCIILiteral.
238         - Drop finalize() function on SQLiteStatement so SQLiteStatement objects
239           are always valid. It simplifies the implementation of SQLiteStatement
240           member functions. The SQLiteStatement destructor "finalizes" the statement
241           so users can simply destroy the SQLiteStatement if they need the object
242           to be finalize at a certain point (e.g. before closing a database).
243         - Drop the prepare() & prepareAndStep() SQLiteStatement member functions now
244           that SQLiteStatement are always prepared.
245         - Stop storing the SQL query as a String data member in SQLiteStatement class.
246           This is no longer needed now that they is no separe prepare step after the
247           construction. This makes the SQLiteStatement a bit smaller.
248
249         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
250         (WebCore::IDBServer::createOrMigrateRecordsTableIfNecessary):
251         (WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidBlobTables):
252         (WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsTable):
253         (WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsIndex):
254         (WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsRecordIndex):
255         (WebCore::IDBServer::SQLiteIDBBackingStore::createAndPopulateInitialDatabaseInfo):
256         (WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidObjectStoreInfoTable):
257         (WebCore::IDBServer::SQLiteIDBBackingStore::migrateIndexInfoTableForIDUpdate):
258         (WebCore::IDBServer::SQLiteIDBBackingStore::migrateIndexRecordsTableForIDUpdate):
259         (WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo):
260         (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameAndVersionFromFile):
261         (WebCore::IDBServer::SQLiteIDBBackingStore::beginTransaction):
262         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteBackingStore):
263         (WebCore::IDBServer::SQLiteIDBBackingStore::cachedStatement):
264         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
265         (WebCore::IDBServer::SQLiteIDBCursor::createSQLiteStatement):
266         (WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindPreIndexStatementIfNecessary):
267         (WebCore::IDBServer::SQLiteIDBCursor::internalFetchNextRecord):
268         * Modules/webdatabase/Database.cpp:
269         (WebCore::setTextValueInDatabase):
270         (WebCore::retrieveTextResultFromDatabase):
271         (WebCore::Database::performGetTableNames):
272         * Modules/webdatabase/DatabaseTracker.cpp:
273         (WebCore::DatabaseTracker::hasEntryForOriginNoLock):
274         (WebCore::DatabaseTracker::hasEntryForDatabase):
275         (WebCore::DatabaseTracker::fullPathForDatabaseNoLock):
276         (WebCore::DatabaseTracker::origins):
277         (WebCore::DatabaseTracker::databaseNamesNoLock):
278         (WebCore::DatabaseTracker::detailsForNameAndOrigin):
279         (WebCore::DatabaseTracker::setDatabaseDetails):
280         (WebCore::DatabaseTracker::quotaNoLock):
281         (WebCore::DatabaseTracker::setQuota):
282         (WebCore::DatabaseTracker::addDatabase):
283         (WebCore::DatabaseTracker::deleteOrigin):
284         (WebCore::DatabaseTracker::deleteDatabase):
285         (WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
286         (WebCore::DatabaseTracker::deleteDatabaseFileIfEmpty):
287         * Modules/webdatabase/SQLStatement.cpp:
288         (WebCore::SQLStatement::execute):
289         * loader/appcache/ApplicationCacheStorage.cpp:
290         (WebCore::ApplicationCacheStorage::loadCacheGroup):
291         (WebCore::ApplicationCacheStorage::loadManifestHostHashes):
292         (WebCore::ApplicationCacheStorage::cacheGroupForURL):
293         (WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL):
294         (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
295         (WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
296         (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
297         (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
298         (WebCore::ApplicationCacheStorage::verifySchemaVersion):
299         (WebCore::ApplicationCacheStorage::executeStatement):
300         (WebCore::ApplicationCacheStorage::store):
301         (WebCore::ApplicationCacheStorage::storeUpdatedType):
302         (WebCore::ApplicationCacheStorage::ensureOriginRecord):
303         (WebCore::ApplicationCacheStorage::storeNewestCache):
304         (WebCore::ApplicationCacheStorage::loadCache):
305         (WebCore::ApplicationCacheStorage::remove):
306         (WebCore::ApplicationCacheStorage::manifestURLs):
307         (WebCore::ApplicationCacheStorage::deleteCacheGroupRecord):
308         (WebCore::ApplicationCacheStorage::checkForDeletedResources):
309         (WebCore::ApplicationCacheStorage::flatFileAreaSize):
310         * platform/network/curl/CookieJarDB.cpp:
311         (WebCore::CookieJarDB::verifySchemaVersion):
312         (WebCore::CookieJarDB::checkDatabaseValidity):
313         (WebCore::CookieJarDB::searchCookies):
314         (WebCore::CookieJarDB::getAllCookies):
315         (WebCore::CookieJarDB::allDomains):
316         (WebCore::CookieJarDB::createPrepareStatement):
317         (WebCore::CookieJarDB::executeSql):
318         * platform/sql/SQLiteDatabase.cpp:
319         (WebCore::SQLiteDatabase::open):
320         (WebCore::SQLiteDatabase::useWALJournalMode):
321         (WebCore::SQLiteDatabase::maximumSize):
322         (WebCore::SQLiteDatabase::setMaximumSize):
323         (WebCore::SQLiteDatabase::pageSize):
324         (WebCore::SQLiteDatabase::freeSpaceSize):
325         (WebCore::SQLiteDatabase::totalSize):
326         (WebCore::SQLiteDatabase::executeCommand):
327         (WebCore::SQLiteDatabase::returnsAtLeastOneResult):
328         (WebCore::SQLiteDatabase::tableExists):
329         (WebCore::SQLiteDatabase::clearAllTables):
330         (WebCore::SQLiteDatabase::turnOnIncrementalAutoVacuum):
331         (WebCore::constructAndPrepareStatement):
332         (WebCore::SQLiteDatabase::prepareStatement):
333         (WebCore::SQLiteDatabase::prepareHeapStatement):
334         * platform/sql/SQLiteDatabase.h:
335         * platform/sql/SQLiteStatement.cpp:
336         (WebCore::SQLiteStatement::SQLiteStatement):
337         (WebCore::SQLiteStatement::~SQLiteStatement):
338         (WebCore::SQLiteStatement::step):
339         (WebCore::SQLiteStatement::reset):
340         (WebCore::SQLiteStatement::executeCommand):
341         (WebCore::SQLiteStatement::returnsAtLeastOneResult):
342         (WebCore::SQLiteStatement::bindBlob):
343         (WebCore::SQLiteStatement::bindText):
344         (WebCore::SQLiteStatement::bindInt):
345         (WebCore::SQLiteStatement::bindInt64):
346         (WebCore::SQLiteStatement::bindDouble):
347         (WebCore::SQLiteStatement::bindNull):
348         (WebCore::SQLiteStatement::bindParameterCount const):
349         (WebCore::SQLiteStatement::columnCount):
350         (WebCore::SQLiteStatement::isColumnNull):
351         (WebCore::SQLiteStatement::isColumnDeclaredAsBlob):
352         (WebCore::SQLiteStatement::getColumnName):
353         (WebCore::SQLiteStatement::getColumnValue):
354         (WebCore::SQLiteStatement::getColumnText):
355         (WebCore::SQLiteStatement::getColumnDouble):
356         (WebCore::SQLiteStatement::getColumnInt):
357         (WebCore::SQLiteStatement::getColumnInt64):
358         (WebCore::SQLiteStatement::getColumnBlobAsString):
359         (WebCore::SQLiteStatement::getColumnBlobAsVector):
360         (WebCore::SQLiteStatement::returnTextResults):
361         (WebCore::SQLiteStatement::returnIntResults):
362         (WebCore::SQLiteStatement::returnInt64Results):
363         (WebCore::SQLiteStatement::returnDoubleResults):
364         * platform/sql/SQLiteStatement.h:
365         * platform/win/SearchPopupMenuDB.cpp:
366         (WebCore::SearchPopupMenuDB::checkDatabaseValidity):
367         (WebCore::SearchPopupMenuDB::verifySchemaVersion):
368         (WebCore::SearchPopupMenuDB::executeSimpleSql):
369         (WebCore::SearchPopupMenuDB::createPreparedStatement):
370         * workers/service/server/RegistrationDatabase.cpp:
371         (WebCore::RegistrationDatabase::ensureValidRecordsTable):
372         (WebCore::RegistrationDatabase::doPushChanges):
373         (WebCore::RegistrationDatabase::importRecords):
374
375 2021-05-16  Alan Bujtas  <zalan@apple.com>
376
377         [LFC] Cleanup FormattingContext class
378         https://bugs.webkit.org/show_bug.cgi?id=225744
379
380         Reviewed by Antti Koivisto.
381
382         This final patch makes the FormattingContext interface uncluttered.
383
384         * WebCore.xcodeproj/project.pbxproj:
385         * layout/FormattingState.h:
386         (WebCore::Layout::FormattingState::setIntrinsicWidthConstraints):
387         (WebCore::Layout::FormattingState::intrinsicWidthConstraints const):
388         (WebCore::Layout::FormattingState::setIntrinsicWidthConstraintsForBox):
389         (WebCore::Layout::FormattingState::intrinsicWidthConstraintsForBox const):
390         * layout/LayoutContext.cpp:
391         (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
392         * layout/LayoutUnits.h:
393         (WebCore::Layout::IntrinsicWidthConstraints::expand):
394         (WebCore::Layout::IntrinsicWidthConstraints::operator+=):
395         (WebCore::Layout::IntrinsicWidthConstraints::operator-=):
396         * layout/formattingContexts/FormattingContext.cpp:
397         * layout/formattingContexts/FormattingContext.h:
398         (WebCore::Layout::FormattingContext::root const):
399         (WebCore::Layout::FormattingContext::formattingState const):
400         (WebCore::Layout::FormattingContext::isBlockFormattingContext const):
401         (WebCore::Layout::FormattingContext::isInlineFormattingContext const):
402         (WebCore::Layout::FormattingContext::isTableFormattingContext const):
403         (WebCore::Layout::FormattingContext::isTableWrapperBlockFormattingContext const):
404         (WebCore::Layout::FormattingContext::isFlexFormattingContext const):
405         (WebCore::Layout::FormattingContext::IntrinsicWidthConstraints::expand): Deleted.
406         (WebCore::Layout::FormattingContext::IntrinsicWidthConstraints::operator+=): Deleted.
407         (WebCore::Layout::FormattingContext::IntrinsicWidthConstraints::operator-=): Deleted.
408         * layout/formattingContexts/FormattingGeometry.cpp:
409         (WebCore::Layout::FormattingGeometry::computedWidthValue):
410         (WebCore::Layout::FormattingGeometry::shrinkToFitWidth):
411         (WebCore::Layout::FormattingGeometry::constrainByMinMaxWidth const):
412         (WebCore::Layout::FormattingGeometry::constraintsForOutOfFlowContent):
413         (WebCore::Layout::FormattingGeometry::constraintsForInFlowContent const):
414         * layout/formattingContexts/FormattingGeometry.h:
415         * layout/formattingContexts/block/BlockFormattingContext.cpp:
416         (WebCore::Layout::BlockFormattingContext::computedIntrinsicWidthConstraints):
417         * layout/formattingContexts/block/BlockFormattingGeometry.cpp:
418         (WebCore::Layout::BlockFormattingGeometry::intrinsicWidthConstraints):
419         * layout/formattingContexts/block/BlockFormattingGeometry.h:
420         * layout/formattingContexts/block/BlockMarginCollapse.cpp:
421         * layout/formattingContexts/flex/FlexFormattingContext.cpp:
422         (WebCore::Layout::FlexFormattingContext::computedIntrinsicWidthConstraints):
423         * layout/formattingContexts/flex/FlexFormattingGeometry.cpp:
424         (WebCore::Layout::FlexFormattingGeometry::intrinsicWidthConstraints):
425         * layout/formattingContexts/flex/FlexFormattingGeometry.h:
426         * layout/formattingContexts/inline/InlineFormattingContext.cpp:
427         (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
428         * layout/formattingContexts/table/TableFormattingContext.cpp:
429         (WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints):
430         (WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns):
431         * layout/formattingContexts/table/TableFormattingGeometry.cpp:
432         (WebCore::Layout::TableFormattingGeometry::intrinsicWidthConstraintsForCell):
433         * layout/formattingContexts/table/TableFormattingGeometry.h:
434         * layout/formattingContexts/table/TableGrid.h:
435         (WebCore::Layout::TableGrid::setWidthConstraints):
436         (WebCore::Layout::TableGrid::widthConstraints const):
437         (WebCore::Layout::TableGrid::Slot::widthConstraints const):
438         (WebCore::Layout::TableGrid::Slot::setWidthConstraints):
439
440 2021-05-16  Sam Weinig  <weinig@apple.com>
441
442         Add support for creating/accessing/setting non-sRGB ImageData via canvas
443         https://bugs.webkit.org/show_bug.cgi?id=225841
444
445         Reviewed by Darin Adler.
446
447         Test: fast/canvas/canvas-color-space-display-p3-ImageData.html
448
449         Add support for accessing non-sRGB (only DisplayP3 for now due
450         to the specification, but the support is general) pixel data in
451         HTML canvas.
452
453         Updates ImageData constructors and CanvasImageData operations to 
454         take optional ImageDataSettings dictionaries, which contain an 
455         optional color space (otherwise defaulting back to sRGB). 
456
457         * CMakeLists.txt:
458         * DerivedSources-input.xcfilelist:
459         * DerivedSources-output.xcfilelist:
460         * DerivedSources.make:
461         * Sources.txt:
462         * WebCore.xcodeproj/project.pbxproj:
463         * html/ImageDataSettings.h: Added.
464         * html/ImageDataSettings.idl: Added.
465         Add new ImageDataSettings.idl and related files.
466
467         * bindings/js/SerializedScriptValue.cpp:
468         (WebCore::CloneDeserializer::readImageBitmap):
469         Fixes FIXME and uses PixelBuffer directly rather than allocating
470         an unnecessary ImageData. This was done now since the relevent
471         ImageData constructor has gone away.
472
473         * html/ImageData.cpp:
474         (WebCore::computeDataSize):
475         (WebCore::ImageData::computeColorSpace):
476         (WebCore::ImageData::create):
477         (WebCore::ImageData::createUninitialized):
478         (WebCore::ImageData::ImageData):
479         (WebCore::ImageData::pixelBuffer const):
480         (WebCore::ImageData::dataSize): Deleted.
481         (WebCore::ImageData::deepClone const): Deleted.
482         * html/ImageData.h:
483         (WebCore::ImageData::size const):
484         (WebCore::ImageData::width const):
485         (WebCore::ImageData::height const):
486         (WebCore::ImageData::data const):
487         (WebCore::ImageData::colorSpace const):
488         (WebCore::ImageData::pixelBuffer const): Deleted.
489
490         - Reworked ImageData to no longer store a PixelBuffer, which has
491           extraneous information in it, but rather to store just what it
492           needs IntSize, Ref<JSC::Uint8ClampedArray>, and now PredefinedColorSpace.
493         - Updates create functions for new optional ImageDataSettings.
494         - Adds createUninitialized which follows spec language for ImageData creation
495           and is used by CanvasRenderingContext2D to create ImageData objects of with
496           the right color spaces, allowing for fallback to the canvas' own color space
497           when no ImageDataSettings color space is provided. It is uninitialized and
498           therefore requires the client to initialize the data to allow for support for
499           no alpha support in the future, which requires a non-zero initialization pattern.
500
501         * html/ImageData.idl:
502         Add optional ImageDataSettings parameters and the new colorSpace attribute.
503
504         * html/canvas/CanvasImageData.idl:
505         Add optional ImageDataSettings parameters.
506
507         * html/canvas/CanvasRenderingContext2DBase.h:
508         * html/canvas/CanvasRenderingContext2DBase.cpp:
509         (WebCore::initializeEmptyImageData):
510         Add helper to initialize the ImageData buffer. Right now it always calls
511         zeroFill(), but in the future it will need to do more.
512         
513         (WebCore::CanvasRenderingContext2DBase::createImageData const):
514         Update to account for this function being able to throw an exception (when 
515         out of memory) and use the new createUninitialized/initializeEmptyImageData
516         to create a correctly color spaced ImageData.
517
518         (WebCore::CanvasRenderingContext2DBase::createImageData const):
519         Update for new optional ImageDataSettings and use the new createUninitialized
520         initializeEmptyImageData to create a correctly color spaced ImageData.
521
522         (WebCore::CanvasRenderingContext2DBase::getImageData const):
523         Moves parameter checks to the begining to match the spec, and uses new 
524         createUninitialized/initializeEmptyImageData to create a correctly color 
525         spaced ImageData. Also, use the ImageData's color space when getting
526         the pixel buffer to actually return the right data!
527
528         * html/canvas/PredefinedColorSpace.cpp:
529         (WebCore::toPredefinedColorSpace):
530         * html/canvas/PredefinedColorSpace.h:
531         Add conversion function from DestinationColorSpace to PredefinedColorSpace.
532         Since DestinationColorSpace is a superset of PredefinedColorSpace, this can
533         fail, so this conversion returns an Optional.
534
535         * inspector/InspectorCanvas.cpp:
536         * inspector/InspectorCanvasCallTracer.cpp:
537         * inspector/InspectorCanvasCallTracer.h:
538         Stub out inspector support for ImageDataSettings.
539
540         * platform/graphics/ImageBufferBackend.cpp:
541         (WebCore::ImageBufferBackend::getPixelBuffer const):
542         Use the ImageBuffer's actual color space as the source color space
543         rather than hard coding sRGB. This allows the color space conversion
544         to take place. Also remove some unnecessary temporary variables.
545
546         (WebCore::ImageBufferBackend::putPixelBuffer):
547         Use the ImageBuffer's actual color space as the destination color space
548         rather than hard coding sRGB. This allows the color space conversion
549         to take place. Also remove some unnecessary temporary variables.
550
551         * platform/graphics/PixelBuffer.cpp:
552         (WebCore::PixelBuffer::tryCreate):
553         (WebCore::PixelBuffer::PixelBuffer):
554         * platform/graphics/PixelBuffer.h:
555         (WebCore::PixelBuffer::takeData):
556         Add a few helpers to allow creationg to/from PixelBuffer
557         a bit easier.
558
559         * platform/graphics/PixelBufferConversion.cpp:
560         (WebCore::convertImagePixelsAccelerated):
561         Fix incorrect assertion. We want to assert that there is no error, not that
562         there is one.
563
564         * platform/graphics/filters/FilterEffect.cpp:
565         (WebCore::FilterEffect::convertImageBufferToColorSpace):
566         (WebCore::FilterEffect::copyUnmultipliedResult):
567         (WebCore::FilterEffect::copyPremultipliedResult):
568         (WebCore::FilterEffect::createUnmultipliedImageResult):
569         (WebCore::FilterEffect::createPremultipliedImageResult):
570         Stop hard coding SRGB for PixelBuffer color spaces and use the appropriate
571         color space for the task. We still do color space conversion through ImageBuffer
572         so we should come back and simplify code here to not always require that.
573
574         * testing/Internals.cpp:
575         (WebCore::Internals::videoSampleAvailable):
576         (WebCore::Internals::loadArtworkImage):
577         Update to specify a color space to maintain existing behavior.
578
579 2021-05-16  Alan Bujtas  <zalan@apple.com>
580
581         [LFC] Cleanup margin collapsing class
582         https://bugs.webkit.org/show_bug.cgi?id=225745
583
584         Reviewed by Antti Koivisto.
585
586         BlockMarginCollapse needs LayoutState and BlockFormattingState only.
587
588         * layout/MarginTypes.h:
589         * layout/formattingContexts/FormattingGeometry.cpp:
590         (WebCore::Layout::FormattingGeometry::constraintsForInFlowContent const):
591         (WebCore::Layout::FormattingGeometry::constraintsForInFlowContent): Deleted.
592         * layout/formattingContexts/FormattingGeometry.h:
593         * layout/formattingContexts/block/BlockFormattingContext.cpp:
594         (WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForBoxAndAncestors):
595         (WebCore::Layout::BlockFormattingContext::geometry const):
596         (WebCore::Layout::BlockFormattingContext::marginCollapse const):
597         * layout/formattingContexts/block/BlockFormattingGeometry.cpp:
598         (WebCore::Layout::BlockFormattingGeometry::inFlowNonReplacedContentHeightAndMargin):
599         * layout/formattingContexts/block/BlockFormattingQuirks.cpp:
600         (WebCore::Layout::BlockFormattingQuirks::stretchedInFlowHeightIfApplicable const):
601         * layout/formattingContexts/block/BlockFormattingQuirks.h:
602         * layout/formattingContexts/block/BlockMarginCollapse.cpp:
603         (WebCore::Layout::BlockMarginCollapse::BlockMarginCollapse):
604         (WebCore::Layout::BlockMarginCollapse::hasClearance const):
605         (WebCore::Layout::BlockMarginCollapse::marginBeforeCollapsesWithParentMarginBefore const):
606         (WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithParentMarginAfter const):
607         (WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter const):
608         (WebCore::Layout::BlockMarginCollapse::positiveNegativeValues const):
609         (WebCore::Layout::BlockMarginCollapse::positiveNegativeMarginBefore const):
610         * layout/formattingContexts/block/BlockMarginCollapse.h:
611         (WebCore::Layout::BlockMarginCollapse::inQuirksMode const):
612         (WebCore::Layout::BlockMarginCollapse::layoutState const):
613         (WebCore::Layout::BlockMarginCollapse::formattingState const):
614         (WebCore::Layout::BlockMarginCollapse::layoutState): Deleted.
615         (WebCore::Layout::BlockMarginCollapse::formattingContext const): Deleted.
616         * layout/formattingContexts/block/PrecomputedBlockMarginCollapse.cpp:
617         (WebCore::Layout::BlockMarginCollapse::precomputedPositiveNegativeValues const):
618         (WebCore::Layout::BlockMarginCollapse::precomputedPositiveNegativeMarginBefore const):
619         (WebCore::Layout::BlockMarginCollapse::precomputedMarginBefore):
620
621 2021-05-16  Alan Bujtas  <zalan@apple.com>
622
623         [LFC] Cleanup FormattingQuirk classes
624         https://bugs.webkit.org/show_bug.cgi?id=225746
625
626         Reviewed by Antti Koivisto.
627
628         Quirk functions should only be called when not in standards mode.
629
630         * layout/formattingContexts/FormattingQuirks.cpp:
631         (WebCore::Layout::FormattingQuirks::heightValueOfNearestContainingBlockWithFixedHeight const):
632         (WebCore::Layout::FormattingQuirks::heightValueOfNearestContainingBlockWithFixedHeight): Deleted.
633         * layout/formattingContexts/FormattingQuirks.h:
634         (WebCore::Layout::FormattingQuirks::layoutState const):
635         (WebCore::Layout::FormattingQuirks::layoutState): Deleted.
636         * layout/formattingContexts/block/BlockFormattingContext.cpp:
637         (WebCore::Layout::BlockFormattingContext::quirks const): Deleted.
638         * layout/formattingContexts/block/BlockFormattingContext.h:
639         * layout/formattingContexts/block/BlockFormattingGeometry.cpp:
640         (WebCore::Layout::BlockFormattingGeometry::inFlowContentHeightAndMargin):
641         * layout/formattingContexts/block/BlockFormattingQuirks.cpp:
642         (WebCore::Layout::BlockFormattingQuirks::BlockFormattingQuirks):
643         (WebCore::Layout::needsStretching):
644         (WebCore::Layout::BlockFormattingQuirks::stretchedInFlowHeightIfApplicable const):
645         (WebCore::Layout::BlockFormattingQuirks::shouldIgnoreCollapsedQuirkMargin):
646         (WebCore::Layout::BlockFormattingQuirks::shouldCollapseMarginBeforeWithParentMarginBefore):
647         (WebCore::Layout::BlockFormattingQuirks::shouldCollapseMarginAfterWithParentMarginAfter):
648         (WebCore::Layout::BlockFormattingQuirks::needsStretching const): Deleted.
649         (WebCore::Layout::BlockFormattingQuirks::stretchedInFlowHeight): Deleted.
650         (WebCore::Layout::BlockFormattingQuirks::shouldIgnoreCollapsedQuirkMargin const): Deleted.
651         (WebCore::Layout::BlockFormattingQuirks::shouldCollapseMarginBeforeWithParentMarginBefore const): Deleted.
652         (WebCore::Layout::BlockFormattingQuirks::shouldCollapseMarginAfterWithParentMarginAfter const): Deleted.
653         * layout/formattingContexts/block/BlockFormattingQuirks.h:
654         (WebCore::Layout::BlockFormattingQuirks::formattingContext const): Deleted.
655         * layout/formattingContexts/block/BlockMarginCollapse.cpp:
656         (WebCore::Layout::BlockMarginCollapse::marginBeforeCollapsesWithParentMarginBefore const):
657         (WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithParentMarginAfter const):
658         (WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter const):
659         (WebCore::Layout::BlockMarginCollapse::positiveNegativeMarginBefore const):
660         (WebCore::Layout::BlockMarginCollapse::quirks const): Deleted.
661         * layout/formattingContexts/block/BlockMarginCollapse.h:
662         * layout/formattingContexts/block/PrecomputedBlockMarginCollapse.cpp:
663         (WebCore::Layout::BlockMarginCollapse::precomputedPositiveNegativeMarginBefore const):
664         * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp:
665         (WebCore::Layout::TableWrapperBlockFormattingContext::computeHeightAndMarginForTableBox):
666         (WebCore::Layout::TableWrapperBlockFormattingContext::quirks const): Deleted.
667         * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.h:
668         * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingQuirks.cpp:
669         (WebCore::Layout::TableWrapperQuirks::TableWrapperQuirks):
670         (WebCore::Layout::TableWrapperQuirks::overriddenTableHeight const):
671         * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingQuirks.h:
672         * layout/formattingContexts/inline/InlineFormattingContext.cpp:
673         (WebCore::Layout::InlineFormattingContext::lineLayout):
674         (WebCore::Layout::InlineFormattingContext::quirks const): Deleted.
675         * layout/formattingContexts/inline/InlineFormattingContext.h:
676         * layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
677         (WebCore::Layout::InlineFormattingGeometry::inlineLevelBoxAffectsLineBox const):
678         * layout/formattingContexts/inline/InlineFormattingGeometry.h:
679         * layout/formattingContexts/inline/InlineFormattingQuirks.cpp:
680         (WebCore::Layout::InlineFormattingQuirks::initialLineHeight const):
681         (WebCore::Layout::InlineFormattingQuirks::inlineLevelBoxAffectsLineBox const):
682         * layout/formattingContexts/inline/InlineFormattingQuirks.h:
683         (WebCore::Layout::InlineFormattingQuirks::formattingContext const): Deleted.
684         * layout/formattingContexts/table/TableFormattingContext.cpp:
685         (WebCore::Layout::TableFormattingContext::quirks const): Deleted.
686         * layout/formattingContexts/table/TableFormattingContext.h:
687         * layout/formattingContexts/table/TableFormattingGeometry.cpp:
688         (WebCore::Layout::TableFormattingGeometry::cellHeigh const):
689         * layout/formattingContexts/table/TableFormattingQuirks.cpp:
690         (WebCore::Layout::TableFormattingQuirks::TableFormattingQuirks):
691         (WebCore::Layout::TableFormattingQuirks::shouldIgnoreChildContentVerticalMargin):
692         (WebCore::Layout::TableFormattingQuirks::shouldIgnoreChildContentVerticalMargin const): Deleted.
693         * layout/formattingContexts/table/TableFormattingQuirks.h:
694         (WebCore::Layout::TableFormattingQuirks::formattingContext const): Deleted.
695         * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
696         (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayNonRootInlineBoxes const):
697
698 2021-05-16  Tim Nguyen  <ntim@apple.com>
699
700         Make will-change: transform-style create a containing block
701         https://bugs.webkit.org/show_bug.cgi?id=225441
702
703         Reviewed by Simon Fraser.
704
705         Marked relevant WPT as pass.
706
707         * rendering/style/WillChangeData.cpp:
708         (WebCore::WillChangeData::createsContainingBlockForOutOfFlowPositioned const):
709
710 2021-05-15  Ryosuke Niwa  <rniwa@webkit.org>
711
712         Delete WebSQL code from WebKit2
713         https://bugs.webkit.org/show_bug.cgi?id=225739
714
715         Reviewed by Sihui Liu.
716
717         * page/RuntimeEnabledFeatures.h:
718         (WebCore::RuntimeEnabledFeatures::setWebSQLEnabled): Replaced setWebSQLDisabled.
719
720 2021-05-15  Alan Bujtas  <zalan@apple.com>
721
722         [LFC] Make redundant public helpers private in FormattingContext
723         https://bugs.webkit.org/show_bug.cgi?id=225747
724
725         Reviewed by Antti Koivisto.
726
727         * layout/formattingContexts/FormattingContext.h:
728         * layout/formattingContexts/FormattingGeometry.cpp:
729         (WebCore::Layout::FormattingGeometry::computedHeightValue const):
730         * layout/formattingContexts/FormattingQuirks.cpp:
731         (WebCore::Layout::FormattingQuirks::heightValueOfNearestContainingBlockWithFixedHeight):
732
733 2021-05-15  Alan Bujtas  <zalan@apple.com>
734
735         [LFC] Make redundant public helpers private in TableFormattingContext
736         https://bugs.webkit.org/show_bug.cgi?id=225748
737
738         Reviewed by Antti Koivisto.
739
740         * layout/formattingContexts/table/TableFormattingContext.h:
741         * layout/formattingContexts/table/TableFormattingGeometry.cpp:
742         (WebCore::Layout::TableFormattingGeometry::cellHeigh const):
743         * layout/formattingContexts/table/TableFormattingQuirks.h:
744         (WebCore::Layout::TableFormattingQuirks::formattingContext const):
745         (WebCore::Layout::TableFormattingQuirks::geometry const): Deleted.
746
747 2021-05-15  Sam Weinig  <weinig@apple.com>
748
749         Allow conditionally enabling OffscreenCanvas only for non-worker contexts
750         https://bugs.webkit.org/show_bug.cgi?id=225845
751
752         Reviewed by Darin Adler.
753
754         Enable both compile time and runtime conditional enablement of just the
755         non-worker OffscreenCanvas code path.
756
757         To make this work a new IDL extended attribute was needed, ConditionalForWorker=FOO,
758         which allows specifying an additional macro to check for whether the constructor
759         should be exposed on workers. Ideally this would be generic for any context type,
760         but at the moment, the limited syntax of extended attributes makes that hard. If
761         generalization is needed (or a similar syntax is needed for something else) this can
762         be revisited.
763
764         To support runtime conditional exposure, the existing EnabledForContext, which calls
765         a static function on the implementation class passing the ScriptExecutationContext
766         is used. If conditional per context type ever becomes a common thing, we should add
767         another extended attribute (and add syntax to support like above) that allows specifying
768         both the context type and the setting name.
769
770         Other than that, uses of ENABLE_OFFSCREEN_CANVAS that guarded worker specific functionality
771         were replaced by ENABLE_OFFSCREEN_CANVAS_IN_WORKERS.
772
773         * bindings/js/SerializedScriptValue.cpp:
774         (WebCore::CloneSerializer::serialize):
775         (WebCore::CloneSerializer::CloneSerializer):
776         (WebCore::CloneSerializer::dumpIfTerminal):
777         (WebCore::CloneDeserializer::deserialize):
778         (WebCore::CloneDeserializer::CloneDeserializer):
779         (WebCore::CloneDeserializer::readTerminal):
780         (WebCore::SerializedScriptValue::SerializedScriptValue):
781         (WebCore::SerializedScriptValue::computeMemoryCost const):
782         (WebCore::SerializedScriptValue::create):
783         (WebCore::SerializedScriptValue::deserialize):
784         * bindings/js/SerializedScriptValue.h:
785         (WebCore::SerializedScriptValue::SerializedScriptValue):
786         * bindings/scripts/IDLAttributes.json:
787         * bindings/scripts/preprocess-idls.pl:
788         (GenerateConstructorAttributes):
789         * html/HTMLCanvasElement.idl:
790         * html/OffscreenCanvas.cpp:
791         (WebCore::OffscreenCanvas::enabledForContext):
792         * html/OffscreenCanvas.h:
793         * html/OffscreenCanvas.idl:
794         * html/canvas/OffscreenCanvasRenderingContext2D.cpp:
795         (WebCore::OffscreenCanvasRenderingContext2D::enabledForContext):
796         * html/canvas/OffscreenCanvasRenderingContext2D.h:
797         * html/canvas/OffscreenCanvasRenderingContext2D.idl:
798         * page/RuntimeEnabledFeatures.h:
799         (WebCore::RuntimeEnabledFeatures::setOffscreenCanvasInWorkersEnabled):
800         (WebCore::RuntimeEnabledFeatures::offscreenCanvasInWorkersEnabled const):
801         * workers/DedicatedWorkerGlobalScope.h:
802         * workers/DedicatedWorkerGlobalScope.idl:
803         * workers/WorkerAnimationController.cpp:
804         * workers/WorkerAnimationController.h:
805
806 2021-05-15  Alan Bujtas  <zalan@apple.com>
807
808         [LFC] Make redundant public helpers private in InlineFormattingContext
809         https://bugs.webkit.org/show_bug.cgi?id=225749
810
811         Reviewed by Antti Koivisto.
812
813         * layout/formattingContexts/inline/InlineFormattingContext.h:
814         * layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
815         (WebCore::Layout::LineBoxBuilder::computeLineBoxHeightAndAlignInlineLevelBoxesVertically):
816         * layout/formattingContexts/inline/InlineLineBuilder.cpp:
817         (WebCore::Layout::isAtSoftWrapOpportunity):
818         * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
819         (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayNonRootInlineBoxes const):
820
821 2021-05-15  Alan Bujtas  <zalan@apple.com>
822
823         [LFC] Make redundant public helpers private in BlockFormattingContext
824         https://bugs.webkit.org/show_bug.cgi?id=225750
825
826         Reviewed by Antti Koivisto.
827
828         * layout/formattingContexts/block/BlockFormattingContext.h:
829         * layout/formattingContexts/block/BlockFormattingGeometry.cpp:
830         (WebCore::Layout::BlockFormattingGeometry::inFlowNonReplacedContentHeightAndMargin):
831         (WebCore::Layout::BlockFormattingGeometry::inFlowContentHeightAndMargin):
832         * layout/formattingContexts/block/BlockFormattingQuirks.cpp:
833         (WebCore::Layout::BlockFormattingQuirks::stretchedInFlowHeight):
834         * layout/formattingContexts/block/BlockMarginCollapse.cpp:
835         (WebCore::Layout::BlockMarginCollapse::quirks const):
836         (WebCore::Layout::BlockMarginCollapse::marginBeforeCollapsesWithParentMarginBefore const):
837         (WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithParentMarginAfter const):
838         (WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter const):
839         (WebCore::Layout::BlockMarginCollapse::positiveNegativeMarginBefore const):
840         * layout/formattingContexts/block/BlockMarginCollapse.h:
841         * layout/formattingContexts/block/PrecomputedBlockMarginCollapse.cpp:
842         (WebCore::Layout::BlockMarginCollapse::precomputedPositiveNegativeValues const):
843         (WebCore::Layout::BlockMarginCollapse::precomputedPositiveNegativeMarginBefore const):
844         * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingQuirks.cpp:
845         (WebCore::Layout::TableWrapperQuirks::overriddenTableHeight const):
846
847 2021-05-15  Alan Bujtas  <zalan@apple.com>
848
849         [LFC] Make FormattingGeometry c'tors public
850         https://bugs.webkit.org/show_bug.cgi?id=225751
851
852         Reviewed by Antti Koivisto.
853
854         Remove unnecessary class friending.
855
856         * layout/formattingContexts/FormattingGeometry.h:
857         * layout/formattingContexts/block/BlockFormattingGeometry.h:
858         * layout/formattingContexts/inline/InlineFormattingGeometry.h:
859         * layout/formattingContexts/inline/InlineFormattingQuirks.h:
860         * layout/formattingContexts/table/TableFormattingGeometry.h:
861
862 2021-05-15  Alan Bujtas  <zalan@apple.com>
863
864         [LFC] Move base formatting geometry to its own class
865         https://bugs.webkit.org/show_bug.cgi?id=225752
866
867         Reviewed by Antti Koivisto.
868
869         * Sources.txt:
870         * WebCore.xcodeproj/project.pbxproj:
871         * layout/formattingContexts/FormattingContext.cpp:
872         (WebCore::Layout::FormattingContext::geometry const):
873         * layout/formattingContexts/FormattingContext.h:
874         (WebCore::Layout::FormattingContext::Geometry::layoutState const): Deleted.
875         (WebCore::Layout::FormattingContext::Geometry::layoutState): Deleted.
876         (WebCore::Layout::FormattingContext::Geometry::formattingContext const): Deleted.
877         (WebCore::Layout::FormattingContext::geometry const): Deleted.
878         (WebCore::Layout::FormattingContext::Geometry::Geometry): Deleted.
879         * layout/formattingContexts/FormattingContextGeometry.cpp: Removed.
880         * layout/formattingContexts/block/BlockFormattingGeometry.cpp:
881         (WebCore::Layout::BlockFormattingGeometry::BlockFormattingGeometry):
882         (WebCore::Layout::BlockFormattingGeometry::inFlowNonReplacedContentHeightAndMargin):
883         (WebCore::Layout::BlockFormattingGeometry::inFlowNonReplacedContentWidthAndMargin):
884         * layout/formattingContexts/block/BlockFormattingGeometry.h:
885         (WebCore::Layout::BlockFormattingGeometry::formattingContext const):
886         * layout/formattingContexts/flex/FlexFormattingGeometry.cpp:
887         (WebCore::Layout::FlexFormattingGeometry::FlexFormattingGeometry):
888         * layout/formattingContexts/flex/FlexFormattingGeometry.h:
889         (WebCore::Layout::FlexFormattingGeometry::formattingContext const):
890         * layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
891         (WebCore::Layout::InlineFormattingGeometry::InlineFormattingGeometry):
892         (WebCore::Layout::InlineFormattingGeometry::inlineBlockContentWidthAndMargin):
893         * layout/formattingContexts/inline/InlineFormattingGeometry.h:
894         (WebCore::Layout::InlineFormattingGeometry::formattingContext const):
895         * layout/formattingContexts/table/TableFormattingGeometry.cpp:
896         (WebCore::Layout::TableFormattingGeometry::TableFormattingGeometry):
897         * layout/formattingContexts/table/TableFormattingGeometry.h:
898         (WebCore::Layout::TableFormattingGeometry::formattingContext const):
899         * layout/formattingContexts/table/TableFormattingQuirks.h:
900         (WebCore::Layout::TableFormattingQuirks::geometry const):
901
902 2021-05-15  Alan Bujtas  <zalan@apple.com>
903
904         [LFC] Move table formatting geometry to its own class
905         https://bugs.webkit.org/show_bug.cgi?id=225753
906
907         Reviewed by Antti Koivisto.
908
909         * Sources.txt:
910         * WebCore.xcodeproj/project.pbxproj:
911         * layout/formattingContexts/table/TableFormattingContext.cpp:
912         (WebCore::Layout::TableFormattingContext::geometry const):
913         * layout/formattingContexts/table/TableFormattingContext.h:
914         (WebCore::Layout::TableFormattingContext::Geometry::Geometry): Deleted.
915         * layout/formattingContexts/table/TableFormattingContextGeometry.cpp: Removed.
916
917 2021-05-15  Chris Dumez  <cdumez@apple.com>
918
919         Clean up BaseAudioContext now that legacy/prefixed WebAudio is gone
920         https://bugs.webkit.org/show_bug.cgi?id=225843
921
922         Reviewed by Darin Adler.
923
924         The BaseAudioContext class hierarchy used to be a bit complicated when
925         we supposed legacy WebAudio because OfflineAudioContext would subclass
926         BaseAudioContext directly, while WebKitOfflineAudioContext would
927         subclass BaseAudioContext via AudioContext. The class hierarchy is now
928         a lot simpler, BaseAudioContext is the base class and it has exactly
929         2 subclasses: OfflineAudioContext and AudioContext (for real-time
930         rendering). Now that the legacy WebAudio code is gone, this patch
931         cleans up BaseAudioContext and moves as much code as possible to its
932         subclasses (OfflineAudioContext & AudioContext).
933
934         * Modules/webaudio/AudioBuffer.cpp:
935         (WebCore::AudioBuffer::create):
936         * Modules/webaudio/AudioBufferSourceNode.cpp:
937         (WebCore::AudioBufferSourceNode::setBuffer):
938         * Modules/webaudio/AudioContext.cpp:
939         (WebCore::AudioContext::create):
940         (WebCore::AudioContext::AudioContext):
941         (WebCore::AudioContext::uninitialize):
942         (WebCore::AudioContext::lazyInitialize):
943         (WebCore::AudioContext::activeDOMObjectName const):
944         * Modules/webaudio/AudioContext.h:
945         (isType):
946         * Modules/webaudio/AudioContextState.h:
947         * Modules/webaudio/AudioNode.cpp:
948         (WebCore::AudioNode::setChannelCount):
949         * Modules/webaudio/AudioNodeOutput.cpp:
950         (WebCore::AudioNodeOutput::AudioNodeOutput):
951         (WebCore::AudioNodeOutput::setNumberOfChannels):
952         * Modules/webaudio/AudioWorkletNode.cpp:
953         (WebCore::AudioWorkletNode::create):
954         * Modules/webaudio/BaseAudioContext.cpp:
955         (WebCore::generateContextID):
956         (WebCore::BaseAudioContext::BaseAudioContext):
957         (WebCore::BaseAudioContext::lazyInitialize):
958         (WebCore::BaseAudioContext::uninitialize):
959         (WebCore::BaseAudioContext::stop):
960         (WebCore::BaseAudioContext::createScriptProcessor):
961         (WebCore::BaseAudioContext::derefFinishedSourceNodes):
962         (WebCore::BaseAudioContext::lockInternal):
963         (WebCore::BaseAudioContext::tryLock):
964         (WebCore::BaseAudioContext::unlock):
965         (WebCore::BaseAudioContext::handlePostRenderTasks):
966         (WebCore::BaseAudioContext::deleteMarkedNodes):
967         (WebCore::BaseAudioContext::updateAutomaticPullNodes):
968         (WebCore::BaseAudioContext::postTask):
969         (WebCore::BaseAudioContext::workletIsReady):
970         * Modules/webaudio/BaseAudioContext.h:
971         (WebCore::BaseAudioContext::isInitialized const):
972         (WebCore::BaseAudioContext::currentSampleFrame const):
973         (WebCore::BaseAudioContext::currentTime const):
974         (WebCore::BaseAudioContext::sampleRate const):
975         (WebCore::BaseAudioContext::listener):
976         (WebCore::BaseAudioContext::incrementConnectionCount):
977         (WebCore::BaseAudioContext::isAudioThread const):
978         (WebCore::BaseAudioContext::isAudioThreadFinished const):
979         (WebCore::BaseAudioContext::isGraphOwner const):
980         * Modules/webaudio/ChannelMergerNode.cpp:
981         (WebCore::ChannelMergerNode::create):
982         * Modules/webaudio/ChannelSplitterNode.cpp:
983         (WebCore::ChannelSplitterNode::create):
984         * Modules/webaudio/DefaultAudioDestinationNode.cpp:
985         (WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode):
986         (WebCore::DefaultAudioDestinationNode::context):
987         (WebCore::DefaultAudioDestinationNode::context const):
988         * Modules/webaudio/DefaultAudioDestinationNode.h:
989         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
990         (WebCore::MediaElementAudioSourceNode::setFormat):
991         * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
992         (WebCore::MediaStreamAudioSourceNode::setFormat):
993         * Modules/webaudio/OfflineAudioContext.cpp:
994         (WebCore::OfflineAudioContext::OfflineAudioContext):
995         (WebCore::OfflineAudioContext::create):
996         (WebCore::OfflineAudioContext::uninitialize):
997         (WebCore::OfflineAudioContext::activeDOMObjectName const):
998         (WebCore::OfflineAudioContext::startRendering):
999         (WebCore::OfflineAudioContext::suspendRendering):
1000         (WebCore::OfflineAudioContext::resumeRendering):
1001         (WebCore::OfflineAudioContext::didSuspendRendering):
1002         (WebCore::OfflineAudioContext::finishedRendering):
1003         (WebCore::OfflineAudioContext::settleRenderingPromise):
1004         (WebCore::OfflineAudioContext::dispatchEvent):
1005         * Modules/webaudio/OfflineAudioContext.h:
1006         (isType):
1007         * Modules/webaudio/OfflineAudioContext.idl:
1008         * Modules/webaudio/OfflineAudioDestinationNode.cpp:
1009         (WebCore::OfflineAudioDestinationNode::OfflineAudioDestinationNode):
1010         (WebCore::OfflineAudioDestinationNode::context):
1011         (WebCore::OfflineAudioDestinationNode::context const):
1012         * Modules/webaudio/OfflineAudioDestinationNode.h:
1013         * Modules/webaudio/ScriptProcessorNode.cpp:
1014         (WebCore::ScriptProcessorNode::ScriptProcessorNode):
1015
1016 2021-05-15  Alan Bujtas  <zalan@apple.com>
1017
1018         [LFC] Move inline formatting geometry to its own class
1019         https://bugs.webkit.org/show_bug.cgi?id=225754
1020
1021         Reviewed by Antti Koivisto.
1022
1023         * Sources.txt:
1024         * WebCore.xcodeproj/project.pbxproj:
1025         * layout/formattingContexts/inline/InlineFormattingContext.cpp:
1026         (WebCore::Layout::InlineFormattingContext::geometry const):
1027         * layout/formattingContexts/inline/InlineFormattingContext.h:
1028         (WebCore::Layout::InlineFormattingContext::Geometry::Geometry): Deleted.
1029         * layout/formattingContexts/inline/InlineFormattingContextGeometry.cpp: Removed.
1030
1031 2021-05-15  Alan Bujtas  <zalan@apple.com>
1032
1033         [LFC] Move flex formatting geometry to its own class
1034         https://bugs.webkit.org/show_bug.cgi?id=225755
1035
1036         Reviewed by Antti Koivisto.
1037
1038         * Sources.txt:
1039         * WebCore.xcodeproj/project.pbxproj:
1040         * layout/formattingContexts/flex/FlexFormattingContext.cpp:
1041         (WebCore::Layout::FlexFormattingContext::geometry const):
1042         * layout/formattingContexts/flex/FlexFormattingContext.h:
1043         (WebCore::Layout::FlexFormattingContext::Geometry::Geometry): Deleted.
1044         * layout/formattingContexts/flex/FlexFormattingContextGeometry.cpp: Removed.
1045
1046 2021-05-15  Alan Bujtas  <zalan@apple.com>
1047
1048         [LFC] Move block formatting geometry to its own class
1049         https://bugs.webkit.org/show_bug.cgi?id=225756
1050
1051         Reviewed by Antti Koivisto.
1052
1053         * Sources.txt:
1054         * WebCore.xcodeproj/project.pbxproj:
1055         * layout/formattingContexts/block/BlockFormattingContext.cpp:
1056         (WebCore::Layout::BlockFormattingContext::geometry const):
1057         * layout/formattingContexts/block/BlockFormattingContext.h:
1058         (WebCore::Layout::BlockFormattingContext::Geometry::formattingContext const): Deleted.
1059         (WebCore::Layout::BlockFormattingContext::geometry const): Deleted.
1060         (WebCore::Layout::BlockFormattingContext::Geometry::Geometry): Deleted.
1061         * layout/formattingContexts/block/BlockFormattingContextGeometry.cpp: Removed.
1062         * layout/formattingContexts/block/BlockFormattingQuirks.cpp:
1063         (WebCore::Layout::BlockFormattingQuirks::stretchedInFlowHeight):
1064         * layout/formattingContexts/block/BlockFormattingQuirks.h:
1065         (WebCore::Layout::BlockFormattingQuirks::formattingContext const):
1066         (WebCore::Layout::BlockFormattingQuirks::geometry const): Deleted.
1067         * layout/formattingContexts/block/PrecomputedBlockMarginCollapse.cpp:
1068         * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp:
1069         * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingQuirks.cpp:
1070         (WebCore::Layout::TableWrapperQuirks::overriddenTableHeight const):
1071
1072 2021-05-15  Alan Bujtas  <zalan@apple.com>
1073
1074         [LFC] Move base formatting quirks to its own class
1075         https://bugs.webkit.org/show_bug.cgi?id=225757
1076
1077         Reviewed by Antti Koivisto.
1078
1079         * Sources.txt:
1080         * WebCore.xcodeproj/project.pbxproj:
1081         * layout/formattingContexts/FormattingContext.cpp:
1082         (WebCore::Layout::FormattingContext::quirks const):
1083         * layout/formattingContexts/FormattingContext.h:
1084         (WebCore::Layout::FormattingContext::formattingState):
1085         (WebCore::Layout::FormattingContext::Quirks::layoutState const): Deleted.
1086         (WebCore::Layout::FormattingContext::Quirks::layoutState): Deleted.
1087         (WebCore::Layout::FormattingContext::Quirks::formattingContext const): Deleted.
1088         (WebCore::Layout::FormattingContext::quirks const): Deleted.
1089         (WebCore::Layout::FormattingContext::Quirks::Quirks): Deleted.
1090         * layout/formattingContexts/FormattingContextQuirks.cpp: Removed.
1091         * layout/formattingContexts/block/BlockFormattingQuirks.cpp:
1092         (WebCore::Layout::BlockFormattingQuirks::BlockFormattingQuirks):
1093         * layout/formattingContexts/block/BlockFormattingQuirks.h:
1094         (WebCore::Layout::BlockFormattingQuirks::formattingContext const):
1095         * layout/formattingContexts/inline/InlineFormattingQuirks.cpp:
1096         (WebCore::Layout::InlineFormattingQuirks::InlineFormattingQuirks):
1097         * layout/formattingContexts/inline/InlineFormattingQuirks.h:
1098         (WebCore::Layout::InlineFormattingQuirks::formattingContext const):
1099         * layout/formattingContexts/table/TableFormattingQuirks.cpp:
1100         (WebCore::Layout::TableFormattingQuirks::TableFormattingQuirks):
1101         * layout/formattingContexts/table/TableFormattingQuirks.h:
1102         (WebCore::Layout::TableFormattingQuirks::formattingContext const):
1103
1104 2021-05-15  Said Abou-Hallawa  <said@apple.com>
1105
1106         Implement CanvasRenderingContext2D.createConicGradient
1107         https://bugs.webkit.org/show_bug.cgi?id=225539
1108
1109         Reviewed by Sam Weinig.
1110
1111         Proposal document:
1112             https://github.com/fserb/canvas2D/blob/master/spec/conic-gradient.md
1113
1114         MDN documentation:
1115             https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createConicGradient
1116
1117         Tests: fast/canvas/canvas-conic-gradient-angle.html
1118                fast/canvas/canvas-conic-gradient-center.html
1119                fast/canvas/conicGradient-infinite-values.html
1120
1121         * html/canvas/CanvasFillStrokeStyles.idl:
1122         * html/canvas/CanvasGradient.cpp:
1123         (WebCore::CanvasGradient::CanvasGradient):
1124         (WebCore::m_canvas):
1125         (WebCore::CanvasGradient::create):
1126         * html/canvas/CanvasGradient.h:
1127         * html/canvas/CanvasRenderingContext2DBase.cpp:
1128         (WebCore::CanvasRenderingContext2DBase::createConicGradient):
1129         * html/canvas/CanvasRenderingContext2DBase.h:
1130
1131 2021-05-15  Alan Bujtas  <zalan@apple.com>
1132
1133         [LFC] Move table formatting quirks to its own class
1134         https://bugs.webkit.org/show_bug.cgi?id=225758
1135
1136         Reviewed by Antti Koivisto.
1137
1138         * Sources.txt:
1139         * WebCore.xcodeproj/project.pbxproj:
1140         * layout/formattingContexts/table/TableFormattingContext.cpp:
1141         (WebCore::Layout::TableFormattingContext::quirks const):
1142         * layout/formattingContexts/table/TableFormattingContext.h:
1143         (WebCore::Layout::TableFormattingContext::Quirks::Quirks): Deleted.
1144         * layout/formattingContexts/table/TableFormattingContextQuirks.cpp: Removed.
1145
1146 2021-05-15  Alan Bujtas  <zalan@apple.com>
1147
1148         [LFC] Move inline formatting quirks to its own class
1149         https://bugs.webkit.org/show_bug.cgi?id=225759
1150
1151         Reviewed by Antti Koivisto.
1152
1153         * Sources.txt:
1154         * WebCore.xcodeproj/project.pbxproj:
1155         * layout/formattingContexts/inline/InlineFormattingContext.cpp:
1156         (WebCore::Layout::InlineFormattingContext::quirks const):
1157         * layout/formattingContexts/inline/InlineFormattingContext.h:
1158         (WebCore::Layout::InlineFormattingContext::Quirks::Quirks): Deleted.
1159         * layout/formattingContexts/inline/InlineFormattingContextQuirks.cpp: Removed.
1160         * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
1161
1162 2021-05-15  Alan Bujtas  <zalan@apple.com>
1163
1164         [LFC] Move table wrapper quirks to its own class
1165         https://bugs.webkit.org/show_bug.cgi?id=225760
1166
1167         Reviewed by Antti Koivisto.
1168
1169         * Sources.txt:
1170         * WebCore.xcodeproj/project.pbxproj:
1171         * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp:
1172         (WebCore::Layout::TableWrapperBlockFormattingContext::quirks const):
1173         * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.h:
1174         (WebCore::Layout::TableWrapperBlockFormattingContext::Quirks::Quirks): Deleted.
1175         * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContextQuirks.cpp: Removed.
1176
1177 2021-05-15  Sam Weinig  <weinig@apple.com>
1178
1179         Move CanvasRenderingContext2DSettings down to CanvasRenderingContext2DBase so it can be used there (and to support OffscreenCanvas)
1180         https://bugs.webkit.org/show_bug.cgi?id=225836
1181
1182         Reviewed by Simon Fraser.
1183
1184         In subsequent changes, it will be useful to have CanvasRenderingContext2DSettings accessible
1185         in CanvasRenderingContext2DBase for implementing color space support in ImageData. 
1186
1187         While doing this, I noticed it was trivial to add support for passing the settings
1188         to OffscreenCanvasRenderingContext2D, so I add that as well.
1189
1190         * html/OffscreenCanvas.cpp:
1191         (WebCore::OffscreenCanvas::getContext):
1192         * html/canvas/CanvasRenderingContext2D.cpp:
1193         (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
1194         (WebCore::CanvasRenderingContext2D::pixelFormat const): Deleted.
1195         (WebCore::CanvasRenderingContext2D::colorSpace const): Deleted.
1196         * html/canvas/CanvasRenderingContext2D.h:
1197         * html/canvas/CanvasRenderingContext2DBase.cpp:
1198         (WebCore::CanvasRenderingContext2DBase::CanvasRenderingContext2DBase):
1199         (WebCore::CanvasRenderingContext2DBase::pixelFormat const):
1200         (WebCore::CanvasRenderingContext2DBase::colorSpace const):
1201         * html/canvas/CanvasRenderingContext2DBase.h:
1202         (WebCore::CanvasRenderingContext2DBase::getContextAttributes const):
1203         * html/canvas/OffscreenCanvasRenderingContext2D.cpp:
1204         (WebCore::OffscreenCanvasRenderingContext2D::OffscreenCanvasRenderingContext2D):
1205         * html/canvas/OffscreenCanvasRenderingContext2D.h:
1206         * html/canvas/PaintRenderingContext2D.cpp:
1207         (WebCore::PaintRenderingContext2D::PaintRenderingContext2D):
1208
1209 2021-05-15  Alan Bujtas  <zalan@apple.com>
1210
1211         [LFC] Move block formatting quirks to its own class
1212         https://bugs.webkit.org/show_bug.cgi?id=225761
1213
1214         Reviewed by Antti Koivisto.
1215
1216         * Sources.txt:
1217         * WebCore.xcodeproj/project.pbxproj:
1218         * layout/formattingContexts/FormattingContext.h:
1219         (WebCore::Layout::FormattingContext::Quirks::layoutState const):
1220         (WebCore::Layout::FormattingContext::Quirks::layoutState):
1221         (WebCore::Layout::FormattingContext::Quirks::formattingContext const):
1222         (WebCore::Layout::FormattingContext::quirks const):
1223         * layout/formattingContexts/block/BlockFormattingContext.cpp:
1224         (WebCore::Layout::BlockFormattingContext::quirks const):
1225         * layout/formattingContexts/block/BlockFormattingContext.h:
1226         (WebCore::Layout::BlockFormattingContext::Quirks::formattingContext const): Deleted.
1227         (WebCore::Layout::BlockFormattingContext::Quirks::geometry const): Deleted.
1228         (WebCore::Layout::BlockFormattingContext::quirks const): Deleted.
1229         (WebCore::Layout::BlockFormattingContext::Quirks::Quirks): Deleted.
1230         * layout/formattingContexts/block/BlockFormattingContextQuirks.cpp: Removed.
1231         * layout/formattingContexts/block/BlockMarginCollapse.cpp:
1232         * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.h:
1233         (WebCore::Layout::TableWrapperBlockFormattingContext::Quirks::Quirks):
1234
1235 2021-05-15  Alan Bujtas  <zalan@apple.com>
1236
1237         [LFC] Move BlockMarginCollapse to its own class
1238         https://bugs.webkit.org/show_bug.cgi?id=225762
1239
1240         Reviewed by Antti Koivisto.
1241
1242         * WebCore.xcodeproj/project.pbxproj:
1243         * layout/formattingContexts/FormattingContext.h:
1244         (WebCore::Layout::FormattingContext::formattingState const):
1245         * layout/formattingContexts/block/BlockFormattingContext.cpp:
1246         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
1247         (WebCore::Layout::BlockFormattingContext::updateMarginAfterForPreviousSibling):
1248         (WebCore::Layout::BlockFormattingContext::marginCollapse const):
1249         * layout/formattingContexts/block/BlockFormattingContext.h:
1250         (WebCore::Layout::BlockFormattingContext::formattingState const):
1251         (WebCore::Layout::BlockFormattingContext::Quirks::formattingContext const):
1252         (WebCore::Layout::BlockFormattingContext::Quirks::geometry const):
1253         (WebCore::Layout::BlockFormattingContext::quirks const):
1254         (WebCore::Layout::BlockFormattingContext::MarginCollapse::layoutState): Deleted.
1255         (WebCore::Layout::BlockFormattingContext::MarginCollapse::layoutState const): Deleted.
1256         (WebCore::Layout::BlockFormattingContext::MarginCollapse::formattingContext const): Deleted.
1257         (WebCore::Layout::BlockFormattingContext::marginCollapse const): Deleted.
1258         (WebCore::Layout::BlockFormattingContext::MarginCollapse::MarginCollapse): Deleted.
1259         * layout/formattingContexts/block/BlockMarginCollapse.cpp:
1260         (WebCore::Layout::BlockMarginCollapse::BlockMarginCollapse):
1261         (WebCore::Layout::BlockMarginCollapse::hasClearance const):
1262         (WebCore::Layout::BlockMarginCollapse::marginBeforeCollapsesWithParentMarginAfter const):
1263         (WebCore::Layout::BlockMarginCollapse::marginBeforeCollapsesWithParentMarginBefore const):
1264         (WebCore::Layout::BlockMarginCollapse::marginBeforeCollapsesWithPreviousSiblingMarginAfter const):
1265         (WebCore::Layout::BlockMarginCollapse::marginBeforeCollapsesWithFirstInFlowChildMarginBefore const):
1266         (WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance const):
1267         (WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithParentMarginBefore const):
1268         (WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithParentMarginAfter const):
1269         (WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter const):
1270         (WebCore::Layout::BlockMarginCollapse::marginAfterCollapsesWithNextSiblingMarginBefore const):
1271         (WebCore::Layout::BlockMarginCollapse::marginsCollapseThrough const):
1272         (WebCore::Layout::BlockMarginCollapse::computedPositiveAndNegativeMargin const):
1273         (WebCore::Layout::BlockMarginCollapse::marginValue const):
1274         (WebCore::Layout::BlockMarginCollapse::positiveNegativeValues const):
1275         (WebCore::Layout::BlockMarginCollapse::positiveNegativeMarginBefore const):
1276         (WebCore::Layout::BlockMarginCollapse::positiveNegativeMarginAfter const):
1277         (WebCore::Layout::BlockMarginCollapse::marginBeforeIgnoringCollapsingThrough):
1278         (WebCore::Layout::BlockMarginCollapse::collapsedVerticalValues):
1279         (WebCore::Layout::BlockFormattingContext::MarginCollapse::hasClearance const): Deleted.
1280         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter const): Deleted.
1281         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore const): Deleted.
1282         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSiblingMarginAfter const): Deleted.
1283         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithFirstInFlowChildMarginBefore const): Deleted.
1284         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance const): Deleted.
1285         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginBefore const): Deleted.
1286         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginAfter const): Deleted.
1287         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter const): Deleted.
1288         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithNextSiblingMarginBefore const): Deleted.
1289         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough const): Deleted.
1290         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedPositiveAndNegativeMargin const): Deleted.
1291         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginValue const): Deleted.
1292         (WebCore::Layout::BlockFormattingContext::MarginCollapse::updateMarginAfterForPreviousSibling): Deleted.
1293         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues const): Deleted.
1294         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginBefore const): Deleted.
1295         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginAfter const): Deleted.
1296         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeIgnoringCollapsingThrough): Deleted.
1297         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedVerticalValues): Deleted.
1298         * layout/formattingContexts/block/PrecomputedBlockMarginCollapse.cpp:
1299         (WebCore::Layout::BlockMarginCollapse::precomputedPositiveNegativeValues const):
1300         (WebCore::Layout::BlockMarginCollapse::precomputedPositiveNegativeMarginBefore const):
1301         (WebCore::Layout::BlockMarginCollapse::precomputedMarginBefore):
1302         (WebCore::Layout::BlockFormattingContext::MarginCollapse::precomputedPositiveNegativeValues const): Deleted.
1303         (WebCore::Layout::BlockFormattingContext::MarginCollapse::precomputedPositiveNegativeMarginBefore const): Deleted.
1304         (WebCore::Layout::BlockFormattingContext::MarginCollapse::precomputedMarginBefore): Deleted.
1305         * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp:
1306         (WebCore::Layout::TableWrapperBlockFormattingContext::computeHeightAndMarginForTableBox):
1307
1308 2021-05-15  Alexander Mikhaylenko  <alexm@gnome.org>
1309
1310         [GTK] REGRESSION: Kinetic scrolling on touchpad doesn't work with async scrolling off
1311         https://bugs.webkit.org/show_bug.cgi?id=224182
1312
1313         Reviewed by Michael Catanzaro.
1314
1315         Don't clear the scroll history every time we scroll, that defeats the whole point of having
1316         the scroll history.
1317
1318         * platform/generic/ScrollAnimatorGeneric.cpp:
1319         (WebCore::ScrollAnimatorGeneric::scrollToPositionWithoutAnimation):
1320
1321 2021-05-15  Antti Koivisto  <antti@apple.com>
1322
1323         Don't allow :visited link style in subtrees that use mix-blend-mode
1324         https://bugs.webkit.org/show_bug.cgi?id=225446
1325         rdar://65686091
1326
1327         Reviewed by Darin Adler.
1328         
1329         Test: fast/css/visited-link-mix-blend-mode.html
1330
1331         * rendering/style/RenderStyle.cpp:
1332         (WebCore::RenderStyle::visitedDependentColor const):
1333         
1334         Return unvisited style in substrees that use mix-blend-mode.
1335
1336         * rendering/style/RenderStyle.h:
1337         (WebCore::RenderStyle::setBlendMode):
1338         (WebCore::RenderStyle::isInSubtreeWithBlendMode const):
1339         
1340         Add an inherited fake property for tracking this.
1341         
1342         * rendering/style/StyleRareInheritedData.cpp:
1343         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
1344         (WebCore::StyleRareInheritedData::operator== const):
1345         * rendering/style/StyleRareInheritedData.h:
1346
1347 2021-05-14  Chris Dumez  <cdumez@apple.com>
1348
1349         Drop FileSystem::fileMetadata() / fileMetadataFollowingSymlinks()
1350         https://bugs.webkit.org/show_bug.cgi?id=225820
1351
1352         Reviewed by Darin Adler.
1353
1354         Update our code base because of the FileSystem API changes.
1355
1356         * Modules/entriesapi/DOMFileSystem.cpp:
1357         (WebCore::listDirectoryWithMetadata):
1358         (WebCore::toFileSystemEntries):
1359         (WebCore::fileTypeIgnoringHiddenFiles):
1360         (WebCore::validatePathIsExpectedType):
1361         (WebCore::DOMFileSystem::getParent):
1362         (WebCore::DOMFileSystem::getEntry):
1363         (WebCore::DOMFileSystem::getFile):
1364         * editing/cocoa/WebContentReaderCocoa.mm:
1365         (WebCore::attachmentForFilePath):
1366         * fileapi/File.cpp:
1367         (WebCore::File::isDirectory const):
1368         * html/DirectoryFileListCreator.cpp:
1369         (WebCore::appendDirectoryFiles):
1370         (WebCore::gatherFileInformation):
1371         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
1372         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setStorageDirectory):
1373         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1374         (WebCore::ensureAssetCacheExistsForPath):
1375         * platform/network/BlobDataFileReference.cpp:
1376         (WebCore::BlobDataFileReference::startTrackingModifications):
1377         * platform/network/BlobRegistryImpl.cpp:
1378         * platform/network/FormData.cpp:
1379         (WebCore::FormData::prepareForUpload):
1380         * platform/network/mac/BlobDataFileReferenceMac.mm:
1381         (WebCore::BlobDataFileReference::generateReplacementFile):
1382
1383 2021-05-14  John Wilander  <wilander@apple.com>
1384
1385         Javascript can't access a SameSite=Strict cookie after page is loaded after a redirect from a third party site
1386         https://bugs.webkit.org/show_bug.cgi?id=208049
1387         <rdar://problem/59701889>
1388
1389         Reviewed by Chris Dumez.
1390
1391         The HTTP WG has decided that SameSite=strict cookies should be returned in document.cookie
1392         even in cases where they are not sent in the HTTP request for the page. Chromium and Gecko
1393         now work according to those rules and the spec is being updated.
1394
1395         See:
1396         - https://github.com/httpwg/http-extensions/issues/769
1397         - https://github.com/httpwg/http-extensions/pull/1428/files.
1398
1399         Here's an excerpt from the spec change:
1400             'If a user agent does return cookies for a given call to a "non-HTTP" API with
1401             an associated Document, then the user agent MUST compute the cookie-string
1402             following the algorithm defined in {{retrieval-algorithm}}, indicating that the
1403             retrieval is from a "non-HTTP" API. The retrieval-uri is the associated
1404             Document's cookie URL {{COOKIE-URL}}, and the retrieval is same-site if the
1405             Document's "site for cookies" is same-site with the top-level origin as defined
1406             in {{document-requests}}.'
1407
1408         Existing layout tests changed and rebased.
1409
1410         * loader/CookieJar.cpp:
1411         (WebCore::CookieJar::sameSiteInfo):
1412             Now takes a IsCookieAccessForDOM parameter and forwards it to SameSiteInfo::create().
1413         (WebCore::CookieJar::cookies const):
1414             Now sends IsCookieAccessForDOM::Yes to CookieJar::sameSiteInfo().
1415         (WebCore::CookieJar::setCookies):
1416             Now sends IsCookieAccessForDOM::Yes to CookieJar::sameSiteInfo().
1417         * loader/CookieJar.h:
1418         * platform/network/SameSiteInfo.cpp:
1419         (WebCore::SameSiteInfo::create):
1420             Now takes a IsForDOMCookieAccess parameter and if it's IsForDOMCookieAccess::Yes and
1421             the site is top site, sets isSameSite.
1422         * platform/network/SameSiteInfo.h:
1423             Now has an enum IsForDOMCookieAccess.
1424
1425 2021-05-14  Rob Buis  <rbuis@igalia.com>
1426
1427         Provide custom SetInlineFillGradient copy ctor
1428         https://bugs.webkit.org/show_bug.cgi?id=225688
1429
1430         Reviewed by Wenson Hsieh.
1431
1432         Provide custom SetInlineFillGradient copy ctor
1433         to deal with invalid SetInlineFillGradient source.
1434
1435         * platform/graphics/displaylists/DisplayListItems.cpp:
1436         (WebCore::DisplayList::SetInlineFillGradient::SetInlineFillGradient):
1437         * platform/graphics/displaylists/DisplayListItems.h:
1438         (WebCore::DisplayList::SetInlineFillGradient::isValid const):
1439
1440 2021-05-14  Chris Dumez  <cdumez@apple.com>
1441
1442         Drop legacy / prefixed WebAudio implementation
1443         https://bugs.webkit.org/show_bug.cgi?id=225832
1444
1445         Reviewed by Darin Adler.
1446
1447         Drop legacy / prefixed WebAudio implementation now that it is no longer
1448         present in shipping and we have received any reports of issues.
1449
1450         This drops all the legacy code but she should be able to clean up the
1451         code further in follow-ups. In particular, I believe some code can
1452         now be moved from BaseAudioContext to OfflineAudioContext.
1453
1454         * CMakeLists.txt:
1455         * DerivedSources.make:
1456         * Modules/webaudio/AudioBufferSourceNode.cpp:
1457         (WebCore::AudioBufferSourceNode::~AudioBufferSourceNode):
1458         (WebCore::AudioBufferSourceNode::totalPitchRate):
1459         * Modules/webaudio/AudioBufferSourceNode.h:
1460         * Modules/webaudio/AudioBufferSourceNode.idl:
1461         * Modules/webaudio/AudioContext.cpp:
1462         (WebCore::AudioContext::create):
1463         (WebCore::AudioContext::AudioContext):
1464         * Modules/webaudio/AudioContext.h:
1465         * Modules/webaudio/AudioListener.h:
1466         * Modules/webaudio/AudioListener.idl:
1467         * Modules/webaudio/AudioNode.cpp:
1468         * Modules/webaudio/AudioNode.h:
1469         * Modules/webaudio/AudioNode.idl:
1470         * Modules/webaudio/AudioParam.h:
1471         * Modules/webaudio/BaseAudioContext.cpp:
1472         (WebCore::BaseAudioContext::BaseAudioContext):
1473         * Modules/webaudio/BaseAudioContext.h:
1474         (WebCore::BaseAudioContext::isOfflineContext const):
1475         (WebCore::BaseAudioContext::BaseAudioContext):
1476         * Modules/webaudio/DynamicsCompressorNode.cpp:
1477         * Modules/webaudio/DynamicsCompressorNode.h:
1478         * Modules/webaudio/OfflineAudioContext.cpp:
1479         (WebCore::OfflineAudioContext::OfflineAudioContext):
1480         * Modules/webaudio/OscillatorNode.h:
1481         * Modules/webaudio/OscillatorNode.idl:
1482         * Modules/webaudio/WebKitAudioBufferSourceNode.h: Removed.
1483         * Modules/webaudio/WebKitAudioBufferSourceNode.idl: Removed.
1484         * Modules/webaudio/WebKitAudioContext.cpp: Removed.
1485         * Modules/webaudio/WebKitAudioContext.h: Removed.
1486         * Modules/webaudio/WebKitAudioContext.idl: Removed.
1487         * Modules/webaudio/WebKitAudioListener.h: Removed.
1488         * Modules/webaudio/WebKitAudioListener.idl: Removed.
1489         * Modules/webaudio/WebKitAudioPannerNode.cpp: Removed.
1490         * Modules/webaudio/WebKitAudioPannerNode.h: Removed.
1491         * Modules/webaudio/WebKitAudioPannerNode.idl: Removed.
1492         * Modules/webaudio/WebKitDynamicsCompressorNode.h: Removed.
1493         * Modules/webaudio/WebKitDynamicsCompressorNode.idl: Removed.
1494         * Modules/webaudio/WebKitOfflineAudioContext.cpp: Removed.
1495         * Modules/webaudio/WebKitOfflineAudioContext.h: Removed.
1496         * Modules/webaudio/WebKitOfflineAudioContext.idl: Removed.
1497         * Modules/webaudio/WebKitOscillatorNode.h: Removed.
1498         * Modules/webaudio/WebKitOscillatorNode.idl: Removed.
1499         * Sources.txt:
1500         * WebCore.xcodeproj/project.pbxproj:
1501         * testing/Internals.cpp:
1502         (WebCore::Internals::setAudioContextRestrictions):
1503         * testing/Internals.h:
1504         * testing/Internals.idl:
1505
1506 2021-05-14  Sam Weinig  <weinig@apple.com>
1507
1508         CustomPaintImage being in platform/graphics is a layering violation
1509         https://bugs.webkit.org/show_bug.cgi?id=225356
1510
1511         Reviewed by Darin Adler.
1512
1513         It is layering violation for a file in platform/ to reference classes
1514         like RenderElement or PaintWorkletGlobalScope. This fixes this by moving
1515         CustomPaintImage out of platform/graphics to html/, next to the existing
1516         CustomPaintCanvas class.
1517
1518         * Sources.txt:
1519         * WebCore.xcodeproj/project.pbxproj:
1520         * html/CustomPaintImage.cpp: Copied from Source/WebCore/platform/graphics/CustomPaintImage.cpp.
1521         * html/CustomPaintImage.h: Copied from Source/WebCore/platform/graphics/CustomPaintImage.h.
1522         * platform/graphics/CustomPaintImage.cpp: Removed.
1523         * platform/graphics/CustomPaintImage.h: Removed.
1524
1525 2021-05-14  Darin Adler  <darin@apple.com>
1526
1527         output element doesn't react properly to node tree mutations
1528         https://bugs.webkit.org/show_bug.cgi?id=196532
1529
1530         Reviewed by Ryosuke Niwa.
1531
1532         * dom/ContainerNode.cpp:
1533         (WebCore::ContainerNode::replaceAll): Refactored most of the functions
1534         replaceAllChildren and replaceAllChildrenWithNewText into this new one,
1535         and named it based on the name of the operation in the HTML specification.
1536         The function is incomplete, but preserves existing behavior.
1537         (WebCore::ContainerNode::stringReplaceAll): Refactored the rest of the
1538         replaceAllChildrenWithNewText function and renamed to the name from the
1539         HTML specification.
1540         * dom/ContainerNode.h: Updated for the above changes.
1541
1542         * dom/Node.cpp:
1543         (WebCore::Node::setTextContent): Updated for name change above.
1544         * dom/Range.cpp:
1545         (WebCore::Range::surroundContents): Ditto.
1546         * editing/ios/EditorIOS.mm:
1547         (WebCore::Editor::setTextAsChildOfElement): Ditto.
1548         * html/HTMLElement.cpp:
1549         (WebCore::HTMLElement::setInnerText): Ditto.
1550
1551         * html/HTMLOutputElement.cpp:
1552         (WebCore::HTMLOutputElement::HTMLOutputElement): Moved data member
1553         initialization into the class definition.
1554         (WebCore::HTMLOutputElement::create): Added an overload that takes just
1555         a document, for use when invoked from as a constructor.
1556         (WebCore::HTMLOutputElement::parseAttribute): Tightened the logic for the
1557         for attribute. I decided it's better to call through to the base class, even
1558         though we often don't do that for attributes that don't expect the base
1559         class to pay attention to.
1560         (WebCore::HTMLOutputElement::childrenChanged): Deleted. No need for this in
1561         the improved HTML specification version of this element's algorithms.
1562         (WebCore::HTMLOutputElement::reset): Updated based on the HTML specification,
1563         using the default value algorithm rather than the default value mode flag we
1564         were using before.
1565         (WebCore::HTMLOutputElement::setValue): Updated based on the HTML specification,
1566         always setting the default value override based on the current default value,
1567         and using stringReplaceAll. There's no need for the old setTextContentInternal,
1568         since that was all due to the need to avoid infinite recursion in childrenChanged.
1569         (WebCore::HTMLOutputElement::defaultValue const): Updated based on the HTML
1570         specification, deriving the default value from the default value override and
1571         the descendant text content.
1572         (WebCore::HTMLOutputElement::setDefaultValue): Updated based on the HTML
1573         specification, doing a string replace all with the value if the default
1574         value override is null, and updating the default value override otherwise.
1575         (WebCore::HTMLOutputElement::htmlFor): Updated to rename m_tokens to m_forTokens.
1576         (WebCore::HTMLOutputElement::setTextContentInternal): Deleted.
1577
1578         * html/HTMLOutputElement.h: Moved DOMTokenList to be a forward declaration
1579         instead of an include. Adde a constructor that takes only a document to be used
1580         from JavaScript. Made the canContainRangeEndPoint override be private like the
1581         other overrides. Removed the childrenChange override and the
1582         setTextContentInternal function. Removed m_isDefaultValueMode,
1583         m_isSetTextContentInProgress, and m_defaultValue. Added m_defaultValueOverride.
1584         Renamed m_tokens to m_forTokens.
1585
1586         * html/HTMLOutputElement.idl: Updated to match the HTML specification. This
1587         involved adding a constructor, adding SameObject for the htmlFor attribute,
1588         making the form attribute nullable, and removing [LegacyNullToEmptyString]
1589         from the defaultValue and value attributes.
1590
1591 2021-05-14  Sam Weinig  <weinig@apple.com>
1592
1593         Use PixelBufferFormat to specify ImageBuffer::getPixelData destination format allowing for more control over data conversion
1594         https://bugs.webkit.org/show_bug.cgi?id=225813
1595
1596         Reviewed by Darin Adler.
1597
1598         The reprevious signature of ImageBuffer::getPixelBuffer:
1599
1600             ImageBuffer::getPixelBuffer(AlphaPremultiplication, const IntRect&);
1601         
1602         only allowed specifying the type of alpha premultiplication wanted, and hard coded
1603         a pixel format of RGBA8 and color space of SRGB. To support accurate and efficient
1604         access to pixel buffers with different pixel formats and color spaces we need to be
1605         able to tell getPixelBuffer what we want up front, so that if the ImageBuffer already
1606         has a DisplayP3 buffer, and we want DisplayP3 pixels, we don't first convert to SRGB
1607         and then convert back to DisplayP3 (which would be slow and lose any out of gamut
1608         data). The new signature allows us to specify the entire format triple:
1609         
1610             ImageBuffer::getPixelBuffer(const PixelBufferFormat&, const IntRect&);
1611
1612         Additionally, ImageBuffer::putPixelBuffer() no longer needs to provide the source
1613         AlphaPremultiplication either, as the PixelBuffer itself also contains that information.
1614
1615         Now that we are passing color space information, we need to support color space conversion,
1616         so PixelBufferConversion was updated to support color space conversion on CG platforms
1617         using vImageConvert_AnyToAny. This is not currently excersised, but will be in a subsequent
1618         change where canvas ImageData gains a color space setting, at which point it can be tested.
1619
1620         We also don't currently support color space conversion on non-CG platforms. This won't
1621         be a problem in the short term, as only CG platforms support DisplayP3, the only other
1622         color space that can be specified currently, but as cleanup, we should add support for
1623         color space conversion using the ColorConversion and ColorTransferFunction infrastructure
1624         for other ports, moving the existing support for SRGB to/from LinearSRGB conversions from
1625         ImageBufferCairoBackend and ImageBufferCairoImageSurfaceBackend.
1626
1627         * html/ImageBitmap.cpp:
1628         (WebCore::ImageBitmap::createPromise):
1629         * html/canvas/CanvasRenderingContext2DBase.cpp:
1630         (WebCore::CanvasRenderingContext2DBase::getImageData const):
1631         (WebCore::CanvasRenderingContext2DBase::putImageData):
1632         * page/PageConsoleClient.cpp:
1633         (WebCore::PageConsoleClient::screenshot):
1634         * platform/graphics/ConcreteImageBuffer.h:
1635         (WebCore::ConcreteImageBuffer::putPixelBuffer):
1636         * platform/graphics/ImageBuffer.h:
1637         (WebCore::ImageBuffer::putPixelBuffer):
1638         * platform/graphics/ImageBufferBackend.cpp:
1639         (WebCore::ImageBufferBackend::convertToLuminanceMask):
1640         (WebCore::ImageBufferBackend::getPixelBuffer const):
1641         (WebCore::ImageBufferBackend::putPixelBuffer):
1642         * platform/graphics/ImageBufferBackend.h:
1643         * platform/graphics/PixelBufferConversion.cpp:
1644         (WebCore::makeVImageCGImageFormat):
1645         (WebCore::makeVImageBuffer):
1646         (WebCore::convertImagePixelsAccelerated):
1647         (WebCore::convertImagePixels):
1648         * platform/graphics/ShadowBlur.cpp:
1649         (WebCore::ShadowBlur::blurShadowBuffer):
1650         * platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp:
1651         (WebCore::ImageBufferCairoSurfaceBackend::getPixelBuffer const):
1652         (WebCore::ImageBufferCairoSurfaceBackend::putPixelBuffer):
1653         * platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h:
1654         * platform/graphics/cg/ImageBufferCGBackend.cpp:
1655         (WebCore::ImageBufferCGBackend::toCFData const):
1656         * platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
1657         (WebCore::ImageBufferCGBitmapBackend::getPixelBuffer const):
1658         (WebCore::ImageBufferCGBitmapBackend::putPixelBuffer):
1659         * platform/graphics/cg/ImageBufferCGBitmapBackend.h:
1660         * platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
1661         (WebCore::ImageBufferIOSurfaceBackend::getPixelBuffer const):
1662         (WebCore::ImageBufferIOSurfaceBackend::putPixelBuffer):
1663         * platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
1664         * platform/graphics/displaylists/DisplayListItems.cpp:
1665         (WebCore::DisplayList::PutPixelBuffer::PutPixelBuffer):
1666         (WebCore::DisplayList::PutPixelBuffer::swap):
1667         (WebCore::DisplayList::operator<<):
1668         * platform/graphics/displaylists/DisplayListItems.h:
1669         (WebCore::DisplayList::GetPixelBuffer::GetPixelBuffer):
1670         (WebCore::DisplayList::GetPixelBuffer::outputFormat const):
1671         (WebCore::DisplayList::PutPixelBuffer::encode const):
1672         (WebCore::DisplayList::PutPixelBuffer::decode):
1673         (WebCore::DisplayList::PutPixelBuffer::inputFormat const): Deleted.
1674         * platform/graphics/displaylists/DisplayListRecorder.cpp:
1675         (WebCore::DisplayList::Recorder::getPixelBuffer):
1676         (WebCore::DisplayList::Recorder::putPixelBuffer):
1677         * platform/graphics/displaylists/DisplayListRecorder.h:
1678         * platform/graphics/filters/FEColorMatrix.cpp:
1679         (WebCore::FEColorMatrix::platformApplySoftware):
1680         * platform/graphics/filters/FEDropShadow.cpp:
1681         (WebCore::FEDropShadow::platformApplySoftware):
1682         * platform/graphics/filters/FilterEffect.cpp:
1683         (WebCore::FilterEffect::imageBufferResult):
1684         (WebCore::FilterEffect::convertPixelBufferToColorSpace):
1685         (WebCore::FilterEffect::convertImageBufferToColorSpace):
1686         (WebCore::FilterEffect::copyConvertedPixelBufferToDestination):
1687         (WebCore::FilterEffect::copyUnmultipliedResult):
1688         (WebCore::FilterEffect::copyPremultipliedResult):
1689         * platform/graphics/filters/FilterEffect.h:
1690         * platform/graphics/win/ImageBufferDirect2DBackend.cpp:
1691         (WebCore::ImageBufferDirect2DBackend::getPixelBuffer const):
1692         (WebCore::ImageBufferDirect2DBackend::putPixelBuffer):
1693         * platform/graphics/win/ImageBufferDirect2DBackend.h:
1694         * rendering/shapes/Shape.cpp:
1695         (WebCore::Shape::createRasterShape):
1696
1697 2021-05-14  Devin Rousso  <drousso@apple.com>
1698
1699         Sampled Page Top Color: move logic out of `Document`
1700         https://bugs.webkit.org/show_bug.cgi?id=225480
1701         <rdar://problem/77984539>
1702
1703         Reviewed by Tim Horton.
1704
1705         Having `determineSampledPageTopColor` be called in `enqueuePaintTimingEntryIfNeeded` as what
1706         is basically a side effect is not great. The only reason it was there in the first place was
1707         to take advantage of the logic that decided "is this the first contentful paint", but that
1708         logic can be replicated elsewhere. Since the sampled page top color deals more with the page
1709         as a whole instead of an individual `Document` (which includes subframes), it makes more
1710         sense to have this logic be on a utility `PageColorSampler` that's used in `Page` instead.
1711
1712         Test: SampledPageTopColor.MainDocumentChange
1713
1714         * page/PageColorSampler.h: Added.
1715         * page/PageColorSampler.cpp: Added.
1716         (WebCore::isValidSampleLocation):
1717         (WebCore::sampleColor):
1718         (WebCore::colorDifference):
1719         (WebCore::averageColor):
1720         (WebCore::PageColorSampler::sampleTop):
1721         * page/Page.h:
1722         * page/Page.cpp:
1723         (WebCore::Page::doAfterUpdateRendering):
1724         (WebCore::Page::sampledPageTopColor const):
1725         (WebCore::Page::didChangeMainDocument):
1726
1727         * dom/Document.h:
1728         (WebCore::Document::sampledPageTopColor const): Deleted.
1729         * dom/Document.cpp:
1730         (WebCore::Document::enqueuePaintTimingEntryIfNeeded):
1731         (WebCore::isValidPageSampleLocation): Deleted.
1732         (WebCore::samplePageColor): Deleted.
1733         (WebCore::colorDifference): Deleted.
1734         (WebCore::averageColor): Deleted.
1735         (WebCore::Document::determineSampledPageTopColor): Deleted.
1736
1737         * page/FrameView.h:
1738         * page/FrameView.cpp:
1739         (WebCore::FrameView::hasContentfulDescendants const): Added.
1740         (WebCore::FrameView::hasContenfulDescendants const): Deleted.
1741         Drive-by: Fix incorrect spelling.
1742
1743         * Source/WebCore/Headers.cmake:
1744         * Source/WebCore/Sources.txt:
1745         * Source/WebCore/WebCore.xcodeproj/project.pbxproj:
1746
1747 2021-05-14  Eric Carlson  <eric.carlson@apple.com>
1748
1749         [GPUP] a media element with a data url and "crossorigin='anonymous'" doesn't load
1750         https://bugs.webkit.org/show_bug.cgi?id=225786
1751         <rdar://77625185>
1752
1753         Reviewed by Jer Noble.
1754
1755         Test: media/data-url-cross-origin.html
1756
1757         * loader/MediaResourceLoader.cpp:
1758         (WebCore::MediaResourceLoader::requestResource): Set loader options `sameOriginDataURLFlag`
1759         to `SameOriginDataURLFlag::Set` so data: urls are treated as same origin.
1760
1761 2021-05-14  Peng Liu  <peng.liu6@apple.com>
1762
1763         REGRESSION: [ Mac WK2 ] fast/mediastream/audio-track-enabled.html is flaky failing
1764         https://bugs.webkit.org/show_bug.cgi?id=221985
1765
1766         Reviewed by Eric Carlson.
1767
1768         When `MediaSessionManagerCocoa::updateSessionState()` goes through all sessions, it
1769         counts all WebAudio sessions regardless their states, and it may set the shared audio
1770         session's category to be `AudioSession::AmbientSound` if the count of WebAudio sessions
1771         is not zero.
1772
1773         However, when we close a page with WebAudio, we should not count the WebAudio session
1774         here because the corresponding AudioContext is suspended and will be destroyed soon.
1775         Without this patch, the shared audio session's category might be `AudioSession::AmbientSound`
1776         after we close the WebAudio page.
1777
1778         * Modules/webaudio/AudioContext.h:
1779
1780 2021-05-14  Alan Bujtas  <zalan@apple.com>
1781
1782         [showRenderTree] Do not integral floor the overflow values
1783         https://bugs.webkit.org/show_bug.cgi?id=225825
1784
1785         Reviewed by Simon Fraser.
1786
1787         Integral flooring may hide fractional values caused by rounding bugs.
1788
1789         * rendering/RenderObject.cpp:
1790         (WebCore::RenderObject::outputRenderObject const):
1791
1792 2021-05-14  Chris Dumez  <cdumez@apple.com>
1793
1794         Drop "get" prefix from WTF::FileSystem's getFileModificationTime() / getFileCreationTime()
1795         https://bugs.webkit.org/show_bug.cgi?id=225812
1796
1797         Reviewed by Darin Adler.
1798
1799         Update code base due to WTF API change.
1800
1801         * Modules/indexeddb/server/IDBServer.cpp:
1802         (WebCore::IDBServer::removeAllDatabasesForFullOriginPath):
1803         * Modules/webdatabase/DatabaseTracker.cpp:
1804         (WebCore::DatabaseTracker::deleteDatabasesModifiedSince):
1805         * fileapi/File.cpp:
1806         (WebCore::File::lastModified const):
1807         * page/Page.cpp:
1808         (WebCore::Page::userStyleSheet const):
1809         * platform/FileStream.cpp:
1810         (WebCore::FileStream::getSize):
1811         * platform/network/FormData.cpp:
1812         (WebCore::FormDataElement::EncodedFileData::fileModificationTimeMatchesExpectation const):
1813         * platform/network/curl/CurlCacheEntry.cpp:
1814         (WebCore::CurlCacheEntry::parseResponseHeaders):
1815         * platform/sql/SQLiteFileSystem.cpp:
1816         (WebCore::SQLiteFileSystem::databaseCreationTime):
1817         (WebCore::SQLiteFileSystem::databaseModificationTime):
1818
1819 2021-05-14  Alan Bujtas  <zalan@apple.com>
1820
1821         [LFC] Add enclosing line top/bottom to showInlineTreeAndRuns
1822         https://bugs.webkit.org/show_bug.cgi?id=225821
1823
1824         Reviewed by Simon Fraser.
1825
1826         * layout/layouttree/LayoutTreeBuilder.cpp:
1827         (WebCore::Layout::showInlineTreeAndRuns):
1828         * page/FrameViewLayoutContext.cpp:
1829         (WebCore::FrameViewLayoutContext::layout):
1830
1831 2021-05-14  Ryosuke Niwa  <rniwa@webkit.org>
1832
1833         Add ScriptDisallowedScope to MediaPlayerPrivateAVFoundation
1834         https://bugs.webkit.org/show_bug.cgi?id=225797
1835
1836         Reviewed by Eric Carlson.
1837
1838         Deployed ScriptDisallowedScope to a bunch of functions in MediaPlayerPrivateAVFoundation.
1839
1840         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
1841         (WebCore::MediaPlayerPrivateAVFoundation::updateStates):
1842         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1843         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
1844         (-[WebCoreAVFMovieObserver legibleOutput:didOutputAttributedStrings:nativeSampleBuffers:forItemTime:]):
1845         (-[WebCoreAVFMovieObserver metadataOutput:didOutputTimedMetadataGroups:fromPlayerItemTrack:]):
1846         (-[WebCoreAVFLoaderDelegate resourceLoader:didCancelLoadingRequest:]):
1847
1848 2021-05-14  Jean-Yves Avenard  <jya@apple.com>
1849
1850         Bad media session artwork URL results in blue "broken image" icon being shown in Now Playing
1851         https://bugs.webkit.org/show_bug.cgi?id=225799
1852         rdar://77990886
1853
1854         Reviewed by Eric Carlson.
1855
1856         By default, when the image's URL doesn't point to an image the CachedImage
1857         will return a default image consistent of a blue interrogation mark.
1858         We need to explicitely check that an error occurred. The naming used in the
1859         method didn't make this need obvious.
1860
1861         * Modules/mediasession/MediaMetadata.cpp:
1862         (WebCore::ArtworkImageLoader::notifyFinished): Check for a status error.
1863         * testing/Internals.cpp:
1864         (WebCore::Internals::loadArtworkImage): Fix spelling
1865
1866 2021-05-14  Devin Rousso  <drousso@apple.com>
1867
1868         Promote `-[WKWebView _pageExtendedBackgroundColor]` SPI to `-[WKWebView underPageBackgroundColor]` API
1869         https://bugs.webkit.org/show_bug.cgi?id=225615
1870         <rdar://problem/76568094>
1871
1872         Reviewed by Wenson Hsieh.
1873
1874         `underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
1875          - the most recent non-null value provided
1876          - the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
1877          - the underlying platform view's background color
1878         Modifications to this property will not have any effect until control is returned to the runloop.
1879
1880         Tests: WKWebViewUnderPageBackgroundColor.OnLoad
1881                WKWebViewUnderPageBackgroundColor.SingleSolidColor
1882                WKWebViewUnderPageBackgroundColor.SingleBlendedColor
1883                WKWebViewUnderPageBackgroundColor.MultipleSolidColors
1884                WKWebViewUnderPageBackgroundColor.MultipleBlendedColors
1885                WKWebViewUnderPageBackgroundColor.KVO
1886                WKWebViewUnderPageBackgroundColor.MatchesScrollView
1887
1888         * page/Page.h:
1889         (WebCore::Page::underPageBackgroundColorOverride const): Added.
1890         * page/Page.cpp:
1891         (WebCore::Page::setUnderPageBackgroundColorOverride): Added.
1892         Hold the client-overriden value for `underPageBackgroundColor` so that it can be used when
1893         drawing the overscroll layer.
1894
1895         * rendering/RenderLayerCompositor.cpp:
1896         (WebCore::RenderLayerCompositor::updateLayerForOverhangAreasBackgroundColor):
1897         Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor` and
1898         `UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
1899         overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
1900
1901         * dom/Document.cpp:
1902         (WebCore::Document::themeColorChanged):
1903         It's no longer necessary to force the overscroll area to redraw since that'll be handled by
1904         a client calling `-[WKWebView setUnderPageBackgroundColor:]` (possibly in response to a
1905         `-[WKWebView themeColor]` KVO notification).
1906
1907 2021-05-14  Alex Christensen  <achristensen@webkit.org>
1908
1909         Fix a build after r277493
1910
1911         * editing/cocoa/AttributedString.h:
1912         I removed an unneeded NSDictionary declaration that was being used here.
1913
1914 2021-05-14  Ziran Sun  <zsun@igalia.com>
1915
1916         Wrong static position for out-of-flow positioned element with different writing-mode than its containing block
1917         https://bugs.webkit.org/show_bug.cgi?id=189513
1918
1919         Reviewed by Sergio Villar Senin.
1920
1921         The static distance computations (computeBlockStaticDistance & computeInlineStaticDistance) in RenderBox have
1922         not been patched for mixed writing modes. This CL adds support for the case that child is orthogonal to its
1923         container block when container block's text direction is LTR. It aims at fixing failures in 
1924         orthogonal-positioned-grid-descendants*.html tests. It is noted that this CL only covers specific case when child's
1925         writing mode is vlr and parent is horizontal tb rather than all cases of mixed writing modes in the static distance
1926         computations.
1927         
1928         * rendering/RenderBox.cpp:
1929         (WebCore::computeInlineStaticDistance):
1930         (WebCore::computeBlockStaticDistance):
1931
1932 2021-05-14  Alex Christensen  <achristensen@webkit.org>
1933
1934         Resource Timing: secureConnectionStart == 0 when a connection is re-used
1935         https://bugs.webkit.org/show_bug.cgi?id=225733
1936
1937         Reviewed by Chris Dumez.
1938
1939         Covered by a newly-passing web platform test, which was already passed by Chrome and Firefox.
1940
1941         * page/PerformanceResourceTiming.cpp:
1942         (WebCore::PerformanceResourceTiming::secureConnectionStart const):
1943         * platform/network/NetworkLoadMetrics.h:
1944         I use a sentinel value to distinguish no secure connection from a reused secure connection.
1945         * platform/network/ResourceHandle.h:
1946         * platform/network/cocoa/NetworkLoadMetrics.mm:
1947         (WebCore::packageTimingData):
1948         (WebCore::copyTimingData):
1949         Introduce a way to get timing data from CFNetwork using a more modern API.
1950         (WebCore::timingValue): Deleted.
1951         * platform/network/cocoa/WebCoreNSURLSession.mm:
1952         (-[WebCoreNSURLSessionDataTask _timingData]):
1953         * platform/network/mac/ResourceHandleMac.mm:
1954         (WebCore::ResourceHandle::getConnectionTimingData): Deleted.
1955         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1956         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
1957
1958 2021-05-14  Chris Dumez  <cdumez@apple.com>
1959
1960         Rename FileSystem::getFileSize() to FileSystem::fileSize()
1961         https://bugs.webkit.org/show_bug.cgi?id=225798
1962
1963         Reviewed by Alex Christensen.
1964
1965         Update code path to due to the API change.
1966
1967         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
1968         (WebCore::IDBServer::SQLiteIDBBackingStore::databasesSizeForDirectory):
1969         * Modules/webdatabase/DatabaseDetails.h:
1970         (WebCore::DatabaseDetails::DatabaseDetails):
1971         * Modules/webdatabase/DatabaseTracker.cpp:
1972         (WebCore::DatabaseTracker::hasAdequateQuotaForOrigin):
1973         (WebCore::DatabaseTracker::canEstablishDatabase):
1974         (WebCore::DatabaseTracker::retryCanEstablishDatabase):
1975         (WebCore::DatabaseTracker::maximumSize):
1976         (WebCore::DatabaseTracker::detailsForNameAndOrigin):
1977         (WebCore::DatabaseTracker::setDatabaseDetails):
1978         (WebCore::DatabaseTracker::usage):
1979         (WebCore::DatabaseTracker::quotaNoLock):
1980         (WebCore::DatabaseTracker::quota):
1981         (WebCore::DatabaseTracker::setQuota):
1982         (WebCore::isZeroByteFile):
1983         * Modules/webdatabase/DatabaseTracker.h:
1984         * editing/cocoa/WebContentReaderCocoa.mm:
1985         (WebCore::attachmentForFilePath):
1986         * loader/appcache/ApplicationCacheStorage.cpp:
1987         (WebCore::ApplicationCacheStorage::spaceNeeded):
1988         (WebCore::ApplicationCacheStorage::loadCache):
1989         (WebCore::ApplicationCacheStorage::flatFileAreaSize):
1990         * platform/FileStream.cpp:
1991         (WebCore::FileStream::getSize):
1992         * platform/network/FormData.cpp:
1993         (WebCore::FormDataElement::lengthInBytes const):
1994         * platform/network/curl/CurlCacheEntry.cpp:
1995         (WebCore::CurlCacheEntry::loadFileToBuffer):
1996         * platform/network/curl/CurlCacheManager.cpp:
1997         (WebCore::CurlCacheManager::loadIndex):
1998         * platform/sql/SQLiteFileSystem.cpp:
1999         (WebCore::SQLiteFileSystem::databaseFileSize):
2000         * platform/sql/SQLiteFileSystem.h:
2001         * rendering/RenderThemeWin.cpp:
2002         (WebCore::RenderThemeWin::stringWithContentsOfFile):
2003         * workers/service/server/SWScriptStorage.cpp:
2004         (WebCore::shouldUseFileMapping):
2005         (WebCore::SWScriptStorage::retrieve):
2006
2007 2021-05-14  Chris Dumez  <cdumez@apple.com>
2008
2009         Rename FileSystem::pathGetFileName() to FileSystem::pathFileName()
2010         https://bugs.webkit.org/show_bug.cgi?id=225806
2011
2012         Reviewed by Alex Christensen.
2013
2014         Rename FileSystem::pathGetFileName() to FileSystem::pathFileName(), as we avoid "get" prefixes in WebKit.
2015
2016         * Modules/entriesapi/FileSystemEntry.cpp:
2017         (WebCore::FileSystemEntry::FileSystemEntry):
2018         * Modules/webdatabase/DatabaseTracker.cpp:
2019         (WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
2020         * editing/cocoa/WebContentReaderCocoa.mm:
2021         (WebCore::attachmentForFilePath):
2022         * fileapi/File.cpp:
2023         (WebCore::File::computeNameAndContentType):
2024         * fileapi/FileCocoa.mm:
2025         (WebCore::File::computeNameAndContentTypeForReplacedFile):
2026         * html/DirectoryFileListCreator.cpp:
2027         (WebCore::gatherFileInformation):
2028         * loader/appcache/ApplicationCacheStorage.cpp:
2029         (WebCore::ApplicationCacheStorage::store):
2030         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2031         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setStorageDirectory):
2032         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2033         (WebCore::MediaPlayerPrivateGStreamer::purgeOldDownloadFiles):
2034
2035 2021-05-13  Rob Buis  <rbuis@igalia.com>
2036
2037         Check for null element in paintSearchFieldResultsButton
2038         https://bugs.webkit.org/show_bug.cgi?id=225232
2039
2040         Reviewed by Ryosuke Niwa.
2041
2042         Check for null element in paintSearchFieldResultsButton.
2043
2044         Test: fast/css/searchfield-results-button-crash.html
2045
2046         * rendering/RenderThemeMac.mm:
2047         (WebCore::RenderThemeMac::paintSearchFieldResultsButton):
2048
2049 2021-05-13  Michael Catanzaro  <mcatanzaro@gnome.org>
2050
2051         Misc GCC warning cleanup
2052         https://bugs.webkit.org/show_bug.cgi?id=225777
2053
2054         Reviewed by Carlos Garcia Campos.
2055
2056         * bindings/js/JSAudioNodeCustom.cpp:
2057         (WebCore::toJSNewlyCreated): Add missing RELEASE_ASSERT_NOT_REACHED().
2058         * svg/SVGToOTFFontConversion.cpp:
2059         (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Remove redundant condition.
2060
2061 2021-05-13  Carlos Garcia Campos  <cgarcia@igalia.com>
2062
2063         [GTK] Wrong smooth animation sometimes with non-async scrolling
2064         https://bugs.webkit.org/show_bug.cgi?id=225764
2065
2066         Reviewed by Adrian Perez de Castro.
2067
2068         This is happening because sometimes when the scrollbars are added to the scroll view, the contents size hasn't
2069         been updated yet, so that values saved by ScrollAnimationSmooth::updateVisibleLengths() are 0x0. After that the
2070         updateVisibleLengths() is not called again when the contents size is updated, so scroll happens with the wrong
2071         visible lengths. This doesn't happen with async scrolling because updateVisibleLengths()  is called every time
2072         layers are repositioned. For non-async scrolling it should be enough to update visible lengths when he contents
2073         size changes.
2074
2075         * platform/ScrollAnimator.cpp:
2076         (WebCore::ScrollAnimator::contentsResized const):
2077         * platform/ScrollAnimator.h:
2078         (WebCore::ScrollAnimator::ScrollAnimator::contentsResized const):
2079
2080 2021-05-13  Devin Rousso  <drousso@apple.com>
2081
2082         [Modern Media Controls] REGRESSION(r268308) AirPlay briefly disappears and then reappears when hovering over controls
2083         https://bugs.webkit.org/show_bug.cgi?id=225780
2084         <rdar://problem/77984683>
2085
2086         Reviewed by Eric Carlson.
2087
2088         r268308 adjusted `AVRoutePickerViewTargetPicker::isAvailable`, which is used to control
2089         whether `AVRoutePickerViewTargetPicker` (which uses the `AVRouteDetectorMultipleRoutesDetectedDidChange`
2090         notification and actually stops listening for it in `stopMonitoringPlaybackTargets`) or
2091         `AVOutputDeviceMenuControllerTargetPicker` (which uses ObjC KVO and doesn't actually do
2092         anything in `stopMonitoringPlaybackTargets` when the last JS `"webkitplaybacktargetavailabilitychanged"`
2093         event listener is removed, meaning that WebKit never senda a new value to the WebProcess) is
2094         used. When using `AVRoutePickerViewTargetPicker`, WebKit calls `-[AVRouteDetector setRouteDetectionEnabled:]`
2095         whenever the first JS `"webkitplaybacktargetavailabilitychanged"` event listener is added
2096         (with the argument `YES`) and the last JS `"webkitplaybacktargetavailabilitychanged"` event
2097         listener is removed (with the argument `NO`). In the latter scenario (which is the case with
2098         builtin media controls), `-[AVRouteDetector setRouteDetectionEnabled:]` will dispatch a
2099         `AVRouteDetectorMultipleRoutesDetectedDidChange` notification and mark itself as not having
2100         multiple routes (`-[AVRouteDetector multipleRoutesDetected]`). This work is done in the
2101         UIProcess and the result is sent to the WebProcess, meaning that even though there are no
2102         more JS event listeners WebKit still updates the cached state of whether multiple routes
2103         exist. This means that the next time a JS event listener is added, WebKit will ask the
2104         UIProcess to update (which will re-enable route detection, which will dispatch a `AVRouteDetectorMultipleRoutesDetectedDidChange`
2105         notification) but then immediately dispatch a JS `"webkitplaybacktargetavailabilitychanged"`
2106         event using the cached state. Once the request from the UIProcess comes back, WebKit will
2107         then dispatch *another* JS "webkitplaybacktargetavailabilitychanged" event with the new
2108         non-cached value.
2109
2110         * platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.h:
2111         * platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.mm:
2112         (WebCore::AVRoutePickerViewTargetPicker::startingMonitoringPlaybackTargets):
2113         (WebCore::AVRoutePickerViewTargetPicker::stopMonitoringPlaybackTargets):
2114         (WebCore::AVRoutePickerViewTargetPicker::availableDevicesDidChange):
2115         Add a flag that ignores the next `AVRouteDetectorMultipleRoutesDetectedDidChange`
2116         notification since it's guaranteed to be `false` after `setRouteDetectionEnabled:NO`.
2117
2118 2021-05-13  Wenson Hsieh  <wenson_hsieh@apple.com>
2119
2120         [Cocoa] Plumb data detector results through some platform objects
2121         https://bugs.webkit.org/show_bug.cgi?id=225775
2122         Work towards rdar://75504956
2123
2124         Reviewed by Tim Horton and Devin Rousso.
2125
2126         Introduce a new struct to hold data detection results, and add it to the existing results object when
2127         `ENABLE(DATA_DETECTION)` is defined.
2128
2129         No change in behavior.
2130
2131         * SourcesCocoa.txt:
2132         * WebCore.xcodeproj/project.pbxproj:
2133         * editing/cocoa/DataDetection.mm:
2134         (WebCore::DataDetection::canBePresentedByDataDetectors):
2135         (WebCore::DataDetection::canPresentDataDetectorsUIForElement):
2136         (WebCore::resultIsURL):
2137         (WebCore::constructURLStringForResult):
2138         (WebCore::buildQuery):
2139         (WebCore::DataDetection::detectContentInRange):
2140
2141         Add a `PAL` namespace to each of these DataDetectorsCore softlinking call sites, since the soft link header now
2142         exists in PAL.
2143
2144         * platform/ImageExtractionResult.h:
2145         (WebCore::ImageExtractionDataDetectorInfo::ImageExtractionDataDetectorInfo):
2146         (WebCore::ImageExtractionResult::isEmpty const):
2147         (WebCore::ImageExtractionResult::encode const):
2148         (WebCore::ImageExtractionResult::decode):
2149         * platform/cocoa/DataDetectorsCoreSoftLink.h: Removed.
2150         * platform/cocoa/DataDetectorsCoreSoftLink.mm: Removed.
2151
2152         Additionally, move `DataDetectorsCoreSoftLink.{h|mm}` out of `WebCore/platform` and into PAL as softlinking
2153         headers, so that they can be imported in WebKit as well as WebCore.
2154
2155 2021-05-13  Devin Rousso  <drousso@apple.com>
2156
2157         [iOS] REGRESSION(r271216) pointerevents/ios/pointer-events-no-mousedown-when-prevent-default-called-on-pointerdown.html is consistently failing
2158         https://bugs.webkit.org/show_bug.cgi?id=225734
2159         <rdar://problem/77070765>
2160
2161         Reviewed by Tim Horton.
2162
2163         r271216 made it so that `touchWithIdentifierWasRemoved` is eagerly called when dispatching
2164         `"pointerup"` for a touch event. This is problematic because (compatibility) mouse events
2165         are dispatched after both pointer and touch events, meaning that if the `CapturingData` for
2166         the touch event is removed, there's no way of knowing if the pointer event `preventDefault`.
2167
2168         Instead of fully removing the `CapturingData` entirely, change its state such that it's
2169         marked as `CapturingData::State::Finished` and check for that instead.
2170
2171         * page/PointerCaptureController.h:
2172         * page/PointerCaptureController.cpp:
2173         (WebCore::PointerCaptureController::hasCancelledPointerEventForIdentifier const):
2174         (WebCore::PointerCaptureController::dispatchEventForTouchAtIndex):
2175         (WebCore::PointerCaptureController::pointerEventForMouseEvent):
2176         (WebCore::PointerCaptureController::cancelPointer):
2177
2178 2021-05-13  Cameron McCormack  <heycam@apple.com>
2179
2180         Ensure scrollable transformed elements that are themselves within scrollable elements don't ignore border-radius
2181         https://bugs.webkit.org/show_bug.cgi?id=216978
2182         <rdar://69660229>
2183
2184         Reviewed by Darin Adler.
2185
2186         We use ShouldRespectOverflowClip to prevent clips from ancestors
2187         from being used when we paint a scrollable layer (when
2188         PaintLayerFlag::PaintingOverflowContents is set). We only look
2189         at the ShouldRespectOverflowClip value when we're painting a layer
2190         we're considering to be a clip rect root layer, and we unconditionally
2191         apply ancestor clips for layers that aren't clip rect roots.
2192
2193         A non-root layer with a transform is handled by applying the transform
2194         and painting the layer as a root layer (since we don't want to handle
2195         computing the effect of ancestor clip rects past the transform). When
2196         the transformed layer also has a border-radius, we incorrectly skip
2197         marking its clip rect as being affected by radius, since we currently
2198         do this at the same time as applying ancestor clip rects.
2199
2200         This patch splits out the setAffectedByRadius call so that it happens
2201         even for transformed non-root layers.
2202
2203         Test: fast/layers/overflow-scroll-transform-border-radius.html
2204
2205         * rendering/RenderLayer.cpp:
2206         (WebCore::ClipRects::setOverflowClipRectAffectedByRadius):
2207         (WebCore::RenderLayer::calculateClipRects const):
2208
2209 2021-05-13  Devin Rousso  <drousso@apple.com>
2210
2211         [macOS] experimental "Use theme color for scroll area background" isn't working
2212         https://bugs.webkit.org/show_bug.cgi?id=225726
2213         <rdar://problem/77933000>
2214
2215         Reviewed by Tim Horton.
2216
2217         * rendering/RenderLayerCompositor.cpp:
2218         (WebCore::RenderLayerCompositor::updateLayerForOverhangAreasBackgroundColor):
2219         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
2220         Fix last remaining `m_layerForOverhangAreas->setBackgroundColor` to use the helper function
2221         `RenderLayerCompositor::updateLayerForOverhangAreasBackgroundColor` instead so that all
2222         paths that update the overscroll area color check the experimental settings too.
2223
2224 2021-05-13  Megan Gardner  <megan_gardner@apple.com>
2225
2226         Add textIndicator bounce for AppHighlights on scroll.
2227         https://bugs.webkit.org/show_bug.cgi?id=225727
2228
2229         Reviewed by Tim Horton.
2230
2231         * Modules/highlight/AppHighlightStorage.cpp:
2232         (WebCore::AppHighlightStorage::attemptToRestoreHighlightAndScroll):
2233         * loader/EmptyClients.cpp:
2234         (WebCore::EmptyChromeClient::setTextIndicator const):
2235         * loader/EmptyClients.h:
2236         * page/ChromeClient.h:
2237         * page/TextIndicator.h:
2238         * page/cocoa/WebTextIndicatorLayer.h:
2239         * page/cocoa/WebTextIndicatorLayer.mm:
2240         (-[WebTextIndicatorLayer initWithFrame:textIndicator:margin:offset:]):
2241         (createBounceAnimation):
2242         (-[WebTextIndicatorLayer _animationDuration]):
2243         * page/mac/TextIndicatorWindow.h:
2244         * page/mac/TextIndicatorWindow.mm:
2245         (WebCore::TextIndicatorWindow::~TextIndicatorWindow):
2246         (WebCore::TextIndicatorWindow::clearTextIndicator):
2247         (WebCore::TextIndicatorWindow::setTextIndicator):
2248
2249 2021-05-13  Aditya Keerthi  <akeerthi@apple.com>
2250
2251         REGRESSION (r276945): [iOS] Focus rings are too large
2252         https://bugs.webkit.org/show_bug.cgi?id=225778
2253         <rdar://problem/77858341>
2254
2255         Reviewed by Tim Horton.
2256
2257         r276945 updated scaling logic to ensure that the scale of the base CTM
2258         matches the device scale factor. The change itself makes our base CTM
2259         more correct, but exposed a longstanding bug with our focus ring
2260         implementation.
2261
2262         Focus rings are drawn using CoreGraphics, using CGFocusRingStyle. On
2263         macOS, the style is initialized using NSInitializeCGFocusRingStyleForTime.
2264         However, on iOS, we initialize the style ourselves, using UIKit constants.
2265         Currently, the focus ring's style's radius is set to
2266         +[UIFocusRingStyle cornerRadius], a constant of 8. This is the longstanding
2267         issue. CGFocusRingStyle's radius is not a corner radius, but is the
2268         width of the focus ring. In UIKit, this width is represented by
2269         +[UIFocusRingStyle borderThickness], a constant of 3. WebKit has always
2270         intended to match this width, as evidenced by the default outline-width
2271         of 3px in the UA style sheet.
2272
2273         Considering the large disparity between the existing and expected radius
2274         value, it may be surprising that this mistake has gone unnoticed since
2275         2019, when focus rings were first introduced on iOS. This is where r276945
2276         comes into play. Prior to r276945, the scale of the base CTM did not match
2277         the device scale factor. This meant that CG scaled down the constant of 8
2278         to 4 CSS pixels (1 (base CTM) / 2 (device scale factor)). After r276945,
2279         the two scales are equal and the focus ring is drawn as 8 CSS pixels, much
2280         larger than the expected 3px.
2281
2282         Test: fast/forms/ios/focus-ring-size.html
2283
2284         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
2285         (WebCore::drawFocusRingAtTime):
2286
2287         To fix, use the correct SPI to get the focus ring width,
2288         +[UIFocusRingStyle borderThickness]. This ensures that focus rings have
2289         the right width, following r276945.
2290
2291         The change also fixes focus ring repaint issues that arose from the
2292         fact that the outline-width was 3px, but the painted width was 4px.
2293
2294 2021-05-13  Sam Weinig  <weinig@apple.com>
2295
2296         Split pixel buffer format data out into a new PixelBufferFormat struct
2297         https://bugs.webkit.org/show_bug.cgi?id=225707
2298
2299         Reviewed by Darin Adler.
2300
2301         Splits out PixelBufferFormat into a new struct and adopts it by PixelBufferConversionView,
2302         ConstPixelBufferConversionView and PixelBuffer. This also means that PixelBuffer now
2303         tracks the alpha format of the underlying buffer which will come in handy.
2304
2305         * Headers.cmake:
2306         * Sources.txt:
2307         * WebCore.xcodeproj/project.pbxproj:
2308         Add new files.
2309
2310         * platform/graphics/AlphaPremultiplication.cpp: Added.
2311         (WebCore::operator<<):
2312         Add AlphaPremultiplication.cpp and move TextStream support
2313         here from GraphicsTypes.cpp.
2314
2315         * platform/graphics/GraphicsTypes.cpp:
2316         Move AlphaPremultiplication TextStream to the more appropriate
2317         AlphaPremultiplication.cpp.
2318
2319         * html/ImageData.cpp:
2320         (WebCore::ImageData::create):
2321         * html/ImageData.h:
2322         (WebCore::ImageData::colorSpace const): Deleted.
2323         (WebCore::ImageData::format const): Deleted.
2324         * platform/graphics/ImageBufferBackend.cpp:
2325         (WebCore::ImageBufferBackend::toBGRAData const):
2326         (WebCore::ImageBufferBackend::getPixelBuffer const):
2327         (WebCore::ImageBufferBackend::putPixelBuffer):
2328         * platform/graphics/ImageBufferBackend.h:
2329         * platform/graphics/PixelBuffer.cpp:
2330         (WebCore::PixelBuffer::computeBufferSize):
2331         (WebCore::PixelBuffer::tryCreateForDecoding):
2332         (WebCore::PixelBuffer::tryCreate):
2333         (WebCore::PixelBuffer::PixelBuffer):
2334         (WebCore::PixelBuffer::deepClone const):
2335         (WebCore::operator<<):
2336         * platform/graphics/PixelBuffer.h:
2337         (WebCore::PixelBuffer::format const):
2338         (WebCore::PixelBuffer::encode const):
2339         (WebCore::PixelBuffer::decode):
2340         (WebCore::PixelBuffer::colorSpace const): Deleted.
2341         * platform/graphics/PixelBufferConversion.cpp:
2342         (WebCore::convertImagePixelsAccelerated):
2343         (WebCore::convertImagePixels):
2344         * platform/graphics/PixelBufferConversion.h:
2345         * platform/graphics/PixelBufferFormat.cpp: Added.
2346         (WebCore::operator<<):
2347         * platform/graphics/PixelBufferFormat.h: Added.
2348         (WebCore::PixelBufferFormat::encode const):
2349         (WebCore::PixelBufferFormat::decode):
2350         * platform/graphics/PixelFormat.cpp: Added.
2351         (WebCore::operator<<):
2352         * platform/graphics/PixelFormat.h:
2353         * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
2354         (WebCore::GraphicsContextGLOpenGL::readPixelsForPaintResults):
2355         * platform/graphics/cg/GraphicsContextGLCG.cpp:
2356         (WebCore::GraphicsContextGLOpenGL::paintToCanvas):
2357         * platform/graphics/cg/ImageBufferCGBackend.cpp:
2358         (WebCore::ImageBufferCGBackend::toCFData const):
2359         * platform/graphics/cg/ImageBufferUtilitiesCG.cpp:
2360         (WebCore::cfData):
2361         * platform/graphics/filters/FilterEffect.cpp:
2362         (WebCore::FilterEffect::copyUnmultipliedResult):
2363         (WebCore::FilterEffect::copyPremultipliedResult):
2364         (WebCore::FilterEffect::createUnmultipliedImageResult):
2365         (WebCore::FilterEffect::createPremultipliedImageResult):
2366         Adopt PixelBufferFormat.
2367
2368 2021-05-13  Chris Dumez  <cdumez@apple.com>
2369
2370         Rename FileSystem::directoryName() to FileSystem::parentPath()
2371         https://bugs.webkit.org/show_bug.cgi?id=225768
2372
2373         Reviewed by Darin Adler.
2374
2375         Rename FileSystem::directoryName() to FileSystem::parentPath() for clarity and
2376         consistency with std::filesystem::parent_path() which is used internally.
2377
2378         * Modules/entriesapi/DOMFileSystem.cpp:
2379         (WebCore::DOMFileSystem::DOMFileSystem):
2380         * loader/appcache/ApplicationCacheStorage.cpp:
2381         (WebCore::ApplicationCacheStorage::writeDataToUniqueFileInDirectory):
2382         (WebCore::ApplicationCacheStorage::checkForDeletedResources):
2383         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
2384         (WebCore::CDMSessionAVContentKeySession::contentKeySession):
2385         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2386         (WebCore::MediaPlayerPrivateGStreamer::purgeOldDownloadFiles):
2387         * platform/network/curl/CookieJarDB.cpp:
2388         (WebCore::CookieJarDB::openDatabase):
2389         * platform/sql/SQLiteFileSystem.cpp:
2390         (WebCore::SQLiteFileSystem::ensureDatabaseFileExists):
2391         * platform/win/SearchPopupMenuDB.cpp:
2392         (WebCore::SearchPopupMenuDB::openDatabase):
2393         * workers/service/server/SWScriptStorage.cpp:
2394         (WebCore::SWScriptStorage::store):
2395
2396 2021-05-13  Chris Dumez  <cdumez@apple.com>
2397
2398         Rename FileSystem::fileIsDirectory(path, followSymlinks) to isDirectory(path) / isDirectoryFollowingSymlinks(path)
2399         https://bugs.webkit.org/show_bug.cgi?id=225772
2400
2401         Reviewed by Darin Adler.
2402
2403         Update code base due to API naming change.
2404
2405         * Modules/entriesapi/DOMFileSystem.cpp:
2406         (WebCore::listDirectoryWithMetadata):
2407         * editing/cocoa/WebContentReaderCocoa.mm:
2408         (WebCore::attachmentForFilePath):
2409         * fileapi/File.cpp:
2410         (WebCore::File::isDirectory const):
2411         * html/DirectoryFileListCreator.cpp:
2412         (WebCore::gatherFileInformation):
2413         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2414         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setStorageDirectory):
2415         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2416         (WebCore::ensureAssetCacheExistsForPath):
2417         * platform/network/FormData.cpp:
2418         (WebCore::FormData::prepareForUpload):
2419
2420 2021-05-13  Jer Noble  <jer.noble@apple.com>
2421
2422         [ macOS Wk2 ] media/media-fragments/TC0051.html is flakey crashing
2423         https://bugs.webkit.org/show_bug.cgi?id=222277
2424         <rdar://problem/74600790>
2425
2426         Reviewed by Eric Carlson.
2427
2428         In r274734, a workaround was added to detect a bug in the Photos.framework that would cause
2429         an exception to be thrown if the URL provided to AVURLAsset had a malformed fragment identifier.
2430         However, in an effort to reduce the runtime cost of this check, it was only done once, the first
2431         time an AVURLAsset is created. This failed to account for the Photos.framework being dynamically
2432         loaded and changing the behavior of AVURLAsset after the check had been performed.
2433
2434         Instead, fall back to a much simpler check: wrap the creation of the AVURLAsset in a @try/@catch
2435         block, and if an exception was thrown, re-attempt to create the AVURLAsset with a manually
2436         conformed URL.
2437
2438         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2439         (WebCore::conformFragmentIdentifierForURL):
2440         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
2441         (WebCore::hasBrokenFragmentSupport): Deleted.
2442
2443 2021-05-13  Alicia Boya García  <aboya@igalia.com>
2444
2445         [WTF] Add holdLock() overload for WTF::DataMutex
2446         https://bugs.webkit.org/show_bug.cgi?id=225652
2447
2448         Reviewed by Xabier Rodriguez-Calvar.
2449
2450         All instantiations of DataMutex::LockedWrapper have been replaced by
2451         holdLock(), for equivalent but more concise code.
2452
2453         This patch introduces no behavior changes.
2454
2455         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2456         (webKitWebSrcConstructed):
2457         (webKitWebSrcGetProperty):
2458         (webKitWebSrcSetContext):
2459         (webKitWebSrcCreate):
2460         (webKitWebSrcMakeRequest):
2461         (webKitWebSrcStop):
2462         (webKitWebSrcGetSize):
2463         (webKitWebSrcIsSeekable):
2464         (webKitWebSrcDoSeek):
2465         (webKitWebSrcQuery):
2466         (webKitWebSrcUnLock):
2467         (webKitWebSrcUnLockStop):
2468         (webKitWebSrcSetMediaPlayer):
2469         (webKitSrcPassedCORSAccessCheck):
2470         (CachedResourceStreamingClient::responseReceived):
2471         (CachedResourceStreamingClient::dataReceived):
2472         (CachedResourceStreamingClient::accessControlCheckFailed):
2473         (CachedResourceStreamingClient::loadFailed):
2474         (CachedResourceStreamingClient::loadFinished):
2475         (webKitSrcWouldTaintOrigin):
2476         * platform/graphics/gstreamer/mse/MediaSourceTrackGStreamer.cpp:
2477         (WebCore::MediaSourceTrackGStreamer::isReadyForMoreSamples):
2478         (WebCore::MediaSourceTrackGStreamer::notifyWhenReadyForMoreSamples):
2479         (WebCore::MediaSourceTrackGStreamer::enqueueObject):
2480         (WebCore::MediaSourceTrackGStreamer::clearQueue):
2481         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
2482         (webKitMediaSrcActivateMode):
2483         (webKitMediaSrcPadLinked):
2484         (webKitMediaSrcLoop):
2485         (webKitMediaSrcStreamFlush):
2486
2487 2021-05-13  Darin Adler  <darin@apple.com>
2488
2489         Remove StringBuilder::appendNumber
2490         https://bugs.webkit.org/show_bug.cgi?id=225732
2491
2492         Reviewed by Sam Weinig.
2493
2494         * Modules/indexeddb/server/IndexValueStore.cpp:
2495         (WebCore::IDBServer::IndexValueStore::loggingString const):
2496         Use append instead of appendNumber.
2497
2498         * Modules/websockets/WebSocketHandshake.cpp:
2499         (WebCore::hostName): Use makeString instead of StringBuilder.
2500
2501         * contentextensions/CombinedURLFilters.cpp:
2502         (WebCore::ContentExtensions::prefixTreeVertexToString):
2503         Use append instead of appendNumber.
2504         * contentextensions/Term.h:
2505         (WebCore::ContentExtensions::Term::toString const): Ditto.
2506         * css/CSSFontFeatureValue.cpp:
2507         (WebCore::CSSFontFeatureValue::customCSSText const): Ditto.
2508         * css/CSSTimingFunctionValue.cpp:
2509         (WebCore::CSSStepsTimingFunctionValue::customCSSText const): Ditto.
2510
2511         * dom/Document.cpp:
2512         (WebCore::Document::downgradeReferrerToRegistrableDomain): Use
2513         makeString instead of StringBuilder.
2514         * editing/MarkupAccumulator.cpp:
2515         (WebCore::MarkupAccumulator::generateUniquePrefix): Ditto.
2516
2517         * editing/cocoa/DataDetection.mm:
2518         (WebCore::dataDetectorStringForPath): Use append instead of appendNumber.
2519         * html/HTMLAnchorElement.cpp:
2520         (WebCore::appendServerMapMousePosition): Ditto.
2521
2522         * html/HTMLCanvasElement.cpp:
2523         (WebCore::HTMLCanvasElement::createContext2d): Use makeString
2524         instead of StringBuilder.
2525         (WebCore::HTMLCanvasElement::createImageBuffer const): Ditto.
2526
2527         * loader/ResourceLoadStatistics.cpp:
2528         (WebCore::ResourceLoadStatistics::toString const): Use append instead
2529         of appendNumber.
2530
2531         * loader/SubresourceIntegrity.cpp:
2532         (WebCore::integrityMismatchDescription): Use makeString instead of
2533         StringBuilder.
2534
2535         * page/IntersectionObserver.cpp:
2536         (WebCore::IntersectionObserver::rootMargin const): Use append instead
2537         of appendNumber.
2538
2539         * page/SecurityOriginData.cpp:
2540         (WebCore::SecurityOriginData::databaseIdentifier const): Use makeString
2541         instead of StringBuilder.
2542
2543         * platform/Decimal.cpp:
2544         (WebCore::Decimal::toString const): Use append instead of appendNumber.
2545
2546         * platform/graphics/GraphicsLayer.cpp:
2547         (WebCore::GraphicsLayer::animationNameForTransition): Use makeString
2548         instead of StringBuilder.
2549         * platform/graphics/ca/TileController.cpp:
2550         (WebCore::TileController::createTileLayer): Ditto.
2551
2552         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
2553         (printTransform): Use single append instead of a run of them.
2554         (printLayer): Ditto, and use append instead of apppendNumber.
2555         (PlatformCALayerWin::layerTreeAsString const): Ditto.
2556
2557         * platform/mediarecorder/MediaRecorderPrivateMock.cpp:
2558         (WebCore::MediaRecorderPrivateMock::generateMockCounterString):
2559         Use append instead of appendNumber.
2560         * platform/network/ProxyServer.cpp:
2561         (WebCore::appendProxyServerString): Ditto.
2562         * rendering/RenderTreeAsText.cpp:
2563         (WebCore::nodePosition): Ditto.
2564         * svg/SVGPathUtilities.cpp:
2565         (WebCore::buildStringFromPath): Ditto.
2566
2567         * testing/Internals.cpp:
2568         (WebCore::Internals::parserMetaData): Use makeString instead of
2569         StringBuilder.
2570         (WebCore::appendOffsets): Use append instead of appendNumber.
2571
2572         * testing/MockPageOverlayClient.cpp:
2573         (WebCore::MockPageOverlayClient::drawRect): Use makeString instead
2574         of StringBuilder.
2575         (WebCore::MockPageOverlayClient::mouseEvent): Ditto.
2576
2577         * xml/XMLErrors.cpp:
2578         (WebCore::XMLErrors::appendErrorMessage): Use append instead of
2579         appendNumber.
2580
2581 2021-05-13  Zalan Bujtas  <zalan@apple.com>
2582
2583         [css-flexbox] Flex item construction may affect sibling flex item height computation
2584         https://bugs.webkit.org/show_bug.cgi?id=225489
2585
2586         Reviewed by Sergio Villar Senin.
2587
2588         Flex item construction triggers layout both on the flex item and on its descendants (see constructFlexItem).
2589         During this layout a percent height descendant may indirectly set an incorrect value on the flex container's 
2590         m_hasDefiniteHeight (this is due to the odd way we choose to resolve percent height values on the ancestor chain, 
2591         see setOverridingContainingBlockContentLogicalHeight(WTF::nullopt)).
2592         Now this incorrect m_hasDefiniteHeight value (Indefinite) causes the next sibling's (also) percent height
2593         resolve fail as it tells the flex item that the flex container can't help with resolving the percent height value.
2594         As the result we end up with an incorrect, 0px height value for this sibling.
2595         e.g.
2596         <div style="height: 100px; display: flex; flex-direction: column;">
2597           <div id=flexItemA style="height: 50px;"><div style="height: 100%;"></div></div>
2598           <div id=flexItemB style="height: 50%;"></div>
2599         </div>
2600         By the time we get to the construction of flexItemB, the RenderFlexibleBox's (flex container) m_hasDefiniteHeight
2601         is already (and incorrectly) set to Indefinite as the result of us trying to resolve flexItemA's descendant height percentage.
2602         This Indefinite value makes the flexItemB's height resolution fail as we believe that the flex container has indefinite height
2603         e.g "height: auto", while it is clearly resolvable (50% of 100px).
2604         Now if we flip the order and flexItemB comes first, the test case passes fine.
2605         It is very unfortunate that some descendant height resolving process can trigger a state change on the ancestor RenderFlexibleBox, but
2606         fixing it would certainly require some substantial architectural change.
2607         In this patch, we just reset the m_hasDefiniteHeight flag inside the loop to ensure that each flex item
2608         starts with a fresh height percent resolve state. 
2609
2610         Test: fast/flexbox/flex-column-with-percent-height-descendants.html
2611
2612         * rendering/RenderFlexibleBox.cpp:
2613         (WebCore::RenderFlexibleBox::layoutFlexItems):
2614
2615 2021-05-13  Chris Fleizach  <cfleizach@apple.com>
2616
2617         AX: Crash at WebCore::Document::updateLayout
2618         https://bugs.webkit.org/show_bug.cgi?id=225677
2619
2620         Reviewed by Alan Bujtas.
2621
2622         Handling notifications while during layout is risky because we can call back into an update method.
2623         We have handled many other cases like this by deferring the notification, as we do here.
2624         Special note: this test can't be made to crash because actual crash requires the accessibility
2625         runtime to be initialized and posting real notifications to the system. But, we can verify that the
2626         notification is still sent correctly under conditions that could lead to a crash.
2627
2628         Test: accessibility/mac/menu-selection-notification-crash.html
2629
2630         * accessibility/AXObjectCache.cpp:
2631         (WebCore::AXObjectCache::deferMenuListValueChange):
2632         (WebCore::AXObjectCache::performDeferredCacheUpdate):
2633         * accessibility/AXObjectCache.h:
2634         * accessibility/AccessibilityMenuList.cpp:
2635         (WebCore::AccessibilityMenuList::didUpdateActiveOption):
2636
2637 2021-05-13  Enrique Ocaña González  <eocanha@igalia.com>
2638
2639         [GStreamer] media/track/in-band/track-in-band-srt-mkv-kind.html is a flaky crash
2640         https://bugs.webkit.org/show_bug.cgi?id=225697
2641
2642         This is a tentative fix for the flaky crash (I can't reproduce it locally after 10000
2643         repetitions). It makes sure that mediaPlayerPrivate and any parameter passed to
2644         handleTextSample() can either survive or detected to be invalid when the lambda is ran in
2645         the main thread.
2646
2647         Reviewed by Alicia Boya Garcia.
2648
2649         Covered by existing tests.
2650
2651         * platform/graphics/gstreamer/TextSinkGStreamer.cpp:
2652         (webkitTextSinkHandleSample): Protect mediaPlayerPrivate and streadId and check if the mediaPlayerPrivate WeakRef is still alive.
2653
2654 2021-05-12  Frederic Wang  <fwang@igalia.com>
2655
2656         RELEASE_ASSERT(m_selection->isNone()) fails in Document::removedLastRef
2657         https://bugs.webkit.org/show_bug.cgi?id=225434
2658
2659         Reviewed by Ryosuke Niwa.
2660
2661         Document::removedLastRef asserts that the document's selection is not set. However, setting
2662         that selection is possible in FrameSelection::setSelectionWithoutUpdatingAppearance when the
2663         document has not been destroyed yet but is already detached from its frame. This patch
2664         instead clears the selection in that case.
2665
2666         No new tests.
2667
2668         * editing/FrameSelection.cpp:
2669         (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance): Clears the selection when
2670         newSelection is in a detached document. Given the other conditions, this is actually
2671         checking equivalent to !m_document->frame().
2672
2673 2021-05-12  Peng Liu  <peng.liu6@apple.com>
2674
2675         [iPad] SourceBufferPrivateAVFObjC should not report an error to the web page when the video playback is interrupted
2676         https://bugs.webkit.org/show_bug.cgi?id=225620
2677
2678         Reviewed by Jer Noble.
2679
2680         If `SourceBufferPrivateAVFObjC` reports an error to a web page when
2681         `AVSampleBufferDisplayLayer` reports `AVErrorOperationInterrupted` (the playback
2682         was interrupted), the web page will likely destroy the video player (and teardown
2683         the video element). That behavior will lead to an empty picture-in-picture window
2684         if the video was playing in picture-in-picture.
2685
2686         With this patch, `SourceBufferPrivateAVFObjC` will not report an error to the
2687         web page in case of playback interruption. Instead, it takes a note that
2688         the playback was interrupted, so that when we try to resume the playback later,
2689         it will flush the `AVSampleBufferDisplayLayer` to recover the playback state.
2690
2691         In addition, we need to enqueue an IDR frame first before we enqueue more
2692         samples after flushing the `AVSampleBufferDisplayLayer`. That is guaranteed
2693         by `SourceBufferPrivate::reenqueSamples()`.
2694
2695         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2696         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal):
2697         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
2698         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
2699         (WebCore::MediaSourcePrivateAVFObjC::flushActiveSourceBuffersIfNeeded):
2700         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2701         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2702         (WebCore::SourceBufferPrivateAVFObjC::flushIfNeeded):
2703         (WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError):
2704         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples):
2705
2706 2021-05-12  Chris Dumez  <cdumez@apple.com>
2707
2708         Notification.requestPermission() should return a Promise
2709         https://bugs.webkit.org/show_bug.cgi?id=225712
2710
2711         Reviewed by Darin Adler.
2712
2713         Notification.requestPermission() should return a Promise as per the specification:
2714         - https://notifications.spec.whatwg.org/#notification
2715
2716         Both Firefox and Chrome already support this.
2717
2718         Test: http/tests/notifications/request-with-promise.html
2719
2720         * Modules/notifications/Notification.cpp:
2721         (WebCore::Notification::requestPermission):
2722         * Modules/notifications/Notification.h:
2723         * Modules/notifications/Notification.idl:
2724         * Modules/notifications/NotificationClient.h:
2725
2726 2021-05-12  Fujii Hironori  <Hironori.Fujii@sony.com>
2727
2728         Some webgl/2.0.0/conformance/textures/image_bitmap_from_image_data tests are failing after r277369 if !USE(ACCELERATE)
2729         https://bugs.webkit.org/show_bug.cgi?id=225725
2730
2731         Reviewed by Sam Weinig.
2732
2733         * platform/graphics/PixelBufferConversion.cpp:
2734         (WebCore::convertImagePixels): Fixed the wrong condition of destination.alphaFormat.
2735
2736 2021-05-12  Chris Dumez  <cdumez@apple.com>
2737
2738         ASSERTION FAILED: actualVTablePointer == expectedVTablePointer in toJSNewlyCreated(JSC::JSGlobalObject *, WebCore::JSDOMGlobalObject *, Ref<WebCore::AudioNode> &&)
2739         https://bugs.webkit.org/show_bug.cgi?id=225719
2740         <rdar://77828031>
2741
2742         Reviewed by Geoffrey Garen.
2743
2744         AudioNode has (a lot of) subclasses that are exposed to JS (for which we call toJS() for).
2745         As a result, AudioNode needs a custom toJS() implementation which returns the correct subclass
2746         wrapper, instead of a generic JSAudioNode.
2747
2748         Test: webaudio/event-relatedTarget-audionode.html
2749
2750         * Modules/webaudio/AudioNode.idl:
2751         * Sources.txt:
2752         * WebCore.xcodeproj/project.pbxproj:
2753         * bindings/js/JSAudioNodeCustom.cpp: Added.
2754         (WebCore::toJSNewlyCreated):
2755         (WebCore::toJS):
2756
2757 2021-05-12  Ziran Sun  <zsun@igalia.com>
2758
2759         Wrong position for orthogonal positioned element with writing-mode: vertical-rl
2760         https://bugs.webkit.org/show_bug.cgi?id=180633
2761
2762         Reviewed by Javier Fernandez.
2763
2764         When calculating offset position for orthogonal positioned element with writing mode vertical-rl,
2765         we also need to take into account of borders and paddings. This change corrects computations
2766         for both topOffset and leftOffset.
2767
2768         * rendering/RenderBox.cpp:
2769         (WebCore::RenderBox::computePositionedLogicalWidthUsing const):
2770         (WebCore::RenderBox::computePositionedLogicalHeightUsing const):
2771
2772 2021-05-12  Jer Noble  <jer.noble@apple.com>
2773
2774         TapStorage::lock freed while locked in AudioSourceProviderAVFObjC::destroyMixIfNeeded()
2775         https://bugs.webkit.org/show_bug.cgi?id=225706
2776         <rdar://77719381>
2777
2778         Reviewed by Ryosuke Niwa.
2779
2780         In r275933, an update was made to protect access to TapStorage during destruction by
2781         locking its lock inside destroyMixIfNeeded(), but if TapStorage has a refCount==1
2782         during that teardown, the lock itself is destroyed while it is still held. Add an
2783         explicit scoping to the lock holder, and only deref the TapStorage outside that
2784         locking scope.
2785
2786         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
2787         (WebCore::AudioSourceProviderAVFObjC::destroyMixIfNeeded):
2788
2789 2021-05-12  Said Abou-Hallawa  <said@apple.com>
2790
2791         Removing the transform CSS property from the SVG element does not cause invalidation
2792         https://bugs.webkit.org/show_bug.cgi?id=225366
2793
2794         Reviewed by Simon Fraser.
2795
2796         If the new or the old RenderStyle includes a transform, the renderer of
2797         the SVG element needs to be repainted.
2798
2799         Test: svg/css/svg-css-transform-dynamic-remove.html
2800
2801         * rendering/svg/RenderSVGModelObject.cpp:
2802         (WebCore::RenderSVGModelObject::styleDidChange):
2803
2804 2021-05-12  Sam Weinig  <weinig@apple.com>
2805
2806         Remove inline annoatations for static functions in PixelBufferConversion
2807         https://bugs.webkit.org/show_bug.cgi?id=225708
2808
2809         Reviewed by Darin Adler.
2810
2811         Remove inline annoatations for static functions in PixelBufferConversion
2812         as suggested by Darin. The theory here is that outside of a header, the
2813         use of 'inline' serves no purpose as the compiler is perfectly allowed 
2814         and capable of inlining these functions.
2815
2816         * platform/graphics/PixelBufferConversion.cpp:
2817         (WebCore::makeVImageBuffer):
2818         (WebCore::convertImagePixelsAccelerated):
2819         (WebCore::convertSinglePixelPremultipliedToPremultiplied):
2820         (WebCore::convertSinglePixelPremultipliedToUnpremultiplied):
2821         (WebCore::convertSinglePixelUnpremultipliedToPremultiplied):
2822         (WebCore::convertSinglePixelUnpremultipliedToUnpremultiplied):
2823         (WebCore::convertFunctor):
2824
2825 2021-05-12  Alex Christensen  <achristensen@webkit.org>
2826
2827         Use HashSet<RefPtr<Node>> instead of HashSet<Node*>
2828         https://bugs.webkit.org/show_bug.cgi?id=220464
2829
2830         Reviewed by Chris Dumez and Ryosuke Niwa.
2831
2832         This makes us more resistent to lifetime bugs.
2833
2834         liveNodeSet() and ignoreSet() need to be WeakHashSet, and they are only used in debug builds so that's fine.
2835
2836         MutationObserver::observedNodes() is not called on the main thread, but it's called during garbage collection.
2837         I replaced it with MutationObserver::isReachableFromOpaqueRoots which eliminates the HashSet allocation and hashing,
2838         and it can return true early if it finds a contained opaque root, resulting in less work in several ways.
2839         This should only increase our performance slightly while getting the same behavior.
2840
2841         * accessibility/AXObjectCache.cpp:
2842         (WebCore::conditionallyAddNodeToFilterList):
2843         (WebCore::filterVectorPairForRemoval):
2844         (WebCore::filterMapForRemoval):
2845         (WebCore::filterListForRemoval):
2846         (WebCore::AXObjectCache::prepareForDocumentDestruction):
2847         * bindings/js/JSMutationObserverCustom.cpp:
2848         (WebCore::JSMutationObserverOwner::isReachableFromOpaqueRoots):
2849         * dom/MutationObserver.cpp:
2850         (WebCore::MutationObserver::isReachableFromOpaqueRoots const):
2851         (WebCore:: const): Deleted.
2852         * dom/MutationObserver.h:
2853         * dom/MutationObserverRegistration.cpp:
2854         (WebCore::MutationObserverRegistration::isReachableFromOpaqueRoots const):
2855         (WebCore::MutationObserverRegistration::addRegistrationNodesToSet const): Deleted.
2856         * dom/MutationObserverRegistration.h:
2857         * dom/Node.cpp:
2858         (WebCore::liveNodeSet):
2859         (WebCore::stringForRareDataUseType):
2860         (WebCore::Node::dumpStatistics):
2861         (WebCore::ignoreSet):
2862         (WebCore::Node::trackForDebugging):
2863         (WebCore::Node::~Node):
2864         * editing/AppendNodeCommand.cpp:
2865         (WebCore::AppendNodeCommand::getNodesInCommand):
2866         * editing/AppendNodeCommand.h:
2867         * editing/CompositeEditCommand.cpp:
2868         (WebCore::EditCommandComposition::getNodesInCommand):
2869         * editing/CompositeEditCommand.h:
2870         * editing/DeleteFromTextNodeCommand.cpp:
2871         (WebCore::DeleteFromTextNodeCommand::getNodesInCommand):
2872         * editing/DeleteFromTextNodeCommand.h:
2873         * editing/EditCommand.cpp:
2874         (WebCore::SimpleEditCommand::addNodeAndDescendants):
2875         * editing/EditCommand.h:
2876         * editing/InsertIntoTextNodeCommand.cpp:
2877         (WebCore::InsertIntoTextNodeCommand::getNodesInCommand):
2878         * editing/InsertIntoTextNodeCommand.h:
2879         * editing/InsertNodeBeforeCommand.cpp:
2880         (WebCore::InsertNodeBeforeCommand::getNodesInCommand):
2881         * editing/InsertNodeBeforeCommand.h:
2882         * editing/MergeIdenticalElementsCommand.cpp:
2883         (WebCore::MergeIdenticalElementsCommand::getNodesInCommand):
2884         * editing/MergeIdenticalElementsCommand.h:
2885         * editing/RemoveNodeCommand.cpp:
2886         (WebCore::RemoveNodeCommand::getNodesInCommand):
2887         * editing/RemoveNodeCommand.h:
2888         * editing/ReplaceNodeWithSpanCommand.cpp:
2889         (WebCore::ReplaceNodeWithSpanCommand::getNodesInCommand):
2890         * editing/ReplaceNodeWithSpanCommand.h:
2891         * editing/SetNodeAttributeCommand.cpp:
2892         (WebCore::SetNodeAttributeCommand::getNodesInCommand):
2893         * editing/SetNodeAttributeCommand.h:
2894         * editing/SetSelectionCommand.h:
2895         * editing/SpellingCorrectionCommand.cpp:
2896         * editing/SplitElementCommand.cpp:
2897         (WebCore::SplitElementCommand::getNodesInCommand):
2898         * editing/SplitElementCommand.h:
2899         * editing/SplitTextNodeCommand.cpp:
2900         (WebCore::SplitTextNodeCommand::getNodesInCommand):
2901         * editing/SplitTextNodeCommand.h:
2902         * editing/WrapContentsInDummySpanCommand.cpp:
2903         (WebCore::WrapContentsInDummySpanCommand::getNodesInCommand):
2904         * editing/WrapContentsInDummySpanCommand.h:
2905         * editing/cocoa/HTMLConverter.mm:
2906         (HTMLConverterCaches::cacheAncestorsOfStartToBeConverted):
2907         * inspector/agents/InspectorDOMAgent.cpp:
2908         (WebCore::InspectorDOMAgent::highlightSelector):
2909         * xml/XPathFunctions.cpp:
2910         (WebCore::XPath::FunId::evaluate const):
2911         * xml/XPathNodeSet.cpp:
2912         (WebCore::XPath::sortBlock):
2913         (WebCore::XPath::NodeSet::traversalSort const):
2914         * xml/XPathPath.cpp:
2915         (WebCore::XPath::LocationPath::evaluate const):
2916         * xml/XPathPredicate.cpp:
2917         (WebCore::XPath::Union::evaluate const):
2918
2919 2021-05-12  Jer Noble  <jer.noble@apple.com>
2920
2921         HTMLMediaElement::mediaLoadingFailedFatally() does direct dispatch of events; should enqueue
2922         https://bugs.webkit.org/show_bug.cgi?id=225700
2923         <rdar://75576322>
2924
2925         Reviewed by Eric Carlson.
2926
2927         In r274559, an update was made to mediaLoadingFailedFatally to adopt recent spec changes, and as
2928         part of that change, an "error" event was changed from being enqueued to being directly dispatched.
2929         However, directly dispatching events exposes the element to JS and has the potential to cause the
2930         element to be garbage collected, deleting the object and potentially other objects in the backtrace.
2931         Events should always be enqueued, rather than directy dispatched, for this reason.
2932
2933         * html/HTMLMediaElement.cpp:
2934         (WebCore::HTMLMediaElement::mediaLoadingFailedFatally):
2935
2936 2021-05-12  Sergio Villar Senin  <svillar@igalia.com>
2937
2938         ASSERTION FAILED: m_clients.contains(&client) in CSSFontFace::removeClient via CSSSegmentedFontFace::~CSSSegmentedFontFace()
2939         https://bugs.webkit.org/show_bug.cgi?id=223790
2940
2941         Reviewed by Ryosuke Niwa.
2942
2943         CSSFontFace does not support adding the same client twice as it uses a HashSet to track them. This means that
2944         it's a mistake to call removeClient() more than once. This could happen when specifying the same font
2945         family more than once in a <font-face> element inside a svg container.
2946
2947         Test: fast/css/svg-font-face-duplicate-crash.html
2948
2949         * css/CSSFontFaceSet.cpp:
2950         (WebCore::CSSFontFaceSet::fontFace): Skip duplicate CSSFontFace's when before calling appendFontFace().
2951
2952 2021-05-12  Chris Dumez  <cdumez@apple.com>
2953
2954         Queue notification permission requests for the same origin on WebKit side
2955         https://bugs.webkit.org/show_bug.cgi?id=225701
2956         <rdar://76804977>
2957
2958         Reviewed by Geoffrey Garen.
2959
2960         Remove some dead code.
2961
2962         * Modules/notifications/NotificationClient.h:
2963
2964 2021-05-12  Ryosuke Niwa  <rniwa@webkit.org>
2965
2966         REGRESSION: Release assert in SlotAssignment::assignedNodesForSlot via ComposedTreeIterator::traverseNextInShadowTree
2967         in Element::insertedIntoAncestor
2968         https://bugs.webkit.org/show_bug.cgi?id=225684
2969
2970         Reviewed by Darin Adler.
2971
2972         The release assertion failure was caused by RenderTreeUpdater::tearDownRenderers end up traversing the parts of the DOM
2973         for which Element::insertedIntoAncestor had not been called yet. Since HTMLSlotElement::insertedIntoAncestor is where
2974         SlotAssignment::Slot is updated for a newly inserted slot, SlotAssignment::Slot may not contain this slot element.
2975
2976         Fixed the bug by returning early in SlotAssignment::assignedNodesForSlot when this condition holds, which is when
2977         the shadow root is connected to a document but HTMLSlotElement isn't since its connected flag has not been updated yet.
2978
2979         Test: fast/shadow-dom/insert-host-child-with-slot-renderer-teardown-crash.html
2980
2981         * dom/SlotAssignment.cpp:
2982         (WebCore::SlotAssignment::assignedNodesForSlot):
2983
2984 2021-05-12  Peng Liu  <peng.liu6@apple.com>
2985
2986         Implement TextTrackPrivateRemote::inBandMetadataTrackDispatchType()
2987         https://bugs.webkit.org/show_bug.cgi?id=225674
2988
2989         Reviewed by Eric Carlson.
2990
2991         Remove an unused function in `InbandTextTrackPrivate`.
2992
2993         * platform/graphics/InbandTextTrackPrivate.h:
2994         (WebCore::InbandTextTrackPrivate::textTrackIndex const): Deleted.
2995
2996 2021-05-12  Sergio Villar Senin  <svillar@igalia.com>
2997
2998         [css-flexbox] Do not use margins when computing aspect ratio cross sizes
2999         https://bugs.webkit.org/show_bug.cgi?id=221210
3000
3001         Reviewed by Javier Fernandez.
3002
3003         In r270578 we implemented section 9.8.1 of the flexbox specs which allowed us to compute child's
3004         indefinite cross sizes as definite when the flexbox container had a definite cross size and a couple
3005         of other conditions. However we did not take into account that the child might have some margins in
3006         in the cross direction. Aspect ratio computations must use the content box and thus, we need to
3007         substract the margin extent before trying to compute a cross size based on an aspect ratio.
3008
3009         Note that when computeMainSizeFromAspectRatioUsing() is called the child might not have been ever
3010         laid out. This means that the margins wouldn't have been computed and thus marginXXX() would always
3011         return 0. That's why crossAxisMarginExtentForChild() was also modified so that it actually computes
3012         the margins in case the child needs to be laid out.
3013
3014         * rendering/RenderFlexibleBox.cpp:
3015         (WebCore::RenderFlexibleBox::crossAxisMarginExtentForChild const):
3016         (WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing const):
3017
3018 2021-05-12  Sam Weinig  <weinig@apple.com>
3019
3020         Factor copyImagePixels pixel conversion code into its own file
3021         https://bugs.webkit.org/show_bug.cgi?id=225673
3022
3023         Reviewed by Darin Adler.
3024
3025         Removes virtual ImageBufferBackend::copyImagePixels() function and
3026         moves functionality to new PixelBufferConversion.h/cpp.
3027
3028         Merge USE(ACCELERATE) code from ImageBufferCGBackend into the same
3029         file and do some light cleanup. 
3030         
3031         - Function renamed to covert convertImagePixels to convey that it is
3032           doing more than copying.
3033         - Add PixelBufferConversionView/ConstPixelBufferConversionView structs
3034           to hold parameters for the conversions, including a ColorSpace member
3035           that is not yet used but will be shortly.
3036         - Uses constexpr conditionals in unaccelerated cases to hoist branch
3037           checking for pixel format conversion requirements outside the main
3038           loop.
3039
3040         * Sources.txt:
3041         * WebCore.xcodeproj/project.pbxproj:
3042         Add new files.
3043
3044         * platform/graphics/PixelBufferConversion.cpp: Added.
3045         (WebCore::makeVImageBuffer):
3046         (WebCore::convertImagePixelsAccelerated):
3047         (WebCore::convertSinglePixelPremultipliedToPremultiplied):
3048         (WebCore::convertSinglePixelPremultipliedToUnpremultiplied):
3049         (WebCore::convertSinglePixelUnpremultipliedToPremultiplied):
3050         (WebCore::convertSinglePixelUnpremultipliedToUnpremultiplied):
3051         (WebCore::convertFunctor):
3052         (WebCore::convertImagePixels):
3053         * platform/graphics/PixelBufferConversion.h: Added.
3054         Move existing copyImagePixels implementations here.
3055
3056         * platform/graphics/ImageBufferBackend.cpp:
3057         (WebCore::ImageBufferBackend::toBGRAData const):
3058         (WebCore::ImageBufferBackend::getPixelBuffer const):
3059         (WebCore::ImageBufferBackend::putPixelBuffer):
3060         (WebCore::copyPremultipliedToPremultiplied): Deleted.
3061         (WebCore::copyPremultipliedToUnpremultiplied): Deleted.
3062         (WebCore::copyUnpremultipliedToPremultiplied): Deleted.
3063         (WebCore::copyUnpremultipliedToUnpremultiplied): Deleted.
3064         (WebCore::copyFunctor): Deleted.
3065         (WebCore::ImageBufferBackend::copyImagePixels const): Deleted.
3066         * platform/graphics/ImageBufferBackend.h:
3067         * platform/graphics/cg/ImageBufferCGBackend.cpp:
3068         (WebCore::makeVImageBuffer): Deleted.
3069         (WebCore::copyImagePixelsAccelerated): Deleted.
3070         (WebCore::ImageBufferCGBackend::copyImagePixels const): Deleted.
3071         * platform/graphics/cg/ImageBufferCGBackend.h:
3072         Remove existing copyImagePixels() implementation and call new
3073         convertImagePixels() instead.
3074         
3075         * platform/graphics/filters/FilterEffect.cpp:
3076         (WebCore::FilterEffect::copyUnmultipliedResult):
3077         (WebCore::FilterEffect::copyPremultipliedResult):
3078         (WebCore::FilterEffect::createUnmultipliedImageResult):
3079         (WebCore::FilterEffect::createPremultipliedImageResult):
3080         Fix pixel format for the PixelBuffers to match existing behaviors.
3081         These are not being used at the moment but will in the future
3082         and new assert in putPixelBuffer caught these being incorrect.
3083
3084 2021-05-12  Commit Queue  <commit-queue@webkit.org>
3085
3086         Unreviewed, reverting r277320 and r277329.
3087         https://bugs.webkit.org/show_bug.cgi?id=225698
3088
3089         Added broken test fast/css/visited-link-mix-blend-mode.html
3090
3091         Reverted changesets:
3092
3093         "Don't allow :visited link style in subtrees that use mix-
3094         blend-mode"
3095         https://bugs.webkit.org/show_bug.cgi?id=225446
3096         https://trac.webkit.org/changeset/277320
3097
3098         "Don't allow :visited link style in subtrees that use mix-
3099         blend-mode"
3100         https://bugs.webkit.org/show_bug.cgi?id=225446
3101         https://trac.webkit.org/changeset/277329
3102
3103 2021-05-12  Jean-Yves Avenard  <jya@apple.com>
3104
3105         Adopt CoreMedia SPI to identify audio-only playback for MSE clients
3106         https://bugs.webkit.org/show_bug.cgi?id=225647
3107         rdar://76138365
3108
3109         Reviewed by Youenn Fablet.
3110
3111         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3112           tells whether the AVSBAR is attached to an <audio> or <video> element.
3113
3114 2021-05-12  Youenn Fablet  <youenn@apple.com>
3115
3116         Introduce an internal unit to render audio MediaStreamTrack(s)
3117         https://bugs.webkit.org/show_bug.cgi?id=225601
3118
3119         Reviewed by Eric Carlson.
3120
3121         Move files from platform/mediastream/mac to platform/mediastream/cocoa since they are used in both iOS and macOS.
3122         Move Audio Unit functionality out of AudioMediaStreamTrackRendererUnit.
3123         AudioMediaStreamTrackRendererUnit is responsible to manage sources and do the mixing.
3124         To actually render audio, it will use an InternalUnit, which is currently done in process.
3125
3126         A future work will add support for a remote InternalUnit, that would run on GPUProcess.
3127         To prepare for that, a callback allows customizing the Internal Unit creation.
3128         We also change renderer start to be asynchronous, since it requires fetching the audio description from GPUProcess.
3129
3130         No change of behavior, covered by existing tests.
3131
3132         * SourcesCocoa.txt:
3133         * WebCore.xcodeproj/project.pbxproj:
3134         * platform/audio/cocoa/AudioSampleBufferList.h:
3135         * platform/mediastream/AudioMediaStreamTrackRenderer.h:
3136         * platform/mediastream/AudioTrackPrivateMediaStream.cpp:
3137         (WebCore::AudioTrackPrivateMediaStream::startRenderer):
3138         * platform/mediastream/cocoa/AudioMediaStreamTrackRendererCocoa.cpp: Renamed from Source/WebCore/platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.cpp.
3139         (WebCore::AudioMediaStreamTrackRendererCocoa::start):
3140         * platform/mediastream/cocoa/AudioMediaStreamTrackRendererCocoa.h: Copied from Source/WebCore/platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.h.
3141         * platform/mediastream/cocoa/AudioMediaStreamTrackRendererInternalUnit.cpp: Renamed from Source/WebCore/platform/mediastream/mac/AudioMediaStreamTrackRendererUnit.cpp.
3142         (WebCore::AudioMediaStreamTrackRendererInternalUnit::createLocalInternalUnit):
3143         (WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::LocalAudioMediaStreamTrackRendererInternalUnit):
3144         (WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::retrieveFormatDescription):
3145         (WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::setAudioOutputDevice):
3146         (WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::start):
3147         (WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::stop):
3148         (WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::createAudioUnitIfNeeded):
3149         (WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::renderingCallback):
3150         * platform/mediastream/cocoa/AudioMediaStreamTrackRendererInternalUnit.h: Renamed from Source/WebCore/platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.h.
3151         * platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.cpp: Added.
3152         (WebCore::getCreateInternalUnitFunction):
3153         (WebCore::AudioMediaStreamTrackRendererUnit::setCreateInternalUnitFunction):
3154         (WebCore::createInternalUnit):
3155         (WebCore::AudioMediaStreamTrackRendererUnit::singleton):
3156         (WebCore::AudioMediaStreamTrackRendererUnit::AudioMediaStreamTrackRendererUnit):
3157         (WebCore::AudioMediaStreamTrackRendererUnit::~AudioMediaStreamTrackRendererUnit):
3158         (WebCore::AudioMediaStreamTrackRendererUnit::setAudioOutputDevice):
3159         (WebCore::AudioMediaStreamTrackRendererUnit::addSource):
3160         (WebCore::AudioMediaStreamTrackRendererUnit::removeSource):
3161         (WebCore::AudioMediaStreamTrackRendererUnit::start):
3162         (WebCore::AudioMediaStreamTrackRendererUnit::stop):
3163         (WebCore::AudioMediaStreamTrackRendererUnit::retrieveFormatDescription):
3164         (WebCore::AudioMediaStreamTrackRendererUnit::render):
3165         * platform/mediastream/cocoa/AudioMediaStreamTrackRendererUnit.h: Renamed from Source/WebCore/platform/mediastream/mac/AudioMediaStreamTrackRendererUnit.h.
3166
3167 2021-05-12  Youenn Fablet  <youenn@apple.com>
3168
3169         Enumerate AVCaptureDevice list in a background thread
3170         https://bugs.webkit.org/show_bug.cgi?id=225643
3171         <rdar://problem/77820002>
3172
3173         Reviewed by Eric Carlson.
3174
3175         Enumerate AVCaptureDevice in a background queue asynchronously.
3176         Delay getUserMedia and enumerateDevices until this is completed.
3177
3178         Update RealtimeMediaSourceCenter accordingly and introduce RealtimeMediaSourceCenter::enumerateDevices for that purpose.
3179         Replace getCaptureDevices by computeCaptureDevices to do the async computation.
3180         Continue using captureDevices() getters.
3181
3182         Manually tested.
3183
3184         * platform/mediastream/CaptureDevice.h:
3185         (WebCore::CaptureDevice::CaptureDevice):
3186         (WebCore::CaptureDevice::isolatedCopy):
3187         * platform/mediastream/CaptureDeviceManager.h:
3188         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
3189         (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices):
3190         (WebCore::RealtimeMediaSourceCenter::enumerateDevices):
3191         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
3192         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraintsAfterEnumeration):
3193         * platform/mediastream/RealtimeMediaSourceCenter.h:
3194         * platform/mediastream/RealtimeMediaSourceFactory.h:
3195         (WebCore::AudioCaptureFactory::computeSpeakerDevices const):
3196         * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
3197         (WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice):
3198         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
3199         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
3200         (WebCore::AVAudioSessionCaptureDeviceManager::scheduleUpdateCaptureDevices):
3201         (WebCore::AVAudioSessionCaptureDeviceManager::computeCaptureDevices):
3202         * platform/mediastream/mac/AVCaptureDeviceManager.h:
3203         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
3204         (WebCore::AVCaptureDeviceManager::computeCaptureDevices):
3205         (WebCore::AVCaptureDeviceManager::captureDevices):
3206         (WebCore::AVCaptureDeviceManager::updateCachedAVCaptureDevices):
3207         (WebCore::AVCaptureDeviceManager::retrieveCaptureDevices):
3208         (WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
3209         (WebCore::AVCaptureDeviceManager::AVCaptureDeviceManager):
3210
3211 2021-05-11  Cameron McCormack  <heycam@apple.com>
3212
3213         Include reasons for compositing in showLayerTree output
3214         https://bugs.webkit.org/show_bug.cgi?id=225640
3215
3216         Reviewed by Simon Fraser.
3217
3218         Since it seems useful to know why a layer is composited.
3219
3220         The logging code was only including one reason, rather than the
3221         whole set of reasons, and that's unchanged (except for the function
3222         name to make that clearer), although we could also just make that
3223         include all of the reasons too.
3224
3225         There were two reason strings missing, which are also added --
3226         OverflowScrollPositioning and WillChange -- which the use of a
3227         switch should help catch in the future.
3228
3229         * rendering/RenderLayerCompositor.cpp:
3230         (WebCore::RenderLayerCompositor::logLayerInfo):
3231         (WebCore::compositingReasonToString):
3232         (WebCore::RenderLayerCompositor::logReasonsForCompositing):
3233         (WebCore::operator<<):
3234         * rendering/RenderLayerCompositor.h:
3235         * rendering/RenderTreeAsText.cpp:
3236
3237 2021-05-11  Chris Dumez  <cdumez@apple.com>
3238
3239         Port WTF::FileSystem::listDirectory to std::filesystem
3240         https://bugs.webkit.org/show_bug.cgi?id=225633
3241
3242         Reviewed by Darin Adler.
3243
3244         Update FileSystem::listDirectory() call sites to deal with the fact that:
3245         - The function now returns file names instead of full file paths
3246         - The callers now have to do filtering by themselves if they need it
3247
3248         * Modules/entriesapi/DOMFileSystem.cpp:
3249         (WebCore::listDirectoryWithMetadata):
3250         * Modules/indexeddb/server/IDBServer.cpp:
3251         (WebCore::IDBServer::IDBServer::getAllDatabaseNamesAndVersions):
3252         (WebCore::IDBServer::collectOriginsForVersion):
3253         (WebCore::IDBServer::removeAllDatabasesForFullOriginPath):
3254         (WebCore::IDBServer::removeAllDatabasesForOriginPath):
3255         (WebCore::IDBServer::IDBServer::removeDatabasesModifiedSinceForVersion):
3256         (WebCore::IDBServer::IDBServer::removeDatabasesWithOriginsForVersion):
3257         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
3258         (WebCore::IDBServer::SQLiteIDBBackingStore::fullDatabaseDirectoryWithUpgrade):
3259         (WebCore::IDBServer::SQLiteIDBBackingStore::databasesSizeForDirectory):
3260         * Modules/webdatabase/DatabaseTracker.cpp:
3261         (WebCore::DatabaseTracker::usage):
3262         (WebCore::DatabaseTracker::deleteOrigin):
3263         * html/DirectoryFileListCreator.cpp:
3264         (WebCore::appendDirectoryFiles):
3265         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3266         (WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback):
3267         (WebCore::MediaPlayerPrivateGStreamer::purgeOldDownloadFiles):
3268         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
3269         * platform/text/hyphen/HyphenationLibHyphen.cpp:
3270         (WebCore::extractLocaleFromDictionaryFileName):
3271         (WebCore::scanDirectoryForDictionaries):
3272
3273 2021-05-11  Chris Dumez  <cdumez@apple.com>
3274
3275         Add SPI to suspend / resume a WKWebView
3276         https://bugs.webkit.org/show_bug.cgi?id=225333
3277         <rdar://77462543>
3278
3279         Reviewed by Geoff Garen.
3280
3281         Add new function to BackForwardCache to suspend a page and return a CachedPage
3282         instead of requiring a HistoryItem and storing the CachedPage on that history
3283         item. This is useful when we want to suspend the page in-place and do not want
3284         to require a history item (or a navigation).
3285
3286         * Headers.cmake:
3287         * history/BackForwardCache.cpp:
3288         (WebCore::BackForwardCache::trySuspendPage):
3289         (WebCore::BackForwardCache::addIfCacheable):
3290         (WebCore::BackForwardCache::suspendPage):
3291         * history/BackForwardCache.h:
3292         * history/CachedPage.h:
3293
3294 2021-05-11  Darin Adler  <darin@apple.com>
3295
3296         Remove the String::toInt family of functions
3297         https://bugs.webkit.org/show_bug.cgi?id=225599
3298
3299         Reviewed by Anders Carlsson.
3300
3301         * platform/graphics/GLContext.cpp:
3302         (WebCore::GLContext::version): Use
3303         parseIntegerAllowingTrailingJunk<unsigned> instead of String::toUInt.
3304
3305         * platform/graphics/GlyphBuffer.h:
3306         (WebCore::GlyphBuffer::checkedStringOffsetAt const): Fix code that was
3307         assuming GlyphBufferStringOffset was signed to compile without a warning
3308         regardless of whether it's signed or unsigned. This was making GTK
3309         builds have tons and tons of warnings, which was distracting while
3310         working on the other fixes here.
3311
3312         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3313         (CachedResourceStreamingClient::responseReceived): Use
3314         parseIntegerAllowingTrailingJunk<uint64_t> instead of String::toUInt64.
3315
3316 2021-05-11  Commit Queue  <commit-queue@webkit.org>
3317
3318         Unreviewed, reverting r277341.
3319         https://bugs.webkit.org/show_bug.cgi?id=225685
3320
3321         Caused WK2 layout tests to exit with an exception
3322
3323         Reverted changeset:
3324
3325         "Add SPI to suspend / resume a WKWebView"
3326         https://bugs.webkit.org/show_bug.cgi?id=225333
3327         https://trac.webkit.org/changeset/277341
3328
3329 2021-05-11  Simon Fraser  <simon.fraser@apple.com>
3330
3331         Display-frequency animations in ScrollController should be externally driven
3332         https://bugs.webkit.org/show_bug.cgi?id=225663
3333
3334         Reviewed by Tim Horton.
3335
3336         Display-frequency animations (i.e. those driven by 1/60_s timers) should ultimately
3337         be driven by Page::updateRendering(), since their output should be synchronized with
3338         rendering updates.
3339
3340         As the first step, remove m_snapRubberbandTimer and m_scrollSnapTimer from
3341         ScrollController and have it expose functions that tell its client to start and stop
3342         the animation, and a per-frame callback. Give ScrollAnimator a 1/60_s timer
3343         to drive this, temporarily.
3344
3345         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
3346         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
3347         (WebCore::ScrollingTreeScrollingNodeDelegateMac::startAnimationCallback):
3348         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stopAnimationCallback):
3349         (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollControllerAnimationTimerFired):
3350         * platform/ScrollAnimator.cpp:
3351         (WebCore::ScrollAnimator::ScrollAnimator):
3352         (WebCore::ScrollAnimator::startAnimationCallback):
3353         (WebCore::ScrollAnimator::stopAnimationCallback):
3354         (WebCore::ScrollAnimator::scrollControllerAnimationTimerFired):
3355         * platform/ScrollAnimator.h:
3356         * platform/ScrollController.cpp:
3357         (WebCore::ScrollController::animationCallback):
3358         (WebCore::ScrollController::startOrStopAnimationCallbacks):
3359         (WebCore::ScrollController::setIsAnimatingRubberBand):
3360