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