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