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