[MSE] Adopt new AVSampleBufferDisplayLayer SPI
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-03-07  Eric Carlson  <eric.carlson@apple.com>
2
3         [MSE] Adopt new AVSampleBufferDisplayLayer SPI
4         https://bugs.webkit.org/show_bug.cgi?id=195445
5         <rdar://problem/48480516>
6
7         Reviewed by Jer Noble.
8
9         No new tests, no functional change.
10
11         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
12         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC): Only register for 
13         kCMSampleBufferConsumerNotification_BufferConsumed notiication when
14         -[AVSampleBufferDisplayLayer prerollDecodeWithCompletionHandler:] isn't available.
15         (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC): Ditto, for unregistering.
16         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Use 
17         -[AVSampleBufferDisplayLayer prerollDecodeWithCompletionHandler:] when possible.
18
19 2019-03-07  Zalan Bujtas  <zalan@apple.com>
20
21         [ContentChangeObserver] Click event fires immediately on hover menu at Ebbets.com
22         https://bugs.webkit.org/show_bug.cgi?id=195397
23
24         Reviewed by Simon Fraser.
25
26         This patch introduces TouchEventScope to track changes triggered by touch start.
27
28         Test: fast/events/touch/ios/content-observation/visibility-change-on-touch-start-simple.html
29
30         * page/ios/ContentChangeObserver.cpp:
31         (WebCore::ContentChangeObserver::touchEventDidStart):
32         (WebCore::ContentChangeObserver::touchEventDidFinish):
33         (WebCore::ContentChangeObserver::mouseMovedDidStart):
34         (WebCore::ContentChangeObserver::mouseMovedDidFinish):
35         (WebCore::ContentChangeObserver::adjustObservedState):
36         (WebCore::ContentChangeObserver::TouchEventScope::TouchEventScope):
37         (WebCore::ContentChangeObserver::TouchEventScope::~TouchEventScope):
38         * page/ios/ContentChangeObserver.h:
39         (WebCore::ContentChangeObserver::isObservingContentChanges const):
40
41 2019-03-07  Zalan Bujtas  <zalan@apple.com>
42
43         [ContentChangeObserver] Introduce fixed duration content observation
44         https://bugs.webkit.org/show_bug.cgi?id=195295
45         <rdar://problem/48579913>
46
47         Reviewed by Simon Fraser.
48
49         Some pages have a runloop-like scheduling setup where the content triggering change happens at a nested timer firing.
50         This patch helps finding cases like that using a 32ms long fixed window. Currently nested timers get dropped on the floor and
51         we stop observing for content changes before they even get fired.
52
53         Test: fast/events/touch/ios/content-observation/visibility-change-happens-on-timer-hops.html
54
55         * page/ios/ContentChangeObserver.cpp:
56         (WebCore::ContentChangeObserver::ContentChangeObserver):
57         (WebCore::ContentChangeObserver::startContentObservationForDuration):
58         (WebCore::ContentChangeObserver::completeDurationBasedContentObservation):
59         (WebCore::ContentChangeObserver::didInstallDOMTimer):
60         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
61         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
62         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
63         (WebCore::ContentChangeObserver::styleRecalcDidStart):
64         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
65         (WebCore::ContentChangeObserver::cancelPendingActivities):
66         (WebCore::ContentChangeObserver::didSuspendActiveDOMObjects):
67         (WebCore::ContentChangeObserver::willDetachPage):
68         (WebCore::ContentChangeObserver::contentVisibilityDidChange):
69         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
70         (WebCore::ContentChangeObserver::adjustObservedState):
71         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
72         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
73         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange): Deleted.
74         * page/ios/ContentChangeObserver.h:
75         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
76         (WebCore::ContentChangeObserver::isObservingContentChanges const):
77         (WebCore::ContentChangeObserver::hasPendingActivity const):
78
79 2019-03-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
80
81         requestAnimationFrame should execute before the next frame
82         https://bugs.webkit.org/show_bug.cgi?id=177484
83
84         Reviewed by Simon Fraser.
85
86         This change fixes two issues with animation timing:
87
88         1. Calling the requestAnimationFrame callbacks would have happened when
89            the DisplayLink fires. This may have happened even if the frame is
90            missed and no display is committed.
91
92         2. Style changes and layout triggered by script could trigger painting
93            at more than 60fps. CoreAnimation commits could happen at more than
94            60fps, although WindowServer will throttle those, and only some will
95            be shown on the screen.
96
97         This change introduces a new paint scheduling model where painting is
98         driven by a "RenderingUpdateScheduler", which only triggers paints once
99         per 16.7ms frame.
100
101         Code that previously scheduled a compositing layer flush now schedules a
102         "RenderingUpdate", and that update is driven by a DisplayRefreshMonitor
103         callback. When the render happens, we service requestAnimationFrame callbacks,
104         Web Animations and intersection observations per the "Update the rendering"
105         step of the HTML Event Loop specification
106         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
107
108         In the future, more rendering steps will be added to this code.
109
110         * Sources.txt:
111         * WebCore.xcodeproj/project.pbxproj:
112         * accessibility/mac/AXObjectCacheMac.mm:
113         Fix layout tests by adding null check.
114
115         * animation/DocumentAnimationScheduler.cpp: Removed.
116         * animation/DocumentAnimationScheduler.h: Removed.
117         * animation/DocumentTimeline.cpp:
118         (WebCore::DocumentTimeline::DocumentTimeline):
119         (WebCore::DocumentTimeline::updateThrottlingState):
120         (WebCore::DocumentTimeline::resumeAnimations):
121         (WebCore::DocumentTimeline::liveCurrentTime const):
122         (WebCore::DocumentTimeline::currentTime):
123         (WebCore::DocumentTimeline::animationTimingDidChange):
124         (WebCore::DocumentTimeline::scheduleAnimationResolution):
125         (WebCore::DocumentTimeline::unscheduleAnimationResolution):
126         (WebCore::DocumentTimeline::updateAnimationsAndSendEvents):
127         (WebCore::DocumentTimeline::internalUpdateAnimationsAndSendEvents):
128         (WebCore::DocumentTimeline::scheduleNextTick):
129         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement):
130         Simplify this function by handling the case of no-animations separately.
131
132         (WebCore::DocumentTimeline::resolveAnimationsForElement):
133         Simplify the loop and delete hasPendingAcceleratedAnimations because it
134         is initialized to true and is not changed inside the loop.
135
136         (WebCore::DocumentTimeline::scheduleAnimationResolutionIfNeeded): Deleted.
137         (WebCore::DocumentTimeline::animationResolutionTimerFired): Deleted.
138         * animation/DocumentTimeline.h:
139         * dom/Document.cpp:
140         (WebCore::Document::resolveStyle):
141         There is no need to force update in resolveStyle(). notifyFlushRequired()
142         will be called eventually which will scheduleRenderingUpdate().
143
144         (WebCore::Document::prepareForDestruction):
145         (WebCore::Document::updateAnimationsAndSendEvents):
146         (WebCore::Document::serviceRequestAnimationFrameCallbacks):
147         (WebCore::Document::windowScreenDidChange):
148         (WebCore::Document::updateIntersectionObservations):
149         (WebCore::Document::scheduleForcedIntersectionObservationUpdate): Deleted.
150         (WebCore::Document::animationScheduler): Deleted.
151         * dom/Document.h:
152         (WebCore::Document::numberOfIntersectionObservers const):
153         * dom/ScriptedAnimationController.cpp:
154         (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks):
155         (WebCore::ScriptedAnimationController::scheduleAnimation):
156         (WebCore::ScriptedAnimationController::animationTimerFired):
157         (WebCore::ScriptedAnimationController::serviceScriptedAnimations): Deleted.
158         (WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire): Deleted.
159         * dom/ScriptedAnimationController.h:
160         * page/FrameView.cpp:
161         (WebCore::FrameView::viewportContentsChanged):
162         * page/IntersectionObserver.cpp:
163         (WebCore::IntersectionObserver::observe):
164         * page/Page.cpp:
165         (WebCore::Page::Page):
166         (WebCore::Page::layoutIfNeeded):
167         (WebCore::Page::renderingUpdate):
168         (WebCore::Page::renderingUpdateScheduler):
169         (WebCore::Page::willDisplayPage): Deleted.
170         (WebCore::Page::addDocumentNeedingIntersectionObservationUpdate): Deleted.
171         (WebCore::Page::updateIntersectionObservations): Deleted.
172         (WebCore::Page::scheduleForcedIntersectionObservationUpdate): Deleted.
173         * page/Page.h:
174         * page/PageOverlayController.cpp:
175         (WebCore::PageOverlayController::didChangeViewExposedRect):
176         (WebCore::PageOverlayController::notifyFlushRequired):
177         * page/ResourceUsageData.h:
178         Include header files that become missing because of adding 
179         RenderingUpdateScheduler.cpp.
180
181         * page/RenderingUpdateScheduler.cpp: Added.
182         (WebCore::RenderingUpdateScheduler::RenderingUpdateScheduler):
183         (WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):
184         (WebCore::RenderingUpdateScheduler::startTimer):
185         (WebCore::RenderingUpdateScheduler::clearTimer):
186         (WebCore::RenderingUpdateScheduler::windowScreenDidChange):
187         (WebCore::RenderingUpdateScheduler::createDisplayRefreshMonitor const):
188         (WebCore::RenderingUpdateScheduler::displayRefreshFired):
189         * page/RenderingUpdateScheduler.h: Added.
190         (WebCore::RenderingUpdateScheduler::create):
191         * page/ios/ContentChangeObserver.h:
192         Include header files that become missing because of adding 
193         RenderingUpdateScheduler.cpp.
194
195         * page/mac/ServicesOverlayController.mm:
196         (WebCore::ServicesOverlayController::Highlight::notifyFlushRequired):
197         * rendering/RenderLayerCompositor.cpp:
198         (WebCore::RenderLayerCompositor::scheduleLayerFlushNow):
199
200 2019-03-07  Zalan Bujtas  <zalan@apple.com>
201
202         [ContentChangeObserver] Add a setting to be able to turn content change observation on/off
203         https://bugs.webkit.org/show_bug.cgi?id=195353
204         <rdar://problem/48626394>
205
206         Reviewed by Simon Fraser.
207
208         Move content observation tests to a dedicated directory.
209
210         Tests: fast/events/touch/ios/content-observation/click-instead-of-hover-simple.html
211                fast/events/touch/ios/content-observation/hover-when-style-change-is-async.html
212                fast/events/touch/ios/content-observation/stuck-with-hover-state.html
213                fast/events/touch/ios/content-observation/style-recalc-schedule-and-force-relalc.html
214                fast/events/touch/ios/content-observation/visibility-change-happens-at-the-second-timer.html
215
216         * page/Settings.yaml:
217         * page/ios/ContentChangeObserver.cpp:
218         (WebCore::ContentChangeObserver::didInstallDOMTimer):
219         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
220         * page/ios/ContentChangeObserver.h:
221         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const): Deleted.
222         * testing/InternalSettings.cpp:
223         (WebCore::InternalSettings::resetToConsistentState):
224
225 2019-03-07  John Wilander  <wilander@apple.com>
226
227         Make sure an empty host matches the internal representation "nullOrigin" in WebCore::RegistrableDomain::matches()
228         https://bugs.webkit.org/show_bug.cgi?id=195435
229
230         Reviewed by Brent Fulgham.
231
232         No new tests. Tests are currently failing and will pass again with
233         this patch.
234
235         WebCore::RegistrableDomain::matches() is a quick way to compare a
236         RegistrableDomain with a URL. Since RegistrableDomain represents the
237         empty host as "nullOrigin," a URL with an empty host needs to match
238         that representation in WebCore::RegistrableDomain::matches().
239         Failure to do so caused debug assertions in fast/ layout tests after
240         https://trac.webkit.org/changeset/242603/webkit.
241
242         * platform/RegistrableDomain.h:
243         (WebCore::RegistrableDomain::matches const):
244
245 2019-03-07  Justin Fan  <justin_fan@apple.com>
246
247         Unreviewed build fixes since MTLClampToBorderColor is only supported on macOS.
248
249         * Modules/webgpu/GPUSamplerDescriptor.idl:
250         * platform/graphics/gpu/GPUSamplerDescriptor.h:
251         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm: Forgot include.
252         * platform/graphics/gpu/cocoa/GPUSamplerMetal.mm:
253         (WebCore::mtlAddressModeForAddressMode):
254         (WebCore::tryCreateMtlSamplerState):
255         (WebCore::mtlBorderColorForBorderColor): Deleted.
256
257 2019-03-07  Justin Fan  <justin_fan@apple.com>
258
259         [Web GPU] GPUSampler implementation
260         https://bugs.webkit.org/show_bug.cgi?id=195427
261         <rdar://problem/48686011>
262
263         Reviewed by Dean Jackson.
264
265         Implement ability to create GPUSamplers and use them as pipeline resource bindings.
266
267         Test: texture-triangle-strip.html updated.
268
269         Add symbols to project:
270         * CMakeLists.txt:
271         * DerivedSources-input.xcfilelist:
272         * DerivedSources-output.xcfilelist:
273         * DerivedSources.make:
274         * Sources.txt:
275         * SourcesCocoa.txt:
276         * WebCore.xcodeproj/project.pbxproj:
277         * bindings/js/WebCoreBuiltinNames.h:
278
279         GPUSampler creation:
280         * Modules/webgpu/GPUSamplerDescriptor.idl: Added.
281         * Modules/webgpu/WebGPUDevice.cpp:
282         (WebCore::WebGPUDevice::createSampler const): Added.
283         * Modules/webgpu/WebGPUDevice.h:
284         * Modules/webgpu/WebGPUDevice.idl:
285         * Modules/webgpu/WebGPUSampler.cpp: Added.
286         (WebCore::WebGPUSampler::create):
287         (WebCore::WebGPUSampler::WebGPUSampler):
288         * Modules/webgpu/WebGPUSampler.h: Added.
289         (WebCore::WebGPUSampler::sampler const):
290         * Modules/webgpu/WebGPUSampler.idl: Added.
291         * platform/graphics/gpu/GPUDevice.cpp:
292         (WebCore::GPUDevice::tryCreateSampler const): Added.
293         * platform/graphics/gpu/GPUDevice.h:
294         * platform/graphics/gpu/GPUSampler.h: Added.
295         (WebCore::GPUSampler::platformSampler const):
296         * platform/graphics/gpu/GPUSamplerDescriptor.h: Added.
297         * platform/graphics/gpu/cocoa/GPUSamplerMetal.mm: Added.
298         (WebCore::mtlAddressModeForAddressMode):
299         (WebCore::mtlBorderColorForBorderColor):
300         (WebCore::mtlMinMagFilterForFilterMode):
301         (WebCore::mtlMipFilterForFilterMode):
302         (WebCore::tryCreateMtlSamplerState):
303         (WebCore::GPUSampler::tryCreate):
304         (WebCore::GPUSampler::GPUSampler):
305
306         Move GPUCompareFunction to Utils for shared use.
307         * platform/graphics/gpu/GPUCompareFunction.h:
308         * platform/graphics/gpu/GPUUtils.h:
309         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
310         (WebCore::tryCreateMtlDepthStencilState):
311         (WebCore::validateAndConvertDepthCompareFunctionToMtl): Deleted.
312         * platform/graphics/gpu/cocoa/GPUUtilsMetal.mm:
313         (WebCore::platformTextureFormatForGPUTextureFormat):
314         (WebCore::platformCompareFunctionForGPUCompareFunction):
315
316         Expand bind groups to accept GPUSamplers:
317         * Modules/webgpu/WebGPUBindGroupBinding.h:
318         * Modules/webgpu/WebGPUBindGroupBinding.idl:
319         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
320         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const):
321         * platform/graphics/gpu/GPUBindGroupBinding.h:
322         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
323         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
324         (WebCore::GPUProgrammablePassEncoder::setBindGroup):
325         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder):
326         (WebCore::GPUProgrammablePassEncoder::setResourceAsSamplerOnEncoder): Added.
327         (WebCore::GPUProgrammablePassEncoder::setResourceAsTextureOnEncoder):
328
329         Misc:
330         * Modules/webgpu/WebGPUTexture.cpp: Missing includes.
331         * Modules/webgpu/WebGPUTexture.h:
332         * Modules/webgpu/WebGPUSwapChain.cpp: Removed extra include.
333
334 2019-03-07  Commit Queue  <commit-queue@webkit.org>
335
336         Unreviewed, rolling out r242297.
337         https://bugs.webkit.org/show_bug.cgi?id=195430
338
339         Broke Microsoft Visio. (Requested by dydz on #webkit).
340
341         Reverted changeset:
342
343         "[iOS] Turn mouse event simulation on by default"
344         https://bugs.webkit.org/show_bug.cgi?id=195218
345         https://trac.webkit.org/changeset/242297
346
347 2019-03-07  Sihui Liu  <sihui_liu@apple.com>
348
349         Crash in com.apple.WebCore: WebCore::IDBTransaction::pendingOperationTimerFired + 72
350         https://bugs.webkit.org/show_bug.cgi?id=195214
351         <rdar://problem/48461116>
352
353         Reviewed by Geoffrey Garen.
354
355         When IDBTransaction is ready to commit, a commit operation would be schedule to 
356         m_pendingTransactionOperationQueue. If connection to IDBServer is lost, pending operations are moved to 
357         m_transactionOperationsInProgressQueue and will be completed with TransactionOperation::doComplete. doComplete 
358         executes complete function of the operation, clears the complete function, and then removes the operation from 
359         m_transactionOperationsInProgressQueue. In doComplete, we do early return when complete function is null, 
360         since the doComplete could be invoked twice due to the race conditions between receiving "operation complete" 
361         message from server and client-side abort.
362
363         However, commit operation does not have a complete function because it should be the last operation of 
364         transaction and it gets removed from queue in its perform function. A commit operation would not be removed from 
365         m_transactionOperationsInProgressQueue because of the early return. It would be removed from 
366         m_transactionOperationMap, which may hold the last ref to the commit operation, in 
367         IDBTransaction::connectionClosedFromServer. In this case, when pendingOperationTimerFired is called later, the 
368         commit operation left in m_transactionOperationsInProgressQueue would be used and found to be freed. We should
369         not use null check of complete function to decide whether an operation is completed.
370
371         * Modules/indexeddb/client/TransactionOperation.h:
372         (WebCore::IDBClient::TransactionOperation::doComplete):
373
374 2019-03-07  John Wilander  <wilander@apple.com>
375
376         Resource Load Statistics: Log first-party navigations with link decoration
377         https://bugs.webkit.org/show_bug.cgi?id=195301
378         <rdar://problem/48569971>
379
380         Reviewed by Brent Fulgham.
381
382         Test: http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration.html
383
384         This patch adds two new members to WebCore::ResourceLoadStatistics:
385         - topFrameLinkDecorationsFrom, a set of domains
386         - gotLinkDecorationFromPrevalentResource, a boolean state
387
388         * loader/ResourceLoadStatistics.cpp:
389         (WebCore::ResourceLoadStatistics::encode const):
390         (WebCore::ResourceLoadStatistics::decode):
391         (WebCore::ResourceLoadStatistics::toString const):
392         (WebCore::ResourceLoadStatistics::merge):
393         * loader/ResourceLoadStatistics.h:
394
395 2019-03-07  Simon Fraser  <simon.fraser@apple.com>
396
397         [iOS WK] REGRESSION (r242132): Fixed position banners flicker and move when scrolling (Apple, Tesla, YouTube, Reddit)
398         https://bugs.webkit.org/show_bug.cgi?id=195396
399         rdar://problem/48518959
400
401         Reviewed by Antti Koivisto.
402         
403         r242132 introduced two issues that contributed to jumpiness of position:fixed layers when scrolling.
404         
405         First, ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling() would early return if the scroll position
406         hadn't changed. It also needs to check the supplied layoutViewport (if any), but in some cases running the
407         notifyRelatedNodesAfterScrollPositionChange() code is necessary even without a scroll position change:
408         if the web process has committed new scrolling tree state (e.g. with new fixed constraints) since
409         the last call, we have to run the layer positioning code to have fixed layers re-adjust their position relative
410         to the root. This was the primary bug fix.
411
412         Secondly, a layer tree commit can give ScrollingTreeFrameScrollingNode a new layout viewport, but we need to
413         adjust this by the scrolling tree's current scroll position in case it gets used before the next scroll.
414
415         Currently no way to test this, as it's very timing-dependent.
416
417         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
418         (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren):
419         (WebCore::ScrollingTreeFrameScrollingNode::scrollPositionAndLayoutViewportMatch):
420         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
421         * page/scrolling/ScrollingTreeScrollingNode.cpp:
422         (WebCore::ScrollingTreeScrollingNode::scrollPositionAndLayoutViewportMatch):
423         (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
424         * page/scrolling/ScrollingTreeScrollingNode.h:
425
426 2019-03-07  Youenn Fablet  <youenn@apple.com>
427
428         Introduce a quota manager for Cache API/Service Worker/IDB storage
429         https://bugs.webkit.org/show_bug.cgi?id=195283
430
431         Reviewed by Chris Dumez.
432
433         Introduce a generic quota manager and quota users to be used in Network Process.
434         Quota manager/users are scoped by client origin.
435         Quota manager is used to check for quota by an entity wanting to execute a storage task of a given taskSize.
436         Quota manager will check the current space used by all its quota users.
437         If the size + taskSize is above quota, it will call a function to try extend the quota.
438         In the meantime, the task (and all tasks that may be added) are queued.
439
440         Once the new quota is received, the quota manager will either allow or disallow the first task in the queue.
441         The quota manager will try to execute as many tasks as possible with the provided quota.
442         If some tasks are remaining and quota limit is hit, the quota manager will compute the space needed for all remaining requests
443         and do another quota extension request.
444
445         * Sources.txt:
446         * WebCore.xcodeproj/project.pbxproj:
447         * page/ClientOrigin.h:
448         * storage/StorageQuotaManager.cpp: Added.
449         (WebCore::StorageQuotaManager::~StorageQuotaManager):
450         (WebCore::StorageQuotaManager::spaceUsage const):
451         (WebCore::StorageQuotaManager::requestSpace):
452         (WebCore::StorageQuotaManager::askForMoreSpace):
453         (WebCore::StorageQuotaManager::processPendingRequests):
454         * storage/StorageQuotaManager.h: Added.
455         (WebCore::StorageQuotaManager::StorageQuotaManager):
456         (WebCore::StorageQuotaManager::addUser):
457         (WebCore::StorageQuotaManager::removeUser):
458         * storage/StorageQuotaUser.h: Added.
459
460 2019-03-07  John Wilander  <wilander@apple.com>
461
462         Resource Load Statistics: Make it possible to purge only script-accessible cookies
463         https://bugs.webkit.org/show_bug.cgi?id=195383
464         <rdar://problem/48570136>
465
466         Reviewed by Brent Fulgham.
467
468         Test: http/tests/resourceLoadStatistics/delete-script-accessible-cookies.html
469
470         This patch provides the ability to purge all script-accessible cookies while leaving
471         HttpOnly cookies in place.
472
473         * loader/CookieJar.h:
474             Added boolean enum IncludeHttpOnlyCookies for use as function parameter.
475         * platform/network/NetworkStorageSession.h:
476         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
477         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
478             Support for the new IncludeHttpOnlyCookies flag.
479         * platform/network/curl/NetworkStorageSessionCurl.cpp:
480         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
481             Stubbed out the new function and added a FIXME comment.
482         * platform/network/soup/NetworkStorageSessionSoup.cpp:
483         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
484             Stubbed out the new function and added a FIXME comment.
485
486 2019-03-06  Mark Lam  <mark.lam@apple.com>
487
488         Exception is a JSCell, not a JSObject.
489         https://bugs.webkit.org/show_bug.cgi?id=195392
490
491         Reviewed by Saam Barati.
492
493         * bridge/objc/objc_utility.h:
494         * bridge/objc/objc_utility.mm:
495         (JSC::Bindings::throwError):
496         * bridge/runtime_object.cpp:
497         (JSC::Bindings::RuntimeObject::throwInvalidAccessError):
498         * bridge/runtime_object.h:
499
500 2019-03-07  Devin Rousso  <drousso@apple.com>
501
502         Web Inspector: Canvas: lazily create the agent
503         https://bugs.webkit.org/show_bug.cgi?id=195241
504
505         Reviewed by Joseph Pecoraro.
506
507         No functionality change.
508
509         * html/canvas/CanvasRenderingContext.h:
510         * html/canvas/CanvasRenderingContext.cpp:
511         (WebCore::CanvasRenderingContext::instances): Added.
512         (WebCore::CanvasRenderingContext::instancesMutex): Added.
513         (WebCore::CanvasRenderingContext::CanvasRenderingContext):
514         (WebCore::CanvasRenderingContext::~CanvasRenderingContext):
515
516         * html/canvas/WebGLProgram.h:
517         * html/canvas/WebGLProgram.cpp:
518         (WebCore::WebGLProgram::instances): Added.
519         (WebCore::WebGLProgram::instancesMutex): Added.
520         (WebCore::WebGLProgram::WebGLProgram):
521         (WebCore::WebGLProgram::~WebGLProgram):
522         * html/canvas/WebGLRenderingContextBase.cpp:
523         (WebCore::WebGLRenderingContextBase::~WebGLRenderingContextBase):
524
525         * inspector/InspectorController.cpp:
526         (WebCore::InspectorController::InspectorController):
527         (WebCore::InspectorController::createLazyAgents):
528
529         * inspector/agents/InspectorCanvasAgent.h:
530         * inspector/agents/InspectorCanvasAgent.cpp:
531         (WebCore::InspectorCanvasAgent::enable):
532         (WebCore::InspectorCanvasAgent::disable):
533         (WebCore::InspectorCanvasAgent::frameNavigated):
534         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
535         (WebCore::InspectorCanvasAgent::canvasDestroyed):
536         (WebCore::InspectorCanvasAgent::didCreateProgram):
537         (WebCore::InspectorCanvasAgent::willDeleteProgram):
538         (WebCore::InspectorCanvasAgent::bindCanvas): Added.
539         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
540
541         * inspector/InspectorInstrumentation.h:
542         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
543         (WebCore::InspectorInstrumentation::didCreateProgram):
544         (WebCore::InspectorInstrumentation::willDeleteProgram):
545
546 2019-03-06  Ross Kirsling  <ross.kirsling@sony.com>
547
548         [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
549         https://bugs.webkit.org/show_bug.cgi?id=195346
550
551         Reviewed by Fujii Hironori.
552
553         * platform/graphics/win/FontCacheWin.cpp:
554         (WebCore::appendLinkedFonts):
555         (WebCore::getLinkedFonts):
556         (WebCore::FontCache::systemFallbackForCharacters):
557         (WebCore::FontCache::fontFromDescriptionAndLogFont):
558         (WebCore::createGDIFont):
559         (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
560         * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
561         (WebCore::FontCustomPlatformData::fontPlatformData):
562         * platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp:
563         (WebCore::GlyphPage::fill):
564         * platform/graphics/win/IconWin.cpp:
565         (WebCore::Icon::createIconForFiles):
566         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
567         (WebCore::mimeTypeCache):
568         (WebCore::MediaPlayerPrivateMediaFoundation::startCreateMediaSource):
569         * platform/graphics/win/UniscribeController.cpp:
570         (WebCore::UniscribeController::itemizeShapeAndPlace):
571         (WebCore::UniscribeController::shape):
572         * platform/network/win/DownloadBundleWin.cpp:
573         (WebCore::DownloadBundle::appendResumeData):
574         (WebCore::DownloadBundle::extractResumeData):
575         * platform/text/win/LocaleWin.cpp:
576         (WebCore::LCIDFromLocaleInternal):
577         (WebCore::LCIDFromLocale):
578         (WebCore::LocaleWin::getLocaleInfoString):
579         * platform/win/BString.cpp:
580         (WebCore::BString::BString):
581         * platform/win/ClipboardUtilitiesWin.cpp:
582         (WebCore::getWebLocData):
583         (WebCore::createGlobalData):
584         (WebCore::getFileDescriptorData):
585         (WebCore::getURL):
586         (WebCore::getCFData):
587         (WebCore::setCFData):
588         * platform/win/DragDataWin.cpp:
589         (WebCore::DragData::asFilenames const):
590         * platform/win/DragImageWin.cpp:
591         (WebCore::createDragImageIconForCachedImageFilename):
592         (WebCore::dragLabelFont):
593         * platform/win/MIMETypeRegistryWin.cpp:
594         (WebCore::mimeTypeForExtension):
595         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
596         * platform/win/PasteboardWin.cpp:
597         (WebCore::Pasteboard::read):
598         (WebCore::filesystemPathFromUrlOrTitle):
599         (WebCore::Pasteboard::writeURLToDataObject):
600         (WebCore::createGlobalImageFileDescriptor):
601         (WebCore::createGlobalHDropContent):
602         * platform/win/SSLKeyGeneratorWin.cpp:
603         (WebCore::signedPublicKeyAndChallengeString):
604         * platform/win/SharedBufferWin.cpp:
605         (WebCore::SharedBuffer::createFromReadingFile):
606         * rendering/RenderThemeWin.cpp:
607         (WebCore::fillFontDescription):
608         Use wchar helpers as needed.
609
610 2019-03-06  Devin Rousso  <drousso@apple.com>
611
612         Web Inspector: DOM Debugger: event breakpoints still fire when breakpoints are disabled
613         https://bugs.webkit.org/show_bug.cgi?id=195377
614         <rdar://problem/48651645>
615
616         Reviewed by Joseph Pecoraro and Matt Baker.
617
618         Test: inspector/dom-debugger/event-listener-breakpoints.html
619
620         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
621         (WebCore::InspectorDOMDebuggerAgent::willHandleEvent):
622         (WebCore::InspectorDOMDebuggerAgent::willFireTimer):
623         (WebCore::InspectorDOMDebuggerAgent::willFireAnimationFrame):
624
625 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
626
627         Crash when attempting to change input type while dismissing datalist suggestions
628         https://bugs.webkit.org/show_bug.cgi?id=195384
629         <rdar://problem/48563718>
630
631         Reviewed by Brent Fulgham.
632
633         When closing a datalist suggestion menu, WebPageProxy sends a message to WebPage instructing it to tell its
634         active datalist suggestions picker to close. However, for a myriad of reasons, the suggestions picker (kept
635         alive by its text input type) may have already gone away by this point. To mitigate this, make WebPage weakly
636         reference its active datalist suggestions picker.
637
638         Test: fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html
639
640         * platform/DataListSuggestionPicker.h:
641
642         Make DataListSuggestionPicker capable of being weakly referenced. Additionally, fix some minor preexisting
643         issues in this header (#imports instead of #includes, as well as an unnecessary include of IntRect.h).
644
645 2019-03-06  Ryan Haddad  <ryanhaddad@apple.com>
646
647         Remove an unneeded assert that was added with r242113
648         https://bugs.webkit.org/show_bug.cgi?id=195391
649
650         Reviewed by Simon Fraser.
651
652         Many layout tests are failing ASSERT(m_mediaBufferingIsSuspended). Since m_mediaBufferingIsSuspended is
653         protected by an 'if' statement directly afterwards, the assertion should be safe to remove.
654
655         * page/Page.cpp:
656         (WebCore::Page::resumeAllMediaBuffering):
657
658 2019-03-06  Justin Fan  <justin_fan@apple.com>
659
660         Unreviewed build fix. Replace a forward declaration with an include.
661
662         * Modules/webgpu/WebGPUTextureView.cpp:
663         * Modules/webgpu/WebGPUTextureView.h:
664
665 2019-03-06  Justin Fan  <justin_fan@apple.com>
666
667         [Web GPU] GPUTexture and GPUTextureView updates, and related GPUBindGroup updates
668         https://bugs.webkit.org/show_bug.cgi?id=195347
669
670         Reviewed by Dean Jackson.
671
672         Implement the ability to display image data as a GPUTexture in the rendering pipeline. Improve GPUTexture and 
673         GPUTextureView implementations. Rename various bind group classes to GPU* to match API.
674
675         Test: webgpu/texture-triangle-strip.html
676
677         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
678         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Update to validate GPUTextureView resources.
679         * Modules/webgpu/WebGPUCommandBuffer.cpp: Move instead of copy the converted view objects.
680         (WebCore::WebGPUCommandBuffer::copyBufferToTexture):
681         (WebCore::WebGPUCommandBuffer::copyTextureToBuffer):
682         (WebCore::WebGPUCommandBuffer::copyTextureToTexture):
683         * Modules/webgpu/WebGPUCommandBuffer.h:
684         (WebCore::WebGPUCommandBuffer::commandBuffer const): No longer returns const so used resources can be registered on it.
685         * Modules/webgpu/WebGPUDevice.cpp:
686         (WebCore::WebGPUDevice::createBindGroupLayout const): Rename WebGPUBindGroupLayoutDescriptor and replace unnecessary rvalue reference.
687         * Modules/webgpu/WebGPUDevice.h: Ditto.
688         * Modules/webgpu/WebGPUDevice.idl: Ditto.
689         * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
690         (WebCore::WebGPUProgrammablePassEncoder::setBindGroup const):
691         * Modules/webgpu/WebGPUProgrammablePassEncoder.h:
692         * Modules/webgpu/WebGPUQueue.cpp:
693         (WebCore::WebGPUQueue::submit):
694         * Modules/webgpu/WebGPURenderPassDescriptor.cpp:
695         (WebCore::WebGPURenderPassDescriptor::asGPURenderPassDescriptor const):
696         * Modules/webgpu/WebGPUTexture.cpp:
697         (WebCore::WebGPUTexture::~WebGPUTexture): Clean up any resources created for and from this WebGPUTexture.
698         (WebCore::WebGPUTexture::createDefaultTextureView): Now returns an empty object other than null on failure.
699         (WebCore::WebGPUTexture::destroy):
700         (WebCore::WebGPUTexture::destroyImpl):
701         * Modules/webgpu/WebGPUTexture.h: Keep a list of any views created from this texture.
702         * Modules/webgpu/WebGPUTexture.idl: Enable destroy.
703         * Modules/webgpu/WebGPUTextureView.cpp:
704         (WebCore::WebGPUTextureView::create):
705         (WebCore::WebGPUTextureView::WebGPUTextureView):
706         (WebCore::WebGPUTextureView::destroy):
707         * Modules/webgpu/WebGPUTextureView.h:
708         (WebCore::WebGPUTextureView::~WebGPUTextureView): Clean up any resources backing this WebGPUTextureView.
709         (WebCore::WebGPUTextureView::texture const):
710         (WebCore::WebGPUTextureView::texture): Deleted.
711         * platform/graphics/gpu/GPUBindGroupLayout.h:
712         * platform/graphics/gpu/GPUCommandBuffer.h:
713         (WebCore::GPUCommandBuffer::usedTextures const): Keep a list of all texture resources that will be used by this command buffer on submit.
714         (WebCore::GPUCommandBuffer::isEncodingPass const): Added to prevent multiple pass encoders from being active on one command buffer.
715         (WebCore::GPUCommandBuffer::setIsEncodingPass):
716         (WebCore::GPUCommandBuffer::useTexture):
717         * platform/graphics/gpu/GPUDevice.cpp:
718         (WebCore::GPUDevice::tryCreateBindGroupLayout const):
719         * platform/graphics/gpu/GPUDevice.h:
720         * platform/graphics/gpu/GPUPipelineLayout.cpp:
721         (WebCore::GPUPipelineLayout::GPUPipelineLayout):
722         * platform/graphics/gpu/GPUProgrammablePassEncoder.cpp:
723         (WebCore::GPUProgrammablePassEncoder::GPUProgrammablePassEncoder):
724         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
725         (WebCore::GPUProgrammablePassEncoder::setVertexBuffer):
726         (WebCore::GPUProgrammablePassEncoder::setFragmentBuffer):
727         (): Deleted.
728         * platform/graphics/gpu/GPUQueue.h:
729         * platform/graphics/gpu/GPURenderPassEncoder.h:
730         * platform/graphics/gpu/GPUTexture.h:
731         (WebCore::GPUTexture::isReadOnly const):
732         (WebCore::GPUTexture::destroy):
733         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
734         (WebCore::MTLDataTypeForBindingType):
735         (WebCore::GPUBindGroupLayout::tryCreate):
736         * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm:
737         (WebCore::GPUCommandBuffer::create):
738         (WebCore::GPUCommandBuffer::~GPUCommandBuffer): Ensure blitEncoder is ended before releasing it.
739         (WebCore::GPUCommandBuffer::endBlitEncoding):
740         (WebCore::GPUCommandBuffer::copyBufferToTexture): Ensure textures are marked for usage before submission occurs.
741         (WebCore::GPUCommandBuffer::copyTextureToBuffer):
742         (WebCore::GPUCommandBuffer::copyTextureToTexture):
743         * platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
744         (WebCore::GPUDevice::create):
745         (WebCore::GPUDevice::GPUDevice):
746         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
747         (WebCore::GPUProgrammablePassEncoder::endPass):
748         (WebCore::GPUProgrammablePassEncoder::setBindGroup): Now supports texture resources.
749         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder): Just moved.
750         (WebCore::GPUProgrammablePassEncoder::setResourceAsTextureOnEncoder):
751         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
752         (WebCore::GPUQueue::submit): Ensures destroyed GPUTextures are not submitted.
753         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
754         (WebCore::GPURenderPassEncoder::tryCreate): Ensure any other encoders are ended before attempting to activate a new one.
755         (WebCore::GPURenderPassEncoder::platformPassEncoder const):
756         (WebCore::GPURenderPassEncoder::endPass): Invalidates the MTLCommandEncoder upon success.
757         (WebCore::GPURenderPassEncoder::setPipeline):
758         (WebCore::GPURenderPassEncoder::setVertexBuffers):
759         (WebCore::GPURenderPassEncoder::draw):
760         (WebCore::GPURenderPassEncoder::useResource):
761         (WebCore::GPURenderPassEncoder::setVertexBuffer):
762         (WebCore::GPURenderPassEncoder::setFragmentBuffer):
763         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
764         (WebCore::GPUSwapChain::getNextTexture):
765         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
766         (WebCore::storageModeForPixelFormatAndSampleCount): 
767                 Always create MTLStorageModePrivate textures on macOS, as Web GPU doesn't provide CPU access to textures anyway.
768         (WebCore::tryCreateMtlTextureDescriptor):
769         (WebCore::GPUTexture::create):
770         (WebCore::GPUTexture::GPUTexture):
771         (WebCore::GPUTexture::tryCreateDefaultTextureView): Renamed from createDefaultTextureView.
772
773         Update files and symbols in project:
774         * CMakeLists.txt:
775         * DerivedSources-input.xcfilelist:
776         * DerivedSources-output.xcfilelist:
777         * DerivedSources.make:
778         * Modules/streams/WebGPUBindGroupLayoutDescriptor.h: Removed.
779         * Modules/webgpu/GPUBindGroupLayoutBinding.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h.
780         * Modules/webgpu/GPUBindGroupLayoutBinding.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl.
781         * Modules/webgpu/GPUBindGroupLayoutDescriptor.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h.
782         * Modules/webgpu/GPUBindGroupLayoutDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl.
783         * Modules/webgpu/GPUShaderStageBit.h: Renamed from Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.h.
784         * Modules/webgpu/GPUShaderStageBit.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl.
785         * Sources.txt:
786         * WebCore.xcodeproj/project.pbxproj:
787         * bindings/js/WebCoreBuiltinNames.h:
788
789 2019-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
790
791         [WHLSL] Pack and unpack data at entry points and exit points
792         https://bugs.webkit.org/show_bug.cgi?id=193877
793
794         Reviewed by Dean Jackson.
795
796         This implements the bulk of the rest of the Metal code generation piece.
797         Specifically, this patch adds support for the packing and unpacking steps
798         at the beginning of the entry point functions and all returns from those
799         functions. It does this by creating an object, EntryPointScaffolding, that
800         knows how to emit all the helper types, packing / unpacking code, and the
801         function signature. This patch also accepts parts of the
802         PipelineStateDescriptor so we know the data layout we should be packing and
803         unpacking.
804
805         This is the last patch before enough of the compiler is present that we can
806         start testing it. The next patch will start porting the test suite.
807
808         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
809         (WebCore::WHLSL::Metal::attributeForSemantic):
810         (WebCore::WHLSL::Metal::EntryPointScaffolding::EntryPointScaffolding):
811         (WebCore::WHLSL::Metal::EntryPointScaffolding::mappedBindGroups const):
812         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceHelperTypes):
813         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceSignature):
814         (WebCore::WHLSL::Metal::EntryPointScaffolding::builtInsSignature):
815         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledInputPath):
816         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledOutputPath):
817         (WebCore::WHLSL::Metal::EntryPointScaffolding::unpackResourcesAndNamedBuiltIns):
818         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::VertexEntryPointScaffolding):
819         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::helperTypes):
820         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::signature):
821         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::unpack):
822         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::pack):
823         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::FragmentEntryPointScaffolding):
824         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::helperTypes):
825         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::signature):
826         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::unpack):
827         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::pack):
828         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::ComputeEntryPointScaffolding):
829         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::helperTypes):
830         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::signature):
831         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::unpack):
832         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::pack):
833         (WebCore::WHLSL::Metal::EntryPointScaffolding::helperTypes): Deleted.
834         (WebCore::WHLSL::Metal::EntryPointScaffolding::signature): Deleted.
835         (WebCore::WHLSL::Metal::EntryPointScaffolding::unpack): Deleted.
836         (WebCore::WHLSL::Metal::EntryPointScaffolding::pack): Deleted.
837         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.h:
838         (WebCore::WHLSL::Metal::EntryPointScaffolding::parameterVariables):
839         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
840         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::toString):
841         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::visit):
842         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
843         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::generateNextVariableName):
844         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
845         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::constantExpressionString):
846         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::RenderFunctionDefinitionWriter):
847         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::takeVertexMappedBindGroups):
848         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::takeFragmentMappedBindGroups):
849         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::createEntryPointScaffolding):
850         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::ComputeFunctionDefinitionWriter):
851         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::takeMappedBindGroups):
852         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::createEntryPointScaffolding):
853         (WebCore::WHLSL::Metal::sharedMetalFunctions):
854         (WebCore::WHLSL::Metal::metalFunctions):
855         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.h:
856         * Modules/webgpu/WHLSL/Metal/WHLSLMappedBindings.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h.
857         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp:
858         (WebCore::WHLSL::Metal::generateMetalCodeShared):
859         (WebCore::WHLSL::Metal::generateMetalCode):
860         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h:
861         * Modules/webgpu/WHLSL/WHLSLIntrinsics.h:
862         (WebCore::WHLSL::Intrinsics::float2Type const):
863         * Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h: Added.
864         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp: Added.
865         (WebCore::WHLSL::prepareShared):
866         (WebCore::WHLSL::prepare):
867         * Modules/webgpu/WHLSL/WHLSLPrepare.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h.
868         * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp: Added.
869         (WebCore::WHLSL::findEntryPoint):
870         (WebCore::WHLSL::matchMode):
871         (WebCore::WHLSL::matchResources):
872         (WebCore::WHLSL::matchInputsOutputs):
873         (WebCore::WHLSL::isAcceptableFormat):
874         (WebCore::WHLSL::matchVertexAttributes):
875         (WebCore::WHLSL::matchColorAttachments):
876         (WebCore::WHLSL::matchDepthAttachment):
877         (WebCore::WHLSL::matchSemantics):
878         * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp.
879         * Sources.txt:
880         * WebCore.xcodeproj/project.pbxproj:
881
882 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
883
884         Move RenderObject::isTransparentOrFullyClippedRespectingParentFrames() to RenderLayer
885         https://bugs.webkit.org/show_bug.cgi?id=195300
886
887         Reviewed by Simon Fraser.
888
889         Move isTransparentOrFullyClippedRespectingParentFrames() from RenderObject to RenderLayer, since this function
890         asks questions about RenderLayers rather than their renderers. No change in behavior.
891
892         * rendering/RenderLayer.cpp:
893         (WebCore::enclosingFrameRenderLayer):
894         (WebCore::parentLayerCrossFrame):
895
896         Some static helpers currently in RenderObject that walk up the layer hierarchy through subframes are redundant
897         with static helpers in RenderLayer. Now that isTransparentOrFullyClippedRespectingParentFrames exists in
898         RenderLayer, simply use this existing helper instead and split logic to grab the enclosing layer around the
899         owner element of a frame into a separate helper.
900
901         * rendering/RenderLayer.h:
902         * rendering/RenderObject.cpp:
903         (WebCore::enclosingFrameRenderLayer): Deleted.
904         (WebCore::parentLayerCrossingFrameBoundaries): Deleted.
905         (WebCore::RenderObject::isTransparentOrFullyClippedRespectingParentFrames const): Deleted.
906
907         Moved from RenderObject.
908
909         * rendering/RenderObject.h:
910
911 2019-03-06  Sihui Liu  <sihui_liu@apple.com>
912
913         Assertion Failed: m_databaseQueue.isKilled() in UniqueIDBDatabase::~UniqueIDBDatabase()
914         https://bugs.webkit.org/show_bug.cgi?id=195073
915         <rdar://problem/48285200>
916
917         Reviewed by Geoffrey Garen.
918
919         r240931 removed a retain cycle between IDBConnectionToServer and IDBConnectionToServerDelegate, so 
920         IDBConnectionToServerDelegate, or InProcessIDBServer would not live forever. When IDBDatabase is gone, 
921         InProcessIDBServer would schedule a notifification to IDBServer with databaseConnectionClosed. IDBServer would 
922         then notify UniqueIDBDatabase. When UniqueIDBDatabase finds all database connections are gone, it would acquires
923         its only reference pointer from IDBServer schedule and perform a shutdown that kills its database task queue.
924
925         The assertion failure tells us UniqueIDBDatabase was destructed at when IDBServer was destructed, which means 
926         UniqueIDBDatabase had not acquired its pointer. It's probably because UniqueIDBDatabase had unfinished tasks or
927         the operation timer function had not been executed. Since UniqueIDBDatabase needs to complete shutdown process,
928         we should make IDBServer live as long as UniqueIDBDatabase by keeping a reference pointer of IDBServer in 
929         UniqueIDBDatabase. 
930
931         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
932         (WebCore::IDBServer::UniqueIDBDatabase::UniqueIDBDatabase):
933         (WebCore::IDBServer::UniqueIDBDatabase::deleteBackingStore):
934         (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose):
935         (WebCore::IDBServer::UniqueIDBDatabase::openBackingStore):
936         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask):
937         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply):
938         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
939         (WebCore::IDBServer::UniqueIDBDatabase::notifyServerAboutClose):
940         * Modules/indexeddb/server/UniqueIDBDatabase.h:
941         (WebCore::IDBServer::UniqueIDBDatabase::server):
942
943 2019-03-06  Rob Buis  <rbuis@igalia.com>
944
945         Consider supporting the `referrerpolicy` attribute.
946         https://bugs.webkit.org/show_bug.cgi?id=179053
947
948         Reviewed by Darin Adler.
949
950         This patch adds 'referrerpolicy' attribute support for iframe.
951         If set, the value is restricted to the ReferrerPolicy enum, and
952         if valid it is used for the subframe load.
953         If not set or invalid, the current behavior is kept.
954
955         Tests: http/tests/referrer-policy-iframe/no-referrer-when-downgrade/cross-origin-http-http.html
956                http/tests/referrer-policy-iframe/no-referrer-when-downgrade/cross-origin-http.https.html
957                http/tests/referrer-policy-iframe/no-referrer-when-downgrade/same-origin.html
958                http/tests/referrer-policy-iframe/no-referrer/cross-origin-http-http.html
959                http/tests/referrer-policy-iframe/no-referrer/cross-origin-http.https.html
960                http/tests/referrer-policy-iframe/no-referrer/same-origin.html
961                http/tests/referrer-policy-iframe/origin-when-cross-origin/cross-origin-http-http.html
962                http/tests/referrer-policy-iframe/origin-when-cross-origin/cross-origin-http.https.html
963                http/tests/referrer-policy-iframe/origin-when-cross-origin/same-origin.html
964                http/tests/referrer-policy-iframe/origin/cross-origin-http-http.html
965                http/tests/referrer-policy-iframe/origin/cross-origin-http.https.html
966                http/tests/referrer-policy-iframe/origin/same-origin.html
967                http/tests/referrer-policy-iframe/same-origin/cross-origin-http-http.html
968                http/tests/referrer-policy-iframe/same-origin/cross-origin-http.https.html
969                http/tests/referrer-policy-iframe/same-origin/same-origin.html
970                http/tests/referrer-policy-iframe/strict-origin-when-cross-origin/cross-origin-http-http.html
971                http/tests/referrer-policy-iframe/strict-origin-when-cross-origin/cross-origin-http.https.html
972                http/tests/referrer-policy-iframe/strict-origin-when-cross-origin/same-origin.html
973                http/tests/referrer-policy-iframe/strict-origin/cross-origin-http-http.html
974                http/tests/referrer-policy-iframe/strict-origin/cross-origin-http.https.html
975                http/tests/referrer-policy-iframe/strict-origin/same-origin.html
976                http/tests/referrer-policy-iframe/unsafe-url/cross-origin-http-http.html
977                http/tests/referrer-policy-iframe/unsafe-url/cross-origin-http.https.html
978                http/tests/referrer-policy-iframe/unsafe-url/same-origin.html
979
980         * html/HTMLAttributeNames.in:
981         * html/HTMLFrameOwnerElement.h:
982         (WebCore::HTMLFrameOwnerElement::referrerPolicy const):
983         * html/HTMLIFrameElement.cpp:
984         (WebCore::HTMLIFrameElement::setReferrerPolicyForBindings):
985         (WebCore::HTMLIFrameElement::referrerPolicyForBindings const):
986         (WebCore::HTMLIFrameElement::referrerPolicy const):
987         * html/HTMLIFrameElement.h:
988         * html/HTMLIFrameElement.idl:
989         * loader/SubframeLoader.cpp:
990         (WebCore::SubframeLoader::loadSubframe):
991         * page/RuntimeEnabledFeatures.h:
992         (WebCore::RuntimeEnabledFeatures::referrerPolicyAttributeEnabled const):
993         (WebCore::RuntimeEnabledFeatures::setReferrerPolicyAttributeEnabled):
994         * platform/ReferrerPolicy.cpp:
995         (WebCore::parseReferrerPolicy):
996         * platform/ReferrerPolicy.h:
997
998 2019-03-05  Takashi Komori  <Takashi.Komori@sony.com>
999
1000         [curl] Remove unnecessary file.
1001         https://bugs.webkit.org/show_bug.cgi?id=195350
1002
1003         Reviewed by Fujii Hironori.
1004
1005         Removed unused file.
1006
1007         No new tests. No change in behavior.
1008
1009         * platform/network/curl/CookieJarCurlDatabase.cpp: Removed.
1010
1011 2019-03-05  Eric Liang  <ericliang@apple.com>
1012
1013         AX: Add remote search support for keyboard focusable element search type
1014         https://bugs.webkit.org/show_bug.cgi?id=195336
1015
1016         Reviewed by Chris Fleizach.
1017
1018         Added AXKeyboardFocusable search key to return default keyboard-focusable elements for accessibility.
1019
1020         Test: accessibility/mac/search-predicate-keyboard-focusable.html
1021
1022         * accessibility/AccessibilityObject.cpp:
1023         (WebCore::AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex):
1024         (WebCore::AccessibilityObject::isKeyboardFocusable const):
1025         * accessibility/AccessibilityObject.h:
1026         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
1027         (createAccessibilitySearchKeyMap):
1028
1029 2019-03-05  Don Olmstead  <don.olmstead@sony.com>
1030
1031         [WinCairo] Enable CSS Typed OM
1032         https://bugs.webkit.org/show_bug.cgi?id=195340
1033
1034         Reviewed by Myles C. Maxfield.
1035
1036         * bindings/js/CallTracerTypes.h:
1037
1038 2019-03-05  Sihui Liu  <sihui_liu@apple.com>
1039
1040         Fix a typo in Web SQL quirk
1041         https://bugs.webkit.org/show_bug.cgi?id=195338
1042
1043         Reviewed by Geoffrey Garen.
1044
1045         * page/Quirks.cpp:
1046         (WebCore::Quirks::hasWebSQLSupportQuirk const):
1047
1048 2019-03-05  Daniel Bates  <dabates@apple.com>
1049
1050         [iOS] Should not scroll when checkbox, radio, submit, reset, or button is spacebar activated
1051         https://bugs.webkit.org/show_bug.cgi?id=195281
1052         <rdar://problem/48564347>
1053
1054         Reviewed by Simon Fraser.
1055
1056         Do not call the base class's default event handler (HTMLTextFormControlElement::defaultEventHandler())
1057         when WebCore sees a keydown of the spacebar as we consider such an event as handled.
1058         Otherwise, calling the base class's default event handler ultimately gives the embedding
1059         client a chance to wrongly handle the event. In the case of iOS, keydown of the spacebar
1060         causes the page to scroll.
1061
1062         WebCore implements spacebar activation on keydown for form controls. For IE compatibility
1063         WebCore does not mark such keydown events as handled so that a DOM keypress event will
1064         be subsequently dispatched. The current logic only skips calling the base class's default
1065         event handler if the DOM event was not marked handled. This is insufficient. We need to
1066         know whether WebCore handled the event. If asking the input type to handle the key down
1067         marks the DOM event as handled then, clearly, WebCore handled the event. However, if the
1068         event is not marked as handled, but WebCore actually accounted for this event then we need
1069         to know this so that we do not call the base class's default event handler and ultimately
1070         the embedding client asking for an interpretation of the key event. Towards this, have
1071         InputType::handleKeydownEvent() return a bit whether or not the base class's default
1072         event handler should be invoked.
1073
1074         Tests: fast/events/ios/activating-button-should-not-scroll-page.html
1075                fast/events/ios/activating-checkbox-should-not-scroll-page.html
1076                fast/events/ios/activating-radio-button-should-not-scroll-page.html
1077                fast/events/ios/activating-reset-button-should-not-scroll-page.html
1078                fast/events/ios/activating-submit-button-should-not-scroll-page.html
1079
1080         * html/BaseCheckableInputType.cpp:
1081         (WebCore::BaseCheckableInputType::handleKeydownEvent): Return ShouldCallBaseEventHandler::No
1082         if WebCore handled the spacebar activation. Otherewise, return ShouldCallBaseEventHandler::Yes.
1083         * html/BaseCheckableInputType.h:
1084         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
1085         (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeydownEvent): Ditto.
1086         * html/BaseChooserOnlyDateAndTimeInputType.h:
1087         * html/BaseClickableWithKeyInputType.cpp:
1088         (WebCore::BaseClickableWithKeyInputType::handleKeydownEvent): Keep our current behavior by returning ShouldCallBaseEventHandler::Yes.
1089         * html/BaseClickableWithKeyInputType.h:
1090         * html/HTMLInputElement.cpp:
1091         (WebCore::HTMLInputElement::defaultEventHandler): Do not fallthrough and call the base class's default
1092         event handler if the input type told us it handled the event regardless of whether the event was handled
1093         from the perspective of the DOM.
1094         * html/InputType.cpp:
1095         (WebCore::InputType::handleKeydownEvent): Keep our current behavior by returning ShouldCallBaseEventHandler::Yes.
1096         * html/InputType.h:
1097
1098         * html/NumberInputType.cpp:
1099         (WebCore::NumberInputType::handleKeydownEvent):
1100         * html/NumberInputType.h:
1101         * html/RadioInputType.cpp:
1102         (WebCore::RadioInputType::handleKeydownEvent):
1103         * html/RadioInputType.h:
1104         * html/RangeInputType.cpp:
1105         (WebCore::RangeInputType::handleKeydownEvent):
1106         * html/RangeInputType.h:
1107         * html/SearchInputType.cpp:
1108         (WebCore::SearchInputType::handleKeydownEvent):
1109         * html/SearchInputType.h:
1110         * html/TextFieldInputType.cpp:
1111         (WebCore::TextFieldInputType::handleKeydownEvent):
1112         * html/TextFieldInputType.h:
1113         Keep our current behavior by returning ShouldCallBaseEventHandler::Yes.
1114
1115 2019-03-05  Takashi Komori  <Takashi.Komori@sony.com>
1116
1117         [Curl] Implement Cookie Accept Policy.
1118         https://bugs.webkit.org/show_bug.cgi?id=191645
1119
1120         Reviewed by Fujii Hironori.
1121
1122         Make Curl network layer respect to coookie accept policy.
1123         This patch fixes tests below on TestRunner, but doesn't fix tests on DumpRenderTree.
1124
1125         Tests: http/tests/cookies/only-accept-first-party-cookies.html
1126                http/tests/cookies/third-party-cookie-relaxing.html
1127                http/tests/security/cookies/third-party-cookie-blocking-redirect.html
1128                http/tests/security/cookies/third-party-cookie-blocking-user-action.html
1129                http/tests/security/cookies/third-party-cookie-blocking-xslt.xml
1130                http/tests/security/cookies/third-party-cookie-blocking.html
1131
1132         * platform/network/curl/CookieJarCurl.cpp:
1133         (WebCore::cookiesForSession):
1134         (WebCore::CookieJarCurl::setCookiesFromDOM const):
1135         (WebCore::CookieJarCurl::setCookiesFromHTTPResponse const):
1136         (WebCore::CookieJarCurl::setCookieAcceptPolicy const):
1137         (WebCore::CookieJarCurl::cookieAcceptPolicy const):
1138         (WebCore::CookieJarCurl::getRawCookies const):
1139         * platform/network/curl/CookieJarCurl.h:
1140         * platform/network/curl/CookieJarDB.cpp:
1141         (WebCore::CookieJarDB::openDatabase):
1142         (WebCore::CookieJarDB::isEnabled const):
1143         (WebCore::CookieJarDB::checkCookieAcceptPolicy):
1144         (WebCore::CookieJarDB::hasCookies):
1145         (WebCore::CookieJarDB::searchCookies):
1146         (WebCore::CookieJarDB::canAcceptCookie):
1147         (WebCore::CookieJarDB::setCookie):
1148         (WebCore::CookieJarDB::setEnabled): Deleted.
1149         * platform/network/curl/CookieJarDB.h:
1150         (WebCore::CookieJarDB::setAcceptPolicy):
1151         (WebCore::CookieJarDB::acceptPolicy const):
1152         * platform/network/curl/CookieUtil.cpp:
1153         (WebCore::CookieUtil::parseCookieAttributes):
1154         (WebCore::CookieUtil::parseCookieHeader):
1155         * platform/network/curl/CurlResourceHandleDelegate.cpp:
1156         (WebCore::handleCookieHeaders):
1157         (WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse):
1158
1159 2019-03-05  Zalan Bujtas  <zalan@apple.com>
1160
1161         [ContentChangeObserver] Assert on if notify content change is allowed
1162         https://bugs.webkit.org/show_bug.cgi?id=195332
1163         <rdar://problem/48603276>
1164
1165         Reviewed by Simon Fraser.
1166
1167         Assert we don't notify the client about the state change while in handleSyntheticClick().
1168
1169         * page/ios/ContentChangeObserver.cpp:
1170         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
1171         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
1172         (WebCore::ContentChangeObserver::adjustObservedState):
1173         * page/ios/ContentChangeObserver.h:
1174         (WebCore::ContentChangeObserver::isObservingContentChanges const):
1175         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
1176
1177 2019-03-05  Said Abou-Hallawa  <sabouhallawa@apple.com>
1178
1179         SVGPathSegList.insertItemBefore() should fail if the newItem belongs to an animating animPathSegList
1180         https://bugs.webkit.org/show_bug.cgi?id=195333
1181         <rdar://problem/48475802>
1182
1183         Reviewed by Simon Fraser.
1184
1185         Because the SVG1.1 specs states that the newItem should be removed from
1186         its original list before adding it to another list,
1187         SVGPathSegList.insertItemBefore() should fail if the new item belongs to
1188         an animating animPathSegList since it is read-only.
1189
1190         Test: svg/dom/SVGPathSegList-insert-from-animating-animPathSegList.svg
1191
1192         * svg/SVGPathSegList.cpp:
1193         (WebCore::SVGPathSegList::processIncomingListItemValue):
1194
1195 2019-03-05  Zalan Bujtas  <zalan@apple.com>
1196
1197         [ContentChangeObserver] Send content change notification through adjustObservedState
1198         https://bugs.webkit.org/show_bug.cgi?id=195328
1199         <rdar://problem/48601143>
1200
1201         Reviewed by Simon Fraser.
1202
1203         Have a dedicated place for the notification logic.
1204
1205         * page/ios/ContentChangeObserver.cpp:
1206         (WebCore::ContentChangeObserver::stopDurationBasedContentObservation):
1207         (WebCore::ContentChangeObserver::didInstallDOMTimer):
1208         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
1209         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
1210         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
1211         (WebCore::ContentChangeObserver::mouseMovedDidStart):
1212         (WebCore::ContentChangeObserver::adjustObservedState):
1213         (WebCore::ContentChangeObserver::registerDOMTimer): Deleted.
1214         (WebCore::ContentChangeObserver::unregisterDOMTimer): Deleted.
1215         (WebCore::ContentChangeObserver::notifyContentChangeIfNeeded): Deleted.
1216         * page/ios/ContentChangeObserver.h:
1217         (WebCore::ContentChangeObserver::registerDOMTimer):
1218         (WebCore::ContentChangeObserver::unregisterDOMTimer):
1219
1220 2019-03-05  Youenn Fablet  <youenn@apple.com>
1221
1222         MockLibWebRTCPeerConnection is leaking some session description
1223         https://bugs.webkit.org/show_bug.cgi?id=195315
1224         <rdar://problem/47840038>
1225
1226         Reviewed by David Kilzer.
1227
1228         Make sure to release raw pointers given from WebCore to mock libwebrtc layer.
1229         Covered by existing tests when run in leaks mode.
1230
1231         * testing/MockLibWebRTCPeerConnection.cpp:
1232         (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription):
1233         (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription):
1234
1235 2019-03-05  Ryan Haddad  <ryanhaddad@apple.com>
1236
1237         Unreviewed, rolling out r242403.
1238
1239         Caused layout test crashes on iOS simulator.
1240
1241         Reverted changeset:
1242
1243         "[ContentChangeObserver] Introduce fixed duration content
1244         observation"
1245         https://bugs.webkit.org/show_bug.cgi?id=195295
1246         https://trac.webkit.org/changeset/242403
1247
1248 2019-03-05  Frederic Wang  <fwang@igalia.com>
1249
1250         Web Inspector: Better categorize CPU usage per-thread / worker
1251         https://bugs.webkit.org/show_bug.cgi?id=194564
1252
1253         Unreviewed compilation fix.
1254
1255         * page/ResourceUsageData.h: Add missing headers.
1256
1257 2019-03-05  Frederic Wang  <fwang@igalia.com>
1258
1259         Share more code for updating the state of frame scrolling nodes
1260         https://bugs.webkit.org/show_bug.cgi?id=195254
1261
1262         Unreviewed compilation warning fix.
1263
1264         * page/scrolling/AsyncScrollingCoordinator.cpp:
1265         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): Add UNUSED_PARAM on non-Cocoa
1266         platforms.
1267
1268 2019-03-05  Cathie Chen  <cathiechen@igalia.com>
1269
1270         The include file in ScrollingStateFrameHostingNode.h is wrong.
1271         https://bugs.webkit.org/show_bug.cgi?id=195280
1272
1273         Reviewed by Frédéric Wang.
1274
1275         * page/scrolling/ScrollingStateFrameHostingNode.h:
1276
1277 2019-03-04  Justin Fan  <justin_fan@apple.com>
1278
1279         Unreviewed build fix for High Sierra.
1280
1281         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm: Should fix "global constructor" error.
1282
1283 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
1284
1285         Use a SQLite database to hold the ResourceLoadStatistics data
1286         https://bugs.webkit.org/show_bug.cgi?id=194867
1287         <rdar://problem/24240854>
1288
1289         Reviewed by Chris Dumez.
1290
1291         Add a new runtime feature flag to support use of an experimental database
1292         back-end. Also expose some SQLite function calls for use outside of WebCore.
1293
1294         No change in functionality, so no new tests.
1295
1296         * page/RuntimeEnabledFeatures.h:
1297         (WebCore::RuntimeEnabledFeatures::setItpDatabaseModeEnabled):
1298         (WebCore::RuntimeEnabledFeatures::itpDatabaseModeEnabled const):
1299         * platform/sql/SQLiteDatabase.h:
1300         * platform/sql/SQLiteStatement.h:
1301
1302 2019-03-04  Justin Fan  <justin_fan@apple.com>
1303
1304         [Web GPU] Blitting function prototypes
1305         https://bugs.webkit.org/show_bug.cgi?id=195224
1306         <rdar://problem/48538902>
1307
1308         Reviewed by Dean Jackson.
1309
1310         Implement barebones GPUCommandBuffer::copy* prototypes while rounding out GPUTexture implementation details.
1311
1312         Test: webgpu/blit-commands.html
1313
1314         * Modules/webgpu/GPUOrigin3D.h: Added.
1315         * Modules/webgpu/GPUOrigin3D.idl: Added.
1316         * Modules/webgpu/WebGPUCommandBuffer.cpp: Add copy view struct implementations.
1317         (WebCore::WebGPUBufferCopyView::asGPUBufferCopyView const): Added.
1318         (WebCore::WebGPUTextureCopyView::asGPUTextureCopyView const): Added.
1319         (WebCore::WebGPUCommandBuffer::copyBufferToBuffer): Added.
1320         (WebCore::WebGPUCommandBuffer::copyBufferToTexture): Added.
1321         (WebCore::WebGPUCommandBuffer::copyTextureToBuffer): Added.
1322         (WebCore::WebGPUCommandBuffer::copyTextureToTexture): Added.
1323         * Modules/webgpu/WebGPUCommandBuffer.h: Add new functions and supporting structs.
1324         * Modules/webgpu/WebGPUCommandBuffer.idl: Ditto.
1325         * Modules/webgpu/WebGPURenderPassDescriptor.cpp: Refactor constructors to copy the entire base class.
1326         (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor):
1327         (WebCore::GPURenderPassDepthStencilAttachmentDescriptor::GPURenderPassDepthStencilAttachmentDescriptor):
1328         (WebCore::WebGPURenderPassDescriptor::asGPURenderPassDescriptor const):
1329         (WebCore::attachment): Deleted.
1330         * Modules/webgpu/WebGPUTexture.h:
1331         (WebCore::WebGPUTexture::texture const): Added.
1332         * platform/graphics/gpu/GPUBuffer.h:
1333         (WebCore::GPUBuffer::byteLength const): Added.
1334         (WebCore::GPUBuffer::isTransferSource const): Added.
1335         (WebCore::GPUBuffer::isTransferDestination const): Renamed from isTransferDst. Refactored for OptionSet API.
1336         (WebCore::GPUBuffer::isVertex const): Ditto.
1337         (WebCore::GPUBuffer::isUniform const): Ditto.
1338         (WebCore::GPUBuffer::isStorage const): Ditto.
1339         (WebCore::GPUBuffer::isMappable const): Ditto.
1340         (WebCore::GPUBuffer::isMapWrite const): Ditto.
1341         (WebCore::GPUBuffer::isMapRead const): Ditto.
1342         * platform/graphics/gpu/GPUBufferUsage.h: Refactored for better bit flag style.
1343         * platform/graphics/gpu/GPUCommandBuffer.h:
1344         (WebCore::GPUCommandBuffer::blitEncoder const): Added.
1345         * platform/graphics/gpu/GPURenderPassDescriptor.h: 
1346         * platform/graphics/gpu/GPUTexture.h: Cache usage flags for reference.
1347         (WebCore::GPUTexture::isTransferSrc const): Added.
1348         (WebCore::GPUTexture::isTransferDst const): Added.
1349         (WebCore::GPUTexture::isOutputAttachment const): Added.
1350         * platform/graphics/gpu/GPUTextureUsage.h: Refactor to match GPUBufferUsage.h.
1351         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
1352         (WebCore::GPUBuffer::validateBufferUsage): Renamed from validateBufferCreate, refactored for OptionSet.
1353         (WebCore::GPUBuffer::tryCreate):
1354         (WebCore::GPUBuffer::GPUBuffer):
1355         (WebCore::GPUBuffer::isReadOnly const):
1356         (WebCore::GPUBuffer::setSubData): Add alignment check according to Metal docs.
1357         * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm: 
1358         (WebCore::GPUCommandBuffer::create): No need to use this alias here.
1359         (WebCore::GPUCommandBuffer::GPUCommandBuffer): Ditto.
1360         (WebCore::GPUCommandBuffer::copyBufferToBuffer): Added.
1361         (WebCore::GPUCommandBuffer::copyBufferToTexture): Added.
1362         (WebCore::GPUCommandBuffer::copyTextureToBuffer): Added. 
1363         (WebCore::GPUCommandBuffer::copyTextureToTexture): Added. 
1364         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
1365         (WebCore::GPUQueue::submit): End encoding on the MTLCommandBuffer's blitCommandEncoder if it was used.
1366         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
1367         (WebCore::GPUSwapChain::getNextTexture): Now provide usage flags to texture creation.
1368         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
1369         (WebCore::mtlTextureUsageForGPUTextureUsageFlags): Refactor validation.
1370         (WebCore::tryCreateMtlTextureDescriptor): Ditto.
1371         (WebCore::GPUTexture::tryCreate): Now provide usage flags to texture creation.
1372         (WebCore::GPUTexture::create): Ditto.
1373         (WebCore::GPUTexture::GPUTexture): Ditto.
1374         (WebCore::GPUTexture::createDefaultTextureView): Ditto.
1375
1376 2019-03-04  Zalan Bujtas  <zalan@apple.com>
1377
1378         [ContentChangeObserver] Introduce fixed duration content observation
1379         https://bugs.webkit.org/show_bug.cgi?id=195295
1380         <rdar://problem/48579913>
1381
1382         Reviewed by Simon Fraser.
1383
1384         Some pages have a runloop-like scheduling setup where the content triggering change happens at a nested timer firing.
1385         This patch helps finding cases like that using a 32ms long fixed window. Currently nested timers get dropped on the floor and
1386         we stop observing for content changes before they even get fired.
1387
1388         Test: fast/events/touch/ios/visibility-change-happens-on-timer-hops.html
1389
1390         * page/ios/ContentChangeObserver.cpp:
1391         (WebCore::ContentChangeObserver::ContentChangeObserver):
1392         (WebCore::ContentChangeObserver::startContentObservationForDuration):
1393         (WebCore::ContentChangeObserver::stopDurationBasedContentObservation):
1394         (WebCore::ContentChangeObserver::hasDeterminateState const):
1395         (WebCore::ContentChangeObserver::adjustObservedState):
1396         * page/ios/ContentChangeObserver.h:
1397         (WebCore::ContentChangeObserver::isObservingContentChanges const):
1398         (WebCore::ContentChangeObserver::hasPendingActivity const):
1399
1400 2019-03-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1401
1402         Native text selection UI is incorrectly suppressed in Microsoft Visio
1403         https://bugs.webkit.org/show_bug.cgi?id=195178
1404         <rdar://problem/48519394>
1405
1406         Reviewed by Darin Adler.
1407
1408         Currently, our heuristics for detecting hidden editable areas attempt to search for empty parent renderers with
1409         "overflow: hidden". It does this by ascending the layer tree in search of renderers that have an empty content
1410         size, and whose renderers' styles indicate that they have overflow: hidden in the X or Y directions. This fails
1411         in the case where a child renderer is positioned out of flow, relative to one of its parent layers, since the
1412         child will be visible, but we'll incorrectly believe that it is hidden. This leads to selection UI unexpectedly
1413         disappearing in the online version of Microsoft Visio.
1414
1415         To fix this, we check whether the enclosing layer around the editable element has an empty clip rect; if the
1416         element is inside of a subframe, we additionally walk up to each enclosing frame's layer and check if that
1417         frame's layer has an empty clip rect.
1418
1419         Test: editing/selection/ios/do-not-hide-selection-in-visible-container.html
1420
1421         * rendering/RenderObject.cpp:
1422         (WebCore::RenderObject::isTransparentOrFullyClippedRespectingParentFrames const):
1423
1424 2019-03-01  Ryosuke Niwa  <rniwa@webkit.org>
1425
1426         gPictureOwnerMap is unnecessary
1427         https://bugs.webkit.org/show_bug.cgi?id=195228
1428
1429         Reviewed by Zalan Bujtas.
1430
1431         Just store in HTMLImageElement. An extra pointer isn't going to affect the memory use here.
1432         If anything, we should worry about m_editableImage and m_pendingClonedAttachmentID instead.
1433
1434         * html/HTMLImageElement.cpp:
1435         (WebCore::HTMLImageElement::pictureElement const):
1436         (WebCore::HTMLImageElement::setPictureElement):
1437         * html/HTMLImageElement.h:
1438
1439 2019-03-04  Daniel Bates  <dabates@apple.com>
1440
1441         [iOS] Caret x-position in empty text area does not match text field
1442         https://bugs.webkit.org/show_bug.cgi?id=195125
1443         <rdar://problem/47161070>
1444
1445         Remove the word "use" in the added comment to make it read well.
1446
1447         * css/html.css:
1448         (textarea):
1449
1450 2019-03-04  Joseph Pecoraro  <pecoraro@apple.com>
1451
1452         ITMLKit Inspector: Data Bindings / Associated Data for nodes
1453         https://bugs.webkit.org/show_bug.cgi?id=195290
1454         <rdar://problem/48304019>
1455
1456         Reviewed by Devin Rousso.
1457
1458         * inspector/agents/InspectorDOMAgent.h:
1459         * inspector/agents/InspectorDOMAgent.cpp:
1460         (WebCore::InspectorDOMAgent::getDataBindingsForNode):
1461         (WebCore::InspectorDOMAgent::getAssociatedDataForNode):
1462         Stub these for web pages, they will only be used for ITMLKit right now.
1463
1464 2019-03-04  Daniel Bates  <dabates@apple.com>
1465
1466         [iOS] Caret x-position in empty text area does not match text field
1467         https://bugs.webkit.org/show_bug.cgi?id=195125
1468         <rdar://problem/47161070>
1469
1470         Reviewed by Darin Adler.
1471
1472         Fix up User Agent styles for <textarea> on iOS such that they have the same left padding
1473         width and same text-indent as <input type="text">. This makes the x-position of the caret
1474         in an empty textarea match the position of the caret in an empty text field.
1475
1476         Test: fast/forms/textarea/ios/caret-x-position-in-textarea-matches-textfield.html
1477
1478         * css/html.css:
1479         (textarea): For iOS Family, do not use the padding shorthand property. Instead explicitly specify
1480         padding-top and padding-bottom to be 2px to keep our current behavior (because it looks reasonable)
1481         and do not specify left and right padding so that we inherit the padding set earlier in this file.
1482         (textarea::placeholder): Deleted. This was added to "try" to make fix up the position of the placeholder
1483         text so as to match the position of the textarea's inner text and the position of a text field's inner
1484         text. This fix up may have worked out visually when it was added, but based on the discovery of the
1485         hardcoded 3px left and right padding (see below remark) it looks like it was always one pixel too short.
1486         * html/HTMLTextAreaElement.cpp:
1487         (WebCore::HTMLTextAreaElement::createInnerTextStyle): Remove hardcoded 3px left and right padding.
1488
1489 2019-03-04  Youenn Fablet  <youenn@apple.com>
1490
1491         Make sure to correctly notify of end of a ServiceWorkerJob when the context is stopped
1492         https://bugs.webkit.org/show_bug.cgi?id=195195
1493
1494         Reviewed by Chris Dumez.
1495
1496         Before the patch, we were notifying that some jobs were finished too aggressively at context stop time.
1497         This was confusing the Network Process.
1498         Only notify such jobs that have pending loads.
1499         Improve the tracking of jobs doing registration resolution to ensure the Network Process gets notified
1500         in case of a registration promise being resolved but the settling callback being not yet called while the context is stopped.
1501
1502         Covered by existing tests not crashing anymore, in particular imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting.https.html.
1503
1504         * workers/service/ServiceWorkerContainer.cpp:
1505         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1506         (WebCore::ServiceWorkerContainer::notifyRegistrationIsSettled):
1507         (WebCore::ServiceWorkerContainer::stop):
1508         * workers/service/ServiceWorkerContainer.h:
1509         * workers/service/ServiceWorkerJob.cpp:
1510         (WebCore::ServiceWorkerJob::cancelPendingLoad):
1511         * workers/service/ServiceWorkerJob.h:
1512         (WebCore::ServiceWorkerJob::isLoading const):
1513
1514 2019-03-04  Chris Dumez  <cdumez@apple.com>
1515
1516         [iOS] Improve our file picker
1517         https://bugs.webkit.org/show_bug.cgi?id=195284
1518         <rdar://problem/45655856>
1519
1520         Reviewed by Tim Horton and Wenson Hsieh.
1521
1522         Export UTIUtilities.h so that it can be used from WebKit2.
1523
1524         * WebCore.xcodeproj/project.pbxproj:
1525
1526 2019-03-04  Zalan Bujtas  <zalan@apple.com>
1527
1528         [ContentChangeObserver] Decouple mouseMoved event and the "is observing content change" status.
1529         https://bugs.webkit.org/show_bug.cgi?id=195286
1530
1531         Reviewed by Simon Fraser.
1532
1533         Now isObservingContentChanges returns true only when we are actively observing content change during timer firing and/or style recalculating.
1534         This patch also renames a couple of functions to follow the didStart/didFinish pattern.
1535
1536         * page/ios/ContentChangeObserver.cpp:
1537         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
1538         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
1539         (WebCore::ContentChangeObserver::styleRecalcDidStart):
1540         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
1541         (WebCore::ContentChangeObserver::mouseMovedDidStart):
1542         (WebCore::ContentChangeObserver::mouseMovedDidFinish):
1543         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
1544         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
1545         (WebCore::ContentChangeObserver::MouseMovedScope::MouseMovedScope):
1546         (WebCore::ContentChangeObserver::MouseMovedScope::~MouseMovedScope):
1547         (WebCore::ContentChangeObserver::StyleRecalcScope::StyleRecalcScope):
1548         (WebCore::ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope):
1549         (WebCore::ContentChangeObserver::DOMTimerScope::DOMTimerScope):
1550         (WebCore::ContentChangeObserver::DOMTimerScope::~DOMTimerScope):
1551         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute): Deleted.
1552         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute): Deleted.
1553         (WebCore::ContentChangeObserver::startObservingStyleRecalc): Deleted.
1554         (WebCore::ContentChangeObserver::stopObservingStyleRecalc): Deleted.
1555         (WebCore::ContentChangeObserver::startObservingMouseMoved): Deleted.
1556         (WebCore::ContentChangeObserver::stopObservingMouseMoved): Deleted.
1557         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc): Deleted.
1558         * page/ios/ContentChangeObserver.h:
1559         (WebCore::ContentChangeObserver::setShouldObserveDOMTimerScheduling):
1560         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling const):
1561         (WebCore::ContentChangeObserver::isObservingStyleRecalc const):
1562         (WebCore::ContentChangeObserver::isObservingContentChanges const):
1563         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling): Deleted.
1564         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling): Deleted.
1565         (WebCore::ContentChangeObserver::shouldObserveStyleRecalc const): Deleted.
1566
1567 2019-03-04  Yusuke Suzuki  <ysuzuki@apple.com>
1568
1569         [JSC] Offer @makeTypeError instead of exposing @TypeError
1570         https://bugs.webkit.org/show_bug.cgi?id=193858
1571
1572         Reviewed by Mark Lam.
1573
1574         Use @makeTypeError instead.
1575
1576         * Modules/mediastream/RTCPeerConnection.js:
1577         * Modules/mediastream/RTCPeerConnectionInternals.js:
1578         * Modules/streams/ReadableByteStreamInternals.js:
1579         (readableByteStreamControllerClose):
1580         (readableByteStreamControllerPullInto):
1581         * Modules/streams/ReadableStream.js:
1582         (cancel):
1583         (pipeTo):
1584         * Modules/streams/ReadableStreamBYOBReader.js:
1585         (cancel):
1586         (read):
1587         * Modules/streams/ReadableStreamDefaultReader.js:
1588         (cancel):
1589         (read):
1590         * Modules/streams/ReadableStreamInternals.js:
1591         (readableStreamReaderGenericRelease):
1592         * Modules/streams/WritableStream.js:
1593         (abort):
1594         (close):
1595         (write):
1596         (getter.closed):
1597         (getter.ready):
1598
1599 2019-03-04  Simon Fraser  <simon.fraser@apple.com>
1600
1601         Share more code between overflow and frame scrolling nodes, fixing overflow scrollbar display
1602         https://bugs.webkit.org/show_bug.cgi?id=195258
1603
1604         Reviewed by Antti Koivisto.
1605
1606         This patch moves management of scrollbar layers and scrollbar painters ("NSScrollerImp") down to
1607         ScrollingStateScrollingNode to be shared between frame and overflow nodes, allowing for
1608         scrolling thread updates of overflow scrollbars. It also moves some scrolling tree-side code
1609         to ScrollingTreeScrollingNodeDelegateMac to be shared between the "tree" nodes for overflow and frames.
1610
1611         Layers for scrollbars are given to scrolling state nodes via setNodeLayers() now, and
1612         RenderLayerCompositor::updateScrollingNodeLayers() is added to provide a bottleneck to call that.
1613         At some point AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() should be relieved
1614         of the responsibility of pushing scrollbar layers (but the scrolling state tree needs to hold
1615         references to GraphicsLayers before that becomes safe).
1616         
1617         The actual fix that allows overflow scrollbars to show is the change in
1618         AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() that calls scrollableArea.*ScrollbarLayerDidChange()
1619         for all ScrollableAreas. This ensures that the CALayer is pushed onto the NSScrollerImp.
1620
1621         * SourcesCocoa.txt:
1622         * WebCore.xcodeproj/project.pbxproj:
1623         * page/scrolling/AsyncScrollingCoordinator.cpp:
1624         (WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
1625         (WebCore::AsyncScrollingCoordinator::setNodeLayers):
1626         (WebCore::AsyncScrollingCoordinator::setFrameScrollingNodeState):
1627         (WebCore::AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
1628         * page/scrolling/ScrollingCoordinator.h:
1629         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
1630         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
1631         (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged):
1632         (WebCore::ScrollingStateFrameScrollingNode::setVerticalScrollbarLayer): Deleted.
1633         (WebCore::ScrollingStateFrameScrollingNode::setHorizontalScrollbarLayer): Deleted.
1634         (WebCore::ScrollingStateFrameScrollingNode::setScrollerImpsFromScrollbars): Deleted.
1635         * page/scrolling/ScrollingStateFrameScrollingNode.h:
1636         * page/scrolling/ScrollingStateScrollingNode.cpp:
1637         (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
1638         (WebCore::ScrollingStateScrollingNode::setAllPropertiesChanged):
1639         (WebCore::ScrollingStateScrollingNode::setHorizontalScrollbarLayer):
1640         (WebCore::ScrollingStateScrollingNode::setVerticalScrollbarLayer):
1641         (WebCore::ScrollingStateScrollingNode::setScrollerImpsFromScrollbars):
1642         * page/scrolling/ScrollingStateScrollingNode.h:
1643         (WebCore::ScrollingStateScrollingNode::horizontalScrollbarLayer const):
1644         (WebCore::ScrollingStateScrollingNode::verticalScrollbarLayer const):
1645         (WebCore::ScrollingStateScrollingNode::verticalScrollerImp const):
1646         (WebCore::ScrollingStateScrollingNode::horizontalScrollerImp const):
1647         * page/scrolling/ScrollingTree.cpp:
1648         (WebCore::ScrollingTree::setOrClearLatchedNode):
1649         (WebCore::ScrollingTree::handleWheelEvent):
1650         * page/scrolling/mac/ScrollingStateScrollingNodeMac.mm: Renamed from Source/WebCore/page/scrolling/mac/ScrollingStateFrameScrollingNodeMac.mm.
1651         (WebCore::ScrollingStateScrollingNode::setScrollerImpsFromScrollbars):
1652         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1653         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1654         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
1655         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
1656         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers):
1657         (WebCore::ScrollingTreeFrameScrollingNodeMac::~ScrollingTreeFrameScrollingNodeMac): Deleted.
1658         (WebCore::ScrollingTreeFrameScrollingNodeMac::releaseReferencesToScrollerImpsOnTheMainThread): Deleted.
1659         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
1660         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
1661         (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateBeforeChildren):
1662         (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent):
1663         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionRelatedLayers):
1664         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
1665         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
1666         (WebCore::ScrollingTreeScrollingNodeDelegateMac::~ScrollingTreeScrollingNodeDelegateMac):
1667         (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateFromStateNode):
1668         (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent):
1669         (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateScrollbarPainters):
1670         (WebCore::ScrollingTreeScrollingNodeDelegateMac::releaseReferencesToScrollerImpsOnTheMainThread):
1671         * platform/ScrollbarThemeComposite.h:
1672         * rendering/RenderLayerCompositor.cpp:
1673         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
1674         (WebCore::RenderLayerCompositor::updateScrollingNodeLayers):
1675         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
1676         * rendering/RenderLayerCompositor.h:
1677
1678 2019-03-04  Jer Noble  <jer.noble@apple.com>
1679
1680         Remove HEVC as a codec requiring hardware support.
1681         https://bugs.webkit.org/show_bug.cgi?id=194960
1682         <rdar://problem/47741432>
1683
1684         Reviewed by Eric Carlson.
1685
1686         * page/cocoa/SettingsBaseCocoa.mm:
1687         (WebCore::SettingsBase::defaultMediaContentTypesRequiringHardwareSupport):
1688
1689 2019-03-04  Jer Noble  <jer.noble@apple.com>
1690
1691         [iOS] Fullscreen "stay in page" option breaks video playback
1692         https://bugs.webkit.org/show_bug.cgi?id=195277
1693         <rdar://problem/48537317>
1694
1695         Reviewed by Eric Carlson.
1696
1697         Add a LOG entry when playback is rejected due to media playback suspension.
1698
1699         * html/MediaElementSession.cpp:
1700         (WebCore::MediaElementSession::playbackPermitted const):
1701
1702 2019-03-04  Tim Horton  <timothy_horton@apple.com>
1703
1704         Fix the build.
1705
1706         * dom/Document.h:
1707
1708 2019-03-03  Zalan Bujtas  <zalan@apple.com>
1709
1710         [ContentChangeObserver] Content observation should be limited to the current document.
1711         https://bugs.webkit.org/show_bug.cgi?id=195256
1712         <rdar://problem/48544402>
1713
1714         Move ContentChangeObserver from Page to Document.
1715         It limits content observation to the target node's owner document.
1716
1717         Reviewed by Simon Fraser.
1718
1719         * dom/Document.cpp:
1720         (WebCore::m_contentChangeObserver):
1721         (WebCore::Document::updateStyleIfNeeded):
1722         (WebCore::Document::willDetachPage):
1723         (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
1724         (WebCore::m_undoManager): Deleted.
1725         * dom/Document.h:
1726         (WebCore::Document::contentChangeObserver):
1727         * page/DOMTimer.cpp:
1728         (WebCore::DOMTimer::install):
1729         (WebCore::DOMTimer::removeById):
1730         (WebCore::DOMTimer::fired):
1731         * page/Frame.cpp:
1732         (WebCore::Frame::willDetachPage):
1733         * page/Page.cpp:
1734         (WebCore::Page::Page):
1735         * page/Page.h:
1736         (WebCore::Page::pointerLockController const):
1737         (WebCore::Page::contentChangeObserver): Deleted.
1738         * page/ios/ContentChangeObserver.cpp:
1739         (WebCore::ContentChangeObserver::ContentChangeObserver):
1740         (WebCore::ContentChangeObserver::didInstallDOMTimer):
1741         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
1742         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
1743         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
1744         (WebCore::ContentChangeObserver::startObservingMouseMoved):
1745         (WebCore::ContentChangeObserver::hasDeterminateState const):
1746         (WebCore::ContentChangeObserver::adjustObservedState):
1747         (WebCore::ContentChangeObserver::notifyContentChangeIfNeeded):
1748         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
1749         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
1750         (WebCore::ContentChangeObserver::MouseMovedScope::MouseMovedScope):
1751         (WebCore::ContentChangeObserver::MouseMovedScope::~MouseMovedScope):
1752         (WebCore::ContentChangeObserver::StyleRecalcScope::StyleRecalcScope):
1753         (WebCore::ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope):
1754         (WebCore::ContentChangeObserver::DOMTimerScope::DOMTimerScope):
1755         (WebCore::ContentChangeObserver::DOMTimerScope::~DOMTimerScope):
1756         (WebCore::hasPendingStyleRecalc): Deleted.
1757         * page/ios/ContentChangeObserver.h:
1758         * page/ios/EventHandlerIOS.mm:
1759         (WebCore::EventHandler::mouseMoved):
1760         * rendering/updating/RenderTreeUpdater.cpp:
1761         (WebCore::RenderTreeUpdater::updateElementRenderer):
1762
1763 2019-03-02  Simon Fraser  <simon.fraser@apple.com>
1764
1765         Share more code for updating the state of frame scrolling nodes
1766         https://bugs.webkit.org/show_bug.cgi?id=195254
1767
1768         Reviewed by Antti Koivisto.
1769
1770         Responsibility for updating state on ScrollingStateFrameScrolling nodes was split between
1771         AsyncScrollingCoordinator::frameViewLayoutUpdated(), which is called post-layout, and
1772         RenderLayerCompositor. This patch gives that responsibility entirely to RenderLayerCompositor,
1773         ensuring that we update frame scrolling nodes at the same time as the rest of the scrolling
1774         state tree.
1775         
1776         We also share code between updating ScrollingStateFrameScrollingNodes and
1777         ScrollingStateOverflowScrollingNodews, since both can be updated from a ScrollableArea.
1778         Some minor cleanup of ScrollableArea is doing to help. For the first time, we're pushing
1779         ScrollableAreaParameters for overflow scrolling nodes, allowing rubber-banding to work
1780         on macOS.
1781
1782         * page/scrolling/AsyncScrollingCoordinator.cpp:
1783         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
1784         (WebCore::AsyncScrollingCoordinator::setRectRelativeToParentNode):
1785         (WebCore::AsyncScrollingCoordinator::setFrameScrollingNodeState):
1786         (WebCore::AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
1787         (WebCore::AsyncScrollingCoordinator::setViewportConstraintedNodeConstraints):
1788         (WebCore::AsyncScrollingCoordinator::setScrollingNodeGeometry): Deleted.
1789         (WebCore::AsyncScrollingCoordinator::setViewportConstraintedNodeGeometry): Deleted.
1790         * page/scrolling/AsyncScrollingCoordinator.h:
1791         * page/scrolling/ScrollingCoordinator.h:
1792         (WebCore::ScrollingCoordinator::setRectRelativeToParentNode):
1793         (WebCore::ScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
1794         (WebCore::ScrollingCoordinator::setFrameScrollingNodeState):
1795         (WebCore::ScrollingCoordinator::setViewportConstraintedNodeConstraints):
1796         (WebCore::ScrollingCoordinator::setScrollingNodeGeometry): Deleted.
1797         (WebCore::ScrollingCoordinator::setViewportConstraintedNodeGeometry): Deleted.
1798         * platform/ScrollView.h:
1799         (WebCore::ScrollView::horizontalScrollbarMode const): Deleted.
1800         (WebCore::ScrollView::verticalScrollbarMode const): Deleted.
1801         * platform/ScrollableArea.cpp:
1802         (WebCore::ScrollableArea::reachableTotalContentsSize const):
1803         * platform/ScrollableArea.h:
1804         (WebCore::ScrollableArea::horizontalScrollbarMode const):
1805         (WebCore::ScrollableArea::verticalScrollbarMode const):
1806         * rendering/RenderLayer.cpp:
1807         (WebCore::RenderLayer::overhangAmount const):
1808         (WebCore::RenderLayer::reachableTotalContentsSize const):
1809         (WebCore::RenderLayer::scrollableContentsSize const): Deleted.
1810         * rendering/RenderLayer.h:
1811         * rendering/RenderLayerCompositor.cpp:
1812         (WebCore::RenderLayerCompositor::updateCompositingLayers):
1813         (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
1814         (WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole):
1815         (WebCore::RenderLayerCompositor::rootParentRelativeScrollableRect const):
1816         (WebCore::RenderLayerCompositor::parentRelativeScrollableRect const):
1817         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
1818         (WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole):
1819         (WebCore::RenderLayerCompositor::computeFrameScrollingGeometry const): Deleted.
1820         (WebCore::RenderLayerCompositor::computeFrameHostingGeometry const): Deleted.
1821         (WebCore::RenderLayerCompositor::computeOverflowScrollingGeometry const): Deleted.
1822         * rendering/RenderLayerCompositor.h:
1823
1824 2019-03-02  Darin Adler  <darin@apple.com>
1825
1826         Retire legacy dtoa function and DecimalNumber class
1827         https://bugs.webkit.org/show_bug.cgi?id=195253
1828
1829         Reviewed by Daniel Bates.
1830
1831         * css/CSSPrimitiveValue.cpp:
1832         (WebCore::CSSPrimitiveValue::formatNumberValue const): Use makeString instead
1833         of DecimalNumber. Also changed return type to String and use StringView and
1834         removed special handling of literals.
1835         (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const): Removed an
1836         unnecessary use of StringBuilder.
1837
1838         * css/CSSPrimitiveValue.h: Updated for changes to formatNumberValue.
1839
1840 2019-03-03  Michael Catanzaro  <mcatanzaro@igalia.com>
1841
1842         [SOUP] Cleanups in SoupNetworkSession
1843         https://bugs.webkit.org/show_bug.cgi?id=195247
1844
1845         Reviewed by Daniel Bates.
1846
1847         This renames clientCertificates to allowedCertificates, since they are not client
1848         certificates at all, but server certificates. It also adds a using statement to avoid
1849         repeating the long type of the map, and avoids an unnecessary copy.
1850
1851         * platform/network/soup/SoupNetworkSession.cpp:
1852         (WebCore::allowedCertificates):
1853         (WebCore::SoupNetworkSession::checkTLSErrors):
1854         (WebCore::SoupNetworkSession::allowSpecificHTTPSCertificateForHost):
1855         (WebCore::clientCertificates): Deleted.
1856
1857 2019-03-03  Michael Catanzaro  <mcatanzaro@igalia.com>
1858
1859         -Wformat error in SharedBuffer::tryCreateArrayBuffer
1860         https://bugs.webkit.org/show_bug.cgi?id=195004
1861
1862         Reviewed by Darin Adler.
1863
1864         Seems C++ has no format specifier appropriate for printing the result of sizeof. We should
1865         just not try to print it. Anyway, that's easy in this case, because sizeof(char) is
1866         guaranteed to be 1. This code was an attempt to be pedantic to account for mythical systems
1867         with char larger than one byte, but perhaps it didn't realize sizeof always returns
1868         multiples of char and so sizeof(char) is always one even on such mythical systems.
1869
1870         Note the sizeof(char) use two lines up is left since it's not clear that switching it to 1
1871         would actually be more readable.
1872
1873         * platform/SharedBuffer.cpp:
1874         (WebCore::SharedBuffer::tryCreateArrayBuffer const):
1875
1876 2019-03-03  Tim Horton  <timothy_horton@apple.com>
1877
1878         Remove some more unused 32-bit code
1879         https://bugs.webkit.org/show_bug.cgi?id=195255
1880
1881         Reviewed by Darin Adler.
1882
1883         * platform/gamepad/cocoa/GameControllerGamepad.h:
1884         * platform/gamepad/cocoa/GameControllerGamepad.mm:
1885         * platform/gamepad/cocoa/GameControllerGamepadProvider.h:
1886         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
1887         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1888         * platform/mac/PlatformEventFactoryMac.mm:
1889         (WebCore::globalPointForEvent):
1890         (WebCore::pointForEvent):
1891         (WebCore::mouseButtonForEvent):
1892         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
1893         * rendering/RenderThemeMac.mm:
1894         (WebCore::RenderThemeMac::servicesRolloverButtonCell const):
1895         (WebCore::RenderThemeMac::paintImageControlsButton):
1896         (WebCore::RenderThemeMac::imageControlsButtonSize const):
1897         (WebCore::RenderThemeMac::imageControlsButtonPositionOffset const):
1898
1899 2019-03-02  Zalan Bujtas  <zalan@apple.com>
1900
1901         [ContentChangeObserver] Introduce ContentChangeObserver::MouseMovedScope
1902         https://bugs.webkit.org/show_bug.cgi?id=195252
1903         <rdar://problem/48539446>
1904
1905         Reviewed by Simon Fraser.
1906
1907         Scope the mouse-moved event to make the callsites less error-prone. 
1908
1909         * page/ios/ContentChangeObserver.cpp:
1910         (WebCore::ContentChangeObserver::startObservingMouseMoved):
1911         (WebCore::ContentChangeObserver::stopObservingMouseMoved):
1912         (WebCore::ContentChangeObserver::MouseMovedScope::MouseMovedScope):
1913         (WebCore::ContentChangeObserver::MouseMovedScope::~MouseMovedScope):
1914         (WebCore::ContentChangeObserver::startObservingContentChanges): Deleted.
1915         (WebCore::ContentChangeObserver::stopObservingContentChanges): Deleted.
1916         * page/ios/ContentChangeObserver.h:
1917         * page/ios/EventHandlerIOS.mm:
1918         (WebCore::EventHandler::mouseMoved):
1919
1920 2019-03-02  Zalan Bujtas  <zalan@apple.com>
1921
1922         [ContentChangeObserver] Introduce ContentChangeObserver::adjustObservedState
1923         https://bugs.webkit.org/show_bug.cgi?id=195244
1924         <rdar://problem/48536737>
1925
1926         Reviewed by Simon Fraser.
1927
1928         Move state change handling code to adjustObservedState() and introduce signalContentChangeIfNeeded() to
1929         let the client know about the state change (or lack of state change).
1930
1931         Test: fast/events/touch/ios/visibility-change-happens-at-the-second-timer.html
1932
1933         * page/ios/ContentChangeObserver.cpp:
1934         (WebCore::ContentChangeObserver::didInstallDOMTimer):
1935         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
1936         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
1937         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
1938         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
1939         (WebCore::ContentChangeObserver::didContentVisibilityChange):
1940         (WebCore::ContentChangeObserver::addObservedDOMTimer):
1941         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
1942         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc):
1943         (WebCore::ContentChangeObserver::adjustObservedState):
1944         (WebCore::ContentChangeObserver::signalContentChangeIfNeeded):
1945         * page/ios/ContentChangeObserver.h:
1946         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling const):
1947         (WebCore::ContentChangeObserver::addObservedDOMTimer): Deleted.
1948         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc): Deleted.
1949
1950 2019-03-02  Zalan Bujtas  <zalan@apple.com>
1951
1952         [ContentChangeObserver] Move away from WKContentChange values
1953         https://bugs.webkit.org/show_bug.cgi?id=195240
1954         <rdar://problem/48532358>
1955
1956         Reviewed by Simon Fraser.
1957
1958         This is in preparation for moving towards a state machine-like implementation.
1959
1960         * page/ios/ContentChangeObserver.cpp:
1961         (WebCore::ContentChangeObserver::didInstallDOMTimer): Do not install the timer if we are already in "hover" state.
1962         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
1963         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
1964         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
1965         (WebCore::ContentChangeObserver::startObservingStyleRecalc): No need to start observing the style recalc if we are already in "hover" state.
1966         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
1967         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
1968         (WebCore::ContentChangeObserver::didContentVisibilityChange):
1969         (WebCore::ContentChangeObserver::startObservingContentChanges):
1970         (WebCore::ContentChangeObserver::observedContentChange const):
1971         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
1972         (WebCore::ContentChangeObserver::hasDeterminedState const):
1973         (WebCore::ContentChangeObserver::observedContentChange): Deleted.
1974         (WebCore::ContentChangeObserver::resetObservedContentChange): Deleted.
1975         (WebCore::ContentChangeObserver::setObservedContentChange): Deleted.
1976         (WebCore::ContentChangeObserver::addObservedDOMTimer): Deleted.
1977         * page/ios/ContentChangeObserver.h:
1978         (WebCore::ContentChangeObserver::addObservedDOMTimer):
1979         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
1980         (WebCore::ContentChangeObserver::hasVisibleChangeState const):
1981         (WebCore::ContentChangeObserver::hasObservedDOMTimer const):
1982         (WebCore::ContentChangeObserver::setHasNoChangeState):
1983         (WebCore::ContentChangeObserver::setHasIndeterminateState):
1984         (WebCore::ContentChangeObserver::setHasVisibleChangeState):
1985         (WebCore::ContentChangeObserver::countOfObservedDOMTimers const): Deleted.
1986
1987 2019-03-02  Wenson Hsieh  <wenson_hsieh@apple.com>
1988
1989         [iOS] Programmatic paste access should be granted when copying and pasting within the same origin
1990         https://bugs.webkit.org/show_bug.cgi?id=195053
1991         <rdar://problem/48134710>
1992
1993         Reviewed by Ryosuke Niwa.
1994
1995         Plumb the document pasteboard identifier through the client when making a DOM paste access request. See WebKit
1996         ChangeLog for more details.
1997
1998         Test: editing/pasteboard/ios/dom-paste-same-origin.html
1999
2000         * WebCore.xcodeproj/project.pbxproj:
2001         * dom/DOMPasteAccess.h: Renamed from Source/WebCore/dom/DOMPasteAccessPolicy.h.
2002
2003         Introduce DOMPasteAccessResponse, which is either DeniedForGesture, GrantedForCommand, or GrantedForGesture. In
2004         particular, when pasteboard identifiers match, we only grant access for the current paste command, rather than
2005         throughout the user gesture.
2006
2007         * dom/UserGestureIndicator.h:
2008         (WebCore::UserGestureToken::didRequestDOMPasteAccess):
2009         * loader/EmptyClients.cpp:
2010         * page/EditorClient.h:
2011         * page/Frame.cpp:
2012         (WebCore::Frame::requestDOMPasteAccess):
2013
2014 2019-02-27  Darin Adler  <darin@apple.com>
2015
2016         Fixed makeString(float) to do shortest-form serialization without first converting to double
2017         https://bugs.webkit.org/show_bug.cgi?id=195142
2018
2019         Reviewed by Daniel Bates.
2020
2021         * platform/graphics/Color.cpp: Removed unneeded include of DecimalNumber.h.
2022
2023 2019-03-02  Simon Fraser  <simon.fraser@apple.com>
2024
2025         REGRESSION (r242132): Incorrect positioning with multiple position:fixed elements
2026         https://bugs.webkit.org/show_bug.cgi?id=195246
2027
2028         Reviewed by Frederic Wang.
2029
2030         r242132 introduced a bug where the management of 'cumulativeDelta' in ScrollingTree::notifyRelatedNodesRecursive
2031         was incorrect. This value should propagate from ancestors to descendants, but not between siblings in the scrolling
2032         tree, which it did, causing sibling position:fixed to behave incorrectly.
2033
2034         Test: scrollingcoordinator/mac/multiple-fixed.html
2035
2036         * page/scrolling/ScrollingTree.cpp:
2037         (WebCore::ScrollingTree::notifyRelatedNodesRecursive):
2038         * page/scrolling/ScrollingTree.h:
2039
2040 2019-03-02  Darin Adler  <darin@apple.com>
2041
2042         Improve some comments
2043         https://bugs.webkit.org/show_bug.cgi?id=195243
2044
2045         Reviewed by Daniel Bates.
2046
2047         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2048         (-[WebAccessibilityObjectWrapper _addAccessibilityObject:toTextMarkerArray:]):
2049         Fix a typo in a comment.
2050
2051         * dom/RadioButtonGroups.cpp: Fix a typo in a comment.
2052         (WebCore::RadioButtonGroups::checkedButtonForGroup const): Use nullptr instead of 0.
2053
2054         * html/HTMLInputElement.cpp:
2055         (WebCore::HTMLInputElement::~HTMLInputElement): Improved a comment, but sadly made
2056         it a bit longer. Use nullptr instead of 0.
2057         (WebCore::HTMLInputElement::didMoveToNewDocument): Added a comment.
2058
2059 2019-03-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2060
2061         [Datalist] fast/forms/datalist/datalist-child-validation.html crashes with a debug assertion in isValidFormControlElement()
2062         https://bugs.webkit.org/show_bug.cgi?id=190620
2063         <rdar://problem/19226679>
2064
2065         Reviewed by Ryosuke Niwa.
2066
2067         Fixes and re-enables an existing layout test that is asserting on debug builds (and failing on release builds).
2068         To understand why we hit this assertion, we first note several observations:
2069
2070             -   The validity of a form control (`isValid()`) depends on the value of `willValidate()`.
2071             -   Both of these results are cached in member variables: `m_isValid` and `m_willValidate`, respectively.
2072             -   `willValidate()` changes the cached value of `m_willValidate` if necessary, but `isValid()` uses the
2073                 cached value without update.
2074
2075         Now, consider the following scenario:
2076
2077             1.  Something changes in the DOM that changes the result of `willValidate()`. This can happen as a result of
2078                 several things:
2079                 a.  The form control changes readonly state
2080                 b.  The form control changes disabled state
2081                 c.  The form control is added to a datalist element
2082                 d.  The form control is removed from a datalist element
2083             2.  Call `willValidate()`.
2084             3.  Call `isValid()`.
2085
2086         In scenarios (a) - (c), we ensure that cached form control validity (`m_isValid`) is updated alongside
2087         `m_willValidate` by invoking `setNeedsWillValidateCheck()`, such that the result of `isValid()` matches the
2088         result of `m_isValid` in step (3). However, in the last scenario (d), we don't do this, which causes form
2089         control validity to fall out of sync with the result of `isValid()`. To fix the bug, we update willValidate and
2090         isValid when a form control is removed from an ancestor, only if one of its ancestors is a datalist element.
2091
2092         * html/HTMLFormControlElement.cpp:
2093         (WebCore::HTMLFormControlElement::insertedIntoAncestor):
2094         (WebCore::HTMLFormControlElement::removedFromAncestor):
2095
2096         Make a couple of minor tweaks:
2097           - Currently, we always invalidate `m_dataListAncestorState` by resetting the state to `Unknown` when the form
2098             control is removed from an ancestor or inserted. Instead, we only need to reset it when the form control
2099             already has an ancestor that is a datalist (in the case where it's being removed) or when the form control
2100             does not yet have an ancestor (in the case where it is being added).
2101           - If the form control was inside a datalist prior to removal, recompute its cached value of `m_willValidate`,
2102             as well as its cached validity (`m_isValid`).
2103
2104 2019-03-01  Darin Adler  <darin@apple.com>
2105
2106         Finish removing String::format
2107         https://bugs.webkit.org/show_bug.cgi?id=194893
2108
2109         Reviewed by Daniel Bates.
2110
2111         * dom/Document.cpp:
2112         (WebCore::Document::lastModified const): Use makeString and pad.
2113         * html/FTPDirectoryDocument.cpp:
2114         (WebCore::processFileDateString): Ditto.
2115
2116         * mathml/MathMLElement.cpp:
2117         (WebCore::convertToPercentageIfNeeded): Use makeString and FormattedNumber.
2118
2119         * page/cocoa/ResourceUsageOverlayCocoa.mm:
2120         (WebCore::ResourceUsageOverlay::platformDraw): Use makeString and pad.
2121
2122         * page/linux/ResourceUsageOverlayLinux.cpp:
2123         (WebCore::cpuUsageString): Use makeString, FormattedNumber, and pad.
2124         (WebCore::gcTimerString): Use String::number.
2125
2126         * platform/DateComponents.cpp:
2127         (WebCore::DateComponents::toStringForTime const): Use makeString and pad.
2128         (WebCore::DateComponents::toString const): Ditto.
2129
2130         * platform/LocalizedStrings.cpp: Removed comment that mentioned String::format,
2131         and that was also inaccurate.
2132
2133         * platform/audio/HRTFElevation.cpp:
2134         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
2135         Use makeString and pad.
2136         * platform/mock/MockRealtimeVideoSource.cpp:
2137         (WebCore::MockRealtimeVideoSource::drawText): Ditto.
2138         * rendering/RenderLayerCompositor.cpp:
2139         (WebCore::RenderLayerCompositor::logLayerInfo): Ditto.
2140         * rendering/RenderTheme.cpp:
2141         (WebCore::RenderTheme::formatMediaControlsTime const): Ditto.
2142
2143 2019-03-01  Chris Dumez  <cdumez@apple.com>
2144
2145         Do not attempt to set WAL Journal mode on a readonly SQLite database
2146         https://bugs.webkit.org/show_bug.cgi?id=195237
2147
2148         Reviewed by Simon Fraser.
2149
2150         This avoids logging errors when opening the database.
2151
2152         * platform/sql/SQLiteDatabase.cpp:
2153         (WebCore::SQLiteDatabase::open):
2154         (WebCore::SQLiteDatabase::useWALJournalMode):
2155         * platform/sql/SQLiteDatabase.h:
2156
2157 2019-03-01  Antoine Quint  <graouts@apple.com>
2158
2159         [iOS] Turn mouse event simulation on by default
2160         https://bugs.webkit.org/show_bug.cgi?id=195218
2161         <rdar://problem/48516794>
2162
2163         Reviewed by Dean Jackson.
2164
2165         * page/RuntimeEnabledFeatures.h:
2166
2167 2019-03-01  Chris Dumez  <cdumez@apple.com>
2168
2169         Disable NetworkStateNotifier::singleton()'s isMainThread() assertion when the WebThread is enabled
2170         https://bugs.webkit.org/show_bug.cgi?id=195230
2171         <rdar://problem/47925359>
2172
2173         Reviewed by Ryosuke Niwa.
2174
2175         Disable NetworkStateNotifier::singleton()'s isMainThread() assertion when the WebThread is enabled
2176         to address crashes on iOS WK1.
2177
2178         * platform/network/NetworkStateNotifier.cpp:
2179         (WebCore::shouldSuppressThreadSafetyCheck):
2180         (WebCore::NetworkStateNotifier::singleton):
2181
2182 2019-03-01  Simon Fraser  <simon.fraser@apple.com>
2183
2184         Show mouse event regions in the overlay
2185         https://bugs.webkit.org/show_bug.cgi?id=195227
2186
2187         Reviewed by Tim Horton.
2188
2189         Enhance event region overlays to show more kinds of events.
2190
2191         * page/DebugPageOverlays.cpp:
2192         (WebCore::touchEventRegionColors):
2193         (WebCore::NonFastScrollableRegionOverlay::drawRect):
2194
2195 2019-03-01  Zalan Bujtas  <zalan@apple.com>
2196
2197         [ContentChangeObserver] Check for pending style recalcs at the end of each timer run.
2198         https://bugs.webkit.org/show_bug.cgi?id=195220
2199         <rdar://problem/48518979>
2200
2201         Reviewed by Simon Fraser.
2202
2203         didScheduleStyleRecalc callback was introduced to see if a style recalc is scheduled while firing the DOM timer. However it does not handle the case
2204         when in addition to this style recalc scheduling, something later (though during the same timer firing) triggers a sync style recalc.
2205         Let's just check if we've got a pending style recalc when the DOM timer comes back.
2206
2207         Test: fast/events/touch/ios/style-recalc-schedule-and-force-relalc.html
2208
2209         * dom/Document.cpp:
2210         (WebCore::Document::scheduleStyleRecalc):
2211         * page/ios/ContentChangeObserver.cpp:
2212         (WebCore::hasPendingStyleRecalc):
2213         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
2214         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
2215         (WebCore::ContentChangeObserver::startObservingContentChanges):
2216         (WebCore::ContentChangeObserver::didScheduleStyleRecalc): Deleted.
2217         * page/ios/ContentChangeObserver.h:
2218         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling): Deleted.
2219         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling): Deleted.
2220         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling const): Deleted.
2221
2222 2019-03-01  John Wilander  <wilander@apple.com>
2223
2224         Resource Load Statistics: Further restrict client-side cookie persistence after cross-site navigations with link decoration
2225         https://bugs.webkit.org/show_bug.cgi?id=195196
2226         <rdar://problem/48006419>
2227
2228         Reviewed by Brent Fulgham.
2229
2230         Tests: http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site.html
2231                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html
2232                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html
2233                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html
2234                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource.html
2235
2236         Trackers abuse link query parameters to transport user identifiers cross-site.
2237         This patch detects such navigations and applies further restrictions to
2238         client-site cookies on the destination page.
2239
2240         * platform/network/NetworkStorageSession.cpp:
2241         (WebCore::NetworkStorageSession::setAgeCapForClientSideCookies):
2242             Now sets the regular 7-day cap and a reduced 1-day cap.
2243         (WebCore::NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics):
2244             Renamed NetworkStorageSession::removeStorageAccessForAllFramesOnPage() to
2245             NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics since
2246             it now clears out two types of page-specific data.
2247         (WebCore::NetworkStorageSession::committedCrossSiteLoadWithLinkDecoration):
2248             This function receives a cross-site navigation and checks if the originating
2249             site is a prevalent resource. If so, it marks the page or stricter cookie
2250             rules.
2251         (WebCore::NetworkStorageSession::resetCrossSiteLoadsWithLinkDecorationForTesting):
2252             Test infrastructure. This sets a state that overrides the regular per-page
2253             clear of data. The reason is that the double clear was racy and caused test
2254             failures.
2255         (WebCore::NetworkStorageSession::clientSideCookieCap const):
2256             New function that returns the current cookie lifetime cap.
2257         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage): Deleted.
2258             Renamed to NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics().
2259         * platform/network/NetworkStorageSession.h:
2260         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
2261         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
2262             Now calls NetworkStorageSession::clientSideCookieCap() to set the cap.
2263
2264 2019-03-01  Rob Buis  <rbuis@igalia.com>
2265
2266         Adjust XMLHttpRequest Content-Type handling
2267         https://bugs.webkit.org/show_bug.cgi?id=184645
2268
2269         Reviewed by Youenn Fablet.
2270
2271         Implement steps 4.4.1.2 and 4.4.1.3 of send() [1].
2272
2273         Test: web-platform-tests/xhr/send-content-type-charset.htm
2274
2275         [1] https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send
2276
2277         * platform/network/ParsedContentType.cpp:
2278         (WebCore::ParsedContentType::setCharset):
2279         * platform/network/ParsedContentType.h:
2280         * xml/XMLHttpRequest.cpp:
2281         (WebCore::replaceCharsetInMediaTypeIfNeeded):
2282         (WebCore::XMLHttpRequest::send):
2283         (WebCore::replaceCharsetInMediaType): Deleted.
2284
2285 2019-03-01  Youenn Fablet  <youenn@apple.com>
2286
2287         Update originsMatch to handle the case of file origins which enforce file path separation
2288         https://bugs.webkit.org/show_bug.cgi?id=195216
2289
2290         Reviewed by Brady Eidson.
2291
2292         Covered by the assertion and existing tests like fast/xmlhttprequest/xmlhttprequest-no-file-access.html.
2293         Make sure originsMatch returns true if either compared origins are the same object
2294         or they have the same file path separation behavior.
2295
2296         * page/SecurityOrigin.cpp:
2297         (WebCore::areOriginsMatching):
2298         (WebCore::originsMatch):
2299
2300 2019-03-01  Youenn Fablet  <youenn@apple.com>
2301
2302         Serialize IndexedDB::ObjectStoreOverwriteMode as an enum
2303         https://bugs.webkit.org/show_bug.cgi?id=195213
2304
2305         Reviewed by Alex Christensen.
2306
2307         Add traits to enable enum IPC encoding.
2308         No change of behavior.
2309
2310         * Modules/indexeddb/IndexedDB.h:
2311
2312 2019-03-01  Don Olmstead  <don.olmstead@sony.com>
2313
2314         [WinCairo] Enable service worker
2315         https://bugs.webkit.org/show_bug.cgi?id=188318
2316
2317         Reviewed by Youenn Fablet.
2318
2319         * WebCorePrefix.h:
2320         * testing/ServiceWorkerInternals.h:
2321         * workers/service/context/SWContextManager.cpp:
2322         (WebCore::SWContextManager::serviceWorkerFailedToTerminate):
2323         * workers/service/context/SWContextManager.h:
2324
2325 2019-03-01  Sihui Liu  <sihui_liu@apple.com>
2326
2327         Add a quirk for bostongloble.com and latimes.com
2328         https://bugs.webkit.org/show_bug.cgi?id=195155
2329
2330         Reviewed by Geoffrey Garen.
2331
2332         Covered by manual testing.
2333
2334         * Modules/webdatabase/DOMWindowWebDatabase.idl:
2335         * bindings/scripts/CodeGeneratorJS.pm:
2336         (GenerateRuntimeEnableConditionalString):
2337         * bindings/scripts/IDLAttributes.json:
2338         * bindings/scripts/preprocess-idls.pl:
2339         (GenerateConstructorAttributes):
2340         * page/Quirks.cpp:
2341         (WebCore::Quirks::hasWebSQLSupportQuirk const):
2342         * page/Quirks.h:
2343
2344 2019-03-01  Zalan Bujtas  <zalan@apple.com>
2345
2346         [ContentChangeObserver] Rename members and move implementation to header.
2347         https://bugs.webkit.org/show_bug.cgi?id=195198
2348         <rdar://problem/48499967>
2349
2350         Reviewed by Simon Fraser.
2351
2352         * page/ios/ContentChangeObserver.cpp:
2353         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
2354         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
2355         (WebCore::ContentChangeObserver::startObservingStyleRecalc):
2356         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
2357         (WebCore::ContentChangeObserver::startObservingContentChanges):
2358         (WebCore::ContentChangeObserver::stopObservingContentChanges):
2359         (WebCore::ContentChangeObserver::StyleRecalcScope::StyleRecalcScope):
2360         (WebCore::ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope):
2361         (WebCore::ContentChangeObserver::startObservingStyleResolve): Deleted.
2362         (WebCore::ContentChangeObserver::stopObservingStyleResolve): Deleted.
2363         (WebCore::ContentChangeObserver::isObservingContentChanges): Deleted.
2364         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling): Deleted.
2365         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling): Deleted.
2366         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling): Deleted.
2367         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling): Deleted.
2368         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling): Deleted.
2369         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling): Deleted.
2370         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc): Deleted.
2371         (WebCore::ContentChangeObserver::shouldObserveNextStyleRecalc): Deleted.
2372         (WebCore::ContentChangeObserver::countOfObservedDOMTimers): Deleted.
2373         (WebCore::ContentChangeObserver::clearObservedDOMTimers): Deleted.
2374         (WebCore::ContentChangeObserver::containsObservedDOMTimer): Deleted.
2375         * page/ios/ContentChangeObserver.h:
2376         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling):
2377         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling):
2378         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling const):
2379         (WebCore::ContentChangeObserver::containsObservedDOMTimer const):
2380         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling):
2381         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling):
2382         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling const):
2383         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc):
2384         (WebCore::ContentChangeObserver::shouldObserveStyleRecalc const):
2385         (WebCore::ContentChangeObserver::isObservingContentChanges const):
2386         (WebCore::ContentChangeObserver::countOfObservedDOMTimers const):
2387         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
2388
2389 2019-03-01  Zalan Bujtas  <zalan@apple.com>
2390
2391         [ContentChangeObserver] ContentChangeObserver::StyleChangeScope should not set WKContentVisibilityChange directly
2392         https://bugs.webkit.org/show_bug.cgi?id=195197
2393         <rdar://problem/48498332>
2394
2395         Reviewed by Simon Fraser.
2396
2397         Add didContentVisibilityChange to hide WKContentVisibilityChange value. We might also want to add some logic to didContentVisibilityChange at some point.
2398
2399         * page/ios/ContentChangeObserver.cpp:
2400         (WebCore::ContentChangeObserver::didContentVisibilityChange):
2401         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
2402         * page/ios/ContentChangeObserver.h:
2403
2404 2019-03-01  Jer Noble  <jer.noble@apple.com>
2405
2406         [EME] Make sure the hasSessionSemaphore is set even if HAVE(AVSTREAMSESSION) is false
2407         https://bugs.webkit.org/show_bug.cgi?id=195217
2408
2409         Reviewed by Eric Carlson.
2410
2411         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2412         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
2413
2414 2019-03-01  Justin Fan  <justin_fan@apple.com>
2415
2416         [Web GPU] 32-bit builds broken by attempt to disable WebGPU on 32-bit
2417         https://bugs.webkit.org/show_bug.cgi?id=195191
2418
2419         Rubber-stamped by Dean Jackson.
2420
2421         Dropping support for 32-bit entirely, so I'm intentionally leaving 32-bit broken.
2422
2423         * Configurations/FeatureDefines.xcconfig:
2424
2425 2019-02-28  Fujii Hironori  <Hironori.Fujii@sony.com>
2426
2427         HTTPSUpgradeList.db database should be opened in readonly mode
2428         https://bugs.webkit.org/show_bug.cgi?id=195194
2429         <rdar://problem/47103889>
2430
2431         Unreviewed build fix for curl.
2432
2433         * platform/network/curl/CookieJarDB.cpp:
2434         (WebCore::CookieJarDB::openDatabase): Removed the second arguemnt of SQLiteDatabase::open.
2435
2436 2019-02-28  Chris Dumez  <cdumez@apple.com>
2437
2438         Unreviewed Windows build fix after r242251.
2439
2440         * platform/win/SearchPopupMenuDB.cpp:
2441         (WebCore::SearchPopupMenuDB::openDatabase):
2442
2443 2019-02-28  Zalan Bujtas  <zalan@apple.com>
2444
2445         [ContentChangeObserver] Move timer removal code from DOMWindow::clearTimeout to DOMTimer::removeById
2446         https://bugs.webkit.org/show_bug.cgi?id=195143
2447         <rdar://problem/48462351>
2448
2449         Reviewed by Simon Fraser.
2450
2451         Currently DOMWindow::clearTimeout() is the only callsite that we are interested in, but this is more future-proof.
2452
2453         * page/DOMTimer.cpp:
2454         (WebCore::DOMTimer::removeById):
2455         * page/DOMWindow.cpp:
2456         (WebCore::DOMWindow::clearTimeout):
2457         * page/ios/ContentChangeObserver.cpp:
2458         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
2459         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
2460         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
2461         (WebCore::ContentChangeObserver::removeDOMTimer): Deleted.
2462         * page/ios/ContentChangeObserver.h:
2463
2464 2019-02-28  Chris Dumez  <cdumez@apple.com>
2465
2466         HTTPSUpgradeList.db database should be opened in readonly mode
2467         https://bugs.webkit.org/show_bug.cgi?id=195194
2468         <rdar://problem/47103889>
2469
2470         Reviewed by Youenn Fablet.
2471
2472         Add parameter to SQLiteDatabase::open() to specific the open flags.
2473
2474         * Modules/webdatabase/Database.cpp:
2475         (WebCore::Database::performOpenAndVerify):
2476         * platform/sql/SQLiteDatabase.cpp:
2477         (WebCore::SQLiteDatabase::open):
2478         * platform/sql/SQLiteDatabase.h:
2479         * platform/sql/SQLiteFileSystem.cpp:
2480         * platform/sql/SQLiteFileSystem.h:
2481
2482 2019-02-28  Brady Eidson  <beidson@apple.com>
2483
2484         Followup to:
2485         Universal links from Google search results pages don't open the app
2486         https://bugs.webkit.org/show_bug.cgi?id=195126
2487
2488         Unreviewed.
2489
2490         * page/SecurityOrigin.cpp:
2491         (WebCore::originsMatch): Remove a bogus assertion (reasoning in bugzilla)
2492
2493 2019-02-28  Simon Fraser  <simon.fraser@apple.com>
2494
2495         [iOS] Dark flash when opening Google AMP pages
2496         https://bugs.webkit.org/show_bug.cgi?id=195193
2497         rdar://problem/48326442
2498
2499         Reviewed by Zalan Bujtas.
2500
2501         After the incremental compositing updates changes, it was possible for a change in the size
2502         of an overflow:hidden element to fail to update the "ancestor clipping layer" geometry on
2503         a composited descendant that is not a descendant in z-order. When Google search results
2504         create the <iframe> that contain AMP contents, we'd fail to update a zero-sized clipping layer,
2505         leaving the #222 background of an intermediate element visible.
2506
2507         Fix by setting a flag in RenderLayer::updateLayerPosition() (which is called in containing block order)
2508         that sets the "needs geometry update" dirty bit on containing-block-descendant layers. Currently
2509         this flag affects all descendants; in future, we might be able to clear it for grand-children.
2510
2511         Tests: compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html
2512                compositing/geometry/ancestor-clip-change.html
2513
2514         * rendering/RenderLayer.cpp:
2515         (WebCore::RenderLayer::updateLayerPositions):
2516         (WebCore::RenderLayer::updateLayerPosition):
2517         * rendering/RenderLayer.h:
2518         * rendering/RenderLayerBacking.cpp:
2519         (WebCore::RenderLayerBacking::updateAfterLayout):
2520         * rendering/RenderLayerBacking.h:
2521
2522 2019-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
2523
2524         Use-after-move in RenderCombineText::combineTextIfNeeded()
2525         https://bugs.webkit.org/show_bug.cgi?id=195188
2526
2527         Reviewed by Zalan Bujtas.
2528
2529         r241288 uncovered an existing problem with our text-combine code. r242204 alleviated the
2530         symptom, but this patch fixes the source of the problem (and reverts r242204).
2531
2532         The code in RenderCombineText::combineTextIfNeeded() has a bit that’s like:
2533
2534         FontDescription bestFitDescription;
2535         while (...) {
2536             FontCascade compressedFont(WTFMove(bestFitDescription), ...);
2537             ...
2538         }
2539
2540         Clearly this is wrong.
2541
2542         Test: fast/text/text-combine-crash-2.html
2543
2544         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
2545         (WebCore::FontDescription::platformResolveGenericFamily):
2546         * rendering/RenderCombineText.cpp:
2547         (WebCore::RenderCombineText::combineTextIfNeeded):
2548
2549 2019-02-28  Zalan Bujtas  <zalan@apple.com>
2550
2551         [ContentChangeObserver] Introduce observer subclasses to scope content change observing.
2552         https://bugs.webkit.org/show_bug.cgi?id=195172
2553         <rdar://problem/48479259>
2554
2555         Reviewed by Simon Fraser.
2556
2557         Let's scope start/stopObserving call pairs.
2558
2559         * dom/Document.cpp:
2560         (WebCore::Document::updateStyleIfNeeded):
2561         * page/DOMTimer.cpp:
2562         (WebCore::DOMTimer::fired):
2563         * page/ios/ContentChangeObserver.cpp:
2564         (WebCore::ContentChangeObserver::StyleChangeObserver::StyleChangeObserver):
2565         (WebCore::ContentChangeObserver::StyleChangeObserver::~StyleChangeObserver):
2566         (WebCore::ContentChangeObserver::StyleRecalcObserver::StyleRecalcObserver):
2567         (WebCore::ContentChangeObserver::StyleRecalcObserver::~StyleRecalcObserver):
2568         (WebCore::ContentChangeObserver::DOMTimerObserver::DOMTimerObserver):
2569         (WebCore::ContentChangeObserver::DOMTimerObserver::~DOMTimerObserver):
2570         (WebCore::ContentChangeObserver::StyleChange::StyleChange): Deleted.
2571         (WebCore::ContentChangeObserver::StyleChange::~StyleChange): Deleted.
2572         * page/ios/ContentChangeObserver.h:
2573         * rendering/updating/RenderTreeUpdater.cpp:
2574         (WebCore::RenderTreeUpdater::updateElementRenderer):
2575
2576 2019-02-28  Antoine Quint  <graouts@apple.com>
2577
2578         Enable the Pointer Events runtime flag by default
2579         https://bugs.webkit.org/show_bug.cgi?id=195156
2580
2581         Reviewed by Dean Jackson.
2582
2583         * page/RuntimeEnabledFeatures.h:
2584
2585 2019-02-28  Zalan Bujtas  <zalan@apple.com>
2586
2587         [ContentChangeObserver] Make observed state reset explicit.
2588         https://bugs.webkit.org/show_bug.cgi?id=195185
2589         <rdar://problem/48488342>
2590
2591         Reviewed by Simon Fraser.
2592
2593         Use setObservedContentChange only for setting the observed change while observing.
2594
2595         * page/ios/ContentChangeObserver.cpp:
2596         (WebCore::ContentChangeObserver::startObservingContentChanges):
2597         (WebCore::ContentChangeObserver::resetObservedContentChange):
2598         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
2599         * page/ios/ContentChangeObserver.h:
2600
2601 2019-02-28  Commit Queue  <commit-queue@webkit.org>
2602
2603         Unreviewed, rolling out r242210.
2604         https://bugs.webkit.org/show_bug.cgi?id=195179
2605
2606         it broke hover menus on losaltosonline.com (Requested by zalan
2607         on #webkit).
2608
2609         Reverted changeset:
2610
2611         "[ContentChangeObserver] Move timer removal code from
2612         DOMWindow::clearTimeout to DOMTimer::removeById"
2613         https://bugs.webkit.org/show_bug.cgi?id=195143
2614         https://trac.webkit.org/changeset/242210
2615
2616 2019-02-28  Zalan Bujtas  <zalan@apple.com>
2617
2618         [ContentChangeObserver] Move timer removal code from DOMWindow::clearTimeout to DOMTimer::removeById
2619         https://bugs.webkit.org/show_bug.cgi?id=195143
2620         <rdar://problem/48462351>
2621
2622         Reviewed by Simon Fraser.
2623
2624         Currently DOMWindow::clearTimeout() is the only callsite that we are interested in, but this is more future-proof.
2625
2626         * page/DOMTimer.cpp:
2627         (WebCore::DOMTimer::removeById):
2628         * page/DOMWindow.cpp:
2629         (WebCore::DOMWindow::clearTimeout):
2630         * page/ios/ContentChangeObserver.cpp:
2631         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
2632         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
2633         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
2634         (WebCore::ContentChangeObserver::removeDOMTimer): Deleted.
2635         * page/ios/ContentChangeObserver.h:
2636
2637 2019-02-28  Charles Vazac  <cvazac@akamai.com>
2638
2639         Fix Resource Timing buffer edge cases for WPT
2640         https://bugs.webkit.org/show_bug.cgi?id=193213
2641
2642         Reviewed by Youenn Fablet.
2643
2644         Test coverage by LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer*.html
2645
2646         * page/Performance.cpp:
2647         (WebCore::Performance::resourceTimingBufferFullTimerFired): Only dispatch the
2648         resourcetimingbufferfull event if the buffer is still full (as it may have been cleared or
2649         expanded). Also, avoid infinite loops if we aren't able to decrease the number of entries in
2650         the secondary buffer.
2651
2652 2019-02-28  Takashi Komori  <Takashi.Komori@sony.com>
2653
2654         [Curl] HTTP Body is missing with redirection.
2655         https://bugs.webkit.org/show_bug.cgi?id=191651
2656
2657         Reviewed by Don Olmstead.
2658
2659         Implement updateFromDelegatePreservingOldProperties for curl port.
2660
2661         Tests: http/tests/navigation/post-301-response.html
2662                http/tests/navigation/post-302-response.html
2663                http/tests/navigation/post-303-response.html
2664                http/tests/navigation/post-307-response.html
2665                http/tests/navigation/post-308-response.html
2666
2667         * platform/Curl.cmake:
2668         * platform/network/curl/ResourceRequest.h:
2669         (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties): Deleted.
2670         * platform/network/curl/ResourceRequestCurl.cpp: Added.
2671         (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties):
2672
2673 2019-02-28  Carlos Garcia Campos  <cgarcia@igalia.com>
2674
2675         [CoordinatedGraphics] Remove COORDINATED_GRAPHICS_THREADED option
2676         https://bugs.webkit.org/show_bug.cgi?id=195159
2677
2678         Reviewed by Don Olmstead.
2679
2680         Use COORDINATED_GRAPHICS instead.
2681
2682         * platform/graphics/GraphicsContext3D.h:
2683         * platform/graphics/PlatformLayer.h:
2684         * platform/graphics/cairo/ImageBufferCairo.cpp:
2685         (WebCore::ImageBufferData::ImageBufferData):
2686         (WebCore::ImageBufferData::~ImageBufferData):
2687         * platform/graphics/cairo/ImageBufferDataCairo.h:
2688         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp:
2689         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h:
2690         * platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp:
2691         (Nicosia::GC3DLayer::swapBuffersIfNeeded):
2692         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
2693         (WebCore::GraphicsContext3D::reshapeFBOs):
2694         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2695         (WebCore::GraphicsContext3D::prepareTexture):
2696         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
2697         (WebCore::GraphicsContext3D::reshapeFBOs):
2698         * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp:
2699         (WebCore::GraphicsContext3D::GraphicsContext3D):
2700         (WebCore::GraphicsContext3D::~GraphicsContext3D):
2701         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
2702         (WebCore::TextureMapperGC3DPlatformLayer::TextureMapperGC3DPlatformLayer):
2703         (WebCore::TextureMapperGC3DPlatformLayer::~TextureMapperGC3DPlatformLayer):
2704         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
2705         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
2706         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
2707         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
2708         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
2709         * platform/graphics/texmap/TextureMapperPlatformLayerProxyProvider.h:
2710         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2711         (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay):
2712         (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer):
2713         (WebCore::CoordinatedGraphicsLayer::updatePlatformLayer):
2714         * rendering/RenderLayerBacking.cpp:
2715         (WebCore::RenderLayerBacking::paintsIntoWindow const):
2716         * rendering/RenderLayerCompositor.cpp:
2717         (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls const):
2718
2719 2019-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
2720
2721         Locale names can be nullptr
2722         https://bugs.webkit.org/show_bug.cgi?id=195171
2723         <rdar://problem/48262376>
2724
2725         Reviewed by Dean Jackson.
2726
2727         Nullptr can't be used in keys to HashMaps, so take an early out in this case.
2728
2729         This is a partial revert of r241288.
2730
2731         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
2732         (WebCore::FontDescription::platformResolveGenericFamily):
2733
2734 2019-02-28  Justin Fan  <justin_fan@apple.com>
2735
2736         [Web GPU] Enable Web GPU only on 64-bit
2737         https://bugs.webkit.org/show_bug.cgi?id=195139
2738
2739         Because Metal is only supported on 64 bit apps.
2740
2741         Unreviewed build fix.
2742
2743         * Configurations/FeatureDefines.xcconfig:
2744
2745 2019-02-27  Zalan Bujtas  <zalan@apple.com>
2746
2747         [ContentChangeObserver] Move WKSetObservedContentChange logic to ContentChangeObserver class.
2748         https://bugs.webkit.org/show_bug.cgi?id=195128
2749         <rdar://problem/48456752>
2750
2751         Reviewed by Simon Fraser.
2752
2753         Move the final bits over to ContentChangeObserver and delete WKContentObservationInternal.h.
2754
2755         * WebCore.xcodeproj/project.pbxproj:
2756         * page/ios/ContentChangeObserver.mm:
2757         (WebCore::ContentChangeObserver::setObservedContentChange):
2758         * platform/ios/wak/WKContentObservation.cpp:
2759         (WKSetObservedContentChange):
2760         * platform/ios/wak/WKContentObservation.h:
2761         * platform/ios/wak/WKContentObservationInternal.h: Removed.
2762
2763 2019-02-27  Simon Fraser  <simon.fraser@apple.com>
2764
2765         Roll out r242014; it caused crashes in compositing logging (webkit.org/b/195141)
2766
2767         * dom/Document.cpp:
2768         (WebCore::Document::lastModified const):
2769         * html/FTPDirectoryDocument.cpp:
2770         (WebCore::processFileDateString):
2771         * mathml/MathMLElement.cpp:
2772         (WebCore::convertToPercentageIfNeeded):
2773         (WebCore::MathMLElement::collectStyleForPresentationAttribute):
2774         * page/cocoa/ResourceUsageOverlayCocoa.mm:
2775         (WebCore::ResourceUsageOverlay::platformDraw):
2776         * page/linux/ResourceUsageOverlayLinux.cpp:
2777         (WebCore::cpuUsageString):
2778         (WebCore::gcTimerString):
2779         * platform/DateComponents.cpp:
2780         (WebCore::DateComponents::toStringForTime const):
2781         (WebCore::DateComponents::toString const):
2782         * platform/LocalizedStrings.cpp:
2783         (WebCore::localizedString):
2784         * platform/audio/HRTFElevation.cpp:
2785         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
2786         * platform/mock/MockRealtimeVideoSource.cpp:
2787         (WebCore::MockRealtimeVideoSource::drawText):
2788         * rendering/RenderLayerCompositor.cpp:
2789         (WebCore::RenderLayerCompositor::logLayerInfo):
2790         * rendering/RenderTheme.cpp:
2791         (WebCore::RenderTheme::formatMediaControlsTime const):
2792
2793 2019-02-27  Zalan Bujtas  <zalan@apple.com>
2794
2795         [ContentChangeObserver] Move _WKObservingContentChanges from global to ContentChangeObserver class
2796         https://bugs.webkit.org/show_bug.cgi?id=195091
2797         <rdar://problem/48427271>
2798
2799         Reviewed by Tim Horton.
2800
2801         * page/ios/ContentChangeObserver.h:
2802         * page/ios/ContentChangeObserver.mm:
2803         (WebCore::ContentChangeObserver::startObservingContentChanges):
2804         (WebCore::ContentChangeObserver::stopObservingContentChanges):
2805         (WebCore::ContentChangeObserver::isObservingContentChanges):
2806         * platform/ios/wak/WKContentObservation.cpp:
2807         (WKObservingContentChanges): Deleted.
2808         (WKStartObservingContentChanges): Deleted.
2809         (WKStopObservingContentChanges): Deleted.
2810         * platform/ios/wak/WKContentObservation.h:
2811         * platform/ios/wak/WKContentObservationInternal.h:
2812
2813 2019-02-27  Brady Eidson  <beidson@apple.com>
2814
2815         Universal links from Google search results pages don't open the app.
2816         <rdar://problem/46887179> and https://bugs.webkit.org/show_bug.cgi?id=195126
2817
2818         Reviewed by Geoffrey Garen.
2819
2820         Covered by new API tests.
2821
2822         * loader/DocumentLoader.cpp:
2823         (WebCore::DocumentLoader::shouldOpenExternalURLsPolicyToPropagate const): Propagate the external URL policy from
2824           an iframe if it is from the same security origin as the main frame.
2825
2826 2019-02-27  Zalan Bujtas  <zalan@apple.com>
2827
2828         [ContentChangeObserver] Move DOMTimer schedule handling from global to ContentChangeObserver class
2829         https://bugs.webkit.org/show_bug.cgi?id=195090
2830         <rdar://problem/48426771>
2831
2832         Reviewed by Tim Horton.
2833
2834         Also remove some unused functions from WKContentObservationInternal.
2835
2836         * page/ios/ContentChangeObserver.h:
2837         * page/ios/ContentChangeObserver.mm:
2838         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling):
2839         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling):
2840         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling):
2841         * platform/ios/wak/WKContentObservation.cpp:
2842         (WKStartObservingDOMTimerScheduling): Deleted.
2843         (WKStopObservingDOMTimerScheduling): Deleted.
2844         (WKIsObservingDOMTimerScheduling): Deleted.
2845         * platform/ios/wak/WKContentObservation.h:
2846         * platform/ios/wak/WKContentObservationInternal.h:
2847
2848 2019-02-27  Zalan Bujtas  <zalan@apple.com>
2849
2850         [ContentChangeObserver] Move style recalc handling from global to ContentChangeObserver class
2851         https://bugs.webkit.org/show_bug.cgi?id=195087
2852
2853         Reviewed by Simon Fraser.
2854
2855         Add m_observingNextStyleRecalc/m_observingStyleRecalcScheduling to ContentChangeObserver and move the related code over from WK functions.
2856
2857         * page/ios/ContentChangeObserver.h:
2858         * page/ios/ContentChangeObserver.mm:
2859         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling):
2860         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling):
2861         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling):
2862         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
2863         (WebCore::ContentChangeObserver::shouldObserveNextStyleRecalc):
2864         (WebCore::ContentChangeObserver::setObservedContentChange):
2865         * platform/ios/wak/WKContentObservation.cpp:
2866         (WKSetObservedContentChange):
2867         (WKStartObservingStyleRecalcScheduling): Deleted.
2868         (WKStopObservingStyleRecalcScheduling): Deleted.
2869         (WKIsObservingStyleRecalcScheduling): Deleted.
2870         (WKSetShouldObserveNextStyleRecalc): Deleted.
2871         (WKShouldObserveNextStyleRecalc): Deleted.
2872         * platform/ios/wak/WKContentObservation.h:
2873
2874 2019-02-27  Zalan Bujtas  <zalan@apple.com>
2875
2876         [ContentChangeObserver] Move DOM timer handling from global to ContentChangeObserver class
2877         https://bugs.webkit.org/show_bug.cgi?id=195070
2878         <rdar://problem/48417650>
2879
2880         Reviewed by Tim Horton.
2881
2882         Add DOM timer list to ContentChangeObserver and move the related code over from WK functions.
2883
2884         * page/ios/ContentChangeObserver.h:
2885         * page/ios/ContentChangeObserver.mm:
2886         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling):
2887         (WebCore::ContentChangeObserver::countOfObservedDOMTimers):
2888         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
2889         (WebCore::ContentChangeObserver::setObservedContentChange):
2890         (WebCore::ContentChangeObserver::containsObservedDOMTimer):
2891         (WebCore::ContentChangeObserver::addObservedDOMTimer):
2892         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
2893         * platform/ios/wak/WKContentObservation.cpp:
2894         (WKStartObservingDOMTimerScheduling):
2895         (WKSetObservedContentChange):
2896         (WebThreadGetObservedDOMTimers): Deleted.
2897         (WebThreadCountOfObservedDOMTimers): Deleted.
2898         (WebThreadClearObservedDOMTimers): Deleted.
2899         (WebThreadContainsObservedDOMTimer): Deleted.
2900         (WebThreadAddObservedDOMTimer): Deleted.
2901         (WebThreadRemoveObservedDOMTimer): Deleted.
2902         * platform/ios/wak/WKContentObservation.h:
2903
2904 2019-02-27  Justin Fan  <justin_fan@apple.com>
2905         Fix build errors after Web GPU buffer updates changed some IDL fields from unsigned long to unsigned long long.
2906
2907         Unreviewed build fix.
2908
2909         * Modules/webgpu/WebGPUBuffer.cpp:
2910         (WebCore::WebGPUBuffer::setSubData):
2911         * Modules/webgpu/WebGPUBuffer.h:
2912         * Modules/webgpu/WebGPUBufferBinding.h:
2913         * Modules/webgpu/WebGPURenderPassEncoder.idl:
2914         * platform/graphics/gpu/GPUBufferBinding.h:
2915         * platform/graphics/gpu/GPUVertexAttributeDescriptor.h:
2916         * platform/graphics/gpu/GPUVertexInputDescriptor.h:
2917
2918 2019-02-27  John Wilander  <wilander@apple.com>
2919
2920         Adopt WebCore::RegistrableDomain in WebCore::ResourceLoadStatistics and WebKit::NetworkProcessProxy
2921         https://bugs.webkit.org/show_bug.cgi?id=195071
2922         <rdar://problem/48417690>
2923
2924         Reviewed by Alex Christensen and Brent Fulgham.
2925
2926         No new tests. This patch maintains functionality covered by plenty of layout
2927         tests under http/tests/resourceLoadStatistics/ and http/tests/storageAccess.
2928
2929         This patch adopts WebCore::RegistrableDomain in WebCore::ResourceLoadStatistics
2930         and makes the necessary infrastructure changes to support that.
2931
2932         The previous HashCountedSets in WebCore::ResourceLoadStatistics are now just
2933         HashSets since we never used the counts for anything. This change simplified
2934         encoding and decoding for IPC and will eventually simplify encoding and
2935         decoding in loader/ResourceLoadStatistics.cpp when we obsolete statistics
2936         model version 14 and below.
2937
2938         The patch also makes WebCore::RegistrableDomain's String constructor private.
2939         A new create function WebCore::RegistrableDomain::uncheckedCreateFromString()
2940         is introduced to better signal to users that creating a registrable domain
2941         object with a string may create an object that doesn't match a registrable
2942         domain in a valid HTTP-family URL. This change (private String constructor)
2943         motivated a change in WebCore::AdClickAttribution where the Source and
2944         Destination structs now take a URL as parameter instead of a String.
2945
2946         Finally, this patch harmonizes parameter and variable naming, going from
2947         "origin" to "domain" and "mainFrame" to "topFrame."
2948
2949         * html/HTMLAnchorElement.cpp:
2950         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
2951         * html/HTMLMediaElement.cpp:
2952         (WebCore::HTMLMediaElement::mediaSessionTitle const):
2953         * loader/AdClickAttribution.h:
2954         (WebCore::AdClickAttribution::Source::Source):
2955         (WebCore::AdClickAttribution::Source::deletedValue):
2956         (WebCore::AdClickAttribution::Destination::Destination):
2957         (WebCore::AdClickAttribution::Destination::deletedValue):
2958         (WebCore::AdClickAttribution::decode):
2959         * loader/ResourceLoadObserver.cpp:
2960         (WebCore::ResourceLoadObserver::logSubresourceLoading):
2961         (WebCore::ResourceLoadObserver::logWebSocketLoading):
2962         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2963         (WebCore::ResourceLoadObserver::statisticsForURL):
2964         (WebCore::ResourceLoadObserver::statisticsForOrigin): Deleted.
2965         * loader/ResourceLoadObserver.h:
2966         * loader/ResourceLoadStatistics.cpp:
2967         (WebCore::encodeHashSet):
2968         (WebCore::ResourceLoadStatistics::encode const):
2969         (WebCore::decodeHashCountedSet):
2970         (WebCore::decodeHashSet):
2971         (WebCore::ResourceLoadStatistics::decode):
2972         (WebCore::appendHashSet):
2973         (WebCore::ResourceLoadStatistics::toString const):
2974         (WebCore::ResourceLoadStatistics::merge):
2975         (WebCore::encodeHashCountedSet): Deleted.
2976         (WebCore::encodeOriginHashSet): Deleted.
2977         (WebCore::decodeOriginHashSet): Deleted.
2978         (WebCore::appendHashCountedSet): Deleted.
2979         * loader/ResourceLoadStatistics.h:
2980         * platform/RegistrableDomain.h:
2981         (WebCore::RegistrableDomain::uncheckedCreateFromString):
2982         (WebCore::RegistrableDomain::RegistrableDomain):
2983         * testing/Internals.cpp:
2984         (WebCore::Internals::resourceLoadStatisticsForURL):
2985         (WebCore::Internals::resourceLoadStatisticsForOrigin): Deleted.
2986         * testing/Internals.h:
2987         * testing/Internals.idl:
2988
2989 2019-02-27  Justin Fan  <justin_fan@apple.com>
2990
2991         [Web GPU] Buffer updates part 2: setSubData, GPU/CPU synchronization
2992         https://bugs.webkit.org/show_bug.cgi?id=195077
2993         <rdar://problem/47805229>
2994
2995         Reviewed by Dean Jackson.
2996
2997         Implement GPUBuffer.setSubData and prevent the resolving of mapping promises if the buffer is scheduled to be 
2998         used on the GPU, and add handlers to resolve such promises after command buffer execution completes. In addition,
2999         update buffer sizes to u64 (unsigned long in C++) as per the updated Web GPU API.
3000
3001         Tests: webgpu/buffer-command-buffer-races.html
3002                webgpu/map-read-buffers.html
3003
3004         * Modules/webgpu/WebGPUBindGroup.h:
3005         (WebCore::WebGPUBindGroup::bindGroup const):
3006         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
3007         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Rename binding -> bufferBinding to reduce confusion.
3008         * Modules/webgpu/WebGPUBuffer.cpp: Small tweaks.
3009         (WebCore::WebGPUBuffer::setSubData):
3010         (WebCore::WebGPUBuffer::unmap): Correctly fail if buffer is destroyed.
3011         (WebCore::WebGPUBuffer::destroy):
3012         (WebCore::WebGPUBuffer::rejectOrRegisterPromiseCallback):
3013         * Modules/webgpu/WebGPUBuffer.h:
3014         (WebCore::WebGPUBuffer::buffer const): Returned buffer is no longer const so that it can be used in completed handler callbacks.
3015         * Modules/webgpu/WebGPUBuffer.idl: Enable setSubData.
3016         * Modules/webgpu/WebGPUCommandBuffer.cpp:
3017         (WebCore::WebGPUCommandBuffer::beginRenderPass):
3018         * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
3019         (WebCore::WebGPUProgrammablePassEncoder::setBindGroup const):
3020         * Modules/webgpu/WebGPUProgrammablePassEncoder.h:
3021         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
3022         (WebCore::WebGPURenderPassEncoder::setVertexBuffers):
3023         * Sources.txt:
3024         * WebCore.xcodeproj/project.pbxproj:
3025         * platform/graphics/gpu/GPUBuffer.h:
3026         (WebCore::GPUBuffer::isTransferDst const): Added various state and flag getters.
3027         (WebCore::GPUBuffer::isVertex const):
3028         (WebCore::GPUBuffer::isUniform const):
3029         (WebCore::GPUBuffer::isStorage const):
3030         (WebCore::GPUBuffer::isReadOnly const):
3031         (WebCore::GPUBuffer::isMappable const):
3032         (WebCore::GPUBuffer::isMapWrite const):
3033         (WebCore::GPUBuffer::isMapRead const):
3034         (WebCore::GPUBuffer::isMapWriteable const):
3035         (WebCore::GPUBuffer::isMapReadable const):
3036         * platform/graphics/gpu/GPUBufferBinding.h:
3037         * platform/graphics/gpu/GPUCommandBuffer.h:
3038         (WebCore::GPUCommandBuffer::usedBuffers const):
3039         (WebCore::GPUCommandBuffer::useBuffer):
3040         * platform/graphics/gpu/GPUDevice.cpp:
3041         (WebCore::GPUDevice::tryCreateBuffer): Pass Ref of itself for Buffer to request the Queue later, if needed.
3042         (WebCore::GPUDevice::tryCreateBuffer const): Deleted.
3043         * platform/graphics/gpu/GPUDevice.h:
3044         * platform/graphics/gpu/GPUProgrammablePassEncoder.cpp: Retain the encoder's commandBuffer to reference its used resource buffers.
3045         (WebCore::GPUProgrammablePassEncoder::GPUProgrammablePassEncoder):
3046         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
3047         (WebCore::GPUProgrammablePassEncoder::commandBuffer const):
3048         * platform/graphics/gpu/GPURenderPassEncoder.h:
3049         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
3050         (WebCore::GPUBuffer::validateBufferCreate): Move validation out of tryCreate.
3051         (WebCore::GPUBuffer::tryCreate): Create both shared and private buffers, depending on usage.
3052         (WebCore::GPUBuffer::GPUBuffer):
3053         (WebCore::GPUBuffer::~GPUBuffer): Call destroy instead of just unmap.
3054         (WebCore::GPUBuffer::state const):
3055         (WebCore::GPUBuffer::setSubData): Uses a cached collection of staging MTLBuffers to encode data copies to the implementation MTLBuffer.
3056         (WebCore::GPUBuffer::commandBufferCommitted): Register on the GPUBuffer that the provided MTLCommandBuffer uses it, and is about to be committed.
3057         (WebCore::GPUBuffer::commandBufferCompleted): MTLCommandBuffer's onCompletedHandler calls this.
3058         (WebCore::GPUBuffer::reuseSubDataBuffer): SetSubData's blit command buffers call this to return a staging buffer to the pool.
3059         (WebCore::GPUBuffer::registerMappingCallback):
3060         (WebCore::GPUBuffer::runMappingCallback):
3061         (WebCore::GPUBuffer::unmap):
3062         (WebCore::GPUBuffer::destroy):
3063         (WebCore::GPUBuffer::tryCreateSharedBuffer): Deleted.
3064         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
3065         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder):
3066         (WebCore::GPUProgrammablePassEncoder::setBindGroup):
3067         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
3068         (WebCore::GPUQueue::submit): Ensure submitted buffers are in the correct state, and add completed handlers for synchronization.
3069         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
3070         (WebCore::GPURenderPassEncoder::tryCreate):
3071         (WebCore::GPURenderPassEncoder::GPURenderPassEncoder): Retain the commandBuffer for later reference.
3072         (WebCore::GPURenderPassEncoder::setVertexBuffers): Mark vertex buffers as used before submission.
3073         (WebCore::GPURenderPassEncoder::create): Deleted.
3074
3075         Buffer size updates in the IDL:
3076         * Modules/webgpu/GPUBufferDescriptor.idl:
3077         * Modules/webgpu/WebGPUBuffer.idl:
3078         * Modules/webgpu/WebGPUBufferBinding.idl:
3079         * Modules/webgpu/WebGPUCommandBuffer.idl:
3080         * Modules/webgpu/WebGPURenderPassEncoder.idl:
3081         * Modules/webgpu/WebGPUVertexAttributeDescriptor.idl:
3082         * Modules/webgpu/WebGPUVertexInputDescriptor.idl:
3083
3084 2019-02-27  Youenn Fablet  <youenn@apple.com>
3085
3086         Remove LeetCode FetchRequest quirk
3087         https://bugs.webkit.org/show_bug.cgi?id=195100
3088
3089         Reviewed by Alex Christensen.
3090
3091         Covered by manual testing.
3092
3093         * Modules/fetch/FetchRequest.cpp:
3094         (WebCore::needsSignalQuirk):
3095
3096 2019-02-27  Chris Dumez  <cdumez@apple.com>
3097
3098         Unable to log into chase.com on iPad when DeviceMotionEvent API is disabled
3099         https://bugs.webkit.org/show_bug.cgi?id=195101
3100         <rdar://problem/48423023>
3101
3102         Reviewed by Geoffrey Garen.
3103
3104         Add site-specific quirk for chase.com on iOS where we fire a dummy DeviceMotionEvent if the page
3105         tries to register a "devicemotion" event listener and fails because the API is disabled. This is
3106         needed to unblock the site and proceed with the login flow.
3107
3108         Unfortunately, document()->settings().needsSiteSpecificQuirks() is false on iOS so I could not
3109         guard the quirk behind this flag.
3110
3111         * page/DOMWindow.cpp:
3112         (WebCore::DOMWindow::addEventListener):
3113         (WebCore::DOMWindow::failedToRegisterDeviceMotionEventListener):
3114         * page/DOMWindow.h:
3115
3116 2019-02-27  Antoine Quint  <graouts@apple.com>
3117
3118         Support Pointer Events on macOS
3119         https://bugs.webkit.org/show_bug.cgi?id=195008
3120         <rdar://problem/47454419>
3121
3122         Reviewed by Dean Jackson.
3123
3124         We now dispatch relevant pointer events as we prepare to dispatch mouse events. In most cases, this means we dispatch
3125         a pointer event of the same type, with "mouse" being substituted by "pointer", and with the same properties with the
3126         exception that if preventDefault() is called for a "pointerdown" event, the matching "mousedown" will not be dispatched,
3127         and the same behavior also extends to "pointerup".
3128
3129         Tests: pointerevents/mouse/over-enter-out-leave.html
3130                pointerevents/mouse/pointer-capture.html
3131                pointerevents/mouse/pointer-event-basic-properties.html
3132                pointerevents/mouse/pointer-events-before-mouse-events.html
3133                pointerevents/mouse/pointerdown-prevent-default.html
3134
3135         * Configurations/FeatureDefines.xcconfig:
3136         * dom/Document.cpp: All of the touch-action related members and functions should be iOS-specific since the touch-action
3137         property does not have any effect on macOS.
3138         (WebCore::Document::invalidateRenderingDependentRegions):
3139         (WebCore::Document::nodeWillBeRemoved):
3140         (WebCore::Document::updateTouchActionElements):
3141         * dom/Document.h:
3142         * dom/Element.cpp:
3143         (WebCore::Element::dispatchMouseEvent): Dispatch a pointer event matching the mouse event that is about to be dispatched.
3144         If preventDefault() is called in the event handler for either "pointerdown" or "pointerup", do not proceed with dispatching
3145         the mouse event.
3146         * dom/PointerEvent.cpp:
3147         (WebCore::pointerEventType):
3148         (WebCore::PointerEvent::create):
3149         * dom/PointerEvent.h:
3150         * page/EventHandler.cpp: Check both the pointer and mouse events to see if we need to dispatch "enter" and "leave" events.
3151         (WebCore::hierarchyHasCapturingEventListeners):
3152         (WebCore::EventHandler::updateMouseEventTargetNode):
3153         * page/PointerCaptureController.cpp: Fix a build error which only happened on macOS.
3154         (WebCore::PointerCaptureController::PointerCaptureController): Create the CapturingData for the unique mouse pointer.
3155         (WebCore::PointerCaptureController::hasPointerCapture): The code did not match the spec cited in the comment, only the
3156         pending target override needs to be considered to determine whether a given element has pointer capture enabled.
3157         (WebCore::PointerCaptureController::dispatchEvent): Dispatch the provided pointer event, accounting for pointer capture if
3158         it is set.
3159         * page/PointerLockController.cpp: Fix a build error which only happened on macOS.
3160         * style/StyleTreeResolver.cpp:
3161         (WebCore::Style::TreeResolver::resolveElement): Code related to touch-action is only relevant to iOS.
3162
3163 2019-02-27  Sihui Liu  <sihui_liu@apple.com>
3164
3165         Network Process is put to suspended when holding locked IndexedDB files
3166         https://bugs.webkit.org/show_bug.cgi?id=195024
3167         <rdar://problem/45194169>
3168
3169         Reviewed by Geoffrey Garen.
3170
3171         We found network process was suspended when IDBDatabase was being closed in the background database thread, 
3172         holding locks to its database file. To avoid starvation or deadlock, we need to keep network process alive by 
3173         taking background assertion in UI process until the closes are done and locks are released.
3174
3175         * Modules/indexeddb/server/IDBServer.cpp:
3176         (WebCore::IDBServer::IDBServer::create):
3177         (WebCore::IDBServer::IDBServer::IDBServer):
3178         (WebCore::IDBServer::IDBServer::createBackingStore):
3179         (WebCore::IDBServer::IDBServer::closeDatabase):
3180         (WebCore::IDBServer::IDBServer::didCloseDatabase):
3181         * Modules/indexeddb/server/IDBServer.h:
3182         (WebCore::IDBServer::IDBServer::create):
3183         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
3184         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentDeleteOperation):
3185         (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose):
3186         (WebCore::IDBServer::UniqueIDBDatabase::didShutdownForClose):
3187         (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
3188         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
3189         (WebCore::IDBServer::UniqueIDBDatabase::notifyServerAboutClose):
3190         * Modules/indexeddb/server/UniqueIDBDatabase.h:
3191
3192 2019-02-26  Simon Fraser  <simon.fraser@apple.com>
3193
3194         Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
3195         https://bugs.webkit.org/show_bug.cgi?id=194973
3196
3197         Reviewed by Antti Koivisto.
3198
3199         This patch cleans up how the scrolling tree responds to scrolls.
3200
3201         First, ScrollingTreeScrollingNode::m_currentScrollPosition is "truth" for scrolling thread/
3202         UI process scroll position.
3203
3204         On macOS where handleWheelEvent on the scrolling thread changes scroll position, the
3205         bottleneck is ScrollingTreeScrollingNode::scrollTo() which sets the new scroll position,
3206         update the visual viewport (for frame scrolls) updates the scrolledContentsLayer position,
3207         updates related layers on this node (counter-scrolling layers etc), and then tells the
3208         scrolling tree, which recurses through descendant nodes so they can adjust their layer
3209         positions.
3210
3211         On iOS, the bottleneck is ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling(),
3212         which does the above other than setting scrolledContentsLayer (since we're reacting to
3213         layer state changes, not producing them).
3214
3215         updateLayersAfterAncestorChange() is renamed to relatedNodeScrollPositionDidChange(), and
3216         ScrollingTree does the tree walk so classes don't have to implement
3217         updateLayersAfterAncestorChange() just to talk children. The ScrollingTree tree walk knows
3218         how to get the correct layoutViewport and to stop at frame boundaries (layer updates never
3219         need to cross frame boundaries).
3220
3221         We preserve 'cumulativeDelta'; it's necessary for things like fixed inside overflow:scroll,
3222         since the fixed state was computed with the "layout" scroll position, so we have to account
3223         for the scroll delta since the last committed position. It's possible we could improve this
3224         in future.
3225
3226         * page/scrolling/ScrollingTree.cpp:
3227         (WebCore::ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling):
3228         (WebCore::ScrollingTree::notifyRelatedNodesAfterScrollPositionChange):
3229         (WebCore::ScrollingTree::notifyRelatedNodesRecursive):
3230         (WebCore::ScrollingTree::mainFrameLayoutViewport):
3231         (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling): Deleted.
3232         * page/scrolling/ScrollingTree.h:
3233         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
3234         (WebCore::ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange): Deleted.
3235         * page/scrolling/ScrollingTreeFrameHostingNode.h:
3236         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
3237         (WebCore::ScrollingTreeFrameScrollingNode::updateViewportForCurrentScrollPosition):
3238         (WebCore::ScrollingTreeFrameScrollingNode::localToContentsPoint const):
3239         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
3240         * page/scrolling/ScrollingTreeNode.cpp:
3241         (WebCore::ScrollingTreeNode::relatedNodeScrollPositionDidChange):
3242         (WebCore::ScrollingTreeNode::enclosingScrollingNodeIncludingSelf):
3243         * page/scrolling/ScrollingTreeNode.h:
3244         * page/scrolling/ScrollingTreeScrollingNode.cpp:
3245         (WebCore::ScrollingTreeScrollingNode::minimumScrollPosition const):
3246         (WebCore::ScrollingTreeScrollingNode::scrollLimitReached const):
3247         (WebCore::ScrollingTreeScrollingNode::adjustedScrollPosition const):
3248         (WebCore::ScrollingTreeScrollingNode::scrollBy):
3249         (WebCore::ScrollingTreeScrollingNode::scrollTo):
3250         (WebCore::ScrollingTreeScrollingNode::currentScrollPositionChanged):
3251         (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
3252         (WebCore::ScrollingTreeScrollingNode::localToContentsPoint const):
3253         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterAncestorChange): Deleted.
3254         (WebCore::ScrollingTreeScrollingNode::setScrollPosition): Deleted.
3255         * page/scrolling/ScrollingTreeScrollingNode.h:
3256         * page/scrolling/ScrollingTreeScrollingNodeDelegate.h:
3257         (WebCore::ScrollingTreeScrollingNodeDelegate::currentScrollPosition const):
3258         (WebCore::ScrollingTreeScrollingNodeDelegate::scrollPosition const): Deleted.
3259         * page/scrolling/ThreadedScrollingTree.cpp:
3260         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
3261         * page/scrolling/ThreadedScrollingTree.h:
3262         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
3263         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
3264         (WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
3265         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange): Deleted.
3266         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
3267         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
3268         (WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
3269         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange): Deleted.
3270         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
3271         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3272         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
3273         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
3274         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
3275         (WebCore::ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition const):
3276         (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged):
3277         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
3278         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers):
3279         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState):
3280         (WebCore::ScrollingTreeFrameScrollingNodeMac::exposedUnfilledArea const):
3281         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const): Deleted.
3282         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition): Deleted.
3283         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition): Deleted.
3284         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateLayersAfterViewportChange): Deleted.
3285         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
3286         (): Deleted.
3287         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
3288         (WebCore::ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition const):
3289         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
3290         (WebCore::ScrollingTreeOverflowScrollingNodeMac::~ScrollingTreeOverflowScrollingNodeMac): Deleted.
3291         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange): Deleted.
3292         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): Deleted.
3293         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition): Deleted.
3294         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition): Deleted.
3295         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterDelegatedScroll): Deleted.
3296         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
3297         (WebCore::ScrollingTreeScrollingNodeDelegateMac::isAlreadyPinnedInDirectionOfGesture):
3298         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount):
3299         (WebCore::ScrollingTreeScrollingNodeDelegateMac::pinnedInDirection):
3300         (WebCore::ScrollingTreeScrollingNodeDelegateMac::adjustScrollPositionToBoundsIfNecessary):
3301         (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollOffset const):
3302         (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollOnAxis):
3303
3304 2019-02-22  Simon Fraser  <simon.fraser@apple.com>
3305
3306         Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
3307         https://bugs.webkit.org/show_bug.cgi?id=194973
3308
3309         Reviewed by Antti Koivisto.
3310
3311         The "master" value for the scroll position of a ScrollingTreeScrollingNode is now its m_scrollPosition member;
3312         layout viewports and layer positions will be set from this. This allows scrollPosition() to no longer be virtual
3313         and require different code for each scrolling node subclass, and adds a choke point that we can use to update
3314         the layout viewport.
3315         
3316         We can remove m_probableMainThreadScrollPosition on ScrollingTreeFrameScrollingNodeMac because this was really just
3317         an alias for the scroll position.
3318
3319         Add some isRootNode() checks for things that should only affect the main frame.
3320
3321         * page/scrolling/ScrollingTree.h: Remove fixedPositionRect() which was unused, and is a per-frame thing so makes
3322         no sense here.
3323         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
3324         (WebCore::ScrollingTreeFrameScrollingNode::didChangeScrollPosition):
3325         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
3326         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewport const):
3327         (WebCore::ScrollingTreeFrameScrollingNode::setLayoutViewport):
3328         (WebCore::ScrollingTreeFrameScrollingNode::fixedPositionRect): Deleted.
3329         * page/scrolling/ScrollingTreeScrollingNode.cpp:
3330         (WebCore::ScrollingTreeScrollingNode::setScrollPosition):
3331         (WebCore::ScrollingTreeScrollingNode::setScrollPositionInternal):
3332         (WebCore::ScrollingTreeScrollingNode::didChangeScrollPosition):
3333         * page/scrolling/ScrollingTreeScrollingNode.h:
3334         (WebCore::ScrollingTreeScrollingNode::scrollPosition const):
3335         * page/scrolling/ios/ScrollingTreeIOS.cpp:
3336         (WebCore::ScrollingTreeIOS::fixedPositionRect): Deleted.
3337         * page/scrolling/ios/ScrollingTreeIOS.h:
3338         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
3339         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3340         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
3341         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
3342         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
3343         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
3344         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState):
3345         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const): Deleted.
3346         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
3347         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
3348         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): Deleted.
3349
3350 2019-02-27  Ulrich Pflueger  <up@nanocosmos.de>
3351
3352         [MSE] SourceBuffer sample time increment vs. last frame duration check is broken
3353         https://bugs.webkit.org/show_bug.cgi?id=194747
3354         <rdar://problem/48148469>
3355
3356         Reviewed by Jer Noble.
3357
3358         Prevent unintended frame drops by including last frame duration in discontinuity check. 
3359
3360         Test: media/media-source/media-source-append-variable-frame-lengths-with-matching-durations.html
3361
3362         * Modules/mediasource/SourceBuffer.cpp:
3363         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
3364
3365 2019-02-27  Timothy Hatcher  <timothy@apple.com>
3366
3367         REGRESSION: WebKit content crash in Base System (because NSAppearance is NULL).
3368     &