[EME][GStreamer] Speculative build fix
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-03-12  Enrique Ocaña González  <eocanha@igalia.com>
2
3         [EME][GStreamer] Speculative build fix
4         https://bugs.webkit.org/show_bug.cgi?id=195614
5
6         Unreviewed speculative WPE build fix after r242776.
7
8         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h: Added missing include.
9
10 2019-03-12  Philippe Normand  <pnormand@igalia.com>
11
12         [GStreamer] remove legacy GStreamer version checks
13         https://bugs.webkit.org/show_bug.cgi?id=195552
14
15         Reviewed by Xabier Rodriguez-Calvar.
16
17         We require GStreamer 1.8.x so version checks below that make
18         little sense. Also checks for odd minor version numbers make sense
19         only for the latest GStreamer git development version.
20
21         * platform/graphics/gstreamer/GStreamerCommon.cpp:
22         (WebCore::initializeGStreamerAndRegisterWebKitElements):
23         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
24         (WebCore::MediaPlayerPrivateGStreamer::createAudioSink):
25         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
26         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
27         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
28
29 2019-03-12  Xabier Rodriguez Calvar  <calvaris@igalia.com>
30
31         [EME] generateRequest was not using the sanitized init data
32         https://bugs.webkit.org/show_bug.cgi?id=195555
33
34         Reviewed by Jer Noble.
35
36         * Modules/encryptedmedia/MediaKeySession.cpp:
37         (WebCore::MediaKeySession::generateRequest): Use sanitized init
38         data instead of the original one.
39
40 2019-03-12  Rob Buis  <rbuis@igalia.com>
41
42         Implement further CORS restrictions
43         https://bugs.webkit.org/show_bug.cgi?id=188644
44
45         Reviewed by Darin Adler.
46
47         Verify that header value length is not greater than 128 [1]. Also implement
48         Step 5 of [2] to append values to existing header value when calling
49         Headers.append.
50
51         Tests: fetch/api/cors/cors-preflight-not-cors-safelisted.any.html
52                fetch/api/cors/cors-preflight-not-cors-safelisted.any.worker.html
53                fetch/api/headers/headers-no-cors.window.html
54
55         [1] https://fetch.spec.whatwg.org/#cors-safelisted-request-header
56         [2] https://fetch.spec.whatwg.org/#concept-headers-append
57
58         * Modules/fetch/FetchHeaders.cpp:
59         (WebCore::canWriteHeader):
60         (WebCore::appendToHeaderMap):
61         (WebCore::FetchHeaders::remove):
62         (WebCore::FetchHeaders::set):
63         (WebCore::FetchHeaders::filterAndFill):
64         * platform/network/HTTPParsers.cpp:
65         (WebCore::isCrossOriginSafeRequestHeader): verify that header length is not greater than 128
66
67 2019-03-11  Ryosuke Niwa  <rniwa@webkit.org>
68
69         Remove OS X Server QuickTime plugin quirks
70         https://bugs.webkit.org/show_bug.cgi?id=195607
71
72         Reviewed by Brent Fulgham.
73
74         r87244 added a site specific quirk for Mac OS X Sever wiki pages.
75         However, the issue has since been resolved as of OS X Mountain Lion,
76         of which Apple has ended the support in September 2015.
77
78         Because the latest versions of Safari no longer supports non-Flash plugins,
79         the only scenario in which this quirk comes into play is when a third party app
80         which embeds WKWebView or WebKitLegacy loaded web pages on a OS X Server
81         running OS X Mountain Lion or earlier.
82
83         Given these observations, it's probably safe to remove this quirk from WebKit.
84
85         * html/HTMLObjectElement.cpp:
86         (WebCore::HTMLObjectElement::hasFallbackContent const):
87         (WebCore::HTMLObjectElement::hasValidClassId):
88         (WebCore::HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk): Deleted.
89         * html/HTMLObjectElement.h:
90
91 2019-03-11  Ross Kirsling  <ross.kirsling@sony.com>
92
93         Unreviewed speculative WPE build fix after r195586.
94
95         * platform/encryptedmedia/CDMInstance.h:
96
97 2019-03-12  Ryosuke Niwa  <rniwa@webkit.org>
98
99         Remove MediaWiki site specific quirks
100         https://bugs.webkit.org/show_bug.cgi?id=195597
101
102         Reviewed by Simon Fraser.
103
104         r47383 added a site specific quirk for the KHTML workaround in MediaWiki.
105
106         Blink since removed this workaround:
107         https://github.com/chromium/chromium/commit/ecf84fc9c1a51c8ede7adfd0b0cba446d9a8caa0
108
109         Given Chrome has been shipping without this quirk for six years, it's safe to assume
110         this site specific quirk is no longer neeed for Web compatibility.
111
112         * css/StyleSheetContents.cpp:
113         (WebCore::StyleSheetContents::parseAuthorStyleSheet):
114         * css/parser/CSSParserContext.cpp:
115         (WebCore::CSSParserContext::CSSParserContext):
116         (WebCore::operator==):
117         * css/parser/CSSParserContext.h:
118         (WebCore::CSSParserContextHash::hash):
119
120 2019-03-11  Ryosuke Niwa  <rniwa@webkit.org>
121
122         Remove OpenCube QuickMenu quirks from navigator.appVersion
123         https://bugs.webkit.org/show_bug.cgi?id=195600
124
125         Reviewed by Simon Fraser.
126
127         Remove the site specific quirk added in r35050 for OpenCube QuickMenu library for nwa.com
128
129         Blink removed this code back in 2013. The fact Chrome has been shipping successfully without
130         this quirk for six years is a good evidence that it's no longer needed for the Web compatibility.
131
132         * page/Navigator.cpp:
133         (WebCore::Navigator::appVersion const):
134         (WebCore::shouldHideFourDot): Deleted.
135
136 2019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
137
138         Unreviewed, rolling out r242763.
139
140         Causes layout test crashes on iOS simulator
141
142         Reverted changeset:
143
144         "[Synthetic Click] Dispatch mouseout soon after mouseup"
145         https://bugs.webkit.org/show_bug.cgi?id=195575
146         https://trac.webkit.org/changeset/242763
147
148 2019-03-11  Ross Kirsling  <ross.kirsling@sony.com>
149
150         Add Optional to Forward.h.
151         https://bugs.webkit.org/show_bug.cgi?id=195586
152
153         Reviewed by Darin Adler.
154
155         * Modules/encryptedmedia/MediaKeyStatusMap.cpp:
156         * Modules/encryptedmedia/MediaKeyStatusMap.h:
157         * Modules/webauthn/apdu/ApduCommand.cpp:
158         * Modules/webauthn/apdu/ApduCommand.h:
159         * Modules/webauthn/apdu/ApduResponse.cpp:
160         * Modules/webauthn/apdu/ApduResponse.h:
161         * Modules/webauthn/fido/FidoHidMessage.cpp:
162         * Modules/webauthn/fido/FidoHidMessage.h:
163         * Modules/webauthn/fido/U2fCommandConstructor.cpp:
164         * Modules/webauthn/fido/U2fCommandConstructor.h:
165         * Modules/webdatabase/SQLTransaction.cpp:
166         * Modules/webdatabase/SQLTransaction.h:
167         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
168         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.h:
169         * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.h:
170         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
171         * Modules/webgpu/WHLSL/WHLSLPrepare.h:
172         * Modules/webgpu/WebGPU.cpp:
173         * Modules/webgpu/WebGPU.h:
174         * Modules/webgpu/WebGPUCommandBuffer.cpp:
175         * Modules/webgpu/WebGPUCommandBuffer.h:
176         * animation/WebAnimation.cpp:
177         * animation/WebAnimation.h:
178         * crypto/gcrypt/GCryptUtilities.cpp:
179         * crypto/gcrypt/GCryptUtilities.h:
180         * css/CSSStyleDeclaration.cpp:
181         * css/CSSStyleDeclaration.h:
182         * dom/TextDecoder.cpp:
183         * dom/TextDecoder.h:
184         * dom/UserGestureIndicator.cpp:
185         * dom/UserGestureIndicator.h:
186         * editing/ChangeListTypeCommand.cpp:
187         * editing/ChangeListTypeCommand.h:
188         * editing/EditingStyle.cpp:
189         * editing/EditingStyle.h:
190         * html/DOMFormData.cpp:
191         * html/DOMFormData.h:
192         * html/HTMLAllCollection.cpp:
193         * html/HTMLAllCollection.h:
194         * html/HTMLAnchorElement.cpp:
195         * html/HTMLAnchorElement.h:
196         * html/ImageBitmap.cpp:
197         * html/ImageBitmap.h:
198         * html/canvas/Path2D.h:
199         * html/canvas/WebMetalEnums.cpp:
200         * html/canvas/WebMetalEnums.h:
201         * html/parser/HTMLParserIdioms.cpp:
202         * html/parser/HTMLParserIdioms.h:
203         * loader/ResourceCryptographicDigest.cpp:
204         * loader/ResourceCryptographicDigest.h:
205         * mathml/MathMLOperatorDictionary.cpp:
206         * mathml/MathMLOperatorDictionary.h:
207         * page/PerformanceEntry.cpp:
208         * page/PerformanceEntry.h:
209         * page/ResourceUsageData.h:
210         * platform/ReferrerPolicy.cpp:
211         * platform/ReferrerPolicy.h:
212         * platform/Theme.cpp:
213         * platform/Theme.h:
214         * platform/encryptedmedia/CDMInstance.h:
215         * platform/graphics/gpu/GPUDevice.cpp:
216         * platform/graphics/gpu/GPUDevice.h:
217         * platform/graphics/transforms/AffineTransform.cpp:
218         * platform/graphics/transforms/AffineTransform.h:
219         * platform/graphics/transforms/TransformState.cpp:
220         * platform/graphics/transforms/TransformState.h:
221         * platform/graphics/transforms/TransformationMatrix.cpp:
222         * platform/graphics/transforms/TransformationMatrix.h:
223         * platform/graphics/win/ImageDecoderDirect2D.cpp:
224         * platform/graphics/win/ImageDecoderDirect2D.h:
225         * platform/mediacapabilities/AudioConfiguration.h:
226         * platform/network/CacheValidation.cpp:
227         * platform/network/CacheValidation.h:
228         * platform/network/DataURLDecoder.cpp:
229         * platform/network/DataURLDecoder.h:
230         * platform/network/HTTPParsers.cpp:
231         * platform/network/HTTPParsers.h:
232         * platform/network/curl/CookieJarDB.cpp:
233         * platform/network/curl/CookieJarDB.h:
234         * platform/win/SearchPopupMenuDB.cpp:
235         * platform/win/SearchPopupMenuDB.h:
236         * rendering/ImageQualityController.cpp:
237         * rendering/ImageQualityController.h:
238         * svg/SVGToOTFFontConversion.cpp:
239         * svg/SVGToOTFFontConversion.h:
240         Remove unnecessary includes from headers.
241
242 2019-03-11  Jer Noble  <jer.noble@apple.com>
243
244         REGRESSION(r236281): YouTube Movies fail with "video format" error
245         https://bugs.webkit.org/show_bug.cgi?id=195598
246         <rdar://problem/48782842>
247
248         Reviewed by Jon Lee.
249
250         Partially revert r236281 for YouTube.com.
251
252         * page/Quirks.cpp:
253         (WebCore::Quirks::hasBrokenEncryptedMediaAPISupportQuirk const):
254
255 2019-03-11  Justin Fan  <justin_fan@apple.com>
256
257         [Web GPU] BindGroups/Argument buffers: Move MTLBuffer creation from and GPUBindGroup validation to GPUDevice.createBindGroup
258         https://bugs.webkit.org/show_bug.cgi?id=195519
259         <rdar://problem/48781297>
260
261         Reviewed by Myles C. Maxfield.
262
263         Metal's Argument Buffers should not be tied directly to GPUBindGroupLayout; rather, create the MTLBuffer 
264         in GPUBindGroup creation process.
265         Move GPUBindGroup validation out of setBindGroup and to GPUBindGroup creation for performance.
266
267         Covered by existing tests. No behavior change.
268
269         * Modules/webgpu/WebGPUDevice.cpp:
270         (WebCore::WebGPUDevice::createBindGroup const):
271         * Sources.txt:
272         * SourcesCocoa.txt:
273         * WebCore.xcodeproj/project.pbxproj:
274         * platform/graphics/gpu/GPUBindGroup.cpp: Removed.
275         * platform/graphics/gpu/GPUBindGroup.h:
276         (WebCore::GPUBindGroup::vertexArgsBuffer): A buffer that arguments will be encoded into during setBindGroup.
277         (WebCore::GPUBindGroup::fragmentArgsBuffer): Ditto.
278         (WebCore::GPUBindGroup::boundBuffers const): A list of resources that are bound by this GPUBindGroup.
279         (WebCore::GPUBindGroup::boundTextures const): Ditto.
280         (WebCore::GPUBindGroup::layout const): Deleted.
281         (WebCore::GPUBindGroup::bindings const): Deleted.
282         * platform/graphics/gpu/GPUBindGroupLayout.h: No longer creating and retaining MTLBuffers.
283         (WebCore::GPUBindGroupLayout::vertexEncoder const):
284         (WebCore::GPUBindGroupLayout::fragmentEncoder const):
285         (WebCore::GPUBindGroupLayout::computeEncoder const):
286         (WebCore::GPUBindGroupLayout::ArgumentEncoderBuffer::isValid const): Deleted.
287         (WebCore::GPUBindGroupLayout::vertexArguments const): Deleted.
288         (WebCore::GPUBindGroupLayout::fragmentArguments const): Deleted.
289         (WebCore::GPUBindGroupLayout::computeArguments const): Deleted.
290         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
291         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
292         (WebCore::tryCreateMtlArgumentEncoder):
293         (WebCore::GPUBindGroupLayout::tryCreate):
294         (WebCore::GPUBindGroupLayout::GPUBindGroupLayout):
295         (WebCore::tryCreateArgumentEncoderAndBuffer): Deleted.
296         * platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm: Added.
297         (WebCore::tryCreateArgumentBuffer): Create and associate the MTLBuffer that backs the MTLArgumentEncoder.
298         (WebCore::tryGetResourceAsBufferBinding): Validate a GPUBindingResource.
299         (WebCore::trySetBufferOnEncoder): Encodes a GPUBufferBinding's MTLBuffer on a MTLArgumentEncoder.
300         (WebCore::tryGetResourceAsSampler): Ditto, for GPUSamplers.
301         (WebCore::trySetSamplerOnEncoder):
302         (WebCore::tryGetResourceAsTexture): Ditto, for GPUTextures.
303         (WebCore::trySetTextureOnEncoder):
304         (WebCore::GPUBindGroup::tryCreate): Most setBindGroup validation moved here.
305         (WebCore::GPUBindGroup::GPUBindGroup): Retains the resource references needed for setBindGroup. 
306         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
307         (WebCore::GPUProgrammablePassEncoder::setBindGroup): Most validation moved to GPUBindGroup::tryCreate().
308         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder): Deleted.
309         (WebCore::GPUProgrammablePassEncoder::setResourceAsSamplerOnEncoder): Deleted.
310         (WebCore::GPUProgrammablePassEncoder::setResourceAsTextureOnEncoder): Deleted.
311         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
312         (WebCore::GPURenderPassEncoder::useResource):
313         (WebCore::GPURenderPassEncoder::setVertexBuffer):
314         (WebCore::GPURenderPassEncoder::setFragmentBuffer):
315
316         Misc:
317         * platform/graphics/gpu/GPUCommandBuffer.cpp/h: Move missing includes to header.
318
319 2019-03-11  Zalan Bujtas  <zalan@apple.com>
320
321         [Synthetic Click] Dispatch mouseout soon after mouseup
322         https://bugs.webkit.org/show_bug.cgi?id=195575
323         <rdar://problem/47093049>
324
325         Reviewed by Simon Fraser.
326
327         Let's fire a mouseout event when a click is submitted as the result of a tap. It helps to dismiss content which would otherwise require you to move the mouse (cases like control bar on youtube.com).
328
329         Test: fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click.html
330
331         * page/EventHandler.h:
332         * page/ios/EventHandlerIOS.mm:
333         (WebCore::EventHandler::dispatchFakeMouseOut):
334
335 2019-03-11  Youenn Fablet  <youenn@apple.com>
336
337         REGRESSION: (r242181) API test DragAndDropTests.ExternalSourcePlainTextToIFrame is Timing out
338         https://bugs.webkit.org/show_bug.cgi?id=195362
339
340         Reviewed by Alexey Proskuryakov.
341
342         Covered by API test no longer crashing.
343
344         * page/SecurityOrigin.cpp:
345         (WebCore::originsMatch):
346         String representation should only match if originsMatch returns true.
347
348 2019-03-11  Justin Fan  <justin_fan@apple.com>
349
350         [Web GPU] Update GPUSwapChainDescriptor, GPUSwapChain and implement GPUCanvasContext
351         https://bugs.webkit.org/show_bug.cgi?id=194406
352         <rdar://problem/47892466>
353
354         Reviewed by Myles C. Maxfield.
355
356         GPUSwapChain no longer inherits from GPUBasedRenderingContext, and is now created from a GPUDevice. 
357         WebGPURenderingContext is now GPUCanvasContext and delegates functionality to the GPUSwapChain, if it exists. 
358         GPUQueue now implicitly presents the GPUSwapChain's current drawable at the task boundary, if one exists.
359         Creating a new GPUSwapChain with the same GPUCanvasContext invalidates the previous one and its drawable and pipeline attachments.
360         Calling GPUSwapChain::getCurrentTexture returns the same drawable within one task cycle. 
361         Some mentions of "WebGPU" have been renamed to "Web GPU" and "gpu".
362
363         All Web GPU tests updated to match.
364
365         Add new files and symbols.
366         * CMakeLists.txt:
367         * DerivedSources-input.xcfilelist:
368         * DerivedSources-output.xcfilelist:
369         * DerivedSources.make:
370         * Sources.txt:
371         * WebCore.xcodeproj/project.pbxproj:
372         * bindings/js/WebCoreBuiltinNames.h:
373
374         Rename some mentions of "webgpu" to "gpu".
375         * Modules/webgpu/DOMWindowWebGPU.cpp:
376         (WebCore::DOMWindowWebGPU::gpu):
377         (WebCore::DOMWindowWebGPU::gpu const):
378         * Modules/webgpu/DOMWindowWebGPU.h:
379         * Modules/webgpu/DOMWindowWebGPU.idl:
380
381         Replace WebGPURenderingContext with GPUCanvasContext.
382         * Modules/webgpu/GPUCanvasContext.cpp: Renamed from Source/WebCore/Modules/webgpu/WebGPURenderingContext.cpp.
383         (WebCore::GPUCanvasContext::create):
384         (WebCore::GPUCanvasContext::GPUCanvasContext):
385         (WebCore::GPUCanvasContext::replaceSwapChain):
386         (WebCore::GPUCanvasContext::platformLayer const):
387         (WebCore::GPUCanvasContext::reshape):
388         (WebCore::GPUCanvasContext::markLayerComposited):
389         * Modules/webgpu/GPUCanvasContext.h: Renamed from Source/WebCore/Modules/webgpu/WebGPURenderingContext.h.
390         * Modules/webgpu/GPUCanvasContext.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPURenderingContext.idl.
391         * dom/Document.cpp:
392         (WebCore::Document::getCSSCanvasContext):
393         * dom/Document.h:
394         * dom/Document.idl:
395         * html/HTMLCanvasElement.cpp:
396         (WebCore::HTMLCanvasElement::getContext):
397         (WebCore::HTMLCanvasElement::isWebGPUType):
398         (WebCore::HTMLCanvasElement::createContextWebGPU):
399         (WebCore::HTMLCanvasElement::getContextWebGPU):
400         * html/HTMLCanvasElement.h:
401         * html/HTMLCanvasElement.idl:
402         * inspector/InspectorCanvas.cpp:
403         (WebCore::InspectorCanvas::buildObjectForCanvas):
404         * inspector/agents/InspectorCanvasAgent.cpp:
405         (WebCore::contextAsScriptValue):
406
407         Update WebGPUSwapChain.
408         * Modules/webgpu/GPUTextureDescriptor.idl:
409         * Modules/webgpu/GPUTextureFormat.idl: Add the other two texture formats supported by CAMetalLayer.
410         * Modules/webgpu/WebGPUDevice.cpp: Implement createSwapChain.
411         (WebCore::WebGPUDevice::createSwapChain const):
412         (WebCore::WebGPUDevice::getQueue const):
413         (WebCore::WebGPUDevice::getQueue): Deleted.
414         * Modules/webgpu/WebGPUDevice.h:
415         * Modules/webgpu/WebGPUDevice.idl:
416         * Modules/webgpu/WebGPUSwapChain.cpp:
417         (WebCore::WebGPUSwapChain::create):
418         (WebCore::WebGPUSwapChain::WebGPUSwapChain):
419         (WebCore::WebGPUSwapChain::getCurrentTexture): Renamed from getNextTexture. Only returns the next drawable if the last was presented.
420         (WebCore::WebGPUSwapChain::destroy): Invalidate this GPUSwapChain and its textures and views.
421         (WebCore::WebGPUSwapChain::configure): Deleted.
422         (WebCore::WebGPUSwapChain::getNextTexture): Deleted.
423         (WebCore::WebGPUSwapChain::present): Deleted.
424         (WebCore::WebGPUSwapChain::reshape): Deleted.
425         (WebCore::WebGPUSwapChain::markLayerComposited): Deleted.
426         * Modules/webgpu/WebGPUSwapChain.h: Now a device-based object rather than a rendering context.
427         (WebCore::WebGPUSwapChain::swapChain const):
428         (WebCore::WebGPUSwapChain::WebGPUSwapChain): Deleted.
429         * Modules/webgpu/WebGPUSwapChain.idl:
430         * Modules/webgpu/WebGPUSwapChainDescriptor.h: Added.
431         * platform/graphics/gpu/GPUDevice.cpp: Implement tryCreateSwapChain.
432         (WebCore::GPUDevice::tryCreateSwapChain const):
433         (WebCore::GPUDevice::getQueue const):
434         (WebCore::GPUDevice::getQueue): Deleted.
435         * platform/graphics/gpu/GPUDevice.h: Retain a reference to the current GPUSwapChain, if one exists.
436         (WebCore::GPUDevice::swapChain const):
437         * platform/graphics/gpu/GPUQueue.h:
438         * platform/graphics/gpu/GPUSwapChain.h:
439         (WebCore::GPUSwapChain::destroy):
440         * platform/graphics/gpu/GPUSwapChainDescriptor.h: Added.
441         * platform/graphics/gpu/GPUTextureFormat.h: Add the other two texture formats supported by CAMetalLayer.
442         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
443         (WebCore::GPUBuffer::commandBufferCommitted):
444         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
445         (WebCore::GPUQueue::tryCreate): Renamed from create to better fit functionality. Now retain a reference to the GPUDevice.
446         (WebCore::GPUQueue::GPUQueue):
447         (WebCore::GPUQueue::submit): Now checks state of all resources before marking them as committed or committing any resource.
448                 In addition, schedules the current drawable to be presented after all commands have been submitted during this task cycle.
449         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
450         (WebCore::useAttachments): Ensure that the command buffer is aware of any texture resources used as attachments.
451         (WebCore::GPURenderPassEncoder::tryCreate):
452         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
453         (WebCore::tryGetSupportedPixelFormat): Supported texture formats are the intersection of Web GPU's texture formats and CAMetalLayer's.
454         (WebCore::setLayerShape):
455         (WebCore::tryCreateSwapLayer): Create and configure the CAMetalLayer backing the swap chain.
456         (WebCore::GPUSwapChain::tryCreate):
457         (WebCore::GPUSwapChain::GPUSwapChain):
458         (WebCore::GPUSwapChain::tryGetCurrentTexture): Renamed from getNextTexture. Only returns a texture if the last one was presented.
459         (WebCore::GPUSwapChain::present):
460         (WebCore::GPUSwapChain::reshape):
461         (WebCore::GPUSwapChain::takeDrawable): Swaps out the current drawable so that it can be presented. The GPUSwapChain thus releases its reference to it.
462         (WebCore::GPUSwapChain::create): Deleted.
463         (WebCore::GPUSwapChain::setDevice): Deleted.
464         (WebCore::GPUSwapChain::setFormat): Deleted.
465         (WebCore::GPUSwapChain::getNextTexture): Deleted.
466         * platform/graphics/gpu/cocoa/GPUUtilsMetal.mm:
467         (WebCore::platformTextureFormatForGPUTextureFormat):
468
469         Misc:
470         * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp: Missing include.
471
472 2019-03-11  Chris Dumez  <cdumez@apple.com>
473
474         Update device orientation & motion permission native SPI as per latest proposal
475         https://bugs.webkit.org/show_bug.cgi?id=195567
476
477         Reviewed by Youenn Fablet.
478
479         * dom/DeviceOrientationAndMotionAccessController.cpp:
480         (WebCore::DeviceOrientationAndMotionAccessController::shouldAllowAccess):
481         * page/ChromeClient.h:
482
483 2019-03-11  Wenson Hsieh  <wenson_hsieh@apple.com>
484
485         [macOS] Dispatching reentrant "contextmenu" events may cause crashes
486         https://bugs.webkit.org/show_bug.cgi?id=195571
487         <rdar://problem/48086046>
488
489         Reviewed by Andy Estes.
490
491         Make ContextMenuController::handleContextMenuEvent robust against reentrancy by guarding it with a boolean flag.
492         As demonstrated in the test case, it is currently possible to force WebKit into a bad state by dispatching a
493         synthetic "contextmenu" event from within the scope of one of the "before(copy|cut|paste)" events triggered as
494         a result of handling a context menu event.
495
496         Test: fast/events/contextmenu-reentrancy-crash.html
497
498         * page/ContextMenuController.cpp:
499         (WebCore::ContextMenuController::handleContextMenuEvent):
500         * page/ContextMenuController.h:
501
502 2019-03-11  Andy Estes  <aestes@apple.com>
503
504         [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
505         https://bugs.webkit.org/show_bug.cgi?id=195530
506         <rdar://problem/48747164>
507
508         Reviewed by Alex Christensen.
509
510         * Modules/applepay/PaymentCoordinatorClient.h: Defined isWebPaymentCoordinator.
511         * page/Settings.yaml: Defined the applePayRemoteUIEnabled setting and reordered the other
512         Apple Pay settings.
513
514 2019-03-11  Alex Christensen  <achristensen@webkit.org>
515
516         Soft linking to Reveal framework should be optional
517         https://bugs.webkit.org/show_bug.cgi?id=195576
518         <rdar://problem/46822452>
519
520         Reviewed by Megan Gardner.
521
522         Systems exist with ENABLE(REVEAL) true and the Reveal framework does not exist.
523
524         * editing/cocoa/DictionaryLookup.mm:
525         (WebCore::showPopupOrCreateAnimationController):
526
527 2019-03-11  Yusuke Suzuki  <ysuzuki@apple.com>
528
529         [JSC] Reduce # of structures in JSGlobalObject initialization
530         https://bugs.webkit.org/show_bug.cgi?id=195498
531
532         Reviewed by Darin Adler.
533
534         * bindings/js/SerializedScriptValue.cpp:
535         (WebCore::CloneSerializer::serialize):
536
537 2019-03-11  Brent Fulgham  <bfulgham@apple.com>
538
539         Remove obsolete runtime flag for StorageAccess API Prompt
540         https://bugs.webkit.org/show_bug.cgi?id=195564
541         <rdar://problem/37279014>
542
543         Reviewed by Chris Dumez.
544
545         This bug tracks the work of removing the obsolete flag that had been used to optionally
546         prevent display of the StorageAccess API prompt. We have since shipped the final version
547         of this feature with an always-on prompt, and should have removed this runtime flag.
548
549         No test changes because this has no change in behavior. Tests already assume the prompt
550         behavior, and did not test turning the flag off.
551
552         * page/RuntimeEnabledFeatures.h:
553         (WebCore::RuntimeEnabledFeatures::setStorageAccessPromptsEnabled): Deleted.
554         (WebCore::RuntimeEnabledFeatures::storageAccessPromptsEnabled const): Deleted.
555         * testing/InternalSettings.cpp:
556         (WebCore::InternalSettings::Backup::Backup):
557         (WebCore::InternalSettings::Backup::restoreTo):
558         (WebCore::InternalSettings::setStorageAccessPromptsEnabled): Deleted.
559         * testing/InternalSettings.h:
560         (): Deleted.
561         * testing/InternalSettings.idl:
562
563 2019-03-11  Eric Carlson  <eric.carlson@apple.com>
564
565         Add web audio release logging
566         https://bugs.webkit.org/show_bug.cgi?id=195554
567         <rdar://problem/48767211>
568
569         Reviewed by Jer Noble.
570
571         No new tests, no functional change.
572
573         * Modules/webaudio/AudioBasicInspectorNode.cpp:
574         (WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode):
575         * Modules/webaudio/AudioBufferSourceNode.cpp:
576         (WebCore::AudioBufferSourceNode::setBuffer):
577         (WebCore::AudioBufferSourceNode::startPlaying):
578         * Modules/webaudio/AudioContext.cpp:
579         (WebCore::nextLogIdentifier):
580         (WebCore::AudioContext::AudioContext):
581         (WebCore::AudioContext::uninitialize):
582         (WebCore::AudioContext::stop):
583         (WebCore::AudioContext::createBufferSource):
584         (WebCore::AudioContext::createMediaElementSource):
585         (WebCore::AudioContext::createMediaStreamSource):
586         (WebCore::AudioContext::createScriptProcessor):
587         (WebCore::AudioContext::createBiquadFilter):
588         (WebCore::AudioContext::createWaveShaper):
589         (WebCore::AudioContext::createPanner):
590         (WebCore::AudioContext::createConvolver):
591         (WebCore::AudioContext::createDynamicsCompressor):
592         (WebCore::AudioContext::createAnalyser):
593         (WebCore::AudioContext::createGain):
594         (WebCore::AudioContext::createDelay):
595         (WebCore::AudioContext::createChannelSplitter):
596         (WebCore::AudioContext::createChannelMerger):
597         (WebCore::AudioContext::createOscillator):
598         (WebCore::AudioContext::createPeriodicWave):
599         (WebCore::AudioContext::willBeginPlayback):
600         (WebCore::AudioContext::startRendering):
601         (WebCore::AudioContext::fireCompletionEvent):
602         (WebCore::AudioContext::logChannel const):
603         * Modules/webaudio/AudioContext.h:
604         (WebCore::AudioContext::nextAudioNodeLogIdentifier):
605         (WebCore::AudioContext::nextAudioParameterLogIdentifier):
606         * Modules/webaudio/AudioDestinationNode.cpp:
607         (WebCore::AudioDestinationNode::AudioDestinationNode):
608         * Modules/webaudio/AudioNode.cpp:
609         (WebCore::convertEnumerationToString):
610         (WebCore::AudioNode::AudioNode):
611         (WebCore::AudioNode::~AudioNode):
612         (WebCore::AudioNode::setNodeType):
613         (WebCore::AudioNode::addInput):
614         (WebCore::AudioNode::addOutput):
615         (WebCore::AudioNode::connect):
616         (WebCore::AudioNode::disconnect):
617         (WebCore::AudioNode::setChannelCount):
618         (WebCore::AudioNode::setChannelCountMode):
619         (WebCore::AudioNode::setChannelInterpretation):
620         (WebCore::AudioNode::logChannel const):
621         * Modules/webaudio/AudioNode.h:
622         (WTF::LogArgument<WebCore::AudioNode::NodeType>::toString):
623         * Modules/webaudio/AudioParam.cpp:
624         (WebCore::AudioParam::AudioParam):
625         (WebCore::AudioParam::setValue):
626         (WebCore::AudioParam::connect):
627         (WebCore::AudioParam::disconnect):
628         (WebCore::AudioParam::logChannel const):
629         * Modules/webaudio/AudioParam.h:
630         * Modules/webaudio/AudioScheduledSourceNode.cpp:
631         (WebCore::AudioScheduledSourceNode::start):
632         (WebCore::AudioScheduledSourceNode::stop):
633         * Modules/webaudio/BiquadFilterNode.cpp:
634         (WebCore::BiquadFilterNode::BiquadFilterNode):
635         * Modules/webaudio/ChannelMergerNode.cpp:
636         (WebCore::ChannelMergerNode::ChannelMergerNode):
637         * Modules/webaudio/ChannelSplitterNode.cpp:
638         (WebCore::ChannelSplitterNode::ChannelSplitterNode):
639         * Modules/webaudio/ConvolverNode.cpp:
640         (WebCore::ConvolverNode::ConvolverNode):
641         * Modules/webaudio/DefaultAudioDestinationNode.cpp:
642         (WebCore::DefaultAudioDestinationNode::initialize):
643         (WebCore::DefaultAudioDestinationNode::uninitialize):
644         (WebCore::DefaultAudioDestinationNode::enableInput):
645         (WebCore::DefaultAudioDestinationNode::setChannelCount):
646         * Modules/webaudio/DelayNode.cpp:
647         (WebCore::DelayNode::DelayNode):
648         * Modules/webaudio/DynamicsCompressorNode.cpp:
649         (WebCore::DynamicsCompressorNode::DynamicsCompressorNode):
650         * Modules/webaudio/GainNode.cpp:
651         (WebCore::GainNode::GainNode):
652         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
653         (WebCore::MediaElementAudioSourceNode::MediaElementAudioSourceNode):
654         * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
655         (WebCore::MediaStreamAudioSourceNode::MediaStreamAudioSourceNode):
656         * Modules/webaudio/OfflineAudioDestinationNode.cpp:
657         (WebCore::OfflineAudioDestinationNode::startRendering):
658         * Modules/webaudio/OscillatorNode.cpp:
659         (WebCore::OscillatorNode::setType):
660         (WebCore::OscillatorNode::setPeriodicWave):
661         * Modules/webaudio/OscillatorNode.h:
662         (WTF::LogArgument<WebCore::OscillatorNode::Type>::toString):
663         * Modules/webaudio/PannerNode.cpp:
664         (WebCore::PannerNode::PannerNode):
665         * Modules/webaudio/ScriptProcessorNode.cpp:
666         (WebCore::ScriptProcessorNode::ScriptProcessorNode):
667         * Modules/webaudio/WaveShaperNode.cpp:
668         (WebCore::WaveShaperNode::WaveShaperNode):
669         (WebCore::WaveShaperNode::setCurve):
670         (WebCore::WaveShaperNode::setOversample):
671         * Modules/webaudio/WaveShaperNode.h:
672         (WTF::LogArgument<WebCore::WaveShaperNode::OverSampleType>::toString):
673
674 2019-03-11  Youenn Fablet  <youenn@apple.com>
675
676         Make IDBDatabaseIdentifier take a ClientOrigin as member
677         https://bugs.webkit.org/show_bug.cgi?id=195544
678
679         Reviewed by Geoffrey Garen.
680
681         Instead of taking a top and a frame origin, make
682         make IDBDatabaseIdentifier take a ClientOrigin.
683
684         This allows reusing some ClientOrigin code
685         and will ease implementation of storage quota checking in
686         NetworkProcess, as quota managers are keyed by client origins.
687
688         No change of behavior.
689
690         * Modules/indexeddb/IDBDatabaseIdentifier.cpp:
691         (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier):
692         (WebCore::IDBDatabaseIdentifier::isolatedCopy const):
693         (WebCore::IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot const):
694         (WebCore::IDBDatabaseIdentifier::debugString const):
695         * Modules/indexeddb/IDBDatabaseIdentifier.h:
696         (WebCore::IDBDatabaseIdentifier::hash const):
697         (WebCore::IDBDatabaseIdentifier::operator== const):
698         (WebCore::IDBDatabaseIdentifier::origin const):
699         (WebCore::IDBDatabaseIdentifier::isRelatedToOrigin const):
700         (WebCore::IDBDatabaseIdentifier::encode const):
701         (WebCore::IDBDatabaseIdentifier::decode):
702         * page/ClientOrigin.h:
703         (WebCore::ClientOrigin::isRelated const):
704
705 2019-03-11  Zan Dobersek  <zdobersek@igalia.com>
706
707         Unreviewed. Manually rolling out r242701 and r242703 since the changes
708         are causing test timeouts and crashes on GTK and WPE.
709
710         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
711         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
712         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
713         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
714         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
715         (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink):
716         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
717         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
718         (WebCore::TextureMapperPlatformLayerProxy::pushNextBuffer):
719         (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
720         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
721         (): Deleted.
722
723 2019-03-11  Jer Noble  <jer.noble@apple.com>
724
725         Use AVContentKeySession for "com.apple.fps.2_0" CDM version when AVStreamSession is absent
726         https://bugs.webkit.org/show_bug.cgi?id=195462
727         <rdar://problem/48712306>
728
729         Reviewed by Eric Carlson.
730
731         The difference between "com.apple.fps.2_0" and "3_0" is a protocol difference more than an
732         implementation difference. In "2_0", the "EME nitialization" data comes in the form of a "content
733         identifier", while the true initialization data is retrieved through a side channel directly from
734         the attached element. In "3_0", the "EME initialization data" is the exact initialization data
735         given by the parser, with no "content identifier" at all.
736
737         In the original implementation, the "2_0" used AVStreamSession, and "3_0" used AVContentKeySession,
738         but in the absense of AVStreamSession, those protocol differences are minor and can be implemented
739         using AVContentKeySession.
740
741         Changes:
742
743         - Add a new helper struct in CDMPrivateMediaSourceAVFObjC that represents the parsed parameters
744           of the CDM string.
745         - Add an "initData()" accessor to SourceBufferPrivateAVFObjC so that the "2_0" path can implement
746           the side channel access to the necessary initialization data.
747         - Refactor some of the SPI code to not re-declare unnecessary APIs.
748         - In CDMSessionAVContentKeySession::generateKeyRequest(), this function can never be called twice
749           so it is a logical impossibility to have a certificate at this point. Remove all this if() code.
750
751         * Modules/encryptedmedia/legacy/LegacyCDM.cpp:
752         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h:
753         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
754         (WebCore::CDMPrivateMediaSourceAVFObjC::parseKeySystem):
755         (WebCore::queryDecoderAvailability):
756         (WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystem):
757         (WebCore::CDMPrivateMediaSourceAVFObjC::createSession):
758         (WebCore::validKeySystemRE): Deleted.
759         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h:
760         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
761         (WebCore::CDMSessionAVContentKeySession::CDMSessionAVContentKeySession):
762         (WebCore::CDMSessionAVContentKeySession::generateKeyRequest):
763         (WebCore::CDMSessionAVContentKeySession::update):
764         (WebCore::CDMSessionAVContentKeySession::addParser):
765         (WebCore::CDMSessionAVContentKeySession::removeParser):
766         (WebCore::CDMSessionAVContentKeySession::contentKeySession):
767         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
768         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
769         (WebCore::CDMSessionAVStreamSession::CDMSessionAVStreamSession):
770         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
771         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
772         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession):
773         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
774         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
775         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
776
777 2019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
778
779         Unreviewed, rolling out r242688, r242643, r242624.
780
781         Caused multiple layout test failures and crashes on iOS and macOS.
782
783         Reverted changeset:
784
785         "requestAnimationFrame should execute before the next frame"
786         https://bugs.webkit.org/show_bug.cgi?id=177484
787         https://trac.webkit.org/changeset/242624/webkit
788
789         * Sources.txt:
790         * WebCore.xcodeproj/project.pbxproj:
791         * accessibility/mac/AXObjectCacheMac.mm:
792         (WebCore::AXObjectCache::platformHandleFocusedUIElementChanged):
793         * animation/DocumentAnimationScheduler.cpp: Added.
794         (WebCore::DocumentAnimationScheduler::create):
795         (WebCore::DocumentAnimationScheduler::DocumentAnimationScheduler):
796         (WebCore::DocumentAnimationScheduler::detachFromDocument):
797         (WebCore::DocumentAnimationScheduler::scheduleWebAnimationsResolution):
798         (WebCore::DocumentAnimationScheduler::unscheduleWebAnimationsResolution):
799         (WebCore::DocumentAnimationScheduler::scheduleScriptedAnimationResolution):
800         (WebCore::DocumentAnimationScheduler::displayRefreshFired):
801         (WebCore::DocumentAnimationScheduler::windowScreenDidChange):
802         (WebCore::DocumentAnimationScheduler::createDisplayRefreshMonitor const):
803         * animation/DocumentAnimationScheduler.h: Renamed from Source/WebCore/page/RenderingUpdateScheduler.h.
804         (WebCore::DocumentAnimationScheduler::lastTimestamp):
805         (WebCore::DocumentAnimationScheduler::isFiring const):
806         * animation/DocumentTimeline.cpp:
807         (WebCore::DocumentTimeline::DocumentTimeline):
808         (WebCore::DocumentTimeline::updateThrottlingState):
809         (WebCore::DocumentTimeline::suspendAnimations):
810         (WebCore::DocumentTimeline::resumeAnimations):
811         (WebCore::DocumentTimeline::liveCurrentTime const):
812         (WebCore::DocumentTimeline::currentTime):
813         (WebCore::DocumentTimeline::cacheCurrentTime):
814         (WebCore::DocumentTimeline::scheduleAnimationResolutionIfNeeded):
815         (WebCore::DocumentTimeline::animationTimingDidChange):
816         (WebCore::DocumentTimeline::scheduleAnimationResolution):
817         (WebCore::DocumentTimeline::unscheduleAnimationResolution):
818         (WebCore::DocumentTimeline::animationResolutionTimerFired):
819         (WebCore::DocumentTimeline::updateAnimationsAndSendEvents):
820         (WebCore::DocumentTimeline::scheduleNextTick):
821         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement):
822         (WebCore::DocumentTimeline::resolveAnimationsForElement):
823         (WebCore::DocumentTimeline::internalUpdateAnimationsAndSendEvents): Deleted.
824         * animation/DocumentTimeline.h:
825         * dom/Document.cpp:
826         (WebCore::Document::resolveStyle):
827         (WebCore::Document::prepareForDestruction):
828         (WebCore::Document::windowScreenDidChange):
829         (WebCore::Document::updateIntersectionObservations):
830         (WebCore::Document::scheduleForcedIntersectionObservationUpdate):
831         (WebCore::Document::animationScheduler):
832         (WebCore::Document::updateAnimationsAndSendEvents): Deleted.
833         (WebCore::Document::serviceRequestAnimationFrameCallbacks): Deleted.
834         * dom/Document.h:
835         * dom/ScriptedAnimationController.cpp:
836         (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
837         (WebCore::ScriptedAnimationController::scheduleAnimation):
838         (WebCore::ScriptedAnimationController::animationTimerFired):
839         (WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire):
840         (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks): Deleted.
841         * dom/ScriptedAnimationController.h:
842         * page/FrameView.cpp:
843         (WebCore::FrameView::viewportContentsChanged):
844         * page/IntersectionObserver.cpp:
845         (WebCore::IntersectionObserver::observe):
846         * page/Page.cpp:
847         (WebCore::Page::Page):
848         (WebCore::Page::willDisplayPage):
849         (WebCore::Page::addDocumentNeedingIntersectionObservationUpdate):
850         (WebCore::Page::updateIntersectionObservations):
851         (WebCore::Page::scheduleForcedIntersectionObservationUpdate):
852         (WebCore::Page::layoutIfNeeded): Deleted.
853         (WebCore::Page::renderingUpdate): Deleted.
854         (WebCore::Page::renderingUpdateScheduler): Deleted.
855         * page/Page.h:
856         * page/PageOverlayController.cpp:
857         (WebCore::PageOverlayController::didChangeViewExposedRect):
858         (WebCore::PageOverlayController::notifyFlushRequired):
859         * page/RenderingUpdateScheduler.cpp: Removed.
860         * page/ios/ContentChangeObserver.h:
861         * page/mac/ServicesOverlayController.mm:
862         (WebCore::ServicesOverlayController::Highlight::notifyFlushRequired):
863         * rendering/RenderLayerCompositor.cpp:
864         (WebCore::RenderLayerCompositor::scheduleLayerFlushNow):
865
866 2019-03-11  Darin Adler  <darin@apple.com>
867
868         Specify fixed precision explicitly to prepare to change String::number and StringBuilder::appendNumber floating point behavior
869         https://bugs.webkit.org/show_bug.cgi?id=195533
870
871         Reviewed by Brent Fulgham.
872
873         * accessibility/AccessibilityNodeObject.cpp:
874         (WebCore::AccessibilityNodeObject::changeValueByStep): Use numberToStringFixedPrecision.
875         (WebCore::AccessibilityNodeObject::changeValueByPercent): Ditto.
876         * accessibility/AccessibilityScrollbar.cpp:
877         (WebCore::AccessibilityScrollbar::setValue): Ditto.
878         * css/CSSFontVariationValue.cpp:
879         (WebCore::CSSFontVariationValue::customCSSText const): Use appendFixedPrecisionNumber.
880         * css/CSSGradientValue.cpp:
881         (WebCore::CSSLinearGradientValue::customCSSText const): Ditto.
882         (WebCore::CSSRadialGradientValue::customCSSText const): Ditto.
883         * css/CSSKeyframeRule.cpp:
884         (WebCore::StyleRuleKeyframe::keyText const): Ditto.
885         * css/CSSTimingFunctionValue.cpp:
886         (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText const): Ditto.
887         (WebCore::CSSSpringTimingFunctionValue::customCSSText const): Ditto.
888         * css/parser/CSSParserToken.cpp:
889         (WebCore::CSSParserToken::serialize const): Ditto.
890         * html/HTMLImageElement.cpp:
891         (WebCore::HTMLImageElement::completeURLsInAttributeValue const): Ditto.
892         * inspector/InspectorOverlay.cpp:
893         (WebCore::InspectorOverlay::drawRulers): Use numberToStringFixedPrecision.
894         * loader/ResourceLoadStatistics.cpp:
895         (WebCore::ResourceLoadStatistics::toString const): Use appendFixedPrecisionNumber.
896         * page/PrintContext.cpp:
897         (WebCore::PrintContext::pageProperty): Use numberToStringFixedPrecision.
898         * page/cocoa/ResourceUsageOverlayCocoa.mm:
899         (WebCore::gcTimerString): Use numberToStringFixedPrecision.
900         * platform/LayoutUnit.h:
901         (WTF::ValueToString<WebCore::LayoutUnit>::string): Ditto.
902         * platform/graphics/Color.cpp:
903         (WebCore::Color::cssText const): Use appendFixedPrecisionNumber.
904         * platform/graphics/ExtendedColor.cpp:
905         (WebCore::ExtendedColor::cssText const): Ditto.
906         * svg/SVGAngleValue.cpp:
907         (WebCore::SVGAngleValue::valueAsString const): Use numberToStringFixedPrecision.
908         * svg/SVGNumberListValues.cpp:
909         (WebCore::SVGNumberListValues::valueAsString const): Use appendFixedPrecisionNumber.
910         * svg/SVGPathStringBuilder.cpp:
911         (WebCore::appendNumber): Ditto.
912         (WebCore::appendPoint): Ditto.
913         * svg/SVGPointListValues.cpp:
914         (WebCore::SVGPointListValues::valueAsString const): Ditto.
915         * svg/SVGTransformValue.cpp:
916         (WebCore::SVGTransformValue::valueAsString const): Ditto.
917         * svg/properties/SVGPropertyTraits.h:
918         (WebCore::SVGPropertyTraits<float>::toString): Use numberToStringFixedPrecision.
919         (WebCore::SVGPropertyTraits<FloatPoint>::toString): Use appendFixedPrecisionNumber.
920         (WebCore::SVGPropertyTraits<FloatRect>::toString): Ditto.
921         * testing/Internals.cpp:
922         (WebCore::Internals::dumpMarkerRects): Use appendFixedPrecisionNumber.
923         (WebCore::Internals::getCurrentCursorInfo): Ditto.
924         * xml/XPathValue.cpp:
925         (WebCore::XPath::Value::toString const): Use numberToStringFixedPrecision.
926
927 2019-03-11  Philippe Normand  <pnormand@igalia.com>
928
929         Unreviewed, Non-GStreamer-GL build fix after r242701.
930
931         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
932         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
933
934 2019-03-11  Philippe Normand  <pnormand@igalia.com>
935
936         [GStreamer][v4l2] Synchronous video texture flushing support
937         https://bugs.webkit.org/show_bug.cgi?id=195453
938
939         Reviewed by Xabier Rodriguez-Calvar.
940
941         The v4l2 video decoder currently requires that downstream users of
942         the graphics resources complete any pending draw call and release
943         resources before returning from the DRAIN query.
944
945         To accomplish this the player monitors the pipeline and whenever a
946         v4l2 decoder is added, synchronous video texture flushing support
947         is enabled. Additionally and for all decoder configurations, a
948         flush is performed before disposing of the player.
949
950         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
951         (WebCore::MediaPlayerPrivateGStreamer::playbinDeepElementAddedCallback):
952         Monitor elements added to the decodebin bin.
953         (WebCore::MediaPlayerPrivateGStreamer::decodebinElementAdded): Set
954         a flag if a v4l2 decoder was added in decodebin.
955         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Connect
956         to the deep-element-added signal so as to monitor pipeline
957         topology updates.
958         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
959         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
960         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
961         Flush video texture before disposing of the player.
962         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
963         Synchronously flush if the pipeline contains a v4l2 decoder.
964         (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink): Monitor push events only.
965         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
966         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
967         (WebCore::TextureMapperPlatformLayerProxy::pushNextBuffer): New
968         boolean flag used mostly to trigger synchronous flush conditions.
969         (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
970         Optionally drop the current buffer in a synchronous manner. By
971         default the method keeps operating asynchronously.
972         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
973
974 2019-03-11  Antti Koivisto  <antti@apple.com>
975
976         Rename contentOffsetInCompostingLayer to contentOffsetInCompositingLayer
977         https://bugs.webkit.org/show_bug.cgi?id=195553
978
979         Reviewed by Simon Fraser.
980
981         Less composting, more compositing.
982
983         * rendering/RenderLayerBacking.cpp:
984         (WebCore::RenderLayerBacking::updateBackdropFiltersGeometry):
985         (WebCore::RenderLayerBacking::resetContentsRect):
986         (WebCore::RenderLayerBacking::updateChildClippingStrategy):
987         (WebCore::RenderLayerBacking::updateImageContents):
988         (WebCore::RenderLayerBacking::contentOffsetInCompositingLayer const):
989         (WebCore::RenderLayerBacking::contentsBox const):
990         (WebCore::RenderLayerBacking::backgroundBoxForSimpleContainerPainting const):
991         (WebCore::RenderLayerBacking::contentOffsetInCompostingLayer const): Deleted.
992         * rendering/RenderLayerBacking.h:
993
994 2019-03-10  Ross Kirsling  <ross.kirsling@sony.com>
995
996         Invalid flags in a RegExp literal should be an early SyntaxError
997         https://bugs.webkit.org/show_bug.cgi?id=195514
998
999         Reviewed by Darin Adler.
1000
1001         * bindings/js/SerializedScriptValue.cpp:
1002         (WebCore::CloneDeserializer::readTerminal):
1003         Consume YarrFlags.
1004
1005 2019-03-10  Tim Horton  <timothy_horton@apple.com>
1006
1007         Add SPI to retrieve the set of text inputs in a given rect, and later focus one
1008         https://bugs.webkit.org/show_bug.cgi?id=195499
1009
1010         Reviewed by Darin Adler.
1011
1012         New API tests: WebKit.RequestTextInputContext and WebKit.FocusTextInputContext
1013
1014         * WebCore.xcodeproj/project.pbxproj:
1015         * dom/Document.cpp:
1016         (WebCore::Document::identifierForElement):
1017         (WebCore::Document::elementWithIdentifier):
1018         (WebCore::Document::identifiedElementWasRemovedFromDocument):
1019         * dom/Document.h:
1020         Add a mechanism where Document will vend an ObjectIdentifier for a given
1021         element, and can (if possible) retrieve that element later.
1022
1023         * dom/Element.cpp:
1024         (WebCore::Element::removedFromAncestor):
1025         If an Element has an identifier created for it, inform Document to remove
1026         it from the identifier map when the element is detached.
1027
1028         (WebCore::Element::createElementIdentifier):
1029         * dom/Element.h:
1030         * dom/ElementIdentifier.h: Added.
1031         * dom/ElementRareData.cpp:
1032         * dom/ElementRareData.h:
1033         (WebCore::ElementRareData::hasElementIdentifier const):
1034         (WebCore::ElementRareData::setHasElementIdentifier):
1035         (WebCore::ElementRareData::ElementRareData):
1036         Store a bit indicating if the Element has had a identifier created for it,
1037         so that we can avoid a hash lookup on every Element removal.
1038
1039         * dom/Node.h:
1040         * html/HTMLTextFormControlElement.h:
1041
1042 2019-03-10  Zalan Bujtas  <zalan@apple.com>
1043
1044         [ContentChangeObserver] Fix failing test cases
1045         https://bugs.webkit.org/show_bug.cgi?id=195524
1046         <rdar://problem/48745101>
1047
1048         Reviewed by Simon Fraser.
1049
1050         1. Do not start DOM timer install observation when we already detected change at touchstart.
1051         2. hasPendingActivity() should only care about ContentChangeObserver flags.
1052         3. Do not try to notify the client when we are in the mouseMoved dispatch call (currently it could happen
1053         when a timer gets intalled and removed right away).
1054
1055         * page/ios/ContentChangeObserver.cpp:
1056         (WebCore::ContentChangeObserver::adjustObservedState):
1057         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const): Deleted.
1058         * page/ios/ContentChangeObserver.h:
1059         (WebCore::ContentChangeObserver::hasPendingActivity const):
1060         (WebCore::ContentChangeObserver::isObservationTimeWindowActive const):
1061
1062 2019-03-10  Simon Fraser  <simon.fraser@apple.com>
1063
1064         ScrollingTree should have the final say on where layers go
1065         https://bugs.webkit.org/show_bug.cgi?id=195507
1066
1067         Reviewed by Antti Koivisto.
1068
1069         Main thread layer flushing can race with scrolling tree layer changes on macOS, causing
1070         flashing as layers jump around sometimes. We go to some lengths to avoid this by trying
1071         not to touch properties on layers that are being interacted with (scrollableArea->setIsUserScroll in
1072         updateScrollPositionAfterAsyncScroll()), but that's fragile.
1073
1074         This patch adds ScrollingTree::applyScrollingTreeLayerPositions(), which enters
1075         ScrollingTree::applyLayerPositions() on the main thread/UI process. This traverses
1076         the tree allowing each node to run their layer positioning logic.
1077
1078         For macOS WK2, this is called from TiledCoreAnimationDrawingArea::flushLayers() after flushCompositingStateIncludingSubframes().
1079         For macOS WK2 with UI-side compositing, RemoteLayerTreeDrawingAreaProxy::commitLayerTree()
1080         calls m_webPageProxy.scrollingCoordinatorProxy()->applyScrollingTreeLayerPositions().
1081         iOS WK2 is unchanged, using viewportChangedViaDelegatedScrolling() which does the same thing, allowing
1082         for the dynamic viewport changes that happen when zooming on iOS.
1083
1084         Testing this requires infrastructure that we don't have yet.
1085
1086         * page/scrolling/AsyncScrollingCoordinator.cpp:
1087         (WebCore::AsyncScrollingCoordinator::applyScrollingTreeLayerPositions):
1088         * page/scrolling/AsyncScrollingCoordinator.h:
1089         * page/scrolling/ScrollingCoordinator.h:
1090         (WebCore::ScrollingCoordinator::applyScrollingTreeLayerPositions):
1091         * page/scrolling/ScrollingTree.cpp:
1092         (WebCore::ScrollingTree::handleWheelEvent):
1093         (WebCore::ScrollingTree::commitTreeState):
1094         (WebCore::ScrollingTree::applyLayerPositions):
1095         (WebCore::ScrollingTree::applyLayerPositionsRecursive):
1096         * page/scrolling/ScrollingTree.h:
1097         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
1098         (WebCore::ScrollingTreeFrameHostingNode::applyLayerPositions):
1099         * page/scrolling/ScrollingTreeFrameHostingNode.h:
1100         * page/scrolling/ScrollingTreeNode.h:
1101         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1102         (WebCore::ScrollingTreeScrollingNode::applyLayerPositions):
1103         * page/scrolling/ScrollingTreeScrollingNode.h:
1104         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
1105         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
1106         (WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
1107         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
1108         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
1109         (WebCore::ScrollingTreeStickyNode::applyLayerPositions):
1110         (WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
1111         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1112         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1113         (WebCore::ScrollingTreeFrameScrollingNodeMac::applyLayerPositions):
1114
1115 2019-03-09  Andy Estes  <aestes@apple.com>
1116
1117         [Apple Pay] CanMakePaymentsWithActiveCard and OpenPaymentSetup should be async messages
1118         https://bugs.webkit.org/show_bug.cgi?id=195526
1119         <rdar://problem/48745636>
1120
1121         Reviewed by Chris Dumez.
1122
1123         * Modules/applepay/PaymentCoordinatorClient.h:
1124         * loader/EmptyClients.cpp:
1125         * testing/MockPaymentCoordinator.cpp:
1126         (WebCore::MockPaymentCoordinator::canMakePaymentsWithActiveCard):
1127         (WebCore::MockPaymentCoordinator::openPaymentSetup):
1128         * testing/MockPaymentCoordinator.h:
1129
1130 2019-03-09  Zalan Bujtas  <zalan@apple.com>
1131
1132         [ContentChangeObserver] Click event fires immediately on hover menu at seriouseats.com
1133         https://bugs.webkit.org/show_bug.cgi?id=195520
1134         <rdar://problem/48740098>
1135
1136         Reviewed by Simon Fraser.
1137
1138         Unfortunately seriouseats has a 300ms hover intent delay to deal with accidental menupane pop-ups. This page also hides this
1139         non-fixed width menupane using absolute positioning and negative left.  
1140
1141         Test: fast/events/touch/ios/content-observation/move-content-from-offscreen.html
1142
1143         * page/ios/ContentChangeObserver.cpp:
1144         (WebCore::ContentChangeObserver::didInstallDOMTimer):
1145         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
1146         (WebCore::ContentChangeObserver::StyleChangeScope::isConsideredHidden const): Content auhtors tend to use x - 1 values (where x = 10^y)
1147
1148 2019-03-09  Chris Dumez  <cdumez@apple.com>
1149
1150         Add assertions to help debug crash under DOMWindowExtension::suspendForPageCache()
1151         https://bugs.webkit.org/show_bug.cgi?id=195488
1152
1153         Reviewed by Ryosuke Niwa.
1154
1155         Try and figure out how the document can be detached from its frame while we're suspending
1156         DOMWindowExtensions.
1157
1158         * page/DOMWindow.cpp:
1159         (WebCore::DOMWindow::willDetachDocumentFromFrame):
1160         (WebCore::DOMWindow::suspendForPageCache):
1161         * page/DOMWindow.h:
1162
1163 2019-03-09  Chris Dumez  <cdumez@apple.com>
1164
1165         Simplify DOMWindowProperty code / handling
1166         https://bugs.webkit.org/show_bug.cgi?id=195495
1167
1168         Reviewed by Ryosuke Niwa.
1169
1170         DOMWindowProperty code was unnecessarily complex because DOMWindowExtension inherited
1171         from it and DOMWindowExtension needs a lot of information about the global object's
1172         lifetime to communicate to the injected bbundle client. This subclassing is also
1173         very confusing because a DOMWindowExtension is not a *property* on the Window object.
1174
1175         This patch updates DOMWindowExtension to stop subclassing DOMWindowProperty and
1176         moves all the complexity from DOMWindowProperty to DOMWindowExtension.
1177         DOMWindowProperty is now a very simple base class which merely has a WeakPtr to
1178         the window and getters for the window and the frame.
1179
1180         * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
1181         (WebCore::DOMWindowIndexedDatabase::DOMWindowIndexedDatabase):
1182         (WebCore::DOMWindowIndexedDatabase::indexedDB):
1183         * Modules/indexeddb/DOMWindowIndexedDatabase.h:
1184         There is no reason for DOMWindowIndexedDatabase to move its IDBFactory to a
1185         separate data member which in PageCache. Script do not run while in PageCache.
1186         Also, frames are nulled out while in the PageCache so the indexedDB() getter
1187         would return null anyway while in PageCache.
1188
1189         * css/StyleMedia.idl:
1190         * loader/appcache/ApplicationCacheHost.cpp:
1191         (WebCore::ApplicationCacheHost::setDOMApplicationCache):
1192         Store a WeakPtr to the DOMApplicationCache for safety.
1193
1194         (WebCore::ApplicationCacheHost::dispatchDOMEvent):
1195         Do not fire events on the DOMApplicationCache if it is frameless to maintain
1196         previous behavior. Previously, the DOMApplicationCache would have been nulled
1197         out when detached from its frame so we would not have fired events.
1198
1199         * loader/appcache/ApplicationCacheHost.h:
1200         * loader/appcache/DOMApplicationCache.cpp:
1201         * loader/appcache/DOMApplicationCache.h:
1202         Remove some unnecessary complexity. The ApplicationCacheHost is owned by the
1203         DocumentLoader, which changes on navigation. There is therefore no reason to
1204         null out the DOMApplicationCache on the ApplicationCacheHost when its gets
1205         detached from its frame or enters PageCache.
1206
1207         * page/BarProp.idl:
1208         * page/DOMSelection.idl:
1209         * page/DOMWindow.cpp:
1210         (WebCore::DOMWindow::willDestroyCachedFrame):
1211         (WebCore::DOMWindow::willDestroyDocumentInFrame):
1212         (WebCore::DOMWindow::willDetachDocumentFromFrame):
1213         (WebCore::DOMWindow::registerExtension):
1214         (WebCore::DOMWindow::unregisterExtension):
1215
1216         (WebCore::DOMWindow::resetDOMWindowProperties): Removed.
1217         Stop clearing some of the DOMWindow's properties when the document gets destroyed or when
1218         the Window for the initial empty document gets reused on navigation. I think we used to
1219         need this because DOMWindowProperty used to hold pointers to their frame. However, this
1220         is no longer the case nowadays as DOMWindowProperty objects get their frame from their
1221         Window.
1222
1223         (WebCore::DOMWindow::resetUnlessSuspendedForDocumentSuspension):
1224         (WebCore::DOMWindow::suspendForPageCache):
1225         (WebCore::DOMWindow::resumeFromPageCache):
1226         * page/DOMWindow.h:
1227         * page/DOMWindowExtension.cpp:
1228         (WebCore::DOMWindowExtension::DOMWindowExtension):
1229         (WebCore::DOMWindowExtension::~DOMWindowExtension):
1230         (WebCore::DOMWindowExtension::frame const):
1231         (WebCore::DOMWindowExtension::suspendForPageCache):
1232         (WebCore::DOMWindowExtension::resumeFromPageCache):
1233         (WebCore::DOMWindowExtension::willDestroyGlobalObjectInCachedFrame):
1234         (WebCore::DOMWindowExtension::willDestroyGlobalObjectInFrame):
1235         (WebCore::DOMWindowExtension::willDetachGlobalObjectFromFrame):
1236         * page/DOMWindowExtension.h:
1237         * page/DOMWindowProperty.cpp:
1238         (WebCore::DOMWindowProperty::DOMWindowProperty):
1239         * page/DOMWindowProperty.h:
1240         (WebCore::DOMWindowProperty::window const):
1241         * page/History.idl:
1242         * page/Location.idl:
1243         * page/Navigator.cpp:
1244         (WebCore::Navigator::plugins):
1245         (WebCore::Navigator::mimeTypes):
1246         * page/PerformanceNavigation.idl:
1247         * page/PerformanceTiming.idl:
1248         * page/Screen.idl:
1249         * page/VisualViewport.cpp:
1250         (WebCore::VisualViewport::scriptExecutionContext const):
1251         * plugins/DOMMimeTypeArray.idl:
1252         * plugins/DOMPluginArray.idl:
1253
1254 2019-03-09  Zalan Bujtas  <zalan@apple.com>
1255
1256         [ContentChangeObserver] Start observing for content change between touchEnd and mouseMoved start
1257         https://bugs.webkit.org/show_bug.cgi?id=195510
1258         <rdar://problem/48735695>
1259
1260         Reviewed by Simon Fraser.
1261
1262         This patch covers the observation of async changes triggered by touchStart/touchEnd (animations, timers, style recalcs).
1263
1264         Test: fast/events/touch/ios/content-observation/visibility-change-after-touch-end.html
1265
1266         * page/ios/ContentChangeObserver.cpp:
1267         (WebCore::ContentChangeObserver::didCancelTouchEvent):
1268         (WebCore::ContentChangeObserver::adjustObservedState):
1269         * page/ios/ContentChangeObserver.h:
1270         (WebCore::ContentChangeObserver::setIsInBetweenTouchEndAndMouseMoved):
1271         (WebCore::ContentChangeObserver::isInBetweenTouchEndAndMouseMoved const):
1272         (WebCore::ContentChangeObserver::isObservingContentChanges const):
1273
1274 2019-03-08  Simon Fraser  <simon.fraser@apple.com>
1275
1276         Make it clearer which data is protected by the two locks in ScrollingTree
1277         https://bugs.webkit.org/show_bug.cgi?id=195501
1278
1279         Reviewed by Tim Horton.
1280
1281         Gather ScrollingTree member variables into two structs, and name the struct
1282         members and the locks to make it clear which data is protected by each lock.
1283         
1284         We only need to protect data read by multiple threads; these are the scrolling
1285         thread, the event handling thread (which runs ThreadedScrollingTree::tryToHandleWheelEvent()),
1286         and the main thread, which pokes various bits of pin/rubber-banding state.
1287         Ideally the main thread would always push data to the scrolling thread via a commit,
1288         but that's not what happens now.
1289
1290         Suspiciously, ScrollingTree::shouldHandleWheelEventSynchronously() uses the root node,
1291         so should probably hold a lock shared with the scrolling thread (webkit.org/b/195502).
1292         
1293         * page/scrolling/ScrollingTree.cpp:
1294         (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously):
1295         (WebCore::ScrollingTree::commitTreeState):
1296         (WebCore::ScrollingTree::setAsyncFrameOrOverflowScrollingEnabled):
1297         (WebCore::ScrollingTree::setMainFrameScrollPosition):
1298         (WebCore::ScrollingTree::eventTrackingTypeForPoint):
1299         (WebCore::ScrollingTree::isRubberBandInProgress):
1300         (WebCore::ScrollingTree::setMainFrameIsRubberBanding):
1301         (WebCore::ScrollingTree::isScrollSnapInProgress):
1302         (WebCore::ScrollingTree::setMainFrameIsScrollSnapping):
1303         (WebCore::ScrollingTree::setMainFramePinState):
1304         (WebCore::ScrollingTree::setCanRubberBandState):
1305         (WebCore::ScrollingTree::setScrollPinningBehavior):
1306         (WebCore::ScrollingTree::scrollPinningBehavior):
1307         (WebCore::ScrollingTree::willWheelEventStartSwipeGesture):
1308         (WebCore::ScrollingTree::latchedNode):
1309         (WebCore::ScrollingTree::setLatchedNode):
1310         (WebCore::ScrollingTree::clearLatchedNode):
1311         (WebCore::ScrollingTree::scrollingTreeAsText):
1312         (WebCore::ScrollingTree::touchActionDataAtPoint const):
1313         (WebCore::ScrollingTree::mainFrameScrollPosition): Deleted.
1314         (WebCore::ScrollingTree::mainFrameLayoutViewport): Deleted.
1315         (WebCore::ScrollingTree::rubberBandsAtLeft): Deleted.
1316         (WebCore::ScrollingTree::rubberBandsAtRight): Deleted.
1317         (WebCore::ScrollingTree::rubberBandsAtBottom): Deleted.
1318         (WebCore::ScrollingTree::rubberBandsAtTop): Deleted.
1319         * page/scrolling/ScrollingTree.h:
1320         (WebCore::ScrollingTree::hasLatchedNode const):
1321         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
1322         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount):
1323         * platform/graphics/FloatPoint.h:
1324         (WebCore::FloatPoint::isZero const):
1325
1326 2019-03-08  Simon Fraser  <simon.fraser@apple.com>
1327
1328         Share some code that sets CALayer positions
1329         https://bugs.webkit.org/show_bug.cgi?id=195485
1330
1331         Reviewed by Zalan Bujtas.
1332
1333         Share some code between ScrollingTreeStickyNode and ScrollingTreeFixedNode that sets the position
1334         of a CALayer given the top-left location.
1335
1336         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
1337         (WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
1338         (WebCore::ScrollingTreeFixedNodeInternal::operator*): Deleted.
1339         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
1340         (WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
1341         (WebCore::ScrollingTreeStickyNodeInternal::operator*): Deleted.
1342         * platform/graphics/cocoa/WebCoreCALayerExtras.h:
1343         * platform/graphics/cocoa/WebCoreCALayerExtras.mm:
1344         (-[CALayer _web_setLayerTopLeftPosition:]):
1345
1346 2019-03-08  Chris Dumez  <cdumez@apple.com>
1347
1348         Add support for Device Orientation / Motion permission API
1349         https://bugs.webkit.org/show_bug.cgi?id=195329
1350         <rdar://problem/47645367>
1351
1352         Reviewed by Geoffrey Garen.
1353
1354         Add support for Device Orientation / Motion permission API:
1355         - https://github.com/w3c/deviceorientation/issues/57
1356
1357         Pages can add event listeners for 'deviceorientation' / 'devicemotion' events but
1358         such events will not be fired until the page's JavaScript calls
1359         DeviceOrientationEvent.requestPermission() / DeviceMotionEvent.requestPermission()
1360         and the user grants the request.
1361
1362         The feature is currently behind an experimental feature flag, off by default.
1363
1364         Tests: fast/device-orientation/device-motion-request-permission-denied.html
1365                fast/device-orientation/device-motion-request-permission-granted.html
1366                fast/device-orientation/device-motion-request-permission-user-gesture.html
1367                fast/device-orientation/device-orientation-request-permission-denied.html
1368                fast/device-orientation/device-orientation-request-permission-granted.html
1369                fast/device-orientation/device-orientation-request-permission-user-gesture.html
1370
1371         * CMakeLists.txt:
1372         * DerivedSources-input.xcfilelist:
1373         * DerivedSources-output.xcfilelist:
1374         * DerivedSources.make:
1375         * Sources.txt:
1376         * WebCore.xcodeproj/project.pbxproj:
1377         * dom/DeviceMotionEvent.h:
1378         * dom/DeviceMotionEvent.idl:
1379         * dom/DeviceOrientationAndMotionAccessController.cpp: Added.
1380         (WebCore::DeviceOrientationAndMotionAccessController::DeviceOrientationAndMotionAccessController):
1381         (WebCore::DeviceOrientationAndMotionAccessController::shouldAllowAccess):
1382         (WebCore::DeviceOrientationAndMotionAccessController::setAccessState):
1383         * dom/DeviceOrientationAndMotionAccessController.h: Added.
1384         (WebCore::DeviceOrientationAndMotionAccessController::accessState const):
1385         * dom/DeviceOrientationEvent.h:
1386         * dom/DeviceOrientationEvent.idl:
1387         * dom/DeviceOrientationOrMotionEvent.cpp: Added.
1388         (WebCore::DeviceOrientationOrMotionEvent::requestPermission):
1389         * dom/DeviceOrientationOrMotionEvent.h: Added.
1390         * dom/DeviceOrientationOrMotionEvent.idl: Added.
1391         * dom/DeviceOrientationOrMotionPermissionState.h: Added.
1392         * dom/DeviceOrientationOrMotionPermissionState.idl: Added.
1393         * dom/Document.cpp:
1394         (WebCore::Document::deviceOrientationAndMotionAccessController):
1395         * dom/Document.h:
1396         * dom/Event.cpp:
1397         * dom/MessagePort.cpp:
1398         * dom/Microtasks.cpp:
1399         * page/ChromeClient.h:
1400         * page/DOMWindow.cpp:
1401         (WebCore::DOMWindow::addEventListener):
1402         (WebCore::DOMWindow::deviceOrientationController const):
1403         (WebCore::DOMWindow::deviceMotionController const):
1404         (WebCore::DOMWindow::isAllowedToUseDeviceMotionOrientation const):
1405         (WebCore::DOMWindow::isAllowedToAddDeviceMotionOrientationListener const):
1406         (WebCore::DOMWindow::startListeningForDeviceOrientationIfNecessary):
1407         (WebCore::DOMWindow::stopListeningForDeviceOrientationIfNecessary):
1408         (WebCore::DOMWindow::startListeningForDeviceMotionIfNecessary):
1409         (WebCore::DOMWindow::stopListeningForDeviceMotionIfNecessary):
1410         (WebCore::DOMWindow::removeEventListener):
1411         (WebCore::DOMWindow::removeAllEventListeners):
1412         * page/DOMWindow.h:
1413         * page/DeviceController.cpp:
1414         (WebCore::DeviceController::hasDeviceEventListener const):
1415         * page/DeviceController.h:
1416         * page/Settings.yaml:
1417
1418 2019-03-08  Zalan Bujtas  <zalan@apple.com>
1419
1420         [ContentChangeObserver] Expand "isConsideredClickable" to descendants
1421         https://bugs.webkit.org/show_bug.cgi?id=195478
1422         <rdar://problem/48724935>
1423
1424         Reviewed by Simon Fraser.
1425
1426         In StyleChangeScope we try to figure out whether newly visible content should stick (menu panes etc) by checking if it is clickable.
1427         This works fine as long as all the visible elements are gaining new renderers through this style update processs.
1428         However when an element becomes visible by a change other than display: (not)none, it's not sufficient to just check the element itself,
1429         since it might not respond to click at all, while its descendants do.
1430         A concrete example is a max-height value change on usps.com, where the max-height is on a container (menu pane).
1431         This container itself is not clickable while most of its children are (menu items).    
1432
1433         Test: fast/events/touch/ios/content-observation/clickable-content-is-inside-a-container.html
1434
1435         * page/ios/ContentChangeObserver.cpp:
1436         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
1437         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
1438         (WebCore::ContentChangeObserver::StyleChangeScope::isConsideredHidden const):
1439         (WebCore::ContentChangeObserver::StyleChangeScope::isConsideredClickable const):
1440         (WebCore::isConsideredHidden): Deleted.
1441         * page/ios/ContentChangeObserver.h:
1442
1443 2019-03-08  Zalan Bujtas  <zalan@apple.com>
1444
1445         [ContentChangeObserver] Cleanup adjustObservedState
1446         https://bugs.webkit.org/show_bug.cgi?id=195470
1447         <rdar://problem/48717823>
1448
1449         Reviewed by Simon Fraser.
1450
1451         This is in preparation for introducing an observation window from touchStart -> mouseMoved.
1452         1. Cancel pending activities (future timers, pending stylesheet recalcs) when visible content change is detected.
1453         2. The fixed time window takes care of notifying the client -timers, style recalcs during the window should not signal themselves.  
1454         3. Reset m_isObservingPendingStyleRecalc at StartedStyleRecalc instead of EndedStyleRecalc. 
1455
1456         * page/ios/ContentChangeObserver.cpp:
1457         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
1458         (WebCore::ContentChangeObserver::styleRecalcDidStart):
1459         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
1460         (WebCore::ContentChangeObserver::adjustObservedState):
1461         * page/ios/ContentChangeObserver.h:
1462         (WebCore::ContentChangeObserver::hasPendingActivity const):
1463         (WebCore::ContentChangeObserver::isObservationTimeWindowActive const):
1464
1465 2019-03-08  Zalan Bujtas  <zalan@apple.com>
1466
1467         [ContentChangeObserver] Add StartedDOMTimerExecution and StartedStyleRecalc
1468         https://bugs.webkit.org/show_bug.cgi?id=195463
1469         <rdar://problem/48714762>
1470
1471         Reviewed by Simon Fraser.
1472
1473         This is in preparation for introducing m_isObservingContentChanges flag to track observing state across events (touchStart -> mouseMoved).
1474
1475         * page/ios/ContentChangeObserver.cpp:
1476         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
1477         (WebCore::ContentChangeObserver::styleRecalcDidStart):
1478         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
1479         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
1480         (WebCore::ContentChangeObserver::adjustObservedState):
1481         * page/ios/ContentChangeObserver.h:
1482         (WebCore::ContentChangeObserver::isObservingPendingStyleRecalc const):
1483         (WebCore::ContentChangeObserver::isObservingStyleRecalc const): Deleted.
1484
1485 2019-03-08  Chris Fleizach  <cfleizach@apple.com>
1486
1487         AX: AOM accessibleclick does not work on iOS
1488         https://bugs.webkit.org/show_bug.cgi?id=195423
1489         <rdar://problem/48682110>
1490
1491         Reviewed by Joanmarie Diggs.
1492
1493         Return this value of this method so it can be surfaced to a higher level.
1494
1495         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1496         (-[WebAccessibilityObjectWrapper _accessibilityActivate]):
1497
1498 2019-03-08  Chris Dumez  <cdumez@apple.com>
1499
1500         imported/w3c/web-platform-tests/FileAPI/reading-data-section/filereader_error.html is a flaky crash
1501         https://bugs.webkit.org/show_bug.cgi?id=195441
1502         <rdar://problem/43437394>
1503
1504         Reviewed by Alexey Proskuryakov.
1505
1506         FileReader is an ActiveDOMObject, which means that FileReader::stop() gets called when
1507         its script execution context is about to get destroyed. FileReader::stop() sets m_state
1508         to DONE. FileReader::abort() would schedule an asynchronous task and then ASSERT that
1509         m_state is not DONE, which would hit if FileReader::stop() had been called in between
1510         the task being scheduled and its execution. To address the issue, have the task abort
1511         early if isContextStopped() returns true.
1512
1513         Also replace calls to setPendingActivity() / unsetPendingActivity() with a
1514         PendingActivity data member as mismatched call to those can lead to leaks.
1515
1516         * fileapi/FileReader.cpp:
1517         (WebCore::FileReader::canSuspendForDocumentSuspension const):
1518         No reason not to suspend if there is no pending read.
1519
1520         (WebCore::FileReader::stop):
1521         (WebCore::FileReader::readInternal):
1522         (WebCore::FileReader::abort):
1523         (WebCore::FileReader::didFinishLoading):
1524         (WebCore::FileReader::didFail):
1525         * fileapi/FileReader.h:
1526
1527 2019-03-08  Zan Dobersek  <zdobersek@igalia.com>
1528
1529         GLContextEGL: desired EGL config should search for 8-bit components by default
1530         https://bugs.webkit.org/show_bug.cgi?id=195413
1531
1532         Reviewed by Carlos Garcia Campos.
1533
1534         The EGL config search in GLContextEGL should by default look for
1535         RGBA8888 configurations while allowing RGB565 as an alternative.
1536         This prevents from accidentally landing on an RGBA1010102
1537         configuration that is available with some graphics stacks, and which is
1538         not expected in e.g. window snapshotting that's done for layout test
1539         output comparison.
1540
1541         * platform/graphics/egl/GLContextEGL.cpp:
1542         (WebCore::GLContextEGL::getEGLConfig): EGL config search should by
1543         default request 8-bit color channels.
1544
1545 2019-03-08  Miguel Gomez  <magomez@igalia.com>
1546
1547         Use a thread safe refcounter for FilterOperation.
1548         https://bugs.webkit.org/show_bug.cgi?id=194149
1549
1550         Reviewed by Carlos Garcia Campos.
1551
1552         Use a thread safe refcounter for FilterOperation.
1553
1554         * platform/graphics/filters/FilterOperation.h:
1555
1556 2019-03-07  Yusuke Suzuki  <ysuzuki@apple.com>
1557
1558         [JSC] Make more fields lazy in JSGlobalObject
1559         https://bugs.webkit.org/show_bug.cgi?id=195449
1560
1561         Reviewed by Mark Lam.
1562
1563         Use arrayBufferConstructor() since getDirect does not work with lazy property.
1564
1565         * bindings/js/JSDOMGlobalObject.cpp:
1566         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
1567
1568 2019-03-07  Zalan Bujtas  <zalan@apple.com>
1569
1570         [ContentChangeObserver][REGRESSION] Check if visibility change happens while dispatching mouseMoved
1571         https://bugs.webkit.org/show_bug.cgi?id=195421
1572         <rdar://problem/48682004>
1573
1574         Reviewed by Simon Fraser.
1575
1576         Visibility change might be triggered synchronously while dispatching mouseMoved event.
1577
1578         Test: fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html
1579
1580         * page/ios/ContentChangeObserver.cpp:
1581         (WebCore::ContentChangeObserver::mouseMovedDidStart):
1582         (WebCore::ContentChangeObserver::mouseMovedDidFinish):
1583         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
1584         * page/ios/ContentChangeObserver.h:
1585         (WebCore::ContentChangeObserver::isObservingContentChanges const):
1586
1587 2019-03-07  Zalan Bujtas  <zalan@apple.com>
1588
1589         [ContentChangeObserver] Check if max-height change triggers visible content change.
1590         https://bugs.webkit.org/show_bug.cgi?id=195417
1591         <rdar://problem/48680631>
1592
1593         Reviewed by Simon Fraser.
1594
1595         A fixed max-height non-zero value could indicate visible content change. usps.com uses this technique to show menu panes.  
1596
1597         Test: fast/events/touch/ios/content-observation/visibility-change-is-max-height-change.html
1598
1599         * page/ios/ContentChangeObserver.cpp:
1600         (WebCore::isConsideredHidden):
1601         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
1602         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
1603         (WebCore::elementImplicitVisibility): Deleted.
1604         * page/ios/ContentChangeObserver.h:
1605
1606 2019-03-07  Yusuke Suzuki  <ysuzuki@apple.com>
1607
1608         Unreviewed, fix failing EWS build for ios-sim
1609
1610         * page/ios/ContentChangeObserver.cpp:
1611         (WebCore::ContentChangeObserver::touchEventDidStart):
1612
1613 2019-03-07  Eric Carlson  <eric.carlson@apple.com>
1614
1615         [MSE] Adopt new AVSampleBufferDisplayLayer SPI
1616         https://bugs.webkit.org/show_bug.cgi?id=195445
1617         <rdar://problem/48480516>
1618
1619         Reviewed by Jer Noble.
1620
1621         No new tests, no functional change.
1622
1623         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1624         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC): Only register for 
1625         kCMSampleBufferConsumerNotification_BufferConsumed notiication when
1626         -[AVSampleBufferDisplayLayer prerollDecodeWithCompletionHandler:] isn't available.
1627         (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC): Ditto, for unregistering.
1628         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Use 
1629         -[AVSampleBufferDisplayLayer prerollDecodeWithCompletionHandler:] when possible.
1630
1631 2019-03-07  Zalan Bujtas  <zalan@apple.com>
1632
1633         [ContentChangeObserver] Click event fires immediately on hover menu at Ebbets.com
1634         https://bugs.webkit.org/show_bug.cgi?id=195397
1635
1636         Reviewed by Simon Fraser.
1637
1638         This patch introduces TouchEventScope to track changes triggered by touch start.
1639
1640         Test: fast/events/touch/ios/content-observation/visibility-change-on-touch-start-simple.html
1641
1642         * page/ios/ContentChangeObserver.cpp:
1643         (WebCore::ContentChangeObserver::touchEventDidStart):
1644         (WebCore::ContentChangeObserver::touchEventDidFinish):
1645         (WebCore::ContentChangeObserver::mouseMovedDidStart):
1646         (WebCore::ContentChangeObserver::mouseMovedDidFinish):
1647         (WebCore::ContentChangeObserver::adjustObservedState):
1648         (WebCore::ContentChangeObserver::TouchEventScope::TouchEventScope):
1649         (WebCore::ContentChangeObserver::TouchEventScope::~TouchEventScope):
1650         * page/ios/ContentChangeObserver.h:
1651         (WebCore::ContentChangeObserver::isObservingContentChanges const):
1652
1653 2019-03-07  Zalan Bujtas  <zalan@apple.com>
1654
1655         [ContentChangeObserver] Introduce fixed duration content observation
1656         https://bugs.webkit.org/show_bug.cgi?id=195295
1657         <rdar://problem/48579913>
1658
1659         Reviewed by Simon Fraser.
1660
1661         Some pages have a runloop-like scheduling setup where the content triggering change happens at a nested timer firing.
1662         This patch helps finding cases like that using a 32ms long fixed window. Currently nested timers get dropped on the floor and
1663         we stop observing for content changes before they even get fired.
1664
1665         Test: fast/events/touch/ios/content-observation/visibility-change-happens-on-timer-hops.html
1666
1667         * page/ios/ContentChangeObserver.cpp:
1668         (WebCore::ContentChangeObserver::ContentChangeObserver):
1669         (WebCore::ContentChangeObserver::startContentObservationForDuration):
1670         (WebCore::ContentChangeObserver::completeDurationBasedContentObservation):
1671         (WebCore::ContentChangeObserver::didInstallDOMTimer):
1672         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
1673         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
1674         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
1675         (WebCore::ContentChangeObserver::styleRecalcDidStart):
1676         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
1677         (WebCore::ContentChangeObserver::cancelPendingActivities):
1678         (WebCore::ContentChangeObserver::didSuspendActiveDOMObjects):
1679         (WebCore::ContentChangeObserver::willDetachPage):
1680         (WebCore::ContentChangeObserver::contentVisibilityDidChange):
1681         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
1682         (WebCore::ContentChangeObserver::adjustObservedState):
1683         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
1684         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
1685         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange): Deleted.
1686         * page/ios/ContentChangeObserver.h:
1687         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
1688         (WebCore::ContentChangeObserver::isObservingContentChanges const):
1689         (WebCore::ContentChangeObserver::hasPendingActivity const):
1690
1691 2019-03-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
1692
1693         requestAnimationFrame should execute before the next frame
1694         https://bugs.webkit.org/show_bug.cgi?id=177484
1695
1696         Reviewed by Simon Fraser.
1697
1698         This change fixes two issues with animation timing:
1699
1700         1. Calling the requestAnimationFrame callbacks would have happened when
1701            the DisplayLink fires. This may have happened even if the frame is
1702            missed and no display is committed.
1703
1704         2. Style changes and layout triggered by script could trigger painting
1705            at more than 60fps. CoreAnimation commits could happen at more than
1706            60fps, although WindowServer will throttle those, and only some will
1707            be shown on the screen.
1708
1709         This change introduces a new paint scheduling model where painting is
1710         driven by a "RenderingUpdateScheduler", which only triggers paints once
1711         per 16.7ms frame.
1712
1713         Code that previously scheduled a compositing layer flush now schedules a
1714         "RenderingUpdate", and that update is driven by a DisplayRefreshMonitor
1715         callback. When the render happens, we service requestAnimationFrame callbacks,
1716         Web Animations and intersection observations per the "Update the rendering"
1717         step of the HTML Event Loop specification
1718         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
1719
1720         In the future, more rendering steps will be added to this code.
1721
1722         * Sources.txt:
1723         * WebCore.xcodeproj/project.pbxproj:
1724         * accessibility/mac/AXObjectCacheMac.mm:
1725         Fix layout tests by adding null check.
1726
1727         * animation/DocumentAnimationScheduler.cpp: Removed.
1728         * animation/DocumentAnimationScheduler.h: Removed.
1729         * animation/DocumentTimeline.cpp:
1730         (WebCore::DocumentTimeline::DocumentTimeline):
1731         (WebCore::DocumentTimeline::updateThrottlingState):
1732         (WebCore::DocumentTimeline::resumeAnimations):
1733         (WebCore::DocumentTimeline::liveCurrentTime const):
1734         (WebCore::DocumentTimeline::currentTime):
1735         (WebCore::DocumentTimeline::animationTimingDidChange):
1736         (WebCore::DocumentTimeline::scheduleAnimationResolution):
1737         (WebCore::DocumentTimeline::unscheduleAnimationResolution):
1738         (WebCore::DocumentTimeline::updateAnimationsAndSendEvents):
1739         (WebCore::DocumentTimeline::internalUpdateAnimationsAndSendEvents):
1740         (WebCore::DocumentTimeline::scheduleNextTick):
1741         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement):
1742         Simplify this function by handling the case of no-animations separately.
1743
1744         (WebCore::DocumentTimeline::resolveAnimationsForElement):
1745         Simplify the loop and delete hasPendingAcceleratedAnimations because it
1746         is initialized to true and is not changed inside the loop.
1747
1748         (WebCore::DocumentTimeline::scheduleAnimationResolutionIfNeeded): Deleted.
1749         (WebCore::DocumentTimeline::animationResolutionTimerFired): Deleted.
1750         * animation/DocumentTimeline.h:
1751         * dom/Document.cpp:
1752         (WebCore::Document::resolveStyle):
1753         There is no need to force update in resolveStyle(). notifyFlushRequired()
1754         will be called eventually which will scheduleRenderingUpdate().
1755
1756         (WebCore::Document::prepareForDestruction):
1757         (WebCore::Document::updateAnimationsAndSendEvents):
1758         (WebCore::Document::serviceRequestAnimationFrameCallbacks):
1759         (WebCore::Document::windowScreenDidChange):
1760         (WebCore::Document::updateIntersectionObservations):
1761         (WebCore::Document::scheduleForcedIntersectionObservationUpdate): Deleted.
1762         (WebCore::Document::animationScheduler): Deleted.
1763         * dom/Document.h:
1764         (WebCore::Document::numberOfIntersectionObservers const):
1765         * dom/ScriptedAnimationController.cpp:
1766         (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks):
1767         (WebCore::ScriptedAnimationController::scheduleAnimation):
1768         (WebCore::ScriptedAnimationController::animationTimerFired):
1769         (WebCore::ScriptedAnimationController::serviceScriptedAnimations): Deleted.
1770         (WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire): Deleted.
1771         * dom/ScriptedAnimationController.h:
1772         * page/FrameView.cpp:
1773         (WebCore::FrameView::viewportContentsChanged):
1774         * page/IntersectionObserver.cpp:
1775         (WebCore::IntersectionObserver::observe):
1776         * page/Page.cpp:
1777         (WebCore::Page::Page):
1778         (WebCore::Page::layoutIfNeeded):
1779         (WebCore::Page::renderingUpdate):
1780         (WebCore::Page::renderingUpdateScheduler):
1781         (WebCore::Page::willDisplayPage): Deleted.
1782         (WebCore::Page::addDocumentNeedingIntersectionObservationUpdate): Deleted.
1783         (WebCore::Page::updateIntersectionObservations): Deleted.
1784         (WebCore::Page::scheduleForcedIntersectionObservationUpdate): Deleted.
1785         * page/Page.h:
1786         * page/PageOverlayController.cpp:
1787         (WebCore::PageOverlayController::didChangeViewExposedRect):
1788         (WebCore::PageOverlayController::notifyFlushRequired):
1789         * page/ResourceUsageData.h:
1790         Include header files that become missing because of adding 
1791         RenderingUpdateScheduler.cpp.
1792
1793         * page/RenderingUpdateScheduler.cpp: Added.
1794         (WebCore::RenderingUpdateScheduler::RenderingUpdateScheduler):
1795         (WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):
1796         (WebCore::RenderingUpdateScheduler::startTimer):
1797         (WebCore::RenderingUpdateScheduler::clearTimer):
1798         (WebCore::RenderingUpdateScheduler::windowScreenDidChange):
1799         (WebCore::RenderingUpdateScheduler::createDisplayRefreshMonitor const):
1800         (WebCore::RenderingUpdateScheduler::displayRefreshFired):
1801         * page/RenderingUpdateScheduler.h: Added.
1802         (WebCore::RenderingUpdateScheduler::create):
1803         * page/ios/ContentChangeObserver.h:
1804         Include header files that become missing because of adding 
1805         RenderingUpdateScheduler.cpp.
1806
1807         * page/mac/ServicesOverlayController.mm:
1808         (WebCore::ServicesOverlayController::Highlight::notifyFlushRequired):
1809         * rendering/RenderLayerCompositor.cpp:
1810         (WebCore::RenderLayerCompositor::scheduleLayerFlushNow):
1811
1812 2019-03-07  Zalan Bujtas  <zalan@apple.com>
1813
1814         [ContentChangeObserver] Add a setting to be able to turn content change observation on/off
1815         https://bugs.webkit.org/show_bug.cgi?id=195353
1816         <rdar://problem/48626394>
1817
1818         Reviewed by Simon Fraser.
1819
1820         Move content observation tests to a dedicated directory.
1821
1822         Tests: fast/events/touch/ios/content-observation/click-instead-of-hover-simple.html
1823                fast/events/touch/ios/content-observation/hover-when-style-change-is-async.html
1824                fast/events/touch/ios/content-observation/stuck-with-hover-state.html
1825                fast/events/touch/ios/content-observation/style-recalc-schedule-and-force-relalc.html
1826                fast/events/touch/ios/content-observation/visibility-change-happens-at-the-second-timer.html
1827
1828         * page/Settings.yaml:
1829         * page/ios/ContentChangeObserver.cpp:
1830         (WebCore::ContentChangeObserver::didInstallDOMTimer):
1831         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
1832         * page/ios/ContentChangeObserver.h:
1833         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const): Deleted.
1834         * testing/InternalSettings.cpp:
1835         (WebCore::InternalSettings::resetToConsistentState):
1836
1837 2019-03-07  John Wilander  <wilander@apple.com>
1838
1839         Make sure an empty host matches the internal representation "nullOrigin" in WebCore::RegistrableDomain::matches()
1840         https://bugs.webkit.org/show_bug.cgi?id=195435
1841
1842         Reviewed by Brent Fulgham.
1843
1844         No new tests. Tests are currently failing and will pass again with
1845         this patch.
1846
1847         WebCore::RegistrableDomain::matches() is a quick way to compare a
1848         RegistrableDomain with a URL. Since RegistrableDomain represents the
1849         empty host as "nullOrigin," a URL with an empty host needs to match
1850         that representation in WebCore::RegistrableDomain::matches().
1851         Failure to do so caused debug assertions in fast/ layout tests after
1852         https://trac.webkit.org/changeset/242603/webkit.
1853
1854         * platform/RegistrableDomain.h:
1855         (WebCore::RegistrableDomain::matches const):
1856
1857 2019-03-07  Justin Fan  <justin_fan@apple.com>
1858
1859         Unreviewed build fixes since MTLClampToBorderColor is only supported on macOS.
1860
1861         * Modules/webgpu/GPUSamplerDescriptor.idl:
1862         * platform/graphics/gpu/GPUSamplerDescriptor.h:
1863         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm: Forgot include.
1864         * platform/graphics/gpu/cocoa/GPUSamplerMetal.mm:
1865         (WebCore::mtlAddressModeForAddressMode):
1866         (WebCore::tryCreateMtlSamplerState):
1867         (WebCore::mtlBorderColorForBorderColor): Deleted.
1868
1869 2019-03-07  Justin Fan  <justin_fan@apple.com>
1870
1871         [Web GPU] GPUSampler implementation
1872         https://bugs.webkit.org/show_bug.cgi?id=195427
1873         <rdar://problem/48686011>
1874
1875         Reviewed by Dean Jackson.
1876
1877         Implement ability to create GPUSamplers and use them as pipeline resource bindings.
1878
1879         Test: texture-triangle-strip.html updated.
1880
1881         Add symbols to project:
1882         * CMakeLists.txt:
1883         * DerivedSources-input.xcfilelist:
1884         * DerivedSources-output.xcfilelist:
1885         * DerivedSources.make:
1886         * Sources.txt:
1887         * SourcesCocoa.txt:
1888         * WebCore.xcodeproj/project.pbxproj:
1889         * bindings/js/WebCoreBuiltinNames.h:
1890
1891         GPUSampler creation:
1892         * Modules/webgpu/GPUSamplerDescriptor.idl: Added.
1893         * Modules/webgpu/WebGPUDevice.cpp:
1894         (WebCore::WebGPUDevice::createSampler const): Added.
1895         * Modules/webgpu/WebGPUDevice.h:
1896         * Modules/webgpu/WebGPUDevice.idl:
1897         * Modules/webgpu/WebGPUSampler.cpp: Added.
1898         (WebCore::WebGPUSampler::create):
1899         (WebCore::WebGPUSampler::WebGPUSampler):
1900         * Modules/webgpu/WebGPUSampler.h: Added.
1901         (WebCore::WebGPUSampler::sampler const):
1902         * Modules/webgpu/WebGPUSampler.idl: Added.
1903         * platform/graphics/gpu/GPUDevice.cpp:
1904         (WebCore::GPUDevice::tryCreateSampler const): Added.
1905         * platform/graphics/gpu/GPUDevice.h:
1906         * platform/graphics/gpu/GPUSampler.h: Added.
1907         (WebCore::GPUSampler::platformSampler const):
1908         * platform/graphics/gpu/GPUSamplerDescriptor.h: Added.
1909         * platform/graphics/gpu/cocoa/GPUSamplerMetal.mm: Added.
1910         (WebCore::mtlAddressModeForAddressMode):
1911         (WebCore::mtlBorderColorForBorderColor):
1912         (WebCore::mtlMinMagFilterForFilterMode):
1913         (WebCore::mtlMipFilterForFilterMode):
1914         (WebCore::tryCreateMtlSamplerState):
1915         (WebCore::GPUSampler::tryCreate):
1916         (WebCore::GPUSampler::GPUSampler):
1917
1918         Move GPUCompareFunction to Utils for shared use.
1919         * platform/graphics/gpu/GPUCompareFunction.h:
1920         * platform/graphics/gpu/GPUUtils.h:
1921         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
1922         (WebCore::tryCreateMtlDepthStencilState):
1923         (WebCore::validateAndConvertDepthCompareFunctionToMtl): Deleted.
1924         * platform/graphics/gpu/cocoa/GPUUtilsMetal.mm:
1925         (WebCore::platformTextureFormatForGPUTextureFormat):
1926         (WebCore::platformCompareFunctionForGPUCompareFunction):
1927
1928         Expand bind groups to accept GPUSamplers:
1929         * Modules/webgpu/WebGPUBindGroupBinding.h:
1930         * Modules/webgpu/WebGPUBindGroupBinding.idl:
1931         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
1932         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const):
1933         * platform/graphics/gpu/GPUBindGroupBinding.h:
1934         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
1935         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
1936         (WebCore::GPUProgrammablePassEncoder::setBindGroup):
1937         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder):
1938         (WebCore::GPUProgrammablePassEncoder::setResourceAsSamplerOnEncoder): Added.
1939         (WebCore::GPUProgrammablePassEncoder::setResourceAsTextureOnEncoder):
1940
1941         Misc:
1942         * Modules/webgpu/WebGPUTexture.cpp: Missing includes.
1943         * Modules/webgpu/WebGPUTexture.h:
1944         * Modules/webgpu/WebGPUSwapChain.cpp: Removed extra include.
1945
1946 2019-03-07  Commit Queue  <commit-queue@webkit.org>
1947
1948         Unreviewed, rolling out r242297.
1949         https://bugs.webkit.org/show_bug.cgi?id=195430
1950
1951         Broke Microsoft Visio. (Requested by dydz on #webkit).
1952
1953         Reverted changeset:
1954
1955         "[iOS] Turn mouse event simulation on by default"
1956         https://bugs.webkit.org/show_bug.cgi?id=195218
1957         https://trac.webkit.org/changeset/242297
1958
1959 2019-03-07  Sihui Liu  <sihui_liu@apple.com>
1960
1961         Crash in com.apple.WebCore: WebCore::IDBTransaction::pendingOperationTimerFired + 72
1962         https://bugs.webkit.org/show_bug.cgi?id=195214
1963         <rdar://problem/48461116>
1964
1965         Reviewed by Geoffrey Garen.
1966
1967         When IDBTransaction is ready to commit, a commit operation would be schedule to 
1968         m_pendingTransactionOperationQueue. If connection to IDBServer is lost, pending operations are moved to 
1969         m_transactionOperationsInProgressQueue and will be completed with TransactionOperation::doComplete. doComplete 
1970         executes complete function of the operation, clears the complete function, and then removes the operation from 
1971         m_transactionOperationsInProgressQueue. In doComplete, we do early return when complete function is null, 
1972         since the doComplete could be invoked twice due to the race conditions between receiving "operation complete" 
1973         message from server and client-side abort.
1974
1975         However, commit operation does not have a complete function because it should be the last operation of 
1976         transaction and it gets removed from queue in its perform function. A commit operation would not be removed from 
1977         m_transactionOperationsInProgressQueue because of the early return. It would be removed from 
1978         m_transactionOperationMap, which may hold the last ref to the commit operation, in 
1979         IDBTransaction::connectionClosedFromServer. In this case, when pendingOperationTimerFired is called later, the 
1980         commit operation left in m_transactionOperationsInProgressQueue would be used and found to be freed. We should
1981         not use null check of complete function to decide whether an operation is completed.
1982
1983         * Modules/indexeddb/client/TransactionOperation.h:
1984         (WebCore::IDBClient::TransactionOperation::doComplete):
1985
1986 2019-03-07  John Wilander  <wilander@apple.com>
1987
1988         Resource Load Statistics: Log first-party navigations with link decoration
1989         https://bugs.webkit.org/show_bug.cgi?id=195301
1990         <rdar://problem/48569971>
1991
1992         Reviewed by Brent Fulgham.
1993
1994         Test: http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration.html
1995
1996         This patch adds two new members to WebCore::ResourceLoadStatistics:
1997         - topFrameLinkDecorationsFrom, a set of domains
1998         - gotLinkDecorationFromPrevalentResource, a boolean state
1999
2000         * loader/ResourceLoadStatistics.cpp:
2001         (WebCore::ResourceLoadStatistics::encode const):
2002         (WebCore::ResourceLoadStatistics::decode):
2003         (WebCore::ResourceLoadStatistics::toString const):
2004         (WebCore::ResourceLoadStatistics::merge):
2005         * loader/ResourceLoadStatistics.h:
2006
2007 2019-03-07  Simon Fraser  <simon.fraser@apple.com>
2008
2009         [iOS WK] REGRESSION (r242132): Fixed position banners flicker and move when scrolling (Apple, Tesla, YouTube, Reddit)
2010         https://bugs.webkit.org/show_bug.cgi?id=195396
2011         rdar://problem/48518959
2012
2013         Reviewed by Antti Koivisto.
2014         
2015         r242132 introduced two issues that contributed to jumpiness of position:fixed layers when scrolling.
2016         
2017         First, ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling() would early return if the scroll position
2018         hadn't changed. It also needs to check the supplied layoutViewport (if any), but in some cases running the
2019         notifyRelatedNodesAfterScrollPositionChange() code is necessary even without a scroll position change:
2020         if the web process has committed new scrolling tree state (e.g. with new fixed constraints) since
2021         the last call, we have to run the layer positioning code to have fixed layers re-adjust their position relative
2022         to the root. This was the primary bug fix.
2023
2024         Secondly, a layer tree commit can give ScrollingTreeFrameScrollingNode a new layout viewport, but we need to
2025         adjust this by the scrolling tree's current scroll position in case it gets used before the next scroll.
2026
2027         Currently no way to test this, as it's very timing-dependent.
2028
2029         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
2030         (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren):
2031         (WebCore::ScrollingTreeFrameScrollingNode::scrollPositionAndLayoutViewportMatch):
2032         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
2033         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2034         (WebCore::ScrollingTreeScrollingNode::scrollPositionAndLayoutViewportMatch):
2035         (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
2036         * page/scrolling/ScrollingTreeScrollingNode.h:
2037
2038 2019-03-07  Youenn Fablet  <youenn@apple.com>
2039
2040         Introduce a quota manager for Cache API/Service Worker/IDB storage
2041         https://bugs.webkit.org/show_bug.cgi?id=195283
2042
2043         Reviewed by Chris Dumez.
2044
2045         Introduce a generic quota manager and quota users to be used in Network Process.
2046         Quota manager/users are scoped by client origin.
2047         Quota manager is used to check for quota by an entity wanting to execute a storage task of a given taskSize.
2048         Quota manager will check the current space used by all its quota users.
2049         If the size + taskSize is above quota, it will call a function to try extend the quota.
2050         In the meantime, the task (and all tasks that may be added) are queued.
2051
2052         Once the new quota is received, the quota manager will either allow or disallow the first task in the queue.
2053         The quota manager will try to execute as many tasks as possible with the provided quota.
2054         If some tasks are remaining and quota limit is hit, the quota manager will compute the space needed for all remaining requests
2055         and do another quota extension request.
2056
2057         * Sources.txt:
2058         * WebCore.xcodeproj/project.pbxproj:
2059         * page/ClientOrigin.h:
2060         * storage/StorageQuotaManager.cpp: Added.
2061         (WebCore::StorageQuotaManager::~StorageQuotaManager):
2062         (WebCore::StorageQuotaManager::spaceUsage const):
2063         (WebCore::StorageQuotaManager::requestSpace):
2064         (WebCore::StorageQuotaManager::askForMoreSpace):
2065         (WebCore::StorageQuotaManager::processPendingRequests):
2066         * storage/StorageQuotaManager.h: Added.
2067         (WebCore::StorageQuotaManager::StorageQuotaManager):
2068         (WebCore::StorageQuotaManager::addUser):
2069         (WebCore::StorageQuotaManager::removeUser):
2070         * storage/StorageQuotaUser.h: Added.
2071
2072 2019-03-07  John Wilander  <wilander@apple.com>
2073
2074         Resource Load Statistics: Make it possible to purge only script-accessible cookies
2075         https://bugs.webkit.org/show_bug.cgi?id=195383
2076         <rdar://problem/48570136>
2077
2078         Reviewed by Brent Fulgham.
2079
2080         Test: http/tests/resourceLoadStatistics/delete-script-accessible-cookies.html
2081
2082         This patch provides the ability to purge all script-accessible cookies while leaving
2083         HttpOnly cookies in place.
2084
2085         * loader/CookieJar.h:
2086             Added boolean enum IncludeHttpOnlyCookies for use as function parameter.
2087         * platform/network/NetworkStorageSession.h:
2088         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
2089         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
2090             Support for the new IncludeHttpOnlyCookies flag.
2091         * platform/network/curl/NetworkStorageSessionCurl.cpp:
2092         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
2093             Stubbed out the new function and added a FIXME comment.
2094         * platform/network/soup/NetworkStorageSessionSoup.cpp:
2095         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
2096             Stubbed out the new function and added a FIXME comment.
2097
2098 2019-03-06  Mark Lam  <mark.lam@apple.com>
2099
2100         Exception is a JSCell, not a JSObject.
2101         https://bugs.webkit.org/show_bug.cgi?id=195392
2102
2103         Reviewed by Saam Barati.
2104
2105         * bridge/objc/objc_utility.h:
2106         * bridge/objc/objc_utility.mm:
2107         (JSC::Bindings::throwError):
2108         * bridge/runtime_object.cpp:
2109         (JSC::Bindings::RuntimeObject::throwInvalidAccessError):
2110         * bridge/runtime_object.h:
2111
2112 2019-03-07  Devin Rousso  <drousso@apple.com>
2113
2114         Web Inspector: Canvas: lazily create the agent
2115         https://bugs.webkit.org/show_bug.cgi?id=195241
2116
2117         Reviewed by Joseph Pecoraro.
2118
2119         No functionality change.
2120
2121         * html/canvas/CanvasRenderingContext.h:
2122         * html/canvas/CanvasRenderingContext.cpp:
2123         (WebCore::CanvasRenderingContext::instances): Added.
2124         (WebCore::CanvasRenderingContext::instancesMutex): Added.
2125         (WebCore::CanvasRenderingContext::CanvasRenderingContext):
2126         (WebCore::CanvasRenderingContext::~CanvasRenderingContext):
2127
2128         * html/canvas/WebGLProgram.h:
2129         * html/canvas/WebGLProgram.cpp:
2130         (WebCore::WebGLProgram::instances): Added.
2131         (WebCore::WebGLProgram::instancesMutex): Added.
2132         (WebCore::WebGLProgram::WebGLProgram):
2133         (WebCore::WebGLProgram::~WebGLProgram):
2134         * html/canvas/WebGLRenderingContextBase.cpp:
2135         (WebCore::WebGLRenderingContextBase::~WebGLRenderingContextBase):
2136
2137         * inspector/InspectorController.cpp:
2138         (WebCore::InspectorController::InspectorController):
2139         (WebCore::InspectorController::createLazyAgents):
2140
2141         * inspector/agents/InspectorCanvasAgent.h:
2142         * inspector/agents/InspectorCanvasAgent.cpp:
2143         (WebCore::InspectorCanvasAgent::enable):
2144         (WebCore::InspectorCanvasAgent::disable):
2145         (WebCore::InspectorCanvasAgent::frameNavigated):
2146         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
2147         (WebCore::InspectorCanvasAgent::canvasDestroyed):
2148         (WebCore::InspectorCanvasAgent::didCreateProgram):
2149         (WebCore::InspectorCanvasAgent::willDeleteProgram):
2150         (WebCore::InspectorCanvasAgent::bindCanvas): Added.
2151         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
2152
2153         * inspector/InspectorInstrumentation.h:
2154         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
2155         (WebCore::InspectorInstrumentation::didCreateProgram):
2156         (WebCore::InspectorInstrumentation::willDeleteProgram):
2157
2158 2019-03-06  Ross Kirsling  <ross.kirsling@sony.com>
2159
2160         [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
2161         https://bugs.webkit.org/show_bug.cgi?id=195346
2162
2163         Reviewed by Fujii Hironori.
2164
2165         * platform/graphics/win/FontCacheWin.cpp:
2166         (WebCore::appendLinkedFonts):
2167         (WebCore::getLinkedFonts):
2168         (WebCore::FontCache::systemFallbackForCharacters):
2169         (WebCore::FontCache::fontFromDescriptionAndLogFont):
2170         (WebCore::createGDIFont):
2171         (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
2172         * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
2173         (WebCore::FontCustomPlatformData::fontPlatformData):
2174         * platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp:
2175         (WebCore::GlyphPage::fill):
2176         * platform/graphics/win/IconWin.cpp:
2177         (WebCore::Icon::createIconForFiles):
2178         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2179         (WebCore::mimeTypeCache):
2180         (WebCore::MediaPlayerPrivateMediaFoundation::startCreateMediaSource):
2181         * platform/graphics/win/UniscribeController.cpp:
2182         (WebCore::UniscribeController::itemizeShapeAndPlace):
2183         (WebCore::UniscribeController::shape):
2184         * platform/network/win/DownloadBundleWin.cpp:
2185         (WebCore::DownloadBundle::appendResumeData):
2186         (WebCore::DownloadBundle::extractResumeData):
2187         * platform/text/win/LocaleWin.cpp:
2188         (WebCore::LCIDFromLocaleInternal):
2189         (WebCore::LCIDFromLocale):
2190         (WebCore::LocaleWin::getLocaleInfoString):
2191         * platform/win/BString.cpp:
2192         (WebCore::BString::BString):
2193         * platform/win/ClipboardUtilitiesWin.cpp:
2194         (WebCore::getWebLocData):
2195         (WebCore::createGlobalData):
2196         (WebCore::getFileDescriptorData):
2197         (WebCore::getURL):
2198         (WebCore::getCFData):
2199         (WebCore::setCFData):
2200         * platform/win/DragDataWin.cpp:
2201         (WebCore::DragData::asFilenames const):
2202         * platform/win/DragImageWin.cpp:
2203         (WebCore::createDragImageIconForCachedImageFilename):
2204         (WebCore::dragLabelFont):
2205         * platform/win/MIMETypeRegistryWin.cpp:
2206         (WebCore::mimeTypeForExtension):
2207         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
2208         * platform/win/PasteboardWin.cpp:
2209         (WebCore::Pasteboard::read):
2210         (WebCore::filesystemPathFromUrlOrTitle):
2211         (WebCore::Pasteboard::writeURLToDataObject):
2212         (WebCore::createGlobalImageFileDescriptor):
2213         (WebCore::createGlobalHDropContent):
2214         * platform/win/SSLKeyGeneratorWin.cpp:
2215         (WebCore::signedPublicKeyAndChallengeString):
2216         * platform/win/SharedBufferWin.cpp:
2217         (WebCore::SharedBuffer::createFromReadingFile):
2218         * rendering/RenderThemeWin.cpp:
2219         (WebCore::fillFontDescription):
2220         Use wchar helpers as needed.
2221
2222 2019-03-06  Devin Rousso  <drousso@apple.com>
2223
2224         Web Inspector: DOM Debugger: event breakpoints still fire when breakpoints are disabled
2225         https://bugs.webkit.org/show_bug.cgi?id=195377
2226         <rdar://problem/48651645>
2227
2228         Reviewed by Joseph Pecoraro and Matt Baker.
2229
2230         Test: inspector/dom-debugger/event-listener-breakpoints.html
2231
2232         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
2233         (WebCore::InspectorDOMDebuggerAgent::willHandleEvent):
2234         (WebCore::InspectorDOMDebuggerAgent::willFireTimer):
2235         (WebCore::InspectorDOMDebuggerAgent::willFireAnimationFrame):
2236
2237 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2238
2239         Crash when attempting to change input type while dismissing datalist suggestions
2240         https://bugs.webkit.org/show_bug.cgi?id=195384
2241         <rdar://problem/48563718>
2242
2243         Reviewed by Brent Fulgham.
2244
2245         When closing a datalist suggestion menu, WebPageProxy sends a message to WebPage instructing it to tell its
2246         active datalist suggestions picker to close. However, for a myriad of reasons, the suggestions picker (kept
2247         alive by its text input type) may have already gone away by this point. To mitigate this, make WebPage weakly
2248         reference its active datalist suggestions picker.
2249
2250         Test: fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html
2251
2252         * platform/DataListSuggestionPicker.h:
2253
2254         Make DataListSuggestionPicker capable of being weakly referenced. Additionally, fix some minor preexisting
2255         issues in this header (#imports instead of #includes, as well as an unnecessary include of IntRect.h).
2256
2257 2019-03-06  Ryan Haddad  <ryanhaddad@apple.com>
2258
2259         Remove an unneeded assert that was added with r242113
2260         https://bugs.webkit.org/show_bug.cgi?id=195391
2261
2262         Reviewed by Simon Fraser.
2263
2264         Many layout tests are failing ASSERT(m_mediaBufferingIsSuspended). Since m_mediaBufferingIsSuspended is
2265         protected by an 'if' statement directly afterwards, the assertion should be safe to remove.
2266
2267         * page/Page.cpp:
2268         (WebCore::Page::resumeAllMediaBuffering):
2269
2270 2019-03-06  Justin Fan  <justin_fan@apple.com>
2271
2272         Unreviewed build fix. Replace a forward declaration with an include.
2273
2274         * Modules/webgpu/WebGPUTextureView.cpp:
2275         * Modules/webgpu/WebGPUTextureView.h:
2276
2277 2019-03-06  Justin Fan  <justin_fan@apple.com>
2278
2279         [Web GPU] GPUTexture and GPUTextureView updates, and related GPUBindGroup updates
2280         https://bugs.webkit.org/show_bug.cgi?id=195347
2281
2282         Reviewed by Dean Jackson.
2283
2284         Implement the ability to display image data as a GPUTexture in the rendering pipeline. Improve GPUTexture and 
2285         GPUTextureView implementations. Rename various bind group classes to GPU* to match API.
2286
2287         Test: webgpu/texture-triangle-strip.html
2288
2289         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
2290         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Update to validate GPUTextureView resources.
2291         * Modules/webgpu/WebGPUCommandBuffer.cpp: Move instead of copy the converted view objects.
2292         (WebCore::WebGPUCommandBuffer::copyBufferToTexture):
2293         (WebCore::WebGPUCommandBuffer::copyTextureToBuffer):
2294         (WebCore::WebGPUCommandBuffer::copyTextureToTexture):
2295         * Modules/webgpu/WebGPUCommandBuffer.h:
2296         (WebCore::WebGPUCommandBuffer::commandBuffer const): No longer returns const so used resources can be registered on it.
2297         * Modules/webgpu/WebGPUDevice.cpp:
2298         (WebCore::WebGPUDevice::createBindGroupLayout const): Rename WebGPUBindGroupLayoutDescriptor and replace unnecessary rvalue reference.
2299         * Modules/webgpu/WebGPUDevice.h: Ditto.
2300         * Modules/webgpu/WebGPUDevice.idl: Ditto.
2301         * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
2302         (WebCore::WebGPUProgrammablePassEncoder::setBindGroup const):
2303         * Modules/webgpu/WebGPUProgrammablePassEncoder.h:
2304         * Modules/webgpu/WebGPUQueue.cpp:
2305         (WebCore::WebGPUQueue::submit):
2306         * Modules/webgpu/WebGPURenderPassDescriptor.cpp:
2307         (WebCore::WebGPURenderPassDescriptor::asGPURenderPassDescriptor const):
2308         * Modules/webgpu/WebGPUTexture.cpp:
2309         (WebCore::WebGPUTexture::~WebGPUTexture): Clean up any resources created for and from this WebGPUTexture.
2310         (WebCore::WebGPUTexture::createDefaultTextureView): Now returns an empty object other than null on failure.
2311         (WebCore::WebGPUTexture::destroy):
2312         (WebCore::WebGPUTexture::destroyImpl):
2313         * Modules/webgpu/WebGPUTexture.h: Keep a list of any views created from this texture.
2314         * Modules/webgpu/WebGPUTexture.idl: Enable destroy.
2315         * Modules/webgpu/WebGPUTextureView.cpp:
2316         (WebCore::WebGPUTextureView::create):
2317         (WebCore::WebGPUTextureView::WebGPUTextureView):
2318         (WebCore::WebGPUTextureView::destroy):
2319         * Modules/webgpu/WebGPUTextureView.h:
2320         (WebCore::WebGPUTextureView::~WebGPUTextureView): Clean up any resources backing this WebGPUTextureView.
2321         (WebCore::WebGPUTextureView::texture const):
2322         (WebCore::WebGPUTextureView::texture): Deleted.
2323         * platform/graphics/gpu/GPUBindGroupLayout.h:
2324         * platform/graphics/gpu/GPUCommandBuffer.h:
2325         (WebCore::GPUCommandBuffer::usedTextures const): Keep a list of all texture resources that will be used by this command buffer on submit.
2326         (WebCore::GPUCommandBuffer::isEncodingPass const): Added to prevent multiple pass encoders from being active on one command buffer.
2327         (WebCore::GPUCommandBuffer::setIsEncodingPass):
2328         (WebCore::GPUCommandBuffer::useTexture):
2329         * platform/graphics/gpu/GPUDevice.cpp:
2330         (WebCore::GPUDevice::tryCreateBindGroupLayout const):
2331         * platform/graphics/gpu/GPUDevice.h:
2332         * platform/graphics/gpu/GPUPipelineLayout.cpp:
2333         (WebCore::GPUPipelineLayout::GPUPipelineLayout):
2334         * platform/graphics/gpu/GPUProgrammablePassEncoder.cpp:
2335         (WebCore::GPUProgrammablePassEncoder::GPUProgrammablePassEncoder):
2336         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
2337         (WebCore::GPUProgrammablePassEncoder::setVertexBuffer):
2338         (WebCore::GPUProgrammablePassEncoder::setFragmentBuffer):
2339         (): Deleted.
2340         * platform/graphics/gpu/GPUQueue.h:
2341         * platform/graphics/gpu/GPURenderPassEncoder.h:
2342         * platform/graphics/gpu/GPUTexture.h:
2343         (WebCore::GPUTexture::isReadOnly const):
2344         (WebCore::GPUTexture::destroy):
2345         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
2346         (WebCore::MTLDataTypeForBindingType):
2347         (WebCore::GPUBindGroupLayout::tryCreate):
2348         * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm:
2349         (WebCore::GPUCommandBuffer::create):
2350         (WebCore::GPUCommandBuffer::~GPUCommandBuffer): Ensure blitEncoder is ended before releasing it.
2351         (WebCore::GPUCommandBuffer::endBlitEncoding):
2352         (WebCore::GPUCommandBuffer::copyBufferToTexture): Ensure textures are marked for usage before submission occurs.
2353         (WebCore::GPUCommandBuffer::copyTextureToBuffer):
2354         (WebCore::GPUCommandBuffer::copyTextureToTexture):
2355         * platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
2356         (WebCore::GPUDevice::create):
2357         (WebCore::GPUDevice::GPUDevice):
2358         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
2359         (WebCore::GPUProgrammablePassEncoder::endPass):
2360         (WebCore::GPUProgrammablePassEncoder::setBindGroup): Now supports texture resources.
2361         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder): Just moved.
2362         (WebCore::GPUProgrammablePassEncoder::setResourceAsTextureOnEncoder):
2363         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
2364         (WebCore::GPUQueue::submit): Ensures destroyed GPUTextures are not submitted.
2365         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
2366         (WebCore::GPURenderPassEncoder::tryCreate): Ensure any other encoders are ended before attempting to activate a new one.
2367         (WebCore::GPURenderPassEncoder::platformPassEncoder const):
2368         (WebCore::GPURenderPassEncoder::endPass): Invalidates the MTLCommandEncoder upon success.
2369         (WebCore::GPURenderPassEncoder::setPipeline):
2370         (WebCore::GPURenderPassEncoder::setVertexBuffers):
2371         (WebCore::GPURenderPassEncoder::draw):
2372         (WebCore::GPURenderPassEncoder::useResource):
2373         (WebCore::GPURenderPassEncoder::setVertexBuffer):
2374         (WebCore::GPURenderPassEncoder::setFragmentBuffer):
2375         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
2376         (WebCore::GPUSwapChain::getNextTexture):
2377         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
2378         (WebCore::storageModeForPixelFormatAndSampleCount): 
2379                 Always create MTLStorageModePrivate textures on macOS, as Web GPU doesn't provide CPU access to textures anyway.
2380         (WebCore::tryCreateMtlTextureDescriptor):
2381         (WebCore::GPUTexture::create):
2382         (WebCore::GPUTexture::GPUTexture):
2383         (WebCore::GPUTexture::tryCreateDefaultTextureView): Renamed from createDefaultTextureView.
2384
2385         Update files and symbols in project:
2386         * CMakeLists.txt:
2387         * DerivedSources-input.xcfilelist:
2388         * DerivedSources-output.xcfilelist:
2389         * DerivedSources.make:
2390         * Modules/streams/WebGPUBindGroupLayoutDescriptor.h: Removed.
2391         * Modules/webgpu/GPUBindGroupLayoutBinding.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h.
2392         * Modules/webgpu/GPUBindGroupLayoutBinding.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl.
2393         * Modules/webgpu/GPUBindGroupLayoutDescriptor.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h.
2394         * Modules/webgpu/GPUBindGroupLayoutDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl.
2395         * Modules/webgpu/GPUShaderStageBit.h: Renamed from Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.h.
2396         * Modules/webgpu/GPUShaderStageBit.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl.
2397         * Sources.txt:
2398         * WebCore.xcodeproj/project.pbxproj:
2399         * bindings/js/WebCoreBuiltinNames.h:
2400
2401 2019-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
2402
2403         [WHLSL] Pack and unpack data at entry points and exit points
2404         https://bugs.webkit.org/show_bug.cgi?id=193877
2405
2406         Reviewed by Dean Jackson.
2407
2408         This implements the bulk of the rest of the Metal code generation piece.
2409         Specifically, this patch adds support for the packing and unpacking steps
2410         at the beginning of the entry point functions and all returns from those
2411         functions. It does this by creating an object, EntryPointScaffolding, that
2412         knows how to emit all the helper types, packing / unpacking code, and the
2413         function signature. This patch also accepts parts of the
2414         PipelineStateDescriptor so we know the data layout we should be packing and
2415         unpacking.
2416
2417         This is the last patch before enough of the compiler is present that we can
2418         start testing it. The next patch will start porting the test suite.
2419
2420         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
2421         (WebCore::WHLSL::Metal::attributeForSemantic):
2422         (WebCore::WHLSL::Metal::EntryPointScaffolding::EntryPointScaffolding):
2423         (WebCore::WHLSL::Metal::EntryPointScaffolding::mappedBindGroups const):
2424         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceHelperTypes):
2425         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceSignature):
2426         (WebCore::WHLSL::Metal::EntryPointScaffolding::builtInsSignature):
2427         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledInputPath):
2428         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledOutputPath):
2429         (WebCore::WHLSL::Metal::EntryPointScaffolding::unpackResourcesAndNamedBuiltIns):
2430         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::VertexEntryPointScaffolding):
2431         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::helperTypes):
2432         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::signature):
2433         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::unpack):
2434         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::pack):
2435         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::FragmentEntryPointScaffolding):
2436         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::helperTypes):
2437         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::signature):
2438         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::unpack):
2439         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::pack):
2440         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::ComputeEntryPointScaffolding):
2441         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::helperTypes):
2442         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::signature):
2443         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::unpack):
2444         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::pack):
2445         (WebCore::WHLSL::Metal::EntryPointScaffolding::helperTypes): Deleted.
2446         (WebCore::WHLSL::Metal::EntryPointScaffolding::signature): Deleted.
2447         (WebCore::WHLSL::Metal::EntryPointScaffolding::unpack): Deleted.
2448         (WebCore::WHLSL::Metal::EntryPointScaffolding::pack): Deleted.
2449         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.h:
2450         (WebCore::WHLSL::Metal::EntryPointScaffolding::parameterVariables):
2451         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
2452         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::toString):
2453         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::visit):
2454         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
2455         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::generateNextVariableName):
2456         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
2457         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::constantExpressionString):
2458         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::RenderFunctionDefinitionWriter):
2459         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::takeVertexMappedBindGroups):
2460         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::takeFragmentMappedBindGroups):
2461         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::createEntryPointScaffolding):
2462         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::ComputeFunctionDefinitionWriter):
2463         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::takeMappedBindGroups):
2464         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::createEntryPointScaffolding):
2465         (WebCore::WHLSL::Metal::sharedMetalFunctions):
2466         (WebCore::WHLSL::Metal::metalFunctions):
2467         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.h:
2468         * Modules/webgpu/WHLSL/Metal/WHLSLMappedBindings.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h.
2469         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp:
2470         (WebCore::WHLSL::Metal::generateMetalCodeShared):
2471         (WebCore::WHLSL::Metal::generateMetalCode):
2472         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h:
2473         * Modules/webgpu/WHLSL/WHLSLIntrinsics.h:
2474         (WebCore::WHLSL::Intrinsics::float2Type const):
2475         * Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h: Added.
2476         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp: Added.
2477         (WebCore::WHLSL::prepareShared):
2478         (WebCore::WHLSL::prepare):
2479         * Modules/webgpu/WHLSL/WHLSLPrepare.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h.
2480         * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp: Added.
2481         (WebCore::WHLSL::findEntryPoint):
2482         (WebCore::WHLSL::matchMode):
2483         (WebCore::WHLSL::matchResources):
2484         (WebCore::WHLSL::matchInputsOutputs):
2485         (WebCore::WHLSL::isAcceptableFormat):
2486         (WebCore::WHLSL::matchVertexAttributes):
2487         (WebCore::WHLSL::matchColorAttachments):
2488         (WebCore::WHLSL::matchDepthAttachment):
2489         (WebCore::WHLSL::matchSemantics):
2490         * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp.
2491         * Sources.txt:
2492         * WebCore.xcodeproj/project.pbxproj:
2493
2494 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2495
2496         Move RenderObject::isTransparentOrFullyClippedRespectingParentFrames() to RenderLayer
2497         https://bugs.webkit.org/show_bug.cgi?id=195300
2498
2499         Reviewed by Simon Fraser.
2500
2501         Move isTransparentOrFullyClippedRespectingParentFrames() from RenderObject to RenderLayer, since this function
2502         asks questions about RenderLayers rather than their renderers. No change in behavior.
2503
2504         * rendering/RenderLayer.cpp:
2505         (WebCore::enclosingFrameRenderLayer):
2506         (WebCore::parentLayerCrossFrame):
2507
2508         Some static helpers currently in RenderObject that walk up the layer hierarchy through subframes are redundant
2509         with static helpers in RenderLayer. Now that isTransparentOrFullyClippedRespectingParentFrames exists in
2510         RenderLayer, simply use this existing helper instead and split logic to grab the enclosing layer around the
2511         owner element of a frame into a separate helper.
2512
2513         * rendering/RenderLayer.h:
2514         * rendering/RenderObject.cpp:
2515         (WebCore::enclosingFrameRenderLayer): Deleted.
2516         (WebCore::parentLayerCrossingFrameBoundaries): Deleted.
2517         (WebCore::RenderObject::isTransparentOrFullyClippedRespectingParentFrames const): Deleted.
2518
2519         Moved from RenderObject.
2520
2521         * rendering/RenderObject.h:
2522
2523 2019-03-06  Sihui Liu  <sihui_liu@apple.com>
2524
2525         Assertion Failed: m_databaseQueue.isKilled() in UniqueIDBDatabase::~UniqueIDBDatabase()
2526         https://bugs.webkit.org/show_bug.cgi?id=195073
2527         <rdar://problem/48285200>
2528
2529         Reviewed by Geoffrey Garen.
2530
2531         r240931 removed a retain cycle between IDBConnectionToServer and IDBConnectionToServerDelegate, so 
2532         IDBConnectionToServerDelegate, or InProcessIDBServer would not live forever. When IDBDatabase is gone, 
2533         InProcessIDBServer would schedule a notifification to IDBServer with databaseConnectionClosed. IDBServer would 
2534         then notify UniqueIDBDatabase. When UniqueIDBDatabase finds all database connections are gone, it would acquires
2535         its only reference pointer from IDBServer schedule and perform a shutdown that kills its database task queue.
2536
2537         The assertion failure tells us UniqueIDBDatabase was destructed at when IDBServer was destructed, which means 
2538         UniqueIDBDatabase had not acquired its pointer. It's probably because UniqueIDBDatabase had unfinished tasks or
2539         the operation timer function had not been executed. Since UniqueIDBDatabase needs to complete shutdown process,
2540         we should make IDBServer live as long as UniqueIDBDatabase by keeping a reference pointer of IDBServer in 
2541         UniqueIDBDatabase. 
2542
2543         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2544         (WebCore::IDBServer::UniqueIDBDatabase::UniqueIDBDatabase):
2545         (WebCore::IDBServer::UniqueIDBDatabase::deleteBackingStore):
2546         (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose):
2547         (WebCore::IDBServer::UniqueIDBDatabase::openBackingStore):
2548         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask):
2549         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply):
2550         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
2551         (WebCore::IDBServer::UniqueIDBDatabase::notifyServerAboutClose):
2552         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2553         (WebCore::IDBServer::UniqueIDBDatabase::server):
2554
2555 2019-03-06  Rob Buis  <rbuis@igalia.com>
2556
2557         Consider supporting the `referrerpolicy` attribute.
2558         https://bugs.webkit.org/show_bug.cgi?id=179053
2559
2560         Reviewed by Darin Adler.
2561
2562         This patch adds 'referrerpolicy' attribute support for iframe.
2563         If set, the value is restricted to the ReferrerPolicy enum, and
2564         if valid it is used for the subframe load.
2565         If not set or invalid, the current behavior is kept.
2566
2567         Tests: http/tests/referrer-policy-iframe/no-referrer-when-downgrade/cross-origin-http-http.html
2568                http/tests/referrer-policy-iframe/no-referrer-when-downgrade/cross-origin-http.https.html
2569                http/tests/referrer-policy-iframe/no-referrer-when-downgrade/same-origin.html
2570                http/tests/referrer-policy-iframe/no-referrer/cross-origin-http-http.html
2571                http/tests/referrer-policy-iframe/no-referrer/cross-origin-http.https.html
2572                http/tests/referrer-policy-iframe/no-referrer/same-origin.html
2573                http/tests/referrer-policy-iframe/origin-when-cross-origin/cross-origin-http-http.html
2574                http/tests/referrer-policy-iframe/origin-when-cross-origin/cross-origin-http.https.html
2575                http/tests/referrer-policy-iframe/origin-when-cross-origin/same-origin.html
2576                http/tests/referrer-policy-iframe/origin/cross-origin-http-http.html
2577                http/tests/referrer-policy-iframe/origin/cross-origin-http.https.html
2578                http/tests/referrer-policy-iframe/origin/same-origin.html
2579                http/tests/referrer-policy-iframe/same-origin/cross-origin-http-http.html
2580                http/tests/referrer-policy-iframe/same-origin/cross-origin-http.https.html
2581                http/tests/referrer-policy-iframe/same-origin/same-origin.html
2582                http/tests/referrer-policy-iframe/strict-origin-when-cross-origin/cross-origin-http-http.html
2583                http/tests/referrer-policy-iframe/strict-origin-when-cross-origin/cross-origin-http.https.html
2584                http/tests/referrer-policy-iframe/strict-origin-when-cross-origin/same-origin.html
2585                http/tests/referrer-policy-iframe/strict-origin/cross-origin-http-http.html
2586                http/tests/referrer-policy-iframe/strict-origin/cross-origin-http.https.html
2587                http/tests/referrer-policy-iframe/strict-origin/same-origin.html
2588                http/tests/referrer-policy-iframe/unsafe-url/cross-origin-http-http.html
2589                http/tests/referrer-policy-iframe/unsafe-url/cross-origin-http.https.html
2590                http/tests/referrer-policy-iframe/unsafe-url/same-origin.html
2591
2592         * html/HTMLAttributeNames.in:
2593         * html/HTMLFrameOwnerElement.h:
2594         (WebCore::HTMLFrameOwnerElement::referrerPolicy const):
2595         * html/HTMLIFrameElement.cpp:
2596         (WebCore::HTMLIFrameElement::setReferrerPolicyForBindings):
2597         (WebCore::HTMLIFrameElement::referrerPolicyForBindings const):
2598         (WebCore::HTMLIFrameElement::referrerPolicy const):
2599         * html/HTMLIFrameElement.h:
2600         * html/HTMLIFrameElement.idl:
2601         * loader/SubframeLoader.cpp:
2602         (WebCore::SubframeLoader::loadSubframe):
2603         * page/RuntimeEnabledFeatures.h:
2604         (WebCore::RuntimeEnabledFeatures::referrerPolicyAttributeEnabled const):
2605         (WebCore::RuntimeEnabledFeatures::setReferrerPolicyAttributeEnabled):
2606         * platform/ReferrerPolicy.cpp:
2607         (WebCore::parseReferrerPolicy):
2608         * platform/ReferrerPolicy.h:
2609
2610 2019-03-05  Takashi Komori  <Takashi.Komori@sony.com>
2611
2612         [curl] Remove unnecessary file.
2613         https://bugs.webkit.org/show_bug.cgi?id=195350
2614
2615         Reviewed by Fujii Hironori.
2616
2617         Removed unused file.
2618
2619         No new tests. No change in behavior.
2620
2621         * platform/network/curl/CookieJarCurlDatabase.cpp: Removed.
2622
2623 2019-03-05  Eric Liang  <ericliang@apple.com>
2624
2625         AX: Add remote search support for keyboard focusable element search type
2626         https://bugs.webkit.org/show_bug.cgi?id=195336
2627
2628         Reviewed by Chris Fleizach.
2629
2630         Added AXKeyboardFocusable search key to return default keyboard-focusable elements for accessibility.
2631
2632         Test: accessibility/mac/search-predicate-keyboard-focusable.html
2633
2634         * accessibility/AccessibilityObject.cpp:
2635         (WebCore::AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex):
2636         (WebCore::AccessibilityObject::isKeyboardFocusable const):
2637         * accessibility/AccessibilityObject.h:
2638         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
2639         (createAccessibilitySearchKeyMap):
2640
2641 2019-03-05  Don Olmstead  <don.olmstead@sony.com>
2642
2643         [WinCairo] Enable CSS Typed OM
2644         https://bugs.webkit.org/show_bug.cgi?id=195340
2645
2646         Reviewed by Myles C. Maxfield.
2647
2648         * bindings/js/CallTracerTypes.h:
2649
2650 2019-03-05  Sihui Liu  <sihui_liu@apple.com>
2651
2652         Fix a typo in Web SQL quirk
2653         https://bugs.webkit.org/show_bug.cgi?id=195338
2654
2655         Reviewed by Geoffrey Garen.
2656
2657         * page/Quirks.cpp:
2658         (WebCore::Quirks::hasWebSQLSupportQuirk const):
2659
2660 2019-03-05  Daniel Bates  <dabates@apple.com>
2661
2662         [iOS] Should not scroll when checkbox, radio, submit, reset, or button is spacebar activated
2663         https://bugs.webkit.org/show_bug.cgi?id=195281
2664         <rdar://problem/48564347>
2665
2666         Reviewed by Simon Fraser.
2667
2668         Do not call the base class's default event handler (HTMLTextFormControlElement::defaultEventHandler())
2669         when WebCore sees a keydown of the spacebar as we consider such an event as handled.
2670         Otherwise, calling the base class's default event handler ultimately gives the embedding
2671         client a chance to wrongly handle the event. In the case of iOS, keydown of the spacebar
2672         causes the page to scroll.
2673
2674         WebCore implements spacebar activation on keydown for form controls. For IE compatibility
2675         WebCore does not mark such keydown events as handled so that a DOM keypress event will
2676         be subsequently dispatched. The current logic only skips calling the base class's default
2677         event handler if the DOM event was not marked handled. This is insufficient. We need to
2678         know whether WebCore handled the event. If asking the input type to handle the key down
2679         marks the DOM event as handled then, clearly, WebCore handled the event. However, if the
2680         event is not marked as handled, but WebCore actually accounted for this event then we need
2681         to know this so that we do not call the base class's default event handler and ultimately
2682         the embedding client asking for an interpretation of the key event. Towards this, have
2683         InputType::handleKeydownEvent() return a bit whether or not the base class's default
2684         event handler should be invoked.
2685
2686         Tests: fast/events/ios/activating-button-should-not-scroll-page.html
2687                fast/events/ios/activating-checkbox-should-not-scroll-page.html
2688                fast/events/ios/activating-radio-button-should-not-scroll-page.html
2689                fast/events/ios/activating-reset-button-should-not-scroll-page.html
2690                fast/events/ios/activating-submit-button-should-not-scroll-page.html
2691
2692         * html/BaseCheckableInputType.cpp:
2693         (WebCore::BaseCheckableInputType::handleKeydownEvent): Return ShouldCallBaseEventHandler::No
2694         if WebCore handled the spacebar activation. Otherewise, return ShouldCallBaseEventHandler::Yes.
2695         * html/BaseCheckableInputType.h:
2696         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
2697         (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeydownEvent): Ditto.
2698         * html/BaseChooserOnlyDateAndTimeInputType.h:
2699         * html/BaseClickableWithKeyInputType.cpp:
2700         (WebCore::BaseClickableWithKeyInputType::handleKeydownEvent): Keep our current behavior by returning ShouldCallBaseEventHandler::Yes.
2701         * html/BaseClickableWithKeyInputType.h:
2702         * html/HTMLInputElement.cpp:
2703         (WebCore::HTMLInputElement::defaultEventHandler): Do not fallthrough and call the base class's default
2704         event handler if the input type told us it handled the event regardless of whether the event was handled
2705         from the perspective of the DOM.
2706         * html/InputType.cpp:
2707         (WebCore::InputType::handleKeydownEvent): Keep our current behavior by returning ShouldCallBaseEventHandler::Yes.
2708         * html/InputType.h:
2709
2710         * html/NumberInputType.cpp:
2711         (WebCore::NumberInputType::handleKeydownEvent):
2712         * html/NumberInputType.h:
2713         * html/RadioInputType.cpp:
2714         (WebCore::RadioInputType::handleKeydownEvent):
2715         * html/RadioInputType.h:
2716         * html/RangeInputType.cpp:
2717         (WebCore::RangeInputType::handleKeydownEvent):
2718         * html/RangeInputType.h:
2719         * html/SearchInputType.cpp:
2720         (WebCore::SearchInputType::handleKeydownEvent):
2721         * html/SearchInputType.h:
2722         * html/TextFieldInputType.cpp:
2723         (WebCore::TextFieldInputType::handleKeydownEvent):
2724         * html/TextFieldInputType.h:
2725         Keep our current behavior by returning ShouldCallBaseEventHandler::Yes.
2726
2727 2019-03-05  Takashi Komori  <Takashi.Komori@sony.com>
2728
2729         [Curl] Implement Cookie Accept Policy.
2730         https://bugs.webkit.org/show_bug.cgi?id=191645
2731
2732         Reviewed by Fujii Hironori.
2733
2734         Make Curl network layer respect to coookie accept policy.
2735         This patch fixes tests below on TestRunner, but doesn't fix tests on DumpRenderTree.
2736
2737         Tests: http/tests/cookies/only-accept-first-party-cookies.html
2738                http/tests/cookies/third-party-cookie-relaxing.html
2739                http/tests/security/cookies/third-party-cookie-blocking-redirect.html
2740                http/tests/security/cookies/third-party-cookie-blocking-user-action.html
2741                http/tests/security/cookies/third-party-cookie-blocking-xslt.xml
2742                http/tests/security/cookies/third-party-cookie-blocking.html
2743
2744         * platform/network/curl/CookieJarCurl.cpp:
2745         (WebCore::cookiesForSession):
2746         (WebCore::CookieJarCurl::setCookiesFromDOM const):
2747         (WebCore::CookieJarCurl::setCookiesFromHTTPResponse const):
2748         (WebCore::CookieJarCurl::setCookieAcceptPolicy const):
2749         (WebCore::CookieJarCurl::cookieAcceptPolicy const):
2750         (WebCore::CookieJarCurl::getRawCookies const):
2751         * platform/network/curl/CookieJarCurl.h:
2752         * platform/network/curl/CookieJarDB.cpp:
2753         (WebCore::CookieJarDB::openDatabase):
2754         (WebCore::CookieJarDB::isEnabled const):
2755         (WebCore::CookieJarDB::checkCookieAcceptPolicy):
2756         (WebCore::CookieJarDB::hasCookies):
2757         (WebCore::CookieJarDB::searchCookies):
2758         (WebCore::CookieJarDB::canAcceptCookie):
2759         (WebCore::CookieJarDB::setCookie):
2760         (WebCore::CookieJarDB::setEnabled): Deleted.
2761         * platform/network/curl/CookieJarDB.h:
2762         (WebCore::CookieJarDB::setAcceptPolicy):
2763         (WebCore::CookieJarDB::acceptPolicy const):
2764         * platform/network/curl/CookieUtil.cpp:
2765         (WebCore::CookieUtil::parseCookieAttributes):
2766         (WebCore::CookieUtil::parseCookieHeader):
2767         * platform/network/curl/CurlResourceHandleDelegate.cpp:
2768         (WebCore::handleCookieHeaders):
2769         (WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse):
2770
2771 2019-03-05  Zalan Bujtas  <zalan@apple.com>
2772
2773         [ContentChangeObserver] Assert on if notify content change is allowed
2774         https://bugs.webkit.org/show_bug.cgi?id=195332
2775         <rdar://problem/48603276>
2776
2777         Reviewed by Simon Fraser.
2778
2779         Assert we don't notify the client about the state change while in handleSyntheticClick().
2780
2781         * page/ios/ContentChangeObserver.cpp:
2782         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
2783         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
2784         (WebCore::ContentChangeObserver::adjustObservedState):
2785         * page/ios/ContentChangeObserver.h:
2786         (WebCore::ContentChangeObserver::isObservingContentChanges const):
2787         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
2788
2789 2019-03-05  Said Abou-Hallawa  <sabouhallawa@apple.com>
2790
2791         SVGPathSegList.insertItemBefore() should fail if the newItem belongs to an animating animPathSegList
2792         https://bugs.webkit.org/show_bug.cgi?id=195333
2793         <rdar://problem/48475802>
2794
2795         Reviewed by Simon Fraser.
2796
2797         Because the SVG1.1 specs states that the newItem should be removed from
2798         its original list before adding it to another list,
2799         SVGPathSegList.insertItemBefore() should fail if the new item belongs to
2800         an animating animPathSegList since it is read-only.
2801
2802         Test: svg/dom/SVGPathSegList-insert-from-animating-animPathSegList.svg
2803
2804         * svg/SVGPathSegList.cpp:
2805         (WebCore::SVGPathSegList::processIncomingListItemValue):
2806
2807 2019-03-05  Zalan Bujtas  <zalan@apple.com>
2808
2809         [ContentChangeObserver] Send content change notification through adjustObservedState
2810         https://bugs.webkit.org/show_bug.cgi?id=195328
2811         <rdar://problem/48601143>
2812
2813         Reviewed by Simon Fraser.
2814
2815         Have a dedicated place for the notification logic.
2816
2817         * page/ios/ContentChangeObserver.cpp:
2818         (WebCore::ContentChangeObserver::stopDurationBasedContentObservation):
2819         (WebCore::ContentChangeObserver::didInstallDOMTimer):
2820         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
2821         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
2822         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
2823         (WebCore::ContentChangeObserver::mouseMovedDidStart):
2824         (WebCore::ContentChangeObserver::adjustObservedState):
2825         (WebCore::ContentChangeObserver::registerDOMTimer): Deleted.
2826         (WebCore::ContentChangeObserver::unregisterDOMTimer): Deleted.
2827         (WebCore::ContentChangeObserver::notifyContentChangeIfNeeded): Deleted.
2828         * page/ios/ContentChangeObserver.h:
2829         (WebCore::ContentChangeObserver::registerDOMTimer):
2830         (WebCore::ContentChangeObserver::unregisterDOMTimer):
2831
2832 2019-03-05  Youenn Fablet  <youenn@apple.com>
2833
2834         MockLibWebRTCPeerConnection is leaking some session description
2835         https://bugs.webkit.org/show_bug.cgi?id=195315
2836         <rdar://problem/47840038>
2837
2838         Reviewed by David Kilzer.
2839
2840         Make sure to release raw pointers given from WebCore to mock libwebrtc layer.
2841         Covered by existing tests when run in leaks mode.
2842
2843         * testing/MockLibWebRTCPeerConnection.cpp:
2844         (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription):
2845         (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription):
2846
2847 2019-03-05  Ryan Haddad  <ryanhaddad@apple.com>
2848
2849         Unreviewed, rolling out r242403.
2850
2851         Caused layout test crashes on iOS simulator.
2852
2853         Reverted changeset:
2854
2855         "[ContentChangeObserver] Introduce fixed duration content
2856         observation"
2857         https://bugs.webkit.org/show_bug.cgi?id=195295
2858         https://trac.webkit.org/changeset/242403
2859
2860 2019-03-05  Frederic Wang  <fwang@igalia.com>
2861
2862         Web Inspector: Better categorize CPU usage per-thread / worker
2863         https://bugs.webkit.org/show_bug.cgi?id=194564
2864
2865         Unreviewed compilation fix.
2866
2867         * page/ResourceUsageData.h: Add missing headers.
2868
2869 2019-03-05  Frederic Wang  <fwang@igalia.com>
2870
2871         Share more code for updating the state of frame scrolling nodes
2872         https://bugs.webkit.org/show_bug.cgi?id=195254
2873
2874         Unreviewed compilation warning fix.
2875
2876         * page/scrolling/AsyncScrollingCoordinator.cpp:
2877         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): Add UNUSED_PARAM on non-Cocoa
2878         platforms.
2879
2880 2019-03-05  Cathie Chen  <cathiechen@igalia.com>
2881
2882         The include file in ScrollingStateFrameHostingNode.h is wrong.
2883         https://bugs.webkit.org/show_bug.cgi?id=195280
2884
2885         Reviewed by Frédéric Wang.
2886
2887         * page/scrolling/ScrollingStateFrameHostingNode.h:
2888
2889 2019-03-04  Justin Fan  <justin_fan@apple.com>
2890
2891         Unreviewed build fix for High Sierra.
2892
2893         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm: Should fix "global constructor" error.
2894
2895 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
2896
2897         Use a SQLite database to hold the ResourceLoadStatistics data
2898         https://bugs.webkit.org/show_bug.cgi?id=194867
2899         <rdar://problem/24240854>
2900
2901         Reviewed by Chris Dumez.
2902
2903         Add a new runtime feature flag to support use of an experimental database
2904         back-end. Also expose some SQLite function calls for use outside of WebCore.
2905
2906         No change in functionality, so no new tests.
2907
2908         * page/RuntimeEnabledFeatures.h:
2909         (WebCore::RuntimeEnabledFeatures::setItpDatabaseModeEnabled):
2910         (WebCore::RuntimeEnabledFeatures::itpDatabaseModeEnabled const):
2911         * platform/sql/SQLiteDatabase.h:
2912         * platform/sql/SQLiteStatement.h:
2913
2914 2019-03-04  Justin Fan  <justin_fan@apple.com>
2915
2916         [Web GPU] Blitting function prototypes
2917         https://bugs.webkit.org/show_bug.cgi?id=195224
2918         <rdar://problem/48538902>
2919
2920         Reviewed by Dean Jackson.
2921
2922         Implement barebones GPUCommandBuffer::copy* prototypes while rounding out GPUTexture implementation details.
2923
2924         Test: webgpu/blit-commands.html
2925
2926         * Modules/webgpu/GPUOrigin3D.h: Added.
2927         * Modules/webgpu/GPUOrigin3D.idl: Added.
2928         * Modules/webgpu/WebGPUCommandBuffer.cpp: Add copy view struct implementations.
2929         (WebCore::WebGPUBufferCopyView::asGPUBufferCopyView const): Added.
2930         (WebCore::WebGPUTextureCopyView::asGPUTextureCopyView const): Added.
2931         (WebCore::WebGPUCommandBuffer::copyBufferToBuffer): Added.
2932         (WebCore::WebGPUCommandBuffer::copyBufferToTexture): Added.
2933         (WebCore::WebGPUCommandBuffer::copyTextureToBuffer): Added.
2934         (WebCore::WebGPUCommandBuffer::copyTextureToTexture): Added.
2935         * Modules/webgpu/WebGPUCommandBuffer.h: Add new functions and supporting structs.
2936         * Modules/webgpu/WebGPUCommandBuffer.idl: Ditto.
2937         * Modules/webgpu/WebGPURenderPassDescriptor.cpp: Refactor constructors to copy the entire base class.
2938         (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor):
2939         (WebCore::GPURenderPassDepthStencilAttachmentDescriptor::GPURenderPassDepthStencilAttachmentDescriptor):
2940         (WebCore::WebGPURenderPassDescriptor::asGPURenderPassDescriptor const):
2941         (WebCore::attachment): Deleted.
2942         * Modules/webgpu/WebGPUTexture.h:
2943         (WebCore::WebGPUTexture::texture const): Added.
2944         * platform/graphics/gpu/GPUBuffer.h:
2945         (WebCore::GPUBuffer::byteLength const): Added.
2946         (WebCore::GPUBuffer::isTransferSource const): Added.
2947         (WebCore::GPUBuffer::isTransferDestination const): Renamed from isTransferDst. Refactored for OptionSet API.
2948         (WebCore::GPUBuffer::isVertex const): Ditto.
2949         (WebCore::GPUBuffer::isUniform const): Ditto.
2950         (WebCore::GPUBuffer::isStorage const): Ditto.
2951         (WebCore::GPUBuffer::isMappable const): Ditto.
2952         (WebCore::GPUBuffer::isMapWrite const): Ditto.
2953         (WebCore::GPUBuffer::isMapRead const): Ditto.
2954         * platform/graphics/gpu/GPUBufferUsage.h: Refactored for better bit flag style.
2955         * platform/graphics/gpu/GPUCommandBuffer.h:
2956         (WebCore::GPUCommandBuffer::blitEncoder const): Added.
2957         * platform/graphics/gpu/GPURenderPassDescriptor.h: 
2958         * platform/graphics/gpu/GPUTexture.h: Cache usage flags for reference.
2959         (WebCore::GPUTexture::isTransferSrc const): Added.
2960         (WebCore::GPUTexture::isTransferDst const): Added.
2961         (WebCore::GPUTexture::isOutputAttachment const): Added.
2962         * platform/graphics/gpu/GPUTextureUsage.h: Refactor to match GPUBufferUsage.h.
2963         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
2964         (WebCore::GPUBuffer::validateBufferUsage): Renamed from validateBufferCreate, refactored for OptionSet.
2965         (WebCore::GPUBuffer::tryCreate):
2966         (WebCore::GPUBuffer::GPUBuffer):
2967         (WebCore::GPUBuffer::isReadOnly const):
2968         (WebCore::GPUBuffer::setSubData): Add alignment check according to Metal docs.
2969         * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm: 
2970         (WebCore::GPUCommandBuffer::create): No need to use this alias here.
2971         (WebCore::GPUCommandBuffer::GPUCommandBuffer): Ditto.
2972         (WebCore::GPUCommandBuffer::copyBufferToBuffer): Added.
2973         (WebCore::GPUCommandBuffer::copyBufferToTexture): Added.
2974         (WebCore::GPUCommandBuffer::copyTextureToBuffer): Added. 
2975         (WebCore::GPUCommandBuffer::copyTextureToTexture): Added. 
2976         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
2977         (WebCore::GPUQueue::submit): End encoding on the MTLCommandBuffer's blitCommandEncoder if it was used.
2978         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
2979         (WebCore::GPUSwapChain::getNextTexture): Now provide usage flags to texture creation.
2980         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
2981         (WebCore::mtlTextureUsageForGPUTextureUsageFlags): Refactor validation.
2982         (WebCore::tryCreateMtlTextureDescriptor): Ditto.
2983         (WebCore::GPUTexture::tryCreate): Now provide usage flags to texture creation.
2984         (WebCore::GPUTexture::create): Ditto.
2985         (WebCore::GPUTexture::GPUTexture): Ditto.
2986         (WebCore::GPUTexture::createDefaultTextureView): Ditto.
2987
2988 2019-03-04  Zalan Bujtas  <zalan@apple.com>
2989
2990         [ContentChangeObserver] Introduce fixed duration content observation
2991         https://bugs.webkit.org/show_bug.cgi?id=195295
2992         <rdar://problem/48579913>
2993
2994         Reviewed by Simon Fraser.
2995
2996         Some pages have a runloop-like scheduling setup where the content triggering change happens at a nested timer firing.
2997         This patch helps finding cases like that using a 32ms long fixed window. Currently nested timers get dropped on the floor and
2998         we stop observing for content changes before they even get fired.
2999
3000         Test: fast/events/touch/ios/visibility-change-happens-on-timer-hops.html
3001
3002         * page/ios/ContentChangeObserver.cpp:
3003         (WebCore::ContentChangeObserver::ContentChangeObserver):
3004         (WebCore::ContentChangeObserver::startContentObservationForDuration):
3005         (WebCore::ContentChangeObserver::stopDurationBasedContentObservation):
3006         (WebCore::ContentChangeObserver::hasDeterminateState const):
3007         (WebCore::ContentChangeObserver::adjustObservedState):
3008         * page/ios/ContentChangeObserver.h:
3009         (WebCore::ContentChangeObserver::isObservingContentChanges const):
3010         (WebCore::ContentChangeObserver::hasPendingActivity const):
3011
3012 2019-03-04  Wenson Hsieh  <wenson_hsieh@apple.com>
3013
3014         Native text selection UI is incorrectly suppressed in Microsoft Visio
3015         https://bugs.webkit.org/show_bug.cgi?id=195178
3016         <rdar://problem/48519394>
3017
3018         Reviewed by Darin Adler.
3019
3020         Currently, our heuristics for detecting hidden editable areas attempt to search for empty parent renderers with
3021         "overflow: hidden". It does this by ascending the layer tree in search of renderers that have an empty content
3022         size, and whose renderers' styles indicate that they have overflow: hidden in the X or Y directions. This fails
3023         in the case where a child renderer is positioned out of flow, relative to one of its parent layers, since the
3024         child will be visible, but we'll incorrectly believe that it is hidden. This leads to selection UI unexpectedly
3025         disappearing in the online version of Microsoft Visio.
3026
3027         To fix this, we check whether the enclosing layer around the editable element has an empty clip rect; if the
3028         element is inside of a subframe, we additionally walk up to each enclosing frame's layer and check if that
3029         frame's layer has an empty clip rect.
3030
3031         Test: editing/selection/ios/do-not-hide-selection-in-visible-container.html
3032
3033         * rendering/RenderObject.cpp:
3034         (WebCore::RenderObject::isTransparentOrFullyClippedRespectingParentFrames const):
3035
3036 2019-03-01  Ryosuke Niwa  <rniwa@webkit.org>
3037
3038         gPictureOwnerMap is unnecessary
3039         https://bugs.webkit.org/show_bug.cgi?id=195228
3040
3041         Reviewed by Zalan Bujtas.
3042
3043         Just store in HTMLImageElement. An extra pointer isn't going to affect the memory use here.
3044         If anything, we should worry about m_editableImage and m_pendingClonedAttachmentID instead.
3045
3046         * html/HTMLImageElement.cpp:
3047         (WebCore::HTMLImageElement::pictureElement const):
3048         (WebCore::HTMLImageElement::setPictureElement):
3049         * html/HTMLImageElement.h:
3050
3051 2019-03-04  Daniel Bates  <dabates@apple.com>
3052
3053         [iOS] Caret x-position in empty text area does not match text field
3054         https://bugs.webkit.org/show_bug.cgi?id=195125
3055         <rdar://problem/47161070>
3056
3057         Remove the word "use" in the added comment to make it read well.
3058
3059         * css/html.css:
3060         (textarea):
3061
3062 2019-03-04  Joseph Pecoraro  <pecoraro@apple.com>
3063
3064         ITMLKit Inspector: Data Bindings / Associated Data for nodes
3065         https://bugs.webkit.org/show_bug.cgi?id=195290
3066         <rdar://problem/48304019>
3067
3068         Reviewed by Devin Rousso.
3069
3070         * inspector/agents/InspectorDOMAgent.h:
3071         * inspector/agents/InspectorDOMAgent.cpp:
3072         (WebCore::InspectorDOMAgent::getDataBindingsForNode):
3073         (WebCore::InspectorDOMAgent::getAssociatedDataForNode):
3074         Stub these for web pages, they will only be used for ITMLKit right now.
3075
3076 2019-03-04  Daniel Bates  <dabates@apple.com>
3077
3078         [iOS] Caret x-position in empty text area does not match text field
3079         https://bugs.webkit.org/show_bug.cgi?id=195125
3080         <rdar://problem/47161070>
3081
3082         Reviewed by Darin Adler.
3083
3084         Fix up User Agent styles for <textarea> on iOS such that they have the same left padding
3085         width and same text-indent as <input type="text">. This makes the x-position of the caret
3086         in an empty textarea match the position of the caret in an empty text field.
3087
3088         Test: fast/forms/textarea/ios/caret-x-position-in-textarea-matches-textfield.html
3089
3090         * css/html.css:
3091         (textarea): For iOS Family, do not use the padding shorthand property. Instead explicitly specify
3092         padding-top and padding-bottom to be 2px to keep our current behavior (because it looks reasonable)
3093         and do not specify left and right padding so that we inherit the padding set earlier in this file.
3094         (textarea::placeholder): Deleted. This was added to "try" to make fix up the position of the placeholder
3095         text so as to match the position of the textarea's inner text and the position of a text field's inner
3096         text. This fix up may have worked out visually when it was added, but based on the discovery of the
3097         hardcoded 3px left and right padding (see below remark) it looks like it was always one pixel too short.
3098         * html/HTMLTextAreaElement.cpp:
3099         (WebCore::HTMLTextAreaElement::createInnerTextStyle): Remove hardcoded 3px left and right padding.
3100
3101 2019-03-04  Youenn Fablet  <youenn@apple.com>
3102
3103         Make sure to correctly notify of end of a ServiceWorkerJob when the context is stopped
3104         https://bugs.webkit.org/show_bug.cgi?id=195195
3105
3106         Reviewed by Chris Dumez.
3107
3108         Before the patch, we were notifying that some jobs were finished too aggressively at context stop time.
3109         This was confusing the Network Process.
3110         Only notify such jobs that have pending loads.
3111         Improve the tracking of jobs doing registration resolution to ensure the Network Process gets notified
3112         in case of a registration promise being resolved but the settling callback being not yet called while the context is stopped.
3113
3114         Covered by existing tests not crashing anymore, in particular imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting.https.html.
3115
3116         * workers/service/ServiceWorkerContainer.cpp:
3117         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
3118         (WebCore::ServiceWorkerContainer::notifyRegistrationIsSettled):
3119         (WebCore::ServiceWorkerContainer::stop):
3120         * workers/service/ServiceWorkerContainer.h:
3121         * workers/service/ServiceWorkerJob.cpp:
3122         (WebCore::ServiceWorkerJob::cancelPendingLoad):
3123         * workers/service/ServiceWorkerJob.h:
3124         (WebCore::ServiceWorkerJob::isLoading const):
3125
3126 2019-03-04  Chris Dumez  <cdumez@apple.com>
3127
3128         [iOS] Improve our file picker
3129         https://bugs.webkit.org/show_bug.cgi?id=195284
3130         <rdar://problem/45655856>
3131
3132         Reviewed by Tim Horton and Wenson Hsieh.
3133
3134         Export UTIUtilities.h so that it can be used from WebKit2.
3135
3136         * WebCore.xcodeproj/project.pbxproj:
3137
3138 2019-03-04  Zalan Bujtas  <zalan@apple.com>
3139
3140         [ContentChangeObserver] Decouple mouseMoved event and the "is observing content change" status.
3141         https://bugs.webkit.org/show_bug.cgi?id=195286
3142
3143         Reviewed by Simon Fraser.
3144
3145         Now isObservingContentChanges returns true only when we are actively observing content change during timer firing and/or style recalculating.
3146         This patch also renames a couple of functions to follow the didStart/didFinish pattern.
3147
3148         * page/ios/ContentChangeObserver.cpp:
3149         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
3150         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
3151         (WebCore::ContentChangeObserver::styleRecalcDidStart):
3152         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
3153         (WebCore::ContentChangeObserver::mouseMovedDidStart):
3154         (WebCore::ContentChangeObserver::mouseMovedDidFinish):
3155         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
3156         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
3157         (WebCore::ContentChangeObserver::MouseMovedScope::MouseMovedScope):
3158         (WebCore::ContentChangeObserver::MouseMovedScope::~MouseMovedScope):
3159         (WebCore::ContentChangeObserver::StyleRecalcScope::StyleRecalcScope):
3160         (WebCore::ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope):
3161         (WebCore::ContentChangeObserver::DOMTimerScope::DOMTimerScope):
3162         (WebCore::ContentChangeObserver::DOMTimerScope::~DOMTimerScope):
3163         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute): Deleted.
3164         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute): Deleted.
3165         (WebCore::ContentChangeObserver::startObservingStyleRecalc): Deleted.
3166         (WebCore::ContentChangeObserver::stopObservingStyleRecalc): Deleted.
3167         (WebCore::ContentChangeObserver::startObservingMouseMoved): Deleted.
3168         (WebCore::ContentChangeObserver::stopObservingMouseMoved): Deleted.
3169         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc): Deleted.
3170         * page/ios/ContentChangeObserver.h:
3171         (WebCore::ContentChangeObserver::setShouldObserveDOMTimerScheduling):
3172         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling const):
3173         (WebCore::ContentChangeObserver::isObservingStyleRecalc const):
3174         (WebCore::ContentChangeObserver::isObservingContentChanges const):
3175         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling): Deleted.
3176         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling): Deleted.
3177         (WebCore::ContentChangeObserver::shouldObserveStyleRecalc const): Deleted.
3178
3179 2019-03-04  Yusuke Suzuki  <ysuzuki@apple.com>
3180
3181         [JSC] Offer @makeTypeError instead of exposing @TypeError
3182         https://bugs.webkit.org/show_bug.cgi?id=193858
3183
3184         Reviewed by Mark Lam.
3185
3186         Use @makeTypeError instead.
3187
3188         * Modules/mediastream/RTCPeerConnection.js:
3189         * Modules/mediastream/RTCPeerConnectionInternals.js:
3190         * Modules/streams/ReadableByteStreamInternals.js:
3191         (readableByteStreamControllerClose):
3192         (readableByteStreamControllerPullInto):
3193         * Modules/streams/ReadableStream.js:
3194         (cancel):
3195         (pipeTo):
3196         * Modules/streams/ReadableStreamBYOBReader.js:
3197         (cancel):
3198         (read):
3199         * Modules/streams/ReadableStreamDefaultReader.js:
3200         (cancel):
3201         (read):
3202         * Modules/streams/ReadableStreamInternals.js:
3203         (readableStreamReaderGenericRelease):
3204         * Modules/streams/WritableStream.js:
3205         (abort):
3206         (close):
3207         (write):
3208         (getter.closed):
3209         (getter.ready):
3210
3211 2019-03-04  Simon Fraser  <simon.fraser@apple.com>
3212
3213         Share more code between overflow and frame scrolling nodes, fixing overflow scrollbar display
3214         https://bugs.webkit.org/show_bug.cgi?id=195258
3215
3216         Reviewed by Antti Koivisto.
3217
3218         This patch moves management of scrollbar layers and scrollbar painters ("NSScrollerImp") down to
3219         ScrollingStateScrollingNode to be shared between frame and overflow nodes, allowing for
3220         scrolling thread updates of overflow scrollbars. It also moves some scrolling tree-side code
3221         to ScrollingTreeScrollingNodeDelegateMac to be shared between the "tree" nodes for overflow and frames.
3222
3223         Layers for scrollbars are given to scrolling state nodes via setNodeLayers() now, and
3224         RenderLayerCompositor::updateScrollingNodeLayers() is added to provide a bottleneck to call that.
3225         At some point AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() should be relieved
3226         of the responsibility of pushing scrollbar layers (but the scrolling state tree needs to hold
3227         references to GraphicsLayers before that becomes safe).
3228         
3229         The actual fix that allows overflow scrollbars to show is the change in
3230         AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() that calls scrollableArea.*ScrollbarLayerDidChange()
3231         for all ScrollableAreas. This ensures that the CALayer is pushed onto the NSScrollerImp.
3232
3233         * SourcesCocoa.txt:
3234         * WebCore.xcodeproj/project.pbxproj:
3235         * page/scrolling/AsyncScrollingCoordinator.cpp:
3236         (WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
3237         (WebCore::AsyncScrollingCoordinator::setNodeLayers):
3238         (WebCore::AsyncScrollingCoordinator::setFrameScrollingNodeState):
3239         (WebCore::AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
3240         * page/scrolling/ScrollingCoordinator.h:
3241         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
3242         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
3243         (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged):
3244         (WebCore::ScrollingStateFrameScrollingNode::setVerticalScrollbarLayer): Deleted.
3245         (WebCore::ScrollingStateFrameScrollingNode::setHorizontalScrollbarLayer): Deleted.
3246         (WebCore::ScrollingStateFrameScrollingNode::setScrollerImpsFromScrollbars): Deleted.
3247         * page/scrolling/ScrollingStateFrameScrollingNode.h:
3248         * page/scrolling/ScrollingStateScrollingNode.cpp:
3249         (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
3250         (WebCore::ScrollingStateScrollingNode::setAllPropertiesChanged):
3251         (WebCore::ScrollingStateScrollingNode::setHorizontalScrollbarLayer):
3252         (WebCore::ScrollingStateScrollingNode::setVerticalScrollbarLayer):
3253         (WebCore::ScrollingStateScrollingNode::setScrollerImpsFromScrollbars):
3254         * page/scrolling/ScrollingStateScrollingNode.h:
3255         (WebCore::ScrollingStateScrollingNode::horizontalScrollbarLayer const):
3256         (WebCore::ScrollingStateScrollingNode::verticalScrollbarLayer const):
3257         (WebCore::ScrollingStateScrollingNode::verticalScrollerImp const):
3258         (WebCore::ScrollingStateScrollingNode::horizontalScrollerImp const):
3259         * page/scrolling/ScrollingTree.cpp:
3260         (WebCore::ScrollingTree::setOrClearLatchedNode):
3261         (WebCore::ScrollingTree::handleWheelEvent):
3262         * page/scrolling/mac/ScrollingStateScrollingNodeMac.mm: Renamed from Source/WebCore/page/scrolling/mac/ScrollingStateFrameScrollingNodeMac.mm.
3263         (WebCore::ScrollingStateScrollingNode::setScrollerImpsFromScrollbars):
3264         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
3265         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3266         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
3267         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
3268         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers):
3269         (WebCore::ScrollingTreeFrameScrollingNodeMac::~ScrollingTreeFrameScrollingNodeMac): Deleted.
3270         (WebCore::ScrollingTreeFrameScrollingNodeMac::releaseReferencesToScrollerImpsOnTheMainThread): Deleted.
3271         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
3272         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
3273         (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateBeforeChildren):
3274         (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent):
3275         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionRelatedLayers):
3276         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
3277         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
3278         (WebCore::ScrollingTreeScrollingNodeDelegateMac::~ScrollingTreeScrollingNodeDelegateMac):
3279         (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateFromStateNode):
3280         (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent):
3281         (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateScrollbarPainters):
3282         (WebCore::ScrollingTreeScrollingNodeDelegateMac::releaseReferencesToScrollerImpsOnTheMainThread):
3283         * platform/ScrollbarThemeComposite.h:
3284         * rendering/RenderLayerCompositor.cpp:
3285         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
3286         (WebCore::RenderLayerCompositor::updateScrollingNodeLayers):
3287         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
3288         * rendering/RenderLayerCompositor.h:
3289
3290 2019-03-04  Jer Noble  <jer.noble@apple.com>
3291
3292         Remove HEVC as a codec requiring hardware support.
3293         https://bugs.webkit.org/show_bug.cgi?id=194960
3294         <rdar://problem/47741432>
3295
3296         Reviewed by Eric Carlson.
3297
3298         * page/cocoa/SettingsBaseCocoa.mm:
3299         (WebCore::SettingsBase::defaultMediaContentTypesRequiringHardwareSupport):
3300
3301 2019-03-04  Jer Noble  <jer.noble@apple.com>
3302
3303         [iOS] Fullscreen "stay in page" option breaks video playback
3304         https://bugs.webkit.org/show_bug.cgi?id=195277
3305         <rdar://problem/48537317>
3306
3307         Reviewed by Eric Carlson.
3308
3309         Add a LOG entry when playback is rejected due to media playback suspension.
3310
3311         * html/MediaElementSession.cpp:
3312         (WebCore::MediaElementSession::playbackPermitted const):
3313
3314 2019-03-04  Tim Horton  <timothy_horton@apple.com>
3315
3316         Fix the build.
3317
3318         * dom/Document.h:
3319
3320 2019-03-03  Zalan Bujtas  <zalan@apple.com>
3321
3322         [ContentChangeObserver] Content observation should be limited to the current document.
3323         https://bugs.webkit.org/show_bug.cgi?id=195256
3324         <rdar://problem/48544402>
3325
3326         Move ContentChangeObserver from Page to Document.
3327         It limits content observation to the target node's owner document.
3328
3329         Reviewed by Simon Fraser.
3330
3331         * dom/Document.cpp:
3332         (WebCore::m_contentChangeObserver):
3333         (WebCore::Document::updateStyleIfNeeded):
3334         (WebCore::Document::willDetachPage):
3335         (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
3336         (WebCore::m_undoManager): Deleted.
3337         * dom/Document.h:
3338         (WebCore::Document::contentChangeObserver):
3339         * page/DOMTimer.cpp:
3340         (WebCore::DOMTimer::install):
3341         (WebCore::DOMTimer::removeById):
3342         (WebCore::DOMTimer::fired):
3343         * page/Frame.cpp:
3344         (WebCore::Frame::willDetachPage):
3345         * page/Page.cpp:
3346         (WebCore::Page::Page):
3347         * page/Page.h:
3348         (WebCore::Page::pointerLockController const):
3349         (WebCore::Page::contentChangeObserver): Deleted.
3350         * page/ios/ContentChangeObserver.cpp:
3351         (WebCore::ContentChangeObserver::ContentChangeObserver):
3352         (WebCore::ContentChangeObserver::didInstallDOMTimer):
3353         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
3354         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
3355         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
3356         (WebCore::ContentChangeObserver::startObservingMouseMoved):
3357         (WebCore::ContentChangeObserver::hasDeterminateState const):
3358         (WebCore::ContentChangeObserver::adjustObservedState):
3359         (WebCore::ContentChangeObserver::notifyContentChangeIfNeeded):
3360         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
3361         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
3362         (WebCore::ContentChangeObserver::MouseMovedScope::MouseMovedScope):
3363         (WebCore::ContentChangeObserver::MouseMovedScope::~MouseMovedScope):
3364         (WebCore::ContentChangeObserver::StyleRecalcScope::StyleRecalcScope):
3365         (WebCore::ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope):
3366         (WebCore::ContentChangeObserver::DOMTimerScope::DOMTimerScope):
3367         (WebCore::ContentChangeObserver::DOMTimerScope::~DOMTimerScope):
3368         (WebCore::hasPendingStyleRecalc): Deleted.
3369         * page/ios/ContentChangeObserver.h:
3370         * page