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