Unreviewed, rolling out r242210.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-02-28  Commit Queue  <commit-queue@webkit.org>
2
3         Unreviewed, rolling out r242210.
4         https://bugs.webkit.org/show_bug.cgi?id=195179
5
6         it broke hover menus on losaltosonline.com (Requested by zalan
7         on #webkit).
8
9         Reverted changeset:
10
11         "[ContentChangeObserver] Move timer removal code from
12         DOMWindow::clearTimeout to DOMTimer::removeById"
13         https://bugs.webkit.org/show_bug.cgi?id=195143
14         https://trac.webkit.org/changeset/242210
15
16 2019-02-28  Zalan Bujtas  <zalan@apple.com>
17
18         [ContentChangeObserver] Move timer removal code from DOMWindow::clearTimeout to DOMTimer::removeById
19         https://bugs.webkit.org/show_bug.cgi?id=195143
20         <rdar://problem/48462351>
21
22         Reviewed by Simon Fraser.
23
24         Currently DOMWindow::clearTimeout() is the only callsite that we are interested in, but this is more future-proof.
25
26         * page/DOMTimer.cpp:
27         (WebCore::DOMTimer::removeById):
28         * page/DOMWindow.cpp:
29         (WebCore::DOMWindow::clearTimeout):
30         * page/ios/ContentChangeObserver.cpp:
31         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
32         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
33         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
34         (WebCore::ContentChangeObserver::removeDOMTimer): Deleted.
35         * page/ios/ContentChangeObserver.h:
36
37 2019-02-28  Charles Vazac  <cvazac@akamai.com>
38
39         Fix Resource Timing buffer edge cases for WPT
40         https://bugs.webkit.org/show_bug.cgi?id=193213
41
42         Reviewed by Youenn Fablet.
43
44         Test coverage by LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer*.html
45
46         * page/Performance.cpp:
47         (WebCore::Performance::resourceTimingBufferFullTimerFired): Only dispatch the
48         resourcetimingbufferfull event if the buffer is still full (as it may have been cleared or
49         expanded). Also, avoid infinite loops if we aren't able to decrease the number of entries in
50         the secondary buffer.
51
52 2019-02-28  Takashi Komori  <Takashi.Komori@sony.com>
53
54         [Curl] HTTP Body is missing with redirection.
55         https://bugs.webkit.org/show_bug.cgi?id=191651
56
57         Reviewed by Don Olmstead.
58
59         Implement updateFromDelegatePreservingOldProperties for curl port.
60
61         Tests: http/tests/navigation/post-301-response.html
62                http/tests/navigation/post-302-response.html
63                http/tests/navigation/post-303-response.html
64                http/tests/navigation/post-307-response.html
65                http/tests/navigation/post-308-response.html
66
67         * platform/Curl.cmake:
68         * platform/network/curl/ResourceRequest.h:
69         (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties): Deleted.
70         * platform/network/curl/ResourceRequestCurl.cpp: Added.
71         (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties):
72
73 2019-02-28  Carlos Garcia Campos  <cgarcia@igalia.com>
74
75         [CoordinatedGraphics] Remove COORDINATED_GRAPHICS_THREADED option
76         https://bugs.webkit.org/show_bug.cgi?id=195159
77
78         Reviewed by Don Olmstead.
79
80         Use COORDINATED_GRAPHICS instead.
81
82         * platform/graphics/GraphicsContext3D.h:
83         * platform/graphics/PlatformLayer.h:
84         * platform/graphics/cairo/ImageBufferCairo.cpp:
85         (WebCore::ImageBufferData::ImageBufferData):
86         (WebCore::ImageBufferData::~ImageBufferData):
87         * platform/graphics/cairo/ImageBufferDataCairo.h:
88         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp:
89         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h:
90         * platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp:
91         (Nicosia::GC3DLayer::swapBuffersIfNeeded):
92         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
93         (WebCore::GraphicsContext3D::reshapeFBOs):
94         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
95         (WebCore::GraphicsContext3D::prepareTexture):
96         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
97         (WebCore::GraphicsContext3D::reshapeFBOs):
98         * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp:
99         (WebCore::GraphicsContext3D::GraphicsContext3D):
100         (WebCore::GraphicsContext3D::~GraphicsContext3D):
101         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
102         (WebCore::TextureMapperGC3DPlatformLayer::TextureMapperGC3DPlatformLayer):
103         (WebCore::TextureMapperGC3DPlatformLayer::~TextureMapperGC3DPlatformLayer):
104         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
105         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
106         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
107         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
108         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
109         * platform/graphics/texmap/TextureMapperPlatformLayerProxyProvider.h:
110         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
111         (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay):
112         (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer):
113         (WebCore::CoordinatedGraphicsLayer::updatePlatformLayer):
114         * rendering/RenderLayerBacking.cpp:
115         (WebCore::RenderLayerBacking::paintsIntoWindow const):
116         * rendering/RenderLayerCompositor.cpp:
117         (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls const):
118
119 2019-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
120
121         Locale names can be nullptr
122         https://bugs.webkit.org/show_bug.cgi?id=195171
123         <rdar://problem/48262376>
124
125         Reviewed by Dean Jackson.
126
127         Nullptr can't be used in keys to HashMaps, so take an early out in this case.
128
129         This is a partial revert of r241288.
130
131         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
132         (WebCore::FontDescription::platformResolveGenericFamily):
133
134 2019-02-28  Justin Fan  <justin_fan@apple.com>
135
136         [Web GPU] Enable Web GPU only on 64-bit
137         https://bugs.webkit.org/show_bug.cgi?id=195139
138
139         Because Metal is only supported on 64 bit apps.
140
141         Unreviewed build fix.
142
143         * Configurations/FeatureDefines.xcconfig:
144
145 2019-02-27  Zalan Bujtas  <zalan@apple.com>
146
147         [ContentChangeObserver] Move WKSetObservedContentChange logic to ContentChangeObserver class.
148         https://bugs.webkit.org/show_bug.cgi?id=195128
149         <rdar://problem/48456752>
150
151         Reviewed by Simon Fraser.
152
153         Move the final bits over to ContentChangeObserver and delete WKContentObservationInternal.h.
154
155         * WebCore.xcodeproj/project.pbxproj:
156         * page/ios/ContentChangeObserver.mm:
157         (WebCore::ContentChangeObserver::setObservedContentChange):
158         * platform/ios/wak/WKContentObservation.cpp:
159         (WKSetObservedContentChange):
160         * platform/ios/wak/WKContentObservation.h:
161         * platform/ios/wak/WKContentObservationInternal.h: Removed.
162
163 2019-02-27  Simon Fraser  <simon.fraser@apple.com>
164
165         Roll out r242014; it caused crashes in compositing logging (webkit.org/b/195141)
166
167         * dom/Document.cpp:
168         (WebCore::Document::lastModified const):
169         * html/FTPDirectoryDocument.cpp:
170         (WebCore::processFileDateString):
171         * mathml/MathMLElement.cpp:
172         (WebCore::convertToPercentageIfNeeded):
173         (WebCore::MathMLElement::collectStyleForPresentationAttribute):
174         * page/cocoa/ResourceUsageOverlayCocoa.mm:
175         (WebCore::ResourceUsageOverlay::platformDraw):
176         * page/linux/ResourceUsageOverlayLinux.cpp:
177         (WebCore::cpuUsageString):
178         (WebCore::gcTimerString):
179         * platform/DateComponents.cpp:
180         (WebCore::DateComponents::toStringForTime const):
181         (WebCore::DateComponents::toString const):
182         * platform/LocalizedStrings.cpp:
183         (WebCore::localizedString):
184         * platform/audio/HRTFElevation.cpp:
185         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
186         * platform/mock/MockRealtimeVideoSource.cpp:
187         (WebCore::MockRealtimeVideoSource::drawText):
188         * rendering/RenderLayerCompositor.cpp:
189         (WebCore::RenderLayerCompositor::logLayerInfo):
190         * rendering/RenderTheme.cpp:
191         (WebCore::RenderTheme::formatMediaControlsTime const):
192
193 2019-02-27  Zalan Bujtas  <zalan@apple.com>
194
195         [ContentChangeObserver] Move _WKObservingContentChanges from global to ContentChangeObserver class
196         https://bugs.webkit.org/show_bug.cgi?id=195091
197         <rdar://problem/48427271>
198
199         Reviewed by Tim Horton.
200
201         * page/ios/ContentChangeObserver.h:
202         * page/ios/ContentChangeObserver.mm:
203         (WebCore::ContentChangeObserver::startObservingContentChanges):
204         (WebCore::ContentChangeObserver::stopObservingContentChanges):
205         (WebCore::ContentChangeObserver::isObservingContentChanges):
206         * platform/ios/wak/WKContentObservation.cpp:
207         (WKObservingContentChanges): Deleted.
208         (WKStartObservingContentChanges): Deleted.
209         (WKStopObservingContentChanges): Deleted.
210         * platform/ios/wak/WKContentObservation.h:
211         * platform/ios/wak/WKContentObservationInternal.h:
212
213 2019-02-27  Brady Eidson  <beidson@apple.com>
214
215         Universal links from Google search results pages don't open the app.
216         <rdar://problem/46887179> and https://bugs.webkit.org/show_bug.cgi?id=195126
217
218         Reviewed by Geoffrey Garen.
219
220         Covered by new API tests.
221
222         * loader/DocumentLoader.cpp:
223         (WebCore::DocumentLoader::shouldOpenExternalURLsPolicyToPropagate const): Propagate the external URL policy from
224           an iframe if it is from the same security origin as the main frame.
225
226 2019-02-27  Zalan Bujtas  <zalan@apple.com>
227
228         [ContentChangeObserver] Move DOMTimer schedule handling from global to ContentChangeObserver class
229         https://bugs.webkit.org/show_bug.cgi?id=195090
230         <rdar://problem/48426771>
231
232         Reviewed by Tim Horton.
233
234         Also remove some unused functions from WKContentObservationInternal.
235
236         * page/ios/ContentChangeObserver.h:
237         * page/ios/ContentChangeObserver.mm:
238         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling):
239         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling):
240         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling):
241         * platform/ios/wak/WKContentObservation.cpp:
242         (WKStartObservingDOMTimerScheduling): Deleted.
243         (WKStopObservingDOMTimerScheduling): Deleted.
244         (WKIsObservingDOMTimerScheduling): Deleted.
245         * platform/ios/wak/WKContentObservation.h:
246         * platform/ios/wak/WKContentObservationInternal.h:
247
248 2019-02-27  Zalan Bujtas  <zalan@apple.com>
249
250         [ContentChangeObserver] Move style recalc handling from global to ContentChangeObserver class
251         https://bugs.webkit.org/show_bug.cgi?id=195087
252
253         Reviewed by Simon Fraser.
254
255         Add m_observingNextStyleRecalc/m_observingStyleRecalcScheduling to ContentChangeObserver and move the related code over from WK functions.
256
257         * page/ios/ContentChangeObserver.h:
258         * page/ios/ContentChangeObserver.mm:
259         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling):
260         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling):
261         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling):
262         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
263         (WebCore::ContentChangeObserver::shouldObserveNextStyleRecalc):
264         (WebCore::ContentChangeObserver::setObservedContentChange):
265         * platform/ios/wak/WKContentObservation.cpp:
266         (WKSetObservedContentChange):
267         (WKStartObservingStyleRecalcScheduling): Deleted.
268         (WKStopObservingStyleRecalcScheduling): Deleted.
269         (WKIsObservingStyleRecalcScheduling): Deleted.
270         (WKSetShouldObserveNextStyleRecalc): Deleted.
271         (WKShouldObserveNextStyleRecalc): Deleted.
272         * platform/ios/wak/WKContentObservation.h:
273
274 2019-02-27  Zalan Bujtas  <zalan@apple.com>
275
276         [ContentChangeObserver] Move DOM timer handling from global to ContentChangeObserver class
277         https://bugs.webkit.org/show_bug.cgi?id=195070
278         <rdar://problem/48417650>
279
280         Reviewed by Tim Horton.
281
282         Add DOM timer list to ContentChangeObserver and move the related code over from WK functions.
283
284         * page/ios/ContentChangeObserver.h:
285         * page/ios/ContentChangeObserver.mm:
286         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling):
287         (WebCore::ContentChangeObserver::countOfObservedDOMTimers):
288         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
289         (WebCore::ContentChangeObserver::setObservedContentChange):
290         (WebCore::ContentChangeObserver::containsObservedDOMTimer):
291         (WebCore::ContentChangeObserver::addObservedDOMTimer):
292         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
293         * platform/ios/wak/WKContentObservation.cpp:
294         (WKStartObservingDOMTimerScheduling):
295         (WKSetObservedContentChange):
296         (WebThreadGetObservedDOMTimers): Deleted.
297         (WebThreadCountOfObservedDOMTimers): Deleted.
298         (WebThreadClearObservedDOMTimers): Deleted.
299         (WebThreadContainsObservedDOMTimer): Deleted.
300         (WebThreadAddObservedDOMTimer): Deleted.
301         (WebThreadRemoveObservedDOMTimer): Deleted.
302         * platform/ios/wak/WKContentObservation.h:
303
304 2019-02-27  Justin Fan  <justin_fan@apple.com>
305         Fix build errors after Web GPU buffer updates changed some IDL fields from unsigned long to unsigned long long.
306
307         Unreviewed build fix.
308
309         * Modules/webgpu/WebGPUBuffer.cpp:
310         (WebCore::WebGPUBuffer::setSubData):
311         * Modules/webgpu/WebGPUBuffer.h:
312         * Modules/webgpu/WebGPUBufferBinding.h:
313         * Modules/webgpu/WebGPURenderPassEncoder.idl:
314         * platform/graphics/gpu/GPUBufferBinding.h:
315         * platform/graphics/gpu/GPUVertexAttributeDescriptor.h:
316         * platform/graphics/gpu/GPUVertexInputDescriptor.h:
317
318 2019-02-27  John Wilander  <wilander@apple.com>
319
320         Adopt WebCore::RegistrableDomain in WebCore::ResourceLoadStatistics and WebKit::NetworkProcessProxy
321         https://bugs.webkit.org/show_bug.cgi?id=195071
322         <rdar://problem/48417690>
323
324         Reviewed by Alex Christensen and Brent Fulgham.
325
326         No new tests. This patch maintains functionality covered by plenty of layout
327         tests under http/tests/resourceLoadStatistics/ and http/tests/storageAccess.
328
329         This patch adopts WebCore::RegistrableDomain in WebCore::ResourceLoadStatistics
330         and makes the necessary infrastructure changes to support that.
331
332         The previous HashCountedSets in WebCore::ResourceLoadStatistics are now just
333         HashSets since we never used the counts for anything. This change simplified
334         encoding and decoding for IPC and will eventually simplify encoding and
335         decoding in loader/ResourceLoadStatistics.cpp when we obsolete statistics
336         model version 14 and below.
337
338         The patch also makes WebCore::RegistrableDomain's String constructor private.
339         A new create function WebCore::RegistrableDomain::uncheckedCreateFromString()
340         is introduced to better signal to users that creating a registrable domain
341         object with a string may create an object that doesn't match a registrable
342         domain in a valid HTTP-family URL. This change (private String constructor)
343         motivated a change in WebCore::AdClickAttribution where the Source and
344         Destination structs now take a URL as parameter instead of a String.
345
346         Finally, this patch harmonizes parameter and variable naming, going from
347         "origin" to "domain" and "mainFrame" to "topFrame."
348
349         * html/HTMLAnchorElement.cpp:
350         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
351         * html/HTMLMediaElement.cpp:
352         (WebCore::HTMLMediaElement::mediaSessionTitle const):
353         * loader/AdClickAttribution.h:
354         (WebCore::AdClickAttribution::Source::Source):
355         (WebCore::AdClickAttribution::Source::deletedValue):
356         (WebCore::AdClickAttribution::Destination::Destination):
357         (WebCore::AdClickAttribution::Destination::deletedValue):
358         (WebCore::AdClickAttribution::decode):
359         * loader/ResourceLoadObserver.cpp:
360         (WebCore::ResourceLoadObserver::logSubresourceLoading):
361         (WebCore::ResourceLoadObserver::logWebSocketLoading):
362         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
363         (WebCore::ResourceLoadObserver::statisticsForURL):
364         (WebCore::ResourceLoadObserver::statisticsForOrigin): Deleted.
365         * loader/ResourceLoadObserver.h:
366         * loader/ResourceLoadStatistics.cpp:
367         (WebCore::encodeHashSet):
368         (WebCore::ResourceLoadStatistics::encode const):
369         (WebCore::decodeHashCountedSet):
370         (WebCore::decodeHashSet):
371         (WebCore::ResourceLoadStatistics::decode):
372         (WebCore::appendHashSet):
373         (WebCore::ResourceLoadStatistics::toString const):
374         (WebCore::ResourceLoadStatistics::merge):
375         (WebCore::encodeHashCountedSet): Deleted.
376         (WebCore::encodeOriginHashSet): Deleted.
377         (WebCore::decodeOriginHashSet): Deleted.
378         (WebCore::appendHashCountedSet): Deleted.
379         * loader/ResourceLoadStatistics.h:
380         * platform/RegistrableDomain.h:
381         (WebCore::RegistrableDomain::uncheckedCreateFromString):
382         (WebCore::RegistrableDomain::RegistrableDomain):
383         * testing/Internals.cpp:
384         (WebCore::Internals::resourceLoadStatisticsForURL):
385         (WebCore::Internals::resourceLoadStatisticsForOrigin): Deleted.
386         * testing/Internals.h:
387         * testing/Internals.idl:
388
389 2019-02-27  Justin Fan  <justin_fan@apple.com>
390
391         [Web GPU] Buffer updates part 2: setSubData, GPU/CPU synchronization
392         https://bugs.webkit.org/show_bug.cgi?id=195077
393         <rdar://problem/47805229>
394
395         Reviewed by Dean Jackson.
396
397         Implement GPUBuffer.setSubData and prevent the resolving of mapping promises if the buffer is scheduled to be 
398         used on the GPU, and add handlers to resolve such promises after command buffer execution completes. In addition,
399         update buffer sizes to u64 (unsigned long in C++) as per the updated Web GPU API.
400
401         Tests: webgpu/buffer-command-buffer-races.html
402                webgpu/map-read-buffers.html
403
404         * Modules/webgpu/WebGPUBindGroup.h:
405         (WebCore::WebGPUBindGroup::bindGroup const):
406         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
407         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Rename binding -> bufferBinding to reduce confusion.
408         * Modules/webgpu/WebGPUBuffer.cpp: Small tweaks.
409         (WebCore::WebGPUBuffer::setSubData):
410         (WebCore::WebGPUBuffer::unmap): Correctly fail if buffer is destroyed.
411         (WebCore::WebGPUBuffer::destroy):
412         (WebCore::WebGPUBuffer::rejectOrRegisterPromiseCallback):
413         * Modules/webgpu/WebGPUBuffer.h:
414         (WebCore::WebGPUBuffer::buffer const): Returned buffer is no longer const so that it can be used in completed handler callbacks.
415         * Modules/webgpu/WebGPUBuffer.idl: Enable setSubData.
416         * Modules/webgpu/WebGPUCommandBuffer.cpp:
417         (WebCore::WebGPUCommandBuffer::beginRenderPass):
418         * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
419         (WebCore::WebGPUProgrammablePassEncoder::setBindGroup const):
420         * Modules/webgpu/WebGPUProgrammablePassEncoder.h:
421         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
422         (WebCore::WebGPURenderPassEncoder::setVertexBuffers):
423         * Sources.txt:
424         * WebCore.xcodeproj/project.pbxproj:
425         * platform/graphics/gpu/GPUBuffer.h:
426         (WebCore::GPUBuffer::isTransferDst const): Added various state and flag getters.
427         (WebCore::GPUBuffer::isVertex const):
428         (WebCore::GPUBuffer::isUniform const):
429         (WebCore::GPUBuffer::isStorage const):
430         (WebCore::GPUBuffer::isReadOnly const):
431         (WebCore::GPUBuffer::isMappable const):
432         (WebCore::GPUBuffer::isMapWrite const):
433         (WebCore::GPUBuffer::isMapRead const):
434         (WebCore::GPUBuffer::isMapWriteable const):
435         (WebCore::GPUBuffer::isMapReadable const):
436         * platform/graphics/gpu/GPUBufferBinding.h:
437         * platform/graphics/gpu/GPUCommandBuffer.h:
438         (WebCore::GPUCommandBuffer::usedBuffers const):
439         (WebCore::GPUCommandBuffer::useBuffer):
440         * platform/graphics/gpu/GPUDevice.cpp:
441         (WebCore::GPUDevice::tryCreateBuffer): Pass Ref of itself for Buffer to request the Queue later, if needed.
442         (WebCore::GPUDevice::tryCreateBuffer const): Deleted.
443         * platform/graphics/gpu/GPUDevice.h:
444         * platform/graphics/gpu/GPUProgrammablePassEncoder.cpp: Retain the encoder's commandBuffer to reference its used resource buffers.
445         (WebCore::GPUProgrammablePassEncoder::GPUProgrammablePassEncoder):
446         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
447         (WebCore::GPUProgrammablePassEncoder::commandBuffer const):
448         * platform/graphics/gpu/GPURenderPassEncoder.h:
449         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
450         (WebCore::GPUBuffer::validateBufferCreate): Move validation out of tryCreate.
451         (WebCore::GPUBuffer::tryCreate): Create both shared and private buffers, depending on usage.
452         (WebCore::GPUBuffer::GPUBuffer):
453         (WebCore::GPUBuffer::~GPUBuffer): Call destroy instead of just unmap.
454         (WebCore::GPUBuffer::state const):
455         (WebCore::GPUBuffer::setSubData): Uses a cached collection of staging MTLBuffers to encode data copies to the implementation MTLBuffer.
456         (WebCore::GPUBuffer::commandBufferCommitted): Register on the GPUBuffer that the provided MTLCommandBuffer uses it, and is about to be committed.
457         (WebCore::GPUBuffer::commandBufferCompleted): MTLCommandBuffer's onCompletedHandler calls this.
458         (WebCore::GPUBuffer::reuseSubDataBuffer): SetSubData's blit command buffers call this to return a staging buffer to the pool.
459         (WebCore::GPUBuffer::registerMappingCallback):
460         (WebCore::GPUBuffer::runMappingCallback):
461         (WebCore::GPUBuffer::unmap):
462         (WebCore::GPUBuffer::destroy):
463         (WebCore::GPUBuffer::tryCreateSharedBuffer): Deleted.
464         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
465         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder):
466         (WebCore::GPUProgrammablePassEncoder::setBindGroup):
467         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
468         (WebCore::GPUQueue::submit): Ensure submitted buffers are in the correct state, and add completed handlers for synchronization.
469         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
470         (WebCore::GPURenderPassEncoder::tryCreate):
471         (WebCore::GPURenderPassEncoder::GPURenderPassEncoder): Retain the commandBuffer for later reference.
472         (WebCore::GPURenderPassEncoder::setVertexBuffers): Mark vertex buffers as used before submission.
473         (WebCore::GPURenderPassEncoder::create): Deleted.
474
475         Buffer size updates in the IDL:
476         * Modules/webgpu/GPUBufferDescriptor.idl:
477         * Modules/webgpu/WebGPUBuffer.idl:
478         * Modules/webgpu/WebGPUBufferBinding.idl:
479         * Modules/webgpu/WebGPUCommandBuffer.idl:
480         * Modules/webgpu/WebGPURenderPassEncoder.idl:
481         * Modules/webgpu/WebGPUVertexAttributeDescriptor.idl:
482         * Modules/webgpu/WebGPUVertexInputDescriptor.idl:
483
484 2019-02-27  Youenn Fablet  <youenn@apple.com>
485
486         Remove LeetCode FetchRequest quirk
487         https://bugs.webkit.org/show_bug.cgi?id=195100
488
489         Reviewed by Alex Christensen.
490
491         Covered by manual testing.
492
493         * Modules/fetch/FetchRequest.cpp:
494         (WebCore::needsSignalQuirk):
495
496 2019-02-27  Chris Dumez  <cdumez@apple.com>
497
498         Unable to log into chase.com on iPad when DeviceMotionEvent API is disabled
499         https://bugs.webkit.org/show_bug.cgi?id=195101
500         <rdar://problem/48423023>
501
502         Reviewed by Geoffrey Garen.
503
504         Add site-specific quirk for chase.com on iOS where we fire a dummy DeviceMotionEvent if the page
505         tries to register a "devicemotion" event listener and fails because the API is disabled. This is
506         needed to unblock the site and proceed with the login flow.
507
508         Unfortunately, document()->settings().needsSiteSpecificQuirks() is false on iOS so I could not
509         guard the quirk behind this flag.
510
511         * page/DOMWindow.cpp:
512         (WebCore::DOMWindow::addEventListener):
513         (WebCore::DOMWindow::failedToRegisterDeviceMotionEventListener):
514         * page/DOMWindow.h:
515
516 2019-02-27  Antoine Quint  <graouts@apple.com>
517
518         Support Pointer Events on macOS
519         https://bugs.webkit.org/show_bug.cgi?id=195008
520         <rdar://problem/47454419>
521
522         Reviewed by Dean Jackson.
523
524         We now dispatch relevant pointer events as we prepare to dispatch mouse events. In most cases, this means we dispatch
525         a pointer event of the same type, with "mouse" being substituted by "pointer", and with the same properties with the
526         exception that if preventDefault() is called for a "pointerdown" event, the matching "mousedown" will not be dispatched,
527         and the same behavior also extends to "pointerup".
528
529         Tests: pointerevents/mouse/over-enter-out-leave.html
530                pointerevents/mouse/pointer-capture.html
531                pointerevents/mouse/pointer-event-basic-properties.html
532                pointerevents/mouse/pointer-events-before-mouse-events.html
533                pointerevents/mouse/pointerdown-prevent-default.html
534
535         * Configurations/FeatureDefines.xcconfig:
536         * dom/Document.cpp: All of the touch-action related members and functions should be iOS-specific since the touch-action
537         property does not have any effect on macOS.
538         (WebCore::Document::invalidateRenderingDependentRegions):
539         (WebCore::Document::nodeWillBeRemoved):
540         (WebCore::Document::updateTouchActionElements):
541         * dom/Document.h:
542         * dom/Element.cpp:
543         (WebCore::Element::dispatchMouseEvent): Dispatch a pointer event matching the mouse event that is about to be dispatched.
544         If preventDefault() is called in the event handler for either "pointerdown" or "pointerup", do not proceed with dispatching
545         the mouse event.
546         * dom/PointerEvent.cpp:
547         (WebCore::pointerEventType):
548         (WebCore::PointerEvent::create):
549         * dom/PointerEvent.h:
550         * page/EventHandler.cpp: Check both the pointer and mouse events to see if we need to dispatch "enter" and "leave" events.
551         (WebCore::hierarchyHasCapturingEventListeners):
552         (WebCore::EventHandler::updateMouseEventTargetNode):
553         * page/PointerCaptureController.cpp: Fix a build error which only happened on macOS.
554         (WebCore::PointerCaptureController::PointerCaptureController): Create the CapturingData for the unique mouse pointer.
555         (WebCore::PointerCaptureController::hasPointerCapture): The code did not match the spec cited in the comment, only the
556         pending target override needs to be considered to determine whether a given element has pointer capture enabled.
557         (WebCore::PointerCaptureController::dispatchEvent): Dispatch the provided pointer event, accounting for pointer capture if
558         it is set.
559         * page/PointerLockController.cpp: Fix a build error which only happened on macOS.
560         * style/StyleTreeResolver.cpp:
561         (WebCore::Style::TreeResolver::resolveElement): Code related to touch-action is only relevant to iOS.
562
563 2019-02-27  Sihui Liu  <sihui_liu@apple.com>
564
565         Network Process is put to suspended when holding locked IndexedDB files
566         https://bugs.webkit.org/show_bug.cgi?id=195024
567         <rdar://problem/45194169>
568
569         Reviewed by Geoffrey Garen.
570
571         We found network process was suspended when IDBDatabase was being closed in the background database thread, 
572         holding locks to its database file. To avoid starvation or deadlock, we need to keep network process alive by 
573         taking background assertion in UI process until the closes are done and locks are released.
574
575         * Modules/indexeddb/server/IDBServer.cpp:
576         (WebCore::IDBServer::IDBServer::create):
577         (WebCore::IDBServer::IDBServer::IDBServer):
578         (WebCore::IDBServer::IDBServer::createBackingStore):
579         (WebCore::IDBServer::IDBServer::closeDatabase):
580         (WebCore::IDBServer::IDBServer::didCloseDatabase):
581         * Modules/indexeddb/server/IDBServer.h:
582         (WebCore::IDBServer::IDBServer::create):
583         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
584         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentDeleteOperation):
585         (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose):
586         (WebCore::IDBServer::UniqueIDBDatabase::didShutdownForClose):
587         (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
588         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
589         (WebCore::IDBServer::UniqueIDBDatabase::notifyServerAboutClose):
590         * Modules/indexeddb/server/UniqueIDBDatabase.h:
591
592 2019-02-26  Simon Fraser  <simon.fraser@apple.com>
593
594         Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
595         https://bugs.webkit.org/show_bug.cgi?id=194973
596
597         Reviewed by Antti Koivisto.
598
599         This patch cleans up how the scrolling tree responds to scrolls.
600
601         First, ScrollingTreeScrollingNode::m_currentScrollPosition is "truth" for scrolling thread/
602         UI process scroll position.
603
604         On macOS where handleWheelEvent on the scrolling thread changes scroll position, the
605         bottleneck is ScrollingTreeScrollingNode::scrollTo() which sets the new scroll position,
606         update the visual viewport (for frame scrolls) updates the scrolledContentsLayer position,
607         updates related layers on this node (counter-scrolling layers etc), and then tells the
608         scrolling tree, which recurses through descendant nodes so they can adjust their layer
609         positions.
610
611         On iOS, the bottleneck is ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling(),
612         which does the above other than setting scrolledContentsLayer (since we're reacting to
613         layer state changes, not producing them).
614
615         updateLayersAfterAncestorChange() is renamed to relatedNodeScrollPositionDidChange(), and
616         ScrollingTree does the tree walk so classes don't have to implement
617         updateLayersAfterAncestorChange() just to talk children. The ScrollingTree tree walk knows
618         how to get the correct layoutViewport and to stop at frame boundaries (layer updates never
619         need to cross frame boundaries).
620
621         We preserve 'cumulativeDelta'; it's necessary for things like fixed inside overflow:scroll,
622         since the fixed state was computed with the "layout" scroll position, so we have to account
623         for the scroll delta since the last committed position. It's possible we could improve this
624         in future.
625
626         * page/scrolling/ScrollingTree.cpp:
627         (WebCore::ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling):
628         (WebCore::ScrollingTree::notifyRelatedNodesAfterScrollPositionChange):
629         (WebCore::ScrollingTree::notifyRelatedNodesRecursive):
630         (WebCore::ScrollingTree::mainFrameLayoutViewport):
631         (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling): Deleted.
632         * page/scrolling/ScrollingTree.h:
633         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
634         (WebCore::ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange): Deleted.
635         * page/scrolling/ScrollingTreeFrameHostingNode.h:
636         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
637         (WebCore::ScrollingTreeFrameScrollingNode::updateViewportForCurrentScrollPosition):
638         (WebCore::ScrollingTreeFrameScrollingNode::localToContentsPoint const):
639         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
640         * page/scrolling/ScrollingTreeNode.cpp:
641         (WebCore::ScrollingTreeNode::relatedNodeScrollPositionDidChange):
642         (WebCore::ScrollingTreeNode::enclosingScrollingNodeIncludingSelf):
643         * page/scrolling/ScrollingTreeNode.h:
644         * page/scrolling/ScrollingTreeScrollingNode.cpp:
645         (WebCore::ScrollingTreeScrollingNode::minimumScrollPosition const):
646         (WebCore::ScrollingTreeScrollingNode::scrollLimitReached const):
647         (WebCore::ScrollingTreeScrollingNode::adjustedScrollPosition const):
648         (WebCore::ScrollingTreeScrollingNode::scrollBy):
649         (WebCore::ScrollingTreeScrollingNode::scrollTo):
650         (WebCore::ScrollingTreeScrollingNode::currentScrollPositionChanged):
651         (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
652         (WebCore::ScrollingTreeScrollingNode::localToContentsPoint const):
653         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterAncestorChange): Deleted.
654         (WebCore::ScrollingTreeScrollingNode::setScrollPosition): Deleted.
655         * page/scrolling/ScrollingTreeScrollingNode.h:
656         * page/scrolling/ScrollingTreeScrollingNodeDelegate.h:
657         (WebCore::ScrollingTreeScrollingNodeDelegate::currentScrollPosition const):
658         (WebCore::ScrollingTreeScrollingNodeDelegate::scrollPosition const): Deleted.
659         * page/scrolling/ThreadedScrollingTree.cpp:
660         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
661         * page/scrolling/ThreadedScrollingTree.h:
662         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
663         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
664         (WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
665         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange): Deleted.
666         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
667         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
668         (WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
669         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange): Deleted.
670         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
671         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
672         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
673         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
674         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
675         (WebCore::ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition const):
676         (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged):
677         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
678         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers):
679         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState):
680         (WebCore::ScrollingTreeFrameScrollingNodeMac::exposedUnfilledArea const):
681         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const): Deleted.
682         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition): Deleted.
683         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition): Deleted.
684         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateLayersAfterViewportChange): Deleted.
685         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
686         (): Deleted.
687         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
688         (WebCore::ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition const):
689         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
690         (WebCore::ScrollingTreeOverflowScrollingNodeMac::~ScrollingTreeOverflowScrollingNodeMac): Deleted.
691         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange): Deleted.
692         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): Deleted.
693         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition): Deleted.
694         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition): Deleted.
695         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterDelegatedScroll): Deleted.
696         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
697         (WebCore::ScrollingTreeScrollingNodeDelegateMac::isAlreadyPinnedInDirectionOfGesture):
698         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount):
699         (WebCore::ScrollingTreeScrollingNodeDelegateMac::pinnedInDirection):
700         (WebCore::ScrollingTreeScrollingNodeDelegateMac::adjustScrollPositionToBoundsIfNecessary):
701         (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollOffset const):
702         (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollOnAxis):
703
704 2019-02-22  Simon Fraser  <simon.fraser@apple.com>
705
706         Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
707         https://bugs.webkit.org/show_bug.cgi?id=194973
708
709         Reviewed by Antti Koivisto.
710
711         The "master" value for the scroll position of a ScrollingTreeScrollingNode is now its m_scrollPosition member;
712         layout viewports and layer positions will be set from this. This allows scrollPosition() to no longer be virtual
713         and require different code for each scrolling node subclass, and adds a choke point that we can use to update
714         the layout viewport.
715         
716         We can remove m_probableMainThreadScrollPosition on ScrollingTreeFrameScrollingNodeMac because this was really just
717         an alias for the scroll position.
718
719         Add some isRootNode() checks for things that should only affect the main frame.
720
721         * page/scrolling/ScrollingTree.h: Remove fixedPositionRect() which was unused, and is a per-frame thing so makes
722         no sense here.
723         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
724         (WebCore::ScrollingTreeFrameScrollingNode::didChangeScrollPosition):
725         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
726         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewport const):
727         (WebCore::ScrollingTreeFrameScrollingNode::setLayoutViewport):
728         (WebCore::ScrollingTreeFrameScrollingNode::fixedPositionRect): Deleted.
729         * page/scrolling/ScrollingTreeScrollingNode.cpp:
730         (WebCore::ScrollingTreeScrollingNode::setScrollPosition):
731         (WebCore::ScrollingTreeScrollingNode::setScrollPositionInternal):
732         (WebCore::ScrollingTreeScrollingNode::didChangeScrollPosition):
733         * page/scrolling/ScrollingTreeScrollingNode.h:
734         (WebCore::ScrollingTreeScrollingNode::scrollPosition const):
735         * page/scrolling/ios/ScrollingTreeIOS.cpp:
736         (WebCore::ScrollingTreeIOS::fixedPositionRect): Deleted.
737         * page/scrolling/ios/ScrollingTreeIOS.h:
738         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
739         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
740         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
741         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
742         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
743         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
744         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState):
745         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const): Deleted.
746         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
747         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
748         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): Deleted.
749
750 2019-02-27  Ulrich Pflueger  <up@nanocosmos.de>
751
752         [MSE] SourceBuffer sample time increment vs. last frame duration check is broken
753         https://bugs.webkit.org/show_bug.cgi?id=194747
754         <rdar://problem/48148469>
755
756         Reviewed by Jer Noble.
757
758         Prevent unintended frame drops by including last frame duration in discontinuity check. 
759
760         Test: media/media-source/media-source-append-variable-frame-lengths-with-matching-durations.html
761
762         * Modules/mediasource/SourceBuffer.cpp:
763         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
764
765 2019-02-27  Timothy Hatcher  <timothy@apple.com>
766
767         REGRESSION: WebKit content crash in Base System (because NSAppearance is NULL).
768         https://bugs.webkit.org/show_bug.cgi?id=195086
769         rdar://problem/48419124
770
771         Reviewed by Tim Horton.
772
773         * platform/mac/ScrollAnimatorMac.mm:
774         (-[WebScrollerImpDelegate effectiveAppearanceForScrollerImp:]): Always return a valid NSAppearance.
775
776 2019-02-26  Wenson Hsieh  <wenson_hsieh@apple.com>
777
778         Remove conditional compile guard for InsertIntoTextNodeCommand::doReapply
779         https://bugs.webkit.org/show_bug.cgi?id=195067
780         <rdar://problem/44812080>
781
782         Reviewed by Tim Horton.
783
784         This iOS-specific override was introduced to fix <rdar://problem/7114425>, in which the last typed character
785         would be revealed when redoing text input on iOS inside a password field. The associated change fixed this bug
786         by overriding doReapply on iOS to only insert text (instead of additionally handling password echo); however, it
787         really makes sense to skip password echo when redoing on all platforms, so we can just remove the platform-
788         specific guards around this logic.
789
790         Doing this allows us to add the `hasEditableStyle()` check on iOS when redoing text insertion, which results in
791         a very subtle behavior change covered by the new layout test below.
792
793         Test: editing/undo/redo-text-insertion-in-non-editable-node.html
794
795         * editing/InsertIntoTextNodeCommand.cpp:
796         (WebCore::InsertIntoTextNodeCommand::doReapply):
797         * editing/InsertIntoTextNodeCommand.h:
798
799 2019-02-26  Keith Miller  <keith_miller@apple.com>
800
801         Code quality cleanup in NeverDestroyed
802         https://bugs.webkit.org/show_bug.cgi?id=194824
803
804         Reviewed by Mark Lam.
805
806         name_names.pl should not just assume the layout of LazyNeverDestroyed.
807
808         * dom/make_names.pl:
809         (printNamesCppFile):
810
811 2019-02-26  Zalan Bujtas  <zalan@apple.com>
812
813         Do not try to observe the timer when Page is nullptr
814         https://bugs.webkit.org/show_bug.cgi?id=195076
815
816         Reviewed by Tim Horton.
817
818         Covered by fast/dom/Window/timer-null-script-execution-context.html.
819
820         * page/DOMTimer.cpp:
821         (WebCore::DOMTimer::install):
822
823 2019-02-20  Jer Noble  <jer.noble@apple.com>
824
825         [Cocoa] Media elements will restart network buffering just before suspending
826         https://bugs.webkit.org/show_bug.cgi?id=193691
827
828         Reviewed by Eric Carlson.
829
830         API Test: WebKit.ProcessSuspendMediaBuffering
831
832         Allow the Page to suspend all media buffering in its child Documents.
833
834         * dom/Document.cpp:
835         (WebCore::Document::suspendAllMediaBuffering):
836         (WebCore::Document::resumeAllMediaBuffering):
837         * dom/Document.h:
838         * html/MediaElementSession.cpp:
839         (WebCore::MediaElementSession::dataBufferingPermitted const):
840         (WebCore::MediaElementSession::suspendBuffering):
841         (WebCore::MediaElementSession::resumeBuffering):
842         (WebCore::MediaElementSession::bufferingSuspended const):
843         * html/MediaElementSession.h:
844         * page/Page.cpp:
845         (WebCore::Page::suspendAllMediaBuffering):
846         (WebCore::Page::resumeAllMediaBuffering):
847         * page/Page.h:
848         (WebCore::Page::mediaPlaybackIsSuspended const):
849         (WebCore::Page::mediaBufferingIsSuspended const):
850         (WebCore::Page::mediaPlaybackIsSuspended): Deleted.
851         * platform/audio/PlatformMediaSession.h:
852         (WebCore::PlatformMediaSession::suspendBuffering):
853         (WebCore::PlatformMediaSession::resumeBuffering):
854         * platform/audio/PlatformMediaSessionManager.cpp:
855         (WebCore::PlatformMediaSessionManager::suspendAllMediaBufferingForDocument):
856         (WebCore::PlatformMediaSessionManager::resumeAllMediaBufferingForDocument):
857         * platform/audio/PlatformMediaSessionManager.h:
858
859 2019-02-26  Youenn Fablet  <youenn@apple.com>
860
861         Move service worker response validation from the service worker client to the service worker itself
862         https://bugs.webkit.org/show_bug.cgi?id=194716
863
864         Reviewed by Geoffrey Garen.
865
866         Added response validation at service worker side.
867
868         No change of behavior except for now logging validation error messages in the console.
869         Covered by rebased tests.
870
871         * workers/service/context/ServiceWorkerFetch.cpp:
872         (WebCore::ServiceWorkerFetch::validateResponse):
873         (WebCore::ServiceWorkerFetch::processResponse):
874         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
875
876 2019-02-26  Sihui Liu  <sihui_liu@apple.com>
877
878         [Mac WK2] storage/indexeddb/IDBObject-leak.html is flaky
879         https://bugs.webkit.org/show_bug.cgi?id=195036
880
881         Reviewed by Geoffrey Garen.
882
883         When connection to IDBServer is lost, IDBDatabase in web process should not only stop active transactions, but 
884         also transactions in committing process.
885
886         Also, TransactionOpration should clear its perform function when the operation is being completed, otherwise 
887         there is a reference cycle of TransactionOpration.
888
889         Covered by existing tests storage/indexeddb/IDBObject-leak.html.
890
891         * Modules/indexeddb/IDBDatabase.cpp:
892         (WebCore::IDBDatabase::connectionToServerLost): notify committing transasctions that connection is lost.
893         * Modules/indexeddb/IDBTransaction.cpp:
894         (WebCore::IDBTransaction::connectionClosedFromServer): notify IDBConnectionProxy that transaction ends.
895         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
896         (WebCore::IDBClient::IDBConnectionProxy::forgetTransaction): clear finished transactions.
897         * Modules/indexeddb/client/IDBConnectionProxy.h:
898         * Modules/indexeddb/client/TransactionOperation.h:
899         (WebCore::IDBClient::TransactionOperation::doComplete): clear perform function unconditionally when the 
900         operation is in completion process. 
901
902 2019-02-26  Zalan Bujtas  <zalan@apple.com>
903
904         [ContentChangeObserver] clearContentChangeObservers should be internal to ContentChangeObserver class
905         https://bugs.webkit.org/show_bug.cgi?id=195066
906         <rdar://problem/48411682>
907
908         Reviewed by Tim Horton.
909
910         Now all the empty clearContentChangeObservers() implementations can be removed.
911
912         * dom/Document.cpp:
913         (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
914         * loader/EmptyClients.h:
915         * page/ChromeClient.h:
916         * page/Frame.cpp:
917         (WebCore::Frame::willDetachPage):
918         * page/ios/ContentChangeObserver.h:
919         * page/ios/ContentChangeObserver.mm:
920         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
921         (WebCore::ContentChangeObserver::didSuspendActiveDOMObjects): Might need to merge them.
922         (WebCore::ContentChangeObserver::willDetachPage):
923
924 2019-02-26  Zalan Bujtas  <zalan@apple.com>
925
926         [ContentChangeObserver] Move style recalc schedule observation logic to ContentChangeObserver
927         https://bugs.webkit.org/show_bug.cgi?id=195062
928         <rdar://problem/48409258>
929
930         Reviewed by Tim Horton.
931
932         Also rename registerDOMTimerForContentObservationIfNeeded to be consistent with the did* naming style.
933
934         * dom/Document.cpp:
935         (WebCore::Document::scheduleStyleRecalc):
936         * page/DOMTimer.cpp:
937         (WebCore::DOMTimer::install):
938         * page/ios/ContentChangeObserver.h:
939         * page/ios/ContentChangeObserver.mm:
940         (WebCore::ContentChangeObserver::didInstallDOMTimer):
941         (WebCore::ContentChangeObserver::didScheduleStyleRecalc):
942         (WebCore::ContentChangeObserver::registerDOMTimerForContentObservationIfNeeded): Deleted.
943
944 2019-02-26  Chris Dumez  <cdumez@apple.com>
945
946         [iOS] Regression(PSON) Scroll position is no longer restored when navigating back to reddit.com
947         https://bugs.webkit.org/show_bug.cgi?id=195054
948         <rdar://problem/48330549>
949
950         Reviewed by Geoff Garen.
951
952         Add MaintainMemoryCache flag to indicate that the memory cache should not get purged.
953
954         * page/MemoryRelease.cpp:
955         (WebCore::releaseNoncriticalMemory):
956         (WebCore::releaseCriticalMemory):
957         (WebCore::releaseMemory):
958         * page/MemoryRelease.h:
959
960 2019-02-26  Commit Queue  <commit-queue@webkit.org>
961
962         Unreviewed, rolling out r241970.
963         https://bugs.webkit.org/show_bug.cgi?id=195057
964
965         made the QuickLook.LegacyQuickLookContent API test flakey
966         (Requested by estes on #webkit).
967
968         Reverted changeset:
969
970         "[iOS] Break a reference cycle between PreviewLoader and
971         ResourceLoader"
972         https://bugs.webkit.org/show_bug.cgi?id=194964
973         https://trac.webkit.org/changeset/241970
974
975 2019-02-26  Zalan Bujtas  <zalan@apple.com>
976
977         [ContentChangeObserver] Simplify content observation API by removing explicit DOMTimer observation.
978         https://bugs.webkit.org/show_bug.cgi?id=195023
979         <rdar://problem/48381885>
980
981         Reviewed by Tim Horton.
982
983         In the future we might decide that certain activities don't require DOMTimer observation, but that should
984         be internal to ContentChangeObserver.
985
986         * page/ios/ContentChangeObserver.h:
987         * page/ios/ContentChangeObserver.mm:
988         (WebCore::ContentChangeObserver::startObservingContentChanges):
989         (WebCore::ContentChangeObserver::stopObservingContentChanges):
990         * page/ios/EventHandlerIOS.mm:
991         (WebCore::EventHandler::mouseMoved):
992
993 2019-02-26  Zalan Bujtas  <zalan@apple.com>
994
995         [ContentChangeObserver] Move observing logic from Document::updateStyleIfNeeded to ContentChangeObserver
996         https://bugs.webkit.org/show_bug.cgi?id=195032
997         <rdar://problem/48388063>
998
999         Reviewed by Tim Horton.
1000
1001         This might eventually turn into a regular start/stop content observing call.
1002
1003         * dom/Document.cpp:
1004         (WebCore::Document::updateStyleIfNeeded):
1005         * page/ios/ContentChangeObserver.h:
1006         * page/ios/ContentChangeObserver.mm:
1007         (WebCore::ContentChangeObserver::startObservingStyleResolve):
1008         (WebCore::ContentChangeObserver::stopObservingStyleResolve):
1009
1010 2019-02-26  Zalan Bujtas  <zalan@apple.com>
1011
1012         [ContentChangeObserver] Move CheckForVisibilityChange to ContentChangeObserver class
1013         https://bugs.webkit.org/show_bug.cgi?id=195035
1014         <rdar://problem/48389123>
1015
1016         Reviewed by Tim Horton.
1017
1018         Visibility checking logic belongs to ContentChangeObserver.
1019
1020         * page/ios/ContentChangeObserver.h:
1021         * page/ios/ContentChangeObserver.mm:
1022         (WebCore::elementImplicitVisibility):
1023         (WebCore::ContentChangeObserver::StyleChange::StyleChange):
1024         (WebCore::ContentChangeObserver::StyleChange::~StyleChange):
1025         * rendering/updating/RenderTreeUpdater.cpp:
1026         (WebCore::RenderTreeUpdater::updateElementRenderer):
1027         (WebCore::elementImplicitVisibility): Deleted.
1028         (WebCore::CheckForVisibilityChange::CheckForVisibilityChange): Deleted.
1029         (WebCore::CheckForVisibilityChange::~CheckForVisibilityChange): Deleted.
1030
1031 2019-02-26  Philippe Normand  <pnormand@igalia.com>
1032
1033         [EGL] Runtime support for RGB565 pixel layout
1034         https://bugs.webkit.org/show_bug.cgi?id=194817
1035
1036         Reviewed by Carlos Garcia Campos.
1037
1038         Currently our graphics pipeline always relies on a ARGB8888 (32
1039         bpp) pixel configuration. On some low-end (old) embedded platforms
1040         the graphics driver is sometimes optimized for 16 bpp
1041         configurations, such as RGB565. On those platforms the application
1042         can now set the WEBKIT_EGL_PIXEL_LAYOUT environment variable to
1043         "RGB565" to adjust to the best pixel configuration supported by
1044         the screen and graphics driver.
1045
1046         * platform/graphics/egl/GLContextEGL.cpp:
1047         (WebCore::GLContextEGL::getEGLConfig):
1048
1049 2019-02-26  Philippe Normand  <pnormand@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
1050
1051         [WPE] Add API for webview background color configuration
1052         https://bugs.webkit.org/show_bug.cgi?id=192305
1053
1054         Reviewed by Michael Catanzaro.
1055
1056         Adapt the FrameView API to allow a default non-white background color.
1057
1058         * page/Frame.cpp:
1059         (WebCore::Frame::createView): Replace isTransparent argument with a background color one.
1060         * page/Frame.h:
1061         * page/FrameView.cpp:
1062         (WebCore::FrameView::recalculateBaseBackgroundColor): Use Color::transparent if m_isTransparent is true.
1063         (WebCore::FrameView::updateBackgroundRecursively): Allow the fallback background color to be non-white, this is
1064         used only in non-dark-mode-css build configurations.
1065         * page/FrameView.h:
1066         * testing/Internals.cpp:
1067         (WebCore::Internals::setViewIsTransparent): Use Color::transparent if transparent is true.
1068
1069 2019-02-25  Yongjun Zhang  <yongjun_zhang@apple.com>
1070
1071         scalableNativeWebpageParameters() is not preserved on new page navigation.
1072         https://bugs.webkit.org/show_bug.cgi?id=194892
1073         <rdar://problem/47538280>
1074
1075         If a page's current default viewport configuration is scalableNativeWebpageParameters due to
1076         the fact that m_canIgnoreScalingConstraints is true, loading a new page should preserve this
1077         configuration until we derive the right values from viewport meta-tag.
1078
1079         Reviewed by Wenson Hsieh.
1080
1081         Test: fast/viewport/ios/viewport-shrink-to-fit-on-new-navigation.html
1082
1083         * page/ViewportConfiguration.cpp:
1084         (WebCore::ViewportConfiguration::canOverrideConfigurationParameters const): Use fixedNativeWebpageParameters().
1085         (WebCore::ViewportConfiguration::updateDefaultConfiguration): Use nativeWebpageParameters.
1086         (WebCore::ViewportConfiguration::nativeWebpageParameters): Return the appropriate default configuration
1087             based on m_canIgnoreScalingConstraints and shouldIgnoreMinimumEffectiveDeviceWidth().
1088         (WebCore::ViewportConfiguration::fixedNativeWebpageParameters): Renamed from nativeWebpageParameters()
1089         (WebCore::ViewportConfiguration::scalableNativeWebpageParameters): Use fixedNativeWebpageParameters.
1090         * page/ViewportConfiguration.h: Make nativeWebpageParameters() an instance method and change the old
1091             static method to fixedNativeWebpageParameters which better reflects the actual behavior.
1092
1093 2019-02-25  Zalan Bujtas  <zalan@apple.com>
1094
1095         [ContentChangeObserver] Move observing logic from DOMWindow::clearTimeout to ContentChangeObserver
1096         https://bugs.webkit.org/show_bug.cgi?id=194988
1097         <rdar://problem/48343040>
1098
1099         Reviewed by Tim Horton.
1100
1101         ContentChangeObserver::removeDOMTimer takes care of the canceled timer removal.
1102
1103         * page/DOMWindow.cpp:
1104         (WebCore::DOMWindow::clearTimeout):
1105         * page/ios/ContentChangeObserver.h:
1106         * page/ios/ContentChangeObserver.mm:
1107         (WebCore::ContentChangeObserver::startObservingDOMTimer):
1108         (WebCore::ContentChangeObserver::stopObservingDOMTimer):
1109         (WebCore::ContentChangeObserver::removeDOMTimer):
1110
1111 2019-02-25  Zalan Bujtas  <zalan@apple.com>
1112
1113         [ContentChangeObserver] Move observing logic from DOMTimer to ContentChangeObserver
1114         https://bugs.webkit.org/show_bug.cgi?id=194987
1115         <rdar://problem/48342910>
1116
1117         Reviewed by Tim Horton.
1118
1119         Content obvservation logic should all move to the ContentChangeObserver class.
1120
1121         * page/DOMTimer.cpp:
1122         (WebCore::DOMTimer::install):
1123         (WebCore::DOMTimer::fired):
1124         * page/Page.cpp:
1125         (WebCore::Page::Page):
1126         * page/Page.h:
1127         (WebCore::Page::contentChangeObserver):
1128         * page/ios/ContentChangeObserver.h:
1129         * page/ios/ContentChangeObserver.mm:
1130         (WebCore::ContentChangeObserver::ContentChangeObserver):
1131         (WebCore::ContentChangeObserver::registerDOMTimerForContentObservationIfNeeded):
1132         (WebCore::ContentChangeObserver::startObservingDOMTimer):
1133         (WebCore::ContentChangeObserver::stopObservingDOMTimer):
1134         (WebCore::ContentChangeObserver::containsObservedDOMTimer):
1135         (WebCore::ContentChangeObserver::addObservedDOMTimer):
1136         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
1137
1138 2019-02-25  John Wilander  <wilander@apple.com>
1139
1140         Introduce and adopt new class RegistrableDomain for eTLD+1
1141         https://bugs.webkit.org/show_bug.cgi?id=194791
1142         <rdar://problem/48179240>
1143
1144         Reviewed by Alex Christensen, Fujii Hironori, and Brent Fulgham.
1145
1146         A new API test was added. Plenty of existing layout tests under
1147         http/tests/resourceLoadStatistics/ and http/tests/storageAccess/ test the code.
1148
1149         This patch introduces and adopts a new class called WebCore::RegistrableDomain
1150         which represents a domain's eTLD+1 (effective top level domain plus one) and is
1151         the basis for the term "site," as in same-site. Other popular names include
1152         high-level domain, primary domain, and top privately controlled/owned domain.
1153         Effective top level domains are enumerated on the Public Suffix List
1154         (https://publicsuffix.org).
1155
1156         This class just uses the full domain for when the Public Suffix List cannot help
1157         finding the registrable domain and for WebKit ports that haven't enabled
1158         PUBLIC_SUFFIX_LIST. It also uses the string "nullOrigin" as a representation
1159         for the null or unique origin (this matches how these origins were handled
1160         before).
1161
1162         The implementation is a wrapper around a String and the functions and class
1163         members that now make use of this new class used to handle regular String
1164         objects which didn't help much in terms of type safety or guarantees that the
1165         string had already been converted to an eTLD+1.
1166
1167         We've at least two bad bugs in the Storage Access API because of confusion
1168         between a URL's eTLD+1 and its host. The usage of WebCore::RegistrableDomain
1169         will prohibit such bugs in the future.
1170
1171         Partitioning in WebKit also uses eTLD+1 to a large extent. I plan to adopt
1172         WebCore::RegistrableDomain for partitioning in a later patch.
1173
1174         This patch also enhances parameter naming by:
1175         - Removing parts that refer to "primary" as in primaryDomain.
1176         - Replacing references to "TopPrivatelyControlledDomain" with "RegistrableDomain."
1177         - Replacing references to "TopPrivatelyOwnedDomain" with "RegistrableDomain."
1178         - Using the term "domain" consistently instead of e.g. "host."
1179
1180         * WebCore.xcodeproj/project.pbxproj:
1181         * dom/Document.cpp:
1182         (WebCore::Document::hasRequestedPageSpecificStorageAccessWithUserInteraction):
1183         (WebCore::Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction):
1184         * dom/Document.h:
1185         * html/HTMLAnchorElement.cpp:
1186         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
1187         * html/HTMLMediaElement.cpp:
1188         (WebCore::HTMLMediaElement::mediaSessionTitle const):
1189         * loader/AdClickAttribution.cpp:
1190         (WebCore::AdClickAttribution::url const):
1191         (WebCore::AdClickAttribution::referrer const):
1192         (WebCore::AdClickAttribution::toString const):
1193         * loader/AdClickAttribution.h:
1194         (WebCore::AdClickAttribution::Source::Source):
1195         (WebCore::AdClickAttribution::Source::matches const):
1196         (WebCore::AdClickAttribution::Source::deleteValue):
1197         (WebCore::AdClickAttribution::Destination::Destination):
1198         (WebCore::AdClickAttribution::Destination::matches const):
1199         (WebCore::AdClickAttribution::Destination::deleteValue):
1200         * loader/ResourceLoadObserver.cpp:
1201         (WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback):
1202         (WebCore::ResourceLoadObserver::setLogUserInteractionNotificationCallback):
1203         (WebCore::ResourceLoadObserver::setLogWebSocketLoadingNotificationCallback):
1204         (WebCore::ResourceLoadObserver::setLogSubresourceLoadingNotificationCallback):
1205         (WebCore::ResourceLoadObserver::setLogSubresourceRedirectNotificationCallback):
1206         (WebCore::ResourceLoadObserver::logSubresourceLoading):
1207         (WebCore::ResourceLoadObserver::logWebSocketLoading):
1208         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1209         (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener):
1210         (WebCore::ResourceLoadObserver::logFontLoad):
1211         (WebCore::ResourceLoadObserver::logCanvasRead):
1212         (WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure):
1213         (WebCore::ResourceLoadObserver::logNavigatorAPIAccessed):
1214         (WebCore::ResourceLoadObserver::logScreenAPIAccessed):
1215         (WebCore::ResourceLoadObserver::ensureResourceStatisticsForRegistrableDomain):
1216         (WebCore::ResourceLoadObserver::statisticsForOrigin):
1217         (WebCore::primaryDomain): Deleted.
1218         (WebCore::ResourceLoadObserver::ensureResourceStatisticsForPrimaryDomain): Deleted.
1219         * loader/ResourceLoadObserver.h:
1220         * loader/ResourceLoadStatistics.cpp:
1221         (WebCore::ResourceLoadStatistics::encode const):
1222         (WebCore::ResourceLoadStatistics::decode):
1223         (WebCore::ResourceLoadStatistics::toString const):
1224         (WebCore::ResourceLoadStatistics::merge):
1225         (WebCore::ResourceLoadStatistics::primaryDomain): Deleted.
1226         * loader/ResourceLoadStatistics.h:
1227         (WebCore::ResourceLoadStatistics::ResourceLoadStatistics):
1228         * page/Page.cpp:
1229         (WebCore::Page::logNavigation):
1230         (WebCore::Page::mainFrameLoadStarted):
1231         * page/Page.h:
1232         * page/PerformanceMonitor.cpp:
1233         (WebCore::reportPageOverPostLoadResourceThreshold):
1234         * platform/RegistrableDomain.h: Added.
1235         (WebCore::RegistrableDomain::RegistrableDomain):
1236         (WebCore::RegistrableDomain::isEmpty const):
1237         (WebCore::RegistrableDomain::string const):
1238         (WebCore::RegistrableDomain::operator!= const):
1239         (WebCore::RegistrableDomain::operator== const):
1240         (WebCore::RegistrableDomain::matches const):
1241         (WebCore::RegistrableDomain::isolatedCopy const):
1242         (WebCore::RegistrableDomain::isHashTableDeletedValue const):
1243         (WebCore::RegistrableDomain::hash const):
1244         (WebCore::RegistrableDomain::RegistrableDomainHash::hash):
1245         (WebCore::RegistrableDomain::RegistrableDomainHash::equal):
1246         (WebCore::RegistrableDomain::encode const):
1247         (WebCore::RegistrableDomain::decode):
1248         * platform/network/NetworkStorageSession.cpp:
1249         (WebCore::NetworkStorageSession::shouldBlockThirdPartyCookies const):
1250         (WebCore::NetworkStorageSession::shouldBlockCookies const):
1251         (WebCore::NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor):
1252         (WebCore::NetworkStorageSession::removePrevalentDomains):
1253         (WebCore::NetworkStorageSession::hasStorageAccess const):
1254         (WebCore::NetworkStorageSession::getAllStorageAccessEntries const):
1255         (WebCore::NetworkStorageSession::grantStorageAccess):
1256         (WebCore::getPartitioningDomain): Deleted.
1257         * platform/network/NetworkStorageSession.h:
1258
1259 2019-02-25  Chris Fleizach  <cfleizach@apple.com>
1260
1261         AX: <footer> HTML5 tag not reading as ARIA Landmark to VoiceOver
1262         https://bugs.webkit.org/show_bug.cgi?id=190138
1263         <rdar://problem/44907695>
1264
1265         Reviewed by Joanmarie Diggs.
1266
1267         Make sure that footer elements use the right role depending on their context.
1268         If scoped to body, they become contentinfo. Otherwise they are just delineated by
1269         a footer subrole.
1270
1271         * accessibility/AccessibilityObject.cpp:
1272         (WebCore::AccessibilityObject::isLandmark const):
1273         * accessibility/AccessibilityRenderObject.cpp:
1274         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
1275         (WebCore::AccessibilityRenderObject::isDescendantOfElementType const):
1276         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
1277         * accessibility/AccessibilityRenderObject.h:
1278         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1279         (-[WebAccessibilityObjectWrapper _accessibilityIsLandmarkRole:]):
1280         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1281         (-[WebAccessibilityObjectWrapper subrole]):
1282
1283 2019-02-25  Sihui Liu  <sihui_liu@apple.com>
1284
1285         IndexedDB: IDBDatabase and IDBTransaction are leaked in layout tests
1286         https://bugs.webkit.org/show_bug.cgi?id=194709
1287
1288         Reviewed by Geoffrey Garen.
1289
1290         When connection to IDB server is closed, IDBTransaction would abort without notifying IDBDatabase, so 
1291         IDBDatabase didn't clear its reference to IDBTransaction which created a reference cycle. 
1292  
1293         Also IDBTransaction didn't clear its reference to IDBRequest in this case and it led to another reference cycle
1294         between IDBOpenDBRequest and IDBTransaction.
1295
1296         Test: storage/indexeddb/IDBObject-leak.html
1297
1298         * Modules/indexeddb/IDBDatabase.cpp:
1299         (WebCore::IDBDatabase::connectionToServerLost):
1300         * Modules/indexeddb/IDBTransaction.cpp:
1301         (WebCore::IDBTransaction::IDBTransaction):
1302         (WebCore::IDBTransaction::~IDBTransaction):
1303         (WebCore::IDBTransaction::connectionClosedFromServer):
1304         * Modules/indexeddb/IDBTransaction.h:
1305         * testing/Internals.cpp:
1306         (WebCore::Internals::numberOfIDBTransactions const):
1307         * testing/Internals.h:
1308         * testing/Internals.idl:
1309
1310 2019-02-25  Zalan Bujtas  <zalan@apple.com>
1311
1312         Add missing stream parameter. Unreviewed.
1313
1314         * page/DOMTimer.cpp:
1315         (WebCore::DOMTimer::fired):
1316
1317 2019-02-25  Zalan Bujtas  <zalan@apple.com>
1318
1319         Unreviewed build fix after r242032.
1320
1321         * page/DOMTimer.cpp:
1322         (WebCore::DOMTimer::install):
1323
1324 2019-02-20  Darin Adler  <darin@apple.com>
1325
1326         Incorrect use of String::foldCase for font family names
1327         https://bugs.webkit.org/show_bug.cgi?id=194895
1328
1329         Reviewed by Myles C. Maxfield.
1330
1331         * platform/graphics/FontCascadeDescription.cpp:
1332         (WebCore::FontCascadeDescription::familiesEqualForTextAutoSizing): Use
1333         familyNamesAreEqual instead of calling convertToASCIILowercase directly.
1334         (WebCore::FontCascadeDescription::familyNamesAreEqual): Use AtomicString's
1335         operator== when we want case sensitive family name comparisons. This is a special
1336         case to accomodate CoreText, which uses "."-prefix names for internal fonts that
1337         are treated case sensitively. (Ideally webpages would not use these fonts at all.)
1338         (WebCore::FontCascadeDescription::familyNameHash): Use AtomicString's existingHash
1339         when we want case sensitive family name hashing.
1340         (WebCore::FontCascadeDescription::foldedFamilyName): Take a String instead of an
1341         AtomicString so we can use this at an additional call site. Converting from an
1342         AtomicString to a String if free and automatic at the existing call sites. Use
1343         convertToASCIILowercase instead of foldCase for three reasons: 1) Other functions
1344         here are folding only ASCII case by using ASCIICaseInsensitiveHash, and this one
1345         must be consistent. 2) this is considerably faster, and 3) font family names don't
1346         need arbitrary Unicode case folding, it's only A-Z that should be folded.
1347         * platform/graphics/FontCascadeDescription.h: Take a String instead of AtomicString
1348         in the foldedFamilyName function.
1349
1350         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1351         (WebCore::FontDatabase::collectionForFamily): Instead of calling foldCase, use
1352         FontCascadeDescription::foldedFamilyName to correctly fold font family names.
1353
1354 2019-02-25  Charlie Turner  <cturner@igalia.com>
1355
1356         [EME][GStreamer] Replace caps field loop with gst_structure_remove_fields
1357         https://bugs.webkit.org/show_bug.cgi?id=194992
1358
1359         Reviewed by Xabier Rodriguez-Calvar.
1360
1361         Refactoring, no new tests.
1362
1363         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
1364         (transformCaps): Simplify the code a little. The idea to use this
1365         utility function came from a review upstream here:
1366         https://gitlab.freedesktop.org/gstreamer/gst-devtools/merge_requests/67
1367
1368 2019-02-25  Alicia Boya García  <aboya@igalia.com>
1369
1370         [MSE][GStreamer] Batch player duration updates
1371         https://bugs.webkit.org/show_bug.cgi?id=194220
1372
1373         Reviewed by Xabier Rodriguez-Calvar.
1374
1375         This saves up a ton of CPU cycles doing layout unnecessarily when all
1376         the appended frames extend the duration of the movie, like in
1377         YTTV 2018 59.DASHLatencyVP9.
1378
1379         This patch is an optimization that introduces no new behavior.
1380
1381         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1382         (WebCore::AppendPipeline::consumeAppsinkAvailableSamples):
1383         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1384         (WebCore::MediaPlayerPrivateGStreamerMSE::blockDurationChanges):
1385         (WebCore::MediaPlayerPrivateGStreamerMSE::unblockDurationChanges):
1386         (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):
1387         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
1388
1389 2019-02-25  Miguel Gomez  <magomez@igalia.com>
1390
1391         [WPE] Add support for holepunch using an external video player
1392         https://bugs.webkit.org/show_bug.cgi?id=194899
1393
1394         Reviewed by Xabier Rodriguez-Calvar.
1395
1396         Implement the holepunch feature to allow playback using an external player. This creates
1397         a new dummy MediaPlayerPrivateHolePunch that accepts only the type "video/holepunch", and
1398         whose goal is to just draw a transparent rectangle in the position where the video should be.
1399         This can be used to allow a player placed on a lower plane than the browser to become visible.
1400
1401         Added ManualTest wpe/video-player-holepunch-external.html to test the feature.
1402
1403         * PlatformWPE.cmake:
1404         * platform/HolePunch.cmake: Added.
1405         * platform/graphics/MediaPlayer.cpp:
1406         (WebCore::buildMediaEnginesVector):
1407         * platform/graphics/holepunch/MediaPlayerPrivateHolePunch.cpp: Added.
1408         (WebCore::MediaPlayerPrivateHolePunch::MediaPlayerPrivateHolePunch):
1409         (WebCore::MediaPlayerPrivateHolePunch::~MediaPlayerPrivateHolePunch):
1410         (WebCore::MediaPlayerPrivateHolePunch::platformLayer const):
1411         (WebCore::MediaPlayerPrivateHolePunch::naturalSize const):
1412         (WebCore::MediaPlayerPrivateHolePunch::pushNextHolePunchBuffer):
1413         (WebCore::MediaPlayerPrivateHolePunch::swapBuffersIfNeeded):
1414         (WebCore::MediaPlayerPrivateHolePunch::proxy const):
1415         (WebCore::mimeTypeCache):
1416         (WebCore::MediaPlayerPrivateHolePunch::getSupportedTypes):
1417         (WebCore::MediaPlayerPrivateHolePunch::supportsType):
1418         (WebCore::MediaPlayerPrivateHolePunch::registerMediaEngine):
1419         (WebCore::MediaPlayerPrivateHolePunch::notifyReadyState):
1420         * platform/graphics/holepunch/MediaPlayerPrivateHolePunch.h: Added.
1421         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
1422         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
1423
1424 2019-02-24  Zalan Bujtas  <zalan@apple.com>
1425
1426         Introduce ContentChangeObserver class
1427         https://bugs.webkit.org/show_bug.cgi?id=194977
1428         <rdar://problem/48338115>
1429
1430         Reviewed by Simon Fraser.
1431
1432         This patch is about piping through all the related WK* calls. 
1433
1434         * SourcesCocoa.txt:
1435         * WebCore.xcodeproj/project.pbxproj:
1436         * dom/Document.cpp:
1437         (WebCore::Document::scheduleStyleRecalc):
1438         (WebCore::Document::updateStyleIfNeeded):
1439         (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
1440         * loader/FrameLoader.cpp:
1441         * page/DOMTimer.cpp:
1442         (WebCore::DOMTimer::install):
1443         (WebCore::DOMTimer::fired):
1444         * page/DOMWindow.cpp:
1445         (WebCore::DOMWindow::clearTimeout):
1446         * page/Frame.cpp:
1447         (WebCore::Frame::willDetachPage):
1448         * page/Page.h:
1449         (WebCore::Page::contentChangeObserver):
1450         * page/ios/EventHandlerIOS.mm:
1451         (WebCore::EventHandler::mouseMoved):
1452         * rendering/updating/RenderTreeUpdater.cpp:
1453         (WebCore::RenderTreeUpdater::updateElementRenderer):
1454         (WebCore::CheckForVisibilityChange::CheckForVisibilityChange):
1455         (WebCore::CheckForVisibilityChange::~CheckForVisibilityChange):
1456
1457 2019-02-24  Simon Fraser  <simon.fraser@apple.com>
1458
1459         Migrate from "fixedPositionRect" to "layoutViewport" in the scrolling tree
1460         https://bugs.webkit.org/show_bug.cgi?id=194984
1461
1462         Reviewed by Sam Weinig.
1463
1464         Rename "fixedPositionRect" to "layoutViewport" in scrolling tree code.
1465
1466         Remove ScrollingTree::fixedPositionRect() which was only used on iOS, to fetch the
1467         current layout viewport rect. Instead, set the layout viewport on the root
1468         node in ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling().
1469
1470         * page/scrolling/ScrollingTree.cpp:
1471         (WebCore::ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling):
1472         (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling): Deleted.
1473         * page/scrolling/ScrollingTree.h:
1474         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
1475         (WebCore::ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange):
1476         * page/scrolling/ScrollingTreeFrameHostingNode.h:
1477         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1478         * page/scrolling/ScrollingTreeNode.h:
1479         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1480         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterAncestorChange):
1481         * page/scrolling/ScrollingTreeScrollingNode.h:
1482         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
1483         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
1484         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
1485         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
1486         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
1487         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange):
1488         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1489         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
1490         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
1491         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange):
1492         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition):
1493
1494 2019-02-24  Devin Rousso  <drousso@apple.com>
1495
1496         Web Inspector: Change the InspectorOverlay to use native rather than canvas
1497         https://bugs.webkit.org/show_bug.cgi?id=105023
1498         <rdar://problem/13443692>
1499
1500         Reviewed by Brian Burg.
1501
1502         Should be no change in observed functionality.
1503
1504         * inspector/InspectorOverlay.h:
1505         * inspector/InspectorOverlay.cpp:
1506         (WebCore::truncateWithEllipsis): Added.
1507         (WebCore::localPointToRootPoint): Added.
1508         (WebCore::contentsQuadToCoordinateSystem):
1509         (WebCore::effectiveElementForNode): Added.
1510         (WebCore::quadToPath): Added.
1511         (WebCore::drawOutlinedQuadWithClip): Added.
1512         (WebCore::drawOutlinedQuad): Added.
1513         (WebCore::drawFragmentHighlight): Added.
1514         (WebCore::drawShapeHighlight): Added.
1515         (WebCore::InspectorOverlay::paint):
1516         (WebCore::InspectorOverlay::setIndicating):
1517         (WebCore::InspectorOverlay::shouldShowOverlay const):
1518         (WebCore::InspectorOverlay::update):
1519         (WebCore::InspectorOverlay::setShowPaintRects): Added.
1520         (WebCore::InspectorOverlay::showPaintRect):
1521         (WebCore::InspectorOverlay::updatePaintRectsTimerFired):
1522         (WebCore::InspectorOverlay::drawNodeHighlight):
1523         (WebCore::InspectorOverlay::drawQuadHighlight):
1524         (WebCore::InspectorOverlay::drawPaintRects):
1525         (WebCore::InspectorOverlay::drawBounds): Added.
1526         (WebCore::InspectorOverlay::drawRulers):
1527         (WebCore::InspectorOverlay::drawElementTitle): Added.
1528         (WebCore::contentsQuadToPage): Deleted.
1529         (WebCore::InspectorOverlay::setPausedInDebuggerMessage): Deleted.
1530         (WebCore::buildObjectForPoint): Deleted.
1531         (WebCore::buildObjectForRect): Deleted.
1532         (WebCore::buildArrayForQuad): Deleted.
1533         (WebCore::buildObjectForHighlight): Deleted.
1534         (WebCore::buildObjectForSize): Deleted.
1535         (WebCore::InspectorOverlay::setShowingPaintRects): Deleted.
1536         (WebCore::buildArrayForRendererFragments): Deleted.
1537         (WebCore::localPointToRoot): Deleted.
1538         (WebCore::appendPathCommandAndPoints): Deleted.
1539         (WebCore::appendPathSegment): Deleted.
1540         (WebCore::buildObjectForShapeOutside): Deleted.
1541         (WebCore::buildObjectForElementData): Deleted.
1542         (WebCore::InspectorOverlay::buildHighlightObjectForNode const): Deleted.
1543         (WebCore::InspectorOverlay::buildObjectForHighlightedNodes const): Deleted.
1544         (WebCore::InspectorOverlay::drawPausedInDebuggerMessage): Deleted.
1545         (WebCore::InspectorOverlay::overlayPage): Deleted.
1546         (WebCore::InspectorOverlay::forcePaint): Deleted.
1547         (WebCore::InspectorOverlay::reset): Deleted.
1548         (WebCore::evaluateCommandInOverlay): Deleted.
1549         (WebCore::InspectorOverlay::evaluateInOverlay): Deleted.
1550         (WebCore::InspectorOverlay::freePage): Deleted.
1551
1552         * inspector/agents/InspectorPageAgent.cpp:
1553         (WebCore::InspectorPageAgent::disable):
1554         (WebCore::InspectorPageAgent::setShowPaintRects):
1555         Drive-by: rename `setShowingPaintRects` to better match the protocol.
1556
1557         * inspector/agents/page/PageDebuggerAgent.h:
1558         * inspector/agents/page/PageDebuggerAgent.cpp:
1559         (WebCore::PageDebuggerAgent::PageDebuggerAgent):
1560         (WebCore::PageDebuggerAgent::setOverlayMessage): Deleted.
1561         Remove `Debugger.setOverlayMessage` command as it hasn't been used and is no longer supported.
1562
1563         * inspector/InspectorController.h:
1564         * inspector/InspectorController.cpp:
1565         (WebCore::InspectorController::createLazyAgents):
1566         (WebCore::InspectorController::disconnectFrontend):
1567         (WebCore::InspectorController::disconnectAllFrontends):
1568         (WebCore::InspectorController::buildObjectForHighlightedNodes const): Deleted.
1569
1570         * testing/Internals.h:
1571         * testing/Internals.idl:
1572         * testing/Internals.cpp:
1573         (WebCore::Internals::inspectorHighlightObject): Deleted.
1574
1575         * inspector/InspectorOverlayPage.css: Removed.
1576         * inspector/InspectorOverlayPage.html: Removed.
1577         * inspector/InspectorOverlayPage.js: Removed.
1578
1579         * CMakeLists.txt:
1580         * DerivedSources-input.xcfilelist:
1581         * DerivedSources-output.xcfilelist:
1582         * DerivedSources.make:
1583         * WebCore.xcodeproj/project.pbxproj:
1584
1585 2019-02-20  Darin Adler  <darin@apple.com>
1586
1587         Finish removing String::format
1588         https://bugs.webkit.org/show_bug.cgi?id=194893
1589
1590         Reviewed by Daniel Bates.
1591
1592         * dom/Document.cpp:
1593         (WebCore::Document::lastModified const): Use makeString and pad.
1594         * html/FTPDirectoryDocument.cpp:
1595         (WebCore::processFileDateString): Ditto.
1596
1597         * mathml/MathMLElement.cpp:
1598         (WebCore::convertToPercentageIfNeeded): Use makeString and FormattedNumber.
1599
1600         * page/cocoa/ResourceUsageOverlayCocoa.mm:
1601         (WebCore::ResourceUsageOverlay::platformDraw): Use makeString and pad.
1602
1603         * page/linux/ResourceUsageOverlayLinux.cpp:
1604         (WebCore::cpuUsageString): Use makeString, FormattedNumber, and pad.
1605         (WebCore::gcTimerString): Use String::number.
1606
1607         * platform/DateComponents.cpp:
1608         (WebCore::DateComponents::toStringForTime const): Use makeString and pad.
1609         (WebCore::DateComponents::toString const): Ditto.
1610
1611         * platform/LocalizedStrings.cpp: Removed comment that mentioned String::format,
1612         and that was also inaccurate.
1613
1614         * platform/audio/HRTFElevation.cpp:
1615         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
1616         Use makeString and pad.
1617         * platform/mock/MockRealtimeVideoSource.cpp:
1618         (WebCore::MockRealtimeVideoSource::drawText): Ditto.
1619         * rendering/RenderLayerCompositor.cpp:
1620         (WebCore::RenderLayerCompositor::logLayerInfo): Ditto.
1621         * rendering/RenderTheme.cpp:
1622         (WebCore::RenderTheme::formatMediaControlsTime const): Ditto.
1623
1624 2019-02-24  Michael Catanzaro  <mcatanzaro@igalia.com>
1625
1626         [WPE][GTK] Remove user agent quirk for washingtonpost.com
1627         https://bugs.webkit.org/show_bug.cgi?id=194981
1628
1629         Reviewed by Žan Doberšek.
1630
1631         Remove user agent quirk for washingtonpost.com because we support JPEG 2000 now.
1632
1633         * platform/UserAgentQuirks.cpp:
1634         (WebCore::urlRequiresChromeBrowser):
1635
1636 2019-02-23  Simon Fraser  <simon.fraser@apple.com>
1637
1638         Remove remnants of iOS WK1 scrolling tree code
1639         https://bugs.webkit.org/show_bug.cgi?id=194980
1640
1641         Reviewed by Sam Weinig.
1642
1643         Remove ScrollingTreeIOS and ScrollingCoordinatorIOS which were never instantiated,
1644         to reduce maintenance costs and simplify.
1645
1646         Merge ScrollingTreeFrameScrollingNodeIOS into ScrollingTreeFrameScrollingNodeRemoteIOS
1647         since that was the only concrete subclass, removing code which never applies to iOS WK2
1648         (e.g. the synchronous scrolling code path).
1649
1650         * SourcesCocoa.txt:
1651         * WebCore.xcodeproj/project.pbxproj:
1652         * page/FrameView.h:
1653         * page/scrolling/ScrollingCoordinator.cpp:
1654         * page/scrolling/ScrollingTree.h:
1655         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1656         * page/scrolling/ScrollingTreeNode.h:
1657         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1658         (WebCore::ScrollingTreeScrollingNode::handleWheelEvent):
1659         * page/scrolling/ScrollingTreeScrollingNode.h:
1660         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterDelegatedScroll): Deleted.
1661         (WebCore::ScrollingTreeScrollingNode::scrollableAreaSize const): Deleted.
1662         (WebCore::ScrollingTreeScrollingNode::totalContentsSize const): Deleted.
1663         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsets const): Deleted.
1664         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsets const): Deleted.
1665         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsetRanges const): Deleted.
1666         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsetRanges const): Deleted.
1667         (WebCore::ScrollingTreeScrollingNode::currentHorizontalSnapPointIndex const): Deleted.
1668         (WebCore::ScrollingTreeScrollingNode::currentVerticalSnapPointIndex const): Deleted.
1669         (WebCore::ScrollingTreeScrollingNode::setCurrentHorizontalSnapPointIndex): Deleted.
1670         (WebCore::ScrollingTreeScrollingNode::setCurrentVerticalSnapPointIndex): Deleted.
1671         (WebCore::ScrollingTreeScrollingNode::useDarkAppearanceForScrollbars const): Deleted.
1672         (WebCore::ScrollingTreeScrollingNode::lastCommittedScrollPosition const): Deleted.
1673         (WebCore::ScrollingTreeScrollingNode::reachableContentsSize const): Deleted.
1674         (WebCore::ScrollingTreeScrollingNode::parentRelativeScrollableRect const): Deleted.
1675         (WebCore::ScrollingTreeScrollingNode::scrollOrigin const): Deleted.
1676         (WebCore::ScrollingTreeScrollingNode::totalContentsSizeForRubberBand const): Deleted.
1677         (WebCore::ScrollingTreeScrollingNode::setTotalContentsSizeForRubberBand): Deleted.
1678         (WebCore::ScrollingTreeScrollingNode::horizontalScrollElasticity const): Deleted.
1679         (WebCore::ScrollingTreeScrollingNode::verticalScrollElasticity const): Deleted.
1680         (WebCore::ScrollingTreeScrollingNode::hasEnabledHorizontalScrollbar const): Deleted.
1681         (WebCore::ScrollingTreeScrollingNode::hasEnabledVerticalScrollbar const): Deleted.
1682         (WebCore::ScrollingTreeScrollingNode::canHaveScrollbars const): Deleted.
1683         (WebCore::ScrollingTreeScrollingNode::expectsWheelEventTestTrigger const): Deleted.
1684         (WebCore::ScrollingTreeScrollingNode::scrollContainerLayer const): Deleted.
1685         (WebCore::ScrollingTreeScrollingNode::scrolledContentsLayer const): Deleted.
1686         * page/scrolling/ios/ScrollingCoordinatorIOS.h: Removed.
1687         * page/scrolling/ios/ScrollingCoordinatorIOS.mm: Removed.
1688         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h: Removed.
1689         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: Removed.
1690         * page/scrolling/ios/ScrollingTreeIOS.cpp: Removed.
1691         * page/scrolling/ios/ScrollingTreeIOS.h: Removed.
1692         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1693         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
1694
1695 2019-02-23  Justin Fan  <justin_fan@apple.com>
1696
1697         [WebGPU] Buffer updates part 1: async mapping functions, unmap, and destroy
1698         https://bugs.webkit.org/show_bug.cgi?id=194665
1699
1700         Reviewed by Dean Jackson.
1701
1702         Test: map-write-buffers.html. Other tests updated to match new API.
1703
1704         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp: Added.
1705         (WebCore::validateBufferBindingType): Ensure buffer binding usages match the binding type.
1706         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Logic moved out from WebGPUDevice.cpp.
1707         * Modules/webgpu/WebGPUBindGroupDescriptor.h:
1708         * Modules/webgpu/WebGPUBuffer.cpp: Added GPUBuffer functionality.
1709         (WebCore::WebGPUBuffer::create):
1710         (WebCore::WebGPUBuffer::WebGPUBuffer):
1711         (WebCore::WebGPUBuffer::mapReadAsync):
1712         (WebCore::WebGPUBuffer::mapWriteAsync):
1713         (WebCore::WebGPUBuffer::unmap):
1714         (WebCore::WebGPUBuffer::destroy):
1715         (WebCore::WebGPUBuffer::rejectOrRegisterPromiseCallback): Register a mapping request on the GPUBuffer, if valid.
1716         * Modules/webgpu/WebGPUBuffer.h:
1717         (WebCore::WebGPUBuffer::buffer const):
1718         (WebCore::WebGPUBuffer::mapping const): Deleted.
1719         * Modules/webgpu/WebGPUBuffer.idl: Update to latest API and enable every function except setSubData.
1720         * Modules/webgpu/WebGPUCommandBuffer.cpp:
1721         (WebCore::WebGPUCommandBuffer::beginRenderPass): Renamed descriptor conversion method.
1722         * Modules/webgpu/WebGPUDevice.cpp:
1723         (WebCore::WebGPUDevice::createBuffer const): Update to non-nullable return type.
1724         (WebCore::WebGPUDevice::createBindGroup const): Move descriptor validation logic to descriptor implementation.
1725         * Modules/webgpu/WebGPUDevice.h:
1726         * Modules/webgpu/WebGPURenderPassDescriptor.cpp:
1727         (WebCore::WebGPURenderPassDescriptor::asGPURenderPassDescriptor const): Renamed from validateAndConvertToGPUVersion.
1728         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
1729         (WebCore::WebGPURenderPassEncoder::setVertexBuffers): Add validation for submitted buffers.
1730         * platform/graphics/gpu/GPUBuffer.cpp: Added.
1731         (WebCore::GPUBuffer::PendingMappingCallback::PendingMappingCallback): New struct for retaining a reference to mapping callbacks.
1732         * platform/graphics/gpu/GPUBuffer.h: Add functionality to retain callbacks and usage bits.
1733         (WebCore::GPUBuffer::isVertex const):
1734         (WebCore::GPUBuffer::isUniform const):
1735         (WebCore::GPUBuffer::isStorage const):
1736         (WebCore::GPUBuffer::isReadOnly const):
1737         (WebCore::GPUBuffer::PendingMapPromise::create):
1738         (WebCore::GPUBuffer::isMappable const):
1739         (WebCore::GPUBuffer::isMapWriteable const):
1740         (WebCore::GPUBuffer::isMapReadable const):
1741         (WebCore::GPUBuffer::mapping const): Deleted.
1742         * platform/graphics/gpu/GPUBufferUsage.h: enum class cannot be logical ORed together.
1743         * platform/graphics/gpu/GPUDevice.cpp:
1744         (WebCore::GPUDevice::tryCreateBuffer const): Renamed from createBuffer. 
1745         (WebCore::GPUDevice::createBuffer const): Deleted.
1746         * platform/graphics/gpu/GPUDevice.h:
1747         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
1748         (WebCore::GPUBuffer::tryCreateSharedBuffer): Attempt to create a MTLBuffer with shared memory.
1749         (WebCore::GPUBuffer::tryCreate): No longer use Gigacage-allocated memory for MTLBuffer.
1750         (WebCore::GPUBuffer::GPUBuffer):
1751         (WebCore::GPUBuffer::~GPUBuffer):
1752         (WebCore::GPUBuffer::registerMappingCallback): Register the provided callback to be executed when the staging buffer can be safely exposed.
1753         (WebCore::GPUBuffer::stagingBufferForRead): Prepare the arrayBuffer for reading and run the mapping callback.
1754         (WebCore::GPUBuffer::stagingBufferForWrite): Ditto, but for writing.
1755         (WebCore::GPUBuffer::unmap): If needed, copy the staging ArrayBuffer to the MTLBuffer. Unregister any mapping callback.
1756         (WebCore::GPUBuffer::destroy): Stub implementation for now. Frees the MTLBuffer as soon as possible.
1757         (WebCore::GPUBuffer::create): Deleted.
1758         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
1759         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder): Ensure only read-only GPUBuffers are used as read-only on the GPU.
1760
1761         Add symbols for new files:
1762         * Sources.txt:
1763         * WebCore.xcodeproj/project.pbxproj:
1764
1765 2019-02-23  Keith Miller  <keith_miller@apple.com>
1766
1767         Add new mac target numbers
1768         https://bugs.webkit.org/show_bug.cgi?id=194955
1769
1770         Reviewed by Tim Horton.
1771
1772         * Configurations/Base.xcconfig:
1773         * Configurations/DebugRelease.xcconfig:
1774
1775 2019-02-23  chris fleizach  <cfleizach@apple.com>
1776
1777         AX: WebKit is incorrectly mapping the <meter> element to progressbar
1778         https://bugs.webkit.org/show_bug.cgi?id=164051
1779         <rdar://problem/29055615>
1780
1781         Reviewed by Joanmarie Diggs.
1782
1783         Add a specific role for meter and map that to the appropriate mac role. 
1784
1785         * accessibility/AccessibilityNodeObject.cpp:
1786         (WebCore::AccessibilityNodeObject::canHaveChildren const):
1787         (WebCore::AccessibilityNodeObject::isProgressIndicator const):
1788         * accessibility/AccessibilityObject.cpp:
1789         (WebCore::AccessibilityObject::accessibleNameDerivesFromContent const):
1790         (WebCore::AccessibilityObject::isRangeControl const):
1791         (WebCore::AccessibilityObject::computedRoleString const):
1792         * accessibility/AccessibilityObjectInterface.h:
1793         * accessibility/AccessibilityProgressIndicator.cpp:
1794         (WebCore::AccessibilityProgressIndicator::roleValue const):
1795         * accessibility/AccessibilityProgressIndicator.h:
1796         * accessibility/AccessibilityRenderObject.cpp:
1797         (WebCore::AccessibilityRenderObject::shouldFocusActiveDescendant const):
1798         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1799         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
1800         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1801         (createAccessibilityRoleMap):
1802
1803 2019-02-22  Ryosuke Niwa  <rniwa@webkit.org>
1804
1805         Crash in SWServerJobQueue::runNextJobSynchronously
1806         https://bugs.webkit.org/show_bug.cgi?id=194974
1807
1808         Reviewed by Geoffrey Garen.
1809
1810         We suspect the crash is happening due to m_jobQueue being empty in runNextJobSynchronously
1811         or there is a timer heap corruption again :(
1812
1813         Exit early when m_jobQueue is empty. Also add a debug assert that this should never happen
1814         but convert an existing release assert to a debug assert since this appears to be hitting
1815         too frequently in wild.
1816
1817         * workers/service/server/SWServerJobQueue.cpp:
1818         (WebCore::SWServerJobQueue::runNextJobSynchronously):
1819
1820 2019-02-22  Simon Fraser  <simon.fraser@apple.com>
1821
1822         Clean up the setScrollPosition/setScrollPositionWithoutContentEdgeConstraints confusion in the scrolling tree nodes
1823         https://bugs.webkit.org/show_bug.cgi?id=194968
1824
1825         Reviewed by Antti Koivisto.
1826
1827         Having both setScrollPosition() and setScrollPositionWithoutContentEdgeConstraints() is confusing because
1828         you can't tell which is the bottleneck. So add a 'clamp' parameter to setScrollPosition() and merge them.
1829
1830         ScrollingTreeFrameScrollingNodeMac::setScrollPosition() replicates a bit of code but future cleanups will
1831         reduce that.
1832
1833         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1834         (WebCore::ScrollingTreeFrameScrollingNode::setScrollPosition): Deleted. This was the same as the base class method.
1835         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1836         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1837         (WebCore::ScrollingTreeScrollingNode::setScrollPosition):
1838         (WebCore::ScrollingTreeScrollingNode::clampScrollPosition const):
1839         (WebCore::ScrollingTreeScrollingNode::scrollBy):
1840         (WebCore::ScrollingTreeScrollingNode::setScrollPositionWithoutContentEdgeConstraints): Deleted.
1841         (WebCore::ScrollingTreeScrollingNode::scrollByWithoutContentEdgeConstraints): Deleted.
1842         * page/scrolling/ScrollingTreeScrollingNode.h:
1843         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
1844         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
1845         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPosition):
1846         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints): Deleted. Did nothing.
1847         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1848         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1849         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
1850         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
1851         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
1852         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): Deleted.
1853         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
1854         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
1855         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition):
1856         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): Deleted.
1857         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
1858         (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollByWithoutContentEdgeConstraints):
1859         * platform/PlatformWheelEvent.h:
1860         (WebCore::PlatformWheelEvent::delta const):
1861         * platform/ScrollTypes.h:
1862
1863 2019-02-22  Eric Liang  <ericliang@apple.com>
1864
1865         AX: Treat AXChildrenInNavigationOrder as AXChildren before adding support for aria-flowto
1866         https://bugs.webkit.org/show_bug.cgi?id=194923
1867
1868         Reviewed by Chris Fleizach.
1869
1870         Added AXChildrenInNavigationOrder attribute that returns the same array as from AXChildren. It prevents AppKit from reordering elements from the fallback AXChildren attribute.
1871
1872         Test: accessibility/mac/children-in-navigation-order-returns-children.html
1873
1874         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1875         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1876
1877 2019-02-22  Tim Horton  <timothy_horton@apple.com>
1878
1879         ProcessSwap.PageOverlayLayerPersistence fails on iOS and in debug builds
1880         https://bugs.webkit.org/show_bug.cgi?id=194963
1881
1882         Reviewed by Dean Jackson.
1883
1884         Tested by existing failing API test.
1885
1886         * page/Page.cpp:
1887         (WebCore::Page::installedPageOverlaysChanged): Deleted.
1888         * page/Page.h:
1889         (WebCore::Page::pageOverlayController):
1890         * page/PageOverlayController.cpp:
1891         (WebCore::PageOverlayController::installedPageOverlaysChanged):
1892         (WebCore::PageOverlayController::detachViewOverlayLayers):
1893         (WebCore::PageOverlayController::installPageOverlay):
1894         (WebCore::PageOverlayController::uninstallPageOverlay):
1895         (WebCore::PageOverlayController::willDetachRootLayer): Deleted.
1896         * page/PageOverlayController.h:
1897         As intended by r240940, move installedPageOverlaysChanged to PageOverlayController.
1898         Also, make it ignore isInWindow state; otherwise, if you install a overlay
1899         and then come into window, nothing installs the root layer. There is no
1900         need for this code to follow in-window state manually anymore since
1901         the DrawingArea and RenderLayerCompositor just hook the layers up when needed.
1902
1903         Make some methods private, and make detachViewOverlayLayers only touch
1904         *view* overlays, so that we don't detach the document-relative root
1905         layer when you drop to having no view overlays. This maintains
1906         existing behavior because nothing was calling PageOverlayController::detachViewOverlayLayers.
1907
1908         Now there are no callers of willDetachRootLayer, so remove it.
1909
1910 2019-02-22  Andy Estes  <aestes@apple.com>
1911
1912         [iOS] Break a reference cycle between PreviewLoader and ResourceLoader
1913         https://bugs.webkit.org/show_bug.cgi?id=194964
1914         <rdar://problem/48279441>
1915
1916         Reviewed by Alex Christensen.
1917
1918         When a document's QuickLook preview is loaded, a reference cycle is created between
1919         PreviewLoader and ResourceLoader. Break the cycle by clearing m_previewLoader in
1920         ResourceLoader::releaseResources().
1921
1922         Fixes leaks detected by `run-webkit-tests --leaks LayoutTests/quicklook`.
1923
1924         * loader/ResourceLoader.cpp:
1925         (WebCore::ResourceLoader::releaseResources):
1926
1927 2019-02-22  Sihui Liu  <sihui_liu@apple.com>
1928
1929         Crash under IDBServer::IDBConnectionToClient::identifier() const
1930         https://bugs.webkit.org/show_bug.cgi?id=194843
1931         <rdar://problem/48203102>
1932
1933         Reviewed by Geoffrey Garen.
1934
1935         UniqueIDBDatabase should ignore requests from connections that are already closed.
1936
1937         Tests are hard to create without some tricks on UniqueIDBDatabase so this fix is verified manually. 
1938         One test is created by adding delay to UniqueIDBDatabase::openBackingStore on the background thread to make sure
1939         disconnection of web process happens before UniqueIDBDatabase::didOpenBackingStore, because didOpenBackingStore
1940         may start a version change transaction and ask for identifier from the connection that is already gone.
1941
1942         * Modules/indexeddb/server/IDBConnectionToClient.cpp:
1943         (WebCore::IDBServer::IDBConnectionToClient::connectionToClientClosed):
1944         * Modules/indexeddb/server/IDBConnectionToClient.h:
1945         (WebCore::IDBServer::IDBConnectionToClient::isClosed):
1946         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1947         (WebCore::IDBServer::UniqueIDBDatabase::clearStalePendingOpenDBRequests):
1948         (WebCore::IDBServer::UniqueIDBDatabase::handleDatabaseOperations):
1949         (WebCore::IDBServer::UniqueIDBDatabase::operationAndTransactionTimerFired):
1950         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1951
1952 2019-02-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1953
1954         Input type "formatSetInlineTextDirection" is dispatched when changing paragraph-level text direction
1955         https://bugs.webkit.org/show_bug.cgi?id=194703
1956         <rdar://problem/48111775>
1957
1958         Reviewed by Ryosuke Niwa.
1959
1960         Currently, when changing text direction, WebKit always sends input events of type formatSetInlineTextDirection,
1961         even when changing paragraph text direction. Instead, we should be emitting formatSetBlockTextDirection in this
1962         scenario. This is problematic when using the context menus on macOS to change writing direction, since changing
1963         "Selection Direction" is currently indistinguishable from changing "Paragraph Direction".
1964
1965         To fix this, we split EditAction::SetWritingDirection into EditAction::SetInlineWritingDirection and
1966         EditAction::SetBlockWritingDirection, which emit inline and block text direction input events, respectively.
1967
1968         Tests: fast/events/before-input-events-prevent-block-text-direction.html
1969                fast/events/before-input-events-prevent-inline-text-direction.html
1970
1971         * editing/CompositeEditCommand.cpp:
1972         (WebCore::CompositeEditCommand::apply):
1973         * editing/EditAction.cpp:
1974         (WebCore::undoRedoLabel):
1975         * editing/EditAction.h:
1976         * editing/EditCommand.cpp:
1977         (WebCore::inputTypeNameForEditingAction):
1978         * editing/Editor.cpp:
1979         (WebCore::inputEventDataForEditingStyleAndAction):
1980         (WebCore::Editor::setBaseWritingDirection):
1981         * editing/EditorCommand.cpp:
1982         (WebCore::executeMakeTextWritingDirectionLeftToRight):
1983         (WebCore::executeMakeTextWritingDirectionNatural):
1984         (WebCore::executeMakeTextWritingDirectionRightToLeft):
1985
1986 2019-02-22  Rob Buis  <rbuis@igalia.com>
1987
1988         Remove stripLeadingAndTrailingWhitespace from MathMLElement.cpp
1989         https://bugs.webkit.org/show_bug.cgi?id=160172
1990
1991         Reviewed by Frédéric Wang.
1992
1993         Remove stripLeadingAndTrailingWhitespace and use stripLeadingAndTrailingHTTPSpaces
1994         from HTTPParsers instead.
1995
1996         No new tests, already covered by MathML tests.
1997
1998         * mathml/MathMLElement.cpp:
1999         (WebCore::MathMLElement::stripLeadingAndTrailingWhitespace): Deleted.
2000         * mathml/MathMLElement.h:
2001         * mathml/MathMLPresentationElement.cpp:
2002         (WebCore::MathMLPresentationElement::parseMathMLLength):
2003         * mathml/MathMLTokenElement.cpp:
2004         (WebCore::MathMLTokenElement::convertToSingleCodePoint):
2005
2006 2019-02-22  Eric Carlson  <eric.carlson@apple.com>
2007
2008         Update some media logging
2009         https://bugs.webkit.org/show_bug.cgi?id=194915
2010
2011         Reviewed by Jer Noble.
2012
2013         No new tests, no functional change.
2014
2015         * Modules/mediasource/SourceBuffer.cpp:
2016         (WebCore::SourceBuffer::evictCodedFrames):
2017         (WebCore::SourceBuffer::provideMediaData):
2018         (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued):
2019
2020         * html/HTMLMediaElement.cpp:
2021         (WebCore::HTMLMediaElement::checkPlaybackTargetCompatablity):
2022         (WebCore::HTMLMediaElement::loadResource):
2023         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
2024         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const):
2025         (WebCore::HTMLMediaElement::seekTask):
2026         (WebCore::HTMLMediaElement::playInternal):
2027         (WebCore::HTMLMediaElement::pauseInternal):
2028         (WebCore::HTMLMediaElement::setLoop):
2029         (WebCore::HTMLMediaElement::setControls):
2030         (WebCore::HTMLMediaElement::sourceWasRemoved):
2031
2032         * html/MediaElementSession.cpp:
2033         (WebCore::convertEnumerationToString):
2034
2035         * html/MediaElementSession.h:
2036         (WTF::LogArgument<WebCore::MediaPlaybackDenialReason>::toString):
2037
2038         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2039         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
2040
2041 2019-02-22  Rob Buis  <rbuis@igalia.com>
2042
2043         Fix unitless usage of mathsize
2044         https://bugs.webkit.org/show_bug.cgi?id=194940
2045
2046         Reviewed by Frédéric Wang.
2047
2048         Convert unitless lengths to percentage values to correct the computed
2049         font size.
2050
2051         * mathml/MathMLElement.cpp:
2052         (WebCore::convertToPercentageIfNeeded):
2053         (WebCore::MathMLElement::collectStyleForPresentationAttribute):
2054
2055 2019-02-21  Simon Fraser  <simon.fraser@apple.com>
2056
2057         Hardcode Visual Viewports on everywhere except iOS WK1
2058         https://bugs.webkit.org/show_bug.cgi?id=194928
2059
2060         Reviewed by Zalan Bujtas.
2061
2062         Remove the WK1 and WK2 preferences and MiniBrowser menu item for "visual viewports",
2063         change the default value of the Setting to 'true', and hardcode WebView on iOS to
2064         set it to false. The setting has shipped for several years and there's no need to turn
2065         it off now.
2066
2067         Similarly, disable the "Visual Viewport API" on iOS WK1, since it makes no sense if
2068         Visual Viewports are not enabled.
2069         
2070         Remove the "visualViewportEnabled" flag and unused code paths from scrolling tree code
2071         that only runs in WK2
2072
2073         * page/Settings.yaml:
2074         * page/scrolling/AsyncScrollingCoordinator.cpp:
2075         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
2076         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
2077         (WebCore::AsyncScrollingCoordinator::visualViewportEnabled const): Deleted.
2078         * page/scrolling/AsyncScrollingCoordinator.h:
2079         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
2080         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
2081         (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged):
2082         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties const):
2083         (WebCore::ScrollingStateFrameScrollingNode::setVisualViewportEnabled): Deleted.
2084         * page/scrolling/ScrollingStateFrameScrollingNode.h:
2085         * page/scrolling/ScrollingTree.cpp:
2086         (WebCore::ScrollingTree::commitTreeState):
2087         * page/scrolling/ScrollingTree.h:
2088         (WebCore::ScrollingTree::visualViewportEnabled const): Deleted.
2089         (WebCore::ScrollingTree::setVisualViewportEnabled): Deleted.
2090         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
2091         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition const):
2092         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2093         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
2094         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
2095
2096 2019-02-21  Darin Adler  <darin@apple.com>
2097
2098         Some refinements for Node and Document
2099         https://bugs.webkit.org/show_bug.cgi?id=194764
2100
2101         Reviewed by Ryosuke Niwa.
2102
2103         * accessibility/AccessibilityObject.cpp:
2104         (WebCore::AccessibilityObject::press): Use shadowHost instead of
2105         deprecatedShadowAncestorNode.
2106         (WebCore::AccessibilityObject::axObjectCache const): Tweak coding style.
2107         (WebCore::AccessibilityObject::focusedUIElement const): Use existing page
2108         function to streamline.
2109
2110         * accessibility/AccessibilityRenderObject.cpp:
2111         (WebCore::AccessibilityRenderObject::accessKey const): Use
2112         attributeWithoutSynchronization for efficiency and consistency with other
2113         code working with the accesskey attribute.
2114
2115         * dom/ContainerNode.cpp:
2116         (WebCore::ContainerNode::childrenChanged): Added call to
2117         invalidateAccessKeyCache, replacing old scheme tied to style recalculation.
2118
2119         * dom/DecodedDataDocumentParser.cpp:
2120         (WebCore::DecodedDataDocumentParser::appendBytes): Update for name and return
2121         type change of createDecoderIfNeeded to decoder.
2122         (WebCore::DecodedDataDocumentParser::flush): Ditto.
2123
2124         * dom/Document.cpp:
2125         (WebCore::Document::elementForAccessKey): Renamed from getElementForAccessKey
2126         to match WebKit coding style. Changed to use unique_ptr instead of separate
2127         boolean to keep track of map validity status.
2128         (WebCore::Document::buildAccessKeyCache): Renamed from buildAccessKeyMap to
2129         clarify that this is a cache. Changed to use composedTreeDescendants rather
2130         than explicit calls to shadowRoot. Use add instead of set so that first element
2131         in document order wins, instead of last element in document order. Updated
2132         to make a new map in a new unique_ptr instead of populating a map.
2133         (WebCore::Document::invalidateAccessKeyCacheSlowCase): Renamed from
2134         invalidateAccessKeyMap, and left an inline part in the header so the fast case
2135         of quickly checking for a null pointer can be inlined.
2136         (WebCore::Document::doctype const): Use downcast instead of static_cast.
2137         (WebCore::Document::scheduleStyleRecalc): Moved call to invalidateAccessKeyMap
2138         from here to childrenChanged and accesskey attribute change handling.
2139         (WebCore::Document::processFormatDetection): Set m_isTelephoneNumberParsingAllowed
2140         directly since this is the only place that does it and we don't need to factor
2141         that one line of code into a function.
2142         (WebCore::Document::getOverrideStyle): Moved to header since it's just a stub
2143         that always returns nullptr and can be inlined.
2144         (WebCore::Document::setIsTelephoneNumberParsingAllowed): Deleted.
2145         (WebCore::Document::ensureTemplateDocument): Removed nullptr frame argument to
2146         the create function, since Document::create now always involves no frame.
2147         (WebCore::Document::didAssociateFormControl): Changed argument type to a reference
2148         and simplified the logic with a local variable.
2149         (WebCore::Document::didAssociateFormControlsTimerFired): Simplified the null
2150         checks and rearranged things so that m_associatedFormControls will always
2151         get cleared even if the document is no longer associated with a page.
2152
2153         * dom/Document.h: Removed unnnecessary explicit values for enumerations (first
2154         value is always zero, etc.) and formatted simple enumerations in a single line
2155         for easier reading. Moved Document::create fucntion bodies out of line, removed
2156         the frame argument from the simple "create with URL" overload and made the frame
2157         argument for createNonRenderedPlaceholder be a reference rather than a pointer.
2158         Renamed getElementByAccessKey to elementForAccessKey, invalidateAccessKeyMap to
2159         invalidateAccessKeyCache, buildAccessKeyMap to buildAccessKeCache,
2160         m_elementsByAccessKey to m_accessKeyCache and changed its type.
2161         Removed bogus "DOM methods" comment, unused setParserFeature friend declaration,
2162         setIsTelephoneNumberParsingAllowed function, and m_accessKeyMapValid flag.
2163
2164         * dom/Document.idl: Added comment highlighting that getOverrideStyle is just a
2165         placeholder returning null.
2166
2167         * dom/Element.cpp:
2168         (WebCore::Element::attributeChanged): Call invalidateAccessKeyCache when the
2169         value of the accesskey attribute is changed. Also moved the class attribute code
2170         so the attributes here are in alphabetical order (only class and id were out of
2171         alphabetical order).
2172
2173         * dom/Node.cpp:
2174         (WebCore::Node::isDescendantOrShadowDescendantOf const): Rewrote to no longer
2175         use deprecatedShadowAncestorNode and used boolean operators to make it a
2176         single line and easier to understand. Also added a FIXME since the
2177         containsIncludingShadowDOM function is so similar, yet differently written.
2178         (WebCore::Node::contains const): Rewrote as a single line to make this easier
2179         to read and to *slightly* improve the speed in the "this == node" case.
2180         (WebCore::Node::containsIncludingHostElements const): Use downcast.
2181         (WebCore::Node::deprecatedShadowAncestorNode const): Deleted.
2182
2183         * dom/Node.h: Deleted now-unused deprecatedShadowAncestorNode.
2184
2185         * editing/ReplaceSelectionCommand.cpp:
2186         (WebCore::ReplacementFragment::ReplacementFragment): Rewrote to use shadowHost
2187         instead of deprecatedShadowAncestorNode.
2188
2189         * html/FormAssociatedElement.cpp:
2190         (WebCore::FormAssociatedElement::resetFormOwner): Pass reference to
2191         didAssociateFormControl.
2192         (WebCore::FormAssociatedElement::formAttributeChanged): Ditto.
2193
2194         * html/HTMLAreaElement.cpp:
2195         (WebCore::HTMLAreaElement::parseAttribute): Removed special case for accesskey
2196         attribute, because we want to call the base class parseAttribute in that case.
2197
2198         * html/HTMLFormElement.cpp:
2199         (WebCore::HTMLFormElement::insertedIntoAncestor): Pass reference to
2200         didAssociateFormControl.
2201
2202         * html/HTMLSelectElement.cpp:
2203         (WebCore::HTMLSelectElement::parseAttribute): Removed special case for accesskey
2204         attribute with mysterious FIXME, because we want to call the base class
2205         parseAttribute in that case. The old code had no effect before; the access key
2206         logic would still find the attribute; if the goal is to ignore the attribute
2207         for these elements we will need a different solution.
2208         * html/HTMLTextAreaElement.cpp:
2209         (WebCore::HTMLTextAreaElement::parseAttribute): Ditto.
2210
2211         * loader/DocumentLoader.cpp:
2212         (WebCore::DocumentLoader::DocumentLoader): Removed code that was always passing
2213         nullptr as the frame for the newly created DocumentWriter. It used m_frame, but
2214         m_frame was always null.
2215         (WebCore::DocumentLoader::attachToFrame): Pass reference to DocumentWriter::setFrame.
2216
2217         * loader/DocumentWriter.cpp:
2218         (WebCore::DocumentWriter::DocumentWriter): Deleted. The old version set m_frame to
2219         the passed in frame, which was always nullptr, and initialized some booleans and an
2220         enumeration, which are now initialized in the class definition.
2221         (WebCore::DocumentWriter::createDocument): Pass a reference for the frame.
2222         (WebCore::DocumentWriter::begin): Updated now that State is an enum class.
2223         (WebCore::DocumentWriter::decoder): Renamed from createDecoderIfNeeded and changed
2224         to return a reference.
2225         (WebCore::DocumentWriter::addData): Use RELEASE_ASSERT instead of if/CRASH and
2226         updated now that State is an enum class.
2227         (WebCore::DocumentWriter::insertDataSynchronously): Updated now that State is an
2228         enum class.
2229         (WebCore::DocumentWriter::end): Ditto.
2230
2231         * loader/DocumentWriter.h: Removed unneeded include and forward declaration.
2232         Removed the frame pointer argument to the constructor, caller was always passing a
2233         nullptr. Changed argument to setFrame to be a reference. Renamed createDecoderIfNeeded
2234         to decoder and changed it to return a reference. Initialized m_frame,
2235         m_hasReceivedSomeData, m_encodingWasChosenByUser, and m_state here so we don't need
2236         to initialize them in a constructor. Renamed the enum from WriterState to State since
2237         it's a member of DocumentWriter already, and made it an enum class rather than ending
2238         each enumeration value with WritingState.
2239
2240         * page/DragController.cpp:
2241         (WebCore::isEnabledColorInput): Removed boolean argument setToShadowAncestor. The
2242         one caller that formerly passed true now calls the new hasEnabledColorInputAsShadowHost
2243         function instead.
2244         (WebCore::hasEnabledColorInputAsShadowHost): Added.
2245         (WebCore::elementUnderMouse): Use shadowHost instead of deprecatedShadowAncestorNode.
2246         Also added FIXME since it seems this should instead be using parentElementInComposedTree.
2247         (WebCore::DragController::concludeEditDrag): Removed "false" argument to isEnabledColorInput.
2248         (WebCore::DragController::canProcessDrag): Removed "true" argument to isEnabledColorInput
2249         and added call to hasEnabledColorInputAsShadowHost. Also put the value of the node to drag
2250         into a local variable to simplify code.
2251         (WebCore::DragController::draggableElement const): Removed "false" argument to isEnabledColorInput.
2252
2253         * page/EventHandler.cpp:
2254         (WebCore::EventHandler::handleAccessKey): Update name of elementForAccessKey.
2255
2256         * page/FocusController.cpp:
2257         (WebCore::clearSelectionIfNeeded): Use shadowHost instead of deprecatedShadowAncestorNode.
2258
2259         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2260         (WebCore::createPageForServiceWorker): Pass reference instead of pointer for frame to
2261         Document::createNonRenderedPlaceholder.
2262
2263 2019-02-21  Daniel Bates  <dabates@apple.com>
2264
2265         Same Site Lax cookies are not sent with cross-site redirect from client-initiated load
2266         https://bugs.webkit.org/show_bug.cgi?id=194906
2267         <rdar://problem/44305947>
2268
2269         Reviewed by Brent Fulgham.
2270
2271         Ensure that a request for a top-level navigation is annotated as such regardless of whether
2272         the request has a computed Same Site policy.
2273
2274         "New loads" initiated by a the client (Safari) either by API or a human either explicitly
2275         typing a URL in the address bar or Command + clicking a hyperlink to open it in a new window/tab
2276         are always considered Same Site. This is by definition from the spec. [1] as we aren't navigating
2277         from an existing page. (Command + click should be thought of as a convenience to the user from
2278         having to copy the hyperlink's URL, create a new window, and paste the URL into the address bar).
2279         Currently the frame loader marks a request as a top-level navigation if and only if the request
2280         does not have a pre-computed Same Site policy. However, "New loads" have a pre-computed Same Site
2281         policy. So, these loads would never be marked as a top-level navigation by the frame loading code.
2282         Therefore, if the "new load" turned out to be a cross-site redirect then WebKit would incorrectly
2283         tell the networking stack that the load was a cross-site, non-top-level navigation, and per the
2284         Same Site spec [2], the networking stack would not send Same Site Lax cookies. Instead,
2285         WebKit should unconditionally ensure that requests are marked as a top-level navigation, if applicable.
2286
2287         [1] See Note for (1) in  <https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-5.2>
2288         [2] <https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-5.3.7.1>
2289
2290         Test: http/tests/cookies/same-site/user-load-cross-site-redirect.php
2291
2292         * loader/FrameLoader.cpp:
2293         (WebCore::FrameLoader::addExtraFieldsToRequest): Unconditionally update the request's top-
2294         level navigation bit.
2295         * platform/network/ResourceRequestBase.cpp:
2296         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Unconditionally copy a request's top-
2297         level navigation bit.
2298
2299 2019-02-21  Per Arne Vollan  <pvollan@apple.com>
2300
2301         Layout Test fast/text/international/khmer-selection.html is crashing
2302         https://bugs.webkit.org/show_bug.cgi?id=191368
2303
2304         Reviewed by Brent Fulgham.
2305
2306         GlyphBuffer's offset array wasn't getting filled by UniscribeController.
2307         Our underlining code requires this array.
2308
2309         Uniscribe gives us a character -> glyph mapping, so we just have to compute
2310         the inverse and give it to the GlyphBuffer.
2311
2312         This patch is written by Myles C. Maxfield.
2313
2314         Test: fast/text/international/khmer-selection.html.
2315
2316         * platform/graphics/GlyphBuffer.h:
2317         (WebCore::GlyphBuffer::add):
2318         * platform/graphics/displaylists/DisplayListItems.cpp:
2319         (WebCore::DisplayList::DrawGlyphs::generateGlyphBuffer const):
2320         * platform/graphics/win/UniscribeController.cpp:
2321         (WebCore::UniscribeController::advance):
2322         (WebCore::UniscribeController::itemizeShapeAndPlace):
2323         (WebCore::UniscribeController::shapeAndPlaceItem):
2324         * platform/graphics/win/UniscribeController.h:
2325
2326 2019-02-21  Sihui Liu  <sihui_liu@apple.com>
2327
2328         IndexedDB: leak UniqueIDBDatabase in layout tests
2329         https://bugs.webkit.org/show_bug.cgi?id=194870
2330         <rdar://problem/48163812>
2331
2332         Reviewed by Geoffrey Garen.
2333
2334         UniqueIDBDatabase owns a pointer to itself after it is hard closed. It should release the pointer when it 
2335         receives confirmation from clients and all pending tasks are done. UniqueIDBDatabase already checks whether the
2336         pointer should be released when a database task finishes, but it didn't perform a check when a confirm message 
2337         is received. 
2338
2339         No new test as the order of task completion and confirmation arrival is uncertain.
2340
2341         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2342         (WebCore::IDBServer::UniqueIDBDatabase::confirmDidCloseFromServer):
2343
2344 2019-02-21  Andy Estes  <aestes@apple.com>
2345
2346         contentfiltering tests leak documents
2347         https://bugs.webkit.org/show_bug.cgi?id=189434
2348         <rdar://44239943>
2349
2350         Reviewed by Simon Fraser.
2351
2352         Changed ContentFilter to capture the blocked Frame as a WeakPtr to break a reference cycle.
2353
2354         This fixes world leaks in several tests in LayoutTests/contentfiltering/.
2355
2356         * bindings/js/ScriptController.h:
2357         * loader/ContentFilter.cpp:
2358         (WebCore::ContentFilter::didDecide):
2359
2360 2019-02-21  Don Olmstead  <don.olmstead@sony.com>
2361
2362         [CMake][Win] Fix !USE(CF) build of WebCore
2363         https://bugs.webkit.org/show_bug.cgi?id=194879
2364
2365         Reviewed by Konstantin Tokarev.
2366
2367         * PlatformAppleWin.cmake:
2368         * PlatformWin.cmake:
2369         * PlatformWinCairo.cmake:
2370
2371 2019-02-21  Zalan Bujtas  <zalan@apple.com>
2372
2373         [LFC][Floats] Add support for placing formatting roots in-between floats.
2374         https://bugs.webkit.org/show_bug.cgi?id=194902
2375
2376         Reviewed by Antti Koivisto.
2377
2378         This patch add support for placing a formatting root box in-between existing floats.
2379         The initial vertical position of a formatting root is its static position which can make the box
2380         placed above exsiting floats (whereas we can never place a regular float above existing floats.)
2381
2382         Test: fast/block/block-only/floats-and-block-formatting-roots.html
2383
2384         * layout/blockformatting/BlockFormattingContext.cpp:
2385         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
2386         * layout/floats/FloatingContext.cpp:
2387         (WebCore::Layout::FloatPair::LeftRightIndex::isEmpty const):
2388         (WebCore::Layout::FloatPair::isEmpty const):
2389         (WebCore::Layout::FloatPair::operator* const):
2390         (WebCore::Layout::Iterator::operator* const):
2391         (WebCore::Layout::begin):
2392         (WebCore::Layout::end):
2393         (WebCore::Layout::FloatingContext::positionForFloat const):
2394         (WebCore::Layout::FloatingContext::positionForFormattingContextRoot const):
2395         (WebCore::Layout::findAvailablePosition):
2396         (WebCore::Layout::FloatingContext::findPositionForFloatBox const):
2397         (WebCore::Layout::FloatingContext::findPositionForFormattingContextRoot const):
2398         (WebCore::Layout::FloatPair::FloatPair):
2399         (WebCore::Layout::FloatPair::left const):
2400         (WebCore::Layout::FloatPair::right const):
2401         (WebCore::Layout::FloatPair::intersects const):
2402         (WebCore::Layout::FloatPair::operator == const):
2403         (WebCore::Layout::FloatPair::horizontalConstraints const):
2404         (WebCore::Layout::FloatPair::bottom const):
2405         (WebCore::Layout::Iterator::operator++):
2406         (WebCore::Layout::Iterator::set):
2407         (WebCore::Layout::FloatingPair::isEmpty const): Deleted.
2408         (WebCore::Layout::FloatingPair::verticalConstraint const): Deleted.
2409         (WebCore::Layout::FloatingContext::positionForFloatAvoiding const): Deleted.
2410         (WebCore::Layout::FloatingContext::floatingPosition const): Deleted.
2411         (WebCore::Layout::FloatingPair::FloatingPair): Deleted.
2412         (WebCore::Layout::FloatingPair::left const): Deleted.
2413         (WebCore::Layout::FloatingPair::right const): Deleted.
2414         (WebCore::Layout::FloatingPair::intersects const): Deleted.
2415         (WebCore::Layout::FloatingPair::operator == const): Deleted.
2416         (WebCore::Layout::FloatingPair::horizontalConstraints const): Deleted.
2417         (WebCore::Layout::FloatingPair::bottom const): Deleted.
2418         * layout/floats/FloatingContext.h:
2419
2420 2019-02-21  Rob Buis  <rbuis@igalia.com>
2421
2422         Update MIME type parser
2423         https://bugs.webkit.org/show_bug.cgi?id=180526
2424
2425         Reviewed by Darin Adler.
2426
2427         Further testing showed the MIME parser needs these fixes:
2428         - stripWhitespace is wrong for removing HTTP whitespace, use
2429           stripLeadingAndTrailingHTTPSpaces instead.
2430         - HTTP Token code points checking for Rfc2045 and Mimesniff were
2431           mixed up, use the dedicated isValidHTTPToken for Mimesniff mode.
2432         - Quoted Strings were not unescaped/escaped, this seems ok for
2433           serializing but is wrong when gettings individual parameter values.
2434           Implement [1] and [2] Step 2.4 to properly unescape and escape.
2435
2436         This change also tries to avoid hard to read uses of find.
2437
2438         Test: ParsedContentType.Serialize
2439
2440         [1] https://fetch.spec.whatwg.org/#collect-an-http-quoted-string
2441         [2] https://mimesniff.spec.whatwg.org/#serializing-a-mime-type
2442
2443         * platform/network/ParsedContentType.cpp:
2444         (WebCore::skipSpaces):
2445         (WebCore::parseToken):
2446         (WebCore::isNotQuoteOrBackslash):
2447         (WebCore::collectHTTPQuotedString):
2448         (WebCore::containsNonTokenCharacters):
2449         (WebCore::parseQuotedString):
2450         (WebCore::ParsedContentType::parseContentType):
2451         (WebCore::ParsedContentType::create):
2452         (WebCore::ParsedContentType::setContentType):
2453         (WebCore::containsNonQuoteStringTokenCharacters):
2454         (WebCore::ParsedContentType::setContentTypeParameter):
2455         (WebCore::ParsedContentType::serialize const):
2456         (WebCore::substringForRange): Deleted.
2457         (WebCore::isNonTokenCharacter): Deleted.
2458         (WebCore::isNonQuotedStringTokenCharacter): Deleted.
2459         * platform/network/ParsedContentType.h:
2460
2461 2019-02-20  Simon Fraser  <simon.fraser@apple.com>
2462
2463         REGRESSION (240698): Fixed position banners flicker and move when scrolling on iOS
2464         https://bugs.webkit.org/show_bug.cgi?id=194889
2465         rdar://problem/47755552
2466
2467         Reviewed by Tim Horton.
2468         
2469         After r240698 we could commit scrolling changes for a fixed node where the "viewportRectAtLastLayout" and the layer
2470         position were mismatched; this happened when AsyncScrollingCoordinator::reconcileScrollingState() came back from the UI process
2471         with an unstable update and set a new layoutViewport, then some other layout triggered a compositing tree update. During the tree
2472         update, we'd update the fixed scrolling node with the new viewport, and an old layer position.
2473         
2474         Fix by ensuring that we only update the geometry info for a scrolling tree node when we update layer geometry for the corresponding
2475         layer.
2476
2477         Not currently testable.
2478
2479         * rendering/RenderLayerCompositor.cpp:
2480         (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
2481
2482 2019-02-20  Dean Jackson  <dino@apple.com>
2483
2484         Rotation animations sometimes use the wrong origin (affects apple.com)
2485         https://bugs.webkit.org/show_bug.cgi?id=194878
2486         <rdar://problem/43908047>
2487
2488         Reviewed by Simon Fraser.
2489
2490         Some versions of CoreAnimation apply additive animations in reverse
2491         order. Detect this and reverse the list of animations we provide.
2492
2493         Update the existing animations/additive-transform-animations.html test to
2494         be a ref-test that would identify this failure. Previously it relied on
2495         a pixel test.
2496
2497         * platform/graphics/ca/GraphicsLayerCA.cpp: Use 
2498             HAVE_CA_WHERE_ADDITIVE_TRANSFORMS_ARE_REVERSED to decide whether or
2499             not to flip the list of animations (and mark the correct ones as
2500             additive).
2501         (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
2502         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
2503
2504 2019-02-20  Don Olmstead  <don.olmstead@sony.com>
2505
2506         [Win] Guard CF usage in RenderThemeWin
2507         https://bugs.webkit.org/show_bug.cgi?id=194875
2508
2509         Reviewed by Alex Christensen.
2510
2511         No new tests. No change in behavior.
2512
2513         Add #if USE(CF) checks to RenderThemeWin so it can compile without CF support.
2514
2515         * rendering/RenderThemeWin.cpp:
2516         (WebCore::RenderThemeWin::stringWithContentsOfFile):
2517         (WebCore::RenderThemeWin::mediaControlsStyleSheet):
2518         (WebCore::RenderThemeWin::mediaControlsScript):
2519         * rendering/RenderThemeWin.h:
2520
2521 2019-02-20  Ryosuke Niwa  <rniwa@webkit.org>
2522
2523         Crash in DOMWindowExtension::suspendForPageCache
2524         https://bugs.webkit.org/show_bug.cgi?id=194871
2525
2526         Reviewed by Chris Dumez.
2527
2528         This is a speculative fix for a crash in DOMWindowExtension::suspendForPageCache.
2529
2530         We think it's possible for DOMWindowExtension::suspendForPageCache notifying the clients via
2531         dispatchWillDisconnectDOMWindowExtensionFromGlobalObject to remove other DOMWindowExtension's.
2532         Check that each DOMWindowProperty is still in m_properties before invoking suspendForPageCache
2533         to avoid the crash.
2534
2535         * page/DOMWindow.cpp:
2536         (WebCore::DOMWindow::willDestroyCachedFrame):
2537         (WebCore::DOMWindow::willDestroyDocumentInFrame):
2538         (WebCore::DOMWindow::willDetachDocumentFromFrame):
2539         (WebCore::DOMWindow::suspendForPageCache):
2540         (WebCore::DOMWindow::resumeFromPageCache):
2541         * page/DOMWindowExtension.cpp:
2542         (WebCore::DOMWindowExtension::suspendForPageCache):
2543
2544 2019-02-20  Alex Christensen  <achristensen@webkit.org>
2545
2546         Always call CompletionHandlers after r240909
2547         https://bugs.webkit.org/show_bug.cgi?id=194823
2548
2549         Reviewed by Ryosuke Niwa.
2550
2551         * loader/PolicyChecker.cpp:
2552         (WebCore::PolicyChecker::checkNavigationPolicy):
2553         (WebCore::PolicyChecker::checkNewWindowPolicy):
2554
2555 2019-02-20  Andy Estes  <aestes@apple.com>
2556
2557         [Xcode] Add SDKVariant.xcconfig to various Xcode projects
2558         https://bugs.webkit.org/show_bug.cgi?id=194869
2559
2560         Rubber-stamped by Jer Noble.
2561
2562         * WebCore.xcodeproj/project.pbxproj:
2563
2564 2019-02-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
2565
2566         drawImage() clears the canvas if it's the source of the image and globalCompositeOperation is "copy"
2567         https://bugs.webkit.org/show_bug.cgi?id=194746
2568
2569         Reviewed by Dean Jackson.
2570
2571         Test: fast/canvas/canvas-drawImage-composite-copy.html
2572
2573         If the source canvas of drawImage() is the same as the destination and
2574         globalCompositeOperation is set to "copy", copy the srcRect from the 
2575         canvas to a temporary buffer before calling clearCanvas() then drawImage
2576         from this temporary buffer.
2577
2578         * html/canvas/CanvasRenderingContext2DBase.cpp:
2579         (WebCore::CanvasRenderingContext2DBase::drawImage):
2580         * platform/graphics/ImageBuffer.cpp:
2581         (WebCore::ImageBuffer::copyRectToBuffer):
2582         * platform/graphics/ImageBuffer.h:
2583
2584 2019-02-20  Simon Fraser  <simon.fraser@apple.com>
2585
2586         REGRESSION (r241788>): ASSERTION FAILED: !m_normalFlowListDirty in TestWebKitAPI.WebKit.ResizeReversePaginatedWebView test
2587         https://bugs.webkit.org/show_bug.cgi?id=194866
2588
2589         Reviewed by Antti Koivisto.
2590
2591         r241788 removed some calls that updated layer lists (normal flow and z-order) during compositing updates, causing
2592         a later call to RenderLayerCompositor::recursiveRepaintLayer() to assert when the lists were dirty. Fix by updating
2593         the lists in RenderLayerCompositor::recursiveRepaintLayer(), as we do in various other places.
2594
2595         * rendering/RenderLayerCompositor.cpp:
2596         (WebCore::RenderLayerCompositor::recursiveRepaintLayer):
2597
2598 2019-02-20  Daniel Bates  <dabates@apple.com>
2599
2600         [iOS] Tweak UI for focus rings
2601         https://bugs.webkit.org/show_bug.cgi?id=194864
2602         <rdar://problem/47831886>
2603
2604         Reviewed by Brent Fulgham.
2605
2606         Make use of UIKit constants to make focus rings pretty.
2607
2608         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
2609         (WebCore::drawFocusRingAtTime):
2610
2611 2019-02-20  Timothy Hatcher  <timothy@apple.com>
2612
2613         RenderThemeIOS should use RenderTheme's color cache instead of its own.
2614         https://bugs.webkit.org/show_bug.cgi?id=194822
2615         rdar://problem/48208296
2616
2617         Reviewed by Tim Horton.
2618
2619         Tested by fast/css/apple-system-colors.html.
2620
2621         * css/CSSValueKeywords.in:
2622         * css/parser/CSSPropertyParser.cpp:
2623         (WebCore::isAppleLegacyCssValueKeyword):
2624         * platform/graphics/Color.h:
2625         * platform/graphics/cg/ColorCG.cpp:
2626         (WebCore::makeRGBAFromCGColor):
2627         (WebCore::Color::Color):
2628         * rendering/RenderThemeIOS.h:
2629         * rendering/RenderThemeIOS.mm:
2630         (WebCore::RenderThemeIOS::systemColor const):
2631         * rendering/RenderThemeMac.mm:
2632         (WebCore::RenderThemeMac::systemColor const):
2633
2634 2019-02-20  Loïc Yhuel  <loic.yhuel@softathome.com>
2635
2636         Fix crash when opening Web Inspector after a WebSocket was blocked by content extensions
2637         https://bugs.webkit.org/show_bug.cgi?id=194819
2638
2639         Reviewed by Joseph Pecoraro.
2640
2641         Test: http/tests/inspector/network/contentextensions/blocked-websocket-crash.html
2642
2643         * Modules/websockets/WebSocketChannel.h:
2644         (WebCore::WebSocketChannel::hasCreatedHandshake):
2645         * inspector/agents/page/PageNetworkAgent.cpp:
2646         Ignore WebSocketChannel without an WebSocketHandshake, which would crash in InspectorNetworkAgent::enable.
2647
2648 2019-02-20  Zalan Bujtas  <zalan@apple.com>
2649
2650         [LFC][Floats] Make FloatAvoider::resetPosition implicit
2651         https://bugs.webkit.org/show_bug.cgi?id=194855
2652
2653         Reviewed by Antti Koivisto.
2654
2655         Let's compute the initial top/left position during c'tor time.
2656         This is in preparation for fixing formatting root box placement in a float context.
2657
2658         * layout/floats/FloatAvoider.cpp:
2659         (WebCore::Layout::FloatAvoider::resetPosition): Deleted.
2660         * layout/floats/FloatAvoider.h:
2661         (WebCore::Layout::FloatAvoider::displayBox):
2662         (WebCore::Layout::FloatAvoider::initialVerticalPosition const): Deleted.
2663         * layout/floats/FloatBox.cpp:
2664         (WebCore::Layout::FloatBox::FloatBox):
2665         (WebCore::Layout::FloatBox::initialVerticalPosition const):
2666         * layout/floats/FloatBox.h:
2667         * layout/floats/FloatingContext.cpp:
2668         (WebCore::Layout::FloatingContext::floatingPosition const):
2669
2670 2019-02-20  Don Olmstead  <don.olmstead@sony.com>
2671
2672         [MSVC] Fix compilation errors with lambdas in Service Workers
2673         https://bugs.webkit.org/show_bug.cgi?id=194841
2674
2675         Reviewed by Alex Christensen.
2676
2677         No new tests. No change in behavior.
2678
2679         MSVC has problems with the scoping of `this` within a nested lambda. In these cases `this` is
2680         referring to the enclosing lambda according to MSVC. This patch works around this behavior
2681         through by using the `protectedThis` pattern in WebKit code.
2682
2683         * workers/service/server/RegistrationDatabase.cpp:
2684         (WebCore::RegistrationDatabase::openSQLiteDatabase):
2685
2686 2019-02-20  Adrian Perez de Castro  <aperez@igalia.com>
2687
2688         [WPE][GTK] Enable support for CONTENT_EXTENSIONS
2689         https://bugs.webkit.org/show_bug.cgi?id=167941
2690
2691         Reviewed by Carlos Garcia Campos.
2692
2693         * platform/gtk/po/POTFILES.in: Added WebKitUserContentFilterStore.cpp
2694         to the list of files with translatable strings.
2695
2696 2019-02-19  Simon Fraser  <simon.fraser@apple.com>
2697
2698         REGRESSION (r238090): Toggling visibility on the <html> element can result in a blank web view
2699         https://bugs.webkit.org/show_bug.cgi?id=194827
2700         rdar://problem/47620594
2701
2702         Reviewed by Antti Koivisto.
2703
2704         Incremental compositing updates, added in rr238090, use repaints as a trigger for re-evaluating
2705         layer configurations, since a repaint implies that a layer gains painted content. This is done
2706         via the call to setNeedsCompositingConfigurationUpdate() in RenderLayerBacking::setContentsNeedDisplay{InRect}.
2707         The RenderView's layer is opted out of this to avoid doing lots of redundant layer config recomputation
2708         for the root. The configuration state that matters here is whether the layer contains painted content,
2709         and therefore needs backing store; this is computed by RenderLayerBacking::isSimpleContainerCompositingLayer(),
2710         and feeds into GraphicsLayer::drawsContent().
2711
2712         However, if <html> starts as "visibility:hidden" or "opacity:0", as some sites do to hide incremental loading,
2713         then we'll fail to recompute 'drawsContent' for the root and leave the root with drawsContent=false, which
2714         causes RenderLayerBacking::setContentsNeedDisplay{InRect} to short-circuit, and then we paint nothing.
2715
2716         Ironically, 'drawsContent' doesn't actually save any backing store for the root, since it has no affect on
2717         the root tile caches; we always make tiles. So the simple fix here is to change RenderLayerBacking::isSimpleContainerCompositingLayer()
2718         to always return false for the RenderView's layer (the root).
2719         
2720         Testing this was tricky; ref testing doesn't work because we force repaint, and we normally skip
2721         properties of the root in layer tree dumps to hide WK1/WK2 differences. Therefore I had to add
2722         LAYER_TREE_INCLUDES_ROOT_LAYER_PROPERTIES and fix RenderLayerBacking::shouldDumpPropertyForLayer to
2723         respect it.
2724
2725         Test: compositing/visibility/root-visibility-toggle.html
2726
2727         * page/Frame.h:
2728         * platform/graphics/GraphicsLayer.cpp:
2729         (WebCore::GraphicsLayer::dumpProperties const):
2730         * platform/graphics/GraphicsLayerClient.h:
2731         (WebCore::GraphicsLayerClient::shouldDumpPropertyForLayer const):
2732         * rendering/RenderLayerBacking.cpp:
2733         (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer const):
2734         (WebCore::RenderLayerBacking::shouldDumpPropertyForLayer const):
2735         * rendering/RenderLayerBacking.h:
2736         * rendering/RenderLayerCompositor.cpp:
2737         (WebCore::RenderLayerCompositor::layerTreeAsText):
2738         * testing/Internals.cpp:
2739         (WebCore::toLayerTreeFlags):
2740         * testing/Internals.h:
2741         * testing/Internals.idl:
2742
2743 2019-02-19  Ryosuke Niwa  <rniwa@webkit.org>
2744
2745         REGRESSION(r240909): Release assertion in FrameLoader::loadPostRequest when opening new window
2746         https://bugs.webkit.org/show_bug.cgi?id=194820
2747
2748         Reviewed by Geoffrey Garen.
2749
2750         This release assertion was wrong. The invocation of PolicyChecker::checkNewWindowPolicy in FrameLoader
2751         doesn’t require PolicyChecker's load type to be set in PolicyChecker because FrameLoader's
2752         continueLoadAfterNewWindowPolicy invokes loadWithNavigationAction which sets the load type later,
2753         and we don't rely on PolicyChecker's load type until then.
2754
2755         Fixed the crash by removing relese asserts before invoking checkNewWindowPolicy accordingly.
2756
2757         This patch reverts r241015 since it too was asserting that PolicyChecker's load type is set before
2758         invoking checkNewWindowPolicy which is not the right assumption.
2759
2760         Test: fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation.html
2761
2762         * loader/FrameLoader.cpp:
2763         (WebCore::FrameLoader::loadURL):
2764         (WebCore::FrameLoader::load):
2765         (WebCore::FrameLoader::loadPostRequest):
2766
2767 2019-02-19  Zalan Bujtas  <zalan@apple.com>
2768
2769         Fix post-commit feedback.
2770
2771         Unreviewed. 
2772
2773         * layout/floats/FloatingContext.cpp:
2774         (WebCore::Layout::FloatingPair::intersects const):
2775
2776 2019-02-19  Zalan Bujtas  <zalan@apple.com>
2777
2778         [LFC][Floats] Remove redundant intersecting logic
2779         https://bugs.webkit.org/show_bug.cgi?id=194804
2780
2781         Reviewed by Antti Koivisto.
2782
2783         floatAvoider.overflowsContainingBlock() check already (and properly) takes care of the far left/right case (see comment).
2784
2785         * layout/floats/FloatingContext.cpp:
2786         (WebCore::Layout::FloatingContext::floatingPosition const):
2787         (WebCore::Layout::FloatingPair::intersects const):
2788
2789 2019-02-19  Commit Queue  <commit-queue@webkit.org>
2790
2791         Unreviewed, rolling out r241722.
2792         https://bugs.webkit.org/show_bug.cgi?id=194801
2793
2794         Causing time outs and EWS failures after expectation file was
2795         added. (Requested by ShawnRoberts on #webkit).
2796
2797         Reverted changeset:
2798
2799         "IndexedDB: leak IDBDatabase and IDBTransacstion in layout
2800         tests"
2801         https://bugs.webkit.org/show_bug.cgi?id=194709
2802         https://trac.webkit.org/changeset/241722
2803
2804 2019-02-16  Darin Adler  <darin@apple.com>
2805
2806         Continue reducing use of String::format, now focusing on hex: "%p", "%x", etc.
2807         https://bugs.webkit.org/show_bug.cgi?id=194752
2808
2809         Reviewed by Daniel Bates.
2810
2811         * Modules/websockets/WebSocket.cpp: Added an include of HexNumber.h. This previously
2812         got included because of Logger.h, but that no longer pulls in HexNumber.h.
2813
2814         * css/CSSMarkup.cpp: Removed unneeded include of StringBuffer.h.
2815         * css/CSSPrimitiveValue.cpp: Ditto.
2816
2817         * css/CSSUnicodeRangeValue.cpp:
2818         (WebCore::CSSUnicodeRangeValue::customCSSText const): Use makeString and hex instead
2819         of String::format and "%x".
2820
2821         * html/HTMLMediaElement.h:
2822         (WTF::ValueToString<WebCore::TextTrackCue::string): Use a non-template function,
2823         TextTrackCure::debugString, so we don't need to use HextNumber.h in a header.
2824
2825         * html/canvas/WebGLRenderingContextBase.cpp:
2826         (GetErrorString): Use makeString and hex instead of String::format and "%04x".
2827
2828         * html/track/TextTrackCue.cpp:
2829         (WebCore::TextTrackCue::debugString const): Added. Moved string conversion here
2830         from HTMLMediaElement.h and use makeString instead of String::format. Also use
2831         the word "debug" to make it clear that it's not OK to use this string, with a
2832         pointer value serialized into it, outside of debugging.
2833         * html/track/TextTrackCue.h: Added TextTrackCue::debugString.
2834
2835         * page/linux/ResourceUsageOverlayLinux.cpp:
2836         (WebCore::formatByteNumber): Use makeString and FormattedNumber::fixedWidth
2837         instead of String::format and "%.1f" etc.
2838
2839         * platform/cocoa/KeyEventCocoa.mm:
2840         (WebCore::keyIdentifierForCharCode): Use the new hex function here instead of
2841         the old code that did each of the four characters explicitly.
2842
2843         * platform/gamepad/mac/HIDGamepad.cpp:
2844         (WebCore::HIDGamepad::HIDGamepad): Use makeString instead of String::format.
2845
2846         * platform/graphics/Color.cpp:
2847         (WebCore::Color::nameForRenderTreeAsText const): Use hex instead of doing each
2848         digit separately.
2849
2850         * platform/graphics/FloatPolygon.cpp:
2851         (WebCore::FloatPolygonEdge::debugString const): Added. Moved string conversion here
2852         from the header and use makeString instead of String::format. Also use
2853         the word "debug" to make it clear that it's not OK to use this string, with a
2854         pointer value serialized into it, outside of debugging.
2855         * platform/graphics/FloatPolygon.h: Updated for the above.
2856
2857         * platform/graphics/ca/GraphicsLayerCA.cpp:
2858         (WebCore::GraphicsLayerCA::setName): Use makeString instead of String::format.
2859         (WebCore::GraphicsLayerCA::recursiveCommitChanges): DItto.
2860         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2861         (WebCore::MediaPlayerPrivateGStreamer::load): Ditto.
2862         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Ditto.
2863         * platform/gtk/PlatformKeyboardEventGtk.cpp:
2864         (WebCore::PlatformKeyboardEvent::keyIdentifierForGdkKeyCode): Ditto.
2865         * platform/libwpe/PlatformKeyboardEventLibWPE.cpp:
2866         (WebCore::PlatformKeyboardEvent::keyIdentifierForWPEKeyCode): Ditto.
2867         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
2868         (WebCore::GStreamerVideoEncoder::makeElement): Ditto.
2869         (WebCore::GStreamerVideoEncoder::InitEncode): Ditto.
2870
2871         * platform/text/TextCodecLatin1.cpp: Removed unneeded include of StringBuffer.h
2872         and "using namespace WTF".
2873
2874         * platform/win/GDIObjectCounter.cpp:
2875         (WebCore::GDIObjectCounter::GDIObjectCounter): Use makeString instead of String::format.
2876         * platform/win/KeyEventWin.cpp:
2877         (WebCore::keyIdentifierForWindowsKeyCode): Ditto.
2878
2879         * rendering/FloatingObjects.cpp:
2880         (WebCore::FloatingObject::debugString const): Added. Moved string conversion here
2881         from the header and use makeString instead of String::format. Also use
2882         the word "debug" to make it clear that it's not OK to use this string, with a
2883         pointer value serialized into it, outside of debugging.
2884         * rendering/FloatingObjects.h: Updated for the above.
2885
2886         * rendering/RenderFragmentContainer.cpp:
2887         (WebCore::RenderFragmentContainer::debugString const): Added. Moved string
2888         conversion here from the header and use makeString instead of String::format.
2889         Also use the word "debug" to make it clear that it's not OK to use this string,
2890         with a pointer value serialized into it, outside of debugging.
2891         * rendering/RenderFragmentContainer.h: Updated for the above.
2892         * rendering/RenderFragmentedFlow.h: Ditto.
2893
2894         * testing/Internals.cpp:
2895         (WebCore::Internals::address): Use makeString instead of String::format.
2896
2897 2019-02-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2898
2899         [iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements
2900         https://bugs.webkit.org/show_bug.cgi?id=194670
2901         <rdar://problem/39066529>
2902
2903         Reviewed by Tim Horton.
2904
2905         Adds support for pasting files on the pasteboard as attachment elements, if the attachment element runtime
2906         switch is enabled. Currently, the only types of data that can be pasted as attachments are images, which take a
2907         special codepath in WebContentReader::readImage.
2908
2909         This patch adds a readDataBuffer method that converts a given blob of data from the pasteboard into an
2910         attachment-element-backed representation in the DOM (i.e. either an attachment element or image element that
2911         contains an attachment element). In the case where the given pasteboard item has been explicitly marked as an
2912         attachment (via the preferredPresentationStyle hint) and the item has at least one type representation that
2913         conforms to "public.content", we take this codepath instead of first attempting the web content reading types
2914         supported by default in WebKit.
2915
2916         See below for more detail.
2917
2918         Test: WKAttachmentTestsIOS.InsertPastedFilesAsAttachments
2919
2920         * editing/Editor.cpp:
2921         (WebCore::Editor::clientReplacementURLForResource): Deleted.
2922         * editing/Editor.h:
2923         * editing/WebContentReader.h:
2924         * editing/cocoa/WebContentReaderCocoa.mm:
2925         (WebCore::mimeTypeFromContentType):
2926         (WebCore::contentTypeIsSuitableForInlineImageRepresentation):
2927         (WebCore::createFragmentAndAddResources):
2928         (WebCore::sanitizeMarkupWithArchive):
2929
2930         Remove all logic for handling subresource URL replacement. See WebKit ChangeLog for more details on this.
2931
2932         (WebCore::WebContentReader::readImage):
2933         (WebCore::attachmentForFilePath):
2934         (WebCore::attachmentForData):
2935
2936         Add a helper that creates an attachment element for a given blob of data and content type. The logic here is
2937         quite similar to that of attachmentForFilePath, and we should find a way to either merge them, or pull out more
2938         of their similarities into helper functions.
2939
2940         (WebCore::WebContentReader::readDataBuffer):
2941         (WebCore::replaceSubresourceURLsWithURLsFromClient): Deleted.
2942
2943         Remove more logic for handling subresource URL replacement. See WebKit ChangeLog for more details on this.
2944
2945         * loader/EmptyClients.cpp:
2946         * page/EditorClient.h:
2947         * platform/Pasteboard.h:
2948         * platform/PasteboardItemInfo.h:
2949         (WebCore::PasteboardItemInfo::contentTypeForHighestFidelityItem const):
2950         (WebCore::PasteboardItemInfo::pathForHighestFidelityItem const):
2951         (WebCore::PasteboardItemInfo::encode const):
2952         (WebCore::PasteboardItemInfo::decode):
2953
2954         Add contentTypesByFidelity to PasteboardItemInfo, instead of requesting this information using a separate IPC
2955         message. This means we can also remove getTypesByFidelityForItemAtIndex, and just use the item's types in
2956         fidelity order instead.
2957
2958         * platform/PasteboardStrategy.h:
2959         * platform/PlatformPasteboard.h:
2960         * platform/ios/AbstractPasteboard.h:
2961         * platform/ios/PasteboardIOS.mm:
2962         (WebCore::Pasteboard::read):
2963
2964         Shave off (potentially many) sync IPC messages to the UI process by pulling each call to
2965         informationForItemAtIndex out of the inner loop when reading web content.
2966
2967         (WebCore::Pasteboard::readRespectingUTIFidelities):
2968
2969         Shave off one extraneous sync IPC message by rolling the types in fidelity order into the request for
2970         PasteboardItemInfo, instead of being sent in a separate message.
2971
2972         * platform/ios/PlatformPasteboardIOS.mm:
2973         (WebCore::PlatformPasteboard::informationForItemAtIndex):
2974
2975         Populate contentTypesForFileUpload in the case where UIPasteboard is used (i.e. copy and paste).
2976
2977         (WebCore::PlatformPasteboard::getTypesByFidelityForItemAtIndex): Deleted.
2978         * platform/ios/WebItemProviderPasteboard.h:
2979         * platform/ios/WebItemProviderPasteboard.mm:
2980         (-[WebItemProviderPasteboard pasteboardTypesByFidelityForItemAtIndex:]): Deleted.
2981
2982 2019-02-18  Daniel Bates  <dabates@apple.com>
2983
2984         Clean up and modernize RenderThemeIOS::paintCheckboxDecorations()
2985         https://bugs.webkit.org/show_bug.cgi?id=194785
2986
2987         Reviewed by Simon Fraser.
2988
2989         Change from early return to else-clause to make the states clearer and make it more straightforward
2990         to share more common code. Use constexpr, allocate temporary vectors with inline capacity, and
2991         switch to uniform initializer syntax.
2992
2993         * rendering/RenderThemeIOS.mm:
2994         (WebCore::RenderThemeIOS::paintCheckboxDecorations):
2995
2996 2019-02-18  Daniel Bates  <dabates@apple.com>
2997
2998         [iOS] Focus ring for checkboxes, radio buttons, buttons and search fields should hug tighter to the contour
2999         https://bugs.webkit.org/show_bug.cgi?id=193599
3000         <rdar://problem/47399602>
3001
3002         Reviewed by Simon Fraser.
3003
3004         For now, iOS uses a 3px outline width for its focus rings. Do not inset the focus ring on iOS
3005         for text fields, textareas, keygens, and selects so as to match the visual appearance of all
3006         the other controls.
3007
3008         Tests: fast/forms/ios/focus-button.html
3009                fast/forms/ios/focus-checkbox.html
3010                fast/forms/ios/focus-checked-checkbox.html
3011                fast/forms/ios/focus-checked-radio.html
3012                fast/forms/ios/focus-radio.html
3013                fast/forms/ios/focus-reset-button.html
3014                fast/forms/ios/focus-search-field.html
3015                fast/forms/ios/focus-submit-button.html
3016                fast/forms/ios/focus-text-field.html
3017                fast/forms/ios/focus-textarea.html
3018
3019         * css/html.css:
3020         (:focus): Use 3px outline width.
3021         (input:focus, textarea:focus, keygen:focus, select:focus): Guard this code to exclude it when building for iOS.
3022         * rendering/RenderBox.cpp:
3023         (WebCore::RenderBox::paintBoxDecorations): Add FIXME comment.
3024         * rendering/RenderElement.cpp:
3025         (WebCore::RenderElement::paintOutline): Call RenderTheme::adjustPaintRect() to adjust the paint rect.
3026         Otherwise, the focus rings for radios and checkboxes are drawn at the wrong y-coordinate and are not snug.
3027
3028 2019-02-18  Oriol Brufau  <obrufau@igalia.com>
3029
3030         [css-grid] Handle indefinite percentages in fit-content()
3031         https://bugs.webkit.org/show_bug.cgi?id=194509
3032
3033         Reviewed by Javier Fernandez.
3034
3035         Test: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-fit-content-percentage.html
3036
3037         If the size of the grid container depends on the size of its tracks,
3038         a percentage in fit-content() is indefinite. Without this patch, some
3039         places treated this case as fit-content(0), which prevented the grid
3040         container from growing enough to contain the max-content contribution
3041         of its grid items.
3042
3043         This patch treats such fit-content() as minmax(auto, max-content),
3044         but once the size of the grid container is known and it is laid out
3045         "for real", then the percentage is definite and it's used.
3046
3047         * rendering/GridTrackSizingAlgorithm.cpp:
3048         (WebCore::GridTrackSizingAlgorithm::gridTrackSize const):
3049         (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes):
3050
3051 2019-02-18  John Wilander  <wilander@apple.com>
3052
3053         Check the existence of the frame in Document::hasFrameSpecificStorageAccess() and Document::setHasFrameSpecificStorageAccess()
3054         https://bugs.webkit.org/show_bug.cgi?id=194777
3055         <rdar://problem/47731945>
3056
3057         Reviewed by Geoffrey Garen and Chris Dumez.
3058
3059         Test: http/tests/storageAccess/remove-requesting-iframe.html
3060
3061         * dom/Document.cpp:
3062         (WebCore::Document::hasFrameSpecificStorageAccess const):
3063             Now checks for the existence of the frame.
3064         (WebCore::Document::setHasFrameSpecificStorageAccess):
3065             Now checks for the existence of the frame.
3066         * loader/ResourceLoadObserver.cpp:
3067         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3068             Now checks that the session ID is valid.
3069
3070 2019-02-18  Jer Noble  <jer.noble@apple.com>
3071
3072         -[AVSampleBufferDisplayLayer player]: Unrecognized selector crash
3073         https://bugs.webkit.org/show_bug.cgi?id=194790
3074         <rdar://problem/33866742>
3075
3076         Reviewed by Jon Lee.
3077
3078         Ensure that a WebVideoContainerLayer's sole sublayer is actually an AVPlayerLayer (and not
3079         an AVSampleBufferDisplayLayer) before reporting that the layer type is LayerTypeAVPlayerLayer.
3080
3081         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
3082         (WebCore::PlatformCALayerCocoa::layerTypeForPlatformLayer):
3083
3084 2019-02-18  Joseph Pecoraro  <pecoraro@apple.com>
3085
3086         Web Inspector: Better categorize CPU usage per-thread / worker
3087         https://bugs.webkit.org/show_bug.cgi?id=194564
3088
3089         Reviewed by Devin Rousso.
3090
3091         Test: inspector/cpu-profiler/threads.html
3092
3093         * workers/WorkerThread.cpp:
3094         (WebCore::WorkerThread::workerThreadsMutex):
3095         (WebCore::WorkerThread::workerThreadCount):
3096         (WebCore::WorkerThread::WorkerThread):
3097         (WebCore::WorkerThread::~WorkerThread):
3098         (WebCore::WorkerThread::workerThread):
3099         (WebCore::WorkerThread::releaseFastMallocFreeMemoryInAllThreads):
3100         * workers/WorkerThread.h:
3101         (WebCore::WorkerThread::identifier const):
3102         Expose the set of all WorkerThreads.
3103
3104         * inspector/agents/InspectorCPUProfilerAgent.cpp:
3105         (WebCore::InspectorCPUProfilerAgent::collectSample):
3106         Send inspector additional per-thread data.
3107
3108         * page/ResourceUsageData.h:
3109         (WebCore::WorkerCPUInfo::WorkerCPUInfo):
3110         * page/cocoa/ResourceUsageThreadCocoa.mm:
3111         (WebCore::ThreadInfo::ThreadInfo):
3112         (WebCore::threadInfos):
3113         (WebCore::ResourceUsageThread::platformCollectCPUData):
3114         (WebCore::threadSendRights): Deleted.
3115         (WebCore::cpuUsage): Deleted.
3116         Compute per-thread values on cocoa ports.
3117
3118         * page/linux/ResourceUsageThreadLinux.cpp:
3119         (WebCore::ResourceUsageThread::platformCollectCPUData):
3120         Stub per-thread values on linux ports.
3121
3122 2019-02-18  Jer Noble  <jer.noble@apple.com>
3123
3124         Uncaught Exception crash in MediaPlayerPrivateAVFoundationObjC::setShouldObserveTimeControlStatus()
3125         https://bugs.webkit.org/show_bug.cgi?id=194786
3126
3127         Reviewed by Eric Carlson.
3128
3129         Convert a runtime crash to a debug assert by wrapping the call to -[AVPlayer removeObserver:forKeyPath:]
3130         in an exception handler.
3131
3132         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3133         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldObserveTimeControlStatus):
3134
3135 2019-02-18  Daniel Bates  <dabates@apple.com>
3136
3137         [iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content-editable element
3138         https://bugs.webkit.org/show_bug.cgi?id=192824
3139         <rdar://problem/47100332>
3140
3141         Reviewed by Wenson Hsieh.
3142
3143         When building with USE(UIKIT_KEYBOARD_ADDITIONS) enabled, normalize input strings for some more key codes
3144         now that hardware key events to non-editable elements use the same code path as for editable elements. 
3145
3146         * platform/ios/KeyEventIOS.mm:
3147         (WebCore::windowsKeyCodeForCharCode): Demarcate mappings that are only needed when building with
3148         !USE(UIKIT_KEYBOARD_ADDITIONS) in the hope that one day we can remove this code.
3149         (WebCore::isFunctionKey): Ditto.
3150         * platform/ios/WebEvent.mm:
3151         (normalizedStringWithAppKitCompatibilityMapping): Normalize some more input strings when building with
3152         USE(UIKIT_KEYBOARD_ADDITIONS) enabled.
3153
3154 2019-02-18  Eric Carlson  <eric.carlson@apple.com>
3155
3156         Add MSE logging configuration
3157         https://bugs.webkit.org/show_bug.cgi?id=194719
3158         <rdar://problem/48122151>
3159
3160         Reviewed by Joseph Pecoraro.
3161
3162         No new tests, updated inspector/console/webcore-logging.html.
3163
3164         * dom/Document.cpp:
3165         (WebCore::messageSourceForWTFLogChannel): Recognize the MSE logging channel.
3166
3167         * inspector/agents/WebConsoleAgent.cpp:
3168         (WebCore::WebConsoleAgent::getLoggingChannels): Ditto.
3169
3170 2019-02-18  Antoine Quint  <graouts@apple.com>
3171
3172         [iOS] Dispatch additional events along with pointerdown and pointerup
3173         https://bugs.webkit.org/show_bug.cgi?id=194776
3174         <rdar://problem/48164284>
3175
3176         Reviewed by Brent Fulgham.
3177
3178         The Pointer Events specification mandates that "pointerover" and "pointerenter" events precede a "pointerdown" event and that "pointerout"
3179         and "pointerleave" events follow a "pointerup" event. We remove the EventHandler::dispatchPointerEventForTouchAtIndex() method and replace
3180         it with a PointerCaptureController::dispatchEventForTouchAtIndex() that can handle the dispatch of such additional events correctly, also
3181         allowing for two PointerCaptureController methods (pointerEventWillBeDispatched and pointerEventWasDispatched) to become private.
3182
3183         Test: pointerevents/ios/over-enter-out-leave.html
3184
3185         * dom/EventNames.h: Add the new "pointerover", "pointerenter", "pointerout" and "pointerleave" event types.
3186         * dom/PointerEvent.h:
3187         * dom/ios/PointerEventIOS.cpp:
3188         (WebCore::PointerEvent::create):
3189         * page/EventHandler.cpp:
3190         (WebCore::EventHandler::dispatchPointerEventForTouchAtIndex): Deleted.
3191         * page/EventHandler.h:
3192         * page/PointerCaptureController.cpp:
3193         (WebCore::PointerCaptureController::dispatchEventForTouchAtIndex): Take the existing code from EventHandler::dispatchPointerEventForTouchAtIndex()
3194         and extend it to dispatch additional events as mandated. Since several events may be dispatched we check whether the dispatch of any of those events
3195         had defaultPrevented() or defaultHanded() return true and return those values as a pair.
3196         (WebCore::PointerCaptureController::pointerEventWasDispatched):
3197         * page/PointerCaptureController.h:
3198
3199 2019-02-18  Sihui Liu  <sihui_liu@apple.com>
3200
3201         IndexedDB: leak IDBDatabase and IDBTransacstion in layout tests
3202         https://bugs.webkit.org/show_bug.cgi?id=194709
3203
3204         Reviewed by Geoffrey Garen.
3205
3206         When connection to IDB server is closed, IDBTransaction would abort without notifying IDBDatabase, so 
3207         IDBDatabase didn't clear its reference to IDBTransaction which created a reference cycle. 
3208
3209         Also IDBTransaction didn't clear its reference to IDBRequest in this case and it led to another reference cycle
3210         between IDBOpenDBRequest and IDBTransaction.
3211
3212         Test: storage/indexeddb/IDBObject-leak.html
3213
3214         * Modules/indexeddb/IDBDatabase.cpp:
3215         (WebCore::IDBDatabase::connectionToServerLost):
3216         * Modules/indexeddb/IDBTransaction.cpp:
3217         (WebCore::IDBTransaction::IDBTransaction):
3218         (WebCore::IDBTransaction::~IDBTransaction):
3219         (WebCore::IDBTransaction::finishedDispatchEventForRequest):
3220         (WebCore::IDBTransaction::connectionClosedFromServer):
3221         * Modules/indexeddb/IDBTransaction.h:
3222         * testing/Internals.cpp:
3223         (WebCore::Internals::numberOfIDBTransactions const):
3224         * testing/Internals.h:
3225         * testing/Internals.idl:
3226
3227 2019-02-18  Chris Fleizach  <cfleizach@apple.com>
3228
3229         AX: PSON: Going back from apple.com to search results, cannot interact with HTML content. Disabling Swap Processes on Cross-Site Navigation resolves the issue.
3230         https://bugs.webkit.org/show_bug.cgi?id=194742
3231
3232         Reviewed by Chris Dumez.
3233
3234         With the new process model, WebProcess hits a case where it tries to send the "page loaded" notification before VoiceOver
3235         had a chance to register for any notifications. This leads to those notifications being dropped (and thus this bug).
3236
3237         This change instead asks the UIProcess to send the notification, which we know VoiceOver has registered for, and can reliably
3238         receive notifications.
3239
3240         It also sends the notification for "load failures," which to the VO users' perspective amounts to the same thing as a successful
3241         page load.
3242
3243         * accessibility/mac/AXObjectCacheMac.mm:
3244         (WebCore::AXObjectCache::frameLoadingEventPlatformNotification):
3245
3246 2019-02-18  Megan Gardner  <megan_gardner@apple.com>
3247
3248         Turn On Smart Delete
3249         https://bugs.webkit.org/show_bug.cgi?id=194320
3250
3251         Reviewed by Ryosuke Niwa.
3252
3253         Updated the following tests to work with iOS:
3254         * editing/deleting/smart-delete-001.html:
3255         * editing/deleting/smart-delete-002.html:
3256         * editing/deleting/smart-delete-003.html:
3257         * editing/deleting/smart-delete-004.html:
3258         * editing/deleting/smart-delete-across-editable-boundaries-2.html:
3259         * editing/selection/delete-word-granularity-text-control.html:
3260
3261         Turn on Smart delete for iOS at all times. Modify checks to allow Mac and iOS and other 
3262         platforms to turn on smart delete when desired.
3263
3264         * editing/Editor.cpp:
3265         (WebCore::Editor::shouldSmartDelete):
3266         Allow platfroms to determine if smart delete should be on.
3267         On mac, this is via word granularity, on iOS this is just on all the time.
3268         (WebCore::Editor::canSmartCopyOrDelete):
3269         (WebCore::Editor::performCutOrCopy):
3270         * editing/Editor.h:
3271         * editing/EditorCommand.cpp:
3272         (WebCore::executeDelete):
3273         * editing/ios/EditorIOS.mm:
3274         (WebCore::Editor::shouldSmartDelete):
3275         * editing/mac/EditorMac.mm:
3276         (WebCore::Editor::shouldSmartDelete):
3277
3278 2019-02-17  David Kilzer  <ddkilzer@apple.com>
3279
3280         Unreviewed, rolling out r241620.
3281
3282         "Causes use-after-free crashes running layout tests with ASan and GuardMalloc."
3283         (Requested by ddkilzer on #webkit.)
3284
3285         Reverted changeset:
3286
3287         "[WTF] Add environment variable helpers"
3288         https://bugs.webkit.org/show_bug.cgi?id=192405
3289         https://trac.webkit.org/changeset/241620
3290
3291 2019-02-16  Zalan Bujtas  <zalan@apple.com>
3292
3293         [LFC] RenderImage's default intrinsic size is 0.
3294         https://bugs.webkit.org/show_bug.cgi?id=194745
3295
3296         Reviewed by Antti Koivisto.
3297
3298         While the images are being loaded, their intrinsic size is set to 0 (RenderImage c'tor). Note that this code is temporary.
3299         * layout/layouttree/LayoutTreeBuilder.cpp:
3300         (WebCore::Layout::TreeBuilder::createSubTree):
3301
3302 2019-02-16  Zalan Bujtas  <zalan@apple.com>
3303
3304         [LFC][BFC] Add support for block replaced intrinsic width.
3305         https://bugs.webkit.org/show_bug.cgi?id=194705
3306
3307         Reviewed by Simon Fraser.
3308
3309         Replaced boxes should report their intrinsic width as preferred widths.
3310
3311         Test: fast/block/block-only/replaced-intrinsic-width-simple.html
3312
3313         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3314         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
3315
3316 2019-02-16  Zalan Bujtas  <zalan@apple.com>
3317
3318         [LFC] Apply min/max width constraints to preferred width computation
3319         https://bugs.webkit.org/show_bug.cgi?id=194739
3320
3321         Reviewed by Simon Fraser.
3322
3323         Ensure that both min-height and max-height are taken into account while computing the preferred width.
3324
3325         Test: fast/block/block-only/min-max-and-preferred-width-simple.html
3326
3327         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3328         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
3329
3330 2019-02-15  Yusuke Suzuki  <ysuzuki@apple.com>
3331
3332         [JSC] Make builtin objects more lazily initialized under non-JIT mode
3333         https://bugs.webkit.org/show_bug.cgi?id=194727
3334
3335         Reviewed by Saam Barati.
3336
3337         * Modules/streams/ReadableByteStreamInternals.js:
3338         (privateInitializeReadableByteStreamController):
3339         (readableByteStreamControllerRespond):
3340
3341 2019-02-15  Dean Jackson  <dino@apple.com>
3342
3343         Allow emulation of user gestures from Web Inspector console
3344         https://bugs.webkit.org/show_bug.cgi?id=194725
3345         <rdar://problem/48126604>
3346
3347         Reviewed by Joseph Pecoraro and Devin Rousso.
3348
3349         Test: inspector/runtime/evaluate-userGestureEmulation.html
3350
3351         * inspector/agents/page/PageRuntimeAgent.cpp: Override the emulate method and create
3352         a UserGestureIndicator based on the emulateUserGesture option.
3353         (WebCore::PageRuntimeAgent::evaluate):
3354         * inspector/agents/page/PageRuntimeAgent.h:
3355
3356 2019-02-15  Chris Dumez  <cdumez@apple.com>
3357
3358         Sample domainsVisited diagnostic logging
3359         https://bugs.webkit.org/show_bug.cgi?id=194657
3360
3361         Reviewed by Ryosuke Niwa.
3362
3363         Sample domainsVisited diagnostic logging, we are getting a lot of data from
3364         this key and this is hurting our other keys.
3365
3366         * page/Page.cpp:
3367         (WebCore::Page::logNavigation):
3368
3369 2019-02-15  Ryosuke Niwa  <rniwa@webkit.org>
3370
3371         Crash in the hit testing code via HTMLPlugInElement::isReplacementObscured()
3372         https://bugs.webkit.org/show_bug.cgi?id=194691
3373
3374         Reviewed by Simon Fraser.
3375
3376         The crash was caused by HTMLPlugInElement::isReplacementObscured updating the document
3377         without updating the layout of ancestor documents (i.e. documents in which frame owner
3378         elements appear) even though it hit-tests against the top-level document's RenderView.
3379
3380         Fixed the bug by updating the layout of the top-level document as needed.
3381
3382         Test: plugins/unsupported-plugin-with-replacement-in-iframe-crash.html
3383
3384         * html/HTMLPlugInElement.cpp:
3385         (WebCore::HTMLPlugInElement::isReplacementObscured):
3386
3387 2019-02-15  Ross Kirsling  <ross.kirsling@sony.com>
3388
3389         [WTF] Add environment variable helpers
3390         https://bugs.webkit.org/show_bug.cgi?id=192405
3391
3392         Reviewed by Michael Catanzaro.
3393
3394         * platform/NotImplemented.h:
3395         * platform/cocoa/SystemVersion.mm:
3396         (WebCore::createSystemMarketingVersion):
3397         * platform/graphics/gstreamer/GStreamerCommon.cpp:
3398         (WebCore::initializeGStreamer):
3399         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3400         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
3401         * platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
3402         (Nicosia::PaintingEngine::create):
3403         * platform/graphics/texmap/TextureMapperFPSCounter.cpp:
3404         (WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
3405         * platform/graphics/x11/PlatformDisplayX11.cpp:
3406         (WebCore::PlatformDisplayX11::create):
3407         * platform/gtk/RenderThemeWidget.cpp:
3408         (WebCore::RenderThemeScrollbar::RenderThemeScrollbar):
3409         * platform/gtk/ScrollbarThemeGtk.cpp:
3410         (WebCore::ScrollbarThemeGtk::ScrollbarThemeGtk):
3411         * platform/network/curl/CurlContext.cpp:
3412         (WebCore::CurlContext::CurlContext):
3413         (WebCore::EnvironmentVariableReader::read): Deleted.
3414         (WebCore::EnvironmentVariableReader::defined): Deleted.
3415         (WebCore::EnvironmentVariableReader::readAs): Deleted.
3416         (WebCore::EnvironmentVariableReader::sscanTemplate): Deleted.
3417         (WebCore::EnvironmentVariableReader::sscanTemplate<signed>): Deleted.
3418         (WebCore::EnvironmentVariableReader::sscanTemplate<unsigned>): Deleted.
3419         * platform/network/curl/NetworkStorageSessionCurl.cpp:
3420         (WebCore::defaultCookieJarPath):
3421         * platform/network/playstation/CurlSSLHandlePlayStation.cpp:
3422         (WebCore::getCACertPathEnv):
3423         * platform/network/win/CurlSSLHandleWin.cpp:
3424         (WebCore::getCACertPathEnv):
3425         * platform/text/hyphen/HyphenationLibHyphen.cpp:
3426         (WebCore::topLevelPath):
3427         (WebCore::webkitBuildDirectory):
3428         * platform/unix/LoggingUnix.cpp:
3429         (WebCore::logLevelString):
3430         * platform/win/LoggingWin.cpp:
3431         (WebCore::logLevelString):
3432         Utilize WTF::Environment where possible.
3433
3434 2019-02-15  Antoine Quint  <graouts@apple.com>
3435
3436         Add a method to dispatch a PointerEvent based on a PlatformTouchEvent
3437         https://bugs.webkit.org/show_bug.cgi?id=194702
3438         <rdar://problem/48109355>
3439
3440         Reviewed by Dean Jackson.
3441
3442         * page/EventHandler.cpp:
3443         (WebCore::EventHandler::dispatchPointerEventForTouchAtIndex):
3444         * page/EventHandler.h:
3445
3446 2019-02-15  Per Arne Vollan  <pvollan@apple.com>
3447
3448         [WebVTT] Inline WebVTT styles should start with '::cue'
3449         https://bugs.webkit.org/show_bug.cgi?id=194227
3450
3451         Reviewed by Eric Carlson.
3452
3453         The original fix in r241203 is not sufficient, since it only checks if the CSS string starts
3454         with '::cue'. Before accepting a CSS string from a WebVTT file, it should be checked that
3455         all selectors starts with '::cue'.
3456
3457         Test: media/track/track-cue-css.html
3458
3459         * html/track/WebVTTParser.cpp:
3460         (WebCore::WebVTTParser::checkAndStoreStyleSheet):
3461
3462 2019-02-15  Youenn Fablet  <youenn@apple.com>
3463
3464         Add binding tests for ContextAllowsMediaDevices and ContextHasServiceWorkerScheme
3465         https://bugs.webkit.org/show_bug.cgi?id=194713
3466
3467         Reviewed by Eric Carlson.
3468
3469         Binding tests covering mediaDevices and serviceWorker attributes.
3470
3471         * bindings/scripts/test/JS/JSTestObj.cpp:
3472         (WebCore::JSTestObjPrototype::finishCreation):
3473         (WebCore::jsTestObjMediaDevices1Getter):
3474         (WebCore::jsTestObjMediaDevices1):
3475         (WebCore::jsTestObjMediaDevices2Getter):
3476         (WebCore::jsTestObjMediaDevices2):
3477         (WebCore::jsTestObjServiceWorkers1Getter):
3478         (WebCore::jsTestObjServiceWorkers1):
3479         (WebCore::jsTestObjServiceWorkers2Getter):
3480         (WebCore::jsTestObjServiceWorkers2):
3481         * bindings/scripts/test/TestObj.idl:
3482
3483 2019-02-15  Beth Dakin  <bdakin@apple.com>
3484
3485         Build fix.
3486
3487         * rendering/RenderThemeIOS.mm:
3488         (WebCore::iconForAttachment):
3489
3490 2019-02-15  Youenn Fablet  <youenn@apple.com>
3491
3492         Make ServiceWorkerClientFetch closer to WebResourceLoader
3493         https://bugs.webkit.org/show_bug.cgi?id=194651
3494
3495         Reviewed by Alex Christensen.
3496
3497         Check for redirection response and if so call a specific client API.
3498         Ensure ServiceWorkerFetch::Client gets called in the service worker thread proxy
3499         so that its m_connection is only accessed on that thread.
3500
3501         Covered by existing tests.
3502
3503         * platform/network/FormData.h:
3504         * platform/network/ResourceErrorBase.h:
3505         * workers/service/context/ServiceWorkerFetch.cpp:
3506         (WebCore::ServiceWorkerFetch::processResponse):
3507         * workers/service/context/ServiceWorkerFetch.h:
3508         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3509         (WebCore::ServiceWorkerThreadProxy::cancelFetch):
3510         (WebCore::ServiceWorkerThreadProxy::continueDidReceiveFetchResponse):
3511         * workers/service/context/ServiceWorkerThreadProxy.h:
3512
3513 2019-02-15  Youenn Fablet  <youenn@apple.com>
3514
3515         Make navigator.mediaDevices SecureContext
3516         https://bugs.webkit.org/show_bug.cgi?id=194666
3517
3518         Reviewed by Eric Carlson.
3519
3520         Make navigator.mediaDevices SecureContext.
3521         This can still be enabled for unsecure context using the existing page settings.
3522         To cover that case, introduce ContextHasMediaDevices custom IDL keyword.
3523
3524         Covered by API test.
3525
3526         * Modules/mediastream/NavigatorMediaDevices.idl:
3527         * bindings/scripts/CodeGeneratorJS.pm:
3528         (GenerateRuntimeEnableConditionalString):
3529         * bindings/scripts/IDLAttributes.json:
3530         * dom/ScriptExecutionContext.cpp:
3531         (WebCore::ScriptExecutionContext::hasMediaDevices const):
3532         (WebCore::ScriptExecutionContext::hasServiceWorkerScheme const):
3533         * dom/ScriptExecutionContext.h:
3534
3535 2019-02-15  Youenn Fablet  <youenn@apple.com>
3536
3537         WebSocket should not fire events after being stopped
3538         https://bugs.webkit.org/show_bug.cgi?id=194690
3539
3540         Reviewed by Geoffrey Garen.
3541
3542         dispatchOrQueueErrorEvent is scheduled using RunLoop::main().dispatch or dispatch_async.
3543         This makes it possible to dispatch an event while WebSocket is already stopped.
3544         Instead, use Document::postTask so that the task is only executed if WebSocket is not stopped.
3545
3546         As a refactoring, make use of PendingActivity to keep track of setPendingActivity/unsetPendingActivity more easily.
3547
3548         * Modules/websockets/WebSocket.cpp:
3549         (WebCore::WebSocket::stop):
3550         (WebCore::WebSocket::connect):
3551         * Modules/websockets/WebSocket.h:
3552
3553 2019-02-15  Youenn Fablet  <youenn@apple.com>
3554
3555         Performance should not fire events when its context is stopped
3556         https://bugs.webkit.org/show_bug.cgi?id=194689
3557
3558         Reviewed by Alex Christensen.
3559
3560         Stop the timer when its context is destroyed.
3561         Add an assertion to ensure the timer does not fire after context is destroyed.
3562
3563         * page/Performance.cpp:
3564         (WebCore::Performance::stop):
3565
3566 2019-02-15  Alex Christensen  <achristensen@webkit.org>
3567
3568         REGRESSION: ( r240978-r240985 ) [ iOS Release ] Layout Test imported/w3c/web-platform-tests/xhr/send-redirect-post-upload.htm is crashing
3569         https://bugs.webkit.org/show_bug.cgi?id=194523
3570
3571         Reviewed by Geoffrey Garen.
3572
3573         The scope of the FormCreationContext was limited to the scope of createHTTPBodyCFReadStream,
3574         so when it was used in formCreate it was lucky to get the same context if the stack hadn't been overwritten
3575         and if the FormData hadn't been freed.  Instead, keep it alive with new/delete like we do the FormStreamFields.
3576         A younger me should've noticed this when reviewing r218517.
3577
3578         * platform/network/cf/FormDataStreamCFNet.cpp:
3579         (WebCore::formCreate):
3580         (WebCore::createHTTPBodyCFReadStream):
3581
3582 2019-02-15  Commit Queue  <commit-queue@webkit.org>
3583
3584         Unreviewed, rolling out r241559 and r241566.
3585         https://bugs.webkit.org/show_bug.cgi?id=194710
3586
3587         Causes layout test crashes under GuardMalloc (Requested by
3588         ryanhaddad on #webkit).
3589
3590         Reverted changesets:
3591
3592         "[WTF] Add environment variable helpers"
3593         https://bugs.webkit.org/show_bug.cgi?id=192405
3594         https://trac.webkit.org/changeset/241559
3595
3596         "Unreviewed build fix for WinCairo Debug after r241559."
3597         https://trac.webkit.org/changeset/241566
3598
3599 2019-02-15  Youenn Fablet  <youenn@apple.com>
3600
3601         Stop the endpoint synchronously in RTCPeerConnection::close
3602         https://bugs.webkit.org/show_bug.cgi?id=194688
3603
3604         Reviewed by Eric Carlson.
3605
3606         In the case where the peer connection is being closed, it was asynchronously stopping the endpoint.
3607         But the endpoint, before being stopped, could try to fire an event.
3608         If the context is gone in between, we end up with a null pointer dereference.
3609
3610         * Modules/mediastream/RTCPeerConnection.cpp:
3611         (WebCore::RTCPeerConnection::close):
3612
3613 2019-02-15  Zalan Bujtas  <zalan@apple.com>
3614
3615         [LFC] Out-of-flow box is never a float box
3616         https://bugs.webkit.org/show_bug.cgi?id=194704
3617
3618         Reviewed by Antti Koivisto.
3619
3620         We can't have it both ways. Absolute positioning wins.
3621
3622         Test: fast/block/block-only/out-of-flow-is-never-float-box.html
3623
3624         * layout/layouttree/LayoutBox.cpp:
3625         (WebCore::Layout::Box::isFloatingPositioned const):
3626         (WebCore::Layout::Box::isLeftFloatingPositioned const):
3627         (WebCore::Layout::Box::isRightFloatingPositioned const):
3628
3629 2019-02-15  Philippe Normand  <pnormand@igalia.com>
3630
3631         [GStreamer] Simplify GObject class name check
3632         https://bugs.webkit.org/show_bug.cgi?id=194537
3633
3634         Reviewed by Michael Catanzaro.
3635
3636         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3637         (WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback):
3638         Use G_OBJECT_TYPE_NAME() to filter out uridecodebin child
3639         elements.
3640
3641 2019-02-15  Wenson Hsieh  <wenson_hsieh@apple.com>
3642
3643         Refactor EditingStyle::textDirection to return an Optional<WritingDirection> instead of a bool
3644         https://bugs.webkit.org/show_bug.cgi?id=194686
3645
3646         Reviewed by Ryosuke Niwa.
3647
3648         Changes EditingStyle::textDirection to return an Optional<WritingDirection>, instead of taking a reference to
3649         the resulting WritingDirection. No change in behavior.
3650
3651         * editing/ApplyStyleCommand.cpp:
3652         (WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi):
3653         (WebCore::ApplyStyleCommand::applyInlineStyle):
3654         * editing/EditingStyle.cpp:
3655         (WebCore::EditingStyle::textDirection const):
3656         (WebCore::EditingStyle::textDirectionForSelection):
3657         * editing/EditingStyle.h:
3658
3659 2019-02-10  Darin Adler  <darin@apple.com>
3660
3661         Replace more uses of String::format with StringConcatenate (mostly non-Apple platform-specific cases)
3662         https://bugs.webkit.org/show_bug.cgi?id=194487
3663
3664         Reviewed by Daniel Bates.
3665
3666         * accessibility/win/AccessibilityObjectWrapperWin.cpp:
3667         (WebCore::AccessibilityObjectWrapper::accessibilityAttributeValue): Use makeString
3668         instead of String::format.
3669
3670         * page/linux/ResourceUsageOverlayLinux.cpp:
3671         (WebCore::formatByteNumber): Use String::number instead of String::format.
3672
3673         * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
3674         (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
3675         Use makeString instead of String::format.
3676         * platform/glib/UserAgentGLib.cpp:
3677         (WebCore::platformVersionForUAString): Ditto.
3678         * platform/graphics/gstreamer/GStreamerCommon.cpp:
3679         (WebCore::simpleBusMessageCallback): Ditto.
3680         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3681         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Ditto.
3682         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3683         (WebCore::AppendPipeline::AppendPipeline): Ditto.
3684         (WebCore::AppendPipeline::handleStateChangeMessage): Ditto.
3685         (WebCore::AppendPipeline::resetParserState): Ditto.
3686         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3687         (WebCore::MediaPlayerPrivateGStreamerMSE::load): Ditto.
3688         (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek): Ditto.
3689
3690         * platform/graphics/gtk/ImageBufferGtk.cpp:
3691         (WebCore::encodeImage): Use String::number instead of String::format.
3692
3693         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
3694         (WebCore::GStreamerAudioCaptureSource::create): Use makeString instead of
3695         String::format.
3696         * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:
3697         (WebCore::GStreamerCaptureDeviceManager::addDevice): Ditto.
3698         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
3699         (WebCore::webkitMediaStreamSrcAddPad): Ditto.
3700         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
3701         (WebCore::GStreamerVideoCaptureSource::create): Ditto.
3702         * platform/network/curl/CookieJarDB.cpp:
3703         (WebCore::CookieJarDB::verifySchemaVersion): Ditto.
3704         * platform/win/SearchPopupMenuDB.cpp:
3705         (WebCore::SearchPopupMenuDB::verifySchemaVersion): Ditto.
3706
3707 2019-02-15  Philippe Normand  <pnormand@igalia.com>
3708
3709         [GStreamer] Decoding media-capabilities configuration initial support
3710         https://bugs.webkit.org/show_bug.cgi?id=191191
3711
3712         Reviewed by Xabier Rodriguez-Calvar.
3713
3714         This patch enables basic platform probing for GStreamer decoders,
3715         optionally using Hardware decoding capabilities. The previous code
3716         for decoders/demuxers probing partially duplicated between the MSE
3717         player and its parent class was moved to a new module called
3718         GStreamerRegistryScanner. There is one instance of it for the MSE player
3719         and one for the parent class.
3720
3721         The scanner can check for the presence of the GstElement Hardware
3722         metadata classifier in decoders and thus advise the
3723         MediaEngineConfigurationFactoryGStreamer that hardware decoding is
3724         supported or not. This is only a first step though. The scanner
3725         should also probably attempt a NULL->READY transition on decoders
3726         to validate specific input caps are supported. As this might
3727         require changes in GStreamer, this part of the patch wasn't
3728         included.
3729
3730         This patch is covered by the existing media tests.
3731
3732         * platform/GStreamer.cmake: New files.
3733         * platform/graphics/MediaPlayer.cpp: Add support for converting
3734         SupportsType enum to string.
3735         (WebCore::convertEnumerationToString):
3736         * platform/graphics/MediaPlayer.h: Ditto.
3737         * platform/graphics/MediaPlayerEnums.h: Ditto.
3738         * platform/graphics/gstreamer/GStreamerCommon.cpp: Move
3739         gstRegistryHasElementForMediaType to GStreamerRegistryScanner.
3740         * platform/graphics/gstreamer/GStreamerCommon.h: Ditto.
3741         * platform/graphics/gstreamer/GStreamerRegistryScanner.cpp: Added.
3742         (WebCore::GStreamerRegistryScanner::singleton):
3743         (WebCore::GStreamerRegistryScanner::GStreamerRegistryScanner): Initialize
3744         supported mime-types and codecs from the GStreamer registry.
3745         (WebCore::GStreamerRegistryScanner::~GStreamerRegistryScanner): Free the element factories.
3746         (WebCore::GStreamerRegistryScanner::gstRegistryHasElementForMediaType):
3747         Check the input caps are supported, optionally using hardware
3748         device.
3749         (WebCore::GStreamerRegistryScanner::fillMimeTypeSetFromCapsMapping):
3750         Moved from MediaPlayerPrivateGStreamer{,MSE}.
3751         (WebCore::GStreamerRegistryScanner::initialize): Ditto.
3752         (WebCore::GStreamerRegistryScanner::supportsCodec const): Ditto.
3753         (WebCore::GStreamerRegistryScanner::supportsAllCodecs const): Ditto.
3754         (WebCore::GStreamerRegistryScanner::isDecodingSupported const): Check
3755         the given configuration is supported. For now hardware support is
3756         checked for video configurations only as it is quite uncommon
3757         anyway to have hardware-enabled audio decoders.
3758         * platform/graphics/gstreamer/GStreamerRegistryScanner.h: Added.
3759         (WebCore::GStreamerRegistryScanner::mimeTypeSet):
3760         (WebCore::GStreamerRegistryScanner::supportsContainerType const):
3761         (WebCore::GStreamerRegistryScanner::RegistryLookupResult::operator bool const):
3762         * platform/graphics/gstreamer/MediaEngineConfigurationFactoryGStreamer.cpp: Added.
3763         (WebCore::createMediaPlayerDecodingConfigurationGStreamer):
3764         * platform/graphics/gstreamer/MediaEngineConfigurationFactoryGStreamer.h: Added.
3765         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3766         Rely on new GStreamerRegistryScanner and add some debugging macros.
3767         (WebCore::MediaPlayerPrivateGStreamer::getSupportedTypes):
3768         (WebCore::MediaPlayerPrivateGStreamer::supportsType):
3769         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Ditto. Also
3770         plug qtdemux for AAC containers, this is an explicit consequence
3771         of finer-grained codecs probing.
3772         (WebCore::AppendPipeline::AppendPipeline):
3773         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
3774         * platform/graphics/gstreamer/mse/GStreamerRegistryScannerMSE.cpp: Added.
3775         (WebCore::GStreamerRegistryScannerMSE::singleton):
3776         (WebCore::GStreamerRegistryScannerMSE::GStreamerRegistryScannerMSE):
3777         * platform/graphics/gstreamer/mse/GStreamerRegistryScannerMSE.h: Added.
3778         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3779         Rely on new GStreamerRegistryScanner and add some debugging macros.
3780         (WebCore::MediaPlayerPrivateGStreamerMSE::getSupportedTypes):
3781         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType):
3782         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
3783         * platform/mediacapabilities/MediaEngineConfigurationFactory.cpp:
3784         (WebCore::factories): GStreamer support.
3785
3786 2019-02-14  Joseph Pecoraro  <pecoraro@apple.com>
3787
3788         Web Inspector: Occasional crash under WebCore::CSSStyleSheet::item called from Inspector
3789         https://bugs.webkit.org/show_bug.cgi?id=194671
3790         <rdar://problem/47628191>
3791
3792         Reviewed by Devin Rousso.
3793
3794         * css/CSSStyleSheet.cpp:
3795         (WebCore::CSSStyleSheet::item):
3796         A crash may happen if the m_childRuleCSSOMWrappers Vector gets out of
3797         sync with the m_contents list of rules. In particular if the wrappers
3798         vector is shorter than the rule list. We tried exercising code paths
3799         that modify these lists but were not able to reproduce the crash.
3800         To avoid a crash we can make this access safer and avoid the original
3801         overflow. At the same time we will keep and promote the assertion that
3802         would catch the lists getting out of sync in debug builds.
3803
3804 2019-02-14  Ross Kirsling  <ross.kirsling@sony.com>
3805
3806         Unreviewed build fix for WinCairo Debug after r241559.
3807
3808         * platform/network/curl/CurlContext.cpp:
3809         (WebCore::CurlContext::CurlContext):
3810
3811 2019-02-14  Ross Kirsling  <ross.kirsling@sony.com>
3812
3813         [WTF] Add environment variable helpers
3814         https://bugs.webkit.org/show_bug.cgi?id=192405
3815
3816         Reviewed by Michael Catanzaro.
3817
3818         * platform/NotImplemented.h:
3819         * platform/cocoa/SystemVersion.mm:
3820         (WebCore::createSystemMarketingVersion):
3821         * platform/graphics/gstreamer/GStreamerCommon.cpp:
3822         (WebCore::initializeGStreamer):
3823         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3824         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
3825         * platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
3826         (Nicosia::PaintingEngine::create):
3827         * platform/graphics/texmap/TextureMapperFPSCounter.cpp:
3828         (WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
3829         * platform/graphics/x11/PlatformDisplayX11.cpp:
3830         (WebCore::PlatformDisplayX11::create):
3831         * platform/gtk/RenderThemeWidget.cpp:
3832         (WebCore::RenderThemeScrollbar::RenderThemeScrollbar):
3833         * platform/gtk/ScrollbarThemeGtk.cpp:
3834         (WebCore::ScrollbarThemeGtk::ScrollbarThemeGtk):
3835         * platform/network/curl/CurlContext.cpp:
3836         (WebCore::CurlContext::CurlContext):
3837         (WebCore::EnvironmentVariableReader::read): Deleted.
3838         (WebCore::EnvironmentVariableReader::defined): Deleted.
3839         (WebCore::EnvironmentVariableReader::readAs): Deleted.
3840         (WebCore::EnvironmentVariableReader::sscanTemplate): Deleted.
3841         (WebCore::EnvironmentVariableReader::sscanTemplate<signed>): Deleted.
3842         (WebCore::EnvironmentVariableReader::sscanTemplate<unsigned>): Deleted.
3843         * platform/network/curl/NetworkStorageSessionCurl.cpp:
3844         (WebCore::defaultCookieJarPath):
3845         * platform/network/playstation/CurlSSLHandlePlayStation.cpp:
3846         (WebCore::getCACertPathEnv):
3847         * platform/network/win/CurlSSLHandleWin.cpp:
3848         (WebCore::getCACertPathEnv):
3849         * platform/text/hyphen/HyphenationLibHyphen.cpp:
3850         (WebCore::topLevelPath):
3851         (WebCore::webkitBuildDirectory):
3852         * platform/unix/LoggingUnix.cpp:
3853         (WebCore::logLevelString):
3854         * platform/win/LoggingWin.cpp:
3855         (WebCore::logLevelString):
3856         Utilize WTF::Environment where possible.
3857
3858 2019-02-14  Chris Dumez  <cdumez@apple.com>
3859
3860         [PSON] Introduce a WebContent Process cache
3861         https://bugs.webkit.org/show_bug.cgi?id=194594
3862         <rdar://problem/46793397>
3863
3864         Reviewed by Geoff Garen.
3865
3866         Update localizable strings.
3867
3868         * en.lproj/Localizable.strings:
3869
3870 2019-02-14  Commit Queue  <commit-queue@webkit.org>
3871
3872         Unreviewed, rolling out r241486.
3873         https://bugs.webkit.org/show_bug.cgi?id=194655
3874
3875         causing API failures in builds (Requested by ShawnRoberts on
3876         #webkit).
3877
3878         Reverted changeset:
3879
3880         "[Cocoa] Media elements will restart network buffering just
3881         before suspending"
3882         https://bugs.webkit.org/show_bug.cgi?id=193691
3883         https://trac.webkit.org/changeset/241486
3884
3885 2019-02-13  Brian Burg  <bburg@apple.com>
3886
3887         Web Inspector: don't include accessibility role in DOM.Node object payloads
3888         https://bugs.webkit.org/show_bug.cgi?id=194623
3889         <rdar://problem/36384037>
3890
3891         Reviewed by Devin Rousso.
3892
3893         Accessibility properties are complicated to fetch at all the points where we want to build and push nodes immediately.
3894         Turning on AX often indirectly causes style recalc and layout. This is bad because we are often building nodes in the
3895         first place due to a DOM node tree update (i.e., NodeInserted).
3896
3897         It turns out that DOM.getAccessibilityPropertiesForNode is called every time we display
3898         the computed role in the Elements Tab > Nodes Sidebar > Accessibility Section. So it is not
3899         necessary to collect this information in a problematic way when initially pushing the node, as
3900         it will be updated anyway.
3901
3902         No new tests, no change in behavior.
3903
3904         * inspector/agents/InspectorDOMAgent.cpp:
3905         (WebCore::InspectorDOMAgent::buildObjectForNode):
3906
3907 2019-02-14  Zalan Bujtas  <zalan@apple.com>
3908
3909         [LFC][BFC][MarginCollapse] Replaced boxes don't collapse through their margins
3910         https://bugs.webkit.org/show_bug.cgi?id=194622
3911
3912         Reviewed by Antti Koivisto.
3913
3914         Ensure that block replaced boxes don't collapse through their vertical margins. 
3915
3916         Test: fast/block/block-only/block-replaced-with-vertical-margins.html
3917
3918         * layout/blockformatting/BlockMarginCollapse.cpp:
3919         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
3920         * page/FrameViewLayoutContext.cpp:
3921         (WebCore::layoutUsingFormattingContext):
3922
3923 2019-02-14  Zalan Bujtas  <zalan@apple.com>
3924
3925         [LFC] Shrink-to-fit-width should be constrained by min/max width
3926         https://bugs.webkit.org/show_bug.cgi?id=194653
3927
3928         Reviewed by Antti Koivisto.
3929
3930         Use the fixed value of min-width/max-width to constrain the computed preferred width.
3931
3932         * layout/FormattingContext.h:
3933         * layout/FormattingContextGeometry.cpp:
3934         (WebCore::Layout::FormattingContext::Geometry::constrainByMinMaxWidth):
3935         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3936         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
3937         * layout/inlineformatting/InlineFormattingContext.cpp:
3938         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
3939
3940 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
3941
3942         Crash in DOMTimer::fired
3943         https://bugs.webkit.org/show_bug.cgi?id=194638
3944
3945         Reviewed by Brent Fulgham.
3946