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