1d6cedc040b0fb416df98ae63af30732060c8d52
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-12-04  Jer Noble  <jer.noble@apple.com>
2
3         Include 'video/*' in image request Accept header if browser supports video media in image contexts.
4         https://bugs.webkit.org/show_bug.cgi?id=179178
5
6         Reviewed by Alex Christensen.
7
8         Test: http/tests/images/image-supports-video.html
9
10         Ensure that 'video/*' is included in the Accept header by asking the ImageDecoder whether "Video"
11         media is supported. The ImageDecoder will ask all it's constituent decoders, which aside from
12         ImageDecoderAVFObjC will say only support the "Image" media type.
13
14         Drive-by fix: Make sure the MIMETypeRegistry includes all the types supported by AVFoundation when
15         ImageDecoderAVFObjC is enabled. Also, now that Image reports it can support video mime types, check
16         whether MediaDocument can support a given mime type before asking ImageDocument.
17
18         * html/HTMLImageElement.cpp:
19         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
20         * loader/LinkLoader.cpp:
21         (WebCore::LinkLoader::isSupportedType):
22         * loader/cache/CachedResourceRequest.cpp:
23         (WebCore::acceptHeaderValueFromType):
24         * platform/MIMETypeRegistry.cpp:
25         (WebCore::MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType):
26         (WebCore::MIMETypeRegistry::isSupportedImageOrSVGMIMEType): Deleted.
27         * platform/MIMETypeRegistry.h:
28         * platform/graphics/ImageDecoder.cpp:
29         (WebCore::ImageDecoder::supportsMediaType):
30         * platform/graphics/ImageDecoder.h:
31         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
32         (WebCore::ImageDecoderAVFObjC::supportsMediaType):
33         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
34         (WebCore::ImageDecoderAVFObjC::supportsContentType):
35         * platform/graphics/cg/ImageDecoderCG.h:
36         * platform/graphics/win/ImageDecoderDirect2D.h:
37         * platform/image-decoders/ScalableImageDecoder.h:
38         (WebCore::ScalableImageDecoder::supportsMediaType):
39         * html/parser/HTMLPreloadScanner.cpp:
40         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
41
42 2017-12-03  Yusuke Suzuki  <utatane.tea@gmail.com>
43
44         WTF shouldn't have both Thread and ThreadIdentifier
45         https://bugs.webkit.org/show_bug.cgi?id=180308
46
47         Reviewed by Darin Adler.
48
49         No behavior change.
50
51         * Modules/indexeddb/IDBActiveDOMObject.h:
52         (WebCore::IDBActiveDOMObject::originThread const):
53         (WebCore::IDBActiveDOMObject::performCallbackOnOriginThread):
54         (WebCore::IDBActiveDOMObject::callFunctionOnOriginThread):
55         (WebCore::IDBActiveDOMObject::originThreadID const): Deleted.
56         * Modules/indexeddb/IDBCursor.cpp:
57         (WebCore::IDBCursor::IDBCursor):
58         (WebCore::IDBCursor::~IDBCursor):
59         (WebCore::IDBCursor::sourcesDeleted const):
60         (WebCore::IDBCursor::transaction const):
61         (WebCore::IDBCursor::update):
62         (WebCore::IDBCursor::advance):
63         (WebCore::IDBCursor::continueFunction):
64         (WebCore::IDBCursor::uncheckedIterateCursor):
65         (WebCore::IDBCursor::deleteFunction):
66         (WebCore::IDBCursor::setGetResult):
67         * Modules/indexeddb/IDBDatabase.cpp:
68         (WebCore::IDBDatabase::~IDBDatabase):
69         (WebCore::IDBDatabase::hasPendingActivity const):
70         (WebCore::IDBDatabase::name const):
71         (WebCore::IDBDatabase::version const):
72         (WebCore::IDBDatabase::objectStoreNames const):
73         (WebCore::IDBDatabase::renameObjectStore):
74         (WebCore::IDBDatabase::renameIndex):
75         (WebCore::IDBDatabase::createObjectStore):
76         (WebCore::IDBDatabase::transaction):
77         (WebCore::IDBDatabase::deleteObjectStore):
78         (WebCore::IDBDatabase::close):
79         (WebCore::IDBDatabase::connectionToServerLost):
80         (WebCore::IDBDatabase::maybeCloseInServer):
81         (WebCore::IDBDatabase::activeDOMObjectName const):
82         (WebCore::IDBDatabase::canSuspendForDocumentSuspension const):
83         (WebCore::IDBDatabase::stop):
84         (WebCore::IDBDatabase::startVersionChangeTransaction):
85         (WebCore::IDBDatabase::didStartTransaction):
86         (WebCore::IDBDatabase::willCommitTransaction):
87         (WebCore::IDBDatabase::didCommitTransaction):
88         (WebCore::IDBDatabase::willAbortTransaction):
89         (WebCore::IDBDatabase::didAbortTransaction):
90         (WebCore::IDBDatabase::didCommitOrAbortTransaction):
91         (WebCore::IDBDatabase::fireVersionChangeEvent):
92         (WebCore::IDBDatabase::dispatchEvent):
93         (WebCore::IDBDatabase::didCreateIndexInfo):
94         (WebCore::IDBDatabase::didDeleteIndexInfo):
95         * Modules/indexeddb/IDBIndex.cpp:
96         (WebCore::IDBIndex::IDBIndex):
97         (WebCore::IDBIndex::~IDBIndex):
98         (WebCore::IDBIndex::name const):
99         (WebCore::IDBIndex::setName):
100         (WebCore::IDBIndex::objectStore):
101         (WebCore::IDBIndex::keyPath const):
102         (WebCore::IDBIndex::unique const):
103         (WebCore::IDBIndex::multiEntry const):
104         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):
105         (WebCore::IDBIndex::openCursor):
106         (WebCore::IDBIndex::openKeyCursor):
107         (WebCore::IDBIndex::doCount):
108         (WebCore::IDBIndex::doGet):
109         (WebCore::IDBIndex::doGetKey):
110         (WebCore::IDBIndex::getAll):
111         (WebCore::IDBIndex::getAllKeys):
112         (WebCore::IDBIndex::markAsDeleted):
113         * Modules/indexeddb/IDBObjectStore.cpp:
114         (WebCore::IDBObjectStore::IDBObjectStore):
115         (WebCore::IDBObjectStore::~IDBObjectStore):
116         (WebCore::IDBObjectStore::name const):
117         (WebCore::IDBObjectStore::setName):
118         (WebCore::IDBObjectStore::keyPath const):
119         (WebCore::IDBObjectStore::indexNames const):
120         (WebCore::IDBObjectStore::transaction):
121         (WebCore::IDBObjectStore::autoIncrement const):
122         (WebCore::IDBObjectStore::openCursor):
123         (WebCore::IDBObjectStore::openKeyCursor):
124         (WebCore::IDBObjectStore::get):
125         (WebCore::IDBObjectStore::getKey):
126         (WebCore::IDBObjectStore::putOrAdd):
127         (WebCore::IDBObjectStore::doDelete):
128         (WebCore::IDBObjectStore::clear):
129         (WebCore::IDBObjectStore::createIndex):
130         (WebCore::IDBObjectStore::index):
131         (WebCore::IDBObjectStore::deleteIndex):
132         (WebCore::IDBObjectStore::doCount):
133         (WebCore::IDBObjectStore::getAll):
134         (WebCore::IDBObjectStore::getAllKeys):
135         (WebCore::IDBObjectStore::markAsDeleted):
136         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
137         * Modules/indexeddb/IDBOpenDBRequest.cpp:
138         (WebCore::IDBOpenDBRequest::~IDBOpenDBRequest):
139         (WebCore::IDBOpenDBRequest::onError):
140         (WebCore::IDBOpenDBRequest::versionChangeTransactionDidFinish):
141         (WebCore::IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit):
142         (WebCore::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
143         (WebCore::IDBOpenDBRequest::dispatchEvent):
144         (WebCore::IDBOpenDBRequest::onSuccess):
145         (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
146         (WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
147         (WebCore::IDBOpenDBRequest::requestCompleted):
148         (WebCore::IDBOpenDBRequest::requestBlocked):
149         * Modules/indexeddb/IDBRequest.cpp:
150         (WebCore::IDBRequest::~IDBRequest):
151         (WebCore:: const):
152         (WebCore::IDBRequest::setSource):
153         (WebCore::IDBRequest::setVersionChangeTransaction):
154         (WebCore::IDBRequest::transaction const):
155         (WebCore::IDBRequest::sourceObjectStoreIdentifier const):
156         (WebCore::IDBRequest::sourceIndexIdentifier const):
157         (WebCore::IDBRequest::requestedObjectStoreRecordType const):
158         (WebCore::IDBRequest::requestedIndexRecordType const):
159         (WebCore::IDBRequest::eventTargetInterface const):
160         (WebCore::IDBRequest::activeDOMObjectName const):
161         (WebCore::IDBRequest::canSuspendForDocumentSuspension const):
162         (WebCore::IDBRequest::hasPendingActivity const):
163         (WebCore::IDBRequest::stop):
164         (WebCore::IDBRequest::enqueueEvent):
165         (WebCore::IDBRequest::dispatchEvent):
166         (WebCore::IDBRequest::uncaughtExceptionInEventHandler):
167         (WebCore::IDBRequest::setResult):
168         (WebCore::IDBRequest::setResultToStructuredClone):
169         (WebCore::IDBRequest::setResultToUndefined):
170         (WebCore::IDBRequest::resultCursor):
171         (WebCore::IDBRequest::willIterateCursor):
172         (WebCore::IDBRequest::didOpenOrIterateCursor):
173         (WebCore::IDBRequest::completeRequestAndDispatchEvent):
174         (WebCore::IDBRequest::onError):
175         (WebCore::IDBRequest::onSuccess):
176         * Modules/indexeddb/IDBTransaction.cpp:
177         (WebCore::IDBTransaction::IDBTransaction):
178         (WebCore::IDBTransaction::~IDBTransaction):
179         (WebCore::IDBTransaction::objectStoreNames const):
180         (WebCore::IDBTransaction::db):
181         (WebCore::IDBTransaction::error const):
182         (WebCore::IDBTransaction::objectStore):
183         (WebCore::IDBTransaction::abortDueToFailedRequest):
184         (WebCore::IDBTransaction::transitionedToFinishing):
185         (WebCore::IDBTransaction::abort):
186         (WebCore::IDBTransaction::internalAbort):
187         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
188         (WebCore::IDBTransaction::activeDOMObjectName const):
189         (WebCore::IDBTransaction::canSuspendForDocumentSuspension const):
190         (WebCore::IDBTransaction::hasPendingActivity const):
191         (WebCore::IDBTransaction::stop):
192         (WebCore::IDBTransaction::isActive const):
193         (WebCore::IDBTransaction::isFinishedOrFinishing const):
194         (WebCore::IDBTransaction::addRequest):
195         (WebCore::IDBTransaction::removeRequest):
196         (WebCore::IDBTransaction::scheduleOperation):
197         (WebCore::IDBTransaction::schedulePendingOperationTimer):
198         (WebCore::IDBTransaction::pendingOperationTimerFired):
199         (WebCore::IDBTransaction::operationCompletedOnServer):
200         (WebCore::IDBTransaction::scheduleCompletedOperationTimer):
201         (WebCore::IDBTransaction::completedOperationTimerFired):
202         (WebCore::IDBTransaction::commit):
203         (WebCore::IDBTransaction::commitOnServer):
204         (WebCore::IDBTransaction::finishAbortOrCommit):
205         (WebCore::IDBTransaction::didStart):
206         (WebCore::IDBTransaction::notifyDidAbort):
207         (WebCore::IDBTransaction::didAbort):
208         (WebCore::IDBTransaction::didCommit):
209         (WebCore::IDBTransaction::fireOnComplete):
210         (WebCore::IDBTransaction::fireOnAbort):
211         (WebCore::IDBTransaction::enqueueEvent):
212         (WebCore::IDBTransaction::dispatchEvent):
213         (WebCore::IDBTransaction::createObjectStore):
214         (WebCore::IDBTransaction::createObjectStoreOnServer):
215         (WebCore::IDBTransaction::didCreateObjectStoreOnServer):
216         (WebCore::IDBTransaction::renameObjectStore):
217         (WebCore::IDBTransaction::renameObjectStoreOnServer):
218         (WebCore::IDBTransaction::didRenameObjectStoreOnServer):
219         (WebCore::IDBTransaction::createIndex):
220         (WebCore::IDBTransaction::createIndexOnServer):
221         (WebCore::IDBTransaction::didCreateIndexOnServer):
222         (WebCore::IDBTransaction::renameIndex):
223         (WebCore::IDBTransaction::renameIndexOnServer):
224         (WebCore::IDBTransaction::didRenameIndexOnServer):
225         (WebCore::IDBTransaction::requestOpenCursor):
226         (WebCore::IDBTransaction::doRequestOpenCursor):
227         (WebCore::IDBTransaction::openCursorOnServer):
228         (WebCore::IDBTransaction::didOpenCursorOnServer):
229         (WebCore::IDBTransaction::iterateCursor):
230         (WebCore::IDBTransaction::iterateCursorOnServer):
231         (WebCore::IDBTransaction::didIterateCursorOnServer):
232         (WebCore::IDBTransaction::requestGetAllObjectStoreRecords):
233         (WebCore::IDBTransaction::requestGetAllIndexRecords):
234         (WebCore::IDBTransaction::getAllRecordsOnServer):
235         (WebCore::IDBTransaction::didGetAllRecordsOnServer):
236         (WebCore::IDBTransaction::requestGetRecord):
237         (WebCore::IDBTransaction::requestGetValue):
238         (WebCore::IDBTransaction::requestGetKey):
239         (WebCore::IDBTransaction::requestIndexRecord):
240         (WebCore::IDBTransaction::getRecordOnServer):
241         (WebCore::IDBTransaction::didGetRecordOnServer):
242         (WebCore::IDBTransaction::requestCount):
243         (WebCore::IDBTransaction::getCountOnServer):
244         (WebCore::IDBTransaction::didGetCountOnServer):
245         (WebCore::IDBTransaction::requestDeleteRecord):
246         (WebCore::IDBTransaction::deleteRecordOnServer):
247         (WebCore::IDBTransaction::didDeleteRecordOnServer):
248         (WebCore::IDBTransaction::requestClearObjectStore):
249         (WebCore::IDBTransaction::clearObjectStoreOnServer):
250         (WebCore::IDBTransaction::didClearObjectStoreOnServer):
251         (WebCore::IDBTransaction::requestPutOrAdd):
252         (WebCore::IDBTransaction::putOrAddOnServer):
253         (WebCore::IDBTransaction::didPutOrAddOnServer):
254         (WebCore::IDBTransaction::deleteObjectStore):
255         (WebCore::IDBTransaction::deleteObjectStoreOnServer):
256         (WebCore::IDBTransaction::didDeleteObjectStoreOnServer):
257         (WebCore::IDBTransaction::deleteIndex):
258         (WebCore::IDBTransaction::deleteIndexOnServer):
259         (WebCore::IDBTransaction::didDeleteIndexOnServer):
260         (WebCore::IDBTransaction::operationCompletedOnClient):
261         (WebCore::IDBTransaction::establishOnServer):
262         (WebCore::IDBTransaction::activate):
263         (WebCore::IDBTransaction::deactivate):
264         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
265         (WebCore::IDBClient::removeItemsMatchingCurrentThread):
266         * Modules/indexeddb/client/TransactionOperation.h:
267         (WebCore::IDBClient::TransactionOperation::~TransactionOperation):
268         (WebCore::IDBClient::TransactionOperation::perform):
269         (WebCore::IDBClient::TransactionOperation::transitionToCompleteOnThisThread):
270         (WebCore::IDBClient::TransactionOperation::transitionToComplete):
271         (WebCore::IDBClient::TransactionOperation::doComplete):
272         (WebCore::IDBClient::TransactionOperation::originThread const):
273         (WebCore::IDBClient::TransactionOperation::originThreadID const): Deleted.
274         * Modules/webaudio/AudioContext.cpp:
275         (WebCore::AudioContext::AudioContext):
276         (WebCore::AudioContext::lock):
277         (WebCore::AudioContext::tryLock):
278         (WebCore::AudioContext::unlock):
279         (WebCore::AudioContext::isAudioThread const):
280         (WebCore::AudioContext::isGraphOwner const):
281         * Modules/webaudio/AudioContext.h:
282         (WebCore::AudioContext::setAudioThread):
283         (WebCore::AudioContext::audioThread const):
284         * Modules/webaudio/AudioDestinationNode.cpp:
285         (WebCore::AudioDestinationNode::render):
286         * Modules/webdatabase/Database.cpp:
287         (WebCore::Database::performClose):
288         (WebCore::Database::securityOrigin):
289         * Modules/webdatabase/DatabaseDetails.h:
290         (WebCore::DatabaseDetails::DatabaseDetails):
291         (WebCore::DatabaseDetails::operator=):
292         (WebCore::DatabaseDetails::thread const):
293         (WebCore::DatabaseDetails::threadID const): Deleted.
294         * Modules/webdatabase/DatabaseManager.cpp:
295         (WebCore::DatabaseManager::detailsForNameAndOrigin):
296         * Modules/webdatabase/DatabaseThread.cpp:
297         (WebCore::DatabaseThread::databaseThread):
298         (WebCore::DatabaseThread::recordDatabaseOpen):
299         (WebCore::DatabaseThread::recordDatabaseClosed):
300         * Modules/webdatabase/DatabaseThread.h:
301         (WebCore::DatabaseThread::getThread):
302         (WebCore::DatabaseThread::getThreadID): Deleted.
303         * Modules/webdatabase/SQLTransaction.cpp:
304         (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
305         * Modules/webdatabase/SQLTransactionBackend.cpp:
306         (WebCore::SQLTransactionBackend::doCleanup):
307         (WebCore::SQLTransactionBackend::notifyDatabaseThreadIsShuttingDown):
308         * bindings/js/JSCallbackData.h:
309         (WebCore::JSCallbackData::JSCallbackData):
310         (WebCore::JSCallbackData::~JSCallbackData):
311         * bindings/js/ScheduledAction.cpp:
312         (WebCore::ScheduledAction::execute):
313         * dom/ScriptExecutionContext.cpp:
314         (WebCore::ScriptExecutionContext::createdMessagePort):
315         (WebCore::ScriptExecutionContext::destroyedMessagePort):
316         * page/ResourceUsageOverlay.h:
317         * page/scrolling/ScrollingThread.cpp:
318         (WebCore::ScrollingThread::isCurrentThread):
319         * platform/Supplementable.h:
320         (WebCore::Supplementable::provideSupplement):
321         (WebCore::Supplementable::removeSupplement):
322         (WebCore::Supplementable::requireSupplement):
323         (WebCore::Supplementable::Supplementable): Deleted.
324         * platform/Timer.cpp:
325         (WebCore::TimerBase::TimerBase):
326         (WebCore::TimerBase::start):
327         (WebCore::TimerBase::stop):
328         (WebCore::TimerBase::setNextFireTime):
329         * platform/Timer.h:
330         (WebCore::TimerBase::isActive const):
331         * platform/graphics/cocoa/FontCacheCoreText.cpp:
332         (WebCore::shouldAutoActivateFontIfNeeded):
333         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
334         (WebCore::TextureMapperPlatformLayerProxy::activateOnCompositingThread):
335         (WebCore::TextureMapperPlatformLayerProxy::invalidate):
336         (WebCore::TextureMapperPlatformLayerProxy::getAvailableBuffer):
337         (WebCore::TextureMapperPlatformLayerProxy::appendToUnusedBuffers):
338         (WebCore::TextureMapperPlatformLayerProxy::swapBuffer):
339         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
340         (): Deleted.
341         * platform/ios/wak/WebCoreThread.mm:
342         (RunWebThread):
343         (StartWebThread):
344         * platform/sql/SQLiteDatabase.cpp:
345         (WebCore::SQLiteDatabase::open):
346         (WebCore::SQLiteDatabase::close):
347         * platform/sql/SQLiteDatabase.h:
348         (WebCore::SQLiteDatabase::sqlite3Handle const):
349         * workers/WorkerGlobalScope.cpp:
350         (WebCore::WorkerGlobalScope::~WorkerGlobalScope):
351         (WebCore::WorkerGlobalScope::isContextThread const):
352         * workers/WorkerMessagingProxy.cpp:
353         (WebCore::WorkerMessagingProxy::WorkerMessagingProxy):
354         (WebCore::WorkerMessagingProxy::~WorkerMessagingProxy):
355         * workers/WorkerRunLoop.cpp:
356         (WebCore::WorkerRunLoop::runInMode):
357         (WebCore::WorkerRunLoop::runCleanupTasks):
358         * workers/WorkerThread.h:
359         (WebCore::WorkerThread::thread const):
360         (WebCore::WorkerThread::threadID const): Deleted.
361         * workers/service/ServiceWorkerContainer.cpp:
362         (WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
363         (WebCore::ServiceWorkerContainer::scheduleJob):
364         (WebCore::ServiceWorkerContainer::jobFailedWithException):
365         (WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
366         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
367         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
368         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
369         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
370         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
371         (WebCore::ServiceWorkerContainer::jobDidFinish):
372         (WebCore::ServiceWorkerContainer::addRegistration):
373         (WebCore::ServiceWorkerContainer::removeRegistration):
374         (WebCore::ServiceWorkerContainer::scheduleTaskToFireControllerChangeEvent):
375         (WebCore::ServiceWorkerContainer::contextIdentifier):
376         * workers/service/ServiceWorkerContainer.h:
377         * workers/service/ServiceWorkerJob.cpp:
378         (WebCore::ServiceWorkerJob::~ServiceWorkerJob):
379         (WebCore::ServiceWorkerJob::failedWithException):
380         (WebCore::ServiceWorkerJob::resolvedWithRegistration):
381         (WebCore::ServiceWorkerJob::resolvedWithUnregistrationResult):
382         (WebCore::ServiceWorkerJob::startScriptFetch):
383         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
384         (WebCore::ServiceWorkerJob::didReceiveResponse):
385         (WebCore::ServiceWorkerJob::notifyFinished):
386         * workers/service/ServiceWorkerJob.h:
387         * xml/parser/XMLDocumentParserLibxml2.cpp:
388         (WebCore::matchFunc):
389         (WebCore::openFunc):
390         (WebCore::initializeXMLParser):
391         (WebCore::XMLParserContext::createStringParser):
392         (WebCore::XMLParserContext::createMemoryParser):
393
394 2017-12-03  Youenn Fablet  <youenn@apple.com>
395
396         WebSocketChannel should ensure its client is live when calling it in error case
397         https://bugs.webkit.org/show_bug.cgi?id=180285
398
399         Reviewed by Darin Adler.
400
401         No observable change of behavior.
402         This makes it consistent with other calls of didReceiveMessageError.
403
404         * Modules/websockets/WebSocketChannel.cpp:
405         (WebCore::WebSocketChannel::fail):
406
407 2017-12-03  Alexey Proskuryakov  <ap@apple.com>
408
409         WebArchiveResourceWebResourceHandler leaks when pasting
410         https://bugs.webkit.org/show_bug.cgi?id=180339
411
412         Reviewed by Joseph Pecoraro.
413
414         * editing/cocoa/WebContentReaderCocoa.mm:
415         (WebCore::attributesForAttributedStringConversion):
416
417 2017-12-03  Chris Dumez  <cdumez@apple.com>
418
419         Support serviceWorker.postMessage() inside service workers
420         https://bugs.webkit.org/show_bug.cgi?id=180328
421
422         Reviewed by Darin Adler.
423
424         Support serviceWorker.postMessage() inside service workers.
425
426         No new tests, unskipped and rebaselined existing test that is
427         now passing.
428
429         * workers/service/SWClientConnection.h:
430         * workers/service/ServiceWorker.cpp:
431         (WebCore::ServiceWorker::postMessage):
432         * workers/service/context/SWContextManager.cpp:
433         (WebCore::SWContextManager::postMessageToServiceWorker):
434         * workers/service/context/SWContextManager.h:
435         * workers/service/context/ServiceWorkerThread.cpp:
436         (WebCore::fireMessageEvent):
437         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
438         * workers/service/context/ServiceWorkerThread.h:
439
440 2017-12-03  Chris Dumez  <cdumez@apple.com>
441
442         Implement self.skipWaiting() inside service workers
443         https://bugs.webkit.org/show_bug.cgi?id=180329
444
445         Reviewed by Darin Adler.
446
447         Implement self.skipWaiting() inside service workers:
448         - https://w3c.github.io/ServiceWorker/#service-worker-global-scope-skipwaiting
449
450         Also fixes a bug where tryActivate() was calling activate() even though the
451         registration's active worker was "in use":
452         - https://w3c.github.io/ServiceWorker/#try-activate-algorithm
453
454         No new tests, rebaselined existing tests.
455
456         * workers/service/ServiceWorkerGlobalScope.cpp:
457         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
458         * workers/service/context/SWContextManager.h:
459         * workers/service/server/SWServerRegistration.cpp:
460         (WebCore::SWServerRegistration::tryActivate):
461         * workers/service/server/SWServerToContextConnection.cpp:
462         (WebCore::SWServerToContextConnection::skipWaiting):
463         * workers/service/server/SWServerToContextConnection.h:
464         * workers/service/server/SWServerWorker.cpp:
465         (WebCore::SWServerWorker::skipWaiting):
466         * workers/service/server/SWServerWorker.h:
467         (WebCore::SWServerWorker::isSkipWaitingFlagSet const):
468
469 2017-12-03  Carlos Garcia Campos  <cgarcia@igalia.com>
470
471         [GStreamer] GstPad leaked in WebKitTextCombiner
472         https://bugs.webkit.org/show_bug.cgi?id=180314
473
474         Reviewed by Michael Catanzaro.
475
476         gst_element_get_static_pad() returns a full reference that si never freed, because gst_ghost_pad_new doesn't
477         take the ownership of the given pad.
478
479         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
480         (webkit_text_combiner_init):
481
482 2017-12-03  Carlos Garcia Campos  <cgarcia@igalia.com>
483
484         [GStreamer] GstCaps leaked in MediaPlayerPrivateGStreamer::createGSTPlayBin
485         https://bugs.webkit.org/show_bug.cgi?id=180311
486
487         Reviewed by Michael Catanzaro.
488
489         gst_caps_new_empty_simple() is passed directly to g_object_set(). The returned caps should be freed with
490         gst_caps_unref().
491
492         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
493         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
494
495 2017-12-02  Youenn Fablet  <youenn@apple.com>
496
497         Move registration activation and clearing from SWServerJobQueue to SWServerRegistration
498         https://bugs.webkit.org/show_bug.cgi?id=180325
499
500         Reviewed by Chris Dumez.
501
502         No change of behavior.
503
504         These algorithms fit naturally in SWServerRegistration and will be used as part of clients.claim.
505
506         * workers/service/server/SWServer.cpp:
507         (WebCore::SWServer::clearAll):
508         (WebCore::SWServer::didFinishActivation):
509         * workers/service/server/SWServerJobQueue.cpp:
510         (WebCore::SWServerJobQueue::scriptFetchFinished):
511         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
512         (WebCore::SWServerJobQueue::didFinishInstall):
513         (WebCore::SWServerJobQueue::runUnregisterJob):
514         (WebCore::SWServerJobQueue::tryActivate): Deleted.
515         (WebCore::SWServerJobQueue::activate): Deleted.
516         (WebCore::SWServerJobQueue::didFinishActivation): Deleted.
517         (WebCore::SWServerJobQueue::tryClearRegistration): Deleted.
518         (WebCore::clearRegistrationWorker): Deleted.
519         (WebCore::SWServerJobQueue::clearRegistration): Deleted.
520         * workers/service/server/SWServerJobQueue.h:
521         * workers/service/server/SWServerRegistration.cpp:
522         (WebCore::SWServerRegistration::tryClear):
523         (WebCore::clearRegistrationWorker):
524         (WebCore::SWServerRegistration::clear):
525         (WebCore::SWServerRegistration::tryActivate):
526         (WebCore::SWServerRegistration::activate):
527         (WebCore::SWServerRegistration::didFinishActivation):
528         * workers/service/server/SWServerRegistration.h:
529
530 2017-12-02  Chris Dumez  <cdumez@apple.com>
531
532         Support container.register() / registration.unregister() /  inside service workers
533         https://bugs.webkit.org/show_bug.cgi?id=180326
534
535         Reviewed by Youenn Fablet.
536
537         Support container.register() / registration.unregister() /  inside service workers.
538         This is mostly about removing the is<Document>() checks and adding testing given
539         that most of the work was done in r225455.
540
541         Test: http/tests/workers/service/ServiceWorkerGlobalScope_register.html
542
543         * workers/service/ServiceWorkerContainer.cpp:
544         (WebCore::ServiceWorkerContainer::addRegistration):
545         * workers/service/ServiceWorkerRegistration.cpp:
546         (WebCore::ServiceWorkerRegistration::update):
547         (WebCore::ServiceWorkerRegistration::unregister):
548
549 2017-12-02  Chris Dumez  <cdumez@apple.com>
550
551         Support serviceWorkerRegistration.update() inside service workers
552         https://bugs.webkit.org/show_bug.cgi?id=180215
553
554         Reviewed by Darin Adler.
555
556         Support serviceWorkerRegistration.update() inside service workers. The code paths
557         for job scheduling and resolution have been made thread safe by hopping to the right
558         thread when necessary. In particular, ServiceWorkerContainer always makes sure to to
559         a callOnMainThread() before calling methods on the SWClientConnection. Also, the
560         SWClientConnection relies on a new postTaskTo() method before calling methods on the
561         job.
562
563         Test: http/tests/workers/service/self_registration_update.html
564
565         * workers/service/SWClientConnection.cpp:
566         (WebCore::SWClientConnection::scheduleJob):
567         (WebCore::SWClientConnection::finishedFetchingScript):
568         (WebCore::SWClientConnection::failedFetchingScript):
569         (WebCore::SWClientConnection::jobRejectedInServer):
570         (WebCore::SWClientConnection::registrationJobResolvedInServer):
571         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
572         (WebCore::SWClientConnection::startScriptFetchForServer):
573         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
574         (WebCore::SWClientConnection::updateRegistrationState):
575         (WebCore::SWClientConnection::updateWorkerState):
576         (WebCore::SWClientConnection::fireUpdateFoundEvent):
577         (WebCore::SWClientConnection::notifyClientsOfControllerChange):
578         (WebCore::SWClientConnection::clearPendingJobs):
579         (WebCore::SWClientConnection::postTaskTo):
580         * workers/service/SWClientConnection.h:
581         * workers/service/ServiceWorkerContainer.cpp:
582         (WebCore::ServiceWorkerContainer::scheduleJob):
583         (WebCore::ServiceWorkerContainer::jobFailedWithException):
584         (WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
585         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
586         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
587         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
588         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
589         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
590         (WebCore::ServiceWorkerContainer::jobDidFinish):
591         (WebCore::ServiceWorkerContainer::addRegistration):
592         (WebCore::ServiceWorkerContainer::removeRegistration):
593         (WebCore::ServiceWorkerContainer::scheduleTaskToFireControllerChangeEvent):
594         (WebCore::ServiceWorkerContainer::contextIdentifier):
595         * workers/service/ServiceWorkerContainer.h:
596         * workers/service/ServiceWorkerJob.cpp:
597         (WebCore::ServiceWorkerJob::ServiceWorkerJob):
598         * workers/service/ServiceWorkerJob.h:
599         (WebCore::ServiceWorkerJob::contextIdentifier):
600         * workers/service/ServiceWorkerJobClient.h:
601         * workers/service/ServiceWorkerRegistration.cpp:
602         (WebCore::ServiceWorkerRegistration::update):
603         * workers/service/ServiceWorkerTypes.h:
604
605 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
606
607         Make IOSurface::Locker and use it in ImageBufferDataCG
608         https://bugs.webkit.org/show_bug.cgi?id=180317
609
610         Reviewed by Zalan Bujtas.
611
612         Add an RAII IOSurface::Locker which can lock readonly or readwrite. Access
613         to the IOSurface base address is through the locker.
614         
615         Add IOSurface::bytesPerRow() to wrap IOSurfaceGetBytesPerRow().
616         
617         After this, there is only one location where we access the IOSurfaceRef
618         directly, in WebGL code.
619
620         * platform/graphics/cg/ImageBufferDataCG.cpp:
621         (WebCore::ImageBufferData::toBGRAData const):
622         (WebCore::ImageBufferData::getData const):
623         (WebCore::ImageBufferData::putData):
624         * platform/graphics/cocoa/IOSurface.h:
625         * platform/graphics/cocoa/IOSurface.mm:
626         (WebCore::IOSurface::bytesPerRow const):
627
628 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
629
630         Add an AlphaPremultiplication enum and use it consistently
631         https://bugs.webkit.org/show_bug.cgi?id=180316
632
633         Reviewed by Zalan Bujtas.
634
635         ImageBuffer-related code sometimes used the 'Multiply' enum, and sometimes
636         a bool to represent alpha premultiplication. Make an enum class and use it
637         everywhere. Re-order and rename some parameters to clarify the meaning of this
638         argument.
639
640         * html/canvas/CanvasRenderingContext2D.cpp:
641         (WebCore::CanvasRenderingContext2D::putImageData):
642         * platform/graphics/GraphicsTypes.cpp:
643         (WebCore::operator<<):
644         * platform/graphics/GraphicsTypes.h:
645         * platform/graphics/ImageBuffer.cpp:
646         (WebCore::ImageBuffer::genericConvertToLuminanceMask):
647         * platform/graphics/ImageBuffer.h:
648         * platform/graphics/ShadowBlur.cpp:
649         (WebCore::ShadowBlur::blurShadowBuffer):
650         * platform/graphics/cairo/ImageBufferCairo.cpp:
651         (WebCore::getImageData):
652         (WebCore::ImageBuffer::getUnmultipliedImageData const):
653         (WebCore::ImageBuffer::getPremultipliedImageData const):
654         (WebCore::ImageBuffer::putByteArray):
655         * platform/graphics/cg/ImageBufferCG.cpp:
656         (WebCore::ImageBuffer::getUnmultipliedImageData const):
657         (WebCore::ImageBuffer::getPremultipliedImageData const):
658         (WebCore::ImageBuffer::putByteArray):
659         * platform/graphics/cg/ImageBufferDataCG.cpp:
660         (WebCore::ImageBufferData::getData const):
661         (WebCore::ImageBufferData::putData):
662         * platform/graphics/cg/ImageBufferDataCG.h:
663         * platform/graphics/filters/FEColorMatrix.cpp:
664         (WebCore::FEColorMatrix::platformApplySoftware):
665         * platform/graphics/filters/FEDropShadow.cpp:
666         (WebCore::FEDropShadow::platformApplySoftware):
667         * platform/graphics/filters/FilterEffect.cpp:
668         (WebCore::FilterEffect::imageBufferResult):
669         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
670         (WebCore::ImageBufferData::getData const):
671         (WebCore::ImageBufferData::putData):
672         * platform/graphics/win/ImageBufferDataDirect2D.h:
673         * platform/graphics/win/ImageBufferDirect2D.cpp:
674         (WebCore::ImageBuffer::getUnmultipliedImageData const):
675         (WebCore::ImageBuffer::getPremultipliedImageData const):
676         (WebCore::ImageBuffer::putByteArray):
677
678 2017-12-02  Youenn Fablet  <youenn@apple.com>
679
680         Implement https://w3c.github.io/ServiceWorker/#clients-getall
681         https://bugs.webkit.org/show_bug.cgi?id=180276
682
683         Reviewed by Chris Dumez.
684
685         Test: http/tests/workers/service/serviceworkerclients-matchAll.https.html
686
687         Move Clients QueryOptions to its own class since it is used by various parties.
688         Add encoder/decoder routines.
689
690         Add a ServieWorkerClientInformation which replaces SWServer::ClientInformation structure.
691         This is what is sent back as a result to matchAll requests.
692         Add encoder/decoder routines.
693
694         Implement matchAll by hopping to the main thread, making IPC to the storage process.
695         SWServer in storage process then iterates through the relevant service workers and does some filtering.
696         Additional filtering and information should be gathered in future patches to fully implement the algorithm.
697
698         Add to SWServer a HashMap to easily identify by which service worker a client is controlled, if any.
699         This map is updated at the same time registrations are updated.
700
701         matchAll is given a callback as in the future, window client information will be retrieved asynchronously.
702
703         * WebCore.xcodeproj/project.pbxproj:
704         * workers/service/ServiceWorkerClientInformation.h: Added.
705         (WebCore::ServiceWorkerClientInformation::isolatedCopy const):
706         (WebCore::ServiceWorkerClientInformation::encode const):
707         (WebCore::ServiceWorkerClientInformation::decode):
708         * workers/service/ServiceWorkerClientQueryOptions.h: Added.
709         (WebCore::ServiceWorkerClientQueryOptions::encode const):
710         (WebCore::ServiceWorkerClientQueryOptions::decode):
711         * workers/service/ServiceWorkerClients.cpp:
712         (WebCore::ServiceWorkerClients::matchAll):
713         * workers/service/ServiceWorkerClients.h:
714         * workers/service/context/SWContextManager.h:
715         * workers/service/server/SWServer.cpp:
716         (WebCore::SWServer::matchAll):
717         (WebCore::SWServer::registerServiceWorkerClient):
718         * workers/service/server/SWServer.h:
719         * workers/service/server/SWServerToContextConnection.cpp:
720         (WebCore::SWServerToContextConnection::matchAll):
721         * workers/service/server/SWServerToContextConnection.h:
722         * workers/service/server/SWServerWorker.cpp:
723         (WebCore::SWServerWorker::matchAll):
724         * workers/service/server/SWServerWorker.h:
725
726 2017-12-02  Brady Eidson  <beidson@apple.com>
727
728         Factor out the "databaseTaskQueue" parts of IDBServer into something reusable.
729         https://bugs.webkit.org/show_bug.cgi?id=180298
730
731         Reviewed by Chris Dumez.
732
733         No new tests (Refactor only).
734
735         * Modules/indexeddb/server/IDBServer.cpp:
736         (WebCore::IDBServer::IDBServer::IDBServer):
737         (WebCore::IDBServer::IDBServer::postDatabaseTask):
738         (WebCore::IDBServer::IDBServer::postDatabaseTaskReply):
739         (WebCore::IDBServer::IDBServer::databaseRunLoop): Deleted.
740         (WebCore::IDBServer::IDBServer::handleTaskRepliesOnMainThread): Deleted.
741         * Modules/indexeddb/server/IDBServer.h:
742         (): Deleted.
743
744 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
745
746         Add a log channel for viewports
747         https://bugs.webkit.org/show_bug.cgi?id=180295
748
749         Reviewed by Zalan Bujtas.
750
751         Add a "Viewports" log channel to log viewport scaling information, and enhance the
752         WebKit "VisibleRects" channel to log additional data for the same reason.
753
754         * dom/Document.cpp:
755         (WebCore::Document::processViewport):
756         * loader/FrameLoader.cpp:
757         (WebCore::FrameLoader::finishedParsing):
758         (WebCore::FrameLoader::completed):
759         * page/FrameView.cpp:
760         (WebCore::FrameView::resetScrollbarsAndClearContentsSize):
761         (WebCore::FrameView::scrollToAnchor):
762         (WebCore::FrameView::maintainScrollPositionAtAnchor):
763         (WebCore::FrameView::setScrollPosition):
764         (WebCore::FrameView::autoSizeIfEnabled):
765         (WebCore::FrameView::setWasScrolledByUser):
766         * page/LayoutContext.cpp:
767         (WebCore::LayoutContext::layout):
768         * page/Page.cpp:
769         (WebCore::Page::setPageScaleFactor):
770         * page/ViewportConfiguration.cpp:
771         (WebCore::ViewportConfiguration::setContentsSize):
772         (WebCore::ViewportConfiguration::setViewportArguments):
773         (WebCore::ViewportConfiguration::updateConfiguration):
774         (WebCore::operator<<):
775         (WebCore::ViewportConfiguration::description const):
776         (WebCore::ViewportConfiguration::dump const):
777         * page/ViewportConfiguration.h:
778         * platform/Logging.h:
779         * platform/ScrollView.cpp:
780         (WebCore::ScrollView::setFixedLayoutSize):
781
782 2017-12-01  Alicia Boya García  <aboya@igalia.com>
783
784         [MSE] Use correct range end checks in sourceBufferPrivateDidReceiveSample()
785         https://bugs.webkit.org/show_bug.cgi?id=179690
786
787         Reviewed by Jer Noble.
788
789         The Coded Frame Processing algorithm as defined in
790         https://www.w3.org/TR/media-source/#sourcebuffer-coded-frame-processing states:
791
792         1.14. Remove existing coded frames in track buffer:
793          -> If highest end timestamp for track buffer is not set:
794                [...]
795          -> If highest end timestamp for track buffer is set and less than or
796             equal to presentation timestamp:
797                Remove all coded frames from track buffer that have a
798                presentation timestamp greater than or equal to highest end
799                timestamp and less than frame end timestamp.
800
801         Note the removal range is closed-open [a, b). WebKit is actually removing
802         frames using an open-closed range (a, b], which causes frames not to be removed
803         in situations where they should and frames to be removed in situations when
804         they should not.
805
806         Tests: media/media-source/media-source-range-end-frame-not-removed.html
807                media/media-source/media-source-range-start-frame-replaced.html
808
809         * Modules/mediasource/SampleMap.cpp:
810         (WebCore::PresentationOrderSampleMap::findSamplesBetweenPresentationTimesFromEnd):
811         * Modules/mediasource/SampleMap.h:
812         * Modules/mediasource/SourceBuffer.cpp:
813         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
814
815 2017-12-01  Simon Fraser  <simon.fraser@apple.com>
816
817         Reduce the number of calls to ViewportConfiguration::updateConfiguration()
818         https://bugs.webkit.org/show_bug.cgi?id=180299
819
820         Reviewed by Zalan Bujtas.
821
822         There are several calls to ViewportConfiguration::setDefaultConfiguration() during loading
823         with the same arguments. We can avoid unnecessary calls to updateConfiguration() by returning
824         early if the configuration hasn't changed.
825
826         * page/ViewportConfiguration.cpp:
827         (WebCore::ViewportConfiguration::setDefaultConfiguration):
828         * page/ViewportConfiguration.h:
829         (WebCore::ViewportConfiguration::Parameters::operator== const):
830
831 2017-12-01  Aishwarya Nirmal  <anirmal@apple.com>
832
833         [Touch Bar Web API] Object representing Touch Bar Menu to send between Web and UI Processes
834         https://bugs.webkit.org/show_bug.cgi?id=179714
835
836         Reviewed by Wenson Hsieh.
837
838         These changes allow the HTMLMenuElement and HTMLMenuItemElement to parse attributes relating
839         to the touch bar and convey changes to the elements that will eventually be propogated to the
840         UI process.
841
842         No new tests at this point because the changes to HTMLMenuElement and HTMLMenuItemElement are
843         new properties, which might not be worth testing, and overriden methods for insertedIntoAncestor
844         and removedFromAncestor, which are involved in sending a message to a UI process but might be
845         difficult to test at this point since the UI process only receives (and does not yet process)
846         the message.
847
848         * html/HTMLMenuElement.cpp:
849         (WebCore::HTMLMenuElement::insertedIntoAncestor):
850         (WebCore::HTMLMenuElement::removedFromAncestor):
851         (WebCore::HTMLMenuElement::parseAttribute):
852         * html/HTMLMenuElement.h:
853         * html/HTMLMenuItemElement.cpp:
854         (WebCore::HTMLMenuItemElement::insertedIntoAncestor):
855         (WebCore::HTMLMenuItemElement::removedFromAncestor):
856         * html/HTMLMenuItemElement.h:
857         * page/ChromeClient.h:
858
859 2017-12-01  Daniel Bates  <dabates@apple.com>
860
861         AlternativePresentationButtonSubstitution::unapply() may not undo substitution
862         https://bugs.webkit.org/show_bug.cgi?id=180279
863         <rdar://problem/35800599>
864
865         Reviewed by Simon Fraser.
866
867         Fixes an issue where removing an alternative presentation button substituted for a non-HTML input
868         element did not restore the original appearance of the element before the substitution.
869
870         To substitute the alternative presentation button for a non-HTML input element we attach a
871         user-agent shadow root to it. Adding a shadow root, including a user-agent shadow root,
872         tears down the existing renderers for the element. Currently when we unapply such a substitution
873         we ultimately just remove the shadow root and do not create new renderers for the subtree
874         that the shadow root was removed from. We need to create new renderers for this subtree
875         to restore the original appearance of the element before the substitution.
876
877         * editing/cocoa/AlternativePresentationButtonSubstitution.cpp:
878         (WebCore::AlternativePresentationButtonSubstitution::unapply):
879
880 2017-12-01  Christopher Reid  <chris.reid@sony.com>
881
882         Move DateComponents into WTF
883         https://bugs.webkit.org/show_bug.cgi?id=180211
884
885         Reviewed by Myles C. Maxfield.
886
887         No new tests no change in behavior.
888
889         Moved DateComponents from platform into WTF.
890
891         * Sources.txt: Removed DateComponents
892         * WebCore.xcodeproj/project.pbxproj: Removed DateComponents
893         * dom/Document.cpp:
894         * html/BaseDateAndTimeInputType.h:
895         * html/DateTimeInputType.h: Fixed a call to the wrong parent constructor
896         * html/HTMLInputElement.h:
897         * html/InputType.cpp:
898         * html/InputType.h:
899         * platform/text/PlatformLocale.cpp:
900         * platform/text/PlatformLocale.h:
901         * platform/text/ios/LocalizedDateCache.h:
902         * platform/text/mac/LocaleMac.h:
903         * platform/text/win/LocaleWin.cpp:
904         * platform/text/win/LocaleWin.h:
905         * rendering/RenderThemeIOS.mm:
906
907 2017-12-01  Daniel Bates  <dabates@apple.com>
908
909         Alternative Presentation Button: Provide a way to query for the replaced elements
910         https://bugs.webkit.org/show_bug.cgi?id=180114
911         <rdar://problem/35710539>
912
913         Reviewed by Tim Horton.
914
915         Add SPI to query for the elements that were replaced by an Alternative Presentation Button.
916
917         Test: fast/forms/alternative-presentation-button/replaced-elements.html
918
919         * editing/Editor.cpp:
920         (WebCore::Editor::elementsReplacedByAlternativePresentationButton): Added.
921         * editing/Editor.h:
922         * editing/cocoa/AlternativePresentationButtonSubstitution.cpp:
923         (WebCore::AlternativePresentationButtonSubstitution::replacedElements): Added.
924         * editing/cocoa/AlternativePresentationButtonSubstitution.h:
925         * testing/Internals.cpp:
926         (WebCore::Internals::elementsReplacedByAlternativePresentationButton): Added.
927         * testing/Internals.h:
928         * testing/Internals.idl: Expose internals function elementsReplacedByAlternativePresentationButton()
929         so as to test Editor::elementsReplacedByAlternativePresentationButton().
930
931 2017-12-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
932
933         Rename ImageFrameCache to ImageSource
934         https://bugs.webkit.org/show_bug.cgi?id=180172
935
936         Reviewed by Per Arne Vollan.
937
938         This is a follow-up for r225300. ImageSource is the intended name after
939         merging ImageFrameCache and ImageSource.
940
941         * Sources.txt:
942         * WebCore.xcodeproj/project.pbxproj:
943         * platform/graphics/BitmapImage.cpp:
944         (WebCore::BitmapImage::BitmapImage):
945         * platform/graphics/BitmapImage.h:
946         * platform/graphics/ImageFrame.h:
947         * platform/graphics/ImageFrameCache.cpp: Removed.
948         * platform/graphics/ImageFrameCache.h: Removed.
949         * platform/graphics/ImageSource.cpp: Added.
950         (WebCore::ImageSource::ImageSource):
951         (WebCore::ImageSource::~ImageSource):
952         (WebCore::ImageSource::ensureDecoderAvailable):
953         (WebCore::ImageSource::setData):
954         (WebCore::ImageSource::resetData):
955         (WebCore::ImageSource::dataChanged):
956         (WebCore::ImageSource::isAllDataReceived):
957         (WebCore::ImageSource::destroyDecodedData):
958         (WebCore::ImageSource::destroyIncompleteDecodedData):
959         (WebCore::ImageSource::clearFrameBufferCache):
960         (WebCore::ImageSource::decodedSizeChanged):
961         (WebCore::ImageSource::decodedSizeIncreased):
962         (WebCore::ImageSource::decodedSizeDecreased):
963         (WebCore::ImageSource::decodedSizeReset):
964         (WebCore::ImageSource::didDecodeProperties):
965         (WebCore::ImageSource::growFrames):
966         (WebCore::ImageSource::setNativeImage):
967         (WebCore::ImageSource::cacheMetadataAtIndex):
968         (WebCore::ImageSource::cacheNativeImageAtIndex):
969         (WebCore::ImageSource::cacheNativeImageAtIndexAsync):
970         (WebCore::ImageSource::decodingQueue):
971         (WebCore::ImageSource::frameRequestQueue):
972         (WebCore::ImageSource::canUseAsyncDecoding):
973         (WebCore::ImageSource::startAsyncDecodingQueue):
974         (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex):
975         (WebCore::ImageSource::isAsyncDecodingQueueIdle const):
976         (WebCore::ImageSource::stopAsyncDecodingQueue):
977         (WebCore::ImageSource::frameAtIndexCacheIfNeeded):
978         (WebCore::ImageSource::clearMetadata):
979         (WebCore::ImageSource::sourceURL const):
980         (WebCore::ImageSource::mimeType const):
981         (WebCore::ImageSource::expectedContentLength const):
982         (WebCore::ImageSource::metadata):
983         (WebCore::ImageSource::frameMetadataAtIndex):
984         (WebCore::ImageSource::frameMetadataAtIndexCacheIfNeeded):
985         (WebCore::ImageSource::encodedDataStatus):
986         (WebCore::ImageSource::frameCount):
987         (WebCore::ImageSource::repetitionCount):
988         (WebCore::ImageSource::uti):
989         (WebCore::ImageSource::filenameExtension):
990         (WebCore::ImageSource::hotSpot):
991         (WebCore::ImageSource::size):
992         (WebCore::ImageSource::sizeRespectingOrientation):
993         (WebCore::ImageSource::singlePixelSolidColor):
994         (WebCore::ImageSource::maximumSubsamplingLevel):
995         (WebCore::ImageSource::frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex):
996         (WebCore::ImageSource::frameDecodingStatusAtIndex):
997         (WebCore::ImageSource::frameHasAlphaAtIndex):
998         (WebCore::ImageSource::frameHasFullSizeNativeImageAtIndex):
999         (WebCore::ImageSource::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex):
1000         (WebCore::ImageSource::frameSubsamplingLevelAtIndex):
1001         (WebCore::ImageSource::frameSizeAtIndex):
1002         (WebCore::ImageSource::frameBytesAtIndex):
1003         (WebCore::ImageSource::frameDurationAtIndex):
1004         (WebCore::ImageSource::frameOrientationAtIndex):
1005         (WebCore::ImageSource::setTargetContext):
1006         (WebCore::ImageSource::createFrameImageAtIndex):
1007         (WebCore::ImageSource::frameImageAtIndex):
1008         (WebCore::ImageSource::frameImageAtIndexCacheIfNeeded):
1009         (WebCore::ImageSource::dump):
1010         * platform/graphics/ImageSource.h: Added.
1011         (WebCore::ImageSource::create):
1012         (WebCore::ImageSource::decodedSize const):
1013         (WebCore::ImageSource::destroyAllDecodedData):
1014         (WebCore::ImageSource::destroyAllDecodedDataExcludeFrame):
1015         (WebCore::ImageSource::destroyDecodedDataBeforeFrame):
1016         (WebCore::ImageSource::clearImage):
1017         (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex):
1018         (WebCore::ImageSource::hasAsyncDecodingQueue const):
1019         (WebCore::ImageSource::isSizeAvailable):
1020         (WebCore::ImageSource::isDecoderAvailable const):
1021         (WebCore::ImageSource::frameAtIndexCacheIfNeeded):
1022         (WebCore::ImageSource::ImageFrameRequest::operator== const):
1023         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
1024         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
1025         * platform/graphics/cg/GraphicsContext3DCG.cpp:
1026         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
1027
1028 2017-12-01  Youenn Fablet  <youenn@apple.com>
1029
1030         Implement https://w3c.github.io/ServiceWorker/#clients-get
1031         https://bugs.webkit.org/show_bug.cgi?id=180167
1032
1033         Reviewed by Chris Dumez.
1034
1035         Test: http/tests/workers/service/serviceworkerclients-get.https.html
1036
1037         Implement clients get by having service worker clients do the following:
1038         - Go to main thread to query the SWClientConnection for getting the client.
1039         - SWClientConnection requests it through IPC to StorageProcess SWServer.
1040         - SWServer looks at its client map and returns client data based on the given identifier.
1041         - SWClientConnection sends it back to the right clients for resolving the promise.
1042
1043         Identifier is parsed at service worker process level.
1044
1045         Made ServiceWorkerClients no longer an ActiveDOMObject since it is owned by ServiceWorkerGlobalScope
1046         and is only exposed in service workers.
1047
1048         * workers/service/ServiceWorkerClientIdentifier.h:
1049         (WebCore::ServiceWorkerClientIdentifier::fromString):
1050         * workers/service/ServiceWorkerClients.cpp:
1051         (WebCore::ServiceWorkerClients::ServiceWorkerClients):
1052         (WebCore::ServiceWorkerClients::get):
1053         * workers/service/ServiceWorkerClients.h:
1054         (WebCore::ServiceWorkerClients::create):
1055         * workers/service/context/SWContextManager.cpp:
1056         (WebCore::SWContextManager::postTaskToServiceWorker):
1057         * workers/service/context/SWContextManager.h:
1058         * workers/service/server/SWServer.cpp:
1059         (WebCore::SWServer::getClientFromId):
1060         * workers/service/server/SWServer.h:
1061         * workers/service/server/SWServerToContextConnection.cpp:
1062         (WebCore::SWServerToContextConnection::findClientByIdentifier):
1063         * workers/service/server/SWServerToContextConnection.h:
1064         * workers/service/server/SWServerWorker.cpp:
1065         (WebCore::SWServerWorker::origin const):
1066         (WebCore::SWServerWorker::findClientByIdentifier):
1067         * workers/service/server/SWServerWorker.h:
1068
1069 2017-12-01  Brian Burg  <bburg@apple.com>
1070
1071         Web Inspector: move Inspector::Protocol::Array<T> to JSON namespace
1072         https://bugs.webkit.org/show_bug.cgi?id=173662
1073
1074         Reviewed by Joseph Pecoraro.
1075
1076         Adopt new type names.
1077
1078         * inspector/InspectorCanvas.cpp:
1079         (WebCore::InspectorCanvas::recordAction):
1080         (WebCore::InspectorCanvas::releaseFrames):
1081         (WebCore::InspectorCanvas::releaseData):
1082         (WebCore::InspectorCanvas::indexForData):
1083         (WebCore::buildArrayForAffineTransform):
1084         (WebCore::buildArrayForVector):
1085         (WebCore::InspectorCanvas::buildInitialState):
1086         (WebCore::InspectorCanvas::buildAction):
1087         (WebCore::InspectorCanvas::buildArrayForCanvasGradient):
1088         (WebCore::InspectorCanvas::buildArrayForCanvasPattern):
1089         (WebCore::InspectorCanvas::buildArrayForImageData):
1090         (WebCore::InspectorCanvas::buildArrayForImageBitmap):
1091         * inspector/InspectorCanvas.h:
1092         * inspector/InspectorController.cpp:
1093         (WebCore::InspectorController::buildObjectForHighlightedNodes const):
1094         * inspector/InspectorController.h:
1095         * inspector/InspectorOverlay.cpp:
1096         (WebCore::buildObjectForHighlight):
1097         (WebCore::InspectorOverlay::drawPaintRects):
1098         (WebCore::buildArrayForRendererFragments):
1099         (WebCore::buildObjectForElementData):
1100         (WebCore::InspectorOverlay::buildHighlightObjectForNode const):
1101         (WebCore::InspectorOverlay::buildObjectForHighlightedNodes const):
1102         * inspector/InspectorOverlay.h:
1103         * inspector/InspectorStyleSheet.cpp:
1104         (WebCore::fillMediaListChain):
1105         (WebCore::InspectorStyle::buildArrayForComputedStyle const):
1106         (WebCore::InspectorStyle::styleWithProperties const):
1107         (WebCore::buildObjectForSelectorHelper):
1108         (WebCore::selectorsFromSource):
1109         (WebCore::InspectorStyleSheet::buildObjectForSelectorList):
1110         (WebCore::InspectorStyleSheet::buildObjectForRule):
1111         (WebCore::InspectorStyleSheet::buildObjectForStyle):
1112         (WebCore::InspectorStyleSheet::buildArrayForRuleList):
1113         * inspector/InspectorStyleSheet.h:
1114         * inspector/agents/InspectorApplicationCacheAgent.cpp:
1115         (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
1116         (WebCore::InspectorApplicationCacheAgent::buildArrayForApplicationCacheResources):
1117         * inspector/agents/InspectorApplicationCacheAgent.h:
1118         * inspector/agents/InspectorCSSAgent.cpp:
1119         (WebCore::InspectorCSSAgent::getMatchedStylesForNode):
1120         (WebCore::InspectorCSSAgent::getComputedStyleForNode):
1121         (WebCore::InspectorCSSAgent::getAllStyleSheets):
1122         (WebCore::InspectorCSSAgent::getSupportedCSSProperties):
1123         (WebCore::InspectorCSSAgent::getSupportedSystemFontFamilyNames):
1124         (WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):
1125         * inspector/agents/InspectorCSSAgent.h:
1126         * inspector/agents/InspectorCanvasAgent.cpp:
1127         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
1128         * inspector/agents/InspectorCanvasAgent.h:
1129         * inspector/agents/InspectorDOMAgent.cpp:
1130         (WebCore::InspectorDOMAgent::querySelectorAll):
1131         (WebCore::InspectorDOMAgent::pushNodePathToFrontend):
1132         (WebCore::InspectorDOMAgent::getEventListenersForNode):
1133         (WebCore::InspectorDOMAgent::getSearchResults):
1134         (WebCore::InspectorDOMAgent::getAttributes):
1135         (WebCore::InspectorDOMAgent::buildObjectForNode):
1136         (WebCore::InspectorDOMAgent::buildArrayForElementAttributes):
1137         (WebCore::InspectorDOMAgent::buildArrayForContainerChildren):
1138         (WebCore::InspectorDOMAgent::buildArrayForPseudoElements):
1139         (WebCore::InspectorDOMAgent::processAccessibilityChildren):
1140         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
1141         (WebCore::InspectorDOMAgent::styleAttributeInvalidated):
1142         * inspector/agents/InspectorDOMAgent.h:
1143         * inspector/agents/InspectorDOMStorageAgent.cpp:
1144         (WebCore::InspectorDOMStorageAgent::getDOMStorageItems):
1145         * inspector/agents/InspectorDOMStorageAgent.h:
1146         * inspector/agents/InspectorDatabaseAgent.cpp:
1147         (WebCore::InspectorDatabaseAgent::getDatabaseTableNames):
1148         * inspector/agents/InspectorDatabaseAgent.h:
1149         * inspector/agents/InspectorIndexedDBAgent.cpp:
1150         (WebCore::Inspector::keyPathFromIDBKeyPath):
1151         (WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
1152         * inspector/agents/InspectorLayerTreeAgent.cpp:
1153         (WebCore::InspectorLayerTreeAgent::layersForNode):
1154         (WebCore::InspectorLayerTreeAgent::gatherLayersUsingRenderObjectHierarchy):
1155         (WebCore::InspectorLayerTreeAgent::gatherLayersUsingRenderLayerHierarchy):
1156         * inspector/agents/InspectorLayerTreeAgent.h:
1157         * inspector/agents/InspectorMemoryAgent.cpp:
1158         (WebCore::InspectorMemoryAgent::collectSample):
1159         * inspector/agents/InspectorNetworkAgent.cpp:
1160         (WebCore::InspectorNetworkAgent::searchOtherRequests):
1161         (WebCore::InspectorNetworkAgent::searchInRequest):
1162         * inspector/agents/InspectorNetworkAgent.h:
1163         * inspector/agents/InspectorPageAgent.cpp:
1164         (WebCore::buildArrayForCookies):
1165         (WebCore::InspectorPageAgent::getCookies):
1166         (WebCore::InspectorPageAgent::searchInResource):
1167         (WebCore::InspectorPageAgent::searchInResources):
1168         (WebCore::InspectorPageAgent::buildObjectForFrameTree):
1169         * inspector/agents/InspectorPageAgent.h:
1170         * inspector/agents/WebConsoleAgent.cpp:
1171         (WebCore::WebConsoleAgent::getLoggingChannels):
1172         * inspector/agents/WebConsoleAgent.h:
1173
1174 2017-12-01  Wenson Hsieh  <wenson_hsieh@apple.com>
1175
1176         [Attachment Support] Implement SPI for clients to update a given attachment's data
1177         https://bugs.webkit.org/show_bug.cgi?id=180184
1178         <rdar://problem/35355731>
1179
1180         Reviewed by Tim Horton.
1181
1182         Add native API support for Mail to update the data (and optionally, the name and type) of a given attachment
1183         element. See per-method comments below for more detail.
1184
1185         Test: WKAttachmentTests.ChangeAttachmentDataAndFileInformation
1186               WKAttachmentTests.ChangeAttachmentDataUpdatesWithInPlaceDisplay
1187
1188         * editing/Editor.cpp:
1189         (WebCore::Editor::insertAttachment):
1190         * html/HTMLAttachmentElement.cpp:
1191         (WebCore::HTMLAttachmentElement::setFile):
1192         (WebCore::HTMLAttachmentElement::invalidateShadowRootChildrenIfNecessary):
1193
1194         Pull out logic to hide and reset shadow DOM state into a separate helper, and additionally hide both the image
1195         and video child elements if they exist. This prevents us from getting into a state where both image and video
1196         elements may appear side-by-side when changing data from an image to a video or vice versa.
1197
1198         (WebCore::HTMLAttachmentElement::updateFileWithData):
1199
1200         Add a new helper to update the backing File of an attachment element from data, optionally updating the filename
1201         and content type as well.
1202
1203         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
1204         * html/HTMLAttachmentElement.h:
1205
1206 2017-12-01  Chris Dumez  <cdumez@apple.com>
1207
1208         Get rid of microtask in ServiceWorkerContainer::jobResolvedWithRegistration()
1209         https://bugs.webkit.org/show_bug.cgi?id=180263
1210
1211         Reviewed by Youenn Fablet.
1212
1213         Get rid of microtask in ServiceWorkerContainer::jobResolvedWithRegistration(). It
1214         is no longer needed and MicrotaskQueue::mainThreadQueue() is only safe to use from
1215         the main thread, as its name suggest. ServiceWorkerContainer are also instantiated
1216         in Service worker threads nowadays.
1217
1218         * workers/service/SWClientConnection.cpp:
1219         (WebCore::SWClientConnection::registrationJobResolvedInServer):
1220         * workers/service/ServiceWorkerContainer.cpp:
1221         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1222         * workers/service/ServiceWorkerContainer.h:
1223         * workers/service/ServiceWorkerJob.cpp:
1224         (WebCore::ServiceWorkerJob::resolvedWithRegistration):
1225         * workers/service/ServiceWorkerJob.h:
1226         * workers/service/ServiceWorkerJobClient.h:
1227
1228 2017-12-01  Myles C. Maxfield  <mmaxfield@apple.com>
1229
1230         Free FontFaceSets may include fonts that were never actually added to them
1231         https://bugs.webkit.org/show_bug.cgi?id=180164
1232
1233         Reviewed by Simon Fraser.
1234
1235         There are two circumstances where this can occur:
1236
1237         - If script makes a so-called "free" FontFaceSet, by using "new FontFaceSet". This object is not
1238         associated with the document, and should therefore only include fonts which have been manually
1239         added to it from script. However, today, this object includes preinstalled fonts which have the
1240         same names as any fonts manually added to it. (So, if you manually add "Helvetica", the object
1241         would have two objects - the one you just added and the preinstalled version too).
1242
1243         - For the document's FontFaceSet, the same thing would happen. This one is a little trickier
1244         because the spec is not clear whether or not the document's FontFaceSet should include these
1245         preinstalled fonts. However, running this test in Firefox and Chrome, they both agree that 
1246         preinstalled fonts should not be present, so this patch adheres to this behavior.
1247
1248         We can't actually remove the preinstalled fonts from the document's FontFaceSet (because that's
1249         how normal font lookups are performed), but we can filter them out at the point they meet the
1250         Javascript API. And, for "free" FontFaceSets, we can avoid adding them in the first place for
1251         performance.
1252
1253         Test: fast/text/font-face-api-preinstalled.html
1254
1255         * css/CSSFontFaceSet.cpp:
1256         (WebCore::CSSFontFaceSet::CSSFontFaceSet):
1257         (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
1258         (WebCore::CSSFontFaceSet::addToFacesLookupTable):
1259         (WebCore::CSSFontFaceSet::matchingFacesExcludingPreinstalledFonts):
1260         (WebCore::CSSFontFaceSet::check):
1261         (WebCore::CSSFontFaceSet::matchingFaces): Deleted.
1262         * css/CSSFontFaceSet.h:
1263         * css/CSSFontSelector.cpp:
1264         (WebCore::CSSFontSelector::CSSFontSelector):
1265         * css/FontFaceSet.cpp:
1266         (WebCore::FontFaceSet::load):
1267
1268 2017-12-01  Dean Jackson  <dino@apple.com>
1269
1270         Attempted build fix.
1271
1272         * platform/graphics/ANGLEWebKitBridge.cpp:
1273         (WebCore::ANGLEWebKitBridge::compileShaderSource):
1274         * platform/graphics/ANGLEWebKitBridge.h:
1275         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
1276         (WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
1277
1278 2017-12-01  Dean Jackson  <dino@apple.com>
1279
1280         Use SH_INITIALIZE_UNINITIALIZED_LOCALS now that ANGLE has been updated
1281         https://bugs.webkit.org/show_bug.cgi?id=177929
1282         <rdar://problem/34866210>
1283
1284         Reviewed by Sam Weinig.
1285
1286         Test: fast/canvas/webgl/uninitialized-locals.html
1287
1288         * platform/graphics/ANGLEWebKitBridge.cpp:
1289         (WebCore::ANGLEWebKitBridge::compileShaderSource):
1290         * platform/graphics/ANGLEWebKitBridge.h:
1291         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
1292         (WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
1293
1294 2017-12-01  Youenn Fablet  <youenn@apple.com>
1295
1296         Many imported/w3c/web-platform-tests/service-workers/ test are failing together intermittently
1297         https://bugs.webkit.org/show_bug.cgi?id=180227
1298
1299         Reviewed by Mark Lam.
1300
1301         No observable change.
1302
1303         * bindings/js/JSDOMPromise.cpp:
1304         (WebCore::callFunction):
1305
1306 2017-12-01  Brady Eidson  <beidson@apple.com>
1307
1308         Add Internals.terminateServiceWorker, and the ability to restart service workers for postMessage.
1309         https://bugs.webkit.org/show_bug.cgi?id=180170
1310
1311         Reviewed by Chris Dumez.
1312
1313         Test: http/tests/workers/service/postmessage-after-terminate.https.html
1314
1315         * dom/ActiveDOMObject.cpp:
1316         (WebCore::ActiveDOMObject::~ActiveDOMObject):
1317
1318         * testing/Internals.cpp:
1319         (WebCore::Internals::terminateServiceWorker):
1320         * testing/Internals.h:
1321         * testing/Internals.idl:
1322
1323         * workers/service/SWClientConnection.h:
1324
1325         * workers/service/ServiceWorker.idl:
1326
1327         * workers/service/context/SWContextManager.cpp:
1328         (WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope):
1329         (WebCore::SWContextManager::terminateWorker):
1330         * workers/service/context/SWContextManager.h:
1331
1332         * workers/service/context/ServiceWorkerThreadProxy.h:
1333
1334         * workers/service/server/SWServer.cpp:
1335         (WebCore::SWServer::workerByID const):
1336         (WebCore::SWServer::Connection::syncTerminateWorker):
1337         (WebCore::SWServer::installContextData):
1338         (WebCore::SWServer::invokeRunServiceWorker):
1339         (WebCore::SWServer::terminateWorker):
1340         (WebCore::SWServer::syncTerminateWorker):
1341         (WebCore::SWServer::terminateWorkerInternal):
1342         (WebCore::SWServer::workerContextTerminated):
1343         * workers/service/server/SWServer.h:
1344         (WebCore::SWServer::workerByID const): Deleted.
1345
1346         * workers/service/server/SWServerToContextConnection.h:
1347
1348         * workers/service/server/SWServerWorker.cpp:
1349         (WebCore::SWServerWorker::contextData const):
1350         * workers/service/server/SWServerWorker.h:
1351         (WebCore::SWServerWorker::isRunning const):
1352         (WebCore::SWServerWorker::isTerminating const):
1353         (WebCore::SWServerWorker::setState):
1354         (WebCore::SWServerWorker::server):
1355
1356 2017-12-01  Zalan Bujtas  <zalan@apple.com>
1357
1358         Nullptr deref in WebCore::RenderTableCaption::containingBlockLogicalWidthForContent
1359         https://bugs.webkit.org/show_bug.cgi?id=180251
1360         <rdar://problem/34138562>
1361
1362         Reviewed by Simon Fraser.
1363
1364         containingBlockLogicalWidthForContent should check whether the renderer is actually
1365         attached to the tree.
1366
1367         Test: fast/table/caption-crash-when-layer-backed.html
1368
1369         * rendering/RenderBoxModelObject.cpp:
1370         (WebCore::RenderBoxModelObject::containingBlockLogicalWidthForContent const):
1371         * rendering/RenderTableCaption.h:
1372         (WebCore::RenderTableCaption::containingBlockLogicalWidthForContent const):
1373
1374 2017-12-01  Youenn Fablet  <youenn@apple.com>
1375
1376         Clear WebSWClientConnection in case storage process IPC connection is closing
1377         https://bugs.webkit.org/show_bug.cgi?id=180210
1378
1379         Reviewed by Chris Dumez.
1380
1381         No observable change of behavior.
1382
1383         * dom/Document.h: Keeping a ref since object may be deleted otherwise.
1384
1385 2017-12-01  Chris Dumez  <cdumez@apple.com>
1386
1387         Drop clientCreationURL from ServiceWorkerRegistrationKey
1388         https://bugs.webkit.org/show_bug.cgi?id=180255
1389
1390         Reviewed by Youenn Fablet.
1391
1392         Drop clientCreationURL from ServiceWorkerRegistrationKey. It is not needed and leads to
1393         wrong behavior when using the Service Worker API from inside service workers.
1394
1395         * workers/service/ServiceWorkerJobData.cpp:
1396         (WebCore::ServiceWorkerJobData::registrationKey const):
1397         * workers/service/ServiceWorkerRegistrationKey.cpp:
1398         (WebCore::ServiceWorkerRegistrationKey::ServiceWorkerRegistrationKey):
1399         (WebCore::ServiceWorkerRegistrationKey::hash const):
1400         (WebCore::ServiceWorkerRegistrationKey::operator== const):
1401         (WebCore::ServiceWorkerRegistrationKey::isolatedCopy const):
1402         (WebCore::ServiceWorkerRegistrationKey::loggingString const):
1403         * workers/service/ServiceWorkerRegistrationKey.h:
1404         (WebCore::ServiceWorkerRegistrationKey::scope const):
1405         (WebCore::ServiceWorkerRegistrationKey::setScope):
1406         (WebCore::ServiceWorkerRegistrationKey::encode const):
1407         (WebCore::ServiceWorkerRegistrationKey::decode):
1408         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue):
1409         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::isDeletedValue):
1410         (WebCore::ServiceWorkerRegistrationKey::clientCreationURL const): Deleted.
1411         (WebCore::ServiceWorkerRegistrationKey::setClientCreationURL): Deleted.
1412
1413 2017-12-01  Fujii Hironori  <Hironori.Fujii@sony.com>
1414
1415         [WinCairo] Wrongly placed scroll bars in HiDPI
1416         https://bugs.webkit.org/show_bug.cgi?id=180066
1417
1418         Reviewed by Žan Doberšek.
1419
1420         PlatformContextCairo wasn't properly initialized. It should have a
1421         pointer to GraphicsContextPrivate in WinCairo port to paint
1422         controls in right places.
1423
1424         No new tests, no behavior change.
1425
1426         * platform/graphics/win/GraphicsContextCairoWin.cpp:
1427         (WebCore::GraphicsContext::platformInit): Call PlatformContextCairo::setGraphicsContextPrivate.
1428
1429 2017-12-01  Eric Carlson  <eric.carlson@apple.com>
1430
1431         [MediaStream] Use CaptureDevice instead of device ID to identify devices
1432         https://bugs.webkit.org/show_bug.cgi?id=180206
1433         <rdar://problem/35775758>
1434
1435         Reviewed by Youenn Fablet.
1436
1437         No new tests, no change in behavior.
1438
1439         * Modules/mediastream/UserMediaRequest.cpp:
1440         (WebCore::UserMediaRequest::allow):
1441         * Modules/mediastream/UserMediaRequest.h:
1442         (WebCore::UserMediaRequest::allowedAudioDeviceUID const): Deleted.
1443         (WebCore::UserMediaRequest::allowedVideoDeviceUID const): Deleted.
1444         * platform/mediastream/RealtimeMediaSource.h:
1445         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1446         (WebCore::RealtimeMediaSourceCenter::createMediaStream):
1447         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
1448         * platform/mediastream/RealtimeMediaSourceCenter.h:
1449         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1450         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1451         * platform/mock/MockRealtimeAudioSource.cpp:
1452         * platform/mock/MockRealtimeVideoSource.cpp:
1453
1454 2017-11-30  Alex Christensen  <achristensen@webkit.org>
1455
1456         Extra PerformanceEntryList entry after iframe navigation
1457         https://bugs.webkit.org/show_bug.cgi?id=178433
1458
1459         Reviewed by Joseph Pecoraro.
1460
1461         Test: http/tests/security/PerformanceEntryList-parent-only-first-navigation.html
1462
1463         When an iframe is loaded, its main resource load should be reported to the parent frame's PerformanceEntryList.
1464         Subsequent main resource loads should not.
1465
1466         * loader/FrameLoader.h:
1467         (WebCore::FrameLoader::shouldReportResourceTimingToParentFrame):
1468         * loader/ResourceTimingInformation.cpp:
1469         (WebCore::ResourceTimingInformation::addResourceTiming):
1470
1471 2017-11-30  Zalan Bujtas  <zalan@apple.com>
1472
1473         [Simple line layout] Incorrect repaint rect with vertically shrinking content and bottom-padding.
1474         https://bugs.webkit.org/show_bug.cgi?id=180223
1475         <rdar://problem/34122210>
1476
1477         Reviewed by Simon Fraser.
1478
1479         Repaint rect should be extended all the way to bottom border/padding.
1480
1481         Test: fast/repaint/simple-line-layout-shrinking-content.html
1482
1483         * rendering/RenderBlockFlow.cpp:
1484         (WebCore::RenderBlockFlow::layoutSimpleLines):
1485
1486 2017-11-30  Stephan Szabo  <stephan.szabo@sony.com>
1487
1488         Make LegacyCustomProtocolManager optional for network process
1489         https://bugs.webkit.org/show_bug.cgi?id=176230
1490
1491         Reviewed by Alex Christensen.
1492
1493         No new tests, only sets up feature define
1494
1495         * Configurations/FeatureDefines.xcconfig:
1496
1497 2017-11-30  Joseph Pecoraro  <pecoraro@apple.com>
1498
1499         [Cocoa] Fix CVPixelBuffer leak
1500         https://bugs.webkit.org/show_bug.cgi?id=180224
1501
1502         Reviewed by Youenn Fablet.
1503
1504         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp:
1505         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
1506         Adopt the newly created pixel buffer.
1507
1508         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
1509         Release the format description as soon as we are done with it. Otherwise
1510         we could have bailed before releasing it.
1511
1512 2017-11-30  Simon Fraser  <simon.fraser@apple.com>
1513
1514         Improve filter logging
1515         https://bugs.webkit.org/show_bug.cgi?id=180182
1516
1517         Reviewed by Sam Weinig.
1518
1519         Add a parameter to FilterEffect::externalRepresentation() so that we can log extra
1520         data without breaking layout tests.
1521
1522         Add TextStream output for ColorSpace.
1523         
1524         Improve logging of FEComponentTransfer ComponentTransferFunctions by logging the data
1525         that's appropriate for the function type, and rebaseline affected tests.
1526
1527         * platform/graphics/Color.cpp:
1528         (WebCore::operator<<):
1529         * platform/graphics/Color.h:
1530         * platform/graphics/filters/FEBlend.cpp:
1531         (WebCore::FEBlend::externalRepresentation const):
1532         * platform/graphics/filters/FEBlend.h:
1533         * platform/graphics/filters/FEColorMatrix.cpp:
1534         (WebCore::FEColorMatrix::externalRepresentation const):
1535         * platform/graphics/filters/FEColorMatrix.h:
1536         * platform/graphics/filters/FEComponentTransfer.cpp:
1537         (WebCore::operator<<):
1538         (WebCore::FEComponentTransfer::externalRepresentation const):
1539         * platform/graphics/filters/FEComponentTransfer.h:
1540         * platform/graphics/filters/FEComposite.cpp:
1541         (WebCore::FEComposite::externalRepresentation const):
1542         * platform/graphics/filters/FEComposite.h:
1543         * platform/graphics/filters/FEConvolveMatrix.cpp:
1544         (WebCore::FEConvolveMatrix::externalRepresentation const):
1545         * platform/graphics/filters/FEConvolveMatrix.h:
1546         * platform/graphics/filters/FEDiffuseLighting.cpp:
1547         (WebCore::FEDiffuseLighting::externalRepresentation const):
1548         * platform/graphics/filters/FEDiffuseLighting.h:
1549         * platform/graphics/filters/FEDisplacementMap.cpp:
1550         (WebCore::FEDisplacementMap::externalRepresentation const):
1551         * platform/graphics/filters/FEDisplacementMap.h:
1552         * platform/graphics/filters/FEDropShadow.cpp:
1553         (WebCore::FEDropShadow::externalRepresentation const):
1554         * platform/graphics/filters/FEDropShadow.h:
1555         * platform/graphics/filters/FEFlood.cpp:
1556         (WebCore::FEFlood::externalRepresentation const):
1557         * platform/graphics/filters/FEFlood.h:
1558         * platform/graphics/filters/FEGaussianBlur.cpp:
1559         (WebCore::FEGaussianBlur::externalRepresentation const):
1560         * platform/graphics/filters/FEGaussianBlur.h:
1561         * platform/graphics/filters/FEMerge.cpp:
1562         (WebCore::FEMerge::externalRepresentation const):
1563         * platform/graphics/filters/FEMerge.h:
1564         * platform/graphics/filters/FEMorphology.cpp:
1565         (WebCore::FEMorphology::externalRepresentation const):
1566         * platform/graphics/filters/FEMorphology.h:
1567         * platform/graphics/filters/FEOffset.cpp:
1568         (WebCore::FEOffset::externalRepresentation const):
1569         * platform/graphics/filters/FEOffset.h:
1570         * platform/graphics/filters/FESpecularLighting.cpp:
1571         (WebCore::FESpecularLighting::externalRepresentation const):
1572         * platform/graphics/filters/FESpecularLighting.h:
1573         * platform/graphics/filters/FETile.cpp:
1574         (WebCore::FETile::externalRepresentation const):
1575         * platform/graphics/filters/FETile.h:
1576         * platform/graphics/filters/FETurbulence.cpp:
1577         (WebCore::FETurbulence::externalRepresentation const):
1578         * platform/graphics/filters/FETurbulence.h:
1579         * platform/graphics/filters/FilterEffect.cpp:
1580         (WebCore::FilterEffect::externalRepresentation const):
1581         (WebCore::operator<<):
1582         * platform/graphics/filters/FilterEffect.h:
1583         * platform/graphics/filters/SourceAlpha.cpp:
1584         (WebCore::SourceAlpha::externalRepresentation const):
1585         * platform/graphics/filters/SourceAlpha.h:
1586         * platform/graphics/filters/SourceGraphic.cpp:
1587         (WebCore::SourceGraphic::externalRepresentation const):
1588         * platform/graphics/filters/SourceGraphic.h:
1589         * rendering/svg/RenderSVGResourceFilter.cpp:
1590         (WebCore::RenderSVGResourceFilter::applyResource):
1591         * svg/graphics/filters/SVGFEImage.cpp:
1592         (WebCore::FEImage::externalRepresentation const):
1593         * svg/graphics/filters/SVGFEImage.h:
1594
1595 2017-11-30  Ryan Haddad  <ryanhaddad@apple.com>
1596
1597         Unreviewed build fix, removed unused lambda captures.
1598
1599         * workers/service/context/ServiceWorkerThread.cpp:
1600         (WebCore::ServiceWorkerThread::postFetchTask):
1601         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
1602
1603 2017-11-30  Chris Dumez  <cdumez@apple.com>
1604
1605         Move SWClientConnection class out of server/ folder
1606         https://bugs.webkit.org/show_bug.cgi?id=180217
1607
1608         Reviewed by Brady Eidson.
1609
1610         Move SWClientConnection class out of server/ folder since the client connection
1611         lives in the WebProcess, not the Storage process.
1612
1613         * Sources.txt:
1614         * WebCore.xcodeproj/project.pbxproj:
1615         * workers/service/SWClientConnection.cpp: Renamed from Source/WebCore/workers/service/server/SWClientConnection.cpp.
1616         (WebCore::SWClientConnection::scheduleJob):
1617         (WebCore::SWClientConnection::finishedFetchingScript):
1618         (WebCore::SWClientConnection::failedFetchingScript):
1619         (WebCore::SWClientConnection::jobRejectedInServer):
1620         (WebCore::SWClientConnection::registrationJobResolvedInServer):
1621         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
1622         (WebCore::SWClientConnection::startScriptFetchForServer):
1623         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
1624         (WebCore::SWClientConnection::forEachContainer):
1625         (WebCore::SWClientConnection::updateRegistrationState):
1626         (WebCore::SWClientConnection::updateWorkerState):
1627         (WebCore::SWClientConnection::fireUpdateFoundEvent):
1628         (WebCore::SWClientConnection::notifyClientsOfControllerChange):
1629         * workers/service/SWClientConnection.h: Renamed from Source/WebCore/workers/service/server/SWClientConnection.h.
1630         * workers/service/ServiceWorkerContainer.cpp:
1631
1632 2017-11-30  Chris Dumez  <cdumez@apple.com>
1633
1634         ServiceWorkerThread's m_extendedEvents gets destroyed on the wrong thread
1635         https://bugs.webkit.org/show_bug.cgi?id=180216
1636
1637         Reviewed by Brady Eidson.
1638
1639         ServiceWorkerThread's m_extendedEvents gets destroyed on the wrong thread. Those events live on the worker
1640         thread so we should destroy them on the worker thread, not the main thread. To address the issue, m_extendedEvents
1641         was moved to ServiceWorkerGlobalScope, which actually lives on the right thread.
1642
1643         * workers/service/ServiceWorkerGlobalScope.cpp:
1644         (WebCore::ServiceWorkerGlobalScope::updateExtendedEventsSet):
1645         * workers/service/ServiceWorkerGlobalScope.h:
1646         * workers/service/context/ServiceWorkerThread.cpp:
1647         (WebCore::ServiceWorkerThread::postFetchTask):
1648         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
1649         (WebCore::ServiceWorkerThread::updateExtendedEventsSet): Deleted.
1650         * workers/service/context/ServiceWorkerThread.h:
1651         (WebCore::ServiceWorkerThread::hasPendingEvents const): Deleted.
1652
1653 2017-11-30  Chris Dumez  <cdumez@apple.com>
1654
1655         SWServerToContextConnection / SWServerWorker do not need to be ThreadSafeRefCounted
1656         https://bugs.webkit.org/show_bug.cgi?id=180214
1657
1658         Reviewed by Brady Eidson.
1659
1660         SWServerToContextConnection / SWServerWorker do not need to be ThreadSafeRefCounted.
1661         RefCounted is sufficient as there is no longer any multithreading on server side.
1662
1663         * workers/service/server/SWServerToContextConnection.h:
1664         * workers/service/server/SWServerWorker.h:
1665
1666 2017-11-30  Chris Dumez  <cdumez@apple.com>
1667
1668         ServiceWorkerGlobalScope::skipWaiting() should resolve its promise
1669         https://bugs.webkit.org/show_bug.cgi?id=180204
1670
1671         Reviewed by Brady Eidson.
1672
1673         ServiceWorkerGlobalScope::skipWaiting() should resolve its promise, even if it is not
1674         implemented yet. For now, always reject the promise.
1675
1676         * workers/service/ServiceWorkerGlobalScope.cpp:
1677         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
1678
1679 2017-11-30  Chris Dumez  <cdumez@apple.com>
1680
1681         Mark a few heap-allocated service worker types as WTF_MAKE_FAST_ALLOCATED
1682         https://bugs.webkit.org/show_bug.cgi?id=180212
1683
1684         Reviewed by Geoffrey Garen.
1685
1686         Mark a few heap-allocated service worker types as WTF_MAKE_FAST_ALLOCATED for performance.
1687
1688         * workers/service/server/SWOriginStore.h:
1689         * workers/service/server/SWServer.h:
1690         * workers/service/server/SWServerJobQueue.h:
1691         * workers/service/server/SWServerRegistration.h:
1692
1693 2017-11-30  Brady Eidson  <beidson@apple.com>
1694
1695         Make WorkerThread lifetime much more predictable.
1696         https://bugs.webkit.org/show_bug.cgi?id=180203
1697
1698         Reviewed by Chris Dumez.
1699
1700         No new tests (Fixes flakiness in existing and future tests).
1701
1702         The family of classes related to Workers has a complicated ownership model.
1703
1704         For Dedicated Workers, the WorkerThread object is owned by the WorkerMessagingProxy,
1705         which manages its own lifetime. Additionally, other object(s) have raw C++ references
1706         to it, and the expected lifetimes are described in comments scattered through a few files.
1707
1708         What it boils down to is that the "Worker" DOM object - which lives on the main thread - 
1709         is the key to the proper destruction of all of these objects.
1710
1711         For ServiceWorkers running in their own context process, there is no "Worker" on the main thread.
1712
1713         As a result, ServiceWorkers can get into a situation where their WorkerThread can be destroyed before
1714         their ServiceWorkerGlobalScope is destroyed on the running background thread.
1715
1716         There's no reason to not have WorkerThread guarantee its own lifetime until its background thread
1717         has actually completed.
1718
1719         * workers/WorkerThread.cpp:
1720         (WebCore::WorkerThread::workerThread): Protect the WorkerThread object during the entire runtime
1721           of the background thread itself, and release that protection on the main thread.
1722         * workers/WorkerThread.h:
1723
1724 2017-11-30  Chris Dumez  <cdumez@apple.com>
1725
1726         Populate self.registration.installing/waiting/active inside service workers
1727         https://bugs.webkit.org/show_bug.cgi?id=180168
1728
1729         Reviewed by Brady Eidson.
1730
1731         Populate self.registration.installing/waiting/active inside service workers.
1732         Also make sure the ServiceWorker's state properly gets updated inside
1733         service workers.
1734
1735         No new tests, extended existing test for self.registration.
1736
1737         * workers/service/ServiceWorker.cpp:
1738         (WebCore::ServiceWorker::scheduleTaskToUpdateState):
1739         * workers/service/context/SWContextManager.cpp:
1740         (WebCore::SWContextManager::forEachServiceWorkerThread):
1741         * workers/service/context/SWContextManager.h:
1742         * workers/service/context/ServiceWorkerThread.cpp:
1743         (WebCore::ServiceWorkerThread::fireInstallEvent):
1744         (WebCore::ServiceWorkerThread::fireActivateEvent):
1745         * workers/service/server/SWClientConnection.cpp:
1746         (WebCore::SWClientConnection::updateRegistrationState):
1747         (WebCore::SWClientConnection::updateWorkerState):
1748         (WebCore::SWClientConnection::fireUpdateFoundEvent):
1749         * workers/service/server/SWClientConnection.h:
1750
1751 2017-11-30  Chris Dumez  <cdumez@apple.com>
1752
1753         Rename RegistrationOptions to ServiceWorkerRegistrationOptions
1754         https://bugs.webkit.org/show_bug.cgi?id=180207
1755
1756         Reviewed by Geoffrey Garen.
1757
1758         Rename RegistrationOptions to ServiceWorkerRegistrationOptions as the name
1759         RegistrationOptions is too generic and likely to conflict. Also modernize
1760         ServiceWorkerRegistrationOptions' IPC decoder.
1761
1762         * workers/service/ServiceWorkerContainer.h:
1763         * workers/service/ServiceWorkerJobData.h:
1764         (WebCore::ServiceWorkerJobData::decode):
1765         * workers/service/ServiceWorkerRegistrationOptions.cpp:
1766         (WebCore::ServiceWorkerRegistrationOptions::isolatedCopy const):
1767         * workers/service/ServiceWorkerRegistrationOptions.h:
1768         (WebCore::ServiceWorkerRegistrationOptions::encode const):
1769         (WebCore::ServiceWorkerRegistrationOptions::decode):
1770
1771 2017-11-30  Darin Adler  <darin@apple.com>
1772
1773         [Mac] remove unneeded RetainPtr use introduced in r225142
1774         https://bugs.webkit.org/show_bug.cgi?id=180202
1775
1776         Reviewed by Tim Horton.
1777
1778         * editing/mac/DictionaryLookup.h: Changed out arguments back to NSDictionary ** instead
1779         of RetainPtr because these use autorelease.
1780
1781         * editing/mac/DictionaryLookup.mm:
1782         (WebCore::tokenRange): Use NSDictionary **.
1783         (WebCore::DictionaryLookup::rangeForSelection): Ditto.
1784         (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto.
1785         (WebCore::DictionaryLookup::stringForPDFSelection): Ditto.
1786
1787 2017-11-30  Chris Dumez  <cdumez@apple.com>
1788
1789         Mark ServiceWorkerGlobalScope as final
1790         https://bugs.webkit.org/show_bug.cgi?id=180201
1791
1792         Reviewed by Alex Christensen.
1793
1794         * workers/service/ServiceWorkerGlobalScope.h:
1795
1796 2017-11-30  Zan Dobersek  <zdobersek@igalia.com>
1797
1798         [CoordGraphics] Move CoordinatedGraphicsLayer painting behind Nicosia::PaintingEngine
1799         https://bugs.webkit.org/show_bug.cgi?id=180141
1800
1801         Reviewed by Carlos Garcia Campos.
1802
1803         Introduce a painting engine concept that's used to perform painting
1804         for a given GraphicsLayer object.
1805
1806         The Nicosia::PaintingEngine object is leveraged in the
1807         CoordinatedGraphicsLayer::updateContentBuffers() method. It's retrieved
1808         through the CoordinatedGraphicsLayerClient interface, with a new method
1809         introduced there for this purpose.
1810
1811         The Nicosia::PaintingEngine interface is kept simple for now, with only
1812         a single paint() method. The only current implementation is the
1813         PaintingEngineBasic class, which simply reuses the code that was
1814         previously in CoordinatedGraphicsLayer::updateContentBuffers(),
1815         maintaining the current functionality.
1816
1817         The Nicosia::PaintingEngine::create() function returns a new
1818         PaintingEngine object. For now it defaults to PaintingEngineBasic, but
1819         it could be configured at configure-time or even runtime in the future
1820         to return a more advanced engine implementation.
1821
1822         No new tests -- no change in behavior.
1823
1824         * platform/TextureMapper.cmake:
1825         * platform/graphics/nicosia/NicosiaPaintingEngine.cpp: Added.
1826         (Nicosia::PaintingEngine::create):
1827         * platform/graphics/nicosia/NicosiaPaintingEngine.h: Added.
1828         * platform/graphics/nicosia/NicosiaPaintingEngineBasic.cpp: Added.
1829         (Nicosia::PaintingEngineBasic::paint):
1830         * platform/graphics/nicosia/NicosiaPaintingEngineBasic.h: Added.
1831         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1832         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
1833         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1834
1835 2017-11-30  Adrian Perez de Castro  <aperez@igalia.com>
1836
1837         [GStreamer] Builds fails with ENABLE_VIDEO=OFF due to GStreamer usage
1838         https://bugs.webkit.org/show_bug.cgi?id=179373
1839
1840         Reviewed by Xabier Rodriguez-Calvar.
1841
1842         This allows to build with WebAudio enabled even if video support is
1843         disabled by guarding usage of HTMLMediaElement with ENABLE(VIDEO).
1844
1845         No new tests needed.
1846
1847         * page/DeprecatedGlobalSettings.cpp:
1848         (WebCore::DeprecatedGlobalSettings::setGStreamerEnabled): Guard usage of HTMLMediaElement.
1849
1850 2017-11-29  Chris Dumez  <cdumez@apple.com>
1851
1852         ServiceWorker WebProcess sometimes crashes in JSVMClientData::~JSVMClientData()
1853         https://bugs.webkit.org/show_bug.cgi?id=180173
1854
1855         Reviewed by Alex Christensen.
1856
1857         The leak was caused by EventListeners remaining when destroying the VM, because
1858         JSEventListener refs the DOMWrapperWorld. To address the issue, we now call
1859         removeAllEventListeners() in the stop() method of ServiceWorkerContainer,
1860         ServiceWorkerRegistration and ServiceWorker. Those event listeners are no
1861         longer needed after ActiveDOMObject::stop() is called since the script
1862         execution context is about to be destroyed.
1863
1864         This is the same pattern used in IDBDatabase::stop(), IDBRequest::stop().
1865
1866         No new tests, already covered by existing test.
1867
1868         * workers/service/ServiceWorker.cpp:
1869         (WebCore::ServiceWorker::stop):
1870         * workers/service/ServiceWorkerContainer.cpp:
1871         (WebCore::ServiceWorkerContainer::stop):
1872         * workers/service/ServiceWorkerContainer.h:
1873         * workers/service/ServiceWorkerRegistration.cpp:
1874         (WebCore::ServiceWorkerRegistration::stop):
1875
1876 2017-11-29  Filip Pizlo  <fpizlo@apple.com>
1877
1878         GC should support isoheaps
1879         https://bugs.webkit.org/show_bug.cgi?id=179288
1880
1881         Reviewed by Saam Barati.
1882
1883         No new tests because no new behavior.
1884         
1885         Adopting changes in JSC Subspace API.
1886
1887         * ForwardingHeaders/runtime/JSDestructibleObjectHeapCellType.h: Added.
1888         * ForwardingHeaders/runtime/JSSegmentedVariableObjectHeapCellType.h: Added.
1889         * bindings/js/JSDOMWrapper.cpp:
1890         (WebCore::outputConstraintSubspaceFor):
1891         (WebCore::globalObjectOutputConstraintSubspaceFor):
1892         * bindings/js/JSDOMWrapper.h:
1893         * bindings/js/WebCoreJSClientData.cpp:
1894         (WebCore::JSVMClientData::JSVMClientData):
1895         * bindings/js/WebCoreJSClientData.h:
1896         (WebCore::JSVMClientData::outputConstraintSpace):
1897         (WebCore::JSVMClientData::globalObjectOutputConstraintSpace):
1898         * bindings/scripts/CodeGeneratorJS.pm:
1899         (GenerateHeader):
1900
1901 2017-11-29  Eric Carlson  <eric.carlson@apple.com>
1902
1903         [MediaStream] Clean up audio and video capture factories
1904         https://bugs.webkit.org/show_bug.cgi?id=180156
1905         <rdar://problem/35753435>
1906
1907         Reviewed by Youenn Fablet.
1908
1909         No new tests, no behavior change.
1910
1911         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1912         (WebCore::RealtimeMediaSourceCenter::setAudioFactory): Deleted.
1913         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory): Deleted.
1914         (WebCore::RealtimeMediaSourceCenter::audioFactory): Deleted.
1915         (WebCore::RealtimeMediaSourceCenter::setVideoFactory): Deleted.
1916         (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory): Deleted.
1917         (WebCore::RealtimeMediaSourceCenter::videoFactory): Deleted.
1918         (WebCore::RealtimeMediaSourceCenter::setAudioCaptureDeviceManager): Deleted.
1919         (WebCore::RealtimeMediaSourceCenter::unsetAudioCaptureDeviceManager): Deleted.
1920         (WebCore::RealtimeMediaSourceCenter::audioCaptureDeviceManager): Deleted.
1921         (WebCore::RealtimeMediaSourceCenter::setVideoCaptureDeviceManager): Deleted.
1922         (WebCore::RealtimeMediaSourceCenter::unsetVideoCaptureDeviceManager): Deleted.
1923         (WebCore::RealtimeMediaSourceCenter::videoCaptureDeviceManager): Deleted.
1924         * platform/mediastream/RealtimeMediaSourceCenter.h:
1925         (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
1926         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
1927         * platform/mediastream/RealtimeMediaSourceSettings.cpp:
1928         (WebCore::RealtimeMediaSourceSettings::facingMode):
1929         (WebCore::RealtimeMediaSourceSettings::videoFacingModeEnum):
1930         (WebCore::userFacing): Deleted.
1931         (WebCore::environmentFacing): Deleted.
1932         (WebCore::leftFacing): Deleted.
1933         (WebCore::rightFacing): Deleted.
1934         * platform/mediastream/RealtimeMediaSourceSettings.h:
1935         (WebCore::RealtimeMediaSourceSettings::RealtimeMediaSourceSettings): Deleted.
1936         * platform/mediastream/mac/AVVideoCaptureSource.h:
1937         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1938         (WebCore::AVVideoCaptureSource::create):
1939         (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
1940         (WebCore::AVVideoCaptureSource::setupCaptureSession):
1941         (): Deleted.
1942         (WebCore::AVVideoCaptureSourceFactory::setVideoCapturePageState): Deleted.
1943         (WebCore::avVideoCaptureSourceFactory): Deleted.
1944         (WebCore::AVVideoCaptureSource::factory): Deleted.
1945         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1946         (WebCore::videoCaptureSourceFactory):
1947         (WebCore::RealtimeMediaSourceCenterMac::audioFactory):
1948         (WebCore::RealtimeMediaSourceCenterMac::videoFactory):
1949         (WebCore::RealtimeMediaSourceCenterMac::audioCaptureDeviceManager):
1950         (WebCore::RealtimeMediaSourceCenterMac::videoCaptureDeviceManager):
1951         (WebCore::RealtimeMediaSourceCenterMac::RealtimeMediaSourceCenterMac): Deleted.
1952         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory): Deleted.
1953         (WebCore::RealtimeMediaSourceCenterMac::defaultVideoFactory): Deleted.
1954         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioCaptureDeviceManager): Deleted.
1955         (WebCore::RealtimeMediaSourceCenterMac::defaultVideoCaptureDeviceManager): Deleted.
1956         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
1957         * platform/mock/MockRealtimeAudioSource.cpp:
1958         (WebCore::MockRealtimeAudioSource::~MockRealtimeAudioSource):
1959         (WebCore::MockRealtimeAudioSource::startProducingData):
1960         * platform/mock/MockRealtimeMediaSourceCenter.h:
1961         * platform/mock/MockRealtimeVideoSource.cpp:
1962         (WebCore::MockRealtimeVideoSource::~MockRealtimeVideoSource):
1963         (WebCore::MockRealtimeVideoSource::startProducingData):
1964         * platform/mock/MockRealtimeVideoSource.h:
1965
1966 2017-11-29  Wenson Hsieh  <wenson_hsieh@apple.com>
1967
1968         [Attachment Support] Implement SPI for clients to make an attachment element display in-place
1969         https://bugs.webkit.org/show_bug.cgi?id=180153
1970         <rdar://problem/35735252>
1971
1972         Reviewed by Tim Horton.
1973
1974         Adds SPI support for inserting attachments using in-place display style, and updating display options for
1975         existing attachments. See comments below for more detail.
1976
1977         Tests: WKAttachmentTests.InPlaceImageAttachmentToggleDisplayMode
1978                WKAttachmentTests.InPlaceImageAttachmentParagraphInsertion
1979                WKAttachmentTests.InPlaceVideoAttachmentInsertionWithinList
1980                WKAttachmentTests.InPlacePDFAttachmentCutAndPaste
1981
1982         * WebCore.xcodeproj/project.pbxproj:
1983         * editing/Editor.cpp:
1984         (WebCore::Editor::insertAttachment):
1985         (WebCore::Editor::insertAttachmentFromFile):
1986
1987         Update display options for the attachment before inserting into the document.
1988
1989         * editing/Editor.h:
1990         * html/AttachmentTypes.h: Added.
1991
1992         Add a new header to define the new attachment display types. This lets us avoid importing HTMLAttachmentElement.h
1993         and instead just import AttachmentTypes.h in some places in WebKit that only deal with plumbing
1994         AttachmentDisplayOptions to the web process.
1995
1996         (WebCore::AttachmentDisplayOptions::encode const):
1997         (WebCore::AttachmentDisplayOptions::decode):
1998
1999         Support serializing and deserializing attachment display options.
2000
2001         * html/HTMLAttachmentElement.cpp:
2002         (WebCore::HTMLAttachmentElement::setFile):
2003
2004         Regenerate the shadow root if needed when setting the file.
2005
2006         (WebCore::HTMLAttachmentElement::updateDisplayMode):
2007
2008         Introduce a new method to update the display mode of an attachment element. This builds up the shadow root of
2009         the attachment if it is displayed in-place.
2010
2011         (WebCore::HTMLAttachmentElement::ensureInnerImage):
2012         (WebCore::HTMLAttachmentElement::ensureInnerVideo):
2013
2014         Helpers to insert image and video elements into the shadow root if needed, and return the image or video element.
2015
2016         (WebCore::HTMLAttachmentElement::innerImage const):
2017         (WebCore::HTMLAttachmentElement::innerVideo const):
2018
2019         Helpers to retrieve existing image and video elements in the shadow root.
2020
2021         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
2022
2023         Appends and configures the attachment element's shadow root for inline display, initializing an image or video
2024         element or neither, depending on the attachment type.
2025
2026         * html/HTMLAttachmentElement.h:
2027
2028         Introduce an AttachmentDisplayOptions struct which mirrors _WKAttachmentDisplayOptions in the WebKit layer. For
2029         now, this only contains a display mode enum.
2030
2031         * platform/audio/ios/AudioSessionIOS.mm:
2032
2033         Avoid this AVAudioSession assertion when targeting iOS simulator. AVAudioSession always throws this error when
2034         setting an audio session category in the simulator, even in a basic test app, since AVFoundation doesn't support
2035         audio sessions in the simulator.
2036
2037         (WebCore::AudioSession::setCategory):
2038
2039 2017-11-29  Simon Fraser  <simon.fraser@apple.com>
2040
2041         Missing layer content when animating elements on-screen
2042         https://bugs.webkit.org/show_bug.cgi?id=180178
2043         rdar://problem/34923438
2044
2045         Reviewed by Dean Jackson.
2046
2047         If a delayed animation starts, that animates layers from offscreen, then we would fail
2048         to run the logic that ensures that those layers have backing store.
2049
2050         Fix by ensuring that if any layer starts or ends a transform animation, we re-evaluate
2051         backing store attachment on all its descendants.
2052
2053         I tried to make a test, but layer flushing is timing-sensitive and the test would have taken
2054         5s, and not been reliable. There's a manual test in the bug.
2055
2056         * platform/graphics/ca/GraphicsLayerCA.cpp:
2057         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
2058         * platform/graphics/ca/GraphicsLayerCA.h:
2059
2060 2017-11-29  Youenn Fablet  <youenn@apple.com>
2061
2062         ServiceWorkerClient objects should be reused if there is already one existing with the same identifier
2063         https://bugs.webkit.org/show_bug.cgi?id=180143
2064
2065         Reviewed by Chris Dumez.
2066
2067         Covered by updated tests.
2068
2069         ServiceWorkerGlobalScope keeps a map of all live ServiceWorkerClient objects.
2070         Before creating a new client, it checks whether the map has one such object with the same identifier.
2071         If so, it reuses this object. Otherwise it creates either a ServiceWorkerWindowClient or ServiceWorkerClient.
2072
2073         Add support for using a ServiceWorkerClientIdentifier as a HashMap key.
2074
2075         * workers/service/ServiceWorkerClient.cpp:
2076         (WebCore::ServiceWorkerClient::ServiceWorkerClient):
2077         (WebCore::ServiceWorkerClient::~ServiceWorkerClient):
2078         * workers/service/ServiceWorkerClient.h:
2079         (WebCore::ServiceWorkerClient::getOrCreate):
2080         * workers/service/ServiceWorkerClientIdentifier.h:
2081         (WebCore::ServiceWorkerClientIdentifier::hash const):
2082         (WTF::ServiceWorkerClientIdentifierHash::hash):
2083         (WTF::ServiceWorkerClientIdentifierHash::equal):
2084         (WTF::HashTraits<WebCore::ServiceWorkerClientIdentifier>::emptyValue):
2085         (WTF::HashTraits<WebCore::ServiceWorkerClientIdentifier>::constructDeletedValue):
2086         (WTF::HashTraits<WebCore::ServiceWorkerClientIdentifier>::isDeletedValue):
2087         * workers/service/ServiceWorkerGlobalScope.cpp:
2088         (WebCore::ServiceWorkerGlobalScope::serviceWorkerClient):
2089         (WebCore::ServiceWorkerGlobalScope::addServiceWorkerClient):
2090         (WebCore::ServiceWorkerGlobalScope::removeServiceWorkerClient):
2091         * workers/service/ServiceWorkerGlobalScope.h:
2092         * workers/service/ServiceWorkerWindowClient.cpp:
2093         (WebCore::ServiceWorkerWindowClient::ServiceWorkerWindowClient):
2094         * workers/service/ServiceWorkerWindowClient.h:
2095         * workers/service/context/ServiceWorkerThread.cpp:
2096         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
2097
2098 2017-11-29  Zalan Bujtas  <zalan@apple.com>
2099
2100         Add missing WTF_MAKE_ISO_ALLOCATED macros
2101         https://bugs.webkit.org/show_bug.cgi?id=180165
2102         <rdar://problem/35755617>
2103
2104         Reviewed by Simon Fraser.
2105
2106         * rendering/RenderFrame.h:
2107         * rendering/RenderFullScreen.cpp:
2108         * rendering/RenderIFrame.h:
2109
2110 2017-11-29  Said Abou-Hallawa  <sabouhallawa@apple.com>
2111
2112         Remove the ImageSource from the class hierarchy that connects BitmapImage to ImageFrame
2113         https://bugs.webkit.org/show_bug.cgi?id=175595
2114
2115         Reviewed by Darin Adler.
2116
2117         The class hierarchy that connects BitmapImage to ImageFrame has been
2118         troublesome. ImageSource does not have a clear responsibility other than
2119         a bridge that connects BitmapIamge to ImageFrameCache. Sharing the 
2120         ImageDecoder between ImageSource and ImageFrameCache is ugly and caused
2121         few crashes in the past.
2122
2123         This patch will do the first step for fixing this issue. First get rid of
2124         ImageSource by moving its APIs to ImageFrameCache and BitmapImage. Replace
2125         all the instances of ImageSource by ImageFrameCache. The next step will
2126         be to rename ImageFrameCache to ImageSource. But this will be done in a
2127         follow-up patch
2128
2129         * Sources.txt:
2130         * WebCore.xcodeproj/project.pbxproj:
2131         * platform/graphics/BitmapImage.cpp:
2132         (WebCore::BitmapImage::BitmapImage):
2133         (WebCore::BitmapImage::~BitmapImage):
2134         (WebCore::BitmapImage::destroyDecodedData):
2135         (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
2136         (WebCore::BitmapImage::dataChanged):
2137         (WebCore::BitmapImage::frameImageAtIndexCacheIfNeeded):
2138         (WebCore::BitmapImage::draw):
2139         (WebCore::BitmapImage::canUseAsyncDecodingForLargeImages const):
2140         (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImages const):
2141         (WebCore::BitmapImage::subsamplingLevelForScaleFactor):
2142         (WebCore::BitmapImage::canDestroyDecodedData):
2143         (WebCore::BitmapImage::internalStartAnimation):
2144         (WebCore::BitmapImage::stopAnimation):
2145         (WebCore::BitmapImage::decode):
2146         (WebCore::BitmapImage::imageFrameAvailableAtIndex):
2147         (WebCore::BitmapImage::dump const):
2148         * platform/graphics/BitmapImage.h:
2149         * platform/graphics/GraphicsContext3D.h:
2150         * platform/graphics/ImageFrameCache.cpp:
2151         (WebCore::ImageFrameCache::ImageFrameCache):
2152         (WebCore::ImageFrameCache::ensureDecoderAvailable):
2153         (WebCore::ImageFrameCache::setData):
2154         (WebCore::ImageFrameCache::resetData):
2155         (WebCore::ImageFrameCache::dataChanged):
2156         (WebCore::ImageFrameCache::isAllDataReceived):
2157         (WebCore::ImageFrameCache::clearFrameBufferCache):
2158         (WebCore::ImageFrameCache::canUseAsyncDecoding):
2159         (WebCore::ImageFrameCache::maximumSubsamplingLevel):
2160         (WebCore::ImageFrameCache::setTargetContext):
2161         (WebCore::ImageFrameCache::createFrameImageAtIndex):
2162         (WebCore::ImageFrameCache::dump):
2163         (WebCore::ImageFrameCache::setDecoder): Deleted.
2164         (WebCore::ImageFrameCache::decoder const): Deleted.
2165         * platform/graphics/ImageFrameCache.h:
2166         (WebCore::ImageFrameCache::create):
2167         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex):
2168         * platform/graphics/ImageSource.cpp: Removed.
2169         * platform/graphics/ImageSource.h: Removed.
2170         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
2171         (WebCore::GraphicsContext3D::ImageExtractor::~ImageExtractor):
2172         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
2173         * platform/graphics/cg/GraphicsContext3DCG.cpp:
2174         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
2175         * platform/graphics/cg/ImageSourceCG.h:
2176
2177 2017-11-29  Brady Eidson  <beidson@apple.com>
2178
2179         When managing context startups, make ServiceWorkerJobDataIdentifier's optional.
2180         https://bugs.webkit.org/show_bug.cgi?id=180166
2181
2182         Reviewed by Chris Dumez.
2183
2184         No new tests (No behavior change).
2185
2186         We'll sometimes be starting SW contexts without an associated job, so ServiceWorkerContextData
2187         should not required actually having a job identifier.
2188
2189         * workers/service/ServiceWorkerContextData.h:
2190         (WebCore::ServiceWorkerContextData::decode):
2191
2192         * workers/service/context/SWContextManager.h:
2193
2194         * workers/service/server/SWServer.cpp:
2195         (WebCore::SWServer::scriptContextFailedToStart):
2196         (WebCore::SWServer::scriptContextStarted):
2197         (WebCore::SWServer::didFinishInstall):
2198         * workers/service/server/SWServer.h:
2199
2200         * workers/service/server/SWServerToContextConnection.cpp:
2201         (WebCore::SWServerToContextConnection::scriptContextFailedToStart):
2202         (WebCore::SWServerToContextConnection::scriptContextStarted):
2203         (WebCore::SWServerToContextConnection::didFinishInstall):
2204         * workers/service/server/SWServerToContextConnection.h:
2205
2206         * workers/service/server/SWServerWorker.cpp:
2207         (WebCore::SWServerWorker::scriptContextFailedToStart):
2208         (WebCore::SWServerWorker::scriptContextStarted):
2209         (WebCore::SWServerWorker::didFinishInstall):
2210         * workers/service/server/SWServerWorker.h:
2211
2212 2017-11-29  Youenn Fablet  <youenn@apple.com>
2213
2214         Add support for service worker generated redirections
2215         https://bugs.webkit.org/show_bug.cgi?id=179498
2216
2217         Reviewed by Darin Adler.
2218
2219         Test: http/tests/workers/service/service-worker-redirection-fetch.https.html
2220
2221         Added redirection routines following fetch specification to:
2222         - check whether a response is a redirection
2223         - generate a redirected request from a request and its redirection response.
2224         Added some specific redirect request generation following existing WebKit networking code.
2225
2226         * Modules/fetch/FetchResponse.cpp:
2227         (WebCore::FetchResponse::redirect):
2228         (WebCore::isRedirectStatus): Deleted.
2229         * platform/network/ResourceRequestBase.cpp:
2230         (WebCore::shouldUseGet):
2231         (WebCore::ResourceRequestBase::redirectedRequest const):
2232         * platform/network/ResourceRequestBase.h:
2233         * platform/network/ResourceResponseBase.h:
2234         (WebCore::ResourceResponseBase::isRedirectionStatusCode):
2235         (WebCore::ResourceResponseBase::isRedirection const):
2236
2237 2017-11-29  Chris Dumez  <cdumez@apple.com>
2238
2239         Start exposing self.registration inside service workers
2240         https://bugs.webkit.org/show_bug.cgi?id=180162
2241
2242         Reviewed by Brady Eidson.
2243
2244         Start exposing self.registration inside service workers as per:
2245         - https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope-interface
2246
2247         This is very initial support:
2248         - The operations on the registration (such as update) will reject the promise for now.
2249         - The registration's service workers are not yet populated.
2250
2251         This will be implemented in a follow-up.
2252
2253         Tests: http/tests/workers/service/ServiceWorkerGlobalScope_registration_SameObject.html
2254                http/tests/workers/service/self_registration.html
2255
2256         * bindings/js/JSServiceWorkerGlobalScopeCustom.cpp:
2257         (WebCore::JSServiceWorkerGlobalScope::visitAdditionalChildren):
2258         * workers/service/ServiceWorkerContainer.cpp:
2259         (WebCore::ServiceWorkerContainer::addRegistration):
2260         * workers/service/ServiceWorkerContextData.cpp:
2261         (WebCore::ServiceWorkerContextData::isolatedCopy const):
2262         * workers/service/ServiceWorkerContextData.h:
2263         (WebCore::ServiceWorkerContextData::encode const):
2264         (WebCore::ServiceWorkerContextData::decode):
2265         * workers/service/ServiceWorkerGlobalScope.cpp:
2266         (WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
2267         * workers/service/ServiceWorkerGlobalScope.h:
2268         (WebCore::ServiceWorkerGlobalScope::registration):
2269         * workers/service/server/SWServer.cpp:
2270         (WebCore::SWServer::updateWorker):
2271         (WebCore::SWServer::installContextData):
2272         * workers/service/server/SWServer.h:
2273         * workers/service/server/SWServerJobQueue.cpp:
2274         (WebCore::SWServerJobQueue::scriptFetchFinished):
2275
2276 2017-11-29  Youenn Fablet  <youenn@apple.com>
2277
2278         Add support for FetchEvent.clientId
2279         https://bugs.webkit.org/show_bug.cgi?id=180052
2280
2281         Reviewed by Chris Dumez.
2282
2283         Covered by updated test.
2284
2285         Add script execution context identifier as a FetchOptions parameter.
2286         This is then sent to the service worker process which can then set FetchEvent.clientId appropriately.
2287         If the fetch is for a subresource, clientId is used directly.
2288         If it is a navigation, clientId is set to targetClientId.
2289
2290         * loader/FetchOptions.h:
2291         (WebCore::FetchOptions::encode const):
2292         (WebCore::FetchOptions::decode):
2293         * loader/cache/CachedResourceLoader.cpp:
2294         (WebCore::CachedResourceLoader::prepareFetch):
2295         * loader/cache/CachedResourceRequest.cpp:
2296         (WebCore::CachedResourceRequest::setClientIdentifierIfNeeded):
2297         * loader/cache/CachedResourceRequest.h:
2298         * workers/service/context/ServiceWorkerFetch.cpp:
2299         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
2300         * workers/service/context/ServiceWorkerFetch.h:
2301         * workers/service/context/ServiceWorkerThread.cpp:
2302         (WebCore::ServiceWorkerThread::postFetchTask):
2303         * workers/service/context/ServiceWorkerThread.h:
2304
2305 2017-11-29  Youenn Fablet  <youenn@apple.com>
2306
2307         Flaky crash in WebCore::DOMGuardedObject::clear() during service worker tests
2308         https://bugs.webkit.org/show_bug.cgi?id=180045
2309         <rdar://problem/35737288>
2310
2311         Reviewed by Chris Dumez.
2312
2313         Manually tested by running concurrently service worker tests using FetchEvents which store promise references.
2314
2315         Before the patch, on workers, clearing of DOMGuardedObjects happens at the time WorkerGlobalScope is destroyed.
2316         This is too late as it is expected that the JSDOMGlobalObject is still alive.
2317
2318         This patch adds a clearDOMGuardedObjects method on JSWorkerGlobalScopeBase.
2319         It is called when stopping a WorkerThread, just before releasing the strong reference to JSWorkerGlobalScopeBase.
2320
2321         * bindings/js/JSDOMGuardedObject.h:
2322         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2323         (WebCore::JSWorkerGlobalScopeBase::clearDOMGuardedObjects):
2324         * bindings/js/JSWorkerGlobalScopeBase.h:
2325         * bindings/js/WorkerScriptController.cpp:
2326
2327 2017-11-29  Alex Christensen  <achristensen@webkit.org>
2328
2329         Fix Mac CMake build.
2330
2331         * PlatformMac.cmake:
2332
2333 2017-11-29  Simon Fraser  <simon.fraser@apple.com>
2334
2335         REGRESSION (r213590): Scrolling to anchors broken in web views when content loaded via HTML string
2336         https://bugs.webkit.org/show_bug.cgi?id=180155
2337         rdar://problem/34220827
2338
2339         Reviewed by Zalan Bujtas.
2340         
2341         When content is loaded in a UIWebView or WKWebView via an HTML string, history().currentItem()
2342         is null so itemAllowsScrollRestoration() would return false, preventing scrolling to anchors.
2343
2344         Fix by allowing scroll restoration if the the history item is null.
2345
2346         Tested by WebKit.NoHistoryItemScrollToFragment API test.
2347
2348         * loader/FrameLoader.cpp:
2349         (WebCore::itemAllowsScrollRestoration):
2350
2351 2017-11-29  Chris Dumez  <cdumez@apple.com>
2352
2353         Introduce ServiceWorkerContainer::ensureSWClientConnection()
2354         https://bugs.webkit.org/show_bug.cgi?id=180146
2355
2356         Reviewed by Youenn Fablet.
2357
2358         Introduce ServiceWorkerContainer::ensureSWClientConnection() to reduce
2359         code duplication. Also use callOnMainThread() in preparation for this
2360         getting called from a service worker thread (now that ServiceWorkerContainer
2361         is exposed to service workers). This is needed because constructing the
2362         SWClientConnection initializes the IPC connection from the WebProcess to
2363         the StorageProcess, which involves a synchronous IPC with the UIProcess.
2364         Doing a synchronous IPC from a background thread is unsupported.
2365
2366         * workers/service/ServiceWorkerContainer.cpp:
2367         (WebCore::ServiceWorkerContainer::addRegistration):
2368         (WebCore::ServiceWorkerContainer::getRegistration):
2369         (WebCore::ServiceWorkerContainer::getRegistrations):
2370         (WebCore::ServiceWorkerContainer::ensureSWClientConnection):
2371         * workers/service/ServiceWorkerContainer.h:
2372
2373 2017-11-29  Antoine Quint  <graouts@apple.com>
2374
2375         [iOS] Media controls should stop updating while media is playing in fullscreen
2376         https://bugs.webkit.org/show_bug.cgi?id=180144
2377         <rdar://problem/35060379>
2378
2379         Reviewed by Eric Carlson.
2380
2381         Updating inline media controls while playing media in fullscreen is useless since we're guaranteed not to
2382         have those controls visible, and hurtful since this has impact on battery life. To avoid this, we remove
2383         all media event listeners while in fullscreen on iOS, which will prevent the UI to be udpated since all
2384         updates are driven by media events.
2385
2386         To implement this, we remove the MediaControllerSupport destroy() method and make it a disable() method,
2387         and factor code out of the MediaControllerSupport constructor into an enable() method that registers the
2388         media event listeners. Then, as we enter and exit fullscreen, we call the disable() and enable() method
2389         on the various MediaControllerSupport objects that were created to support the iOS inline media controls.
2390
2391         Test: media/modern-media-controls/media-controller/ios/media-controller-stop-updates-in-fullscreen.html
2392
2393         * Modules/modern-media-controls/media/controls-visibility-support.js:
2394         (ControlsVisibilitySupport):
2395         (ControlsVisibilitySupport.prototype.enable):
2396         (ControlsVisibilitySupport.prototype.disable):
2397         (ControlsVisibilitySupport.prototype.destroy): Deleted.
2398         * Modules/modern-media-controls/media/media-controller-support.js:
2399         (MediaControllerSupport):
2400         (MediaControllerSupport.prototype.enable):
2401         (MediaControllerSupport.prototype.disable):
2402         (MediaControllerSupport.prototype.destroy): Deleted.
2403         * Modules/modern-media-controls/media/media-controller.js:
2404         (MediaController.prototype.handleEvent):
2405         (MediaController.prototype._updateControlsIfNeeded):
2406         (MediaController.prototype._updateSupportingObjectsEnabledState):
2407         (MediaController):
2408
2409 2017-11-29  Simon Fraser  <simon.fraser@apple.com>
2410
2411         Viewport unit values affected by Comand-+ zoom
2412         https://bugs.webkit.org/show_bug.cgi?id=145614
2413
2414         Reviewed by Zalan Bujtas.
2415         
2416         Don't apply zooming when resolving viewport-relative lengths, since they should not
2417         change based on the zoom level.
2418
2419         Test: fast/css/viewport-units-zoom.html
2420
2421         * css/CSSPrimitiveValue.cpp:
2422         (WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):
2423
2424 2017-11-29  Brent Fulgham  <bfulgham@apple.com>
2425
2426         Unreviewed test fix after r225264.
2427         <rdar://problem/35750689>
2428
2429         The changes in r225264 were meant to have no changes in behavior. However, I mistakenly
2430         switched to a secure coding API call in the PlatformPasteboard::write method. This should
2431         have used the 'insecure' version of this function.
2432
2433         * platform/ios/PlatformPasteboardIOS.mm:
2434         (WebCore::PlatformPasteboard::write): 
2435
2436 2017-11-29  Youenn Fablet  <youenn@apple.com>
2437
2438         LibWebRTCPeerConnectionBackend should clean its stats promises when being cleaned
2439         https://bugs.webkit.org/show_bug.cgi?id=180101
2440
2441         Reviewed by Eric Carlson.
2442
2443         No change of behavior.
2444
2445         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2446         (WebCore::LibWebRTCPeerConnectionBackend::doStop): Cleaning stat promises hash map.
2447
2448 2017-11-29  Zan Dobersek  <zdobersek@igalia.com>
2449
2450         [CoordGraphics] Rename CoordinatedBuffer to Nicosia::Buffer
2451         https://bugs.webkit.org/show_bug.cgi?id=180135
2452
2453         Reviewed by Carlos Garcia Campos.
2454
2455         Rename CoordinatedBuffer to Nicosia::Buffer, starting an abstraction
2456         layer that will in the future allow us to prototype and potentially
2457         support different 2D rasterization libraries. The layer is envisioned
2458         as separate from the CoordinatedGraphics code, but will in the mid-term
2459         only be used there.
2460
2461         In order to keep CMake changes to a minimum for now, the source code is
2462         included in the build along with the CoordinatedGraphics source files,
2463         in TextureMapper.cmake.
2464
2465         No new tests -- no change in functionality.
2466
2467         * platform/TextureMapper.cmake:
2468         * platform/graphics/nicosia/NicosiaBuffer.cpp: Renamed from Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp.
2469         (Nicosia::Buffer::create):
2470         (Nicosia::Buffer::Buffer):
2471         (Nicosia::Buffer::context):
2472         (Nicosia::Buffer::uploadImage):
2473         * platform/graphics/nicosia/NicosiaBuffer.h: Renamed from Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBuffer.h.
2474         (Nicosia::Buffer::size const):
2475         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2476         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
2477         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2478         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
2479         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
2480         (WebCore::CoordinatedImageBacking::update):
2481         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
2482         * platform/graphics/texmap/coordinated/Tile.h:
2483
2484 2017-11-29  Antoine Quint  <graouts@apple.com>
2485
2486         Pressing the space bar while watching a fullscreen video doesn't play or pause
2487         https://bugs.webkit.org/show_bug.cgi?id=180033
2488         <rdar://problem/33610443>
2489
2490         Reviewed by Eric Carlson.
2491
2492         We register a "keydown" event to track when the space bar is pressed, and if the media is playing
2493         in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
2494         one of the media controls using the keyboard will not let the events we register for be dispatched
2495         this far along the event dispatch phase.
2496
2497         Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html
2498
2499         * Modules/modern-media-controls/media/media-controller.js:
2500         (MediaController):
2501         (MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
2502         lead to some extraneous unhandled promise console logging that pollutes test output.
2503         (MediaController.prototype.handleEvent):
2504
2505 2017-11-28  Brent Fulgham  <bfulgham@apple.com>
2506
2507         Adopt updated NSKeyed[Un]Archiver API when available
2508         https://bugs.webkit.org/show_bug.cgi?id=180127
2509         <rdar://problem/35710738>
2510
2511         Reviewed by Alex Christensen.
2512
2513         Switch to new NSKeyed[Un]Archiver methods when available. We do not attempt
2514         to adopt secure coding in places we were not under the original API.
2515
2516         Most of the new API is wrapped in a set of convenience methods so we can
2517         build without the new API on older systems.
2518
2519         No change in behavior.
2520
2521         * editing/cocoa/EditorCocoa.mm:
2522         (WebCore::archivedDataForAttributedString): Use new convenience method
2523         to archive the string object.
2524         * loader/archive/cf/LegacyWebArchiveMac.mm:
2525         (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Update to
2526         use secure coding where possible.
2527         (WebCore::LegacyWebArchive::createPropertyListRepresentation): Ditto.
2528         * platform/ios/PlatformPasteboardIOS.mm:
2529         (WebCore::PlatformPasteboard::write): Use new secure API.
2530         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto.
2531         * testing/cocoa/WebArchiveDumpSupport.mm:
2532         (WebCoreTestSupport::createCFURLResponseFromResponseData): Update to
2533         secure coding API where possible.
2534
2535 2017-11-28  Joseph Pecoraro  <pecoraro@apple.com>
2536
2537         Web Inspector: Cleanup Inspector classes be more consistent about using fast malloc / noncopyable
2538         https://bugs.webkit.org/show_bug.cgi?id=180119
2539
2540         Reviewed by Devin Rousso.
2541
2542         * inspector/InspectorCanvas.cpp:
2543         * inspector/InspectorDatabaseResource.cpp:
2544         * inspector/InspectorFrontendClientLocal.cpp:
2545         * inspector/InspectorFrontendClientLocal.h:
2546         * inspector/InspectorFrontendHost.cpp:
2547         * inspector/InspectorHistory.h:
2548         * inspector/InspectorInstrumentation.cpp:
2549         * inspector/InspectorOverlay.cpp:
2550         * inspector/InspectorShaderProgram.cpp:
2551         * inspector/InspectorStyleSheet.cpp:
2552         * inspector/InstrumentingAgents.cpp:
2553         * inspector/PageScriptDebugServer.h:
2554         * inspector/TimelineRecordFactory.cpp:
2555         * inspector/WebInjectedScriptManager.cpp:
2556         * inspector/WebInjectedScriptManager.h:
2557         * inspector/WorkerScriptDebugServer.cpp:
2558         * inspector/WorkerScriptDebugServer.h:
2559         * inspector/agents/*
2560         Be more consistent about namespace / fast malloc / noncopyable.
2561
2562 2017-11-28  Zan Dobersek  <zdobersek@igalia.com>
2563
2564         [Cairo] Limit the number of active contexts in GraphicsContext3DCairo
2565         https://bugs.webkit.org/show_bug.cgi?id=166968
2566
2567         Reviewed by Alex Christensen.
2568
2569         Cairo's implementation of GraphicsContext3D should follow the Mac's
2570         and limit the number of active GraphicsContext3D objects.
2571
2572         The active contexts are listed in a global Deque, with the first
2573         among them being recycled when the GraphicsContext3D::create()
2574         function sees that the limit has been reached. That function still
2575         returns null if even after recycling the number of contexts didn't
2576         decrease.
2577
2578         Finally, in the GraphicsContext3D destructor, the context being
2579         destroyed is removed from the list of active contexts.
2580
2581         No new tests -- relevant tests are now passing.
2582
2583         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
2584         (WebCore::activeContexts):
2585         (WebCore::GraphicsContext3D::create):
2586         (WebCore::GraphicsContext3D::~GraphicsContext3D):
2587
2588 2017-11-28  Zalan Bujtas  <zalan@apple.com>
2589
2590         Clean up spanners before creating nested column context
2591         https://bugs.webkit.org/show_bug.cgi?id=180107
2592         <rdar://problem/35686655>
2593         
2594         Reviewed by Antti Koivisto.
2595
2596         When an existing spanner placeholder is moved into a newly constructed (and nested)
2597         multicolumn context, we figure it's not valid anymore and end up destroying it
2598         (see RenderMultiColumnFlow::fragmentedFlowDescendantInserted).
2599         This is very unfortunate since as we climb back on the stack, we could hit this renderer as
2600         the newly inserted child. 
2601
2602         This patch proactively removes the invalid placeholders and moves the associated spanners back to their
2603         original position. 
2604
2605         Test: fast/multicol/crash-when-constructing-nested-columns.html
2606
2607         * rendering/RenderMultiColumnFlow.h:
2608         * style/RenderTreeUpdaterMultiColumn.cpp:
2609         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow): 
2610         RenderTreeUpdater::MultiColumn::destroyFragmentedFlow still relies on the placeholder removal
2611         logic in RenderMultiColumnFlow::fragmentedFlowDescendantInserted.
2612
2613 2017-11-28  Tim Horton  <timothy_horton@apple.com>
2614
2615         REGRESSION (High Sierra): Layout Test fast/multicol/newmulticol/spanner2.html is a flaky image failure on WK1
2616         https://bugs.webkit.org/show_bug.cgi?id=177826
2617         <rdar://problem/34876498>
2618
2619         Reviewed by Alexey Proskuryakov.
2620
2621         No new tests, fixes some already-broken tests.
2622
2623         * platform/graphics/mac/PDFDocumentImageMac.mm:
2624         (WebCore::PDFDocumentImage::drawPDFPage):
2625         Save and restore one more piece of context state that
2626         PDFKit mutates while drawing.
2627
2628 2017-11-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2629
2630         Allow attachment elements with no appearance to defer rendering to child nodes
2631         https://bugs.webkit.org/show_bug.cgi?id=180117
2632         <rdar://problem/35735339>
2633
2634         Reviewed by Tim Horton.
2635
2636         Test: fast/attachment/attachment-without-appearance.html
2637
2638         When -webkit-appearance: none; is specified on an attachment element, allow it to fall back to rendering its
2639         subtree. Currently, attachment elements without an appearance don't allow this and truncate the render tree at
2640         the RenderAttachment, since RenderAttachment cannot have any children.
2641
2642         In a followup, this will enable us to render a shadow subtree under the attachment element to display in-place
2643         attachment content, and easily toggle between in-place and icon display by changing the appearance.
2644
2645         * html/HTMLAttachmentElement.cpp:
2646         (WebCore::HTMLAttachmentElement::createElementRenderer):
2647
2648         If no appearance is specified, emit a RenderBlockFlow instead of a RenderAttachment.
2649
2650         (WebCore::HTMLAttachmentElement::setFile):
2651         (WebCore::HTMLAttachmentElement::attachmentRenderer const):
2652
2653         Renamed from renderer(). HTMLAttachmentElement::renderer() now uses the superclass' implementation, and no
2654         longer returns a RenderAttachment in all circumstances. Instead, places that expect a RenderAttachment now go
2655         through HTMLAttachmentElement::renderAttachment() instead.
2656
2657         (WebCore::HTMLAttachmentElement::parseAttribute):
2658         * html/HTMLAttachmentElement.h:
2659         * page/DragController.cpp:
2660         (WebCore::DragController::startDrag):
2661         * rendering/RenderAttachment.h:
2662         (WebCore::HTMLAttachmentElement::renderer const): Deleted.
2663
2664 2017-11-28  Youenn Fablet  <youenn@apple.com>
2665
2666         Register Documents as ServiceWorker clients to the StorageProcess
2667         https://bugs.webkit.org/show_bug.cgi?id=180047
2668
2669         Reviewed by Brady Eidson.
2670
2671         No change of behavior.
2672         These changes will be covered when implementing ServiceWorker Clients API.
2673
2674         Registering a document when being created by DocumentLoader.
2675         In the future, we may restrict registration to only documents related to origins that have some ongoing service worker activity.
2676         This would require to keep track of which documents are registered so that we unregister these ones.
2677         This would also require to register existing documents when one of the document with the same origin starts registering a service worker.
2678         Unregistering a document inside prepareForDestruction.
2679
2680         Storing all clients in SWServer as a HasMap keyed by ClientOrigin.
2681         Processing will then iterate through the list of clients scoped by the client origin.
2682
2683         Adding a ClientOrigin class as a pair of top origin and frame origin since service workers will be related based on that information.
2684
2685         * WebCore.xcodeproj/project.pbxproj:
2686         * dom/Document.cpp:
2687         (WebCore::Document::prepareForDestruction):
2688         * loader/DocumentLoader.cpp:
2689         (WebCore::DocumentLoader::commitData):
2690         * page/ClientOrigin.h: Added.
2691         (WebCore::ClientOrigin::emptyKey):
2692         (WebCore::ClientOrigin::hash const):
2693         (WebCore::ClientOrigin::operator== const):
2694         (WTF::ClientOriginKeyHash::hash):
2695         (WTF::ClientOriginKeyHash::equal):
2696         (WTF::HashTraits<WebCore::ClientOrigin>::emptyValue):
2697         (WTF::HashTraits<WebCore::ClientOrigin>::constructDeletedValue):
2698         (WTF::HashTraits<WebCore::ClientOrigin>::isDeletedValue):
2699         * workers/service/ServiceWorkerClientIdentifier.h:
2700         (WebCore::ServiceWorkerClientIdentifier::operator== const):
2701         * workers/service/server/SWClientConnection.h:
2702         * workers/service/server/SWServer.cpp:
2703         (WebCore::SWServer::registerServiceWorkerClient):
2704         (WebCore::SWServer::unregisterServiceWorkerClient):
2705         * workers/service/server/SWServer.h:
2706
2707 2017-11-28  Chris Dumez  <cdumez@apple.com>
2708
2709         ServiceWorkerGlobalScope.clients should always return the same object
2710         https://bugs.webkit.org/show_bug.cgi?id=180116
2711
2712         Reviewed by Geoffrey Garen.
2713
2714         ServiceWorkerGlobalScope.clients should always return the same object, as per the specification:
2715         - https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope-interface
2716
2717         Test: http/tests/workers/service/ServiceWorkerGlobalScope_clients_SameObject.html
2718
2719         * Sources.txt:
2720         * WebCore.xcodeproj/project.pbxproj:
2721         * bindings/js/JSServiceWorkerGlobalScopeCustom.cpp: Added.
2722         (WebCore::JSServiceWorkerGlobalScope::visitAdditionalChildren):
2723         * workers/service/ServiceWorkerClients.idl:
2724         * workers/service/ServiceWorkerGlobalScope.idl:
2725
2726 2017-11-28  Chris Dumez  <cdumez@apple.com>
2727
2728         Get rid of ServiceWorker::allWorkers() hashmap
2729         https://bugs.webkit.org/show_bug.cgi?id=180111
2730
2731         Reviewed by Brady Eidson.
2732
2733         Get rid of ServiceWorker::allWorkers() hashmap as it is not thread safe and we'll soon have
2734         ServiceWorker objects living in various service worker threads.
2735
2736         Instead, we now have a per-ScriptExecutionContext map, which is inherently thread-safe.
2737
2738         No new tests, no web-facing behavior change.
2739
2740         * dom/ScriptExecutionContext.cpp:
2741         (WebCore::ScriptExecutionContext::registerServiceWorker):
2742         (WebCore::ScriptExecutionContext::unregisterServiceWorker):
2743         * dom/ScriptExecutionContext.h:
2744         (WebCore::ScriptExecutionContext::serviceWorker):
2745         * workers/service/ServiceWorker.cpp:
2746         (WebCore::ServiceWorker::getOrCreate):
2747         (WebCore::ServiceWorker::ServiceWorker):
2748         (WebCore::ServiceWorker::~ServiceWorker):
2749         (WebCore::ServiceWorker::stop):
2750         * workers/service/ServiceWorker.h:
2751         * workers/service/server/SWClientConnection.cpp:
2752         (WebCore::SWClientConnection::updateWorkerState):
2753
2754 2017-11-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
2755
2756         [CG] PostScript images should be supported if they are sub-resource images
2757         https://bugs.webkit.org/show_bug.cgi?id=178502
2758         <rdar://problem/35102988>
2759
2760         Reviewed by Simon Fraser.
2761
2762         Make CachedImage detect the PostScript mime type and the file extension.
2763         Let PDFDocumentImage replaces the PostScript data with the equivalent PDF
2764         data and use it when creating the PDFDocument.
2765
2766         Test: fast/images/eps-as-image.html
2767
2768         * WebCore.xcodeproj/project.pbxproj:
2769         * loader/cache/CachedImage.cpp:
2770         (WebCore::CachedImage::isPDFRequest const):
2771         (WebCore::CachedImage::isPostScriptRequest const):
2772         These functions return whether the request is for a PDF or a PostScript 
2773         image. They check for the same conditions we do in WebPage::createPlugin().
2774
2775         (WebCore::CachedImage::createImage): Create a PDFDocumentImage for either
2776         a PDF or a PostScript image. For PostScript, the data will be converted
2777         to PDF when all the data is received.
2778
2779         (WebCore::CachedImage::updateBufferInternal): Use the size() of m_data
2780         instead of using the m_image->data() to setEncodedSize(). Image::m_data
2781         and CachedImage::m_data point to the same SharedBuffer.
2782
2783         (WebCore::CachedImage::convertedDataIfNeeded const): Convert the PostScript
2784         data to PDF if the system can convert it. If the same can't convert it,
2785         return null so loading the image will be canceled.
2786
2787         (WebCore::CachedImage::updateImageData): Get rid of the data argument since
2788         we always send the member m_data to this function.
2789
2790         (WebCore::CachedImage::finishLoading): Convert the PostScript data to PDF 
2791         data since all the data is received. Use m_data to set setEncodedSize().
2792
2793         * loader/cache/CachedImage.h:
2794         * platform/MIMETypeRegistry.cpp:
2795         (WebCore::MIMETypeRegistry::isPostScriptMIMEType):
2796         (WebCore::MIMETypeRegistry::isPDFOrPostScriptMIMEType):
2797         * platform/MIMETypeRegistry.h:
2798         * platform/graphics/cg/PDFDocumentImage.cpp:
2799         (WebCore::PDFDocumentImage::PDFDocumentImage):
2800         (WebCore::PDFDocumentImage::convertPostScriptDataToPDF):
2801         * platform/graphics/cg/PDFDocumentImage.h:
2802
2803 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2804
2805         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
2806         https://bugs.webkit.org/show_bug.cgi?id=173793
2807
2808         Reviewed by Joseph Pecoraro.
2809
2810         Based on patch by Brian Burg.
2811
2812         * ForwardingHeaders/inspector/InspectorValues.h: Removed.
2813         * Modules/encryptedmedia/InitDataRegistry.cpp:
2814         (WebCore::extractKeyIDsKeyids):
2815         (WebCore::sanitizeKeyids):
2816         * html/parser/XSSAuditorDelegate.cpp:
2817         (WebCore::XSSAuditorDelegate::generateViolationReport):
2818         * inspector/CommandLineAPIHost.cpp:
2819         (WebCore::CommandLineAPIHost::inspect):
2820         * inspector/CommandLineAPIHost.h:
2821         * inspector/InspectorCanvas.cpp:
2822         (WebCore::InspectorCanvas::recordAction):
2823         (WebCore::InspectorCanvas::releaseData):
2824         (WebCore::InspectorCanvas::indexForData):
2825         (WebCore::buildArrayForVector):
2826         (WebCore::InspectorCanvas::buildInitialState):
2827         (WebCore::InspectorCanvas::buildAction):
2828         (WebCore::InspectorCanvas::buildArrayForCanvasGradient):
2829         (WebCore::InspectorCanvas::buildArrayForCanvasPattern):
2830         (WebCore::InspectorCanvas::buildArrayForImageData):
2831         (WebCore::InspectorCanvas::buildArrayForImageBitmap):
2832         * inspector/InspectorCanvas.h:
2833         * inspector/InspectorDatabaseResource.cpp:
2834         * inspector/InspectorOverlay.cpp:
2835         (WebCore::evaluateCommandInOverlay):
2836         (WebCore::InspectorOverlay::evaluateInOverlay):
2837         * inspector/InspectorOverlay.h:
2838         * inspector/InspectorShaderProgram.h:
2839         * inspector/InspectorStyleSheet.h:
2840         (WebCore::InspectorCSSId::InspectorCSSId):
2841         * inspector/TimelineRecordFactory.cpp:
2842         (WebCore::TimelineRecordFactory::createGenericRecord):
2843         (WebCore::TimelineRecordFactory::createFunctionCallData):
2844         (WebCore::TimelineRecordFactory::createConsoleProfileData):
2845         (WebCore::TimelineRecordFactory::createProbeSampleData):
2846         (WebCore::TimelineRecordFactory::createEventDispatchData):
2847         (WebCore::TimelineRecordFactory::createGenericTimerData):
2848         (WebCore::TimelineRecordFactory::createTimerInstallData):
2849         (WebCore::TimelineRecordFactory::createEvaluateScriptData):
2850         (WebCore::TimelineRecordFactory::createTimeStampData):
2851         (WebCore::TimelineRecordFactory::createAnimationFrameData):
2852         (WebCore::createQuad):
2853         (WebCore::TimelineRecordFactory::createPaintData):
2854         (WebCore::TimelineRecordFactory::appendLayoutRoot):
2855         * inspector/TimelineRecordFactory.h:
2856         * inspector/agents/InspectorApplicationCacheAgent.cpp:
2857         * inspector/agents/InspectorApplicationCacheAgent.h:
2858         * inspector/agents/InspectorCSSAgent.cpp:
2859         (WebCore::computePseudoClassMask):
2860         (WebCore::InspectorCSSAgent::setStyleText):
2861         (WebCore::InspectorCSSAgent::setRuleSelector):
2862         (WebCore::InspectorCSSAgent::forcePseudoState):
2863         * inspector/agents/InspectorCSSAgent.h:
2864         * inspector/agents/InspectorDOMAgent.cpp:
2865         (WebCore::parseColor):
2866         (WebCore::parseConfigColor):
2867         (WebCore::parseQuad):
2868         (WebCore::InspectorDOMAgent::performSearch):
2869         (WebCore::InspectorDOMAgent::setSearchingForNode):
2870         (WebCore::InspectorDOMAgent::highlightConfigFromInspectorObject):
2871         (WebCore::InspectorDOMAgent::setInspectModeEnabled):
2872         (WebCore::InspectorDOMAgent::highlightRect):
2873         (WebCore::InspectorDOMAgent::highlightQuad):
2874         (WebCore::InspectorDOMAgent::innerHighlightQuad):
2875         (WebCore::InspectorDOMAgent::highlightSelector):
2876         (WebCore::InspectorDOMAgent::highlightNode):
2877         (WebCore::InspectorDOMAgent::highlightNodeList):
2878         (WebCore::InspectorDOMAgent::highlightFrame):
2879         * inspector/agents/InspectorDOMAgent.h:
2880         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
2881         (WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr):
2882         (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode):
2883         (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode):
2884         (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr):
2885         (WebCore::InspectorDOMDebuggerAgent::descriptionForDOMEvent):
2886         (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded):
2887         (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
2888         * inspector/agents/InspectorDOMDebuggerAgent.h:
2889         * inspector/agents/InspectorDOMStorageAgent.cpp:
2890         (WebCore::InspectorDOMStorageAgent::getDOMStorageItems):
2891         (WebCore::InspectorDOMStorageAgent::setDOMStorageItem):
2892         (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem):
2893         (WebCore::InspectorDOMStorageAgent::findStorageArea):
2894         * inspector/agents/InspectorDOMStorageAgent.h:
2895         * inspector/agents/InspectorDatabaseAgent.cpp:
2896         * inspector/agents/InspectorIndexedDBAgent.cpp:
2897         (WebCore::Inspector::idbKeyFromInspectorObject):
2898         (WebCore::Inspector::idbKeyRangeFromKeyRange):
2899         (WebCore::InspectorIndexedDBAgent::requestData):
2900         * inspector/agents/InspectorIndexedDBAgent.h:
2901         * inspector/agents/InspectorNetworkAgent.cpp:
2902         (WebCore::buildObjectForHeaders):
2903         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
2904         (WebCore::InspectorNetworkAgent::setExtraHTTPHeaders):
2905         * inspector/agents/InspectorNetworkAgent.h:
2906         * inspector/agents/InspectorPageAgent.cpp:
2907         * inspector/agents/InspectorPageAgent.h:
2908         * inspector/agents/InspectorTimelineAgent.cpp:
2909         (WebCore::InspectorTimelineAgent::setInstruments):
2910         (WebCore::InspectorTimelineAgent::internalStart):
2911         (WebCore::InspectorTimelineAgent::didInvalidateLayout):
2912         (WebCore::InspectorTimelineAgent::willLayout):
2913         (WebCore::InspectorTimelineAgent::didScheduleStyleRecalculation):
2914         (WebCore::InspectorTimelineAgent::willRecalculateStyle):
2915         (WebCore::InspectorTimelineAgent::willComposite):
2916         (WebCore::InspectorTimelineAgent::willPaint):
2917         (WebCore::InspectorTimelineAgent::addRecordToTimeline):
2918         (WebCore::InspectorTimelineAgent::setFrameIdentifier):
2919         (WebCore::InspectorTimelineAgent::appendRecord):
2920         (WebCore::InspectorTimelineAgent::sendEvent):
2921         (WebCore::InspectorTimelineAgent::createRecordEntry):
2922         (WebCore::InspectorTimelineAgent::pushCurrentRecord):
2923         * inspector/agents/InspectorTimelineAgent.h:
2924         * page/csp/ContentSecurityPolicy.cpp:
2925         (WebCore::ContentSecurityPolicy::reportViolation const):
2926         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
2927         (WebCore::parseJSONObject):
2928         (WebCore::parseLicenseFormat):
2929         (WebCore::parseLicenseReleaseAcknowledgementFormat):
2930         (WebCore::CDMInstanceClearKey::updateLicense):
2931         (WebCore::CDMInstanceClearKey::removeSessionData):
2932         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
2933         (WebCore::extractSinfData):
2934         * testing/Internals.cpp:
2935
2936 2017-11-28  Simon Fraser  <simon.fraser@apple.com>
2937
2938         Use the TextStream indent manipulator in more places
2939         https://bugs.webkit.org/show_bug.cgi?id=180065
2940
2941         Reviewed by Sam Weinig.
2942
2943         Replace writeIndent() with << indent, and use an IndentScope in a few places.
2944
2945         * dom/ViewportArguments.cpp:
2946         (WebCore::operator<<):
2947         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
2948         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties const):
2949         * page/scrolling/ScrollingStateNode.cpp:
2950         (WebCore::ScrollingStateNode::dump const):
2951         * platform/graphics/FloatRoundedRect.cpp:
2952         (WebCore::operator<<):
2953         * platform/graphics/transforms/TransformationMatrix.cpp:
2954         (WebCore::operator<<):
2955
2956 2017-11-28  Noah Chase  <nchase@gmail.com>
2957
2958         Web Audio's AnalyserNode.fftSize cannot be greater than 2048 in Safari; spec says it can be up to 32768
2959         https://bugs.webkit.org/show_bug.cgi?id=180040
2960
2961         Reviewed by Alex Christensen.
2962
2963         I fixed up the existing test/output for realtimeanalyser-fft-sizing.
2964         one thing that I'm a bit unsure of here is whether or not there are other
2965         places in WebKit's Web Audio implementation that use fftSize and
2966         should have the wider range available (instead of capping out at
2967         2048). based on a quick naive scan I think that there are.
2968
2969         * Modules/webaudio/RealtimeAnalyser.cpp:
2970
2971 2017-11-28  Daniel Bates  <dabates@apple.com>
2972
2973         Add WebKitAdditions extension point to add user-agent stylesheet
2974         https://bugs.webkit.org/show_bug.cgi?id=179702
2975         <rdar://problem/35711147>
2976
2977         Reviewed by Andy Estes.
2978
2979         * DerivedSources.make: Write user agent stylesheet generation recipe in terms of the
2980         automatic variable $^, which represents the list of the names of all prerequisites
2981         for the rule. Make automatically expands the names in $^ up to their full absolute
2982         path.
2983
2984 2017-11-28  Daniel Bates  <dabates@apple.com>
2985
2986         [Cocoa] First pass at implementing alternative presentation button element
2987         https://bugs.webkit.org/show_bug.cgi?id=179785
2988         Part of <rdar://problem/34917108>
2989
2990         Reviewed by Brent Fulgham.
2991
2992         Implement support for substituting a button for one or more elements in a page.
2993         This is a first pass. We will refine the logic and the API/SPI in subsequent
2994         commits.
2995
2996         Tests: accessibility/alternative-presentation-button-input-type.html
2997                accessibility/alternative-presentation-button.html
2998                fast/forms/alternative-presentation-button/replace-and-remove.html
2999                fast/forms/alternative-presentation-button/replacement.html
3000
3001         * English.lproj/Localizable.strings: Add placeholder strings for localization.
3002         * SourcesCocoa.txt: Add some files.
3003         * WebCore.xcodeproj/project.pbxproj: Ditto.
3004         * dom/Element.h:
3005         * editing/Editor.cpp:
3006         (WebCore::Editor::clear): Clear out all substitutions. This is called whenever
3007         we are navigating between pages.
3008         (WebCore::Editor::substituteWithAlternativePresentationButton): Added.
3009         (WebCore::Editor::removeAlternativePresentationButton): Added.
3010         (WebCore::Editor::didInsertAlternativePresentationButtonElement): Added.
3011         (WebCore::Editor::didRemoveAlternativePresentationButtonElement): Added.
3012         * editing/Editor.h:
3013         * editing/cocoa/AlternativePresentationButtonSubstitution.cpp: Added.
3014         (WebCore::AlternativePresentationButtonSubstitution::AlternativePresentationButtonSubstitution):
3015         (WebCore::AlternativePresentationButtonSubstitution::initializeSavedDisplayStyles):
3016         (WebCore::AlternativePresentationButtonSubstitution::apply):
3017         (WebCore::AlternativePresentationButtonSubstitution::unapply):
3018         * editing/cocoa/AlternativePresentationButtonSubstitution.h:
3019         * html/HTMLInputElement.cpp:
3020         (WebCore::HTMLInputElement::alternativePresentationButtonElement const): Added.
3021         (WebCore::HTMLInputElement::setTypeWithoutUpdatingAttribute): Added.
3022         (WebCore::HTMLInputElement::createInputType): Extracted the logic to create the InputType from
3023         HTMLInputElement::updateType() to here and added logic to create the input type for the
3024         alternative presentation button. This input type is not web exposed.
3025         (WebCore::HTMLInputElement::updateType): Modified to take the name of the InputType object to
3026         create as an argument and pass it through to HTMLInputElement::createInputType() to actually
3027         create it. Reordered the logic for destroying the shadow tree of the old InputType, deallocating
3028         the old InputType, and assigning the new InputType such that we assign the new InputType,
3029         destroy the shadow tree of the old InputType, and deallocate the old InputType. This ordering
3030         allows AlternativePresentationButtonSubstitution::substitute() to avoid restoring the input
3031         type saved before the substitution when the input type is changed by the page as opposed to
3032         by SPI.
3033         (WebCore::HTMLInputElement::parseAttribute): Pass the parsed type.
3034         (WebCore::HTMLInputElement::willAttachRenderers): Ditto.
3035         * html/HTMLInputElement.h: Change visibility of removeShadowRoot() from private to public so
3036         that it can be called from AlternativePresentationButtonSubstitution.
3037         * html/InputType.h:
3038         (WebCore::InputType::alternativePresentationButtonElement const): Added.
3039         * html/InputTypeNames.cpp:
3040         (WebCore::InputTypeNames::alternativePresentationButton): Added.
3041         * html/InputTypeNames.h:
3042         * html/shadow/cocoa/AlternativePresentationButtonElement.cpp: Added.
3043         (WebCore::AlternativePresentationButtonElement::create):
3044         (WebCore::AlternativePresentationButtonElement::AlternativePresentationButtonElement):
3045         (WebCore::AlternativePresentationButtonElement::insertedIntoAncestor):
3046         (WebCore::AlternativePresentationButtonElement::removedFromAncestor):
3047         (WebCore::AlternativePresentationButtonElement::didFinishInsertingNode):
3048         (WebCore::AlternativePresentationButtonElement::defaultEventHandler):
3049         * html/shadow/cocoa/AlternativePresentationButtonElement.h:
3050         * html/shadow/cocoa/AlternativePresentationButtonInputType.cpp: Added.
3051         (WebCore::AlternativePresentationButtonInputType::AlternativePresentationButtonInputType):
3052         (WebCore::AlternativePresentationButtonInputType::formControlType const):
3053         (WebCore::AlternativePresentationButtonInputType::appendFormData const):
3054         (WebCore::AlternativePresentationButtonInputType::supportsValidation const):
3055         (WebCore::AlternativePresentationButtonInputType::isTextButton const):
3056         (WebCore::AlternativePresentationButtonInputType::alternativePresentationButtonElement const):
3057         (WebCore::AlternativePresentationButtonInputType::createShadowSubtree):
3058         (WebCore::AlternativePresentationButtonInputType::destroyShadowSubtree):
3059         * html/shadow/cocoa/AlternativePresentationButtonInputType.h:
3060         * page/ChromeClient.h:
3061         * platform/LocalizedStrings.cpp:
3062         (WebCore::AXAlternativePresentationButtonLabel):
3063         (WebCore::alternativePresentationButtonTitle):
3064         (WebCore::alternativePresentationButtonSubtitle):
3065         * platform/LocalizedStrings.h:
3066         * testing/Internals.cpp:
3067         (WebCore::Internals::substituteWithAlternativePresentationButton): Added.
3068         (WebCore::Internals::removeAlternativePresentationButton): Added.
3069         * testing/Internals.h:
3070         * testing/Internals.idl:
3071
3072 2017-11-28  Commit Queue  <commit-queue@webkit.org>
3073
3074         Unreviewed, rolling out r225209.
3075         https://bugs.webkit.org/show_bug.cgi?id=180092
3076
3077         Tests are still timing out (Requested by ap on #webkit).
3078
3079         Reverted changeset:
3080
3081         "Pressing the space bar while watching a fullscreen video
3082         doesn't play or pause"
3083         https://bugs.webkit.org/show_bug.cgi?id=180033
3084         https://trac.webkit.org/changeset/225209
3085
3086 2017-11-28  Chris Dumez  <cdumez@apple.com>
3087
3088         Start exposing navigator.serviceWorker inside service workers
3089         https://bugs.webkit.org/show_bug.cgi?id=180087
3090
3091         Reviewed by Brady Eidson.
3092
3093         Start exposing navigator.serviceWorker inside service workers as per:
3094         - https://w3c.github.io/ServiceWorker/#navigator-serviceworker
3095
3096         Although the property is now exposed, the API on ServiceWorkerContainer is not
3097         supported yet inside service workers and the promise will be rejected. This will
3098         be implemented in a follow-up.
3099
3100         Test: http/tests/workers/service/WorkerNavigator_serviceWorker.html
3101
3102         * Sources.txt:
3103         * WebCore.xcodeproj/project.pbxproj:
3104         * bindings/js/JSWorkerNavigatorCustom.cpp: Added.
3105         (WebCore::JSWorkerNavigator::visitAdditionalChildren):
3106         * page/WorkerNavigator.idl:
3107         * workers/service/ServiceWorker.idl:
3108         * workers/service/ServiceWorkerContainer.cpp:
3109         (WebCore::ServiceWorkerContainer::controller const):
3110         (WebCore::ServiceWorkerContainer::addRegistration):
3111         (WebCore::ServiceWorkerContainer::getRegistration):
3112         (WebCore::ServiceWorkerContainer::getRegistrations):
3113         * workers/service/ServiceWorkerContainer.idl:
3114         * workers/service/ServiceWorkerRegistration.cpp:
3115         (WebCore::ServiceWorkerRegistration::update):
3116         (WebCore::ServiceWorkerRegistration::unregister):
3117         * workers/service/ServiceWorkerRegistration.idl:
3118
3119 2017-11-28  Simon Fraser  <simon.fraser@apple.com>
3120
3121         Modernize GraphicsLayer dumping
3122         https://bugs.webkit.org/show_bug.cgi?id=180067
3123
3124         Reviewed by Sam Weinig.
3125
3126         Use the indent stream manipulator, and TextStream's built-in indent amount
3127         for GraphicsLayer dumping.
3128
3129         * platform/graphics/GraphicsLayer.cpp:
3130         (WebCore::GraphicsLayer::dumpLayer const):
3131         (WebCore::dumpChildren):
3132         (WebCore::GraphicsLayer::dumpProperties const):
3133         (WebCore::GraphicsLayer::layerTreeAsText const):
3134         * platform/graphics/GraphicsLayer.h:
3135         (WebCore::GraphicsLayer::dumpAdditionalProperties const):
3136         * platform/graphics/ca/GraphicsLayerCA.cpp:
3137         (WebCore::dumpInnerLayer):
3138         (WebCore::GraphicsLayerCA::dumpAdditionalProperties const):
3139         * platform/graphics/ca/GraphicsLayerCA.h:
3140
3141 2017-11-28  Antoine Quint  <graouts@apple.com>
3142
3143         Remove dead debugging code in modern media controls
3144         https://bugs.webkit.org/show_bug.cgi?id=180079
3145
3146         Reviewed by Eric Carlson.
3147
3148         This debug utility is no longer necessary and is just dead code.
3149
3150         * Modules/modern-media-controls/controls/scheduler.js:
3151         (const.scheduler.new.prototype.scheduleLayout):
3152         (const.scheduler.new.prototype.unscheduleLayout):
3153         (const.scheduler.new.prototype._requestFrameIfNeeded):
3154         (const.scheduler.new.prototype._frameDidFire):
3155         (const.scheduler.new.prototype._layout):
3156
3157 2017-11-28  Antoine Quint  <graouts@apple.com>
3158
3159         Skip back and forward buttons should not hard-code their numeric amount in localised strings
3160         https://bugs.webkit.org/show_bug.cgi?id=180077
3161
3162         Reviewed by Eric Carlson.
3163
3164         Split out the numeric value used in the skip forward and skip back localized strings to make
3165         it easier to localized the numeric value itself.
3166
3167         Test: media/modern-media-controls/localized-strings/replaced-string.html
3168
3169         * English.lproj/modern-media-controls-localized-strings.js:
3170         * Modules/modern-media-controls/main.js:
3171         (UIString):
3172
3173 2017-11-28  Antoine Quint  <graouts@apple.com>
3174
3175         Pressing the space bar while watching a fullscreen video doesn't play or pause
3176         https://bugs.webkit.org/show_bug.cgi?id=180033
3177         <rdar://problem/33610443>
3178
3179         Reviewed by Eric Carlson.
3180
3181         We register a "keydown" event to track when the space bar is pressed, and if the media is playing
3182         in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
3183         one of the media controls using the keyboard will not let the events we register for be dispatched
3184         this far along the event dispatch phase.
3185
3186         Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html
3187
3188         * Modules/modern-media-controls/media/media-controller.js:
3189         (MediaController):
3190         (MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
3191         lead to some extraneous unhandled promise console logging that pollutes test output.
3192         (MediaController.prototype.handleEvent):
3193
3194 2017-11-27  Tim Horton  <timothy_horton@apple.com>
3195
3196         Web Content process crashes when dragging a link in recovery mode
3197         https://bugs.webkit.org/show_bug.cgi?id=180058
3198         <rdar://problem/35172170>
3199
3200         Reviewed by Alexey Proskuryakov.
3201
3202         * platform/mac/DragImageMac.mm:
3203         (WebCore::LinkImageLayout::LinkImageLayout):
3204         LinkPresentation isn't available in the base system. Make it optional,
3205         and fall back to the full URL like we do on platforms where it doesn't
3206         exist at all.
3207
3208 2017-11-27  Chris Dumez  <cdumez@apple.com>
3209
3210         Move callOnMainThreadAndWait() from SocketStreamHandleImplCFNet.cpp to MainThread.h
3211         https://bugs.webkit.org/show_bug.cgi?id=180060
3212
3213         Reviewed by Alex Christensen.
3214
3215         Move callOnMainThreadAndWait() from SocketStreamHandleImplCFNet.cpp to MainThread.h so that it can be reused.
3216
3217         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
3218         (WebCore::callOnMainThreadAndWait): Deleted.
3219
3220 2017-11-27  Matt Lewis  <jlewis3@apple.com>
3221
3222         Unreviewed, rolling out r225201.
3223
3224         This caused multiple tests to timeout consistently.
3225
3226         Reverted changeset:
3227
3228         "Pressing the space bar while watching a fullscreen video
3229         doesn't play or pause"
3230         https://bugs.webkit.org/show_bug.cgi?id=180033
3231         https://trac.webkit.org/changeset/225201
3232
3233 2017-11-27  Chris Dumez  <cdumez@apple.com>
3234
3235         NavigatorBase::serviceWorker() should return a reference instead of a raw pointer
3236         https://bugs.webkit.org/show_bug.cgi?id=180059
3237
3238         Reviewed by Geoffrey Garen.
3239
3240         NavigatorBase::serviceWorker() should return a reference instead of a raw pointer
3241         as it can never return null.
3242
3243         * bindings/js/JSNavigatorCustom.cpp:
3244         (WebCore::JSNavigator::visitAdditionalChildren):
3245         * dom/ScriptExecutionContext.cpp:
3246         (WebCore::ScriptExecutionContext::serviceWorkerContainer):
3247         * page/NavigatorBase.cpp:
3248         (WebCore::NavigatorBase::serviceWorker):
3249         * page/NavigatorBase.h:
3250
3251 2017-11-27  Antoine Quint  <graouts@apple.com>
3252
3253         Pressing the space bar while watching a fullscreen video doesn't play or pause
3254         https://bugs.webkit.org/show_bug.cgi?id=180033
3255         <rdar://problem/33610443>
3256
3257         Reviewed by Eric Carlson.
3258
3259         We register a "keydown" event to track when the space bar is pressed, and if the media is playing
3260         in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
3261         one of the media controls using the keyboard will not let the events we register for be dispatched
3262         this far along the event dispatch phase.
3263
3264         Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html
3265
3266         * Modules/modern-media-controls/media/media-controller.js:
3267         (MediaController):
3268         (MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
3269         lead to some extraneous unhandled promise console logging that pollutes test output.
3270         (MediaController.prototype.handleEvent):
3271
3272 2017-11-27  Matt Lewis  <jlewis3@apple.com>
3273
3274         Unreviewed, rolling out r225173.
3275
3276         This caused multiple tests to timeout consistently.
3277
3278         Reverted changeset:
3279
3280         "Pressing the space bar while watching a fullscreen video
3281         doesn't play or pause"
3282         https://bugs.webkit.org/show_bug.cgi?id=180033
3283         https://trac.webkit.org/changeset/225173
3284
3285 2017-11-27  Chris Dumez  <cdumez@apple.com>
3286
3287         ASSERTION FAILED: addResult.isNewEntry WebCore::SWServerRegistration::addClientUsingRegistration(WebCore::ServiceWorkerClientIdentifier const&) + 141
3288         https://bugs.webkit.org/show_bug.cgi?id=180049
3289
3290         Reviewed by Brady Eidson.
3291
3292         SWServer::serviceWorkerStoppedControllingClient() was failing to remove the client from the
3293         SWServerRegistration in some cases. This is because we relied on the Service Worker Identifier
3294         to get the SWServerRegistration, via the corresponding SWServerServiceWorker object. However,
3295         It is possible for the SWServerServiceWorker to have been destroyed already.
3296
3297         In serviceWorkerStartedControllingClient / serviceWorkerStoppedControllingClient, we now
3298         pass the registration identifier, so that we are able to look up the registration directly,
3299         without going through the service worker object.
3300
3301         No new tests, already covered by imported/w3c/web-platform-tests/service-workers/service-worker/claim-affect-other-registration.https.html.
3302
3303         * dom/ScriptExecutionContext.cpp:
3304         (WebCore::ScriptExecutionContext::setActiveServiceWorker):
3305         * workers/service/ServiceWorker.h:
3306         * workers/service/ServiceWorkerContainer.cpp:
3307         (WebCore::ServiceWorkerContainer::addRegistration):
3308         (WebCore::ServiceWorkerContainer::removeRegistration):
3309         * workers/service/ServiceWorkerData.cpp:
3310         (WebCore::ServiceWorkerData::isolatedCopy const):
3311         * workers/service/ServiceWorkerData.h:
3312         (WebCore::ServiceWorkerData::encode const):
3313         (WebCore::ServiceWorkerData::decode):
3314         * workers/service/server/SWClientConnection.h:
3315         * workers/service/server/SWServer.cpp:
3316         (WebCore::SWServer::addRegistration):
3317         (WebCore::SWServer::removeRegistration):
3318         (WebCore::SWServer::clearAll):
3319         (WebCore::SWServer::Connection::addServiceWorkerRegistrationInServer):
3320         (WebCore::SWServer::Connection::removeServiceWorkerRegistrationInServer):
3321         (WebCore::SWServer::Connection::serviceWorkerStartedControllingClient):
3322         (WebCore::SWServer::Connection::serviceWorkerStoppedControllingClient):
3323         (WebCore::SWServer::addClientServiceWorkerRegistration):
3324         (WebCore::SWServer::removeClientServiceWorkerRegistration):
3325         (WebCore::SWServer::serviceWorkerStartedControllingClient):
3326         (WebCore::SWServer::serviceWorkerStoppedControllingClient):
3327         (WebCore::SWServer::installContextData):
3328         * workers/service/server/SWServer.h:
3329         * workers/service/server/SWServerWorker.cpp:
3330         (WebCore::SWServerWorker::SWServerWorker):
3331         * workers/service/server/SWServerWorker.h:
3332
3333 2017-11-27  Tim Horton  <timothy_horton@apple.com>
3334
3335         REGRESSION (r225142): Crashes when command clicking or force touching links
3336         https://bugs.webkit.org/show_bug.cgi?id=180055
3337         <rdar://problem/35703910>
3338
3339         Reviewed by Wenson Hsieh.
3340
3341         No new tests; affects an existing API test.
3342
3343         * editing/mac/DictionaryLookup.mm:
3344         (WebCore::tokenRange):
3345         The 'options' out argument from tokenRangeForString is autoreleased.
3346
3347 2017-11-27  Dean Jackson  <dino@apple.com>
3348
3349         Implement OffscreenCanvas.getContext("webgl")
3350         https://bugs.webkit.org/show_bug.cgi?id=180050
3351         <rdar://problem/35705473>
3352
3353         Reviewed by Sam Weinig.
3354
3355         Implement enough of getContext("webgl") to actually return an
3356         active WebGLRenderingContext, even though it isn't actually
3357         hooked up to draw.
3358
3359         Introduce a new type, WebGLCanvas, which is a variant of HTMLCanvasElement
3360         and OffscreenCanvas, so that it can be exposed by the 'canvas' attribute
3361         on WebGLRenderingContext.
3362
3363         At the moment we still assume that all uses of WebGLRenderingContext come
3364         from HTMLCanvasElement, so add a bunch of logic to detect that case.
3365
3366         Updated the existing (proposed) WPT.
3367
3368         * html/OffscreenCanvas.cpp:
3369         (WebCore::OffscreenCanvas::getContext): Implement enough of getContext to
3370         return a WebGLRenderingContext.
3371         * html/OffscreenCanvas.h: Use the new OffscreenRenderingContext type, even
3372         though it's just a WebGLRenderingContext at the moment.
3373
3374         * html/canvas/WebGLRenderingContextBase.cpp:
3375         (WebCore::WebGLRenderingContextBase::canvas): Now returns a WebGLCanvas.
3376         (WebCore::WebGLRenderingContextBase::htmlCanvas): Helper to get the HTMLCanvasElement if it exists.
3377         (WebCore::WebGLRenderingContextBase::offscreenCanvas): Ditto for OffscreenCanvas.
3378         (WebCore::WebGLRenderingContextBase::checkForContextLossHandling): Guard for htmlCanvas().
3379         (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker):
3380         (WebCore::WebGLRenderingContextBase::setupFlags):
3381         (WebCore::WebGLRenderingContextBase::addActivityStateChangeObserverIfNecessary):
3382         (WebCore::WebGLRenderingContextBase::removeActivityStateChangeObserver):
3383         (WebCore::WebGLRenderingContextBase::markContextChanged):
3384         (WebCore::WebGLRenderingContextBase::markContextChangedAndNotifyCanvasObserver):
3385         (WebCore::WebGLRenderingContextBase::paintRenderingResultsToCanvas):
3386         (WebCore::WebGLRenderingContextBase::reshape):
3387         (WebCore::WebGLRenderingContextBase::compileShader):
3388         (WebCore::WebGLRenderingContextBase::isContextLostOrPending):
3389         (WebCore::WebGLRenderingContextBase::readPixels):
3390         (WebCore::WebGLRenderingContextBase::loseContextImpl):
3391         (WebCore::WebGLRenderingContextBase::printToConsole):
3392         (WebCore::WebGLRenderingContextBase::dispatchContextLostEvent):
3393         (WebCore::WebGLRenderingContextBase::maybeRestoreContext):
3394         (WebCore::WebGLRenderingContextBase::dispatchContextChangedEvent):
3395         (WebCore::WebGLRenderingContextBase::clampedCanvasSize):
3396         * html/canvas/WebGLRenderingContextBase.h: Define WebGLCanvas.
3397         * html/canvas/WebGLRenderingContextBase.idl:
3398
3399         * inspector/InspectorInstrumentation.h: Handle the variant options, although leave OffscreenCanvas
3400         unimplemented for the moment.
3401         (WebCore::InspectorInstrumentation::didEnableExtension):
3402         (WebCore::InspectorInstrumentation::didCreateProgram):
3403         (WebCore::InspectorInstrumentation::willDeleteProgram):
3404         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
3405         * inspector/agents/InspectorCanvasAgent.cpp:
3406         (WebCore::InspectorCanvasAgent::didEnableExtension):
3407         (WebCore::InspectorCanvasAgent::didCreateProgram):
3408
3409 2017-11-27  Michael Catanzaro  <mcatanzaro@igalia.com>
3410
3411         Unreviewed, fix an improper #include
3412
3413         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3414
3415 2017-11-27  Alex Christensen  <achristensen@webkit.org>
3416
3417         imported/w3c/web-platform-tests/url/failure.html crashes on debug builds
3418         https://bugs.webkit.org/show_bug.cgi?id=172337
3419
3420         Reviewed by Chris Dumez.
3421
3422         There were two problems:
3423         1. Invalid URLs can contain non-ASCII characters in its UTF8 representation.
3424         We should not put these URLs into content extension finite state machines.  They won't load anyways.
3425         2. If we don't have any content extensions installed, we still call String.utf8 unnecessarily.  Let's not.
3426
3427         * contentextensions/ContentExtensionsBackend.cpp:
3428         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad const):
3429
3430 2017-11-27  Simon Fraser  <simon.fraser@apple.com>
3431
3432         Use TextStream's indent tracking, rather than passing indent to all the externalRepresentation() functions
3433         https://bugs.webkit.org/show_bug.cgi?id=180027
3434
3435         Reviewed by Jon Lee.
3436
3437         Remove all the indent arguments, and make use of TextStream::IndentScope to control
3438         output indentation.
3439         
3440         Add an indent stream manipulator so you can say
3441           ts << indent << "text"
3442         to write the indent.
3443
3444         * platform/graphics/filters/FEBlend.cpp:
3445         (WebCore::FEBlend::externalRepresentation const):
3446         * platform/graphics/filters/FEBlend.h:
3447         * platform/graphics/filters/FEColorMatrix.cpp:
3448         (WebCore::FEColorMatrix::externalRepresentation const):
3449         * platform/graphics/filters/FEColorMatrix.h:
3450         * platform/graphics/filters/FEComponentTransfer.cpp:
3451         (WebCore::FEComponentTransfer::externalRepresentation const):
3452         * platform/graphics/filters/FEComponentTransfer.h:
3453         * platform/graphics/filters/FEComposite.cpp:
3454         (WebCore::FEComposite::externalRepresentation const):
3455         * platform/graphics/filters/FEComposite.h:
3456         * platform/graphics/filters/FEConvolveMatrix.cpp:
3457         (WebCore::FEConvolveMatrix::externalRepresentation const):
3458         * platform/graphics/filters/FEConvolveMatrix.h:
3459         * platform/graphics/filters/FEDiffuseLighting.cpp:
3460         (WebCore::FEDiffuseLighting::externalRepresentation const):
3461         * platform/graphics/filters/FEDiffuseLighting.h:
3462         * platform/graphics/filters/FEDisplacementMap.cpp:
3463         (WebCore::FEDisplacementMap::externalRepresentation const):
3464         * platform/graphics/filters/FEDisplacementMap.h:
3465         * platform/graphics/filters/FEDropShadow.cpp:
3466         (WebCore::FEDropShadow::externalRepresentation const):
3467         * platform/graphics/filters/FEDropShadow.h:
3468         * platform/graphics/filters/FEFlood.cpp:
3469         (WebCore::FEFlood::externalRepresentation const):
3470         * platform/graphics/filters/FEFlood.h:
3471         * platform/graphics/filters/FEGaussianBlur.cpp:
3472         (WebCore::FEGaussianBlur::externalRepresentation const):
3473         * platform/graphics/filters/FEGaussianBlur.h:
3474         * platform/graphics/filters/FEMerge.cpp:
3475         (WebCore::FEMerge::externalRepresentation const):
3476         * platform/graphics/filters/FEMerge.h:
3477         * platform/graphics/filters/FEMorphology.cpp:
3478         (WebCore::FEMorphology::externalRepresentation const):
3479         * platform/graphics/filters/FEMorphology.h:
3480         * platform/graphics/filters/FEOffset.cpp:
3481         (WebCore::FEOffset::externalRepresentation const):
3482         * platform/graphics/filters/FEOffset.h:
3483         * platform/graphics/filters/FESpecularLighting.cpp:
3484         (WebCore::FESpecularLighting::externalRepresentation const):
3485         * platform/graphics/filters/FESpecularLighting.h:
3486         * platform/graphics/filters/FETile.cpp:
3487         (WebCore::FETile::externalRepresentation const):
3488         * platform/graphics/filters/FETile.h:
3489         * platform/graphics/filters/FETurbulence.cpp:
3490         (WebCore::FETurbulence::externalRepresentation const):
3491         * platform/graphics/filters/FETurbulence.h:
3492         * platform/graphics/filters/FilterEffect.cpp:
3493         (WebCore::FilterEffect::externalRepresentation const):
3494         * platform/graphics/filters/FilterEffect.h:
3495         * platform/graphics/filters/SourceAlpha.cpp:
3496         (WebCore::SourceAlpha::externalRepresentation const):
3497         * platform/graphics/filters/SourceAlpha.h:
3498         * platform/graphics/filters/SourceGraphic.cpp:
3499         (WebCore::SourceGraphic::externalRepresentation const):
3500         * platform/graphics/filters/SourceGraphic.h:
3501         * rendering/RenderTreeAsText.cpp:
3502         (WebCore::write):
3503         (WebCore::writeLayer):
3504         (WebCore::writeLayerRenderers):
3505         (WebCore::writeLayers):
3506         (WebCore::externalRepresentation):
3507         * rendering/RenderTreeAsText.h:
3508         * rendering/svg/SVGRenderTreeAsText.cpp:
3509         (WebCore::writeSVGInlineTextBox):
3510         (WebCore::writeSVGInlineTextBoxes):
3511         (WebCore::writeStandardPrefix):
3512         (WebCore::writeChildren):
3513         (WebCore::writeSVGResourceContainer):
3514         (WebCore::writeSVGContainer):
3515         (WebCore::write):
3516         (WebCore::writeSVGText):
3517         (WebCore::writeSVGInlineText):
3518         (WebCore::writeSVGImage):
3519         (WebCore::writeSVGGradientStop):
3520         (WebCore::writeResources):
3521         * rendering/svg/SVGRenderTreeAsText.h:
3522         * svg/graphics/filters/SVGFEImage.cpp:
3523         (WebCore::FEImage::externalRepresentation const):
3524         * svg/graphics/filters/SVGFEImage.h:
3525
3526 2017-11-27  Chris Dumez  <cdumez@apple.com>
3527
3528         Give Document a strongly typed identifier instead of a uint64_t
3529         https://bugs.webkit.org/show_bug.cgi?id=180041
3530
3531         Reviewed by Youenn Fablet.
3532
3533         Give Document a strongly typed identifier instead of a uint64_t, for clarity.
3534
3535         * WebCore.xcodeproj/project.pbxproj:
3536         * dom/Document.cpp:
3537         (WebCore::m_identifier):
3538         * dom/Document.h:
3539         (WebCore::Document::identifier const):
3540         * dom/DocumentIdentifier.h: Copied from Source/WebCore/workers/service/ServiceWorkerClientIdentifier.h.
3541         * workers/service/ServiceWorkerClientIdentifier.h:
3542         (WebCore::ServiceWorkerClientIdentifier::toString const):
3543         (WebCore::ServiceWorkerClientIdentifier::encode const):
3544         (WebCore::ServiceWorkerClientIdentifier::decode):
3545         * workers/service/server/SWClientConnection.cpp:
3546         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
3547         (WebCore::SWClientConnection::notifyClientsOfControllerChange):
3548         * workers/service/server/SWClientConnection.h:
3549         * workers/service/server/SWServer.cpp:
3550         (WebCore::SWServer::Connection::serviceWorkerStartedControllingClient):
3551         (WebCore::SWServer::Connection::serviceWorkerStoppedControllingClient):
3552         (WebCore::SWServer::serviceWorkerStartedControllingClient):
3553         (WebCore::SWServer::serviceWorkerStoppedControllingClient):
3554         * workers/service/server/SWServer.h:
3555         * workers/service/server/SWServerRegistration.cpp:
3556         (WebCore::SWServerRegistration::addClientUsingRegistration):
3557         (WebCore::SWServerRegistration::removeClientUsingRegistration):
3558         * workers/service/server/SWServerRegistration.h:
3559
3560 2017-11-27  Simon Fraser  <simon.fraser@apple.com>
3561
3562         Optimize FEDisplacementMap
3563         https://bugs.webkit.org/show_bug.cgi?id=180023
3564
3565         Reviewed by Sam Weinig.
3566
3567         Make FEDisplacementMap about 3x faster by operating on whole pixels rather than
3568         individual channels. There's no per-channel logic once the srcX and srcY are computed.
3569         
3570         Other sundry cleanup.
3571
3572         * platform/graphics/ColorUtilities.h:
3573         (WebCore::byteOffsetOfPixel): Will use this in more places in future.
3574         * platform/graphics/filters/FEDisplacementMap.cpp:
3575         (WebCore::FEDisplacementMap::platformApplySoftware):
3576         * platform/graphics/filters/FEDisplacementMap.h:
3577         (WebCore::FEDisplacementMap::xChannelIndex const):
3578         (WebCore::FEDisplacementMap::yChannelIndex const):
3579
3580 2017-11-27  Tim Horton  <timothy_horton@apple.com>
3581
3582         One too many zeroes in macOS version number in FeatureDefines
3583         https://bugs.webkit.org/show_bug.cgi?id=180011
3584
3585         Reviewed by Dan Bernstein.
3586
3587         * Configurations/FeatureDefines.xcconfig:
3588
3589 2017-11-27  Zan Dobersek  <zdobersek@igalia.com>
3590
3591         [CoordGraphics] CoordinatedGraphicsLayer doesn't need to inherit from TextureMapperPlatformLayer::Client
3592         https://bugs.webkit.org/show_bug.cgi?id=180036
3593
3594         Reviewed by Carlos Garcia Campos.
3595
3596         There's no reason CoordinatedGraphicsLayer should inherit from
3597         TextureMapperPlatformLayer::Client. CoordinatedGraphicsLayer objects are
3598         not used anywhere through that type, and all the overridden methods are
3599         empty anyway. The TextureMapperPlatformLayer::Client class (along with
3600         TextureMapperPlatformLayer) is nowadays only used in the direct
3601         TextureMapper implementation of GraphicsLayer.
3602
3603         No new tests -- no change in behavior.
3604
3605         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3606         (WebCore::CoordinatedGraphicsLayer::platformLayerWillBeDestroyed): Deleted.
3607         (WebCore::CoordinatedGraphicsLayer::setPlatformLayerNeedsDisplay): Deleted.
3608         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3609
3610 2017-11-27  Antoine Quint  <graouts@apple.com>
3611
3612         Pressing the space bar while watching a fullscreen video doesn't play or pause
3613         https://bugs.webkit.org/show_bug.cgi?id=180033
3614         <rdar://problem/33610443>
3615
3616         Reviewed by Eric Carlson.
3617
3618         We register a "keydown" event to track when the space bar is pressed, and if the media is playing
3619         in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
3620         one of the media controls using the keyboard will not let the events we register for be dispatched
3621         this far along the event dispatch phase.
3622
3623         Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html
3624
3625         * Modules/modern-media-controls/media/media-controller.js:
3626         (MediaController):
3627         (MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
3628         lead to some extraneous unhandled promise console logging that pollutes test output.
3629         (MediaController.prototype.handleEvent):
3630
3631 2017-11-27  Simon Fraser  <simon.fraser@apple.com>
3632
3633         Optimize FEMorphology
3634         https://bugs.webkit.org/show_bug.cgi?id=180020
3635
3636         Reviewed by Sam Weinig.
3637
3638         Use const PaintingData&.
3639         Compute all components at once.
3640         Avoid Vector<> capacity changes during the pixel loop.
3641         Tweak the parallel jobs scaling.
3642         Templatize the the inner loop functions that compute min or max based
3643         on the filter type to avoid conditionals in tight loops.
3644         
3645         This is about a 4x speedup before the parallel jobs tweaking. With fixed parallelism,
3646         a 200x200 filter went from 15ms to about 1ms with these changes.
3647
3648         * platform/graphics/ColorUtilities.h:
3649         (WebCore::ColorComponents::fromRGBA):
3650         (WebCore::ColorComponents::toRGBA const):
3651         (WebCore::perComponentMax):
3652         (WebCore::perComponentMin):
3653         * platform/graphics/filters/FEColorMatrix.cpp:
3654         (WebCore::FEColorMatrix::platformApplySoftware): Remove some old perf logging code.
3655         TimingScope now does something similar.
3656         * platform/graphics/filters/FEMorphology.cpp:
3657         (WebCore::pixelArrayIndex):
3658         (WebCore::minOrMax):
3659         (WebCore::columnExtremum):
3660         (WebCore::kernelExtremum):
3661         (WebCore::FEMorphology::platformApplyGeneric):
3662         (WebCore::FEMorphology::platformApplyWorker):
3663         (WebCore::FEMorphology::platformApply):
3664         (WebCore::FEMorphology::platformApplySoftware):
3665         (WebCore::shouldSupersedeExtremum): Deleted.
3666         * platform/graphics/filters/FEMorphology.h:
3667
3668 2017-11-27  Yacine Bandou  <yacine.bandou_ext@softathome.com>
3669
3670         [EME][GStreamer] Change the ClearKey's SystemID value
3671         https://bugs.webkit.org/show_bug.cgi?id=180007
3672
3673         Reviewed by Xabier Rodriguez-Calvar.
3674
3675         Use 1077efec-c0b2-4d02-ace3-3c1e52e2fb4b instead of
3676         58147ec8-0423-4659-92e6-f52c5ce8c3cc, as is specified in W3C.
3677         https://www.w3.org/TR/eme-initdata-cenc/#common-system-definition
3678
3679         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
3680
3681 2017-11-27  Javier Fernandez  <jfernandez@igalia.com>
3682
3683         [css-grid] Display issues with child with max-width
3684         https://bugs.webkit.org/show_bug.cgi?id=178973
3685
3686         Reviewed by Darin Adler.
3687
3688         We have an utility function to compute the grid item's margins
3689         when the item still needs to layout. We used the function
3690         RenderStyle::hasMarings to decide whether such margin computation
3691         worths. However, we need that function to operate on a specific
3692         axis, hence I added a new function adding such logic.
3693
3694         Additionally, we must treat any 'auto' margin as 0px during the
3695         tracks sizing algorithm, as the CSS Grid spec states:
3696
3697           - https://drafts.csswg.org/css-grid/#auto-margins
3698
3699         Test: fast/css-grid-layout/auto-margins-ignored-during-track-sizing.html
3700
3701         * rendering/GridLayoutFunctions.cpp:
3702         (WebCore::GridLayoutFunctions::childHasMargin): New funciton with axis dependent logic.
3703         (WebCore::GridLayoutFunctions::computeMarginLogicalSizeForChild): Ignore auto margins.
3704         (WebCore::GridLayoutFunctions::marginLogicalSizeForChild): Ignore auto margins.
3705
3706 2017-11-26  Simon Fraser  <simon.fraser@apple.com>
3707
3708         feImage as filter input has skewed colors
3709         https://bugs.webkit.org/show_bug.cgi?id=180021
3710
3711         Reviewed by Sam Weinig.
3712         
3713         Using an <feImage> as a filter input sometimes results in incorrect colors, because
3714         the image is being sourced as linearRGB when it should always be sRGB.
3715         
3716         Fix by setting the result colorspace in FEImage before we allocate the output
3717         buffer.
3718
3719         Tests: svg/filters/feImage-color-fidelity-expected.svg
3720                svg/filters/feImage-color-fidelity.svg
3721
3722         * svg/graphics/filters/SVGFEImage.cpp:
3723         (WebCore::FEImage::platformApplySoftware):
3724
3725 2017-11-26  Minsheng Liu  <lambda@liu.ms>
3726
3727         Cleanup code for RenderMathMLUnderOver::layoutBlock
3728         https://bugs.webkit.org/show_bug.cgi?id=179681
3729
3730         Reviewed by Frédéric Wang.
3731
3732         The patch removes some unnecessary calls to layoutIfNeeds() and guards the change
3733         with assertion. Since there is no behavior change, no new tests are required.
3734
3735         * rendering/mathml/RenderMathMLUnderOver.cpp:
3736         (WebCore::RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren):
3737         (WebCore::RenderMathMLUnderOver::layoutBlock):
3738         (WebCore::RenderMathMLUnderOver::computeOperatorsHorizontalStretch): Deleted.
3739         * rendering/mathml/RenderMathMLUnderOver.h:
3740
3741 2017-11-26  Simon Fraser  <simon.fraser@apple.com>
3742
3743         Use more Uint8ClampedArray& and constness in filter and image buffer code
3744         https://bugs.webkit.org/show_bug.cgi?id=180008
3745
3746         Reviewed by Darin Adler.
3747
3748         Use references to Uint8ClampedArrays rather than pointers where necessary.
3749         
3750         Use const for source data buffers when possible, and uint8_t for the underlying
3751         data type.
3752         
3753         Fix a bug in FEGaussianBlur where the output of the last blur pass wasn't
3754         copied to the result buffer, which required a test adjustment.
3755
3756         * html/canvas/CanvasRenderingContext2D.cpp:
3757         (WebCore::CanvasRenderingContext2D::putImageData):
3758         * platform/graphics/ImageBuffer.cpp:
3759         (WebCore::ImageBuffer::genericConvertToLuminanceMask):
3760         * platform/graphics/ImageBuffer.h:
3761         * platform/graphics/ShadowBlur.cpp:
3762         (WebCore::ShadowBlur::blurShadowBuffer):
3763         * platform/graphics/cairo/ImageBufferCairo.cpp:
3764         (WebCore::ImageBuffer::putByteArray):
3765         * platform/graphics/cg/ImageBufferCG.cpp:
3766         (WebCore::ImageBuffer::putByteArray):
3767         * platform/graphics/cg/ImageBufferDataCG.cpp:
3768         (WebCore::ImageBufferData::getData const):
3769         (WebCore::ImageBufferData::putData):
3770         * platform/graphics/cg/ImageBufferDataCG.h:
3771         * platform/graphics/cpu/arm/filters/FEBlendNEON.h:
3772         (WebCore::FEBlend::platformApplySoftware):
3773         * platform/graphics/cpu/arm/filters/FECompositeArithmeticNEON.h:
3774         (WebCore::FEComposite::computeArithmeticPixelsNeon):
3775         (WebCore::FEComposite::platformArithmeticNeon):
3776         * platform/graphics/cpu/arm/filters/FEGaussianBlurNEON.h:
3777         (WebCore::boxBlurNEON):
3778         * platform/graphics/cpu/arm/filters/NEONHelpers.h:
3779         (WebCore::loadRGBA8AsFloat):
3780         * platform/graphics/filters/FEColorMatrix.cpp:
3781         (WebCore::effectApplyAccelerated):
3782         (WebCore::effectType):
3783         (WebCore::FEColorMatrix::platformApplySoftware):
3784         * platform/graphics/filters/FEComponentTransfer.cpp:
3785         (WebCore::FEComponentTransfer::platformApplySoftware):
3786         * platform/graphics/filters/FEComposite.cpp:
3787         (WebCore::computeArithmeticPixels):
3788         (WebCore::FEComposite::platformArithmeticSoftware):
3789         (WebCore::FEComposite::platformApplySoftware):
3790         * platform/graphics/filters/FEComposite.h:
3791         * platform/graphics/filters/FEConvolveMatrix.cpp:
3792         (WebCore::setDestinationPixels):
3793         (WebCore::FEConvolveMatrix::fastSetInteriorPixels):
3794         (WebCore::FEConvolveMatrix::fastSetOuterPixels):
3795         (WebCore::FEConvolveMatrix::platformApplySoftware):
3796         * platform/graphics/filters/FEConvolveMatrix.h:
3797         * platform/graphics/filters/FEDisplacementMap.cpp:
3798         (WebCore::FEDisplacementMap::platformApplySoftware):
3799         * platform/graphics/filters/FEDropShadow.cpp:
3800         (WebCore::FEDropShadow::platformApplySoftware):
3801         * platform/graphics/filters/FEGaussianBlur.cpp:
3802         (WebCore::boxBlurAlphaOnly):
3803         (WebCore::boxBlur):
3804         (WebCore::accelerateBoxBlur):
3805         (WebCore::standardBoxBlur):
3806         (WebCore::FEGaussianBlur::platformApplyGeneric):
3807         (WebCore::FEGaussianBlur::platformApplyWorker):
3808         (WebCore::FEGaussianBlur::platformApply):
3809         (WebCore::FEGaussianBlur::platformApplySoftware):
3810         * platform/graphics/filters/FEGaussianBlur.h:
3811         * platform/graphics/filters/FELighting.cpp:
3812         (WebCore::FELighting::drawLighting):
3813         (WebCore::FELighting::platformApplySoftware):
3814         * platform/graphics/filters/FELighting.h:
3815         * platform/graphics/filters/FEMorphology.cpp:
3816         (WebCore::columnExtremum):
3817         (WebCore::FEMorphology::platformApplyGeneric):
3818         (WebCore::FEMorphology::platformApplyDegenerate):
3819         (WebCore::FEMorphology::platformApplySoftware):
3820         * platform/graphics/filters/FEMorphology.h:
3821         * platform/graphics/filters/FETurbulence.cpp:
3822         (WebCore::FETurbulence::fillRegion const):
3823         (WebCore::FETurbulence::fillRegionWorker):
3824         (WebCore::FETurbulence::platformApplySoftware):
3825         * platform/graphics/filters/FETurbulence.h:
3826         * platform/graphics/filters/FilterEffect.cpp:
3827         (WebCore::FilterEffect::forceValidPreMultipliedPixels):
3828         (WebCore::FilterEffect::imageBufferResult):
3829         (WebCore::FilterEffect::unmultipliedResult):
3830         (WebCore::FilterEffect::premultipliedResult):
3831         (WebCore::FilterEffect::copyImageBytes const):
3832         (WebCore::copyPremultiplyingAlpha):
3833         (WebCore::copyUnpremultiplyingAlpha):
3834         (WebCore::FilterEffect::copyUnmultipliedResult):
3835         (WebCore::FilterEffect::copyPremultipliedResult):
3836         * platform/graphics/filters/FilterEffect.h:
3837         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
3838         (WebCore::ImageBufferData::putData):
3839         * platform/graphics/win/ImageBufferDataDirect2D.h:
3840
3841 2017-11-25  Zalan Bujtas  <zalan@apple.com>
3842
3843         Make RenderSnapshottedPlugIn ISO allocated
3844         https://bugs.webkit.org/show_bug.cgi?id=180010
3845         <rdar://problem/35671977>
3846
3847         Reviewed by David Kilzer.
3848
3849         RenderEmbeddedObject, the base class is ISO allocated since r224537. 
3850
3851         * rendering/RenderSnapshottedPlugIn.cpp:
3852         * rendering/RenderSnapshottedPlugIn.h:
3853
3854 2016-08-05  Darin Adler  <darin@apple.com>
3855
3856         Fix some minor problems in the StringImpl header
3857         https://bugs.webkit.org/show_bug.cgi?id=160630
3858
3859         Reviewed by Brent Fulgham.
3860
3861         * html/HTMLOptionElement.cpp:
3862         (WebCore::HTMLOptionElement::text): Use stripLeadingAndTrailingHTMLSpaces
3863         instead of stripWhiteSpace(isHTMLSpace).
3864         (WebCore::HTMLOptionElement::value): Ditto.
3865         (WebCore::HTMLOptionElement::label): Ditto.
3866         (WebCore::HTMLOptionElement::displayLabel): Ditto.
3867         * loader/FrameLoader.cpp:
3868         (WebCore::FrameLoader::didBeginDocument): Use stripLeadingAndTrailingHTMLSpaces
3869         instead of calling the general purpose one and passing isHTMLSpace.
3870         * platform/network/HTTPParsers.h:
3871         (WebCore::stripLeadingAndTrailingHTTPSpaces): Updated to use the
3872         new name, stripLeadingAndTrailingCharacters.
3873
3874 2017-11-23  Darin Adler  <darin@apple.com>
3875
3876         Fix dictionary leak in lookup, convert FindOptions to OptionSet, tweak code style nearby
3877         https://bugs.webkit.org/show_bug.cgi?id=179981
3878
3879         Reviewed by Sam Weinig.
3880
3881         * accessibility/AXObjectCache.cpp:
3882         (WebCore::AXObjectCache::rangeMatchesTextNearRange): Pass { } instead of 0.
3883         * accessibility/AccessibilityObject.cpp:
3884         (WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection const): Use { }
3885         instead of | to construct value.
3886         * editing/Editor.cpp:
3887         (WebCore::Editor::findString): Use contains instead of & to test an option.
3888         (WebCore::Editor::rangeOfString): Ditto.
3889         (WebCore::Editor::countMatchesForText): Ditto.
3890         * editing/EditorCommand.cpp:
3891         (WebCore::executeFindString): Use { } instead of | to construct value.
3892         * editing/FindOptions.h: Use OptionSet for type.
3893         * editing/TextIterator.cpp:
3894         (WebCore::SearchBuffer::SearchBuffer): Use contains instead of &. Also use -= instead
3895         of &= coupled with ~ to remove a flag.
3896         (WebCore::SearchBuffer::isWordEndMatch const): Ditto.
3897         (WebCore::SearchBuffer::isWordStartMatch const): Ditto.
3898         (WebCore::SearchBuffer::search): Ditto.
3899         (WebCore::findIteratorOptions): Ditto.
3900         (WebCore::findClosestPlainText): Ditto.
3901         (WebCore::findPlainText): Ditto.
3902
3903         * editing/mac/DictionaryLookup.h: Changed optional dictionary out arguments to
3904         RetainPtr<NSDictionary>. Before, they were returning a retained object, but callers
3905         did not seem to realize that.
3906         * editing/mac/DictionaryLookup.mm:
3907         (WebCore::tokenRange): Added helper. Takes care of doing adoptNS on the options
3908         dictionary, and also handles the Objective-C exception possibility cleanly. Also
3909         fixed the exception case to return NSNotFound instead of a zero-length range at
3910         the location we are searching, which is what the code expects.
3911         (WebCore::DictionaryLookup::rangeForSelection): Refactored to use the tokenRange
3912         helper function, and also to do much less work when the options pointer is null.
3913         (WebCore::DictionaryLookup::rangeAtHitTestResult): Use the tokenRange helper
3914         function and also use auto a bunch to tighten up the code a bit.
3915         (WebCore::DictionaryLookup::stringForPDFSelection): Ditto.
3916
3917         * page/DOMWindow.cpp:
3918         (WebCore::DOMWindow::find const): Use |= instead of | to build find options.
3919         * page/Page.cpp:
3920         (WebCore::Page::findString): Use contains instead of & and also - instead of
3921         & combined with ~.
3922         (WebCore::Page::findStringMatchingRanges): Ditto.
3923         (WebCore::Page::rangeOfString): Ditto.
3924
3925         * page/mac/EventHandlerMac.mm:
3926         (WebCore::EventHandler::selectClosestWordFromHitTestResultBasedOnLookup):
3927         Pass nullptr to indicate we don't need the options dictionary. The code before
3928         was passing a pointer to a null, which meant we would do the work to get the
3929         options dictionary, not use it, and also leak it.
3930
3931         * testing/Internals.cpp:
3932         (WebCore::Internals::rangeOfStringNearLocation): Pass { } instead of 0.
3933         (WebCore::Internals::rangeForDictionaryLookupAtLocation): Pass nullptr to
3934         indicate we don't need the options dictionary as above.
3935         (WebCore::parseFindOptions): Initialize options without an explicit 0, since
3936         an OptionSet starts out empty rather than uninitialized.
3937
3938 2017-11-24  Antti Koivisto  <antti@apple.com>
3939
3940         Style resolution spin due to calc() values always comparing inequal (seen on arstechnica.com)
3941         https://bugs.webkit.org/show_bug.cgi?id=179982
3942         <rdar://problem/35677991>
3943
3944         Reviewed by Darin Adler.
3945
3946         Test: transitions/transition-with-calc-spin.html
3947
3948         Something like calc(100% - 10px) would compare inequal to itself. This causes the implicit animation engine think that
3949         there is a new target value after style resolution and restart the transition. Starting the transition triggers another style
3950         resolution on zero duration timer and so on.
3951
3952         * platform/CalculationValue.cpp:
3953         (WebCore::operator==):
3954         * platform/CalculationValue.h:
3955
3956         Deep compare the child vectors.
3957
3958 2017-11-24  Antoine Quint  <graouts@apple.com>
3959
3960         Captions move when <video> with no controls is hovered
3961         https://bugs.webkit.org/show_bug.cgi?id=178600
3962         <rdar://problem/35112309>
3963
3964         Reviewed by Jer Noble.
3965
3966         We should only reduce the text tracks container height to make room for the controls
3967         bar when controls are enabled.
3968
3969         Tests: media/modern-media-controls/text-tracks/text-tracks-height-no-controls.html
3970                media/modern-media-controls/text-tracks/text-tracks-height-with-controls.html
3971
3972         * Modules/modern-media-controls/controls/text-tracks.css:
3973         (video[controls]::-webkit-media-text-track-container.visible-controls-bar):
3974         (video::-webkit-media-text-track-container.visible-controls-bar): Deleted.
3975
3976 2017-11-23  Simon Fraser  <simon.fraser@apple.com>
3977
3978         Some FilterEffect cleanup and logging
3979         https://bugs.webkit.org/show_bug.cgi?id=179932
3980
3981         Reviewed by Darin Adler.
3982         
3983         Rename the FilterEffect functions that get the result of the filter
3984         to have "result" in the name.
3985         
3986         Re-order FilterEffect member variables and use initializers. webkit.org/b/45614
3987         is closed so remove the comment about things moving to RenderSVGResourceFilterPrimitive.
3988         
3989         Add a virtual filterName() function for use by logging.
3990         
3991         Add a Filters log channel. Log some stuff.
3992         
3993         Rename RenderSVGResourceFilter::m_filter to m_rendererFilterDataMap.
3994
3995         * platform/Logging.h:
3996         * platform/graphics/cpu/arm/filters/FEBlendNEON.h:
3997         (WebCore::FEBlend::platformApplySoftware):
3998         * platform/graphics/filters/FEBlend.cpp:
3999         (WebCore::FEBlend::platformApplySoftware):
4000         * platform/graphics/filters/FEBlend.h:
4001         * platform/graphics/filters/FEColorMatrix.cpp:
4002         (WebCore::FEColorMatrix::platformApplySoftware):
4003         * platform/graphics/filters/FEColorMatrix.h:
4004         * platform/graphics/filters/FEComponentTransfer.cpp:
4005         (WebCore::FEComponentTransfer::platformApplySoftware):
4006         * platform/graphics/filter