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