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