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