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