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