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