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