[WebAudio] Release the AudioDestination when uninitializing DefaultAudioDestinationNode
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-01-18  Yacine Bandou  <yacine.bandou@softathome.com>
2
3         [WebAudio] Release the AudioDestination when uninitializing DefaultAudioDestinationNode
4         https://bugs.webkit.org/show_bug.cgi?id=192590
5
6         Reviewed by Philippe Normand.
7
8         When we uninitialize DefaultAudioDestinationNode, the AudioDestination is stopped but not destroyed.
9
10         On some platforms the resources are allocated and released with the AudioDestination, thus when we uninitialize
11         DefaultAudioDestinationNode we don't release resources because the AudioDestination is not destroyed.
12
13         * Modules/webaudio/DefaultAudioDestinationNode.cpp:
14         (WebCore::DefaultAudioDestinationNode::uninitialize):
15
16 2019-01-18  Yacine Bandou  <yacine.bandou@softathome.com>
17
18         [WebAudio] Call AudioContext::uninitialize() immediately when the AudioContext is stopped
19         https://bugs.webkit.org/show_bug.cgi?id=192586
20
21         Reviewed by Philippe Normand.
22
23         When WebProcess is killed, AudioContext::uninitialize() is not called immediately in the stop so
24         the AudioDestinationNode is not destroyed.
25
26         In my case, I have a resource device manager, the output audio device is reserved when AudioDestinationNode
27         is instantiated and it is released when AudioDestinationNode is destroyed, thus when the webprocess is killed,
28         the resources leak.
29
30         AudioContext::uninitialize() is not called immediately since r94608.
31         This modification can now be reverted without regression in WebAudio tests.
32
33         Test: webaudio/mediaelementaudiosourcenode-gc.html
34
35         * Modules/webaudio/AudioContext.cpp:
36         (WebCore::AudioContext::stop):
37
38 2019-01-18  Simon Fraser  <simon.fraser@apple.com>
39
40         ScrollingCoordinator::scrollableAreaScrollLayerDidChange() can be removed
41         https://bugs.webkit.org/show_bug.cgi?id=193559
42
43         Reviewed by Antti Koivisto.
44
45         ScrollingCoordinator::scrollableAreaScrollLayerDidChange() existed for CoordinatedGraphics,
46         but the code that used it was removed in webkit.org/r229318 so we can remove it and
47         code that calls it.
48
49         * page/scrolling/ScrollingCoordinator.h:
50         (WebCore::ScrollingCoordinator::willDestroyScrollableArea):
51         (WebCore::ScrollingCoordinator::scrollableAreaScrollLayerDidChange): Deleted.
52         * rendering/RenderLayerBacking.cpp:
53         (WebCore::RenderLayerBacking::updateGeometry):
54         * rendering/RenderLayerCompositor.cpp:
55         (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking):
56         (WebCore::RenderLayerCompositor::didAddScrollingLayer):
57         (WebCore::RenderLayerCompositor::scrollingLayerDidChange): Deleted.
58         * rendering/RenderLayerCompositor.h:
59
60 2019-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
61
62         [iOS] Content offset jumps erratically when autoscrolling near scroll view content inset areas
63         https://bugs.webkit.org/show_bug.cgi?id=193494
64         <rdar://problem/46859627>
65
66         Reviewed by Simon Fraser and Tim Horton.
67
68         When computing the content offset to scroll to when revealing a given rect in content coordinates, we currently
69         just use the unobscured content rect. As a result, when scrolling to reveal a rect, we'll clamp the final scroll
70         position such that only content is visible. For example, when asked to reveal the rect `(0, 0, 1, 1)`, we adjust
71         the scroll position to be the origin.
72
73         However, consider the case where a client (e.g. Mail on iOS) has added a content inset to the web view's scroll
74         view. If we're asked to reveal a rect that is outside the content area but within a content inset, we will still
75         end up clamping the scroll position to the unobscured rect. This manifests in a bug where selecting text and
76         autoscrolling in iOS Mail compose while the scroll view is scrolled all the way to the top to reveal the To/Cc/
77         Subject fields causes the content offset to jump to the origin, rather than staying at (0, -topContentInset).
78
79         To fix this, we teach `RenderLayer::scrollRectToVisible` about content insets that are visible. Rather than use
80         the content rects as-is, expand to encompass visible content insets as well. This ensures that revealing a
81         position which is already visible won't cause us to scroll away the content inset area and only show the
82         unobscured rect.
83
84         Tests:  editing/selection/ios/autoscroll-with-top-content-inset.html
85                 fast/scrolling/ios/scroll-into-view-with-top-content-inset.html
86
87         * page/FrameView.cpp:
88         (WebCore::FrameView::unobscuredContentRectExpandedByContentInsets const):
89
90         Introduce a helper method that expands the unobscured content rect to include surrounding content insets.
91
92         * page/FrameView.h:
93         * page/Page.h:
94         (WebCore::Page::contentInsets const):
95         (WebCore::Page::setContentInsets):
96         * rendering/RenderLayer.cpp:
97         (WebCore::RenderLayer::scrollRectToVisible):
98         (WebCore::RenderLayer::getRectToExpose const):
99
100 2019-01-17  Truitt Savell  <tsavell@apple.com>
101
102         Unreviewed, rolling out r240124.
103
104         This commit broke an internal build.
105
106         Reverted changeset:
107
108         "SDK_VARIANT build destinations should be separate from non-
109         SDK_VARIANT builds"
110         https://bugs.webkit.org/show_bug.cgi?id=189553
111         https://trac.webkit.org/changeset/240124
112
113 2019-01-17  Devin Rousso  <drousso@apple.com>
114
115         Web Inspector: fix Xcode project file list after r239976
116         https://bugs.webkit.org/show_bug.cgi?id=193474
117
118         Reviewed by Timothy Hatcher.
119
120         * WebCore.xcodeproj/project.pbxproj:
121
122 2019-01-17  Ross Kirsling  <ross.kirsling@sony.com>
123
124         Unreviewed WinCairo fix -- hundreds of tests crash after r240031.
125
126         * platform/network/curl/ResourceHandleCurl.cpp:
127         (WebCore::ResourceHandle::createCurlRequest):
128         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
129         (WebCore::ResourceHandle::receivedCredential):
130         (WebCore::ResourceHandle::getCredential):
131
132 2019-01-17  John Wilander  <wilander@apple.com>
133
134         Add infrastructure to enable/disable ITP Debug Mode through Preferences
135         https://bugs.webkit.org/show_bug.cgi?id=193510
136         <rdar://problem/47330969>
137
138         Reviewed by Dean Jackson.
139
140         No new tests. These changes are purely for settings/preferences.
141
142         * page/RuntimeEnabledFeatures.h:
143         (WebCore::RuntimeEnabledFeatures::setItpDebugModeEnabled):
144         (WebCore::RuntimeEnabledFeatures::itpDebugModeEnabled const):
145         (WebCore::RuntimeEnabledFeatures::setResourceLoadStatisticsDebugMode): Deleted.
146         (WebCore::RuntimeEnabledFeatures::resourceLoadStatisticsDebugMode const): Deleted.
147             Renamed.
148         * page/Settings.yaml:
149             Removed since this particular setting should not be persisted for privacy
150             reasons.
151
152 2019-01-17  Jer Noble  <jer.noble@apple.com>
153
154         SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds
155         https://bugs.webkit.org/show_bug.cgi?id=189553
156
157         Reviewed by Tim Horton.
158
159         * Configurations/Base.xcconfig:
160         * Configurations/SDKVariant.xcconfig: Added.
161         * Configurations/WebCore.xcconfig:
162
163 2019-01-17  Jer Noble  <jer.noble@apple.com>
164
165         MediaPlayerPrivateAVFoundationObjC can return incorrect paused information
166         https://bugs.webkit.org/show_bug.cgi?id=193499
167
168         Reviewed by Eric Carlson.
169
170         MediaPlayerPrivateAVFoundation uses rate() as an indicator of whether the player
171         is paused or not. This is incorrect when playback is stalled waiting for more data.
172         For MPPAVFObjC, use the timeControlStatus as a more accurate indicator of whether
173         the player is playing.
174
175         Now that we have correct play state information, we can remove the handlePlaybackCommand()
176         path when playing remotely for a more direct approach of notifying the HTMLMediaElement
177         that the play state has changed.
178
179         Drive-by fix: Before throwing away the AVPlayer, clear its output context. This keeps
180         remote devices from keeping the AVPlayer alive.
181
182         Drive-by fix #2: The NullMediaPlayer should always return "true" for paused(), not "false",
183         since it can't possibly play anything.
184
185         * platform/graphics/MediaPlayer.cpp:
186         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
187         (WebCore::MediaPlayerPrivateAVFoundation::paused const):
188         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
189         (WebCore::MediaPlayerPrivateAVFoundation::platformPaused const):
190         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
191         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
192         (WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad):
193         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformPaused const):
194         (WebCore::MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange):
195
196 2019-01-17  Jiewen Tan  <jiewen_tan@apple.com>
197
198         [Mac] Add a new quirk to HTMLFormControlElement::isMouseFocusable
199         https://bugs.webkit.org/show_bug.cgi?id=193478
200         <rdar://problem/34368591>
201
202         Reviewed by Brent Fulgham.
203
204         By default in macOS, submit buttons (controls) are not focusable. WebKit follows this system convention
205         as suggested by the spec: https://html.spec.whatwg.org/multipage/interaction.html#focusable-area. This
206         is also the convention Firefox respects. However, Chrome doesn't. ceac.state.gov is by far the only
207         website that assumes submit buttons are focusable, and will prohibit users from completing immigration
208         forms, such as DS160 if buttons are not. To help immigrations, we decide to add a new quirk to
209         HTMLFormControlElement::isMouseFocusable such that submit buttons are mouse focusable.
210
211         This quirk is for ceac.state.gov specifically, and therefore no tests.
212
213         * html/HTMLFormControlElement.cpp:
214         (WebCore::HTMLFormControlElement::isMouseFocusable const):
215         (WebCore::HTMLFormControlElement::needsSiteSpecificQuirks const):
216         * html/HTMLFormControlElement.h:
217
218 2019-01-17  Alex Christensen  <achristensen@webkit.org>
219
220         Fix WinCairo build after r240117
221         https://bugs.webkit.org/show_bug.cgi?id=193529
222
223         * PlatformWin.cmake:
224         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
225
226 2019-01-17  Youenn Fablet  <youenn@apple.com>
227
228         Add release logging for incoming and outgoing webrtc audio tracks
229         https://bugs.webkit.org/show_bug.cgi?id=185545
230
231         Reviewed by Eric Carlson.
232
233         Add logging of audio tracks. When doing a WebRTC call,
234         one log line is added each second for each audio track.
235         Validated that logging is done through manual testing.
236
237         Refactored code to use LogHelper and apply it to video sources as well.
238
239         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
240         (WebCore::LibWebRTCMediaEndpoint::addTrack):
241         (WebCore::LibWebRTCMediaEndpoint::sourceFromNewReceiver):
242         (WebCore::sourceFromNewReceiver): Deleted.
243         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
244         * platform/mediastream/RealtimeIncomingAudioSource.cpp:
245         (WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource):
246         (WebCore::RealtimeIncomingAudioSource::logChannel const):
247         (WebCore::RealtimeIncomingAudioSource::logger const):
248         * platform/mediastream/RealtimeIncomingAudioSource.h:
249         (WebCore::RealtimeIncomingAudioSource::setLogger):
250         * platform/mediastream/RealtimeIncomingVideoSource.cpp:
251         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
252         (WebCore::RealtimeIncomingVideoSource::logChannel const):
253         (WebCore::RealtimeIncomingVideoSource::logger const):
254         * platform/mediastream/RealtimeIncomingVideoSource.h:
255         (WebCore::RealtimeIncomingVideoSource::setLogger):
256         * platform/mediastream/RealtimeOutgoingAudioSource.cpp:
257         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
258         (WebCore::RealtimeOutgoingAudioSource::sendAudioFrames):
259         (WebCore::RealtimeOutgoingAudioSource::logChannel const):
260         (WebCore::RealtimeOutgoingAudioSource::logger const):
261         * platform/mediastream/RealtimeOutgoingAudioSource.h:
262         (WebCore::RealtimeOutgoingAudioSource::setLogger):
263         * platform/mediastream/RealtimeOutgoingVideoSource.cpp:
264         (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
265         (WebCore::RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded):
266         (WebCore::RealtimeOutgoingVideoSource::sendOneBlackFrame):
267         (WebCore::RealtimeOutgoingVideoSource::logChannel const):
268         (WebCore::RealtimeOutgoingVideoSource::logger const):
269         * platform/mediastream/RealtimeOutgoingVideoSource.h:
270         (WebCore::RealtimeOutgoingVideoSource::setLogger):
271         * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:
272         (WebCore::RealtimeIncomingAudioSourceCocoa::OnData):
273         * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.h:
274         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
275         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferPool):
276         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
277         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
278         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp:
279         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
280         (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated):
281         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm:
282         (WebCore::RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer):
283
284 2019-01-17  Alex Christensen  <achristensen@webkit.org>
285
286         Stop using NetworkStorageSession::storageSession in WebCore
287         https://bugs.webkit.org/show_bug.cgi?id=193529
288
289         Reviewed by Tim Horton.
290
291         Ownership of the map that NetworkStorageSession::storageSession searches needs to move to the WebKit/WebKitLegacy layer,
292         so when WebCore used to look in this map it needs to call a client function to ask the layer above it for the storage object.
293         I've called this client StorageSessionProvider::storageSession.  Right now it just looks in NetworkStorageSession::storageSession,
294         but this added abstraction makes it possible to move the currently process-global map to be a member of the NetworkProcess object.
295
296         * Modules/websockets/WebSocketChannel.cpp:
297         (WebCore::WebSocketChannel::connect):
298         * WebCore.xcodeproj/project.pbxproj:
299         * loader/CookieJar.cpp:
300         (WebCore::CookieJar::create):
301         (WebCore::CookieJar::CookieJar):
302         (WebCore::CookieJar::cookies const):
303         (WebCore::CookieJar::setCookies):
304         (WebCore::CookieJar::cookiesEnabled const):
305         (WebCore::CookieJar::cookieRequestHeaderFieldValue const):
306         (WebCore::CookieJar::getRawCookies const):
307         (WebCore::CookieJar::deleteCookie):
308         * loader/CookieJar.h:
309         * loader/EmptyClients.cpp:
310         (WebCore::pageConfigurationWithEmptyClients):
311         * page/Page.h:
312         * page/SocketProvider.cpp:
313         (WebCore::SocketProvider::createSocketStreamHandle):
314         * page/SocketProvider.h:
315         * platform/network/NetworkingContext.h:
316         * platform/network/SocketStreamHandleImpl.cpp:
317         (WebCore::cookieDataForHandshake):
318         (WebCore::SocketStreamHandleImpl::platformSendHandshake):
319         * platform/network/StorageSessionProvider.h: Added.
320         (WebCore::StorageSessionProvider::~StorageSessionProvider):
321         * platform/network/cf/SocketStreamHandleImpl.h:
322         (WebCore::SocketStreamHandleImpl::create):
323         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
324         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
325         (WebCore::SocketStreamHandleImpl::getStoredCONNECTProxyCredentials):
326         * platform/network/curl/SocketStreamHandleImpl.h:
327         (WebCore::SocketStreamHandleImpl::create):
328         * platform/network/soup/SocketStreamHandleImpl.h:
329         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
330         (WebCore::SocketStreamHandleImpl::create):
331
332 2019-01-17  Jon Lee  <jonlee@apple.com>
333
334         [EME] Remove Amazon Prime Video from quirks list
335         https://bugs.webkit.org/show_bug.cgi?id=193514
336         rdar://problem/47295330
337
338         Reviewed by Jer Noble.
339
340         * page/Quirks.cpp:
341         (WebCore::Quirks::hasBrokenEncryptedMediaAPISupportQuirk const):
342
343 2019-01-17  Zalan Bujtas  <zalan@apple.com>
344
345         [LFC][BFC] An element with transform is a containing block for positioned descendants.
346         https://bugs.webkit.org/show_bug.cgi?id=193534
347
348         Reviewed by Antti Koivisto.
349
350         "For elements whose layout is governed by the CSS box model, any value other than none for the transform
351         property also causes the element to establish a containing block for all descendants."
352         https://www.w3.org/TR/css-transforms-1/
353
354         * layout/layouttree/LayoutBox.cpp:
355         (WebCore::Layout::Box::containingBlock const):
356
357 2019-01-17  Simon Fraser  <simon.fraser@apple.com>
358
359         ScrollingCoordinator: separate updating node geometry from node layers
360         https://bugs.webkit.org/show_bug.cgi?id=193527
361
362         Reviewed by Antti Koivisto.
363
364         Updating scrolling tree node layers happens in a different code path from updating geometry;
365         the former has to be post-flush, when GraphicsLayer has made tiled or structural layers.
366         Geometry only needs to be updated after layout, and soon we'll do this via compositing updates.
367         
368         We can also clean up the ScrollingCoordinator API and have a single function that updates
369         node layers (handling different node types), and separate functions for pushing viewport-constrained
370         and scrolling node geometry.
371
372         No observable behavior change.
373
374         * page/scrolling/AsyncScrollingCoordinator.cpp:
375         (WebCore::AsyncScrollingCoordinator::setNodeLayers):
376         (WebCore::AsyncScrollingCoordinator::setScrollingNodeGeometry):
377         (WebCore::AsyncScrollingCoordinator::setViewportConstraintedNodeGeometry):
378         (WebCore::AsyncScrollingCoordinator::updateFrameScrollingNode): Deleted.
379         (WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode): Deleted.
380         (WebCore::AsyncScrollingCoordinator::updateNodeLayer): Deleted.
381         (WebCore::AsyncScrollingCoordinator::updateNodeViewportConstraints): Deleted.
382         * page/scrolling/AsyncScrollingCoordinator.h:
383         * page/scrolling/ScrollingCoordinator.h:
384         (WebCore::ScrollingCoordinator::setNodeLayers):
385         (WebCore::ScrollingCoordinator::setScrollingNodeGeometry):
386         (WebCore::ScrollingCoordinator::setViewportConstraintedNodeGeometry):
387         (WebCore::ScrollingCoordinator::updateNodeLayer): Deleted.
388         (WebCore::ScrollingCoordinator::updateNodeViewportConstraints): Deleted.
389         (WebCore::ScrollingCoordinator::updateFrameScrollingNode): Deleted.
390         (WebCore::ScrollingCoordinator::updateOverflowScrollingNode): Deleted.
391         * rendering/RenderLayerCompositor.cpp:
392         (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame):
393         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
394         * rendering/RenderLayerCompositor.h:
395
396 2019-01-17  Zalan Bujtas  <zalan@apple.com>
397
398         [LFC][BFC][Quirk] Take body padding and border into account when stretching height.
399         https://bugs.webkit.org/show_bug.cgi?id=193528
400
401         Reviewed by Antti Koivisto.
402
403         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
404         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
405         * layout/displaytree/DisplayBox.h:
406         (WebCore::Display::Box::verticalBorder const):
407         (WebCore::Display::Box::horizontalBorder const):
408         (WebCore::Display::Box::verticalPadding const):
409         (WebCore::Display::Box::horizontalPadding const):
410         * page/FrameViewLayoutContext.cpp:
411         (WebCore::layoutUsingFormattingContext):
412
413 2019-01-17  Zalan Bujtas  <zalan@apple.com>
414
415         [LFC][BFC] For height computation, the bottom edge of the last line box value should not include top border/padding
416         https://bugs.webkit.org/show_bug.cgi?id=193520
417
418         Reviewed by Antti Koivisto.
419
420         This is similar to the other "10.6.3" cases. The bottom edge of the last inline box is in the coordinate systyem
421         of the containing block's border box (and for content height computation it needs to be mapped to the containing block's content box instead).
422
423         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
424         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
425
426 2019-01-16  Simon Fraser  <simon.fraser@apple.com>
427
428         Stub out scrolling tree classes for overflow scrolling nodes on macOS
429         https://bugs.webkit.org/show_bug.cgi?id=193524
430
431         Reviewed by Antti Koivisto.
432
433         Add an empty implementation of ScrollingTreeOverflowScrollingNodeMac for macOS. Change
434         ScrollingTreeMac::createScrollingTreeNode() to create these nodes.
435         
436         Minor refactor of RenderLayerCompositor::useCoordinatedScrollingForLayer() code to ask
437         the scrolling coordinator if it can coordinate scrolling for this layer; no behavior
438         change for existing code paths.
439
440         * SourcesCocoa.txt:
441         * WebCore.xcodeproj/project.pbxproj:
442         * page/scrolling/ScrollingCoordinator.cpp:
443         (WebCore::ScrollingCoordinator::coordinatesScrollingForOverflowLayer const):
444         * page/scrolling/ScrollingCoordinator.h:
445         * page/scrolling/mac/ScrollingStateFrameScrollingNodeMac.mm:
446         * page/scrolling/mac/ScrollingTreeMac.cpp:
447         (ScrollingTreeMac::createScrollingTreeNode):
448         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h: Copied from Source/WebCore/page/scrolling/mac/ScrollingStateFrameScrollingNodeMac.mm.
449         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm: Added.
450         (WebCore::ScrollingTreeOverflowScrollingNodeMac::create):
451         (WebCore::ScrollingTreeOverflowScrollingNodeMac::ScrollingTreeOverflowScrollingNodeMac):
452         (WebCore::ScrollingTreeOverflowScrollingNodeMac::~ScrollingTreeOverflowScrollingNodeMac):
453         (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateBeforeChildren):
454         (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateAfterChildren):
455         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange):
456         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const):
457         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition):
458         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterDelegatedScroll):
459         * rendering/RenderLayer.cpp:
460         (WebCore::RenderLayer::usesAsyncScrolling const):
461         * rendering/RenderLayerCompositor.cpp:
462         (WebCore::RenderLayerCompositor::useCoordinatedScrollingForLayer const):
463         * rendering/RenderLayerCompositor.h:
464
465 2019-01-16  Justin Fan  <justin_fan@apple.com>
466
467         [WebGPU] Update vertex-buffer-triangle-strip.html to actually use vertex buffer
468         https://bugs.webkit.org/show_bug.cgi?id=193473
469
470         Reviewed by Dean Jackson and Myles Maxfield.
471
472         Also, switch to using the inputSlot instead of the shaderLocation field, as this seems more correct. 
473         As of now I cannot determine an analog for WebGPU's shaderLocation in Metal. 
474
475         Test: Covered by vertex-buffer-triangle-strip.html. No change in behavior.
476
477         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
478         (WebCore::setInputStateForPipelineDescriptor): Use the inputSlot instead of shaderLocation as bufferIndex. 
479
480 2019-01-16  Myles C. Maxfield  <mmaxfield@apple.com>
481
482         [WHLSL] Add the function stage checker
483         https://bugs.webkit.org/show_bug.cgi?id=193479
484
485         Reviewed by Dean Jackson and Robin Morisset.
486
487         This is a translation of https://github.com/gpuweb/WHLSL/blob/master/Source/CheckNativeFuncStages.mjs into C++.
488
489         No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
490         of test. When enough of the compiler is present, I'll port the reference implementation's test suite.
491
492         * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:
493         (WebCore::WHLSL::AST::CallExpression::function):
494         * Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.cpp: Added.
495         (WebCore::WHLSL::FunctionStageChecker::FunctionStageChecker):
496         (WebCore::WHLSL::checkFunctionStages):
497         * Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.h: Added.
498         * Modules/webgpu/WHLSL/WHLSLIntrinsics.cpp:
499         (WebCore::WHLSL::Intrinsics::add):
500         * Modules/webgpu/WHLSL/WHLSLIntrinsics.h:
501         (WebCore::WHLSL::Intrinsics::ddx const):
502         (WebCore::WHLSL::Intrinsics::ddy const):
503         (WebCore::WHLSL::Intrinsics::allMemoryBarrier const):
504         (WebCore::WHLSL::Intrinsics::deviceMemoryBarrier const):
505         (WebCore::WHLSL::Intrinsics::groupMemoryBarrier const):
506         (WebCore::WHLSL::Intrinsics::WTF_ARRAY_LENGTH):
507         * Sources.txt:
508         * WebCore.xcodeproj/project.pbxproj:
509
510 2019-01-16  Myles C. Maxfield  <mmaxfield@apple.com>
511
512         [WHLSL] Delete the 'restricted' keyword
513         https://bugs.webkit.org/show_bug.cgi?id=193469
514
515         Reviewed by Dean Jackson and Robin Morisset.
516
517         This change mirrors https://github.com/gpuweb/WHLSL/pull/304 in the reference implementation.
518
519         No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
520         of test. When enough of the compiler is present, I'll port the reference implementation's test suite.
521
522         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h:
523         (WebCore::WHLSL::AST::FunctionDefinition::FunctionDefinition):
524         (WebCore::WHLSL::AST::FunctionDefinition::block):
525         (WebCore::WHLSL::AST::FunctionDefinition::restricted const): Deleted.
526         * Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h:
527         (WebCore::WHLSL::AST::NativeFunctionDeclaration::NativeFunctionDeclaration):
528         (WebCore::WHLSL::AST::NativeFunctionDeclaration::restricted const): Deleted.
529         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
530         (WebCore::WHLSL::resolveWithOperatorAnderIndexer):
531         (WebCore::WHLSL::resolveWithOperatorLength):
532         (WebCore::WHLSL::resolveWithReferenceComparator):
533         * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp:
534         (WebCore::WHLSL::resolveFunctionOverloadImpl):
535         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
536         (WebCore::WHLSL::synthesizeArrayOperatorLength):
537         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
538         (WebCore::WHLSL::synthesizeConstructors):
539         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
540         (WebCore::WHLSL::synthesizeEnumerationFunctions):
541         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
542         (WebCore::WHLSL::synthesizeStructureAccessors):
543
544 2019-01-16  Myles C. Maxfield  <mmaxfield@apple.com>
545
546         [WHLSL] Implement the recursion checker
547         https://bugs.webkit.org/show_bug.cgi?id=193436
548
549         Reviewed by Saam Barati.
550
551         This is a translation of https://github.com/gpuweb/WHLSL/blob/master/Source/RecursionChecker.mjs into C++.
552
553         No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
554         of test. When enough of the compiler is present, I'll port the reference implementation's test suite.
555
556         * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:
557         (WebCore::WHLSL::AST::CallExpression::function):
558         * Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp: Copied from Source/WebCore/Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp.
559         (WebCore::WHLSL::checkRecursion):
560         * Modules/webgpu/WHLSL/WHLSLRecursionChecker.h: Added.
561         * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp:
562         * Sources.txt:
563         * WebCore.xcodeproj/project.pbxproj:
564
565 2019-01-16  Myles C. Maxfield  <mmaxfield@apple.com>
566
567         [WHLSL] Add the literal type checker
568         https://bugs.webkit.org/show_bug.cgi?id=193430
569
570         Reviewed by Dean Jackson.
571
572         This is a translation of https://github.com/gpuweb/WHLSL/blob/master/Source/LiteralTypeChecker.mjs into C++.
573
574         No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
575         of test. When enough of the compiler is present, I'll port the reference implementation's test suite.
576
577         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h:
578         (WebCore::WHLSL::AST::FloatLiteralType::value const):
579         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h:
580         (WebCore::WHLSL::AST::IntegerLiteralType::value const):
581         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h:
582         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::value const):
583         * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp: Added.
584         (WebCore::WHLSL::getNativeTypeDeclaration):
585         (WebCore::WHLSL::LiteralTypeChecker::visit):
586         (WebCore::WHLSL::checkLiteralTypes):
587         * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h.
588         * Sources.txt:
589         * WebCore.xcodeproj/project.pbxproj:
590
591 2019-01-16  Zalan Bujtas  <zalan@apple.com>
592
593         [LFC][BFC] Inflow non-replaced used width should not be negative.
594         https://bugs.webkit.org/show_bug.cgi?id=193495
595
596         Reviewed by Antti Koivisto.
597
598         min-width (initial value 0) enforces non-negative used width. 
599
600         * layout/blockformatting/BlockFormattingContext.cpp:
601         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
602
603 2019-01-16  Myles C. Maxfield  <mmaxfield@apple.com>
604
605         [WHLSL] Add a handwritten parser
606         https://bugs.webkit.org/show_bug.cgi?id=192355
607
608         Reviewed by Dean Jackson.
609
610         The parser is a mechanical representation of WHLSL's ANTLR grammar at
611         https://github.com/gpuweb/WHLSL/blob/master/Spec/WHLSL.g4. The parser
612         uses Expected<> to return an appropriate Error string when parsing fails.
613
614         This patch doesn't include the AST nodes themselves - those are in
615         https://bugs.webkit.org/show_bug.cgi?id=192991. I split up the patch to
616         aid easier reviewing.
617
618         No new tests because the parser isn't hooked up yet.
619
620         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
621         (WebCore::WHLSL::Parser::Parser):
622         (WebCore::WHLSL::Parser::parse):
623         (WebCore::WHLSL::Parser::fail):
624         (WebCore::WHLSL::Parser::peek):
625         (WebCore::WHLSL::Parser::tryType):
626         (WebCore::WHLSL::Parser::tryTypes):
627         (WebCore::WHLSL::Parser::consumeType):
628         (WebCore::WHLSL::Parser::consumeTypes):
629         (WebCore::WHLSL::digitValue):
630         (WebCore::WHLSL::intLiteralToInt):
631         (WebCore::WHLSL::uintLiteralToUint):
632         (WebCore::WHLSL::floatLiteralToFloat):
633         (WebCore::WHLSL::Parser::consumeIntegralLiteral):
634         (WebCore::WHLSL::Parser::consumeNonNegativeIntegralLiteral):
635         (WebCore::WHLSL::recognizeSimpleUnsignedInteger):
636         (WebCore::WHLSL::Parser::parseConstantExpression):
637         (WebCore::WHLSL::Parser::parseTypeArgument):
638         (WebCore::WHLSL::Parser::parseTypeArguments):
639         (WebCore::WHLSL::Parser::parseTypeSuffixAbbreviated):
640         (WebCore::WHLSL::Parser::parseTypeSuffixNonAbbreviated):
641         (WebCore::WHLSL::Parser::parseAddressSpaceType):
642         (WebCore::WHLSL::Parser::parseNonAddressSpaceType):
643         (WebCore::WHLSL::Parser::parseType):
644         (WebCore::WHLSL::Parser::parseTypeDefinition):
645         (WebCore::WHLSL::Parser::parseBuiltInSemantic):
646         (WebCore::WHLSL::Parser::parseResourceSemantic):
647         (WebCore::WHLSL::Parser::parseSpecializationConstantSemantic):
648         (WebCore::WHLSL::Parser::parseStageInOutSemantic):
649         (WebCore::WHLSL::Parser::parseSemantic):
650         (WebCore::WHLSL::Parser::parseQualifiers):
651         (WebCore::WHLSL::Parser::parseStructureElement):
652         (WebCore::WHLSL::Parser::parseStructureDefinition):
653         (WebCore::WHLSL::Parser::parseEnumerationDefinition):
654         (WebCore::WHLSL::Parser::parseEnumerationMember):
655         (WebCore::WHLSL::Parser::parseNativeTypeDeclaration):
656         (WebCore::WHLSL::Parser::parseNumThreadsFunctionAttribute):
657         (WebCore::WHLSL::Parser::parseAttributeBlock):
658         (WebCore::WHLSL::Parser::parseParameter):
659         (WebCore::WHLSL::Parser::parseParameters):
660         (WebCore::WHLSL::Parser::parseFunctionDefinition):
661         (WebCore::WHLSL::Parser::parseEntryPointFunctionDeclaration):
662         (WebCore::WHLSL::Parser::parseRegularFunctionDeclaration):
663         (WebCore::WHLSL::Parser::parseOperatorFunctionDeclaration):
664         (WebCore::WHLSL::Parser::parseFunctionDeclaration):
665         (WebCore::WHLSL::Parser::parseNativeFunctionDeclaration):
666         (WebCore::WHLSL::Parser::parseBlock):
667         (WebCore::WHLSL::Parser::parseBlockBody):
668         (WebCore::WHLSL::Parser::parseIfStatement):
669         (WebCore::WHLSL::Parser::parseSwitchStatement):
670         (WebCore::WHLSL::Parser::parseSwitchCase):
671         (WebCore::WHLSL::Parser::parseForLoop):
672         (WebCore::WHLSL::Parser::parseWhileLoop):
673         (WebCore::WHLSL::Parser::parseDoWhileLoop):
674         (WebCore::WHLSL::Parser::parseVariableDeclaration):
675         (WebCore::WHLSL::Parser::parseVariableDeclarations):
676         (WebCore::WHLSL::Parser::parseStatement):
677         (WebCore::WHLSL::Parser::parseEffectfulExpression):
678         (WebCore::WHLSL::Parser::parseEffectfulAssignment):
679         (WebCore::WHLSL::Parser::parseEffectfulPrefix):
680         (WebCore::WHLSL::Parser::parseEffectfulSuffix):
681         (WebCore::WHLSL::Parser::parseLimitedSuffixOperator):
682         (WebCore::WHLSL::Parser::parseSuffixOperator):
683         (WebCore::WHLSL::Parser::parseExpression):
684         (WebCore::WHLSL::Parser::parseTernaryConditional):
685         (WebCore::WHLSL::Parser::parseAssignment):
686         (WebCore::WHLSL::Parser::parsePossibleTernaryConditional):
687         (WebCore::WHLSL::Parser::parsePossibleLogicalBinaryOperation):
688         (WebCore::WHLSL::Parser::parsePossibleRelationalBinaryOperation):
689         (WebCore::WHLSL::Parser::parsePossibleShift):
690         (WebCore::WHLSL::Parser::parsePossibleAdd):
691         (WebCore::WHLSL::Parser::parsePossibleMultiply):
692         (WebCore::WHLSL::Parser::parsePossiblePrefix):
693         (WebCore::WHLSL::Parser::parsePossibleSuffix):
694         (WebCore::WHLSL::Parser::parseCallExpression):
695         (WebCore::WHLSL::Parser::parseTerm):
696         * Modules/webgpu/WHLSL/WHLSLParser.h:
697         (WebCore::WHLSL::Parser::Error::Error):
698         (WebCore::WHLSL::Parser::backtrackingScope):
699         (WebCore::WHLSL::Parser::SuffixExpression::SuffixExpression):
700         (WebCore::WHLSL::Parser::SuffixExpression::operator bool const):
701
702 2019-01-16  Sihui Liu  <sihui_liu@apple.com>
703
704         IndexedDB: UniqueIDBDatabase should not be freed if the database task queue is not empty.
705         https://bugs.webkit.org/show_bug.cgi?id=193093
706
707         Reviewed by Brady Eidson.
708
709         performUnconditionalDeleteBackingStore killed the database task queue immediately, but performPrefetchCursor
710         task may be scheduled behind performUnconditionalDeleteBackingStore on database thread.
711
712         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
713         (WebCore::IDBServer::UniqueIDBDatabase::shutdownForClose):
714         (WebCore::IDBServer::UniqueIDBDatabase::performPrefetchCursor):
715         (WebCore::IDBServer::UniqueIDBDatabase::isDoneWithHardClose):
716
717 2019-01-16  Alex Christensen  <achristensen@webkit.org>
718
719         Internal build fix.
720
721         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
722         (WebCore::layerContentsFormat):
723
724 2019-01-16  Youenn Fablet  <youenn@apple.com>
725
726         ServiceWorkerContainer is leaking due to a ref cycle
727         https://bugs.webkit.org/show_bug.cgi?id=193462
728         <rdar://problem/47026303>
729
730         Reviewed by Brady Eidson.
731
732         ServiceWorkerContainer keeps a reference to its ready promise.
733         The ready promise keeps a ref to its value which is a ServiceWorkerRegistration.
734         ServiceWorkerRegistration keeps a ref to ServiceWorkerContainer.
735
736         To break the reference cycle, set the ready promise to zero when ServiceWorkerContainer is stopped.
737
738         Covered by imported/w3c/web-platform-tests/service-workers/service-worker/ready.https.html no longer leaking.
739
740         * workers/service/ServiceWorkerContainer.cpp:
741         (WebCore::ServiceWorkerContainer::stop):
742
743 2019-01-15  Simon Fraser  <simon.fraser@apple.com>
744
745         Make didCommitChangesForLayer() explicitly about the platform layer changing because of tile/non-tile swapping
746         https://bugs.webkit.org/show_bug.cgi?id=193290
747
748         Reviewed by Tim Horton.
749
750         RenderLayerCompositor::didFlushChangesForLayer() triggers updates scrolling tree nodes for
751         the flushed layer, but it's not clear what has changed at this point.
752
753         didCommitChangesForLayer()/didFlushChangesForLayer() were added to explicitly handle the
754         case where the underlying platform layer for a GraphicsLayer changes because the layer swaps
755         between tiled and non-tiled, and structural layer changes; we need to push the new layer to
756         the scrolling tree because it operates on platform layers. So the only work that
757         didFlushChangesForLayer() should do is to update layers on scrolling tree nodes; it doesn't
758         need to do any geometry updating. Move towards that goal by renaming this callback to
759         didChangePlatformLayerForLayer() to make its function more explicit.
760
761         * platform/graphics/GraphicsLayerClient.h:
762         (WebCore::GraphicsLayerClient::didChangePlatformLayerForLayer):
763         (WebCore::GraphicsLayerClient::didCommitChangesForLayer const): Deleted.
764         * platform/graphics/ca/GraphicsLayerCA.cpp:
765         (WebCore::GraphicsLayerCA::flushCompositingStateForThisLayerOnly):
766         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
767         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
768         * platform/graphics/ca/GraphicsLayerCA.h:
769         * rendering/RenderLayerBacking.cpp:
770         (WebCore::RenderLayerBacking::didChangePlatformLayerForLayer):
771         (WebCore::RenderLayerBacking::didCommitChangesForLayer const): Deleted.
772         * rendering/RenderLayerBacking.h:
773         * rendering/RenderLayerCompositor.cpp:
774         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
775         (WebCore::LegacyWebKitScrollingLayerCoordinator::didChangePlatformLayerForLayer):
776         (WebCore::RenderLayerCompositor::didFlushChangesForLayer): Deleted.
777         (WebCore::RenderLayerCompositor::didCommitChangesForLayer const): Deleted.
778         (WebCore::LegacyWebKitScrollingLayerCoordinator::didFlushChangesForLayer): Deleted.
779         * rendering/RenderLayerCompositor.h:
780
781 2019-01-16  Chris Dumez  <cdumez@apple.com>
782
783         Regression(PSON) View becomes blank after click a cross-site download link
784         https://bugs.webkit.org/show_bug.cgi?id=193361
785         <rdar://problem/47099573>
786
787         Reviewed by Geoffrey Garen.
788
789         * loader/FrameLoader.cpp:
790         (WebCore::FrameLoader::commitProvisionalLoad):
791         When restoring from PageCache, make sure we notify the client that the load was committed
792         *before* we tell it that the navigation is complete. This would confuse the ProvisionalPageProxy
793         logic in the UIProcess.
794
795 2019-01-16  Devin Rousso  <drousso@apple.com>
796
797         Web Inspector: extend overlay element bounds lines to the right/below as well
798         https://bugs.webkit.org/show_bug.cgi?id=193336
799
800         Reviewed by Matt Baker.
801
802         This patch is purely a visual change for WebInspector, and doesn't affect anything else.
803
804         * inspector/InspectorOverlayPage.js:
805         (_drawBounds):
806
807 2019-01-16  Youenn Fablet  <youenn@apple.com>
808
809         Prevent WorkerRunLoop::runInMode from spinning in nested cases
810         https://bugs.webkit.org/show_bug.cgi?id=193359
811         <rdar://problem/46345353>
812
813         Reviewed by Joseph Pecoraro.
814
815         Speculative fix for some cases where service worker is spinning and consuming a lot of CPU.
816         The hypothesis is that:
817         - Service Worker is checking for its script freshness through WorkerScriptLoader.
818         This triggers the worker run loop to be nested.
819         - The run loop timer is active and needs to fire immediately.
820         The hypothesis is that this happens in some cases like restarting a device after sleep mode.
821
822         WorkerRunLoop::runInMode will then compute a 0 timeout value for getting a message.
823         This will trigger a timeout while waiting for the message queue.
824         Since the run loop is nested,  the run loop timer will not be able to fire,
825         and it will keep ask to fire immediately.
826         runInMode will return timeout as a result and WorkerRunLoop::run will call it immediately.
827
828         The fix is to prevent the shared timer to fire only when the run loop is being debugged through the web inspector.
829         We compute this by checking the run loop mode as debuggerMode().
830         Did some refactoring by introducing helper routines for running the loop and posting task in debugger mode.
831
832         * inspector/WorkerScriptDebugServer.cpp:
833         (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused):
834         * workers/WorkerInspectorProxy.cpp:
835         (WebCore::WorkerInspectorProxy::resumeWorkerIfPaused):
836         (WebCore::WorkerInspectorProxy::connectToWorkerInspectorController):
837         (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspectorController):
838         (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspectorController):
839         * workers/WorkerRunLoop.cpp:
840         (WebCore::ModePredicate::ModePredicate):
841         (WebCore::WorkerRunLoop::WorkerRunLoop):
842         (WebCore::debuggerMode):
843         (WebCore::RunLoopSetup::RunLoopSetup):
844         (WebCore::RunLoopSetup::~RunLoopSetup):
845         (WebCore::WorkerRunLoop::run):
846         (WebCore::WorkerRunLoop::runInDebuggerMode):
847         (WebCore::WorkerRunLoop::runInMode):
848         (WebCore::WorkerRunLoop::Task::performTask):
849         * workers/WorkerRunLoop.h:
850         (WebCore::WorkerRunLoop::isBeingDebugged const):
851         * workers/WorkerThread.cpp:
852         (WebCore::WorkerThread::startRunningDebuggerTasks):
853         * workers/service/context/ServiceWorkerInspectorProxy.cpp:
854         (WebCore::ServiceWorkerInspectorProxy::connectToWorker):
855         (WebCore::ServiceWorkerInspectorProxy::disconnectFromWorker):
856         (WebCore::ServiceWorkerInspectorProxy::sendMessageToWorker):
857
858 2019-01-16  Sihui Liu  <sihui_liu@apple.com>
859
860         IndexedDB: leak WebIDBConnectionToClient for retain cycle
861         https://bugs.webkit.org/show_bug.cgi?id=193097
862         <rdar://problem/46899601>
863
864         Reviewed by David Kilzer.
865
866         Fix API test failure after r239887. After removing the retain cycle, IDBConnectionToClient will no longer live 
867         forever so make sure it is not destructed before UniqueIDBDatabaseConnection unregisters itself.
868
869         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
870         (WebCore::IDBServer::UniqueIDBDatabaseConnection::UniqueIDBDatabaseConnection):
871         (WebCore::IDBServer::UniqueIDBDatabaseConnection::~UniqueIDBDatabaseConnection):
872         (WebCore::IDBServer::UniqueIDBDatabaseConnection::fireVersionChangeEvent):
873         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didAbortTransaction):
874         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didCommitTransaction):
875         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didCreateObjectStore):
876         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didDeleteObjectStore):
877         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didRenameObjectStore):
878         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didClearObjectStore):
879         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didCreateIndex):
880         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didDeleteIndex):
881         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didRenameIndex):
882         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
883
884 2019-01-16  Antti Koivisto  <antti@apple.com>
885
886         Add more assertions to find root cause for release assert hit in StyleResolver
887         https://bugs.webkit.org/show_bug.cgi?id=193488
888         <rdar://problem/30983040>
889
890         Reviewed by Zalan Bujtas.
891
892         * css/StyleResolver.cpp:
893         (WebCore::StyleResolver::~StyleResolver):
894
895         Release assert we are not resolving tree style.
896
897         * dom/Document.cpp:
898         (WebCore::Document::setIsResolvingTreeStyle):
899         * dom/Document.h:
900         (WebCore::Document::isResolvingTreeStyle const):
901         * style/StyleTreeResolver.cpp:
902         (WebCore::Style::TreeResolver::Scope::Scope):
903         (WebCore::Style::TreeResolver::Scope::~Scope):
904
905         Set isResolvingTreeStyle bit when we have a tree resolver scope.
906
907 2019-01-16  Zalan Bujtas  <zalan@apple.com>
908
909         [LFC][Out-of-flow] Set used vertical margin values when top/height/bottom are non-auto.
910         https://bugs.webkit.org/show_bug.cgi?id=193470
911
912         Reviewed by Antti Koivisto.
913
914         Non-auto vertical margin values (which is mostly the case) should be set as used values.
915
916         Test: fast/block/block-only/non-auto-top-bottom-height-with-margins.html
917
918         * layout/FormattingContextGeometry.cpp:
919         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
920
921 2019-01-16  Alan Kinsley  <zalan@apple.com>
922
923         [LFC] Adjust margin box verification.
924         https://bugs.webkit.org/show_bug.cgi?id=193482
925
926         Reviewed by Antti Koivisto.
927
928         In certain cases, like out-of-flow boxes with margin auto, marginBoxRect() returns 0. It's clearly incorrect,
929         so let's check the individual margin values instead (and at this point we know that all other boxes match).
930
931         Test: fast/block/block-only/non-auto-top-bottom-height-with-auto-margins.html
932
933         * layout/Verification.cpp:
934         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
935
936 2019-01-16  Zan Dobersek  <zdobersek@igalia.com>
937
938         [FreeType] Cache the zero-width space glyph in GlyphPage::fill()
939         https://bugs.webkit.org/show_bug.cgi?id=193485
940
941         Reviewed by Carlos Garcia Campos.
942
943         In FreeType's implementation of GlyphPage::fill(), we can cache the
944         zero-width space glyph upon first retrieval through the
945         FcFreeTypeCharIndex() entrypoint, avoiding any subsequent calls
946         for other ignorable characters.
947
948         * platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp:
949         (WebCore::GlyphPage::fill):
950
951 2019-01-16  Myles C. Maxfield  <mmaxfield@apple.com>
952
953         [WHLSL] Add the high zombie finder
954         https://bugs.webkit.org/show_bug.cgi?id=193432
955
956         Reviewed by Robin Morisset and Saam Barati.
957
958         This is a translation of https://github.com/gpuweb/WHLSL/blob/master/Source/HighZombieFinder.mjs into C++.
959
960         No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
961         of test. When enough of the compiler is present, I'll port the reference implementation's test suite.
962
963         * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.cpp: Added.
964         (WebCore::WHLSL::findHighZombies):
965         * Modules/webgpu/WHLSL/WHLSLHighZombieFinder.h: Added.
966         * Sources.txt:
967         * WebCore.xcodeproj/project.pbxproj:
968
969 2019-01-15  Fujii Hironori  <Hironori.Fujii@sony.com>
970
971         Unreviewed WinCairo build fix.
972
973         * platform/network/curl/ResourceHandleCurl.cpp:
974         (WebCore::ResourceHandle::createCurlRequest):
975         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
976         (WebCore::ResourceHandle::receivedCredential):
977         (WebCore::ResourceHandle::getCredential):
978
979 2019-01-15  Alex Christensen  <achristensen@webkit.org>
980
981         Reduce use of NetworkStorageSession::defaultStorageSession in WebCore
982         https://bugs.webkit.org/show_bug.cgi?id=193368
983
984         Reviewed by Geoff Garen.
985
986         The NetworkStorageSession ownership needs to move to the WebKit/WebKitLegacy layer instead of being a process-global static map.
987
988         * loader/EmptyClients.cpp:
989         * platform/network/CredentialStorage.cpp:
990         (WebCore::CredentialStorage::defaultCredentialStorage): Deleted.
991         * platform/network/CredentialStorage.h:
992         * platform/network/NetworkStorageSession.h:
993         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
994         (WebCore::NetworkStorageSession::switchToNewTestingSession):
995         (WebCore::NetworkStorageSession::ensureSession):
996         * platform/network/cf/NetworkStorageSessionCFNetWin.cpp:
997         (WebCore::createPrivateStorageSession):
998         * platform/network/curl/ResourceHandleCurl.cpp:
999         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
1000         (WebCore::ResourceHandle::receivedCredential):
1001         (WebCore::ResourceHandle::getCredential):
1002
1003 2019-01-15  Ryosuke Niwa  <rniwa@webkit.org>
1004
1005         VisualViewport API should be updated upon opening of keyboard
1006         https://bugs.webkit.org/show_bug.cgi?id=193475
1007
1008         Reviewed by Simon Fraser.
1009
1010         Added a function to update the visual viewport API and schedule a resize event to FrameView.
1011
1012         Test: fast/visual-viewport/ios/resize-event-for-keyboard.html
1013
1014         * page/FrameView.cpp:
1015         (WebCore::FrameView::didUpdateViewportOverrideRects):
1016         * page/FrameView.h:
1017
1018 2019-01-15  Myles C. Maxfield  <mmaxfield@apple.com>
1019
1020         Fix build after r240018
1021         https://bugs.webkit.org/show_bug.cgi?id=193434
1022
1023         Unreviewed.
1024
1025         * Modules/webgpu/WHLSL/WHLSLLoopChecker.cpp:
1026         (WebCore::WHLSL::checkLoops):
1027         (WebCore::WHLSL::findHighZombies): Deleted.
1028         * Modules/webgpu/WHLSL/WHLSLLoopChecker.h:
1029
1030 2019-01-15  Megan Gardner  <megan_gardner@apple.com>
1031
1032         Add Reveal support in iOSMac
1033         https://bugs.webkit.org/show_bug.cgi?id=193408
1034         <rdar://problem/47300699>
1035
1036         Reviewed by Tim Horton.
1037
1038         iOSMac and Reveal are currently not testable.
1039
1040         Add support for the reveal SPI specifically for iOSMac.
1041         Show the controller when called, and implement the delegate to 
1042         correctly re-paint the content with the auto-generated highlight from
1043         the reveal framework.
1044
1045         * Configurations/WebCore.xcconfig:
1046         * editing/cocoa/DictionaryLookup.mm:
1047         (-[WebRevealHighlight initWithHighlightRect:view:]):
1048         (-[WebRevealHighlight setImage:]):
1049         (-[WebRevealHighlight highlightRectsForItem:]):
1050         (-[WebRevealHighlight startHighlightingItem:]):
1051         (-[WebRevealHighlight highlightItem:withProgress:]):
1052         (-[WebRevealHighlight completeHighlightingItem:]):
1053         (-[WebRevealHighlight stopHighlightingItem:]):
1054         (-[WebRevealHighlight highlightRangeChangedForItem:]):
1055         (-[WebRevealHighlight highlighting]):
1056         (-[WebRevealHighlight drawHighlightContentForItem:context:]):
1057         (WebCore::showPopupOrCreateAnimationController):
1058         (WebCore::DictionaryLookup::showPopup):
1059         * editing/mac/DictionaryLookup.h:
1060
1061 2019-01-15  Myles C. Maxfield  <mmaxfield@apple.com>
1062
1063         [WHLSL] Add ending namespace comments to make namespace boundaries more clear
1064         https://bugs.webkit.org/show_bug.cgi?id=193471
1065
1066         Reviewed by Saam Barati.
1067
1068         This patch only adds the comments to the files that are too long to fit on a single screen in my editor.
1069
1070         No new tests because there is no behavior change.
1071
1072         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp:
1073         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
1074         * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp:
1075         * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.h:
1076         * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp:
1077         * Modules/webgpu/WHLSL/WHLSLIntrinsics.cpp:
1078         * Modules/webgpu/WHLSL/WHLSLIntrinsics.h:
1079         * Modules/webgpu/WHLSL/WHLSLLexer.cpp:
1080         * Modules/webgpu/WHLSL/WHLSLLexer.h:
1081         * Modules/webgpu/WHLSL/WHLSLLoopChecker.cpp:
1082         * Modules/webgpu/WHLSL/WHLSLNameContext.cpp:
1083         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
1084         * Modules/webgpu/WHLSL/WHLSLNameResolver.h:
1085         * Modules/webgpu/WHLSL/WHLSLParser.h:
1086         * Modules/webgpu/WHLSL/WHLSLProgram.h:
1087         * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp:
1088         * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp:
1089         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
1090         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
1091         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
1092         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
1093         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
1094         * Modules/webgpu/WHLSL/WHLSLVisitor.h:
1095
1096 2019-01-15  Myles C. Maxfield  <mmaxfield@apple.com>
1097
1098         [WHLSL] Implement the loop checker
1099         https://bugs.webkit.org/show_bug.cgi?id=193434
1100
1101         Reviewed by Saam Barati.
1102
1103         This is a translation of https://github.com/gpuweb/WHLSL/blob/master/Source/LoopChecker.mjs into C++.
1104
1105         No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
1106         of test. When enough of the compiler is present, I'll port the reference implementation's test suite.
1107
1108         * Modules/webgpu/WHLSL/WHLSLLoopChecker.cpp: Added.
1109         (WebCore::WHLSL::findHighZombies):
1110         * Modules/webgpu/WHLSL/WHLSLLoopChecker.h: Added.
1111         * Sources.txt:
1112         * WebCore.xcodeproj/project.pbxproj:
1113
1114 2019-01-15  Chris Dumez  <cdumez@apple.com>
1115
1116         Unreviewed, rolling out r239993, r239995, r239997, and
1117         r239999.
1118
1119         Caused assertions under
1120         ViewGestureController::disconnectFromProcess()
1121
1122         Reverted changesets:
1123
1124         "Regression(PSON) View becomes blank after click a cross-site
1125         download link"
1126         https://bugs.webkit.org/show_bug.cgi?id=193361
1127         https://trac.webkit.org/changeset/239993
1128
1129         "Unreviewed iOS build fix after r239993."
1130         https://trac.webkit.org/changeset/239995
1131
1132         "Fix iOS build after r239993"
1133         https://bugs.webkit.org/show_bug.cgi?id=193361
1134         https://trac.webkit.org/changeset/239997
1135
1136         "Unreviewed, revert part of r239997 as it is not needed to fix
1137         the build."
1138         https://trac.webkit.org/changeset/239999
1139
1140 2019-01-15  Alex Christensen  <achristensen@webkit.org>
1141
1142         Stop using CookiesStrategy
1143         https://bugs.webkit.org/show_bug.cgi?id=161106
1144
1145         Reviewed by Don Olmstead and Antti Koivisto.
1146
1147         CookiesStrategy is process-global and makes it difficult to switch NetworkStorageSession from having a process-global map.
1148         Instead, use a CookieJar object in the WebProcess.  This has the additional benefit of making it more clear which code
1149         is used in the WebProcess and which code is used in the NetworkProcess.
1150
1151         * Modules/beacon/NavigatorBeacon.cpp:
1152         * Modules/websockets/WebSocketChannel.cpp:
1153         (WebCore::WebSocketChannel::processBuffer):
1154         * Modules/websockets/WebSocketHandshake.cpp:
1155         (WebCore::WebSocketHandshake::clientHandshakeRequest const):
1156         (WebCore::WebSocketHandshake::clientHandshakeCookieRequestHeaderFieldProxy const):
1157         * WebCore.xcodeproj/project.pbxproj:
1158         * css/StyleRuleImport.cpp:
1159         (WebCore::StyleRuleImport::requestStyleSheet):
1160         * dom/Document.cpp:
1161         (WebCore::Document::cookie):
1162         (WebCore::Document::setCookie):
1163         * html/HTMLMediaElement.cpp:
1164         (WebCore::HTMLMediaElement::mediaPlayerGetRawCookies const):
1165         * inspector/agents/InspectorPageAgent.cpp:
1166         (WebCore::InspectorPageAgent::getCookies):
1167         (WebCore::InspectorPageAgent::deleteCookie):
1168         * loader/CookieJar.cpp:
1169         (WebCore::CookieJar::shouldIncludeSecureCookies):
1170         (WebCore::CookieJar::sameSiteInfo):
1171         (WebCore::CookieJar::create):
1172         (WebCore::CookieJar::cookies const):
1173         (WebCore::CookieJar::cookieRequestHeaderFieldProxy):
1174         (WebCore::CookieJar::setCookies):
1175         (WebCore::CookieJar::cookiesEnabled const):
1176         (WebCore::CookieJar::cookieRequestHeaderFieldValue const):
1177         (WebCore::CookieJar::getRawCookies const):
1178         (WebCore::CookieJar::deleteCookie):
1179         (WebCore::shouldIncludeSecureCookies): Deleted.
1180         (WebCore::sameSiteInfo): Deleted.
1181         (WebCore::cookies): Deleted.
1182         (WebCore::cookieRequestHeaderFieldProxy): Deleted.
1183         (WebCore::setCookies): Deleted.
1184         (WebCore::cookiesEnabled): Deleted.
1185         (WebCore::cookieRequestHeaderFieldValue): Deleted.
1186         (WebCore::getRawCookies): Deleted.
1187         (WebCore::deleteCookie): Deleted.
1188         * loader/CookieJar.h:
1189         * loader/EmptyClients.cpp:
1190         (WebCore::pageConfigurationWithEmptyClients):
1191         * loader/ImageLoader.cpp:
1192         (WebCore::ImageLoader::updateFromElement):
1193         * loader/cache/CachedApplicationManifest.cpp:
1194         (WebCore::CachedApplicationManifest::CachedApplicationManifest):
1195         * loader/cache/CachedApplicationManifest.h:
1196         * loader/cache/CachedCSSStyleSheet.cpp:
1197         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
1198         * loader/cache/CachedCSSStyleSheet.h:
1199         * loader/cache/CachedFont.cpp:
1200         (WebCore::CachedFont::CachedFont):
1201         * loader/cache/CachedFont.h:
1202         * loader/cache/CachedImage.cpp:
1203         (WebCore::CachedImage::CachedImage):
1204         * loader/cache/CachedImage.h:
1205         * loader/cache/CachedRawResource.cpp:
1206         (WebCore::CachedRawResource::CachedRawResource):
1207         * loader/cache/CachedRawResource.h:
1208         * loader/cache/CachedResource.cpp:
1209         (WebCore::CachedResource::CachedResource):
1210         (WebCore::CachedResource::setResponse):
1211         (WebCore::CachedResource::varyHeaderValuesMatch):
1212         * loader/cache/CachedResource.h:
1213         (WebCore::CachedResource::cookieJar const):
1214         * loader/cache/CachedResourceLoader.cpp:
1215         (WebCore::createResource):
1216         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
1217         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest):
1218         (WebCore::CachedResourceLoader::requestResource):
1219         (WebCore::CachedResourceLoader::revalidateResource):
1220         (WebCore::CachedResourceLoader::loadResource):
1221         * loader/cache/CachedResourceLoader.h:
1222         * loader/cache/CachedSVGDocument.cpp:
1223         (WebCore::CachedSVGDocument::CachedSVGDocument):
1224         * loader/cache/CachedSVGDocument.h:
1225         * loader/cache/CachedSVGFont.cpp:
1226         (WebCore::CachedSVGFont::CachedSVGFont):
1227         * loader/cache/CachedSVGFont.h:
1228         * loader/cache/CachedScript.cpp:
1229         (WebCore::CachedScript::CachedScript):
1230         * loader/cache/CachedScript.h:
1231         * loader/cache/CachedTextTrack.cpp:
1232         (WebCore::CachedTextTrack::CachedTextTrack):
1233         * loader/cache/CachedTextTrack.h:
1234         * loader/cache/CachedXSLStyleSheet.cpp:
1235         (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
1236         * loader/cache/CachedXSLStyleSheet.h:
1237         * loader/cache/MemoryCache.cpp:
1238         (WebCore::MemoryCache::addImageToCache):
1239         * loader/cache/MemoryCache.h:
1240         * page/Navigator.cpp:
1241         (WebCore::Navigator::cookieEnabled const):
1242         * page/Page.cpp:
1243         (WebCore::Page::Page):
1244         * page/Page.h:
1245         (WebCore::Page::cookieJar):
1246         * page/PageConfiguration.cpp:
1247         (WebCore::PageConfiguration::PageConfiguration):
1248         * page/PageConfiguration.h:
1249         * platform/CookiesStrategy.h: Removed.
1250         * platform/PlatformStrategies.h:
1251         (WebCore::PlatformStrategies::cookiesStrategy): Deleted.
1252         * platform/network/CacheValidation.cpp:
1253         (WebCore::cookieRequestHeaderFieldValue):
1254         (WebCore::collectVaryingRequestHeaders):
1255         (WebCore::verifyVaryingRequestHeaders):
1256         * platform/network/CacheValidation.h:
1257         * platform/network/CookieRequestHeaderFieldProxy.h:
1258         * platform/network/cf/NetworkStorageSessionCFNetWin.cpp:
1259         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1260         * platform/network/curl/ResourceHandleCurl.cpp:
1261         * rendering/RenderSnapshottedPlugIn.cpp:
1262         (WebCore::RenderSnapshottedPlugIn::updateSnapshot):
1263         * testing/Internals.cpp:
1264         (WebCore::Internals::getCookies const):
1265
1266 2019-01-15  Simon Fraser  <simon.fraser@apple.com>
1267
1268         Animations should only trigger layer recomposite when necessary
1269         https://bugs.webkit.org/show_bug.cgi?id=193450
1270
1271         Reviewed by Antoine Quint.
1272
1273         Animations only need to trigger compositing updates when their states change in a way
1274         that affects compositing. RenderLayerCompositor::requiresCompositingForAnimation() checks for
1275         running animations of properties that can be accelerated, so this patch fixes the legacy
1276         animation logic to only set 'shouldRecompositeLayer' in TreeResolver::createAnimatedElementUpdate()
1277         when the running state of such an animation changes.
1278
1279         ImplicitAnimation::animate() and KeyframeAnimation::animate() now return OptionSet<AnimateChange>.
1280         This contains information about whether the running state changed, so CompositeAnimation::animate()
1281         asks about whether the running state of an accelerated property changed, and returns this in
1282         the AnimationUpdate result.
1283
1284         * page/animation/AnimationBase.h:
1285         (WebCore::AnimationBase::isPausedState):
1286         (WebCore::AnimationBase::isRunningState):
1287         (WebCore::AnimationBase::inPausedState const):
1288         (WebCore::AnimationBase::inRunningState const):
1289         (WebCore::AnimationBase::isAnimatingProperty const):
1290         * page/animation/CSSAnimationController.h:
1291         * page/animation/CompositeAnimation.cpp:
1292         (WebCore::CompositeAnimation::animate):
1293         * page/animation/ImplicitAnimation.cpp:
1294         (WebCore::ImplicitAnimation::animate):
1295         (WebCore::ImplicitAnimation::affectsAcceleratedProperty const):
1296         * page/animation/ImplicitAnimation.h:
1297         * page/animation/KeyframeAnimation.cpp:
1298         (WebCore::KeyframeAnimation::KeyframeAnimation):
1299         (WebCore::KeyframeAnimation::animate):
1300         (WebCore::KeyframeAnimation::computeStackingContextImpact): Deleted.
1301         * page/animation/KeyframeAnimation.h:
1302         * style/StyleTreeResolver.cpp:
1303         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
1304
1305 2019-01-15  Simon Fraser  <simon.fraser@apple.com>
1306
1307         Clean up code related to the updating of Dashboard and touch event regions
1308         https://bugs.webkit.org/show_bug.cgi?id=193460
1309
1310         Reviewed by Zalan Bujtas.
1311
1312         In preparation for layout testing that can count the number of event region
1313         updates, move the code related to updating "annotated" (Dashboard) regions, and
1314         touch event regions into bottleneck functions in Document.
1315         
1316         Updating these two kinds of regions is generally similar, but there are some code paths
1317         that eagerly update annotated regions.
1318
1319         No behavior change.
1320
1321         * dom/Document.cpp:
1322         (WebCore::Document::updateAnnotatedRegions): Moved from FrameView.
1323         (WebCore::Document::invalidateRenderingDependentRegions):
1324         (WebCore::Document::invalidateScrollbarDependentRegions):
1325         (WebCore::Document::updateZOrderDependentRegions):
1326         * dom/Document.h:
1327         (WebCore::Document::setAnnotatedRegionsDirty):
1328         (WebCore::Document::annotatedRegionsDirty const):
1329         (WebCore::Document::hasAnnotatedRegions const):
1330         * page/FrameView.cpp:
1331         (WebCore::FrameView::didLayout):
1332         (WebCore::FrameView::didPaintContents):
1333         (WebCore::FrameView::updateAnnotatedRegions): Deleted.
1334         * page/FrameView.h:
1335         * rendering/RenderElement.cpp: Drive-by header cleanup.
1336         (WebCore::RenderElement::styleWillChange):
1337         * rendering/RenderLayer.cpp:
1338         (WebCore::RenderLayer::scrollTo):
1339         (WebCore::RenderLayer::setHasHorizontalScrollbar):
1340         (WebCore::RenderLayer::setHasVerticalScrollbar):
1341         (WebCore::RenderLayer::updateScrollbarsAfterLayout):
1342         (WebCore::RenderLayer::calculateClipRects const):
1343         * rendering/RenderListBox.cpp:
1344         (WebCore::RenderListBox::setHasVerticalScrollbar):
1345
1346 2019-01-15  David Kilzer  <ddkilzer@apple.com>
1347
1348         Let Xcode have its way with the WebCore project
1349
1350         * WebCore.xcodeproj/project.pbxproj:
1351         - Change the lastKnownFileType for *.gperf and *.idl files from
1352           "file" to "text".
1353         - Resort source files into UUID order.
1354
1355 2019-01-15  Youenn Fablet  <youenn@apple.com>
1356
1357         Correctly handle rotation for local video playback
1358         https://bugs.webkit.org/show_bug.cgi?id=193412
1359
1360         Reviewed by Eric Carlson.
1361
1362         Update AVVideoCaptureSource to compute the size given to settings after rotating the sample.
1363         This ensures computing the size of video elements appropriately.
1364         Also makes sure to notify observers of size change whenever rotation happens as settings() call will provide a different size.
1365         Covered by manual testing as we do not have yet emulation of local capture with rotation.
1366
1367         * platform/mediastream/RealtimeMediaSource.cpp:
1368         (WebCore::RealtimeMediaSource::setIntrinsicSize):
1369         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1370         (WebCore::AVVideoCaptureSource::settings):
1371         (WebCore::AVVideoCaptureSource::computeSampleRotation):
1372
1373 2019-01-15  Chris Dumez  <cdumez@apple.com>
1374
1375         Regression(PSON) View becomes blank after click a cross-site download link
1376         https://bugs.webkit.org/show_bug.cgi?id=193361
1377         <rdar://problem/47099573>
1378
1379         Reviewed by Geoff Garen.
1380
1381         * loader/FrameLoader.cpp:
1382         (WebCore::FrameLoader::commitProvisionalLoad):
1383         When restoring from PageCache, make sure we notify the client that the load was committed
1384         *before* we tell it that the navigation is complete. This would confuse the ProvisionalPageProxy
1385         logic in the UIProcess.
1386
1387 2019-01-15  Zalan Bujtas  <zalan@apple.com>
1388
1389         [LFC][Out-of-flow] Ignore bottom when the vertical values are over-constrained
1390         https://bugs.webkit.org/show_bug.cgi?id=193448
1391
1392         Reviewed by Antti Koivisto.
1393
1394         Add missing check. We should only resolve auto values. 
1395
1396         Test: fast/block/block-only/non-auto-top-bottom-left-right-widht-height-out-of-flow.html
1397
1398         * layout/FormattingContextGeometry.cpp:
1399         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
1400
1401 2019-01-15  Devin Rousso  <drousso@apple.com>
1402
1403         Web Inspector: Audit: provide a way to determine whether a give node has event listeners
1404         https://bugs.webkit.org/show_bug.cgi?id=193226
1405         <rdar://problem/46800005>
1406
1407         Reviewed by Joseph Pecoraro.
1408
1409         Test: inspector/audit/run-dom.html
1410
1411         * inspector/InspectorAuditDOMObject.idl:
1412         * inspector/InspectorAuditDOMObject.h:
1413         * inspector/InspectorAuditDOMObject.cpp:
1414         (WebCore::InspectorAuditDOMObject::hasEventListeners): Added.
1415
1416 2019-01-15  Devin Rousso  <drousso@apple.com>
1417
1418         Web Inspector: Audit: provide a way to query for all nodes with a given computed Accessibility role
1419         https://bugs.webkit.org/show_bug.cgi?id=193228
1420         <rdar://problem/46787787>
1421
1422         Reviewed by Joseph Pecoraro.
1423
1424         Test: inspector/audit/run-accessibility.html
1425
1426         * inspector/InspectorAuditAccessibilityObject.idl:
1427         * inspector/InspectorAuditAccessibilityObject.h:
1428         * inspector/InspectorAuditAccessibilityObject.cpp:
1429         (WebCore::accessiblityObjectForNode): Added.
1430         (WebCore::InspectorAuditAccessibilityObject::getElementsByComputedRole): Added.
1431
1432 2019-01-15  Simon Fraser  <simon.fraser@apple.com>
1433
1434         Simplify isRunningAnimationOnRenderer()
1435         https://bugs.webkit.org/show_bug.cgi?id=193435
1436
1437         Reviewed by Darin Adler.
1438
1439         All callers of CSSAnimationController::isRunningAnimationOnRenderer() pass AnimationBase::Running | AnimationBase::Paused,
1440         so we can remove the parameter and just hardcode this behavior.
1441         
1442         This will simplify a later patch that needs to consider state changes between running and not running.
1443         
1444         No behavior change.
1445
1446         * page/animation/AnimationBase.h:
1447         (WebCore::AnimationBase::isAnimatingProperty const):
1448         * page/animation/CSSAnimationController.cpp:
1449         (WebCore::CSSAnimationControllerPrivate::isRunningAnimationOnRenderer const):
1450         (WebCore::CSSAnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer const):
1451         (WebCore::CSSAnimationControllerPrivate::computeExtentOfAnimation const):
1452         (WebCore::CSSAnimationController::isRunningAnimationOnRenderer const):
1453         (WebCore::CSSAnimationController::isRunningAcceleratedAnimationOnRenderer const):
1454         * page/animation/CSSAnimationController.h:
1455         * page/animation/CSSAnimationControllerPrivate.h:
1456         * page/animation/CompositeAnimation.cpp:
1457         (WebCore::CompositeAnimation::isAnimatingProperty const):
1458         * page/animation/CompositeAnimation.h:
1459         * rendering/RenderLayer.cpp:
1460         (WebCore::RenderLayer::currentTransform const):
1461         * rendering/RenderLayerBacking.cpp:
1462         (WebCore::RenderLayerBacking::updateGeometry):
1463         * rendering/RenderLayerCompositor.cpp:
1464         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const):
1465         (WebCore::RenderLayerCompositor::isRunningTransformAnimation const):
1466
1467 2019-01-15  Antti Koivisto  <antti@apple.com>
1468
1469         Remove unused fields from Scrollbar
1470         https://bugs.webkit.org/show_bug.cgi?id=193442
1471
1472         Reviewed by Zalan Bujtas.
1473
1474         * platform/Scrollbar.cpp:
1475         (WebCore::Scrollbar::Scrollbar):
1476         * platform/Scrollbar.h:
1477         (WebCore::Scrollbar::isCustomScrollbar const):
1478
1479         Make virtual so it doesn't need a bit.
1480
1481         (WebCore::Scrollbar::isAlphaLocked const): Deleted.
1482         (WebCore::Scrollbar::setIsAlphaLocked): Deleted.
1483         * platform/mac/ScrollAnimatorMac.mm:
1484         (WebCore::ScrollAnimatorMac::shouldScrollbarParticipateInHitTesting):
1485         * rendering/RenderScrollbar.cpp:
1486         (WebCore::RenderScrollbar::RenderScrollbar):
1487         * rendering/RenderScrollbar.h:
1488
1489 2019-01-15  Zalan Bujtas  <zalan@apple.com>
1490
1491         [LFC] Use the containing block's padding box to position out-of-flow elements.
1492         https://bugs.webkit.org/show_bug.cgi?id=193431
1493
1494         Reviewed by Antti Koivisto.
1495
1496         If the element has 'position: absolute', the containing block is established by the nearest ancestor
1497         with a 'position' of 'absolute', 'relative' or 'fixed', in the following way:
1498
1499         1. In the case that the ancestor is an inline element, the containing block is the bounding box around the padding
1500         boxes of the first and the last inline boxes generated for that element. In CSS 2.2, if the inline element is split
1501         across multiple lines, the containing block is undefined.
1502
1503         2. Otherwise, the containing block is formed by the padding edge of the ancestor.
1504
1505         This patch covers #2. 
1506
1507         Test: fast/block/block-only/out-of-flow-with-containing-block-border-padding.html
1508
1509         * layout/displaytree/DisplayBox.h:
1510         (WebCore::Display::Box::width const):
1511         (WebCore::Display::Box::height const):
1512         (WebCore::Display::Box::contentBoxTop const):
1513         (WebCore::Display::Box::contentBoxLeft const):
1514         (WebCore::Display::Box::paddingBoxTop const):
1515         (WebCore::Display::Box::paddingBoxLeft const):
1516         (WebCore::Display::Box::paddingBoxBottom const):
1517         (WebCore::Display::Box::paddingBoxRight const):
1518         (WebCore::Display::Box::paddingBoxHeight const):
1519         (WebCore::Display::Box::paddingBoxWidth const):
1520         * page/FrameViewLayoutContext.cpp:
1521         (WebCore::layoutUsingFormattingContext):
1522
1523 2019-01-11  Antoine Quint  <graouts@apple.com>
1524
1525         Support parsing of additional values for the touch-action property
1526         https://bugs.webkit.org/show_bug.cgi?id=193314
1527         <rdar://problem/47176519>
1528
1529         Reviewed by Dean Jackson.
1530
1531         We add parsing support for the "none", "pan-x", "pan-y" and "pinch-zoom" values of the CSS "touch-action" property.
1532
1533         * WebCore.xcodeproj/project.pbxproj:
1534         * css/CSSComputedStyleDeclaration.cpp:
1535         (WebCore::touchActionFlagsToCSSValue):
1536         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
1537         * css/CSSPrimitiveValueMappings.h:
1538         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1539         (WebCore::CSSPrimitiveValue::operator OptionSet<TouchAction> const):
1540         (WebCore::CSSPrimitiveValue::operator TouchAction const): Deleted.
1541         * css/CSSProperties.json:
1542         * css/CSSValueKeywords.in:
1543         * css/StyleBuilderConverter.h:
1544         (WebCore::StyleBuilderConverter::convertTouchAction):
1545         * css/parser/CSSParserFastPaths.cpp:
1546         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
1547         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
1548         * css/parser/CSSPropertyParser.cpp:
1549         (WebCore::consumeTouchAction):
1550         * dom/Element.cpp:
1551         (WebCore::Element::allowsDoubleTapGesture const):
1552         * platform/TouchAction.h: Added.
1553         * rendering/style/RenderStyle.h:
1554         (WebCore::RenderStyle::touchActions const):
1555         (WebCore::RenderStyle::setTouchActions):
1556         (WebCore::RenderStyle::initialTouchActions):
1557         (WebCore::RenderStyle::touchAction const): Deleted.
1558         (WebCore::RenderStyle::setTouchAction): Deleted.
1559         (WebCore::RenderStyle::initialTouchAction): Deleted.
1560         * rendering/style/RenderStyleConstants.h:
1561         * rendering/style/StyleRareNonInheritedData.cpp:
1562         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
1563         (WebCore::StyleRareNonInheritedData::operator== const):
1564         * rendering/style/StyleRareNonInheritedData.h:
1565
1566 2019-01-15  Devin Rousso  <drousso@apple.com>
1567
1568         Web Inspector: Audit: create new IDL type for exposing special functionality in test context
1569         https://bugs.webkit.org/show_bug.cgi?id=193149
1570         <rdar://problem/46801218>
1571
1572         Reviewed by Joseph Pecoraro.
1573
1574         Tests: inspector/audit/run.html
1575                inspector/audit/setup.html
1576                inspector/audit/teardown.html
1577
1578         Create a new `AuditAgent` (and various subclasses for different inspection targets), as well
1579         as `InspectorAuditAccessibilityObject` and `InspectorAuditDOMObject` objects that will
1580         be injected into the test function to allow for more advanced testing.
1581
1582         * inspector/InspectorAuditAccessibilityObject.idl: Added.
1583         * inspector/InspectorAuditAccessibilityObject.h: Added.
1584         (WebCore::InspectorAuditAccessibilityObject::create):
1585         * inspector/InspectorAuditAccessibilityObject.cpp: Added.
1586         (WebCore::InspectorAuditAccessibilityObject::InspectorAuditAccessibilityObject):
1587
1588         * inspector/InspectorAuditDOMObject.idl: Added.
1589         * inspector/InspectorAuditDOMObject.h: Added.
1590         (WebCore::InspectorAuditDOMObject::create):
1591         * inspector/InspectorAuditDOMObject.cpp: Added.
1592         (WebCore::InspectorAuditDOMObject::InspectorAuditDOMObject):
1593
1594         * inspector/agents/page/PageAuditAgent.h: Added.
1595         * inspector/agents/page/PageAuditAgent.cpp: Added.
1596         (WebCore::PageAuditAgent::PageAuditAgent):
1597         (WebCore::PageAuditAgent::injectedScriptForEval):
1598         (WebCore::PageAuditAgent::populateAuditObject):
1599         (WebCore::PageAuditAgent::muteConsole):
1600         (WebCore::PageAuditAgent::unmuteConsole):
1601
1602         * inspector/agents/worker/WorkerAuditAgent.h: Added.
1603         * inspector/agents/worker/WorkerAuditAgent.cpp: Added.
1604         (WebCore::WorkerAuditAgent::WorkerAuditAgent):
1605         (WebCore::WorkerAuditAgent::injectedScriptForEval):
1606
1607         * inspector/InspectorController.cpp:
1608         (WebCore::InspectorController::createLazyAgents):
1609
1610         * inspector/WorkerInspectorController.cpp:
1611         (WebCore::WorkerInspectorController::createLazyAgents):
1612
1613         * CMakeLists.txt:
1614         * DerivedSources-input.xcfilelist:
1615         * DerivedSources-output.xcfilelist:
1616         * DerivedSources.make:
1617         * Sources.txt:
1618         * UnifiedSources-input.xcfilelist:
1619         * WebCore.xcodeproj/project.pbxproj:
1620
1621 2019-01-14  Myles C. Maxfield  <mmaxfield@apple.com>
1622
1623         [WHLSL] Implement the Type Checker
1624         https://bugs.webkit.org/show_bug.cgi?id=193080
1625
1626         Reviewed by Dean Jackson.
1627
1628         This is a translation of https://github.com/gpuweb/WHLSL/blob/master/Source/Checker.mjs into C++.
1629
1630         The Checker passes types between nested expressions. An inner expression figures out what type it is, and
1631         passes that information up to an outer expression. This is done via reading/writing into a HashMap,
1632         because all the type information needs to be saved so that the Metal codegen can emit the correct types.
1633
1634         These types can have two forms: A regular type (like "int[]") or a ResolvableType. ResolvableTypes
1635         represent literals, since a literal needs to know its context before it knows what type it should be. So,
1636         if you have a function like "void foo(int x)" and you have a call like "foo(3)", the 3's ResolvableType
1637         gets passed to the CallExpression, which then unifies it with the function's parameter type, thereby
1638         resolving the 3 to be an int.
1639
1640         There are a few examples where multiple expressions will have the same type: "return (foo, 3)." If those
1641         types are regular types, then it's no problem; we can just clone() the type and stick both in the HashMap.
1642         However, if the type is a ResolvableType, an outer expression will only resolve that type once, so the two
1643         ResolvableTypes can't be distinct. The Checker solves this problem by making a reference-counted wrapper
1644         around ResolvableTypes and using that in the HashMap instead.
1645
1646         Once all the ResolvableTypes have been resolved, a second pass runs through the entire HashMap and assigns
1647         the known types to all the expressions. LValues and their associated address spaces are held in a parallel
1648         HashMap, and are assigned to the expression at the same time. The type is an Optional<AddressSpace> because
1649         address spaces are only relevant if the value is an lvalue; if it's nullopt then that means the expression
1650         is an rvalue.
1651
1652         No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
1653         of test. When enough of the compiler is present, I'll port the reference implementation's test suite.
1654
1655         * Modules/webgpu/WHLSL/WHLSLChecker.cpp: Added.
1656         (WebCore::WHLSL::resolveWithOperatorAnderIndexer):
1657         (WebCore::WHLSL::resolveWithOperatorLength):
1658         (WebCore::WHLSL::resolveWithReferenceComparator):
1659         (WebCore::WHLSL::resolveByInstantiation):
1660         (WebCore::WHLSL::checkSemantics):
1661         (WebCore::WHLSL::checkOperatorOverload):
1662         (WebCore::WHLSL::Checker::Checker):
1663         (WebCore::WHLSL::Checker::visit):
1664         (WebCore::WHLSL::Checker::assignTypes):
1665         (WebCore::WHLSL::Checker::checkShaderType):
1666         (WebCore::WHLSL::matchAndCommit):
1667         (WebCore::WHLSL::Checker::recurseAndGetInfo):
1668         (WebCore::WHLSL::Checker::getInfo):
1669         (WebCore::WHLSL::Checker::assignType):
1670         (WebCore::WHLSL::Checker::forwardType):
1671         (WebCore::WHLSL::getUnnamedType):
1672         (WebCore::WHLSL::Checker::finishVisitingPropertyAccess):
1673         (WebCore::WHLSL::Checker::recurseAndWrapBaseType):
1674         (WebCore::WHLSL::Checker::isBoolType):
1675         (WebCore::WHLSL::Checker::recurseAndRequireBoolType):
1676         (WebCore::WHLSL::check):
1677         * Modules/webgpu/WHLSL/WHLSLChecker.h: Added.
1678         * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp: Added.
1679         (WebCore::WHLSL::Gatherer::Gatherer):
1680         (WebCore::WHLSL::Gatherer::reset):
1681         (WebCore::WHLSL::Gatherer::takeEntryPointItems):
1682         (WebCore::WHLSL::Gatherer::visit):
1683         (WebCore::WHLSL::gatherEntryPointItems):
1684         * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.h: Added.
1685         (WebCore::WHLSL::EntryPointItem::EntryPointItem):
1686         * Sources.txt:
1687         * WebCore.xcodeproj/project.pbxproj:
1688
1689 2019-01-14  Alex Christensen  <achristensen@webkit.org>
1690
1691         Split headerValueForVary into specialized functions for NetworkProcess and WebProcess/WebKitLegacy
1692         https://bugs.webkit.org/show_bug.cgi?id=193429
1693
1694         Reviewed by Joseph Pecoraro.
1695
1696         headerValueForVary is a strange function that is causing trouble with my NetworkProcess global state removal project.
1697         It currently accesses the cookie storage to see if there's a match in two different ways currently written as fallbacks.
1698         In the WebProcess or in WebKitLegacy, it uses cookiesStrategy to access cookies via IPC or directly, respectively,
1699         depending on the PlatformStrategies implementation of cookiesStrategy for that process.
1700         In the NetworkProcess, it uses WebCore::NetworkStorageSession to access cookies directly.
1701         Both of these cookie accessing methods use global state in the process, and I must split them to refactor them separately.
1702         This patch does the split by passing in the method of cookie access: a CookiesStrategy& or a NetworkStorageSession&.
1703         Further refactoring will be done in bug 193368 and bug 161106 to build on this and replace the global state with
1704         member variables of the correct containing objects.
1705
1706         * loader/cache/CachedResource.cpp:
1707         (WebCore::CachedResource::setResponse):
1708         (WebCore::CachedResource::varyHeaderValuesMatch):
1709         * platform/network/CacheValidation.cpp:
1710         (WebCore::cookieRequestHeaderFieldValue):
1711         (WebCore::headerValueForVary):
1712         (WebCore::collectVaryingRequestHeaders):
1713         (WebCore::verifyVaryingRequestHeaders):
1714         * platform/network/CacheValidation.h:
1715
1716 2019-01-14  Simon Fraser  <simon.fraser@apple.com>
1717
1718         Only run the node comparison code in FrameSelection::respondToNodeModification() for range selections
1719         https://bugs.webkit.org/show_bug.cgi?id=193416
1720
1721         Reviewed by Wenson Hsieh.
1722
1723         The code inside the m_selection.firstRange() clause needs to only run for non-collapsed selections, and
1724         it shows up on Speedometer profiles so optimize to only run this code if we have a selection range.
1725
1726         * editing/FrameSelection.cpp:
1727         (WebCore::FrameSelection::respondToNodeModification):
1728
1729 2019-01-14  Simon Fraser  <simon.fraser@apple.com>
1730
1731         Animation and other code is too aggressive about invalidating layer composition
1732         https://bugs.webkit.org/show_bug.cgi?id=193343
1733
1734         Reviewed by Antoine Quint.
1735         
1736         We used to have the concept of a "SyntheticStyleChange", which was used to trigger
1737         style updates for animation, and also to get compositing updated.
1738         
1739         That morphed into a call to Element::invalidateStyleAndLayerComposition(), which causes
1740         a style update to result in a "RecompositeLayer" diff, which in turn triggers compositing work,
1741         and dirties DOM touch event regions (which can be expensive to update).
1742         
1743         However, not all the callers of Element::invalidateStyleAndLayerComposition() need to trigger
1744         compositing, and doing so from animations caused excessive touch event regions on yahoo.com,
1745         which has several visibility:hidden elements with background-position animation.
1746         
1747         So fix callers of invalidateStyleAndLayerComposition() which don't care about compositing to instead
1748         call just invalidateStyle().
1749         
1750         Also fix KeyframeAnimation::animate to correctly return true when animation state changes—it failed to
1751         do so, because fireAnimationEventsIfNeeded() can run the state machine and change state.
1752
1753         * animation/KeyframeEffect.cpp:
1754         (WebCore::invalidateElement):
1755         * page/animation/AnimationBase.cpp:
1756         (WebCore::AnimationBase::setNeedsStyleRecalc):
1757         * page/animation/CSSAnimationController.cpp:
1758         (WebCore::CSSAnimationControllerPrivate::updateAnimations):
1759         (WebCore::CSSAnimationControllerPrivate::fireEventsAndUpdateStyle):
1760         (WebCore::CSSAnimationControllerPrivate::pauseAnimationAtTime):
1761         (WebCore::CSSAnimationControllerPrivate::pauseTransitionAtTime):
1762         (WebCore::CSSAnimationController::cancelAnimations):
1763         * page/animation/KeyframeAnimation.cpp:
1764         (WebCore::KeyframeAnimation::animate):
1765         * rendering/RenderImage.cpp:
1766         (WebCore::RenderImage::imageChanged):
1767         * rendering/RenderLayer.cpp:
1768         (WebCore::RenderLayer::calculateClipRects const):
1769         * rendering/svg/SVGResourcesCache.cpp:
1770         (WebCore::SVGResourcesCache::clientStyleChanged):
1771         * style/StyleTreeResolver.cpp:
1772         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
1773         * svg/SVGAnimateElementBase.cpp:
1774         (WebCore::applyCSSPropertyToTarget):
1775         (WebCore::removeCSSPropertyFromTarget):
1776
1777 2019-01-14  Sihui Liu  <sihui_liu@apple.com>
1778
1779         IndexedDB: When deleting databases, some open databases might be missed
1780         https://bugs.webkit.org/show_bug.cgi?id=193090
1781
1782         Reviewed by Brady Eidson.
1783
1784         We should close all databases with an open backing store instead of looking at which ones have an open database
1785         connection. This is because a database might be in the process of getting a backing store before its connection
1786         has been created.
1787
1788         * Modules/indexeddb/server/IDBServer.cpp:
1789         (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince):
1790         (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesForOrigins):
1791
1792 2019-01-14  Ryosuke Niwa  <rniwa@webkit.org>
1793
1794         Remove redundant check for alignAttr and hiddenAttr in various isPresentationAttribute overrides
1795         https://bugs.webkit.org/show_bug.cgi?id=193410
1796
1797         Reviewed by Simon Fraser.
1798
1799         Removed redundant checks for check for alignAttr and hiddenAttr in isPresentationAttribute overrides
1800         in HTMLElement subclasses since HTMLElement::isPresentationAttribute already checks for those attributes.
1801
1802         * html/HTMLDivElement.cpp:
1803         (WebCore::HTMLDivElement::isPresentationAttribute const): Deleted.
1804         * html/HTMLDivElement.h:
1805         * html/HTMLEmbedElement.cpp:
1806         (WebCore::HTMLEmbedElement::isPresentationAttribute const): Deleted.
1807         * html/HTMLEmbedElement.h:
1808         * html/HTMLHRElement.cpp:
1809         (WebCore::HTMLHRElement::isPresentationAttribute const):
1810         * html/HTMLIFrameElement.cpp:
1811         (WebCore::HTMLIFrameElement::isPresentationAttribute const):
1812         * html/HTMLImageElement.cpp:
1813         (WebCore::HTMLImageElement::isPresentationAttribute const):
1814         * html/HTMLInputElement.cpp:
1815         (WebCore::HTMLInputElement::isPresentationAttribute const):
1816         * html/HTMLParagraphElement.cpp:
1817         (WebCore::HTMLParagraphElement::isPresentationAttribute const): Deleted.
1818         * html/HTMLParagraphElement.h:
1819         * html/HTMLTableCaptionElement.cpp:
1820         (WebCore::HTMLTableCaptionElement::isPresentationAttribute const): Deleted.
1821         * html/HTMLTableCaptionElement.h:
1822         * html/HTMLTableElement.cpp:
1823         (WebCore::HTMLTableElement::isPresentationAttribute const):
1824         * html/HTMLTablePartElement.cpp:
1825         (WebCore::HTMLTablePartElement::isPresentationAttribute const):
1826
1827 2019-01-14  Commit Queue  <commit-queue@webkit.org>
1828
1829         Unreviewed, rolling out r239901, r239909, r239910, r239912,
1830         r239913, and r239914.
1831         https://bugs.webkit.org/show_bug.cgi?id=193407
1832
1833         These revisions caused an internal failure (Requested by
1834         Truitt on #webkit).
1835
1836         Reverted changesets:
1837
1838         "[Cocoa] Avoid importing directly from subumbrella frameworks"
1839         https://bugs.webkit.org/show_bug.cgi?id=186016
1840         https://trac.webkit.org/changeset/239901
1841
1842         "Tried to fix USE(APPLE_INTERNAL_SDK) builds after r239901."
1843         https://trac.webkit.org/changeset/239909
1844
1845         "Tried to fix the build."
1846         https://trac.webkit.org/changeset/239910
1847
1848         "Fixed iOS builds after r239910."
1849         https://trac.webkit.org/changeset/239912
1850
1851         "More build fixing."
1852         https://trac.webkit.org/changeset/239913
1853
1854         "Tried to fix USE(APPLE_INTERNAL_SDK) 32-bit builds."
1855         https://trac.webkit.org/changeset/239914
1856
1857 2019-01-14  Mark Lam  <mark.lam@apple.com>
1858
1859         Re-enable ability to build --cloop builds.
1860         https://bugs.webkit.org/show_bug.cgi?id=192955
1861
1862         Reviewed by Saam barati and Keith Miller.
1863
1864         * Configurations/FeatureDefines.xcconfig:
1865
1866 2019-01-14  Jer Noble  <jer.noble@apple.com>
1867
1868         https://bugs.webkit.org/show_bug.cgi?id=193403
1869         <rdar://problem/46750743>
1870
1871         Continue fix in r239711 by using WeakPtr in SourceBufferPrivateAVFObjC.
1872
1873         Reviewed by Eric Carlson.
1874
1875         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1876         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1877         (WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
1878
1879 2019-01-14  Justin Fan  <justin_fan@apple.com>
1880
1881         [WebGPU] Map WebGPUBindGroupLayoutBindings from the BindGroupLayoutDescriptor for error checking and later referencing
1882         https://bugs.webkit.org/show_bug.cgi?id=193405
1883
1884         Reviewed by Dean Jackson.
1885
1886         When creating a WebGPUBindGroupLayout, cache the WebGPUBindGroupLayoutDescriptor's list of BindGroupLayoutBindings
1887         in a HashMap, keyed by binding number, for quick reference during the WebGPUProgrammablePassEncoder::setBindGroups 
1888         implementation to follow. Also add error-checking e.g. detecting duplicate binding numbers in the same WebGPUBindGroupLayout
1889         and non-existent binding numbers when creating the WebGPUBindGroup.
1890
1891         No new tests. BindGroups and BindGroupLayouts reflect the (canonical?) strategy of returning empty 
1892         objects upon creation failure and reporting errors elswhere. Since error reporting is not yet implemented, 
1893         the error checks aren't testable from LayoutTests right now. Expected behavior unchanged and covered by existing tests.
1894
1895         * Modules/webgpu/WebGPUDevice.cpp:
1896         (WebCore::WebGPUDevice::createBindGroup const): 
1897                 Number of bindings must be consistent between bindings and layout bindings.
1898                 BindGroupBindings should only refer to existing BindGroupLayoutBindings.
1899         * platform/graphics/gpu/GPUBindGroup.h: 
1900         * platform/graphics/gpu/GPUBindGroupLayout.h:
1901         (WebCore::GPUBindGroupLayout::bindingsMap const): Added. Cache map of BindGroupLayoutBindings.
1902         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm: Disallow duplicate binding numbers in BindGroupLayoutBindings.
1903         (WebCore::GPUBindGroupLayout::tryCreate):
1904         (WebCore::GPUBindGroupLayout::GPUBindGroupLayout):
1905
1906 2019-01-14  Myles C. Maxfield  <mmaxfield@apple.com>
1907
1908         [WHLSL] Assorted cleanup
1909         https://bugs.webkit.org/show_bug.cgi?id=193389
1910
1911         Reviewed by Dean Jackson.
1912
1913         This is a bunch of non-behavior-changing cleanup.
1914
1915         - The compiler uses UniqueRef all over the place, and UniqueRef has an implicit operator T&. Therefore,
1916           we don't need to static_cast<T&> everywhere.
1917         - ConstantExpressionEnumerationMemberReference is the exact same thing as EnumerationMemberLiteral, so
1918           this patch deletes the longer-named class in favor of the shorter-named class.
1919         - Because of the header dependency tree, this patch moves EntryPointType into its own file so it can be
1920           used by files that FunctionDeclaration depends on. Same thing for AddressSpace.
1921         - EnumTypes have to have non-null base types. The parser will make sure this is always true.
1922
1923         No new tests because there is no behavior change.
1924
1925         * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h.
1926         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
1927         (WebCore::WHLSL::AST::ArrayType::type const):
1928         (WebCore::WHLSL::AST::ArrayType::type):
1929         * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h:
1930         (WebCore::WHLSL::AST::AssignmentExpression::left):
1931         (WebCore::WHLSL::AST::AssignmentExpression::right):
1932         * Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h:
1933         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp:
1934         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const):
1935         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h:
1936         * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h:
1937         (WebCore::WHLSL::AST::ConstantExpression::ConstantExpression):
1938         (WebCore::WHLSL::AST::ConstantExpression::clone const):
1939         (WebCore::WHLSL::AST::ConstantExpression::matches const):
1940         * Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h: Removed.
1941         * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h:
1942         (WebCore::WHLSL::AST::DereferenceExpression::pointer):
1943         * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h:
1944         (WebCore::WHLSL::AST::DoWhileLoop::body):
1945         (WebCore::WHLSL::AST::DoWhileLoop::conditional):
1946         * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h:
1947         (WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression):
1948         * Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h.
1949         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h:
1950         (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition):
1951         (WebCore::WHLSL::AST::EnumerationDefinition::type):
1952         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h:
1953         (WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral):
1954         (WebCore::WHLSL::AST::EnumerationMemberLiteral::wrap):
1955         (WebCore::WHLSL::AST::EnumerationMemberLiteral::left const):
1956         (WebCore::WHLSL::AST::EnumerationMemberLiteral::right const):
1957         (WebCore::WHLSL::AST::EnumerationMemberLiteral::clone const):
1958         (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationDefinition):
1959         (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationDefinition const):
1960         (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember):
1961         (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember const):
1962         (WebCore::WHLSL::AST::EnumerationMemberLiteral::setEnumerationMember):
1963         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
1964         (WebCore::WHLSL::AST::Expression::type):
1965         (WebCore::WHLSL::AST::Expression::setType):
1966         (WebCore::WHLSL::AST::Expression::addressSpace const):
1967         (WebCore::WHLSL::AST::Expression::setAddressSpace):
1968         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp:
1969         (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const):
1970         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h:
1971         (WebCore::WHLSL::AST::FloatLiteralType::preferredType):
1972         * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h:
1973         (WebCore::WHLSL::AST::ForLoop::condition):
1974         (WebCore::WHLSL::AST::ForLoop::increment):
1975         (WebCore::WHLSL::AST::ForLoop::body):
1976         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
1977         (WebCore::WHLSL::AST::FunctionDeclaration::type const):
1978         (WebCore::WHLSL::AST::FunctionDeclaration::type):
1979         * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h:
1980         (WebCore::WHLSL::AST::IfStatement::conditional):
1981         (WebCore::WHLSL::AST::IfStatement::body):
1982         (WebCore::WHLSL::AST::IfStatement::elseBody):
1983         * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h:
1984         (WebCore::WHLSL::AST::IndexExpression::indexExpression):
1985         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp:
1986         (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const):
1987         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h:
1988         (WebCore::WHLSL::AST::IntegerLiteralType::preferredType):
1989         * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h:
1990         (WebCore::WHLSL::AST::LogicalExpression::left):
1991         (WebCore::WHLSL::AST::LogicalExpression::right):
1992         * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h:
1993         (WebCore::WHLSL::AST::LogicalNotExpression::operand):
1994         * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h:
1995         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue):
1996         * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h:
1997         (WebCore::WHLSL::AST::MakePointerExpression::lValue):
1998         * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h:
1999         (WebCore::WHLSL::AST::PropertyAccessExpression::base):
2000         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
2001         (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue):
2002         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression):
2003         (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression):
2004         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
2005         (WebCore::WHLSL::AST::ReferenceType::elementType const):
2006         (WebCore::WHLSL::AST::ReferenceType::elementType):
2007         * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h:
2008         (WebCore::WHLSL::AST::ResolvableType::resolvedType const):
2009         (WebCore::WHLSL::AST::ResolvableType::resolvedType):
2010         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp:
2011         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const):
2012         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection const):
2013         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h:
2014         * Modules/webgpu/WHLSL/AST/WHLSLReturn.h:
2015         (WebCore::WHLSL::AST::Return::value):
2016         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp:
2017         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const):
2018         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h:
2019         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp:
2020         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const):
2021         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h:
2022         * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h:
2023         (WebCore::WHLSL::AST::StructureElement::type):
2024         * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h:
2025         (WebCore::WHLSL::AST::SwitchStatement::value):
2026         * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h:
2027         (WebCore::WHLSL::AST::TernaryExpression::predicate):
2028         (WebCore::WHLSL::AST::TernaryExpression::bodyExpression):
2029         (WebCore::WHLSL::AST::TernaryExpression::elseExpression):
2030         * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h:
2031         (WebCore::WHLSL::AST::TypeDefinition::type):
2032         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp:
2033         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const):
2034         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h:
2035         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType):
2036         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
2037         (WebCore::WHLSL::AST::VariableDeclaration::type):
2038         (WebCore::WHLSL::AST::VariableDeclaration::initializer):
2039         (WebCore::WHLSL::AST::VariableDeclaration::isAnonymous const):
2040         * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h:
2041         (WebCore::WHLSL::AST::WhileLoop::conditional):
2042         (WebCore::WHLSL::AST::WhileLoop::body):
2043         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp:
2044         (WebCore::WHLSL::checkDuplicateFunctions):
2045         * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp:
2046         (WebCore::WHLSL::commit):
2047         (WebCore::WHLSL::inferTypesForTypeArguments):
2048         (WebCore::WHLSL::inferTypesForCall):
2049         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
2050         (WebCore::WHLSL::NameResolver::visit):
2051         (WebCore::WHLSL::resolveNamesInTypes):
2052         (WebCore::WHLSL::resolveNamesInFunctions):
2053         * Modules/webgpu/WHLSL/WHLSLNameResolver.h:
2054         * Modules/webgpu/WHLSL/WHLSLParser.h:
2055         * Modules/webgpu/WHLSL/WHLSLProgram.h:
2056         (WebCore::WHLSL::Program::append):
2057         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
2058         (WebCore::WHLSL::synthesizeEnumerationFunctions):
2059         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
2060         (WebCore::WHLSL::synthesizeStructureAccessors):
2061         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
2062         (WebCore::WHLSL::Visitor::visit):
2063         * Modules/webgpu/WHLSL/WHLSLVisitor.h:
2064         * WebCore.xcodeproj/project.pbxproj:
2065
2066 2019-01-14  Zan Dobersek  <zdobersek@igalia.com>
2067
2068         DOMCacheStorage: use-after-move in doSequentialMatch()
2069         https://bugs.webkit.org/show_bug.cgi?id=193396
2070
2071         Reviewed by Youenn Fablet.
2072
2073         Depending on the platform- and compiler-specific calling conventions,
2074         the doSequentialMatch() code can move out the Vector<Ref<DOMCache>>
2075         object into the callback lambda before the DOMCache object at the
2076         specified index is retrieved for the DOMCache::doMatch() invocation.
2077
2078         This problem is now avoided by retrieving reference to the target
2079         DOMCache object in an earlier expression.
2080
2081         * Modules/cache/DOMCacheStorage.cpp:
2082         (WebCore::doSequentialMatch):
2083
2084 2019-01-14  Zalan Bujtas  <zalan@apple.com>
2085
2086         [LFC][BFC] Add basic box-sizing support.
2087         https://bugs.webkit.org/show_bug.cgi?id=193392
2088
2089         Reviewed by Antti Koivisto.
2090
2091         No min/max support yet.
2092
2093         Test: fast/block/block-only/box-sizing-inflow-out-of-flow-simple.html
2094
2095         * layout/FormattingContextGeometry.cpp:
2096         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
2097         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
2098         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2099         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2100         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
2101         * page/FrameViewLayoutContext.cpp:
2102         (WebCore::layoutUsingFormattingContext):
2103
2104 2019-01-14  Thibault Saunier  <tsaunier@igalia.com>
2105
2106         [GStreamer][WebRTC] Override DeviceType() in RealtimeMediaSource implementations
2107         https://bugs.webkit.org/show_bug.cgi?id=193397
2108
2109         This was necessary but wasn't done.
2110
2111         Reviewed by Philippe Normand.
2112
2113         No test required as this fixes a regression in all WebRTC tests when built in debug mode.
2114
2115         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h:
2116         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h:
2117
2118 2019-01-14  Zan Dobersek  <zdobersek@igalia.com>
2119
2120         Unreviewed WPE debug build fix after r239921.
2121
2122         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
2123         (webKitMediaClearKeyDecryptorDecrypt): Fix the assert that checks the
2124         size of the mapped buffer containing IV data.
2125
2126 2019-01-14  Charlie Turner  <cturner@igalia.com>
2127
2128         [GStreamer] Add sharedBuffer utility to GstMappedBuffer, and a testsuite
2129         https://bugs.webkit.org/show_bug.cgi?id=192977
2130
2131         Reviewed by Carlos Garcia Campos.
2132
2133         Add a utility method on GstMappedBuffer to return a SharedBuffer
2134         view over the mapped data with no copies.
2135
2136         This patch also introduces a new gstreamer port API test
2137         directory, and includes some tests for GstMappedBuffer.
2138
2139         New tests in the API section.
2140
2141         * platform/SharedBuffer.cpp: Add a new overload for
2142         GstMappedBuffer that allows sharing the mapped GStreamer buffers
2143         with zero copies.
2144         (WebCore::SharedBuffer::create):
2145         (WebCore::SharedBuffer::SharedBuffer):
2146         (WebCore::SharedBuffer::DataSegment::data const):
2147         (WebCore::SharedBuffer::DataSegment::size const):
2148         * platform/SharedBuffer.h:
2149         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
2150         (webKitWebAudioSrcAllocateBuffersAndRenderAudio): Update to new
2151         API.
2152         * platform/graphics/gstreamer/GStreamerCommon.cpp:
2153         (WebCore::GstMappedBuffer::createSharedBuffer): Return a shared
2154         buffer sharing this mapped buffer. The buffer must be shareable to
2155         use this method.
2156         * platform/graphics/gstreamer/GStreamerCommon.h:
2157         (WebCore::GstMappedBuffer::create): Make GstMappedBuffer RefCounted
2158         (WebCore::GstMappedBuffer::~GstMappedBuffer):
2159         (WebCore::GstMappedBuffer::data):
2160         (WebCore::GstMappedBuffer::data const):
2161         (WebCore::GstMappedBuffer::size const):
2162         (WebCore::GstMappedBuffer::isSharable const): New predicate to
2163         check whether this buffer can be shared (i.e., is not writable)
2164         (WebCore::GstMappedBuffer::GstMappedBuffer):
2165         (WebCore::GstMappedBuffer::operator bool const): Deleted.
2166         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
2167         (WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfSample):
2168         Update to use new API.
2169         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
2170         (WebCore::InitData::InitData): Ditto.
2171         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
2172         (webKitMediaClearKeyDecryptorFindAndSetKey): Ditto.
2173         (webKitMediaClearKeyDecryptorDecrypt): Ditto.
2174         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
2175         (WebCore::WrappedMockRealtimeAudioSource::render): Ditto.
2176         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
2177         (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData): Ditto.
2178         * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.cpp:
2179         (WebCore::RealtimeOutgoingVideoSourceLibWebRTC::createBlackFrame): Ditto.
2180         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
2181         (WebCore::GStreamerVideoEncoder::Fragmentize): Ditto.
2182
2183 2019-01-14  Karl Leplat  <karl.leplat_ext@softathome.com>
2184
2185         [GTK][WPE] Graphic issue with invalidations on composited layers with subpixel positions
2186         https://bugs.webkit.org/show_bug.cgi?id=193239
2187
2188         Reviewed by Žan Doberšek.
2189
2190         Test: compositing/repaint/invalidations-on-composited-layers-with-subpixel-positions.html
2191
2192         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2193         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers): Use enclosed dirty rect values
2194         when invalidating the CoordinatedBackingStore areas.
2195
2196 2019-01-13  Carlos Garcia Campos  <cgarcia@igalia.com>
2197
2198         [FreeType] Support emoji modifiers
2199         https://bugs.webkit.org/show_bug.cgi?id=177040
2200
2201         Reviewed by Myles C. Maxfield.
2202
2203         The problem only happens with emojis having the zero with joiner (U+200D) in the sequence. The sequence is
2204         broken because createAndFillGlyphPage() in Font.cpp overwrites zero with joiner with zero width space (U+200B),
2205         but the emoji font actually supports zero with joiner. This patch moves the control characters override from
2206         createAndFillGlyphPage() to GlyphPage::fill() only for FreeType based ports. This way we can do the override
2207         only for the cases where the code point is not supported by the font.
2208
2209         * platform/graphics/Font.cpp:
2210         (WebCore::overrideControlCharacters): Helper function to override the control characters.
2211         (WebCore::createAndFillGlyphPage): Call overrideControlCharacters() only when not using FreeType.
2212         * platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp:
2213         (WebCore::GlyphPage::fill): Use zero width space as fallback when the font doesn't support characters with
2214         Default_Ignorable Unicode property.
2215
2216 2019-01-13  Dan Bernstein  <mitz@apple.com>
2217
2218         More build fixing.
2219
2220         * editing/cocoa/DictionaryLookup.mm:
2221
2222 2019-01-13  Simon Fraser  <simon.fraser@apple.com>
2223
2224         Minor optimization to RenderText::setRenderedText()
2225         https://bugs.webkit.org/show_bug.cgi?id=193388
2226
2227         Reviewed by Ryosuke Niwa.
2228
2229         Avoid the call to applyTextTransform() if TextTransform is None, so that we don't
2230         have to call previousCharacter() and reassign m_text.
2231         
2232         Similar optimization in RenderText::textWithoutConvertingBackslashToYenSymbol().
2233
2234         Speedometer profiles show a few samples here, but this isn't going to win any prizes.
2235
2236         * rendering/RenderText.cpp:
2237         (WebCore::RenderText::setRenderedText):
2238         (WebCore::RenderText::textWithoutConvertingBackslashToYenSymbol const):
2239
2240 2019-01-13  Dan Bernstein  <mitz@apple.com>
2241
2242         Tried to fix the build.
2243
2244         * editing/cocoa/DictionaryLookup.mm:
2245
2246 2019-01-13  Dan Bernstein  <mitz@apple.com>
2247
2248         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r239901.
2249
2250         Patch by Keith Rollin.
2251
2252         * accessibility/mac/AXObjectCacheMac.mm:
2253
2254 2019-01-13  Zalan Bujtas  <zalan@apple.com>
2255
2256         [LFC] Adjust assert for statically positioned fixed elements
2257         https://bugs.webkit.org/show_bug.cgi?id=193385
2258
2259         Reviewed by Antti Koivisto.
2260
2261         While computing the static position and traversing the ancestor chain, we can surely hit a positioned container
2262         (since we need to go all the way up to the initial containing block).
2263
2264         * layout/FormattingContextGeometry.cpp:
2265         (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned):
2266         (WebCore::Layout::staticHorizontalPositionForOutOfFlowPositioned):
2267
2268 2019-01-13  Antti Koivisto  <antti@apple.com>
2269
2270         Release assert with <img usemap> in shadow tree
2271         https://bugs.webkit.org/show_bug.cgi?id=193378
2272
2273         Reviewed by Ryosuke Niwa.
2274
2275         When a shadow host that has <img usemap> in the shadow tree is removed from the document, we try
2276         to remove the map from the scope of the host.
2277
2278         * html/HTMLImageElement.cpp:
2279         (WebCore::HTMLImageElement::parseAttribute):
2280         (WebCore::HTMLImageElement::insertedIntoAncestor):
2281         (WebCore::HTMLImageElement::removedFromAncestor):
2282
2283         Tree scope changes are relevant, not the connection to the document.
2284
2285 2019-01-12  Timothy Hatcher  <timothy@apple.com>
2286
2287         Have prefers-color-scheme: light always match on macOS versions before Mojave.
2288         https://bugs.webkit.org/show_bug.cgi?id=191655
2289         rdar://problem/46074680
2290
2291         Reviewed by Megan Gardner.
2292
2293         Tests: css-dark-mode/older-systems/prefers-color-scheme.html
2294                css-dark-mode/older-systems/supported-color-schemes-css.html
2295                css-dark-mode/older-systems/supported-color-schemes.html
2296
2297         Use new HAVE(OS_DARK_MODE_SUPPORT) to make it easier to find code.
2298         Added HAVE(OS_DARK_MODE_SUPPORT) around more bits to make it work on older systems.
2299
2300         * Configurations/FeatureDefines.xcconfig:
2301         * dom/Document.cpp:
2302         (WebCore::Document::useDarkAppearance const):
2303         * inspector/agents/InspectorPageAgent.cpp:
2304         (WebCore::InspectorPageAgent::enable):
2305         * page/Page.cpp:
2306         (WebCore::Page::setUseDarkAppearance):
2307         (WebCore::Page::useDarkAppearance const):
2308         (WebCore::Page::setUseDarkAppearanceOverride):
2309         * platform/mac/LocalDefaultSystemAppearance.h:
2310         (WebCore::LocalDefaultSystemAppearance::usingDarkAppearance const):
2311         * platform/mac/LocalDefaultSystemAppearance.mm:
2312         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
2313         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
2314         * platform/mac/ScrollAnimatorMac.mm:
2315         * rendering/RenderThemeMac.mm:
2316         (-[WebCoreTextFieldCell _adjustedCoreUIDrawOptionsForDrawingBordersOnly:]):
2317         (-[WebListButtonCell drawWithFrame:inView:]):
2318         (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const):
2319         (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
2320         (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const):
2321         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
2322         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const):
2323         (WebCore::RenderThemeMac::systemColor const):
2324
2325 2019-01-12  Zalan Bujtas  <zalan@apple.com>
2326
2327         [LFC] Block/InlinFormattingContext should take Block/InlineFormattingState
2328         https://bugs.webkit.org/show_bug.cgi?id=193383
2329
2330         Reviewed by Antti Koivisto.
2331
2332         This is just a downcast really.
2333
2334         * layout/FormattingContext.cpp:
2335         (WebCore::Layout::FormattingContext::FormattingContext):
2336         (WebCore::Layout::FormattingContext::formattingState const): Deleted.
2337         * layout/FormattingContext.h:
2338         * layout/LayoutState.cpp:
2339         (WebCore::Layout::LayoutState::createFormattingContext):
2340         * layout/blockformatting/BlockFormattingContext.cpp:
2341         (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
2342         * layout/blockformatting/BlockFormattingContext.h:
2343         (WebCore::Layout::BlockFormattingContext::formattingState const):
2344         (WebCore::Layout::BlockFormattingContext::blockFormattingState const): Deleted.
2345         * layout/inlineformatting/InlineFormattingContext.cpp:
2346         (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
2347         (WebCore::Layout::InlineFormattingContext::splitInlineRunIfNeeded const):
2348         (WebCore::Layout::InlineFormattingContext::createFinalRuns const):
2349         (WebCore::Layout::InlineFormattingContext::postProcessInlineRuns const):
2350         (WebCore::Layout::InlineFormattingContext::layoutInlineContent const):
2351         (WebCore::Layout::InlineFormattingContext::placeInFlowPositionedChildren const):
2352         (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):
2353         (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
2354         * layout/inlineformatting/InlineFormattingContext.h:
2355         (WebCore::Layout::InlineFormattingContext::formattingState const):
2356         (WebCore::Layout::InlineFormattingContext::inlineFormattingState const): Deleted.
2357         * page/FrameViewLayoutContext.cpp:
2358         (WebCore::layoutUsingFormattingContext):
2359
2360 2019-01-12  Myles C. Maxfield  <mmaxfield@apple.com>
2361
2362         [WHLSL] Add native function synthesis passes
2363         https://bugs.webkit.org/show_bug.cgi?id=193360
2364
2365         Reviewed by Dean Jackson.
2366
2367         This patch includes all the passes in prepare() that are between the name resolver and the
2368         type checker. It involves a few small pieces:
2369
2370         - CheckDuplicateFunctions which makes sure the same function isn't defined twice
2371         - Intrinsics, which remembers all of the native types so they can be referred to by the
2372           rest of the compiler
2373         - RecursiveTypeChecker which makes sure types don't refer to themselves
2374         - SynthesizeArrayOperatorLength which creates operator.length() functions for arrays
2375         - SynthesizeConstructors which creates copy constructors and default constructors for all
2376           types
2377         - SynthesizeEnumerationFunctions which provides cast operators between enum types and their
2378           base types
2379         - SynthesizeStructureAccessors which provides getters, setters, and anders for each member
2380           of a struct
2381
2382         No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
2383         of test. When enough of the compiler is present, I'll port the reference implementation's test suite.
2384
2385         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp:
2386         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const):
2387         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp:
2388         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const):
2389         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp: Added.
2390         (WebCore::WHLSL::checkDuplicateFunctions):
2391         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
2392         * Modules/webgpu/WHLSL/WHLSLIntrinsics.cpp: Added.
2393         (WebCore::WHLSL::Intrinsics::Intrinsics):
2394         (WebCore::WHLSL::Intrinsics::add):
2395         (WebCore::WHLSL::Intrinsics::addPrimitive):
2396         (WebCore::WHLSL::Intrinsics::addVector):
2397         (WebCore::WHLSL::Intrinsics::addMatrix):
2398         (WebCore::WHLSL::Intrinsics::addFullTexture):
2399         (WebCore::WHLSL::Intrinsics::addDepthTexture):
2400         (WebCore::WHLSL::Intrinsics::addTexture):
2401         * Modules/webgpu/WHLSL/WHLSLIntrinsics.h: Added.
2402         (WebCore::WHLSL::Intrinsics::voidType const):
2403         (WebCore::WHLSL::Intrinsics::boolType const):
2404         (WebCore::WHLSL::Intrinsics::intType const):
2405         (WebCore::WHLSL::Intrinsics::uintType const):
2406         (WebCore::WHLSL::Intrinsics::samplerType const):
2407         (WebCore::WHLSL::Intrinsics::floatType const):
2408         (WebCore::WHLSL::Intrinsics::float3Type const):
2409         (WebCore::WHLSL::Intrinsics::float4Type const):
2410         * Modules/webgpu/WHLSL/WHLSLProgram.h:
2411         (WebCore::WHLSL::Program::append):
2412         (WebCore::WHLSL::Program::intrinsics):
2413         * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp: Added.
2414         (WebCore::WHLSL::checkRecursiveTypes):
2415         * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
2416         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp: Added.
2417         (WebCore::WHLSL::FindArrayTypes::takeArrayTypes):
2418         (WebCore::WHLSL::synthesizeArrayOperatorLength):
2419         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
2420         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp: Added.
2421         (WebCore::WHLSL::FindAllTypes::takeUnnamedTypes):
2422         (WebCore::WHLSL::FindAllTypes::takeNamedTypes):
2423         (WebCore::WHLSL::synthesizeConstructors):
2424         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
2425         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp: Added.
2426         (WebCore::WHLSL::synthesizeEnumerationFunctions):
2427         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
2428         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp: Added.
2429         (WebCore::WHLSL::synthesizeStructureAccessors):
2430         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp.
2431         * Sources.txt:
2432         * WebCore.xcodeproj/project.pbxproj:
2433
2434 2019-01-12  Dan Bernstein  <mitz@apple.com>
2435
2436         [Cocoa] Avoid importing directly from subumbrella frameworks
2437         https://bugs.webkit.org/show_bug.cgi?id=186016
2438         <rdar://problem/40591038>
2439
2440         Reviewed by Sam Weinig.
2441
2442         * Configurations/WebCore.xcconfig: Removed -iframework options from OTHER_CFLAGS and
2443           OTHER_CPLUSPLUSFLAGS.
2444         * editing/mac/DictionaryLookupLegacy.mm: Import Quartz.h instead of a PDFKit header.
2445         * platform/mac/PlatformEventFactoryMac.mm: Import Carbon.h instead of HIToolbox headers.
2446         * platform/text/mac/TextEncodingRegistryMac.mm: Import Carbon.h instead of CarbonCore.h.
2447
2448 2019-01-12  Zalan Bujtas  <zalan@apple.com>
2449
2450         [LFC] Move formatting context creation from FormattingState to LayoutState
2451         https://bugs.webkit.org/show_bug.cgi?id=193381
2452
2453         Reviewed by Antti Koivisto.
2454
2455         layoutState().createFormattingStateForFormattingRootIfNeeded(root).createFormattingContext(root) is not only mouthful
2456         but also feels unintuitive. Use layoutState().createFormattingContext(root) instead.
2457
2458         * layout/FormattingContext.cpp:
2459         (WebCore::Layout::FormattingContext::FormattingContext):
2460         (WebCore::Layout::FormattingContext::~FormattingContext):
2461         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
2462         * layout/FormattingContextGeometry.cpp:
2463         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
2464         * layout/FormattingState.h:
2465         * layout/LayoutState.cpp:
2466         (WebCore::Layout::LayoutState::layoutFormattingContextSubtree):
2467         (WebCore::Layout::LayoutState::createFormattingContext):
2468         * layout/LayoutState.h:
2469         (WebCore::Layout::LayoutState::deregisterFormattingContext):
2470         (WebCore::Layout::LayoutState::registerFormattingContext):
2471         * layout/blockformatting/BlockFormattingContext.cpp:
2472         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
2473         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
2474         * layout/blockformatting/BlockFormattingState.cpp:
2475         (WebCore::Layout::BlockFormattingState::createFormattingContext): Deleted.
2476         * layout/blockformatting/BlockFormattingState.h:
2477         * layout/inlineformatting/InlineFormattingContext.cpp:
2478         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
2479         * layout/inlineformatting/InlineFormattingState.cpp:
2480         (WebCore::Layout::InlineFormattingState::createFormattingContext): Deleted.
2481         * layout/inlineformatting/InlineFormattingState.h:
2482
2483 2019-01-12  Zalan Bujtas  <zalan@apple.com>
2484
2485         [LFC][BFC][MarginCollapsing] Move estimatedMarginBefore flag from state/display box to BlockFormattingContext
2486         https://bugs.webkit.org/show_bug.cgi?id=193375
2487
2488         Reviewed by Antti Koivisto.
2489
2490         The estimated marginBefore is a pre-computed, temporary value. We need to keep it around until the final vertical margin value is computed.
2491         Neither BlockFormattingState nor Display should hold temporary values.
2492
2493         * layout/blockformatting/BlockFormattingContext.cpp:
2494         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBefore const):
2495         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBeforeForAncestors const):
2496         (WebCore::Layout::BlockFormattingContext::hasPrecomputedMarginBefore const):
2497         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
2498         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
2499         (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const):
2500         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
2501         (WebCore::Layout::BlockFormattingContext::setEstimatedMarginBefore const):
2502         (WebCore::Layout::BlockFormattingContext::hasEstimatedMarginBefore const):
2503         (WebCore::Layout::hasPrecomputedMarginBefore): Deleted.
2504         * layout/blockformatting/BlockFormattingContext.h:
2505         (WebCore::Layout::BlockFormattingContext::removeEstimatedMarginBefore const):
2506         (WebCore::Layout::BlockFormattingContext::estimatedMarginBefore const):
2507         * layout/blockformatting/BlockFormattingState.h:
2508         (WebCore::Layout::BlockFormattingState::setHasEstimatedMarginBefore): Deleted.
2509         (WebCore::Layout::BlockFormattingState::clearHasEstimatedMarginBefore): Deleted.
2510         (WebCore::Layout::BlockFormattingState::hasEstimatedMarginBefore const): Deleted.
2511         * layout/displaytree/DisplayBox.cpp:
2512         (WebCore::Display::Box::Box):
2513         * layout/displaytree/DisplayBox.h:
2514         (WebCore::Display::Box::setHasEstimatedMarginBefore):
2515         (WebCore::Display::Box::invalidateEstimatedMarginBefore):
2516         (WebCore::Display::Box::top const):
2517         (WebCore::Display::Box::topLeft const):
2518         (WebCore::Display::Box::setEstimatedMarginBefore): Deleted.
2519         (WebCore::Display::Box::estimatedMarginBefore const): Deleted.
2520         * page/FrameViewLayoutContext.cpp:
2521         (WebCore::layoutUsingFormattingContext):
2522
2523 2019-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
2524
2525         [WHLSL] Implement the NameResolver
2526         https://bugs.webkit.org/show_bug.cgi?id=193007
2527
2528         Reviewed by Dean Jackson.
2529
2530         This is the base implementation for WHLSL's name resolver. The name resolver matches three kinds of things:
2531         1. It matches VariableRefs to VariableDecls
2532         2. It matches TypeRefs to NamedTypes
2533         3. It matches CallExpressions to FunctionDeclarations
2534
2535         No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
2536         of test. When enough of the compiler is present, I'll port the reference implementation's test suite.
2537
2538         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: Now that InferTypes.h exists, we can implement these
2539         functions.
2540         (WebCore::WHLSL::AST::FloatLiteralType::canResolve const):
2541         (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const):
2542         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: Remove unnecessary function.
2543         (WebCore::WHLSL::AST::FloatLiteralType::value const): Deleted.
2544         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: Now that InferTypes.h exists, we can implement these
2545         functions.
2546         (WebCore::WHLSL::AST::IntegerLiteralType::canResolve const):
2547         (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const):
2548         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: Remove unnecessary function.
2549         (WebCore::WHLSL::AST::IntegerLiteralType::value const): Deleted.
2550         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: Modifying Sources.txt caused the sources
2551         to get shuffled around, so the #includes need to be fixed.
2552         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: Now that InferTypes.h exists, we can implement
2553         these functions.
2554         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::canResolve const):
2555         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const):
2556         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: Remove unnecessary function.
2557         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::value const): Deleted.
2558         * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp: Added. This is the replacement for UnificationContext in the
2559         reference compiler. It's much simpler (and we should remove UnificationContext in the reference compiler in
2560         favor of this design). It has three sets of functions: Tell if two types are the same, tell if two types are
2561         the same and commit the resolvable type, and run the above functions on type references or function arguments.
2562         (WebCore::WHLSL::matches):
2563         (WebCore::WHLSL::matchAndCommit):
2564         (WebCore::WHLSL::commit):
2565         (WebCore::WHLSL::inferTypesForTypeArguments):
2566         (WebCore::WHLSL::inferTypesForCall):
2567         * Modules/webgpu/WHLSL/WHLSLInferTypes.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp.
2568         * Modules/webgpu/WHLSL/WHLSLNameContext.cpp: Added. This is the data structure that remembers NamedTypes,
2569         FunctionDeclarations, and VariableDeclarations so NameResolver can work.
2570         (WebCore::WHLSL::NameContext::NameContext):
2571         (WebCore::WHLSL::NameContext::add):
2572         (WebCore::WHLSL::NameContext::getTypes):
2573         (WebCore::WHLSL::NameContext::getFunctions):
2574         (WebCore::WHLSL::NameContext::getVariable):
2575         (WebCore::WHLSL::NameContext::exists):
2576         * Modules/webgpu/WHLSL/WHLSLNameContext.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h.
2577         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp: Added. Use the NameContext to match up the three types of names.
2578         (WebCore::WHLSL::NameResolver::NameResolver):
2579         (WebCore::WHLSL::NameResolver::visit):
2580         (WebCore::WHLSL::resolveNamesInTypes):
2581         (WebCore::WHLSL::resolveNamesInFunctions):
2582         * Modules/webgpu/WHLSL/WHLSLNameResolver.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h.
2583         (WebCore::WHLSL::NameResolver::setCurrentFunctionDefinition):
2584         * Modules/webgpu/WHLSL/WHLSLProgram.h:
2585         (WebCore::WHLSL::Program::append): The parser needs to add all global declarations to the name context so the
2586         name resolver is ready to go as soon as parsing is finished.
2587         (WebCore::WHLSL::Program::nameContext):
2588         * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp: Added. Pick the appropriate FunctionDeclaration or
2589         NamedType for a particular CallExpression or TypeReference.
2590         (WebCore::WHLSL::conversionCost):
2591         (WebCore::WHLSL::resolveFunctionOverloadImpl):
2592         (WebCore::WHLSL::resolveTypeOverloadImpl):
2593         * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp.
2594         * Modules/webgpu/WHLSL/WHLSLResolvingType.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp. This describes the two states that a type in the type resolver can be in: either an owned
2595         UnnamedType, or a reference to a ResolvableType. This is because every expression needs to have a type
2596         associated with it, but those types might be the type of a literal (aka a ResolvableType). Multiple
2597         expressions might need to reference the same ResolvableType so when it gets resolved, all the expressions
2598         get the result.
2599         (WebCore::WHLSL::ResolvableTypeReference::ResolvableTypeReference):
2600         (WebCore::WHLSL::ResolvableTypeReference::resolvableType):
2601         * Sources.txt:
2602         * WebCore.xcodeproj/project.pbxproj:
2603
2604 2019-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
2605
2606         [WHLSL] Add a Visitor class
2607         https://bugs.webkit.org/show_bug.cgi?id=192826
2608
2609         Reviewed by Dean Jackson.
2610
2611         This patch exposes a bunch of the private members of WHLSL's AST nodes so that Visitor can recurse on constituent nodes.
2612         It also writes the recursion in Visitor.h. This is a virtual base class that gets subclassed for compiler passes.
2613
2614         I've split this part into its own patch to aid reviewing of the compiler.
2615
2616         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp:
2617         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp: Added.
2618         (WebCore::WHLSL::Visitor::visit):
2619         (WebCore::WHLSL::Visitor::checkErrorAndVisit):
2620         * Modules/webgpu/WHLSL/WHLSLVisitor.h: Added.
2621         (WebCore::WHLSL::Visitor::setError):
2622         (WebCore::WHLSL::Visitor::error const):
2623         * Sources.txt:
2624         * WebCore.xcodeproj/project.pbxproj:
2625
2626 2019-01-11  Jer Noble  <jer.noble@apple.com>
2627
2628         REGRESSION(r239419): Crash in AudioSourceProviderAVFObjC::~AudioSourceProviderAVFObjC()
2629         https://bugs.webkit.org/show_bug.cgi?id=193342
2630         <rdar://problem/47119836>
2631
2632         Reviewed by Eric Carlson.
2633
2634         Make the TapStorage used by AudioSourceProviderAVFObjC thread-safe RefCounted.
2635
2636         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
2637         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
2638         (WebCore::AudioSourceProviderAVFObjC::initCallback):
2639         (WebCore::AudioSourceProviderAVFObjC::finalizeCallback):
2640
2641 2019-01-11  John Wilander  <wilander@apple.com>
2642
2643         Compile out Web API Statistics Collection
2644         https://bugs.webkit.org/show_bug.cgi?id=193370
2645         <rdar://problem/45388584>
2646
2647         Reviewed by Brent Fulgham.
2648
2649         No new tests. This patch disables functionality. The associated tests
2650         are skipped.
2651
2652         These functions are now no-ops unless web API statistics is enabled.
2653
2654         * Configurations/FeatureDefines.xcconfig:
2655         * loader/ResourceLoadObserver.cpp:
2656         (WebCore::ResourceLoadObserver::logFontLoad):
2657         (WebCore::ResourceLoadObserver::logCanvasRead):
2658         (WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure):
2659         (WebCore::ResourceLoadObserver::logNavigatorAPIAccessed):
2660         (WebCore::ResourceLoadObserver::logScreenAPIAccessed):
2661         * loader/ResourceLoadStatistics.cpp:
2662         (WebCore::ResourceLoadStatistics::encode const):
2663         (WebCore::ResourceLoadStatistics::decode):
2664         (WebCore::ResourceLoadStatistics::toString const):
2665         (WebCore::ResourceLoadStatistics::merge):
2666         * loader/ResourceLoadStatistics.h:
2667             The associated struct members are skipped unless web API
2668             statistics is enabled.
2669
2670 2019-01-11  Sihui Liu  <sihui_liu@apple.com>
2671
2672         IndexedDB: leak WebIDBConnectionToClient for retain cycle
2673         https://bugs.webkit.org/show_bug.cgi?id=193097
2674         <rdar://problem/46899601>
2675
2676         Reviewed by Brady Eidson.
2677
2678         Let IDBConnectionToClient hold a WeakPtr of IDBConnectionToClientDelegate.
2679
2680         * Modules/indexeddb/server/IDBConnectionToClient.cpp:
2681         (WebCore::IDBServer::IDBConnectionToClient::IDBConnectionToClient):
2682         (WebCore::IDBServer::IDBConnectionToClient::identifier const):
2683         (WebCore::IDBServer::IDBConnectionToClient::didDeleteDatabase):
2684         (WebCore::IDBServer::IDBConnectionToClient::didOpenDatabase):
2685         (WebCore::IDBServer::IDBConnectionToClient::didAbortTransaction):
2686         (WebCore::IDBServer::IDBConnectionToClient::didCreateObjectStore):
2687         (WebCore::IDBServer::IDBConnectionToClient::didDeleteObjectStore):
2688         (WebCore::IDBServer::IDBConnectionToClient::didRenameObjectStore):
2689         (WebCore::IDBServer::IDBConnectionToClient::didClearObjectStore):
2690         (WebCore::IDBServer::IDBConnectionToClient::didCreateIndex):
2691         (WebCore::IDBServer::IDBConnectionToClient::didDeleteIndex):
2692         (WebCore::IDBServer::IDBConnectionToClient::didRenameIndex):
2693         (WebCore::IDBServer::IDBConnectionToClient::didPutOrAdd):
2694         (WebCore::IDBServer::IDBConnectionToClient::didGetRecord):
2695         (WebCore::IDBServer::IDBConnectionToClient::didGetAllRecords):
2696         (WebCore::IDBServer::IDBConnectionToClient::didGetCount):
2697         (WebCore::IDBServer::IDBConnectionToClient::didDeleteRecord):
2698         (WebCore::IDBServer::IDBConnectionToClient::didOpenCursor):
2699         (WebCore::IDBServer::IDBConnectionToClient::didIterateCursor):
2700         (WebCore::IDBServer::IDBConnectionToClient::didCommitTransaction):
2701         (WebCore::IDBServer::IDBConnectionToClient::fireVersionChangeEvent):
2702         (WebCore::IDBServer::IDBConnectionToClient::didStartTransaction):
2703         (WebCore::IDBServer::IDBConnectionToClient::didCloseFromServer):
2704         (WebCore::IDBServer::IDBConnectionToClient::notifyOpenDBRequestBlocked):
2705         (WebCore::IDBServer::IDBConnectionToClient::didGetAllDatabaseNames):
2706         * Modules/indexeddb/server/IDBConnectionToClient.h:
2707         * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
2708
2709 2019-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
2710
2711         Fix the build after r239844
2712         https://bugs.webkit.org/show_bug.cgi?id=192991
2713
2714         Unreviewed.
2715
2716         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp:
2717         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp:
2718         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp:
2719         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp:
2720
2721 2019-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2722
2723         [iOS] Precision drop state thrashes when dragging near the top edge of an editable element
2724         https://bugs.webkit.org/show_bug.cgi?id=193364
2725         <rdar://problem/47214117>
2726
2727         Reviewed by Tim Horton.
2728
2729         Add a new helper method on DragCaretController to compute the bounds of the editable element around the drop
2730         caret position. This is either the enclosing form control (in the case of text fields and text areas), or the
2731         highest editable root. See WebKit ChangeLog for more details.
2732
2733         Test: DragAndDropTests.AvoidPreciseDropNearTopOfTextArea
2734
2735         * editing/FrameSelection.cpp:
2736         (WebCore::DragCaretController::editableElementRectInRootViewCoordinates const):
2737         * editing/FrameSelection.h:
2738
2739 2019-01-11  Tim Horton  <timothy_horton@apple.com>
2740
2741         REGRESSION (PSON): Firefox app lacks Open in New Tab in menu
2742         https://bugs.webkit.org/show_bug.cgi?id=193366
2743         <rdar://problem/46097212>
2744
2745         Reviewed by Simon Fraser.
2746
2747         * platform/RuntimeApplicationChecks.h:
2748         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2749         (WebCore::IOSApplication::isFirefox):
2750         Add a Firefox Mobile bundle check.
2751
2752 2019-01-11  Antti Koivisto  <antti@apple.com>
2753
2754         Release assert when removing element with a map element in the shadow tree
2755         https://bugs.webkit.org/show_bug.cgi?id=193351
2756         <rdar://problem/47208807>
2757
2758         Reviewed by Ryosuke Niwa.
2759
2760         When a shadow host that has a map element in the shadow tree is removed from the document, we try
2761         to remove the map from the scope of the host.
2762
2763         Test: fast/shadow-dom/image-map-tree-scope.html
2764
2765         * html/HTMLMapElement.cpp:
2766         (WebCore::HTMLMapElement::insertedIntoAncestor):
2767         (WebCore::HTMLMapElement::removedFromAncestor):
2768
2769         Add and remove image maps when the scope changes, not when the document changes.
2770         This matches how id/name/etc updates work in the HTMLElement.
2771
2772 2019-01-11  Sihui Liu  <sihui_liu@apple.com>
2773
2774         Fix an assertion in UniqueIDBDatabase
2775         https://bugs.webkit.org/show_bug.cgi?id=193096
2776
2777         Reviewed by Brady Eidson.
2778
2779         m_objectStoreTransactionCounts.count(objectStore) == 1 in UniqueIDBDatabase::operationAndTransactionTimerFired()
2780         is not necessarily true because m_objectStoreTransactionCounts may be cleared in immediateCloseForUserDelete.
2781
2782         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2783         (WebCore::IDBServer::UniqueIDBDatabase::operationAndTransactionTimerFired):
2784
2785 2019-01-11  Miguel Gomez  <magomez@igalia.com>
2786
2787         [GTK] Garbled rendering on Youtube while scrolling under X11.
2788         https://bugs.webkit.org/show_bug.cgi?id=192982
2789
2790         Reviewed by Carlos Garcia Campos.
2791
2792         When creating a GLX window context, try to get a GLXFBConfig that has depth and stencil buffers for
2793         the default framebuffer.
2794
2795         * platform/graphics/glx/GLContextGLX.cpp:
2796         (WebCore::compatibleVisuals):
2797         (WebCore::GLContextGLX::createWindowContext):
2798
2799 2019-01-11  Sihui Liu  <sihui_liu@apple.com>
2800
2801         IndexedDB: leak IDBTransaction, TransactionOperation and IDBRequest in layout tests
2802         https://bugs.webkit.org/show_bug.cgi?id=193167
2803         <rdar://problem/46891688>
2804
2805         Reviewed by Geoffrey Garen.
2806
2807         Do some cleanup to break retain cycle when context is stopped. 
2808
2809         * Modules/indexeddb/IDBOpenDBRequest.cpp:
2810         (WebCore::IDBOpenDBRequest::cancelForStop):
2811         * Modules/indexeddb/IDBTransaction.cpp:
2812         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
2813         (WebCore::IDBTransaction::stop):
2814         (WebCore::IDBTransaction::removeRequest):
2815         * Modules/indexeddb/client/TransactionOperation.h:
2816         (WebCore::IDBClient::TransactionOperation::doComplete):
2817
2818 2019-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2819
2820         Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
2821         https://bugs.webkit.org/show_bug.cgi?id=193109
2822         <rdar://problem/44807048>
2823
2824         Reviewed by Ryosuke Niwa.
2825
2826         Adds new IDL files and stubs for UndoManager and UndoItem. This is an experimental DOM API that (in the near
2827         future) is intended only for use in internal WebKit text editing clients. This API allows the page to
2828         participate in the processes of undoing and redoing by defining custom undo and redo handlers, to be executed
2829         when undo or redo is triggered.
2830
2831         Tests: editing/undo-manager/undo-manager-interfaces.html
2832                editing/undo-manager/undo-manager-keeps-wrapper-alive.html
2833
2834         * CMakeLists.txt:
2835         * DerivedSources-input.xcfilelist:
2836         * DerivedSources-output.xcfilelist:
2837         * DerivedSources.make:
2838         * Sources.txt:
2839         * UnifiedSources-input.xcfilelist:
2840         * WebCore.xcodeproj/project.pbxproj:
2841
2842         Add new source files.
2843
2844         * bindings/js/WebCoreBuiltinNames.h:
2845
2846         Add "UndoManager" and "UndoItem" names.
2847
2848         * dom/Document.cpp:
2849         (WebCore::m_undoManager):
2850
2851         Have the document own a UndoManager.
2852
2853         * dom/Document.h:
2854         (WebCore::Document::undoManager const):
2855         * dom/Document.idl:
2856         * page/RuntimeEnabledFeatures.h:
2857         (WebCore::RuntimeEnabledFeatures::setUndoManagerAPIEnabled):
2858         (WebCore::RuntimeEnabledFeatures::undoManagerAPIEnabled const):
2859
2860         Guard the new bindings behind a runtime-enabled feature flag.
2861
2862         * page/UndoItem.h: Added.
2863         (WebCore::UndoItem::create):
2864         (WebCore::UndoItem::label const):
2865         (WebCore::UndoItem::undoHandler const):
2866         (WebCore::UndoItem::redoHandler const):
2867         (WebCore::UndoItem::UndoItem):
2868         * page/UndoItem.idl: Added.
2869         * page/UndoManager.cpp: Added.
2870         (WebCore::UndoManager::addItem):
2871         * page/UndoManager.h: Added.
2872         (WebCore::UndoManager::create):
2873         (WebCore::UndoManager::document):
2874         (WebCore::UndoManager::UndoManager):
2875         * page/UndoManager.idl: Added.
2876         * page/mac/WheelEventDeltaFilterMac.h:
2877
2878         Necessary (albeit unrelated) build fix to appease unified sources.
2879
2880 2019-01-11  Zalan Bujtas  <zalan@apple.com>
2881
2882         [LFC][BFC][MarginCollapsing] Adjust vertical position when box margin collapses through.
2883         https://bugs.webkit.org/show_bug.cgi?id=193346
2884
2885         Reviewed by Antti Koivisto.
2886
2887         If the top and bottom margins of a box are adjoining, then it is possible for margins to collapse through it.
2888         In this case, the position of the element depends on its relationship with the other elements whose margins are being collapsed.
2889
2890         1. If the element's margins are collapsed with its parent's top margin, the top border edge of the box is defined to be the same as the parent's.
2891         2. Otherwise, either the element's parent is not taking part in the margin collapsing, or only the parent's bottom margin is involved.
2892            The position of the element's top border edge is the same as it would have been if the element had a non-zero bottom border.
2893
2894         Test: fast/block/block-only/collapsed-through-with-parent.html
2895
2896         * layout/MarginTypes.h:
2897         (WebCore::Layout::EstimatedMarginBefore::usedValue const):
2898         * layout/blockformatting/BlockFormattingContext.cpp:
2899         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBefore const):
2900         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
2901         (WebCore::Layout::BlockFormattingContext::adjustedVerticalPositionAfterMarginCollapsing const):
2902         * layout/blockformatting/BlockFormattingContext.h:
2903         * layout/blockformatting/BlockMarginCollapse.cpp:
2904         (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore):
2905         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeIgnoringCollapsingThrough):
2906
2907 2019-01-10  Myles C. Maxfield  <mmaxfield@apple.com>
2908
2909         [WHLSL] Include the standard library
2910         https://bugs.webkit.org/show_bug.cgi?id=192994
2911
2912         Reviewed by Jon Lee.
2913
2914         A small section of the standard library is present in WHLSLStandardLibrary.txt. This gets turned into a header file containing
2915         its raw data at build time by invoking our xxd.pl script (which WebCore already uses for other purposes). The standard
2916         library is generated by running a JavaScript script, but currently there is no way to invoke JavaScript from our build
2917         process, so this patch includes in the standard library's raw text instead. Once the parser is faster, we can include the
2918         entire standard library.
2919
2920         No new tests because it isn't hooked up yet.
2921
2922         * DerivedSources.make:
2923         * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt: Added.
2924         * WebCore.xcodeproj/project.pbxproj:
2925
2926 2019-01-10  Jer Noble  <jer.noble@apple.com>
2927
2928         <video> elements do not enter 'paused' state when playing to end over AirPlay
2929         https://bugs.webkit.org/show_bug.cgi?id=193295
2930         <rdar://problem/46708670>
2931
2932         Reviewed by Eric Carlson.
2933
2934         Adopt the -[AVPlayer timeControlStatus] API, which reports whether the AVPlayer is paused, playing, or blocked waiting
2935         for more data before playing. AirPlay devices report this state back from the remote device, and this allows the
2936         MediaPlayerPrivateAVFoundationObjC to differentiate between user-generated pauses and simple stalling.
2937
2938         Adopting this API allows us to remove the heuristic from rateChanged() which inteprets a rate change when the
2939         readyState > HAVE_ENOUGH as an intentional pause.
2940
2941         Drive-by fix: MediaPlayerPrivateAVFoundation had some code to delay calling platformPlay()
2942         until the first frame became available. But this code was entirely undermined by the previous
2943         behavior of setRate(). Fixing setRate()/setRateDouble() to only start playback if playback was
2944         actually requested started making this code work for the first time, and broke some API tests.
2945         Thus, we're removing this previously dead code.
2946
2947         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
2948         (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
2949         (WebCore::MediaPlayerPrivateAVFoundation::play):
2950         (WebCore::MediaPlayerPrivateAVFoundation::pause):
2951         (WebCore::MediaPlayerPrivateAVFoundation::rateChanged):
2952         (WebCore::MediaPlayerPrivateAVFoundation::updateStates):
2953         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
2954         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2955         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2956         (WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad):
2957         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
2958         (WebCore::MediaPlayerPrivateAVFoundationObjC::didEnd):
2959         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformPlay):
2960         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformPause):
2961         (WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime):
2962         (WebCore::MediaPlayerPrivateAVFoundationObjC::setRateDouble):
2963         (WebCore::MediaPlayerPrivateAVFoundationObjC::setPlayerRate):
2964         (WebCore::MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange):
2965         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldObserveTimeControlStatus):
2966         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
2967
2968 2019-01-10  Myles C. Maxfield  <mmaxfield@apple.com>
2969
2970         Fix the build after r239844
2971         https://bugs.webkit.org/show_bug.cgi?id=192991
2972
2973         Unreviewed.
2974
2975         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp:
2976         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const):
2977         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const):
2978         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp:
2979         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const):
2980         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection const):
2981         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp:
2982         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const):
2983         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const):
2984         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp:
2985         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const):
2986         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const):
2987
2988 2019-01-10  Justin Fan  <justin_fan@apple.com>
2989
2990         [WebGPU] WebGPUBindGroup and device::createBindGroup prototype
2991         https://bugs.webkit.org/show_bug.cgi?id=193341
2992
2993         Reviewed by Myles C. Maxfield.
2994
2995         Add *GPUBindGroup class stubs and the ability to create WebGPUBindGroups via the API.
2996
2997         Test: bind-groups.html
2998
2999         * CMakeLists.txt:
3000         * DerivedSources.make:
3001         * Sources.txt:
3002         * WebCore.xcodeproj/project.pbxproj:
3003         * bindings/js/WebCoreBuiltinNames.h:
3004
3005         * Modules/webgpu/WebGPUBindGroup.cpp:
3006         (WebCore::WebGPUBindGroup::create):
3007         (WebCore::WebGPUBindGroup::WebGPUBindGroup):
3008         * Modules/webgpu/WebGPUBindGroup.h:
3009         * Modules/webgpu/WebGPUBindGroup.idl: Enable createBindGroup().
3010         * Modules/webgpu/WebGPUDevice.cpp:
3011         (WebCore::BindingResourceVisitor::operator() const): Added. Validate and convert WebGPUBindGroupDescriptor to GPU* version.
3012         (WebCore::WebGPUDevice::createBindGroup const): Added.
3013         * Modules/webgpu/WebGPUDevice.h:
3014         * platform/graphics/gpu/GPUBindGroup.cpp:
3015         (WebCore::GPUBindGroup::create):
3016         (WebCore::GPUBindGroup::GPUBindGroup):
3017         * platform/graphics/gpu/GPUBindGroup.h:
3018         * platform/graphics/gpu/GPUBufferBinding.h:
3019         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
3020         (WebCore::appendArgumentToArray): Pass RetainPtr by reference to actually update descriptor.
3021
3022 2019-01-10  Simon Fraser  <simon.fraser@apple.com>
3023
3024         Fix rare crash under ScrollbarThemeMac::paintScrollCorner()
3025         https://bugs.webkit.org/show_bug.cgi?id=193337
3026         rdar://problem/47179993
3027
3028         Reviewed by Zalan Bujtas.
3029         
3030         Async image decoding can trigger a FrameView::traverseForPaintInvalidation() fake paint,
3031         which creates a GraphicsContext with no platform context. However, we could hit ScrollView::paintScrollbars()
3032         which tried to get at the platform context, and then crashed.
3033         
3034         So protect two functions in ScrollbarThemeMac with if (context.paintingDisabled()) checks. I verified
3035         that other scrollbar-related painting code paths were already protected.
3036
3037         Hard to test because it depends on async image decoding timing.
3038
3039         * platform/mac/ScrollbarThemeMac.mm:
3040         (WebCore::ScrollbarThemeMac::paint):
3041         (WebCore::ScrollbarThemeMac::paintScrollCorner):
3042
3043 2019-01-10  Myles C. Maxfield  <mmaxfield@apple.com>
3044
3045         [WHLSL] Implement parser AST nodes
3046         https://bugs.webkit.org/show_bug.cgi?id=192991
3047
3048         Reviewed by Alex Christensen.
3049
3050         This patch creates all the AST nodes which will be the result of running the parser.
3051         This patch used to be a part of the "create a WHLSL parser" patch but I split them
3052         out in order to aid reviewing.
3053
3054         The classes were mechanically created to match the result of the parser. There are
3055         nodes for things like ForLoops, LogicalNotExpressions, DereferenceExpressions,
3056         StructureDefinitions, and things like that. The classes don't actually have any logic
3057         in them - they are currently just containers to hold the structure of the parsed
3058         program. Some of these nodes (like constexprs) are just Variants of the various things
3059         they can in the form of.
3060
3061         No new tests because the parser doesn't exist to create the new AST nodes yet.
3062
3063         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h: Added.
3064         (WebCore::WHLSL::AST::ArrayReferenceType::ArrayReferenceType):
3065         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h: Added.
3066         (WebCore::WHLSL::AST::ArrayType::ArrayType):
3067         (WebCore::WHLSL::AST::ArrayType::type const):
3068         (WebCore::WHLSL::AST::ArrayType::type):
3069         (WebCore::WHLSL::AST::ArrayType::numElements const):
3070         * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h: Added.
3071         (WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression):
3072         (WebCore::WHLSL::AST::AssignmentExpression::left):
3073         (WebCore::WHLSL::AST::AssignmentExpression::right):
3074         * Modules/webgpu/WHLSL/AST/WHLSLBaseFunctionAttribute.h: Added.
3075         (WebCore::WHLSL::AST::BaseFunctionAttribute::BaseFunctionAttribute):
3076         * Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h: Added.
3077         (WebCore::WHLSL::AST::BaseSemantic::BaseSemantic):
3078         * Modules/webgpu/WHLSL/AST/WHLSLBlock.h: Added.
3079         (WebCore::WHLSL::AST::Block::Block):
3080         (WebCore::WHLSL::AST::Block::statements):
3081         * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h: Added.
3082         (WebCore::WHLSL::AST::BooleanLiteral::BooleanLiteral):
3083         (WebCore::WHLSL::AST::BooleanLiteral::value const):
3084         (WebCore::WHLSL::AST::BooleanLiteral::clone const):
3085         * Modules/webgpu/WHLSL/AST/WHLSLBreak.h: Added.
3086         (WebCore::WHLSL::AST::Break::Break):
3087         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp: Added.
3088         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableType const):
3089         (WebCore::WHLSL::AST::BuiltInSemantic::isAcceptableForShaderItemDirection const):
3090         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h: Added.
3091         (WebCore::WHLSL::AST::BuiltInSemantic::BuiltInSemantic):
3092         (WebCore::WHLSL::AST::BuiltInSemantic::variable const):
3093         (WebCore::WHLSL::AST::BuiltInSemantic::operator== const):
3094         (WebCore::WHLSL::AST::BuiltInSemantic::operator!= const):
3095         * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h: Added.
3096         (WebCore::WHLSL::AST::CallExpression::CallExpression):
3097         (WebCore::WHLSL::AST::CallExpression::arguments):
3098         (WebCore::WHLSL::AST::CallExpression::name):
3099         (WebCore::WHLSL::AST::CallExpression::setCastData):
3100         (WebCore::WHLSL::AST::CallExpression::isCast):
3101         (WebCore::WHLSL::AST::CallExpression::castReturnType):
3102         (WebCore::WHLSL::AST::CallExpression::hasOverloads const):
3103         (WebCore::WHLSL::AST::CallExpression::overloads):
3104         (WebCore::WHLSL::AST::CallExpression::setOverloads):
3105         (WebCore::WHLSL::AST::CallExpression::setFunction):
3106         * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h: Added.
3107         (WebCore::WHLSL::AST::CommaExpression::CommaExpression):
3108         (WebCore::WHLSL::AST::CommaExpression::list):
3109         * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h: Added.
3110         (WebCore::WHLSL::AST::ConstantExpression::ConstantExpression):
3111         (WebCore::WHLSL::AST::ConstantExpression::integerLiteral):
3112         (WebCore::WHLSL::AST::ConstantExpression::visit):
3113         (WebCore::WHLSL::AST::ConstantExpression::visit const):
3114         (WebCore::WHLSL::AST::ConstantExpression::clone const):
3115         (WebCore::WHLSL::AST::ConstantExpression::matches const):
3116         * Modules/webgpu/WHLSL/AST/WHLSLConstantExpressionEnumerationMemberReference.h: Added.
3117         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::ConstantExpressionEnumerationMemberReference):
3118         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::left const):
3119         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::right const):
3120         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::clone const):
3121         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition):
3122         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationDefinition const):
3123         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember):
3124         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::enumerationMember const):
3125         (WebCore::WHLSL::AST::ConstantExpressionEnumerationMemberReference::setEnumerationMember):
3126         * Modules/webgpu/WHLSL/AST/WHLSLContinue.h: Added.
3127         (WebCore::WHLSL::AST::Continue::Continue):
3128         * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h: Added.
3129         (WebCore::WHLSL::AST::DereferenceExpression::DereferenceExpression):
3130         (WebCore::WHLSL::AST::DereferenceExpression::pointer):
3131         * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h: Added.
3132         (WebCore::WHLSL::AST::DoWhileLoop::DoWhileLoop):
3133         (WebCore::WHLSL::AST::DoWhileLoop::body):
3134         (WebCore::WHLSL::AST::DoWhileLoop::conditional):
3135         * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h: Added.
3136         (WebCore::WHLSL::AST::DotExpression::DotExpression):
3137         (WebCore::WHLSL::AST::DotExpression::fieldName):
3138         * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h: Added.
3139         (WebCore::WHLSL::AST::EffectfulExpressionStatement::EffectfulExpressionStatement):
3140         (WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression):
3141         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h: Added.
3142         (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition):
3143         (WebCore::WHLSL::AST::EnumerationDefinition::type):
3144         (WebCore::WHLSL::AST::EnumerationDefinition::add):
3145         (WebCore::WHLSL::AST::EnumerationDefinition::memberByName):
3146         (WebCore::WHLSL::AST::EnumerationDefinition::enumerationMembers):
3147         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h: Added.
3148         (WebCore::WHLSL::AST::EnumerationMember::EnumerationMember):
3149         (WebCore::WHLSL::AST::EnumerationMember::origin const):
3150         (WebCore::WHLSL::AST::EnumerationMember::name):
3151         (WebCore::WHLSL::AST::EnumerationMember::value):
3152         (WebCore::WHLSL::AST::EnumerationMember::setValue):
3153         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h: Added.
3154         (WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral):
3155         (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember):
3156         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: Added.
3157         (WebCore::WHLSL::AST::Expression::Expression):
3158         (WebCore::WHLSL::AST::Expression::origin const):
3159         (WebCore::WHLSL::AST::Expression::isAssignmentExpression const):
3160         (WebCore::WHLSL::AST::Expression::isBooleanLiteral const):
3161         (WebCore::WHLSL::AST::Expression::isCallExpression const):
3162         (WebCore::WHLSL::AST::Expression::isCommaExpression const):
3163         (WebCore::WHLSL::AST::Expression::isDereferenceExpression const):
3164         (WebCore::WHLSL::AST::Expression::isDotExpression const):
3165         (WebCore::WHLSL::AST::Expression::isFloatLiteral const):
3166         (WebCore::WHLSL::AST::Expression::isIndexExpression const):
3167         (WebCore::WHLSL::AST::Expression::isIntegerLiteral const):
3168         (WebCore::WHLSL::AST::Expression::isLogicalExpression const):
3169         (WebCore::WHLSL::AST::Expression::isLogicalNotExpression const):
3170         (WebCore::WHLSL::AST::Expression::isMakeArrayReferenceExpression const):
3171         (WebCore::WHLSL::AST::Expression::isMakePointerExpression const):
3172         (WebCore::WHLSL::AST::Expression::isNullLiteral const):
3173         (WebCore::WHLSL::AST::Expression::isPropertyAccessExpression const):
3174         (WebCore::WHLSL::AST::Expression::isReadModifyWriteExpression const):
3175         (WebCore::WHLSL::AST::Expression::isTernaryExpression const):
3176         (WebCore::WHLSL::AST::Expression::isUnsignedIntegerLiteral const):
3177         (WebCore::WHLSL::AST::Expression::isVariableReference const):
3178         (WebCore::WHLSL::AST::Expression::isEnumerationMemberLiteral const):
3179         * Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h: Added.
3180         (WebCore::WHLSL::AST::Fallthrough::Fallthrough):
3181         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h: Added.
3182         (WebCore::WHLSL::AST::FloatLiteral::FloatLiteral):
3183         (WebCore::WHLSL::AST::FloatLiteral::type):
3184         (WebCore::WHLSL::AST::FloatLiteral::value const):
3185         (WebCore::WHLSL::AST::FloatLiteral::clone const):
3186         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp: Added.
3187         (WebCore::WHLSL::AST::FloatLiteralType::FloatLiteralType):
3188         (WebCore::WHLSL::AST::FloatLiteralType::canResolve const):
3189         (WebCore::WHLSL::AST::FloatLiteralType::conversionCost const):
3190         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h: Added.
3191         (WebCore::WHLSL::AST::FloatLiteralType::preferredType):
3192         * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h: Added.
3193         (WebCore::WHLSL::AST::ForLoop::ForLoop):
3194         (WebCore::WHLSL::AST::ForLoop::~ForLoop):
3195         (WebCore::WHLSL::AST::ForLoop::initialization):
3196         (WebCore::WHLSL::AST::ForLoop::condition):
3197         (WebCore::WHLSL::AST::ForLoop::increment):
3198         (WebCore::WHLSL::AST::ForLoop::body):
3199         * Modules/webgpu/WHLSL/AST/WHLSLFunctionAttribute.h: Added.
3200         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h: Added.
3201         (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration):
3202         (WebCore::WHLSL::AST::FunctionDeclaration::isFunctionDefinition const):
3203         (WebCore::WHLSL::AST::FunctionDeclaration::isNativeFunctionDeclaration const):
3204         (WebCore::WHLSL::AST::FunctionDeclaration::attributeBlock):
3205         (WebCore::WHLSL::AST::FunctionDeclaration::entryPointType const):
3206         (WebCore::WHLSL::AST::FunctionDeclaration::type const):
3207         (WebCore::WHLSL::AST::FunctionDeclaration::type):
3208         (WebCore::WHLSL::AST::FunctionDeclaration::name const):
3209         (WebCore::WHLSL::AST::FunctionDeclaration::isCast const):
3210         (WebCore::WHLSL::AST::FunctionDeclaration::parameters const):
3211         (WebCore::WHLSL::AST::FunctionDeclaration::parameters):
3212         (WebCore::WHLSL::AST::FunctionDeclaration::semantic):
3213         (WebCore::WHLSL::AST::FunctionDeclaration::isOperator const):
3214         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h: Added.
3215         (WebCore::WHLSL::AST::FunctionDefinition::FunctionDefinition):
3216         (WebCore::WHLSL::AST::FunctionDefinition::block):
3217         (WebCore::WHLSL::AST::FunctionDefinition::restricted const):
3218         * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h: Added.
3219         (WebCore::WHLSL::AST::IfStatement::IfStatement):
3220         (WebCore::WHLSL::AST::IfStatement::conditional):
3221         (WebCore::WHLSL::AST::IfStatement::body):
3222         (WebCore::WHLSL::AST::IfStatement::elseBody):
3223         * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h: Added.
3224         (WebCore::WHLSL::AST::IndexExpression::IndexExpression):
3225         (WebCore::WHLSL::AST::IndexExpression::indexExpression):
3226         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp: Added.
3227         (WebCore::WHLSL::AST::IntegerLiteral::valueForSelectedType const):
3228         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h: Added.
3229         (WebCore::WHLSL::AST::IntegerLiteral::IntegerLiteral):
3230         (WebCore::WHLSL::AST::IntegerLiteral::type):
3231         (WebCore::WHLSL::AST::IntegerLiteral::value const):
3232         (WebCore::WHLSL::AST::IntegerLiteral::clone const):
3233         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp: Added.
3234         (WebCore::WHLSL::AST::IntegerLiteralType::IntegerLiteralType):
3235         (WebCore::WHLSL::AST::IntegerLiteralType::canResolve const):
3236         (WebCore::WHLSL::AST::IntegerLiteralType::conversionCost const):
3237         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h: Added.
3238         (WebCore::WHLSL::AST::IntegerLiteralType::preferredType):
3239         * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h: Added.
3240         (WebCore::WHLSL::AST::LogicalExpression::LogicalExpression):
3241         (WebCore::WHLSL::AST::LogicalExpression::type const):
3242         (WebCore::WHLSL::AST::LogicalExpression::left):
3243         (WebCore::WHLSL::AST::LogicalExpression::right):
3244         * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h: Added.
3245         (WebCore::WHLSL::AST::LogicalNotExpression::LogicalNotExpression):
3246         (WebCore::WHLSL::AST::LogicalNotExpression::operand):
3247         * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h: Added.
3248         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression):
3249         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue):
3250         * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h: Added.
3251         (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression):
3252         (WebCore::WHLSL::AST::MakePointerExpression::lValue):
3253         * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h: Added.
3254         (WebCore::WHLSL::AST::NamedType::NamedType):
3255         (WebCore::WHLSL::AST::NamedType::origin const):
3256         (WebCore::WHLSL::AST::NamedType::name):
3257         (WebCore::WHLSL::AST::NamedType::isTypeDefinition const):
3258         (WebCore::WHLSL::AST::NamedType::isStructureDefinition const):
3259         (WebCore::WHLSL::AST::NamedType::isEnumerationDefinition const):
3260         (WebCore::WHLSL::AST::NamedType::isNativeTypeDeclaration const):
3261         (WebCore::WHLSL::AST::NamedType::unifyNode const):
3262         (WebCore::WHLSL::AST::NamedType::unifyNode):
3263         * Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h: Added.
3264         (WebCore::WHLSL::AST::NativeFunctionDeclaration::NativeFunctionDeclaration):
3265         (WebCore::WHLSL::AST::NativeFunctionDeclaration::restricted const):
3266         * Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h: Added.
3267         (WebCore::WHLSL::AST::NativeTypeDeclaration::NativeTypeDeclaration):
3268         (WebCore::WHLSL::AST::NativeTypeDeclaration::name const):
3269         (WebCore::WHLSL::AST::NativeTypeDeclaration::name):
3270         (WebCore::WHLSL::AST::NativeTypeDeclaration::typeArguments):
3271         (WebCore::WHLSL::AST::NativeTypeDeclaration::isInt const):
3272         (WebCore::WHLSL::AST::NativeTypeDeclaration::isNumber const):
3273         (WebCore::WHLSL::AST::NativeTypeDeclaration::isFloating const):
3274         (WebCore::WHLSL::AST::NativeTypeDeclaration::isVector const):
3275         (WebCore::WHLSL::AST::NativeTypeDeclaration::isMatrix const):
3276         (WebCore::WHLSL::AST::NativeTypeDeclaration::isTexture const):
3277         (WebCore::WHLSL::AST::NativeTypeDeclaration::isSigned const):
3278         (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<bool const):
3279         (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<int64_t const):
3280         (WebCore::WHLSL::AST::NativeTypeDeclaration::iterateAllValues):
3281         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsInt):
3282         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsNumber):
3283         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsFloating):
3284         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsVector):
3285         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsMatrix):
3286         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsTexture):
3287         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsSigned):
3288         (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentInteger):
3289         (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentUnsignedInteger):
3290         (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentFloat):
3291         (WebCore::WHLSL::AST::NativeTypeDeclaration::setSuccessor):
3292         (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromInteger):
3293         (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromUnsignedInteger):
3294         (WebCore::WHLSL::AST::NativeTypeDeclaration::setIterateAllValues):
3295         * Modules/webgpu/WHLSL/AST/WHLSLNode.h: Added.
3296         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h: Added.
3297         (WebCore::WHLSL::AST::NullLiteral::NullLiteral):
3298         (WebCore::WHLSL::AST::NullLiteral::type):
3299         (WebCore::WHLSL::AST::NullLiteral::clone const):
3300         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp: Added.
3301         (WebCore::WHLSL::AST::NullLiteralType::canResolve const):
3302         (WebCore::WHLSL::AST::NullLiteralType::conversionCost const):
3303         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h: Added.
3304         * Modules/webgpu/WHLSL/AST/WHLSLNumThreadsFunctionAttribute.h: Added.
3305         (WebCore::WHLSL::AST::NumThreadsFunctionAttribute::NumThreadsFunctionAttribute):
3306         (WebCore::WHLSL::AST::NumThreadsFunctionAttribute::width const):
3307         (WebCore::WHLSL::AST::NumThreadsFunctionAttribute::height const):
3308         (WebCore::WHLSL::AST::NumThreadsFunctionAttribute::depth const):
3309         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h: Added.
3310         (WebCore::WHLSL::AST::PointerType::PointerType):
3311         * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h: Added.
3312         (WebCore::WHLSL::AST::PropertyAccessExpression::PropertyAccessExpression):
3313         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetOverloads):
3314         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetOverloads):
3315         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAndOverloads):
3316         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetOverloads):
3317         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetOverloads):
3318         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAndOverloads):
3319         (WebCore::WHLSL::AST::PropertyAccessExpression::base):
3320         * Modules/webgpu/WHLSL/AST/WHLSLQualifier.h: Added.
3321         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h: Added.
3322         (WebCore::WHLSL::AST::ReadModifyWriteExpression::create):
3323         (WebCore::WHLSL::AST::ReadModifyWriteExpression::setNewValueExpression):
3324         (WebCore::WHLSL::AST::ReadModifyWriteExpression::setResultExpression):
3325         (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference):
3326         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference):
3327         (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue):
3328         (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldValue):
3329         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValue):
3330         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression):
3331         (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression):
3332         (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression):
3333         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h: Added.
3334         (WebCore::WHLSL::AST::ReferenceType::ReferenceType):
3335         (WebCore::WHLSL::AST::ReferenceType::addressSpace const):
3336         (WebCore::WHLSL::AST::ReferenceType::elementType const):
3337         (WebCore::WHLSL::AST::ReferenceType::elementType):
3338         * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h: Added.
3339         (WebCore::WHLSL::AST::ResolvableType::isFloatLiteralType const):
3340         (WebCore::WHLSL::AST::ResolvableType::isIntegerLiteralType const):
3341         (WebCore::WHLSL::AST::ResolvableType::isNullLiteralType const):
3342         (WebCore::WHLSL::AST::ResolvableType::isUnsignedIntegerLiteralType const):
3343         (WebCore::WHLSL::AST::ResolvableType::resolvedType const):
3344         (WebCore::WHLSL::AST::ResolvableType::resolvedType):
3345         (WebCore::WHLSL::AST::ResolvableType::resolve):
3346         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp: Added.
3347         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const):
3348         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableForShaderItemDirection const):
3349         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h: Added.
3350         (WebCore::WHLSL::AST::ResourceSemantic::ResourceSemantic):
3351         (WebCore::WHLSL::AST::ResourceSemantic::mode const):
3352         (WebCore::WHLSL::AST::ResourceSemantic::index const):
3353         (WebCore::WHLSL::AST::ResourceSemantic::space const):
3354         (WebCore::WHLSL::AST::ResourceSemantic::operator== const):
3355         (WebCore::WHLSL::AST::ResourceSemantic::operator!= const):
3356         * Modules/webgpu/WHLSL/AST/WHLSLReturn.h: Added.
3357         (WebCore::WHLSL::AST::Return::Return):
3358         (WebCore::WHLSL::AST::Return::value):
3359         (WebCore::WHLSL::AST::Return::function):
3360         (WebCore::WHLSL::AST::Return::setFunction):
3361         * Modules/webgpu/WHLSL/AST/WHLSLSemantic.h: Added.
3362         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp: Added.
3363         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const):
3364         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableForShaderItemDirection const):
3365         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h: Added.
3366         (WebCore::WHLSL::AST::SpecializationConstantSemantic::SpecializationConstantSemantic):
3367         (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator== const):
3368         (WebCore::WHLSL::AST::SpecializationConstantSemantic::operator!= const):
3369         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp: Added.
3370         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const):
3371         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableForShaderItemDirection const):
3372         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h: Added.
3373         (WebCore::WHLSL::AST::StageInOutSemantic::StageInOutSemantic):
3374         (WebCore::WHLSL::AST::StageInOutSemantic::index const):
3375         (WebCore::WHLSL::AST::StageInOutSemantic::operator== const):
3376         (WebCore::WHLSL::AST::StageInOutSemantic::operator!= const):
3377         * Modules/webgpu/WHLSL/AST/WHLSLStatement.h: Added.
3378         (WebCore::WHLSL::AST::Statement::Statement):
3379         (WebCore::WHLSL::AST::Statement::isBlock const):
3380         (WebCore::WHLSL::AST::Statement::isBreak const):
3381         (WebCore::WHLSL::AST::Statement::isContinue const):
3382         (WebCore::WHLSL::AST::Statement::isDoWhileLoop const):
3383         (WebCore::WHLSL::AST::Statement::isEffectfulExpressionStatement const):
3384         (WebCore::WHLSL::AST::Statement::isFallthrough const):
3385         (WebCore::WHLSL::AST::Statement::isForLoop const):
3386         (WebCore::WHLSL::AST::Statement::isIfStatement const):
3387         (WebCore::WHLSL::AST::Statement::isReturn const):
3388         (WebCore::WHLSL::AST::Statement::isSwitchCase const):
3389         (WebCore::WHLSL::AST::Statement::isSwitchStatement const):
3390         (WebCore::WHLSL::AST::Statement::isTrap const):
3391         (WebCore::WHLSL::AST::Statement::isVariableDeclarationsStatement const):
3392         (WebCore::WHLSL::AST::Statement::isWhileLoop const):
3393         * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h: Added.
3394         (WebCore::WHLSL::AST::StructureDefinition::StructureDefinition):
3395         (WebCore::WHLSL::AST::StructureDefinition::structureElements):
3396         * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h: Added.
3397         (WebCore::WHLSL::AST::StructureElement::StructureElement):
3398         (WebCore::WHLSL::AST::StructureElement::origin const):
3399         (WebCore::WHLSL::AST::StructureElement::type):
3400         (WebCore::WHLSL::AST::StructureElement::name):
3401         (WebCore::WHLSL::AST::StructureElement::semantic):
3402         * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h: Added.
3403         (WebCore::WHLSL::AST::SwitchCase::SwitchCase):
3404         (WebCore::WHLSL::AST::SwitchCase::value):
3405         (WebCore::WHLSL::AST::SwitchCase::block):
3406         * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h: Added.
3407         (WebCore::WHLSL::AST::SwitchStatement::SwitchStatement):
3408         (WebCore::WHLSL::AST::SwitchStatement::value):
3409         (WebCore::WHLSL::AST::SwitchStatement::switchCases):
3410         * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h: Added.
3411         (WebCore::WHLSL::AST::TernaryExpression::TernaryExpression):
3412         (WebCore::WHLSL::AST::TernaryExpression::predicate):
3413         (WebCore::WHLSL::AST::TernaryExpression::bodyExpression):
3414         (WebCore::WHLSL::AST::TernaryExpression::elseExpression):
3415         * Modules/webgpu/WHLSL/AST/WHLSLTrap.h: Added.
3416         (WebCore::WHLSL::AST::Trap::Trap):
3417         * Modules/webgpu/WHLSL/AST/WHLSLType.h: Added.
3418         (WebCore::WHLSL::AST::Type::isNamedType const):
3419         (WebCore::WHLSL::AST::Type::isUnnamedType const):
3420         (WebCore::WHLSL::AST::Type::isResolvableType const):
3421         * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp: Added.
3422         (WebCore::WHLSL::AST::clone):
3423         * Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.h: Added.
3424         * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h: Added.
3425         (WebCore::WHLSL::AST::TypeDefinition::TypeDefinition):
3426         (WebCore::WHLSL::AST::TypeDefinition::type):
3427         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp: Added.
3428         (WebCore::WHLSL::AST::TypeReference::wrap):
3429         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h: Added.
3430         (WebCore::WHLSL::AST::TypeReference::TypeReference):
3431         (WebCore::WHLSL::AST::TypeReference::name):
3432         (WebCore::WHLSL::AST::TypeReference::typeArguments):
3433         (WebCore::WHLSL::AST::TypeReference::resolvedType const):
3434         (WebCore::WHLSL::AST::TypeReference::setResolvedType):
3435         (WebCore::WHLSL::AST::TypeReference::cloneTypeReference const):
3436         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h: Added.
3437         (WebCore::WHLSL::AST::UnnamedType::UnnamedType):
3438         (WebCore::WHLSL::AST::UnnamedType::isTypeReference const):
3439         (WebCore::WHLSL::AST::UnnamedType::isPointerType const):
3440         (WebCore::WHLSL::AST::UnnamedType::isArrayReferenceType const):
3441         (WebCore::WHLSL::AST::UnnamedType::isArrayType const):
3442         (WebCore::WHLSL::AST::UnnamedType::isReferenceType const):
3443         (WebCore::WHLSL::AST::UnnamedType::unifyNode const):
3444         (WebCore::WHLSL::AST::UnnamedType::unifyNode):
3445         (WebCore::WHLSL::AST::UnnamedType::origin const):
3446         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp: Added.
3447         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::valueForSelectedType const):
3448         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h: Added.
3449         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::UnsignedIntegerLiteral):
3450         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::type):
3451         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::value const):
3452         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const):
3453         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp: Added.
3454         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::UnsignedIntegerLiteralType):
3455         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::canResolve const):
3456         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::conversionCost const):
3457         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h: Added.
3458         (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType):
3459         * Modules/webgpu/WHLSL/AST/WHLSLValue.h: Added.
3460         (WebCore::WHLSL::AST::Value::Value):
3461         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h: Added.
3462         (WebCore::WHLSL::AST::VariableDeclaration::VariableDeclaration):
3463         (WebCore::WHLSL::AST::VariableDeclaration::origin const):
3464         (WebCore::WHLSL::AST::VariableDeclaration::name):
3465         (WebCore::WHLSL::AST::VariableDeclaration::type const):
3466         (WebCore::WHLSL::AST::VariableDeclaration::type):
3467         (WebCore::WHLSL::AST::VariableDeclaration::semantic):
3468         (WebCore::WHLSL::AST::VariableDeclaration::initializer):
3469         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h: Added.
3470         (WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement):
3471         (WebCore::WHLSL::AST::VariableDeclarationsStatement::variableDeclarations):
3472         * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h: Added.
3473         (WebCore::WHLSL::AST::VariableReference::VariableReference):
3474         (WebCore::WHLSL::AST::VariableReference::wrap):
3475         (WebCore::WHLSL::AST::VariableReference::name):
3476         (WebCore::WHLSL::AST::VariableReference::variable):
3477         (WebCore::WHLSL::AST::VariableReference::setVariable):
3478         * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: Added.
3479         (WebCore::WHLSL::AST::WhileLoop::WhileLoop):
3480         (WebCore::WHLSL::AST::WhileLoop::conditional):
3481         (WebCore::WHLSL::AST::WhileLoop::body):
3482         * Modules/webgpu/WHLSL/WHLSLLexer.cpp:
3483         * Modules/webgpu/WHLSL/WHLSLParser.cpp: Added.
3484         * Modules/webgpu/WHLSL/WHLSLParser.h: Added.
3485         * Modules/webgpu/WHLSL/WHLSLProgram.h: Added.
3486         (WebCore::WHLSL::Program::append):
3487         (WebCore::WHLSL::Program::nameContext):
3488         (WebCore::WHLSL::Program::intrinsics):
3489         (WebCore::WHLSL::Program::typeDefinitions):
3490         (WebCore::WHLSL::Program::structureDefinitions):
3491         (WebCore::WHLSL::Program::enumerationDefinitions):
3492         (WebCore::WHLSL::Program::functionDefinitions const):
3493         (WebCore::WHLSL::Program::functionDefinitions):
3494         (WebCore::WHLSL::Program::nativeFunctionDeclarations const):
3495         (WebCore::WHLSL::Program::nativeFunctionDeclarations):
3496         (WebCore::WHLSL::Program::nativeTypeDeclarations):
3497
3498 2019-01-10  Wenson Hsieh  <wenson_hsieh@apple.com>
3499
3500         Bindings generator emits incorrect code when using VoidCallback as an IDL dictionary attribute
3501         https://bugs.webkit.org/show_bug.cgi?id=193328
3502
3503         Reviewed by Chris Dumez.
3504
3505         Currently, when generating the function body of `convertDictionary`, our bindings generator does not pass in an
3506         argument to use as the `$globalObjectReference` in `JSValueToNative`, when generating code to convert a wrapped
3507         attribute value to the native value. As a result, if the generated IDL type returns `true` from
3508         `JSValueToNativeDOMConvertNeedsGlobalObject` (i.e. for callback function types), we will end up using the empty
3509         string as the generated expression for the global object. This emits syntactically incorrect code:
3510
3511             `convert<IDLCallbackFunction<JSVoidCallback>>(state, someValue, );`
3512
3513         To fix this, we pass in a string to use as the global object, which uses the given ExecState to grab the global
3514         object. Tested by augmenting TestStandaloneDictionary.idl and its generated expectation.
3515
3516         * bindings/scripts/CodeGeneratorJS.pm:
3517         (GenerateDictionaryImplementationContent):
3518         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
3519         (WebCore::convertDictionary<DictionaryImplName>):
3520         * bindings/scripts/test/TestStandaloneDictionary.idl:
3521
3522 2019-01-10  Eric Carlson  <eric.carlson@apple.com>
3523
3524         Define page media state flags for display capture.
3525         https://bugs.webkit.org/show_bug.cgi?id=193230
3526         <rdar://problem/47095142>
3527
3528         Reviewed by Youenn Fablet.
3529
3530         Test: fast/mediastream/get-display-media-muted.html
3531
3532         * Modules/mediastream/MediaStreamTrack.cpp:
3533         (WebCore::MediaStreamTrack::mediaState const):
3534         * page/MediaProducer.h:
3535         * platform/mediastream/RealtimeIncomingVideoSource.cpp:
3536         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
3537         * platform/mediastream/RealtimeMediaSource.h:
3538         * platform/mediastream/mac/AVVideoCaptureSource.h:
3539         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
3540         * platform/mediastream/mac/WindowDisplayCaptureSourceMac.h:
3541         * platform/mock/MockRealtimeAudioSource.h:
3542         * platform/mock/MockRealtimeVideoSource.h:
3543         * testing/Internals.cpp:
3544         (WebCore::Internals::pageMediaState):
3545
3546 2019-01-10  Justin Fan  <justin_fan@apple.com>
3547
3548         [WebGPU] Add BindGroupBinding, BindGroupDescriptor, and BufferBinding dictionaries from API
3549         https://bugs.webkit.org/show_bug.cgi?id=193298
3550
3551         Reviewed by Dean Jackson.
3552
3553         No new tests. No change in behavior.
3554
3555         * CMakeLists.txt:
3556         * DerivedSources.make:
3557         * Modules/webgpu/WebGPUBindGroupBinding.h: Added.
3558         * Modules/webgpu/WebGPUBindGroupBinding.idl: Added.
3559         * Modules/webgpu/WebGPUBindGroupDescriptor.h: Added.
3560         * Modules/webgpu/WebGPUBindGroupDescriptor.idl: Added.
3561         * Modules/webgpu/WebGPUBufferBinding.h: Added.
3562         * Modules/webgpu/WebGPUBufferBinding.idl: Added.
3563         * Sources.txt:
3564         * WebCore.xcodeproj/project.pbxproj:
3565         * platform/graphics/gpu/GPUBindGroupBinding.h: Added.
3566         * platform/graphics/gpu/GPUBindGroupDescriptor.h: Added.
3567         * platform/graphics/gpu/GPUBufferBinding.h: Added.
3568
3569 2019-01-09  Justin Fan  <justin_fan@apple.com>
3570
3571         [WebGPU] Fix vertex-buffer-triangle-strip test and small update to GPURenderPipeline
3572         https://bugs.webkit.org/show_bug.cgi?id=193289
3573
3574         Reviewed by Dean Jackson.
3575
3576         Fix broken test after pipeline layouts were added, and a small refactoring to GPURenderPipeline to avoid
3577         retaining its descriptor after creation.
3578
3579         * platform/graphics/gpu/GPURenderPipeline.h:
3580         (WebCore::GPURenderPipeline::primitiveTopology const):
3581         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
3582         (WebCore::GPURenderPipeline::GPURenderPipeline):
3583
3584 2019-01-09  Dean Jackson  <dino@apple.com>
3585
3586         Safari Crashing in Version 12.0.1 (14606.2.104.1.1) WebCore::GraphicsLayerCA::updateBackdropFilters
3587         https://bugs.webkit.org/show_bug.cgi?id=193309
3588         <rdar://problem/45279224>
3589
3590         Reviewed by Antoine Quint.
3591
3592         A speculative fix for a CheckedArithmetic crash triggered in updateBackdropFilters.
3593
3594         The crash log indicates we crash in a Checked<> class that is not recording
3595         overflow i.e. it is crashing due to an overflow. The only place in this function
3596         where that could happen is when we convert the FloatRect for the backdrop
3597         region into a Checked<unsigned> for width and height. This suggests that either
3598         the width or height are negative, or the float values are too large for integers,
3599         or the product of the two overflows.
3600
3601         Avoid this by using RecordOverflow, but also changing the code a little to
3602         bail if the rectangle is incorrect.
3603
3604         * platform/graphics/ca/GraphicsLayerCA.cpp:
3605         (WebCore::GraphicsLayerCA::updateBackdropFilters):
3606
3607 2019-01-10  Oriol Brufau  <obrufau@igalia.com>
3608
3609         [css-grid] Let abspos items reference implicit grid lines
3610         https://bugs.webkit.org/show_bug.cgi?id=193313
3611
3612         Reviewed by Manuel Rego Casasnovas.
3613
3614         While they can't create new implicit grid lines, abspos items
3615         can reference existing ones as clarified in
3616         https://github.com/w3c/csswg-drafts/commit/511bb63
3617
3618         This patch makes WebKit match Blink, Firefox and Edge.
3619
3620         Tests: web-platform-tests/css/css-grid/abspos/grid-positioned-items-padding-001.html
3621                web-platform-tests/css/css-grid/abspos/grid-positioned-items-unknown-named-grid-line-001.html
3622
3623         * rendering/RenderGrid.cpp:
3624         (WebCore::RenderGrid::populateExplicitGridAndOrderIterator const):
3625         Remove argument from spanSizeForAutoPlacedItem call.
3626         (WebCore::RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid const):
3627         Remove argument from spanSizeForAutoPlacedItem call.
3628         (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid const):
3629         Remove argument from spanSizeForAutoPlacedItem call.
3630         (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid const):
3631         Remove argument from spanSizeForAutoPlacedItem call.
3632         (WebCore::RenderGrid::gridAreaBreadthForOutOfFlowChild):
3633         Don't treat implicit grid lines as 'auto'.
3634         * rendering/RenderGrid.h:
3635         Remove unused gridPositionIsAutoForOutOfFlow.
3636         * rendering/style/GridPositionsResolver.cpp:
3637         (WebCore::adjustGridPositionsFromStyle):
3638         Don't treat implicit grid lines as 'auto'.
3639         Remove unused gridContainerStyle parameter.
3640         (WebCore::GridPositionsResolver::spanSizeForAutoPlacedItem):
3641         Remove argument from adjustGridPositionsFromStyle call.
3642         Remove unused gridContainerStyle parameter.
3643         (WebCore::resolveGridPositionFromStyle):
3644         Remove unnecessary assert that uses isValidNamedLineOrArea.
3645         (WebCore::GridPositionsResolver::resolveGridPositionsFromStyle):
3646         Remove argument from adjustGridPositionsFromStyle call.
3647         * rendering/style/GridPositionsResolver.h:
3648         Remove unused isValidNamedLineOrArea.
3649         Remove unused parameter from spanSizeForAutoPlacedItem.
3650
3651 2019-01-09  Matt Rajca  <mrajca@apple.com>
3652
3653         Put per-document autoplay behavior behind runtime website policies quirk instead of a compile time flag
3654         https://bugs.webkit.org/show_bug.cgi?id=193301
3655
3656         Reviewed by Jer Noble.
3657
3658         Instead of unconditionally enabling this with a compile-time flag, let clients
3659         enable the quirk on a per-load basis.
3660
3661         Tests: added API tests in favor of the current layout test as this behavior is no
3662                longer on by default unless a client opts in.
3663
3664         * html/MediaElementSession.cpp:
3665         (WebCore::needsPerDocumentAutoplayBehaviorQuirk):
3666         (WebCore::MediaElementSession::playbackPermitted const):
3667         * loader/DocumentLoader.h:
3668
3669 2019-01-10  Zalan Bujtas  <zalan@apple.com>
3670
3671         [LFC][BFC][MarginCollapsing] Take collapsed through siblings into account when computing vertical position
3672         https://bugs.webkit.org/show_bug.cgi?id=193310
3673
3674         Reviewed by Antti Koivisto.
3675
3676         If the block inflow element has previous siblings with collapsed through vertical margins,
3677         then this box's before margin could _indirectly_ collapse with the parent. Use the previous siblings
3678         to check for margin collapsing.
3679
3680         Test: fast/block/block-only/collapsed-through-siblings.html
3681
3682         * layout/blockformatting/BlockFormattingContext.cpp:
3683         (WebCore::Layout::BlockFormattingContext::adjustedVerticalPositionAfterMarginCollapsing const):
3684         * page/FrameViewLayoutContext.cpp:
3685         (WebCore::layoutUsingFormattingContext):
3686
3687 2019-01-10  Alicia Boya García  <aboya@igalia.com>
3688
3689         [MSE][GStreamer] Use GRefPtr in AppendPipeline::pushNewBuffer()
3690         https://bugs.webkit.org/show_bug.cgi?id=192934
3691
3692         Reviewed by Xabier Rodriguez-Calvar.
3693
3694         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3695         (WebCore::AppendPipeline::pushNewBuffer):
3696         * platform/graphics/gstreamer/mse/AppendPipeline.h:
3697         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
3698         (WebCore::MediaSourceClientGStreamerMSE::append):
3699
3700 2019-01-10  Carlos Garcia Campos  <cgarcia@igalia.com>
3701
3702         [FreeType] Color emoji not properly supported
3703         https://bugs.webkit.org/show_bug.cgi?id=191976
3704
3705         Reviewed by Michael Catanzaro.
3706
3707         Always try to fallback to a colored font for emojis.
3708
3709         Test: platform/gtk/fonts/font-emoji-system-fallback.html
3710
3711         * platform/graphics/ComplexTextController.cpp:
3712         (WebCore::advanceByCombiningCharacterSequence): Group regional indicators in pairs.
3713         * platform/graphics/Font.cpp:
3714         (WebCore::CharacterFallbackMapKey::CharacterFallbackMapKey):
3715         (WebCore::Font::systemFallbackFontForCharacter const): Pass PreferColoredFont::No to FontCache::systemFallbackForCharacters.
3716         * platform/graphics/Font.h: Add IsForPlatformFont enum to replace the bool parameter in systemFallbackFontForCharacter().
3717         * platform/graphics/FontCache.h:
3718         * platform/graphics/FontCascadeFonts.cpp:
3719         (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
3720         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
3721         (WebCore::characterSequenceIsEmoji): Check whether the character sequence is an emoji.
3722         (WebCore::FontCascade::fontForCombiningCharacterSequence const): In case of emojis try to fallback to a colored
3723         font even if base font can render the emoji in black and white.
3724         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3725         (WebCore::FontCache::systemFallbackForCharacters): Add PreferColoredFont parameter that is ignored.
3726         * platform/graphics/freetype/FontCacheFreeType.cpp:
3727         (WebCore::FontCache::systemFallbackForCharacters): Add PreferColoredFont parameter.
3728         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
3729         (WebCore::FontPlatformData::FontPlatformData): Initialize m_isColorBitmapFont.
3730         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
3731         (WebCore::Font::variantCapsSupportsCharacterForSynthesis const): Moved from cross-platform file.
3732         (WebCore::Font::platformSupportsCodePoint const): Add freetype implementation.
3733         * platform/graphics/win/FontCacheWin.cpp:
3734         (WebCore::FontCache::systemFallbackForCharacters): Add PreferColoredFont parameter that is ignored.
3735         * platform/text/CharacterProperties.h:
3736         (WebCore::isEmojiKeycapBase):
3737         (WebCore::isEmojiRegionalIndicator):
3738         (WebCore::isEmojiWithPresentationByDefault):
3739         (WebCore::isEmojiModifierBase):
3740
3741 2019-01-09  Antoine Quint  <graouts@apple.com>
3742
3743         [Web Animations] Audit Web Animations classes for memory reduction
3744         https://bugs.webkit.org/show_bug.cgi?id=193195
3745
3746         Reviewed by Simon Fraser and Yusuke Suzuki.
3747
3748         The classes, enums and structs added to support Web Animations were not as memory-efficient as they could be. We now order
3749         members in a way that reduces padding, use Markable<T, Traits> instead of Optional<T> where applicable, declare enums as uint8_t
3750         and removed unnecessary members.
3751
3752         As a result, classes and structs have shrunk as follows:
3753
3754         WebAnimation: 256 > 216
3755         DeclarativeAnimation: 392 > 344
3756         CSSAnimation: 416 > 368
3757         CSSTransition: 440 > 392
3758         AnimationEffect: 88 > 72
3759         KeyframeEffect: 208 > 184
3760         AnimationPlaybackEvent: 104 > 88
3761         EffectTiming: 72 > 64
3762         ComputedEffectTiming: 136 > 112
3763         AnimationTimeline: 264 > 248
3764         DocumentTimeline: 496 > 464
3765         OptionalEffectTiming: 112 > 80
3766         BaseKeyframe: 32 > 24
3767         ParsedKeyframe: 80 > 72
3768         BaseComputedKeyframe: 40 > 32
3769
3770         * animation/AnimationEffect.h: Order members in decreasing size, except for m_fill and m_direction, which we put at the top to
3771         save 8 bytes (2 bytes of padding instead of 4 before m_animation and saving 6 bytes of padding at the end).
3772         * animation/AnimationPlaybackEvent.cpp:
3773         (WebCore::AnimationPlaybackEvent::AnimationPlaybackEvent):
3774         * animation/AnimationPlaybackEvent.h:
3775         * animation/AnimationPlaybackEventInit.h:
3776         * animation/AnimationTimeline.cpp:
3777         (WebCore::AnimationTimeline::AnimationTimeline):
3778         (WebCore::AnimationTimeline::updateCSSTransitionsForElement):
3779         * animation/AnimationTimeline.h: We remove the m_classType member and instead make isDocumentTimeline() virtual.
3780         (WebCore::AnimationTimeline::isDocumentTimeline const):
3781         (): Deleted.
3782         (WebCore::AnimationTimeline::classType const): Deleted.
3783         * animation/CompositeOperation.h:
3784         * animation/CompositeOperationOrAuto.h:
3785         * animation/ComputedEffectTiming.h:
3786         * animation/DeclarativeAnimation.cpp:
3787         (WebCore::DeclarativeAnimation::DeclarativeAnimation):
3788         (WebCore::DeclarativeAnimation::invalidateDOMEvents):
3789         * animation/DeclarativeAnimation.h: We keep m_wasPending and m_previousPhase at the top to save some padding at the end.
3790         * animation/DocumentTimeline.cpp:
3791         (WebCore::DocumentTimeline::DocumentTimeline):
3792         * animation/DocumentTimeline.h:
3793         * animation/EffectTiming.h:
3794         * animation/FillMode.h:
3795         * animation/IterationCompositeOperation.h:
3796         * animation/KeyframeEffect.cpp:
3797         (WebCore::computeMissingKeyframeOffsets):
3798         (WebCore::KeyframeEffect::create):
3799         (WebCore::KeyframeEffect::KeyframeEffect):
3800         * animation/KeyframeEffect.h:
3801         * animation/OptionalEffectTiming.h:
3802         * animation/PlaybackDirection.h:
3803         * animation/WebAnimation.h:
3804         * animation/WebAnimationUtilities.h:
3805         (WebCore::WebAnimationsMarkableDoubleTraits::isEmptyValue):
3806         (WebCore::WebAnimationsMarkableDoubleTraits::emptyValue):
3807
3808 2019-01-09  Ryosuke Niwa  <rniwa@webkit.org>
3809
3810         ThreadTimers should not store a raw pointer in its heap
3811         https://bugs.webkit.org/show_bug.cgi?id=192975
3812         <rdar://problem/46893946>
3813
3814         Reviewed by Geoffrey Garen.
3815
3816         Right now, ThreadTimers's heap data structure stores a raw pointer to TimerBase. In order to harden the timer code,
3817         this patch replaces it with ThreadTimerHeapItem, a newly introduced struct, which effectively acks like
3818         WeakReference<TimerBase*> as the timer heap and TimerBase both store RefPtr to it, and TimerBase's destructor clears
3819         the raw pointer back to TimerBase*.
3820
3821         This approach was taken instead of an out-right adoptation of WeakPtr since the heap data structure requires each node
3822         in the heap to have a fixed "priority" yet WeakPtr with no valid pointer back to TimerBase would effectively lose its
3823         "priority" thereby corrupting the heap data structure. That is, each item in the heap must remember its fire time and
3824         insertion order even when the underlying TimerBase had gone away (this should never happen but the whole point of this
3825         hardening is to make it work even in the precense of such a bug).
3826
3827         This patch also moves the heap index in TimerBase to ThreadTimerHeapItem, and replaces the pointer to the heap vector
3828         in TimerBase by a reference to ThreadTimers in ThreadTimerHeapItem. Note that ThreadTimers is a per-thread singleton.
3829
3830         The correctness of this hardening was tested by commenting out the call to stop() and !isInHeap() assertion in
3831         TimerBase::~TimerBase() as well as the !isInHeap() assertion in ThreadTimerHeapItem::clearTimer() and observing that
3832         layout tests run successfully without hitting any debug assertions.
3833
3834         No new tests since there should be no observable behavior difference.
3835
3836         * WebCore.xcodeproj/project.pbxproj: Export ThreadTimers.h as a private header since it's now included in Timer.h
3837         * platform/ThreadTimers.cpp:
3838         (WebCore::ThreadTimers::updateSharedTimer): Delete ThreadTimerHeapItem's with nullptr TimerBase* (TimerBase had
3839         already been deleted). This should only happen when TimerBase's destructor failed to remove itself from the timer heap,
3840         which should never happen.
3841         (WebCore::ThreadTimers::sharedTimerFiredInternal): Ditto. Also removed the redundant code which had removed the timer
3842         from the heap since setNextFireTime does the removal already.
3843         * platform/ThreadTimers.h: Outdented the whole file.
3844         (WebCore::ThreadTimers::timerHeap): We use Vector<RefPtr<ThreadTimerHeapItem>> instead of Vector<Ref<~>> since Ref<~>
3845         doesn't have a copy constructor which is used by std::push_heap.
3846         (WebCore::ThreadTimerHeapItem): Added.
3847         (WebCore::ThreadTimerHeapItem::hasTimer const): Added.
3848         (WebCore::ThreadTimerHeapItem::setNotInHeap): Added. ThreadTimerHeapItem uses unsigned -1 as the single value which
3849         signifies the item not being in the heap instead of all negative values as in the old code in TimerBase.
3850         (WebCore::ThreadTimerHeapItem::isInHeap const): Added.
3851         (WebCore::ThreadTimerHeapItem::isFirstInHeap const): Added.
3852         (WebCore::ThreadTimerHeapItem::timer): Added.
3853         (WebCore::ThreadTimerHeapItem::clearTimer): Added.
3854         (WebCore::ThreadTimerHeapItem::heapIndex const): Added.
3855         (WebCore::ThreadTimerHeapItem::setHeapIndex): Added.
3856         (WebCore::ThreadTimerHeapItem::timerHeap const): Added.
3857         * platform/Timer.cpp:
3858         (WebCore::threadGlobalTimerHeap): This function is now only used in assertions.
3859         (WebCore::ThreadTimerHeapItem::ThreadTimerHeapItem): Added.
3860         (WebCore::ThreadTimerHeapItem::create): Added.
3861         (WebCore::TimerHeapPointer::TimerHeapPointer):
3862         (WebCore::TimerHeapPointer::operator-> const):
3863         (WebCore::TimerHeapReference::TimerHeapReference): Added a copy constructor.
3864         (WebCore::TimerHeapReference::copyRef const): Added.
3865         (WebCore::TimerHeapReference::operator RefPtr<ThreadTimerHeapItem>& const):
3866         (WebCore::TimerHeapPointer::operator* const):
3867         (WebCore::TimerHeapReference::operator=): Use move assignment operator.
3868         (WebCore::TimerHeapReference::swapWith):
3869         (WebCore::TimerHeapReference::updateHeapIndex): Extracted to share code between two verions of operator=.
3870         (WebCore::swap):
3871         (WebCore::TimerHeapIterator::TimerHeapIterator):
3872         (WebCore::TimerHeapIterator::operator-> const):
3873         (WebCore::TimerHeapLessThanFunction::compare): Added variants which take RefPtr<ThreadTimerHeapItem>.
3874         (WebCore::TimerHeapLessThanFunction::operator() const):
3875         (WebCore::TimerBase::TimerBase):
3876         (WebCore::TimerBase::~TimerBase):Clear the raw pointer in ThreadTimerHeapItem.
3877         (WebCore::TimerBase::stop):
3878         (WebCore::TimerBase::nextFireInterval const):
3879         (WebCore::TimerBase::checkHeapIndex const): Added the consistency check for other items in the heap.
3880         (WebCore::TimerBase::checkConsistency const):
3881         (WebCore::TimerBase::heapDecreaseKey):
3882         (WebCore::TimerBase::heapDelete):
3883         (WebCore::TimerBase::heapDeleteMin):
3884         (WebCore::TimerBase::heapIncreaseKey):
3885         (WebCore::TimerBase::heapInsert):
3886         (WebCore::TimerBase::heapPop):
3887         (WebCore::TimerBase::heapPopMin):
3888         (WebCore::TimerBase::heapDeleteNullMin): Added. Used to delete ThreadTimerHeapItem which no longer has a valid TimerBase.
3889         (WebCore::parentHeapPropertyHolds):
3890         (WebCore::childHeapPropertyHolds):
3891         (WebCore::TimerBase::hasValidHeapPosition const):