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