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