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