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