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