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