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