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