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