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