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