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