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