c554a119409203c67f3027531c2b511b345444e8
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-07-25  Truitt Savell  <tsavell@apple.com>
2
3         Unreviewed, rolling out r247821.
4
5         Caused two crashing Layout Tests
6
7         Reverted changeset:
8
9         "Make storing cross-origin top-level prefetches in HTTP cache
10         optional"
11         https://bugs.webkit.org/show_bug.cgi?id=199499
12         https://trac.webkit.org/changeset/247821
13
14 2019-07-25  Chris Dumez  <cdumez@apple.com>
15
16         Avoid UI Process hangs when the WebContent process is showing JS prompts / alerts
17         https://bugs.webkit.org/show_bug.cgi?id=200107
18         <rdar://problem/53034592>
19
20         Reviewed by Geoffrey Garen.
21
22         Add testing infrastructure for SendSyncOption::ProcessIncomingSyncMessagesWhenWaitingForSyncReply.
23
24         Test: fast/misc/testProcessIncomingSyncMessagesWhenWaitingForSyncReply.html
25
26         * page/ChromeClient.h:
27         * testing/Internals.cpp:
28         (WebCore::Internals::testProcessIncomingSyncMessagesWhenWaitingForSyncReply):
29         * testing/Internals.h:
30         * testing/Internals.idl:
31
32 2019-07-25  Rob Buis  <rbuis@igalia.com>
33
34         Make storing cross-origin top-level prefetches in HTTP cache optional
35         https://bugs.webkit.org/show_bug.cgi?id=199499
36
37         Reviewed by Youenn Fablet.
38
39         Add Internals API for adding an event listener to prefetch load.
40
41         Test: http/wpt/prefetch/link-prefetch-skip-disk-cache.html
42
43         * bindings/js/JSEventListener.h:
44         * dom/EventTarget.h:
45         (WebCore::EventTarget::addEventListener):
46         * dom/Node.h:
47         * html/HTMLLinkElement.h:
48         * testing/Internals.cpp:
49         (WebCore::Internals::addPrefetchLoadEventListener):
50         * testing/Internals.h:
51         * testing/Internals.idl:
52
53 2019-07-24  Yusuke Suzuki  <ysuzuki@apple.com>
54
55         [bmalloc] Add IsoHeap test to ensure that IsoHeap pages are not allocating too large VA
56         https://bugs.webkit.org/show_bug.cgi?id=200103
57
58         Reviewed by Mark Lam.
59
60         No behavior change in WebCore.
61
62         * page/MemoryRelease.cpp:
63         * page/ResourceUsageThread.h:
64         (WebCore::TagInfo::TagInfo): Deleted.
65         * page/cocoa/ResourceUsageThreadCocoa.mm:
66         (WebCore::vmPageSize): Deleted.
67         (WebCore::logFootprintComparison): Deleted.
68         (WebCore::displayNameForVMTag): Deleted.
69         (WebCore::pagesPerVMTag): Deleted.
70
71 2019-07-24  Devin Rousso  <drousso@apple.com>
72
73         Web Inspector: support `console.screenshot` with detached Nodes that are graphical
74         https://bugs.webkit.org/show_bug.cgi?id=199309
75
76         Reviewed by Joseph Pecoraro.
77
78         Test: inspector/console/console-screenshot.html
79
80         * page/PageConsoleClient.cpp:
81         (WebCore::PageConsoleClient::screenshot):
82
83 2019-07-24  Saam Barati  <sbarati@apple.com>
84
85         [WHLSL] Use bmalloc instead of system malloc for WHLSL data structures
86         https://bugs.webkit.org/show_bug.cgi?id=200063
87
88         Rubber-stamped by Sam Weinig.
89
90         This is a 25-30% WHLSL compile time speedup on Justin's textured-cube demo
91         and a ~40% compile time speedup on the hello-cube demo.
92         
93         The phases that speed up from this are:
94         checker
95         includeStandardLibrary
96         autoInitializeVariables
97         resolveProperties
98
99         * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h:
100         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
101         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
102         * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h:
103         * Modules/webgpu/WHLSL/AST/WHLSLBaseFunctionAttribute.h:
104         * Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h:
105         * Modules/webgpu/WHLSL/AST/WHLSLBlock.h:
106         * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h:
107         * Modules/webgpu/WHLSL/AST/WHLSLBreak.h:
108         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h:
109         * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:
110         * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h:
111         * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h:
112         * Modules/webgpu/WHLSL/AST/WHLSLContinue.h:
113         * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h:
114         * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h:
115         * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h:
116         * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h:
117         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h:
118         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h:
119         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h:
120         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
121         * Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h:
122         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h:
123         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h:
124         * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h:
125         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
126         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h:
127         * Modules/webgpu/WHLSL/AST/WHLSLGlobalVariableReference.h:
128         * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h:
129         * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h:
130         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h:
131         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h:
132         * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h:
133         * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h:
134         * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h:
135         * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h:
136         * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h:
137         * Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h:
138         * Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h:
139         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h:
140         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h:
141         * Modules/webgpu/WHLSL/AST/WHLSLNumThreadsFunctionAttribute.h:
142         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
143         * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h:
144         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
145         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
146         * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h:
147         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h:
148         * Modules/webgpu/WHLSL/AST/WHLSLReturn.h:
149         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.h:
150         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.h:
151         * Modules/webgpu/WHLSL/AST/WHLSLStatement.h:
152         * Modules/webgpu/WHLSL/AST/WHLSLStatementList.h:
153         * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h:
154         * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h:
155         * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h:
156         * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h:
157         * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h:
158         * Modules/webgpu/WHLSL/AST/WHLSLType.h:
159         * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h:
160         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
161         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
162         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h:
163         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h:
164         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
165         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h:
166         * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h:
167         * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h:
168         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
169
170 2019-07-24  Devin Rousso  <drousso@apple.com>
171
172         Web Inspector: support `console.screenshot` with ImageData and ImageBitmap
173         https://bugs.webkit.org/show_bug.cgi?id=199304
174
175         Reviewed by Joseph Pecoraro.
176
177         Test: inspector/console/console-screenshot.html
178
179         * page/PageConsoleClient.cpp:
180         (WebCore::PageConsoleClient::screenshot):
181
182 2019-07-24  Devin Rousso  <drousso@apple.com>
183
184         Web Inspector: REGRESSION: Overlay: highlighting a ::before/::after shows the node info of the parent instead
185         https://bugs.webkit.org/show_bug.cgi?id=200051
186
187         Reviewed by Joseph Pecoraro.
188
189         When highlighting a pseudo-element, only use the parent node for selector information. All
190         rendering data should still come from the pseudo-element itself.
191
192         * inspector/InspectorOverlay.cpp:
193         (WebCore::drawShapeHighlight):
194         (WebCore::InspectorOverlay::drawElementTitle):
195
196 2019-07-24  Devin Rousso  <drousso@apple.com>
197
198         Web Inspector: support `console.screenshot` with subclasses of CanvasRenderingContext
199         https://bugs.webkit.org/show_bug.cgi?id=199305
200
201         Reviewed by Joseph Pecoraro.
202
203         Test: inspector/console/console-screenshot.html
204
205         * page/PageConsoleClient.cpp:
206         (WebCore::canvasRenderingContext):
207         (WebCore::PageConsoleClient::record):
208         (WebCore::PageConsoleClient::recordEnd):
209         (WebCore::PageConsoleClient::screenshot):
210
211 2019-07-24  Youenn Fablet  <youenn@apple.com>
212
213         Remove MediaPlayerPrivate::supportsMuting()
214         https://bugs.webkit.org/show_bug.cgi?id=200005
215
216         Reviewed by Eric Carlson.
217
218         Remove no longer needed interface method.
219         No change of behavior.
220
221         * WebCore.order:
222         * platform/graphics/MediaPlayer.cpp:
223         (WebCore::MediaPlayer::setVolume):
224         (WebCore::MediaPlayer::setMuted):
225         * platform/graphics/MediaPlayerPrivate.h:
226         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
227         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
228         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
229         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
230         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
231         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
232
233 2019-07-24  Tim Horton  <timothy_horton@apple.com>
234
235         Daring Fireball long press highlights are unnecessarily inflated due to false illegibility
236         https://bugs.webkit.org/show_bug.cgi?id=200064
237
238         Reviewed by Geoff Garen.
239
240         If we consider text illegible on the given estimated background color,
241         we bail from doing a tightly fitted selection-only TextIndicator and
242         instead just paint the page without modification into the indicator,
243         causing ugly overlap and an excessively inflated indicator.
244
245         Change the mechanism we use to determine illegibility to be based on
246         a standard, instead of a constant chosen by hand 13 years ago.
247
248         Test: fast/text-indicator/text-indicator-with-low-contrast-text.html
249
250         * platform/graphics/ColorUtilities.cpp:
251         (WebCore::luminance):
252         Fix a typo.
253
254         (WebCore::contrastRatio):
255         Add a function that computes the contrast ratio given two colors using
256         the formula from WCAG.
257
258         * platform/graphics/ColorUtilities.h:
259         * rendering/TextPaintStyle.cpp:
260         (WebCore::textColorIsLegibleAgainstBackgroundColor):
261         Make use of WCAG's minimum legible contrast ratio instead of an
262         arbitrary color difference cutoff for determining whether we consider
263         text legible. It seems sensible and also considers the text on DF readable
264         (which it seems to be to me!).
265
266         * testing/Internals.cpp:
267         (WebCore::Internals::TextIndicatorInfo::TextIndicatorInfo):
268         * testing/Internals.h:
269         * testing/Internals.idl:
270         Expose all of the text rects to Internals, not just the bounding rect.
271         Expose some more TextIndicator options to Internals so that we can
272         turn on the legibility mechanism.
273
274 2019-07-24  Devin Rousso  <drousso@apple.com>
275
276         Web Inspector: print the target of `console.screenshot` last so the target is the closest item to the image
277         https://bugs.webkit.org/show_bug.cgi?id=199308
278
279         Reviewed by Joseph Pecoraro.
280
281         Right now, evaluating `console.screenshot(document, "test", 1);` will log a message to the
282         console with `#document`, `"test"`, and `1`, all on different lines (togglable by a
283         disclosure triangle) since `#document` isn't stringifiable.
284
285         The ideal situation would be to have `"test"` and `1` logged on the same line, and then have
286         `#document` be in a disclosure triangle. This way, you can "label" your images using
287         additional arguments (e.g. `console.screenshot(document.images[1], "second image");`), as
288         well as provide other data.
289
290         If the only argument was the target, it should print as if it was `console.log(target);`.
291
292         If there are no arguments, it should print the text "Viewport"` before the image.
293
294         Test: inspector/console/console-screenshot.html
295
296         * page/PageConsoleClient.cpp:
297         (WebCore::PageConsoleClient::addMessage):
298         (WebCore::PageConsoleClient::screenshot):
299
300 2019-07-24  Alicia Boya García  <aboya@igalia.com>
301
302         [MSE] Reenqueue after removeCodedFrames()
303         https://bugs.webkit.org/show_bug.cgi?id=199749
304
305         Reviewed by Xabier Rodriguez-Calvar.
306
307         Before this patch, SourceBuffer::removeCodedFrames() did not trigger
308         an immediate reenqueue, but rather just set the `needsReenqueuing`
309         flag, deferring it for the next append... but there may not be another
310         append! In that case, the removed frames would still wrongly play.
311
312         This is the case for instance in tests where a single long media
313         append is done and then "cropped" with SourceBuffer.erase().
314
315         Test: media/media-source/media-source-erase-after-last-append.html
316
317         * Modules/mediasource/SourceBuffer.cpp:
318         (WebCore::SourceBuffer::removeCodedFrames):
319
320 2019-07-24  Jer Noble  <jer.noble@apple.com>
321
322         Add per-document autoplay quirk for netflix.com.
323         https://bugs.webkit.org/show_bug.cgi?id=200058
324
325         Reviewed by Eric Carlson.
326
327         Opt netflix.com into the desktop-style per-document autoplay quirk.
328
329         * page/Quirks.cpp:
330         (WebCore::Quirks::needsPerDocumentAutoplayBehavior const):
331
332 2019-07-24  Alicia Boya García  <aboya@igalia.com>
333
334         [GStreamer] Don't crash with empty video src
335         https://bugs.webkit.org/show_bug.cgi?id=200081
336
337         When a <video> element is set to load empty or about:blank, a player is still
338         created, but no pipeline is loaded. This patch fixes some assertion errors that
339         manifested in that case.
340
341         Reviewed by Philippe Normand.
342
343         Test: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/video_crash_empty_src.html
344
345         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
346         (WebCore::MediaPlayerPrivateGStreamer::loadFull):
347         (WebCore::MediaPlayerPrivateGStreamer::platformDuration const):
348         (WebCore::MediaPlayerPrivateGStreamer::paused const):
349
350 2019-07-23  Justin Fan  <justin_fan@apple.com>
351
352         [WebGPU] Implement errors for GPURenderPipeline creation
353         https://bugs.webkit.org/show_bug.cgi?id=200046
354
355         Reviewed by Myles C. Maxfield.
356
357         Replacing error logging in GPURenderPipeline creation with GPUError generation. 
358         Update GPUErrorScopes to re-use an error message prefix for less boiler-plate.
359
360         Test: webgpu/render-pipeline-errors.html
361
362         * Modules/webgpu/WebGPUDevice.cpp:
363         (WebCore::WebGPUDevice::createRenderPipeline const):
364         * Modules/webgpu/WebGPURenderPipelineDescriptor.cpp:
365         (WebCore::WebGPURenderPipelineDescriptor::tryCreateGPURenderPipelineDescriptor const):
366         * Modules/webgpu/WebGPURenderPipelineDescriptor.h:
367         * platform/graphics/gpu/GPUDevice.cpp:
368         (WebCore::GPUDevice::tryCreateRenderPipeline const):
369         * platform/graphics/gpu/GPUDevice.h:
370         * platform/graphics/gpu/GPUErrorScopes.cpp:
371         (WebCore::GPUErrorScopes::generatePrefixedError):
372         * platform/graphics/gpu/GPUErrorScopes.h:
373         (WebCore::GPUErrorScopes::setErrorPrefix):
374         * platform/graphics/gpu/GPURenderPipeline.h:
375         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
376         (WebCore::tryCreateMtlDepthStencilState):
377         (WebCore::trySetVertexInput):
378         (WebCore::trySetColorStates):
379         (WebCore::trySetMetalFunctions):
380         (WebCore::trySetFunctions):
381         (WebCore::convertRenderPipelineDescriptor):
382         (WebCore::tryCreateMtlRenderPipelineState):
383         (WebCore::GPURenderPipeline::tryCreate):
384         (WebCore::GPURenderPipeline::GPURenderPipeline):
385
386 2019-07-23  Konstantin Tokarev  <annulen@yandex.ru>
387
388         ImageDecoderDirect2D::hotSpot() should return WTF::nullopt instead of default constructed value
389         https://bugs.webkit.org/show_bug.cgi?id=200055
390
391         Reviewed by Brent Fulgham.
392
393         * platform/graphics/win/ImageDecoderDirect2D.cpp:
394         (WebCore::ImageDecoderDirect2D::hotSpot const):
395
396 2019-07-23  Tim Horton  <timothy_horton@apple.com>
397
398         Long press hint has half blue shape in Feedly.com
399         https://bugs.webkit.org/show_bug.cgi?id=200053
400         <rdar://problem/53323369>
401
402         Reviewed by Simon Fraser.
403
404         No new tests, because TextIndicator snapshots are not yet testable.
405
406         * rendering/RenderLayer.cpp:
407         (WebCore::RenderLayer::paintForegroundForFragments):
408         Paint ChildBlockBackgrounds when painting selection AND backgrounds;
409         only exclude it when doing a selection-only paint.
410
411 2019-07-23  Chris Fleizach  <cfleizach@apple.com>
412
413         AX: CrashTracer: com.apple.WebKit.WebContent at WebKit: WebKit::WebSpeechSynthesisClient::speak
414         https://bugs.webkit.org/show_bug.cgi?id=199988
415
416         Reviewed by Per Arne Vollan.
417
418         Implement the reset state to cancel current speech jobs.
419
420         * Modules/speech/SpeechSynthesis.cpp:
421         (WebCore::SpeechSynthesis::startSpeakingImmediately):
422         (WebCore::SpeechSynthesis::cancel):
423         * platform/PlatformSpeechSynthesizer.h:
424         * platform/ios/PlatformSpeechSynthesizerIOS.mm:
425         (WebCore::PlatformSpeechSynthesizer::resetState):
426         * platform/mac/PlatformSpeechSynthesizerMac.mm:
427         (WebCore::PlatformSpeechSynthesizer::resetState):
428
429 2019-07-23  Zalan Bujtas  <zalan@apple.com>
430
431         [iOS] Tapping the search field on a search results page on zillow.com shows and immediately dismisses the keyboard
432         https://bugs.webkit.org/show_bug.cgi?id=200044
433         <rdar://problem/53103732>
434
435         Reviewed by Wenson Hsieh.
436
437         1. The keyboard gets dismissed as the result of scroll event.
438         2. The (horizontal)scroll event is initiated by WebKit as we try to re-center the content.
439         3. The content gets off-centered as the result of the newly constructed drop-down menu which slightly sticks out of the document to the right (layout overflows).
440
441         It works with shipping version of iOS because _zoomToFocusRect operates on stale viewport information (see r244494 for the progression).
442         This patch applies a site specific quirk to restore shipping behavior.
443
444         * page/Quirks.cpp:
445         (WebCore::Quirks::shouldAvoidScrollingWhenFocusedContentIsVisible const):
446         * page/Quirks.h:
447
448 2019-07-23  Said Abou-Hallawa  <sabouhallawa@apple.com>
449
450         CanvasRenderingContext2D.setTransfrom() reads only the aliases attributes of DOMMatrix2DInit
451         https://bugs.webkit.org/show_bug.cgi?id=199850
452
453         Reviewed by Simon Fraser.
454
455         The validateAndFixup step of DOMMatrix2DInit sets the matrix attributes 
456         (m** fields) from the aliases attributes (a, b, c, d, e, f) if the former
457         ones do not exist and the later ones exist. See
458         https://www.w3.org/TR/geometry-1/#dommatrixinit-dictionary and
459         DOMMatrixReadOnly::validateAndFixup(DOMMatrix2DInit& init).
460
461         Since CanvasRenderingContext2DBase::setTransform() validates and fixes
462         the input DOMMatrix2DInit, it should rely on matrix attributes.
463
464         Test: fast/canvas/setTransfrom-aliases-transform.html
465
466         * html/canvas/CanvasRenderingContext2DBase.cpp:
467         (WebCore::CanvasRenderingContext2DBase::setTransform):
468
469 2019-07-23  Tim Horton  <timothy_horton@apple.com>
470
471         Long press hint of AirPods buy buttons are tall and narrow during animation
472         https://bugs.webkit.org/show_bug.cgi?id=200036
473         <rdar://problem/53145697>
474
475         Reviewed by Wenson Hsieh.
476
477         New test: fast/text-indicator/text-indicator-with-tiny-child.html
478
479         * dom/Range.cpp:
480         (WebCore::Range::borderAndTextRects const):
481         * dom/Range.h:
482         Add a BoundingRectBehavior that ignores 1x1 and smaller rects.
483
484         * page/TextIndicator.cpp:
485         (WebCore::absoluteBoundingRectForRange):
486         Enable IgnoreTinyRects.
487
488 2019-07-23  Wenson Hsieh  <wenson_hsieh@apple.com>
489
490         [macOS 10.15] Web process crashes when attempting to show the font panel via Font > Show Fonts
491         https://bugs.webkit.org/show_bug.cgi?id=200021
492         <rdar://problem/53301325>
493
494         Reviewed by Ryosuke Niwa.
495
496         In macOS 10.15, attempting to access ~/Library/FontCollections/ from the web process causes a Sandbox violation
497         and a subsequent crash. This can be triggered by trying to show the font panel via Font > Show Fonts in the
498         context menu after right clicking.
499
500         In the (near) future, we should fix this by moving logic to show the font panel, color panel and styles panel
501         from the Editor in the web process to the UI process in WebKit2. However, for the time being, we can just work
502         around this by adding a new EditorClient hook to determine whether to allow the font panel to show; this returns
503         true in the legacy macOS WebKit port, and false everywhere else.
504
505         Test: editing/mac/style/do-not-crash-when-showing-font-panel.html
506
507         * editing/mac/EditorMac.mm:
508         (WebCore::Editor::showFontPanel):
509         * loader/EmptyClients.cpp:
510         * page/EditorClient.h:
511
512 2019-07-23  Ryosuke Niwa  <rniwa@webkit.org>
513
514         WebKit should strip away system font names from the pasted content
515         https://bugs.webkit.org/show_bug.cgi?id=199975
516         <rdar://problem/53336353>
517
518         Reviewed by Darin Adler.
519
520         Cocoa HTML Writer sometimes generate system font names such as ".AppleSystemUIFont", ".SFUI-Regular", and ".SF UI Mono".
521         We need to strip away these font names upon paste to avoid these font names falling back to Times New Roman.
522
523         Added the code to strip these font names away in EditingStyle::mergeStyleFromRulesForSerialization, which is used by
524         StylizedMarkupAccumulator to generate HTML during copy. This works because WebContentReader::readWebArchive invokes
525         sanitizeMarkupWithArchive which inserts the pasteboard content into a temporary document then re-serializes back to HTML
526         using StylizedMarkupAccumulator before the actual pasting happens.
527
528         This approach has a few benefits over stripping away these font names in ReplaceSelectionCommand:
529
530         1. It would only affect clients that opts-in to copy & paste sanitization. e.g. it won't affect legacy WebKit clients
531         and those that opt out of pasteboard content sanitization.
532
533         2. It preserves font names such as ".SF Blah" that a website may insert as some kind of house keeping purposes if ever.
534         While we don't have any evidence that there is any such a website but it's a real risk nonetheless. The copy side fix would
535         only affect cross-site and cross-app pasting, which is rare and less likely to affect real user scenarios.
536
537         3. It avoids exposing bogus .Apple* or .SF* font names to websites that directly use event.clipboardData.getData.
538         Indeed stripping away bogus markup like this is one of the key features / benefit of using copy & paste sanitization.
539
540         Test: editing/pasteboard/paste-cocoa-writer-markup-with-system-fonts.html
541
542         * editing/EditingStyle.cpp:
543         (WebCore::usesForbiddenSystemFontAsOnlyFontFamilyName): Added.
544         (WebCore::EditingStyle::mergeStyleFromRulesForSerialization): Added the code to remove font-family property when needed.
545         * platform/graphics/FontCache.h:
546         * platform/graphics/cocoa/FontCacheCoreText.cpp:
547         (WebCore::isSystemFont): Moved.
548         (WebCore::FontCache::isSystemFontForbiddenForEditing): Added.
549         * platform/graphics/freetype/FontCacheFreeType.cpp:
550         (WebCore::FontCache::isSystemFontForbiddenForEditing): Added. Always returns false.
551         * platform/graphics/win/FontCacheWin.cpp:
552         (WebCore::FontCache::isSystemFontForbiddenForEditing): Ditto.
553
554 2019-07-22  Yusuke Suzuki  <ysuzuki@apple.com>
555
556         [bmalloc] Each IsoPage gets 1MB VA because VMHeap::tryAllocateLargeChunk rounds up
557         https://bugs.webkit.org/show_bug.cgi?id=200024
558
559         Reviewed by Saam Barati.
560
561         Changed how we interpret VM tags. Add IsoHeap VM tag support, and rename WebAssembly tag
562         to Gigacage tag.
563
564         * page/ResourceUsageData.h:
565         * page/ResourceUsageOverlay.h:
566         * page/cocoa/ResourceUsageOverlayCocoa.mm:
567         (WebCore::HistoricResourceUsageData::HistoricResourceUsageData):
568         * page/cocoa/ResourceUsageThreadCocoa.mm:
569         (WebCore::displayNameForVMTag):
570         (WebCore::categoryForVMTag):
571
572 2019-07-22  Youenn Fablet  <youenn@apple.com>
573
574         Fix inspector override conversion in InspectorPageAgent::overrideSetting
575         https://bugs.webkit.org/show_bug.cgi?id=200017
576
577         Reviewed by Devin Rousso.
578
579         Covered by inspector/page/overrideSetting-MockCaptureDevicesEnabled.html
580         which should not fail on bots not having cameras
581
582         * inspector/agents/InspectorPageAgent.cpp:
583         (WebCore::toOptionalBool):
584         (WebCore::InspectorPageAgent::overrideSetting):
585         Previously, the conversion for the mock capture value was implicit from a bool pointer to an optional.
586         Make an explicit conversion as done for regular settings.
587
588 2019-07-22  Ross Kirsling  <ross.kirsling@sony.com>
589
590         Unreviewed non-unified build fix.
591
592         * Modules/webdatabase/DatabaseContext.h:
593         * html/HTMLDialogElement.cpp:
594         * html/HTMLScriptElement.cpp:
595         * inspector/agents/InspectorDatabaseAgent.cpp:
596         * workers/service/server/SWServerWorker.cpp:
597         * workers/service/server/SWServerWorker.h:
598         * worklets/WorkletGlobalScope.cpp:
599         * worklets/WorkletGlobalScope.h:
600
601 2019-07-22  Wenson Hsieh  <wenson_hsieh@apple.com>
602
603         [iOS] [WK1] UIWebView always jumps to the top left corner when scrolling to reveal the selection
604         https://bugs.webkit.org/show_bug.cgi?id=200013
605         <rdar://problem/52526901>
606
607         Reviewed by Simon Fraser.
608
609         After <https://trac.webkit.org/r244141>, we no longer attempt to scroll to reveal the text selection in
610         UIWebView after changing the selection, due to how we use the legacy document view rect in legacy WebKit when
611         computing the visual viewport. This causes the viewRect in RenderLayer::scrollRectToVisible to be the same size
612         as the content size, which then causes us to always scroll to the origin when revealing the selection.
613
614         To make selection revealing work again in legacy WebKit, conditionally restore the old behavior of using the
615         unobscured content rect as the view rect, only in the case where scrolling is delegated and the platform widget
616         is present.
617
618         Test: WebKitLegacy.ScrollToRevealSelection
619
620         * page/FrameView.cpp:
621         (WebCore::FrameView::viewRectExpandedByContentInsets const):
622         (WebCore::FrameView::visualViewportRectExpandedByContentInsets const): Deleted.
623
624         Additionally rename visualViewportRectExpandedByContentInsets to viewRectExpandedByContentInsets, to reflect the
625         fact that this may either be the visual viewport rect or unobscured content rect.
626
627         * page/FrameView.h:
628         * rendering/RenderLayer.cpp:
629         (WebCore::RenderLayer::scrollRectToVisible):
630
631 2019-07-22  Brent Fulgham  <bfulgham@apple.com>
632
633         Correct web audio-related crash in seed reports
634         https://bugs.webkit.org/show_bug.cgi?id=200009
635         <rdar://problem/51565203>
636
637         Reviewed by Per Arne Vollan.
638
639         Update the 'createMix' method to do proper return value checking so that
640         we can clear the result of MTAudioProcessingTapCreate if the create operation
641         failed.
642
643         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
644         (WebCore::AudioSourceProviderAVFObjC::createMix):
645
646 2019-07-22  Per Arne Vollan  <pvollan@apple.com>
647
648         Prewarmed font does not find any matches
649         https://bugs.webkit.org/show_bug.cgi?id=200007
650
651         Reviewed by Brent Fulgham.
652
653         Prewarming the font name 'SF Pro Text' does not find any matches. The font name ".SF NS Text/Display"
654         should be used instead. Also add 'Lucida Grande' to the list of prewarmed font, since it is used as
655         fallback font in many cases.
656
657         No new tests, covered by existing tests.
658
659         * platform/graphics/cocoa/FontCacheCoreText.cpp:
660         (WebCore::fontFamiliesForPrewarming):
661
662 2019-07-22  Youenn Fablet  <youenn@apple.com>
663
664         Make sure the player underlying volume is correctly set after creating a new player
665         https://bugs.webkit.org/show_bug.cgi?id=199974
666         <rdar://problem/52762559>
667
668         Reviewed by Eric Carlson.
669
670         When creating a player before starting to play, the volume might not be correctly initialized.
671         Fix that by updating the volume like done for rate and muted state.
672         A future refactoring should probably move that code in MediaPlayer.
673
674         Add an internal API to query the volume value from the underlying player.
675
676         Test: http/tests/media/audio-volume-zero.html
677
678         * html/HTMLMediaElement.cpp:
679         (WebCore::HTMLMediaElement::updateVolume):
680         (WebCore::HTMLMediaElement::updatePlayState):
681         (WebCore::HTMLMediaElement::effectiveVolume const):
682         (WebCore::HTMLMediaElement::effectiveMuted const):
683         * html/HTMLMediaElement.h:
684         * testing/Internals.cpp:
685         (WebCore::Internals::privatePlayerVolume):
686         * testing/Internals.h:
687         * testing/Internals.idl:
688         * testing/Internals.mm:
689         (WebCore::Internals::privatePlayerVolume):
690
691 2019-07-22  Devin Rousso  <drousso@apple.com>
692
693         Web Inspector: Page: mark any WebCore::Setting inspector override as UNLIKELY
694         https://bugs.webkit.org/show_bug.cgi?id=199925
695
696         Reviewed by Joseph Pecoraro.
697
698         * Scripts/SettingsTemplates/Settings.cpp.erb:
699
700 2019-07-22  Simon Fraser  <simon.fraser@apple.com>
701
702         Fix crashes in ScrollingStateNode::insertChild()
703         https://bugs.webkit.org/show_bug.cgi?id=200023
704         rdar://problem/53265378
705
706         Reviewed by Darin Adler.
707
708         Crash data suggest that ScrollingStateNode::insertChild() can be passed an index that
709         is larger than the size of the vector, causing crashes.
710
711         Fix defensively by falling back to append() if the passed index is equal to or larger
712         than the size of the children vector.
713
714         * page/scrolling/ScrollingStateNode.cpp:
715         (WebCore::ScrollingStateNode::insertChild):
716
717 2019-07-22  Simon Fraser  <simon.fraser@apple.com>
718
719         Make some constructors explicit
720         https://bugs.webkit.org/show_bug.cgi?id=199981
721
722         Reviewed by Daniel Bates.
723
724         Make explicit public constructors of objects that take POD or String& arguments,
725         to reduce the changes of the compiler doing implicit conversions.
726
727         * Modules/indexeddb/server/IndexValueEntry.h:
728         * Modules/indexeddb/server/IndexValueStore.h:
729         * Modules/indexeddb/shared/IDBDatabaseInfo.h:
730         * Modules/webdatabase/ChangeVersionData.h:
731         (WebCore::ChangeVersionData::ChangeVersionData):
732         * Modules/webdatabase/OriginLock.h:
733         * Modules/websockets/WebSocketExtensionParser.h:
734         (WebCore::WebSocketExtensionParser::WebSocketExtensionParser):
735         * bindings/js/ScriptCachedFrameData.h:
736         * contentextensions/URLFilterParser.cpp:
737         (WebCore::ContentExtensions::PatternParser::PatternParser):
738         * css/parser/CSSTokenizer.h:
739         * css/parser/SizesAttributeParser.h:
740         * dom/SpaceSplitString.cpp:
741         (WebCore::TokenIsEqualToCStringTokenProcessor::TokenIsEqualToCStringTokenProcessor):
742         * html/FormController.cpp:
743         (WebCore::SavedFormState::appendControlState):
744         (WebCore::SavedFormState::takeControlState):
745         * loader/ProgressTracker.cpp:
746         (WebCore::ProgressItem::ProgressItem):
747         * page/DragController.cpp:
748         (WebCore::DragController::DragController):
749         (WebCore::DragController::performDragOperation):
750         * page/DragController.h:
751         * page/animation/CSSPropertyAnimation.cpp:
752         (WebCore::AnimationPropertyWrapperBase::AnimationPropertyWrapperBase):
753         * page/ios/DOMTimerHoldingTank.h:
754         (WebCore::DeferDOMTimersForScope::DeferDOMTimersForScope):
755         * platform/CountedUserActivity.h:
756         (WebCore::CountedUserActivity::CountedUserActivity):
757         * platform/audio/DirectConvolver.h:
758         * platform/audio/DownSampler.h:
759         * platform/audio/DynamicsCompressorKernel.h:
760         * platform/audio/EqualPowerPanner.h:
761         * platform/audio/MultiChannelResampler.h:
762         * platform/audio/ReverbAccumulationBuffer.h:
763         * platform/audio/ReverbInputBuffer.h:
764         * platform/audio/SincResampler.cpp:
765         * platform/audio/UpSampler.h:
766         * platform/audio/ios/AudioFileReaderIOS.h:
767         * platform/audio/mac/AudioFileReaderMac.h:
768         * platform/audio/mac/AudioSessionMac.cpp:
769         (WebCore::AudioSessionPrivate::AudioSessionPrivate):
770         * platform/cf/KeyedDecoderCF.h:
771         * platform/graphics/WidthIterator.cpp:
772         (WebCore::OriginalAdvancesForCharacterTreatedAsSpace::OriginalAdvancesForCharacterTreatedAsSpace):
773         * platform/graphics/cocoa/FontCacheCoreText.h:
774         (WebCore::SynthesisPair::SynthesisPair):
775         * platform/graphics/displaylists/DisplayListItems.h:
776         (WebCore::DisplayList::DrawingItem::DrawingItem):
777         * platform/network/cf/ResourceRequest.h:
778         (WebCore::ResourceRequest::ResourceRequest):
779         * platform/text/TextCodecICU.h:
780         * rendering/RenderTableSection.h:
781         (WebCore::CellSpan::CellSpan):
782         * rendering/shapes/RasterShape.cpp:
783         * rendering/shapes/RasterShape.h:
784         (WebCore::RasterShapeIntervals::RasterShapeIntervals):
785         * testing/MockLibWebRTCPeerConnection.h:
786         (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate):
787
788 2019-07-22  Rob Buis  <rbuis@igalia.com>
789
790         Remove some unneeded code in MathOperator
791         https://bugs.webkit.org/show_bug.cgi?id=199935
792
793         Reviewed by Frédéric Wang.
794
795         Remove unused method.
796
797         No new tests, not changing behavior.
798
799         * rendering/mathml/MathOperator.h:
800
801 2019-07-21  Konstantin Tokarev  <annulen@yandex.ru>
802
803         Add DataListButtonElement.cpp to unified sources
804         https://bugs.webkit.org/show_bug.cgi?id=199989
805
806         Reviewed by Michael Catanzaro.
807
808         * Sources.txt:
809         * WebCore.xcodeproj/project.pbxproj:
810
811 2019-07-21  Andres Gonzalez  <andresg_22@apple.com>
812
813         Add accessibilityInsertText for text insertion in edit fields.
814         https://bugs.webkit.org/show_bug.cgi?id=199973
815
816         Reviewed by Chris Fleizach.
817
818         Renamed accessibilityInsertText to _accessibilityInsertText.
819
820         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
821         (-[WebAccessibilityObjectWrapper _accessibilityInsertText:]):
822         (-[WebAccessibilityObjectWrapper accessibilityInsertText:]): Deleted.
823         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
824         (-[WebAccessibilityObjectWrapper _accessibilityInsertText:]):
825         (-[WebAccessibilityObjectWrapper accessibilityInsertText:]): Deleted.
826
827 2019-07-21  Saam Barati  <sbarati@apple.com>
828
829         [WHLSL] Checker needs to setError() when a property access node can't commit its base type
830         https://bugs.webkit.org/show_bug.cgi?id=199978
831
832         Reviewed by Dean Jackson.
833
834         Test: webgpu/whlsl/null-array-property-access.html
835
836         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
837         (WebCore::WHLSL::Checker::finishVisiting):
838
839 2019-07-21  Saam Barati  <sbarati@apple.com>
840
841         [WHLSL] Return the zero-value enum in the enum-from-integer constructor when the integer is not a valid enum value
842         https://bugs.webkit.org/show_bug.cgi?id=199853
843
844         Reviewed by Dean Jackson.
845
846         Test: webgpu/whlsl/enum-integer-constructor.html
847
848         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
849         (WebCore::WHLSL::Metal::writeNativeFunction):
850
851 2019-07-21  Myles C. Maxfield  <mmaxfield@apple.com>
852
853         [iOS] Fast and complex text codepaths disagree about how to lay out bopomofo with tone marks
854         https://bugs.webkit.org/show_bug.cgi?id=199912
855         <rdar://problem/52182454>
856
857         Reviewed by Simon Fraser.
858
859         This is because CoreText has special composition rules for CJK languages, which we don't have in our simple
860         text codepath. Rather than implementing the composition rules in WebKit, we can simply disable them in
861         CoreText.
862
863         Test: fast/text/international/system-language/composition.html
864
865         * platform/graphics/mac/SimpleFontDataCoreText.cpp:
866         (WebCore::Font::getCFStringAttributes const):
867
868 2019-07-20  Andres Gonzalez  <andresg_22@apple.com>
869
870         Add accessibilityInsertText for text insertion in edit fields.
871         https://bugs.webkit.org/show_bug.cgi?id=199973
872
873         Reviewed by Chris Fleizach.
874
875         Tests: accessibility/insert-newline.html
876                accessibility/ios-simulator/insert-newline.html
877
878         Accessibility clients like VoiceOver and Voice Control were entering
879         text in text fields by replacing the entire content of the field
880         (SetValue) and then setting the insertion point to the appropriate
881         offset (SetSelectedTextRange). accessibilityInsertText gives a simpler
882         interface to clients to insert text at the insertion point location.
883         In addition, this provides a workaround for the issue encountered with
884         the previous method when inserting a linebreak.
885
886         * accessibility/AccessibilityObject.cpp:
887         (WebCore::AccessibilityObject::insertText):
888         * accessibility/AccessibilityObject.h:
889         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
890         (-[WebAccessibilityObjectWrapper accessibilityInsertText:]):
891         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
892         (-[WebAccessibilityObjectWrapper accessibilityInsertText:]):
893
894 2019-07-20  Alexander Mikhaylenko  <exalm7659@gmail.com>
895
896         REGRESSION(r246033/r246496): [GTK] Kinetic scrolling doesn't work
897         https://bugs.webkit.org/show_bug.cgi?id=199322
898
899         Reviewed by Michael Catanzaro.
900
901         Check ENABLE(KINETIC_SCROLLING) instead of ENABLE(ASYNC_SCROLLING) for kinetic scrolling.
902
903         * platform/PlatformWheelEvent.h:
904         * platform/generic/ScrollAnimatorGeneric.cpp:
905         (WebCore::ScrollAnimatorGeneric::handleWheelEvent):
906         * platform/gtk/PlatformWheelEventGtk.cpp:
907         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
908
909 2019-07-20  Zalan Bujtas  <zalan@apple.com>
910
911         [LFC][TFC] Introduce table formatting context.
912         https://bugs.webkit.org/show_bug.cgi?id=199979
913         <rdar://problem/53346292>
914
915         Reviewed by Antti Koivisto.
916
917         Add the basic class structure for the table formatting context.
918         https://www.w3.org/TR/CSS22/tables.html
919
920         * Sources.txt:
921         * WebCore.xcodeproj/project.pbxproj:
922         * layout/FormattingState.h:
923         (WebCore::Layout::FormattingState::isTableFormattingState const):
924         * layout/tableformatting/TableFormattingContext.cpp: Added.
925         (WebCore::Layout::TableFormattingContext::TableFormattingContext):
926         (WebCore::Layout::TableFormattingContext::layout const):
927         * layout/tableformatting/TableFormattingContext.h: Added.
928         * layout/tableformatting/TableFormattingState.cpp: Added.
929         (WebCore::Layout::TableFormattingState::TableFormattingState):
930         (WebCore::Layout::TableFormattingState::~TableFormattingState):
931         * layout/tableformatting/TableFormattingState.h: Added.
932         * layout/tableformatting/TableInvalidation.cpp: Added.
933         (WebCore::Layout::TableInvalidation::invalidate):
934         * layout/tableformatting/TableInvalidation.h: Added.
935
936 2019-07-20  Zalan Bujtas  <zalan@apple.com>
937
938         [LFC][IFC] Add support for mid-word break.
939         https://bugs.webkit.org/show_bug.cgi?id=199976
940         <rdar://problem/53337349>
941
942         Reviewed by Antti Koivisto.
943
944         Introduce leading and trailing InlineTextItem to support incoming and outgoing partial content.
945         TextUtil::split is a straight copy of SimpleLineLayout::split.
946
947         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
948         (WebCore::Layout::inlineItemWidth):
949         (WebCore::Layout::LineLayout::close):
950         (WebCore::Layout::LineLayout::placeInlineItem):
951         (WebCore::Layout::LineLayout::layout):
952         * layout/inlineformatting/InlineTextItem.cpp:
953         (WebCore::Layout::InlineTextItem::split const):
954         (WebCore::Layout::InlineTextItem::split): Deleted.
955         * layout/inlineformatting/InlineTextItem.h:
956         (WebCore::Layout::InlineTextItem::inlineBox const):
957         * layout/inlineformatting/text/TextUtil.cpp:
958         (WebCore::Layout::TextUtil::split):
959         * layout/inlineformatting/text/TextUtil.h:
960
961 2019-07-20  Zalan Bujtas  <zalan@apple.com>
962
963         [Text autosizing] Do not nuke the style on dynamicViewportSizeUpdate
964         https://bugs.webkit.org/show_bug.cgi?id=199718
965         <rdar://problem/53344961>
966
967         Reviewed by Simon Fraser.
968
969         When the page scale changes (e.g. as the result of shink to fit mode) we need to visit all the text content on the page and check whether they need to be boosted.
970         Currently we call setNeedsRecalcStyleInAllFrames() to accomplish it. Unfortunatelly setNeedsRecalcStyleInAllFrames destroys all the style information which means that the
971         subsequent styleResolve() needs to start from scratch.
972         This patch addresses this issue by directly adjusting the computed style information when text boosting is required and schedules layout accordingly. We also trigger this style adjusting
973         on a timer so that rapid dynamicViewportSizeUpdate() calls won't trigger redundant layouts.
974
975         * css/StyleResolver.cpp:
976         (WebCore::hasTextChild):
977         (WebCore::StyleResolver::adjustRenderStyleForTextAutosizing):
978         (WebCore::hasTextChildren): Deleted.
979         * css/StyleResolver.h:
980         * page/FrameView.h:
981         * page/Page.cpp:
982         (WebCore::Page::invalidateTextAutoSizeInAllFrames):
983         * page/Page.h:
984
985 2019-07-20  Saam Barati  <sbarati@apple.com>
986
987         [WHLSL] Make enums work
988         https://bugs.webkit.org/show_bug.cgi?id=199634
989
990         Reviewed by Robin Morisset.
991
992         This patch makes enums work. There were a couple changes needed to do this work:
993         1. In the metal codegen, we were emitting code like "EnumType.EnumValue"
994         instead of "EnumType::EnumValue".
995         
996         2. Inside the enumeration declaration AST node, we track enums in a HashMap
997         because we need to look up names of enum values in that map in parts of the
998         compiler. However, HashMap is not ordered but we were relying on the iteration
999         order of it to generate the default values of enums. E.g, in: "enum { Foo = 10, Bar }",
1000         Bar should be 11. However, there was no guarantee that we iterated over Bar
1001         after Foo. Instead, we just track the default values as we parse an enum
1002         inside of the parser. This allows us to continue to keep using HashMap without
1003         also adding an auxiliary data structure (or using more memory in some way) to
1004         track the order of the enum elements.
1005         
1006         I've also filed a patch to do follow-up work on implementing the correct
1007         operational behavior when constructing an enum from its underlying type when
1008         the underlying value does not match any enum value:
1009         https://bugs.webkit.org/show_bug.cgi?id=199853
1010
1011         Tests: webgpu/whlsl/enums-2.html
1012                webgpu/whlsl/enums.html
1013
1014         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h:
1015         (WebCore::WHLSL::AST::EnumerationMember::EnumerationMember):
1016         (WebCore::WHLSL::AST::EnumerationMember::value):
1017         (WebCore::WHLSL::AST::EnumerationMember::setValue): Deleted.
1018         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
1019         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
1020         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::constantExpressionString):
1021         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
1022         (WebCore::WHLSL::Metal::TypeNamer::emitNamedTypeDefinition):
1023         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
1024         (WebCore::WHLSL::ASTDumper::visit):
1025         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
1026         (WebCore::WHLSL::Checker::visit):
1027         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
1028         (WebCore::WHLSL::Parser::parseEnumerationDefinition):
1029         (WebCore::WHLSL::Parser::parseEnumerationMember):
1030         * Modules/webgpu/WHLSL/WHLSLParser.h:
1031         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
1032         (WebCore::WHLSL::Visitor::visit):
1033
1034 2019-07-19  Youenn Fablet  <youenn@apple.com>
1035
1036         Remote WebInspector should enable mock capture devices in UIProcess if doing it in WebProcess
1037         https://bugs.webkit.org/show_bug.cgi?id=199924
1038         <rdar://problem/50552067>
1039
1040         Reviewed by Devin Rousso.
1041
1042         Add necessary API to set mock capture devices override.
1043         In case of desynchronization between webprocess and uiprocess, make sure to return early
1044         and fail capture instead of crashing.
1045
1046         * inspector/InspectorClient.h:
1047         (WebCore::InspectorClient::setMockCaptureDevicesEnabled):
1048         * inspector/agents/InspectorPageAgent.cpp:
1049         (WebCore::InspectorPageAgent::disable):
1050         (WebCore::InspectorPageAgent::overrideSetting):
1051         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1052
1053 2019-07-19  Andy Estes  <aestes@apple.com>
1054
1055         [Apple Pay] Log less in PaymentCoordinator::shouldEnableApplePayAPIs()
1056         https://bugs.webkit.org/show_bug.cgi?id=199958
1057
1058         Reviewed by Tim Horton.
1059
1060         Only log when APIs are disabled due to user scripts.
1061
1062         * Modules/applepay/PaymentCoordinator.cpp:
1063         (WebCore::PaymentCoordinator::shouldEnableApplePayAPIs const):
1064
1065 2019-07-19  Dean Jackson  <dino@apple.com>
1066
1067         Add a menu item to toggle between showing and hiding link previews
1068         https://bugs.webkit.org/show_bug.cgi?id=199940
1069         <rdar://problem/53032288>
1070
1071         Reviewed by Beth Dakin.
1072
1073         New strings for Show/Hide Link Previews.
1074
1075         * en.lproj/Localizable.strings:
1076
1077 2019-07-19  Antoine Quint  <graouts@apple.com>
1078
1079         Links stop working after long-pressing a link (WK1)
1080         https://bugs.webkit.org/show_bug.cgi?id=199952
1081         <rdar://problem/52291860>
1082
1083         Reviewed by Wenson Hsieh.
1084
1085         Test: fast/events/touch/ios/click-after-long-press.html
1086
1087         When EventHandler::tryToBeginDragAtPoint() is called, we must reset m_mousePressed to false so that
1088         WebChromeClientIOS::observedContentChange() is called by EventHandler::mousePressed() when we would
1089         process the next tap after a drag interaction.
1090
1091         * page/ios/EventHandlerIOS.mm:
1092         (WebCore::EventHandler::tryToBeginDragAtPoint):
1093
1094 2019-07-19  Sihui Liu  <sihui_liu@apple.com>
1095
1096         IndexedDB: error in starting version change transaction may be neglected
1097         https://bugs.webkit.org/show_bug.cgi?id=199818
1098         <rdar://problem/52925738>
1099
1100         Reviewed by Brady Eidson.
1101
1102         For version change transaction, IDBServer didn't wait the result of beginTransaction on the background thread 
1103         before giving the IDBClient the result of open request. In this case, beginTransaction may fail to update the 
1104         DatabaseVersion in database file or set m_originalDatabaseInfoBeforeVersionChange, but the transaction was
1105         marked as started. When we later set m_databaseInfo with m_originalDatabaseInfoBeforeVersionChange, 
1106         m_databaseInfo could become nullptr.
1107
1108         To write a test for this, we will need to simulate an SQLite error. I manually tested this by crafting the 
1109         SQLiteStatement in beginTransaction, making it an invalid statement, and verified that error event, instead of 
1110         ungradeneeded event is dispatched to the IDBRequest.
1111
1112         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1113         (WebCore::IDBServer::UniqueIDBDatabase::startVersionChangeTransaction):
1114         (WebCore::IDBServer::UniqueIDBDatabase::performStartVersionChangeTransaction):
1115         (WebCore::IDBServer::UniqueIDBDatabase::didPerformStartVersionChangeTransaction):
1116         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
1117         (WebCore::IDBServer::UniqueIDBDatabase::beginTransactionInBackingStore): Deleted.
1118         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1119
1120 2019-07-19  Zalan Bujtas  <zalan@apple.com>
1121
1122         [LFC][IFC] Add partial content handling
1123         https://bugs.webkit.org/show_bug.cgi?id=199930
1124
1125         Reviewed by Antti Koivisto.
1126
1127         Move the actual inline item placement to a dedicated functions. This enables us to
1128         construct a dedicated InlineItem for the partial content and pass it in to this function.
1129
1130         <span>The quick brown fox jumps over the lazy dog</span> <- inline content
1131         [The][ ][quick][ ][brown][ ][fox][ ][jumps][ ][over][ ][the][ ][lazy][ ][dog] <- InlineItems
1132
1133         Line breaking:
1134         [The][ ][qu]
1135         [ick] <- Partial InlineItem (position: 6 length: 3) from [quick] (position: 4 length: 5)
1136
1137         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
1138         (WebCore::Layout::LineLayout::close):
1139         (WebCore::Layout::LineLayout::placeInlineItem):
1140         (WebCore::Layout::LineLayout::layout):
1141         (WebCore::Layout::LineInput::LineInput):
1142         (WebCore::Layout::InlineFormattingContext::InlineLayout::layout const):
1143         (WebCore::Layout::InlineFormattingContext::InlineLayout::computedIntrinsicWidth const):
1144         * layout/inlineformatting/InlineTextItem.cpp:
1145         (WebCore::Layout::InlineTextItem::split):
1146         * layout/inlineformatting/InlineTextItem.h:
1147
1148 2019-07-19  Charlie Turner  <cturner@igalia.com>
1149
1150         [GStreamer] Flush get_range calls during PAUSED->READY in WebKitWebSource
1151         https://bugs.webkit.org/show_bug.cgi?id=199934
1152
1153         Reviewed by Xabier Rodriguez-Calvar.
1154
1155         Unit testing not applicable.
1156
1157         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1158         (webKitWebSrcChangeState): A well-behaved element should unblock streaming threads
1159         during a PAUSED->READY transition, so do that here.
1160
1161 2019-07-19  Rob Buis  <rbuis@igalia.com>
1162
1163         Remove some unneeded code in MathOperator
1164         https://bugs.webkit.org/show_bug.cgi?id=199935
1165
1166         Reviewed by Frédéric Wang.
1167
1168         The initialize method is unneeded since the member
1169         variables all use default initialization.
1170
1171         No new tests, not changing behavior.
1172
1173         * rendering/mathml/MathOperator.cpp:
1174         (WebCore::MathOperator::MathOperator):
1175         (WebCore::MathOperator::GlyphAssemblyData::initialize): Deleted.
1176
1177 2019-07-18  Antoine Quint  <graouts@apple.com>
1178
1179         Enable simulated mouse events quirk for soundcloud.com
1180         https://bugs.webkit.org/show_bug.cgi?id=199908
1181         <rdar://problem/52915981>
1182
1183         Reviewed by Brent Fulgham.
1184
1185         Scrubbing on soundcloud.com relies on mouse events alone when displaying on iPad with the desktop UA string.
1186         Opting into the simulated mouse events quirk makes scrubbing work and we also ensure that page scrolling is
1187         disabled as a result of scrubbing by returning true in shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented().
1188
1189         Also making a drive-by fix in shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented() to use a reference
1190         instead of a pointer when downcasting a null-checked pointer.
1191
1192         * page/Quirks.cpp:
1193         (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
1194         (WebCore::Quirks::shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented const):
1195
1196 2019-07-18  Per Arne Vollan  <pvollan@apple.com>
1197
1198         Prewarm font cache with more fonts
1199         https://bugs.webkit.org/show_bug.cgi?id=199283
1200
1201         Reviewed by Myles C. Maxfield.
1202
1203         Initialize the list of families requiring system fallback in the prewarming information struct, since
1204         this was part of the original, approved patch, and is needed for the performance improvement.
1205
1206         No new tests, covered by existing tests.
1207
1208         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1209         (WebCore::fontFamiliesForPrewarming):
1210         (WebCore::FontCache::prewarmGlobally):
1211
1212 2019-07-18  Ryan Haddad  <ryanhaddad@apple.com>
1213
1214         Unreviewed, rolling out r247531.
1215
1216         Caused multiple IndexedDB layout test crashes.
1217
1218         Reverted changeset:
1219
1220         "IndexedDB: error in starting version change transaction may
1221         be neglected"
1222         https://bugs.webkit.org/show_bug.cgi?id=199818
1223         https://trac.webkit.org/changeset/247531
1224
1225 2019-07-18  Antoine Quint  <graouts@apple.com>
1226
1227         Ensure Quirks::shouldDispatchSimulatedMouseEvents() works for all Google Maps and Amazon domains
1228         https://bugs.webkit.org/show_bug.cgi?id=199904
1229         <rdar://problem/53250104>
1230
1231         Reviewed by Dean Jackson.
1232
1233         Use topPrivatelyControlledDomain() to determine whether the URL is a Google or Amazon domain so as to apply
1234         Google Maps and Amazon quirks to all the various domain names used.
1235
1236         * page/Quirks.cpp:
1237         (WebCore::Quirks::isAmazon const):
1238         (WebCore::Quirks::isGoogleMaps const):
1239         (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
1240         (WebCore::Quirks::simulatedMouseEventTypeForTarget const):
1241         * page/Quirks.h:
1242
1243 2019-07-18  Per Arne Vollan  <pvollan@apple.com>
1244
1245         Crash under WebPage::boundaryEventOccurred
1246         https://bugs.webkit.org/show_bug.cgi?id=199907
1247
1248         Reviewed by Chris Fleizach.
1249
1250         Add null pointer checks.
1251
1252         No new tests, since I have not been able to reproduce this in a test.
1253
1254         * Modules/speech/SpeechSynthesis.cpp:
1255         (WebCore::SpeechSynthesis::didStartSpeaking):
1256         (WebCore::SpeechSynthesis::didFinishSpeaking):
1257         (WebCore::SpeechSynthesis::didPauseSpeaking):
1258         (WebCore::SpeechSynthesis::didResumeSpeaking):
1259         (WebCore::SpeechSynthesis::speakingErrorOccurred):
1260         (WebCore::SpeechSynthesis::boundaryEventOccurred):
1261
1262 2019-07-18  Antoine Quint  <graouts@apple.com>
1263
1264         [Pointer Events] The button and buttons properties are incorrect on iOS
1265         https://bugs.webkit.org/show_bug.cgi?id=199910
1266         <rdar://problem/52778374>
1267
1268         Reviewed by Dean Jackson.
1269
1270         The button and buttons properties were always set to 0 on iOS. We now use the correct values such that
1271         button is always 0 except for "pointermove" where it's -1, and "buttons" is 1 as long as the pointer is
1272         in contact with the touch surface.
1273
1274         Tests: pointerevents/ios/pointer-event-button-and-buttons-pointer-cancel.html
1275                pointerevents/ios/pointer-event-button-and-buttons.html
1276
1277         * dom/ios/PointerEventIOS.cpp:
1278         (WebCore::buttonForType):
1279         (WebCore::buttonsForType):
1280         (WebCore::PointerEvent::PointerEvent):
1281
1282 2019-07-18  Antoine Quint  <graouts@apple.com>
1283
1284         REGRESSION: Unable to enable simulated mouse events using the runtime flag
1285         https://bugs.webkit.org/show_bug.cgi?id=199909
1286         <rdar://problem/53254895>
1287
1288         Reviewed by Dean Jackson.
1289
1290         The fix for wkb.ug/199508 (r247152) broke the ability enable simulated mouse events using the runtime flag.
1291         We now add a check for the flag in Quirks::shouldDispatchSimulatedMouseEvents() so that the runtime flag
1292         overrides the content of that function. This is more practical and allows for a quick override using the flag.
1293
1294         Additionally, we need only call shouldDispatchSimulatedMouseEvents() in simulatedMouseEventTypeForTarget() since
1295         that function already calls needsQuirks().
1296
1297         * dom/EventNames.h:
1298         (WebCore::EventNames::isTouchRelatedEventType const):
1299         * dom/Node.cpp:
1300         (WebCore::Node::moveNodeToNewDocument):
1301         * page/Quirks.cpp:
1302         (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
1303         (WebCore::Quirks::simulatedMouseEventTypeForTarget const):
1304
1305 2019-07-18  Antoine Quint  <graouts@apple.com>
1306
1307         REGRESSION: Panning on an Amazon product image scrolls the page on iPadOS
1308         https://bugs.webkit.org/show_bug.cgi?id=199905
1309         <rdar://problem/49124529>
1310
1311         Reviewed by Dean Jackson.
1312
1313         Amazon product pages include images that the user can touch and pan to show zoomed details in a side image. This
1314         currently works on iPadOS thanks to the dispatch of simulated "mousemove" events on the product image, but the site
1315         doesn't call preventDefault() when handling those events as it wasn't necessary for macOS.
1316
1317         We add a new quirk that will indicate that a given element is such a product image.
1318
1319         * page/Quirks.cpp:
1320         (WebCore::Quirks::isAmazon const):
1321         (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
1322         (WebCore::Quirks::shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented const):
1323         (WebCore::Quirks::simulatedMouseEventTypeForTarget const):
1324         * page/Quirks.h:
1325
1326 2019-07-18  Youenn Fablet  <youenn@apple.com>
1327
1328         Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts
1329         https://bugs.webkit.org/show_bug.cgi?id=199769
1330         <rdar://problem/49390297>
1331
1332         Reviewed by Myles C. Maxfield.
1333
1334         When getting a system font, set the appropriate attribute so that it
1335         does not fallback to a user initiated font.
1336         Add an ASSERT that checks that the font in use is not a user font if
1337         policy is to not use user installed fonts.
1338
1339         Tests: fast/text/user-installed-fonts/extended-character-with-user-font.html
1340                fast/text/user-installed-fonts/extended-character.html
1341
1342         * platform/graphics/Font.h:
1343         * platform/graphics/FontCascadeFonts.cpp:
1344         (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
1345         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1346         (WebCore::preparePlatformFont):
1347         (WebCore::FontDatabase::singletonAllowingUserInstalledFonts):
1348         (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts):
1349         (WebCore::addAttributesForInstalledFonts):
1350         (WebCore::addAttributesForWebFonts):
1351         (WebCore::installedFontMandatoryAttributes):
1352         * platform/graphics/mac/SimpleFontDataCoreText.cpp:
1353         (WebCore::Font::isUserInstalledFont const):
1354
1355 2019-07-18  Zalan Bujtas  <zalan@apple.com>
1356
1357         [LFC][IFC] InlineFormattingContext::LineLayout::placeInlineItems is getting too complex.
1358         https://bugs.webkit.org/show_bug.cgi?id=199898
1359         <rdar://problem/53235958>
1360
1361         Reviewed by Antti Koivisto.
1362
1363         It's time to restructure LineLayout::placeInlineItems to be able to expand it further.
1364         Introduce the LineLayout class. This class is responsible to place the inline items on the current line.
1365         (Rename InlineFormattingContext::lineLayout -> InlineFormattingContext::InlineLayout and
1366         use Line::InitialConstraints in LineInput)
1367
1368         * layout/inlineformatting/InlineFormattingContext.cpp:
1369         (WebCore::Layout::InlineFormattingContext::layout const):
1370         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
1371         * layout/inlineformatting/InlineFormattingContext.h:
1372         (WebCore::Layout::InlineFormattingContext::LineLayout::layoutState const): Deleted.
1373         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
1374         (WebCore::Layout::inlineItemWidth):
1375         (WebCore::Layout::LineLayout::layoutState const):
1376         (WebCore::Layout::LineLayout::UncommittedContent::runs):
1377         (WebCore::Layout::LineLayout::UncommittedContent::isEmpty const):
1378         (WebCore::Layout::LineLayout::UncommittedContent::size const):
1379         (WebCore::Layout::LineLayout::UncommittedContent::width const):
1380         (WebCore::Layout::LineLayout::UncommittedContent::add):
1381         (WebCore::Layout::LineLayout::UncommittedContent::reset):
1382         (WebCore::Layout::LineLayout::LineLayout):
1383         (WebCore::Layout::LineLayout::commitPendingContent):
1384         (WebCore::Layout::LineLayout::close):
1385         (WebCore::Layout::LineLayout::layout):
1386         (WebCore::Layout::LineInput::LineInput):
1387         (WebCore::Layout::InlineFormattingContext::InlineLayout::InlineLayout):
1388         (WebCore::Layout::InlineFormattingContext::InlineLayout::layout const):
1389         (WebCore::Layout::InlineFormattingContext::InlineLayout::computedIntrinsicWidth const):
1390         (WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns const):
1391         (WebCore::Layout::InlineFormattingContext::InlineLayout::alignRuns const):
1392         (WebCore::Layout::UncommittedContent::runs): Deleted.
1393         (WebCore::Layout::UncommittedContent::isEmpty const): Deleted.
1394         (WebCore::Layout::UncommittedContent::size const): Deleted.
1395         (WebCore::Layout::UncommittedContent::width const): Deleted.
1396         (WebCore::Layout::UncommittedContent::add): Deleted.
1397         (WebCore::Layout::UncommittedContent::reset): Deleted.
1398         (WebCore::Layout::LineInput::HorizontalConstraint::HorizontalConstraint): Deleted.
1399         (WebCore::Layout::InlineFormattingContext::LineLayout::LineLayout): Deleted.
1400         (WebCore::Layout::InlineFormattingContext::LineLayout::placeInlineItems const): Deleted.
1401         (WebCore::Layout::InlineFormattingContext::LineLayout::layout const): Deleted.
1402         (WebCore::Layout::InlineFormattingContext::LineLayout::computedIntrinsicWidth const): Deleted.
1403         (WebCore::Layout::InlineFormattingContext::LineLayout::createDisplayRuns const): Deleted.
1404         (WebCore::Layout::InlineFormattingContext::LineLayout::alignRuns const): Deleted.
1405         * layout/inlineformatting/InlineLine.cpp:
1406         (WebCore::Layout::Line::Line):
1407         * layout/inlineformatting/InlineLine.h:
1408
1409 2019-07-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1410
1411         [GTK] MOUSE_CURSOR_SCALE is not implemented
1412         https://bugs.webkit.org/show_bug.cgi?id=109469
1413
1414         Reviewed by Darin Adler.
1415
1416         Use gdk_cursor_new_from_surface() instead of gdk_cursor_new_from_pixbuf() to avoid the surface to pixbuf
1417         conversion.
1418
1419         * platform/gtk/CursorGtk.cpp:
1420         (WebCore::createCustomCursor):
1421
1422 2019-07-17  Chris Dumez  <cdumez@apple.com>
1423
1424         Prewarm local storage in the NetworkProcess to reduce WebContent process hangs
1425         https://bugs.webkit.org/show_bug.cgi?id=199879
1426         <rdar://problem/53217757>
1427
1428         Reviewed by Ryosuke Niwa.
1429
1430         When JS accesses window.localStorage for the first time, we end up doing a
1431         synchronous IPC to the network process to pull in all items in the local
1432         storage for the origin. If the network process does not have this data in
1433         memory, it has to read it from a database on disk, which may take a significant
1434         amount of time and hang the WebContent process during this time.
1435
1436         To alleviate this problem, this patch introduces prewarming on the local storage
1437         in the network process when loading a given origin in the WebContent process.
1438         This way, in most cases, when the JS accesses window.localStorage for the first
1439         time, the synchronous IPC to the network process returns much faster (measured
1440         50-100ms for a very large database, down from 250-300ms), as it only needs to
1441         IPC the data over, without the need to fetch it from disk.
1442
1443         As a safety net to avoid excessive prewarming, we currently prewarm at most 5
1444         security origins per page load.
1445
1446         * loader/DocumentLoader.cpp:
1447         (WebCore::DocumentLoader::commitData):
1448         * page/DOMWindow.cpp:
1449         (WebCore::DOMWindow::prewarmLocalStorageIfNecessary):
1450         * page/DOMWindow.h:
1451         * page/Frame.cpp:
1452         (WebCore::Frame::didPrewarmLocalStorage):
1453         (WebCore::Frame::mayPrewarmLocalStorage const):
1454         * page/Frame.h:
1455         * storage/Storage.cpp:
1456         (WebCore::Storage::prewarm):
1457         * storage/Storage.h:
1458         * storage/StorageArea.h:
1459         (WebCore::StorageArea::prewarm):
1460
1461 2019-07-17  Robin Morisset  <rmorisset@apple.com>
1462
1463         [WHLSL] The lexer should not choke on a single '/'
1464         https://bugs.webkit.org/show_bug.cgi?id=199886
1465
1466         Reviewed by Myles Maxfield.
1467
1468         The bug is trivial: just recognize that a single '/' without a '*' or '/' afterwards is not the beginning of a comment.
1469
1470         While investigating this bug, I also found that part of the parser fails to properly propagate errors, so I fixed it.
1471
1472         New test in LayoutTests/webgpu/whlsl/float-math.html
1473         I also added a new flag to WHLSLPrepare.cpp. It can be used to parse the full standard library (this is how I found this bug in the first place).
1474
1475         * Modules/webgpu/WHLSL/WHLSLLexer.cpp:
1476         (WebCore::WHLSL::Lexer::skipWhitespaceAndComments):
1477         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
1478         (WebCore::WHLSL::Parser::parsePossibleTernaryConditional):
1479         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
1480         (WebCore::WHLSL::prepareShared):
1481         * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp:
1482         (WebCore::WHLSL::includeStandardLibrary):
1483         * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.h:
1484
1485 2019-07-17  Simon Fraser  <simon.fraser@apple.com>
1486
1487         Unreviewed build fix after r247549.
1488
1489         * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp:
1490
1491 2019-07-17  Robin Morisset  <rmorisset@apple.com>
1492
1493         [WHLSL] Remove traps from the compiler
1494         https://bugs.webkit.org/show_bug.cgi?id=195811
1495         <rdar://problem/50746299>
1496
1497         Reviewed by Myles Maxfield.
1498
1499         Remove the Trap statement from the language, see https://github.com/gpuweb/WHLSL/issues/301.
1500
1501         No new tests, as this part of the language was already untested, and we are removing it, not adding anything.
1502
1503         * Modules/webgpu/WHLSL/AST/WHLSLAST.h:
1504         * Modules/webgpu/WHLSL/AST/WHLSLStatement.h:
1505         (WebCore::WHLSL::AST::Statement::isSwitchStatement const):
1506         * Modules/webgpu/WHLSL/AST/WHLSLTrap.h: Removed.
1507         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
1508         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
1509         * Modules/webgpu/WHLSL/WHLSLASTDumper.h:
1510         * Modules/webgpu/WHLSL/WHLSLLexer.cpp:
1511         (WebCore::WHLSL::Token::typeName):
1512         (WebCore::WHLSL::Lexer::recognizeKeyword):
1513         * Modules/webgpu/WHLSL/WHLSLLexer.h:
1514         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
1515         (WebCore::WHLSL::Parser::parseStatement):
1516         * Modules/webgpu/WHLSL/WHLSLParser.h:
1517         * Modules/webgpu/WHLSL/WHLSLStatementBehaviorChecker.cpp:
1518         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
1519         (WebCore::WHLSL::Visitor::visit):
1520         * Modules/webgpu/WHLSL/WHLSLVisitor.h:
1521         * WebCore.xcodeproj/project.pbxproj:
1522
1523 2019-07-17  Robin Morisset  <rmorisset@apple.com>
1524
1525         [WHLSL] checkRecursiveType should not have exponential complexity.
1526         https://bugs.webkit.org/show_bug.cgi?id=199835
1527
1528         Reviewed by Myles Maxfield.
1529
1530         The change is very similar to that in https://bugs.webkit.org/show_bug.cgi?id=199688.
1531         Just keep track of which types have already been visited, and don't visit them again.
1532
1533         No new tests as there is no intended functional change.
1534
1535         * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp:
1536         (WebCore::WHLSL::RecursiveTypeChecker::visit):
1537         (WebCore::WHLSL::checkRecursiveTypes):
1538
1539 2019-07-17  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
1540
1541         Add missing #include's
1542         https://bugs.webkit.org/show_bug.cgi?id=199856
1543
1544         Reviewed by Simon Fraser.
1545
1546         The missing headers were found during development when unified sources changed.
1547
1548         No new tests required. Adding #include's only.
1549
1550         * Modules/speech/DOMWindowSpeechSynthesis.cpp:
1551         * Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp:
1552         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
1553         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
1554         * Modules/webgpu/WebGPUCommandEncoder.cpp:
1555
1556 2019-07-17  Ryosuke Niwa  <rniwa@webkit.org>
1557
1558         Add inputmode to the feature status page
1559         https://bugs.webkit.org/show_bug.cgi?id=199884
1560
1561         Reviewed by Wenson Hsieh.
1562
1563         Added as supported.
1564
1565         * features.json:
1566
1567 2019-07-17  Antoine Quint  <graouts@apple.com>
1568
1569         Disable Pointer Events prior to watchOS 6
1570         https://bugs.webkit.org/show_bug.cgi?id=199890
1571         <rdar://problem/53206113>
1572
1573         Reviewed by Dean Jackson.
1574
1575         * Configurations/FeatureDefines.xcconfig:
1576
1577 2019-07-17  Antoine Quint  <graouts@apple.com>
1578
1579         Unable to bring up custom media controls on iOS for video.sina.cn
1580         https://bugs.webkit.org/show_bug.cgi?id=199889
1581         <rdar://problem/51883919>
1582
1583         Reviewed by Dean Jackson.
1584
1585         Videos on video.sina.cn by default have the "controls" attribute and are set not to autoplay. This means that the original state
1586         of the media controls are set to show the built-in media controls and also show the prominent play button to begin playback. The
1587         display of the play button also requires a tap gesture recognizer, which calls preventDefault() when the "touchend" is received
1588         to prevent double-tap-to-zoom, but also has the side-effect of preventing a "click" event from being dispatched for a tap.
1589
1590         The video.sina.cn code would eventually remove the "controls" attribute, which would make the built-in media controls not visible,
1591         but still participate in hit-testing because we keep the shadow DOM around in order to potentially show the Airplay or picture-in-picture
1592         placards. Additionally, we wouldn't disable the tap gesture recognizer when the "controls" attribute was removed.
1593
1594         We now ensure that both gesture recognizers used by iOS inline media controls are only enabled when media controls are visible.
1595
1596         Test: media/modern-media-controls/media-controller/ios/media-controller-allows-click-over-video-with-no-controls.html
1597
1598         * Modules/modern-media-controls/controls/ios-inline-media-controls.js:
1599         (IOSInlineMediaControls.prototype.set showsStartButton):
1600         (IOSInlineMediaControls.prototype.get visible):
1601         (IOSInlineMediaControls.prototype.set visible):
1602         (IOSInlineMediaControls.prototype._updateGestureRecognizers):
1603         (IOSInlineMediaControls.prototype._tapGestureRecognizerStateDidChange):
1604         (IOSInlineMediaControls.prototype._pinchGestureRecognizerStateDidChange):
1605
1606 2019-07-17  Christopher Reid  <chris.reid@sony.com>
1607
1608         Bytecode cache should use FileSystem
1609         https://bugs.webkit.org/show_bug.cgi?id=199759
1610
1611         Reviewed by Yusuke Suzuki.
1612
1613         * platform/SharedBuffer.cpp:
1614
1615 2019-07-17  Zalan Bujtas  <zalan@apple.com>
1616
1617         Unable to tap buttons at top of Wells Fargo app’s Payees screen
1618         https://bugs.webkit.org/show_bug.cgi?id=199846
1619         <rdar://problem/48112220>
1620
1621         Reviewed by Simon Fraser.
1622
1623         This patch restores the stop-before-reaching-the-body heuristics for the approximate node finding feature only.
1624         (WebFrame::approximateNodeAtViewportLocation mistakenly relied on this odd quirk of nodeRespondingToClickEvents.)
1625
1626         * page/Frame.h:
1627         * page/ios/FrameIOS.mm:
1628         (WebCore::Frame::approximateNodeAtViewportLocationLegacy):
1629
1630 2019-07-17  Simon Fraser  <simon.fraser@apple.com>
1631
1632         [iOS WK2] Avoid lots of compositing backing store for offscreen position:fixed descendants
1633         https://bugs.webkit.org/show_bug.cgi?id=199819
1634         rdar://problem/51977416
1635
1636         Reviewed by Zalan Bujtas.
1637
1638         There was code to ensure that position:fixed layers and their descendants don't have their
1639         backing store detached (thrown away to save memory when offscreen), since that can trigger
1640         flashing when async scrolling moves layers in and out of the visual viewport.
1641
1642         However, some pages have many descendant layers of positon:fixed which entrain backing
1643         store, because, for example, they have a stack of translated-offscreen menu elements inside
1644         a fixed header, and those elements may composite because of overflow:scroll.
1645
1646         To avoid using too much memory on such pages, allow backing store detachment for fixed
1647         layers that are outside the layout viewport. Add a flag to RenderLayer that's set for layers
1648         which are fixed, or descendants of fixed, and consult that flag in
1649         updateAllowsBackingStoreDetaching(). The logic there is similar to
1650         RenderLayerCompositor::requiresCompositingForPosition().
1651         
1652         I considered allowing all position:fixed to composite (since this patch would keep most of
1653         the memory saving), but historically we've avoided compositing out-of-viewport
1654         position:fixed because it's quite common to have them with negative z-index, and compositing
1655         those has significant compositing knock-on effects.
1656         
1657         GraphicsLayer flushing no longer needs to track the viewport-constrained status of layers,
1658         so remove that code.
1659         
1660         This patch removes backing-store pinning for sticky layers.
1661         scrolling/ios/reconcile-layer-position-recursive.html then revealed a bug in
1662         ScrollingStateStickyNode::reconcileLayerPositionForViewportRect(), which was assuming that
1663         the sticky element was scrolled by the page, causing a bad layer position to get sync'd onto
1664         the layer. Fixed by copying code from ScrollingTreeStickyNode that is smarter about
1665         computing layer positions.
1666         
1667         This patch fixes jetsams on kmart.com.au in iOS 13 beta.
1668
1669         Test: compositing/layer-creation/fixed-position-descendants-out-of-view.html
1670
1671         * page/scrolling/ScrollingStateStickyNode.cpp:
1672         (WebCore::ScrollingStateStickyNode::computeLayerPosition const):
1673         (WebCore::ScrollingStateStickyNode::reconcileLayerPositionForViewportRect):
1674         * page/scrolling/ScrollingStateStickyNode.h:
1675         * platform/graphics/GraphicsLayer.h:
1676         (WebCore::GraphicsLayer::setAllowsBackingStoreDetaching):
1677         (WebCore::GraphicsLayer::allowsBackingStoreDetaching const):
1678         (WebCore::GraphicsLayer::setIsViewportConstrained): Deleted.
1679         (WebCore::GraphicsLayer::isViewportConstrained const): Deleted.
1680         (WebCore::GraphicsLayer::setCanDetachBackingStore): Deleted.
1681         (WebCore::GraphicsLayer::canDetachBackingStore const): Deleted.
1682         * platform/graphics/ca/GraphicsLayerCA.cpp:
1683         (WebCore::GraphicsLayerCA::GraphicsLayerCA):
1684         (WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush const):
1685         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
1686         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
1687         (WebCore::GraphicsLayerCA::updateCoverage):
1688         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
1689         * platform/graphics/ca/GraphicsLayerCA.h:
1690         * rendering/RenderLayer.cpp:
1691         (WebCore::RenderLayer::RenderLayer):
1692         (WebCore::RenderLayer::updateLayerPositions):
1693         (WebCore::outputPaintOrderTreeLegend):
1694         (WebCore::outputPaintOrderTreeRecursive):
1695         * rendering/RenderLayer.h:
1696         * rendering/RenderLayerBacking.cpp:
1697         (WebCore::RenderLayerBacking::updateAllowsBackingStoreDetaching):
1698         (WebCore::RenderLayerBacking::updateOverflowControlsLayers):
1699         (WebCore::RenderLayerBacking::setIsScrollCoordinatedWithViewportConstrainedRole): Deleted.
1700         * rendering/RenderLayerBacking.h:
1701         * rendering/RenderLayerCompositor.cpp:
1702         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
1703         (WebCore::RenderLayerCompositor::requiresCompositingForPosition const):
1704         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
1705         (WebCore::RenderLayerCompositor::updateScrollCoordinationForLayer):
1706
1707 2019-07-17  Chris Dumez  <cdumez@apple.com>
1708
1709         Avoid unnecessary copy of monitors under DisplayRefreshMonitorManager::displayWasUpdated()
1710         https://bugs.webkit.org/show_bug.cgi?id=199847
1711
1712         Reviewed by Said Abou-Hallawa.
1713
1714         There is always one one monitor in m_monitors for a given displayID so there is
1715         no need to copy the monitors inside DisplayRefreshMonitorManager::displayWasUpdated()
1716         and no need to iterate over all of them. This patch also factors a bit differently
1717         so that it becomes more obvious.
1718
1719         * platform/graphics/DisplayRefreshMonitorManager.cpp:
1720         (WebCore::DisplayRefreshMonitorManager::createMonitorForClient):
1721         (WebCore::DisplayRefreshMonitorManager::unregisterClient):
1722         (WebCore::DisplayRefreshMonitorManager::displayDidRefresh):
1723         (WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
1724         (WebCore::DisplayRefreshMonitorManager::findMonitorForDisplay const):
1725         (WebCore::DisplayRefreshMonitorManager::monitorForDisplay const):
1726         * platform/graphics/DisplayRefreshMonitorManager.h:
1727
1728 2019-07-17  Sihui Liu  <sihui_liu@apple.com>
1729
1730         IndexedDB: error in starting version change transaction may be neglected
1731         https://bugs.webkit.org/show_bug.cgi?id=199818
1732         <rdar://problem/52925738>
1733
1734         Reviewed by Brady Eidson.
1735
1736         For version change transaction, IDBServer didn't wait the result of beginTransaction on the background thread 
1737         before giving the IDBClient the result of open request. In this case, beginTransaction may fail to update the 
1738         DatabaseVersion in database file or set m_originalDatabaseInfoBeforeVersionChange, but the transaction was
1739         marked as started. When we later set m_databaseInfo with m_originalDatabaseInfoBeforeVersionChange, 
1740         m_databaseInfo could become nullptr.
1741
1742         To write a test for this, we will need to simulate an SQLite error. I manually tested this by crafting the 
1743         SQLiteStatement in beginTransaction, making it an invalid statement, and verified that error event, instead of 
1744         ungradeneeded event is dispatched to the IDBRequest.
1745
1746         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1747         (WebCore::IDBServer::UniqueIDBDatabase::startVersionChangeTransaction):
1748         (WebCore::IDBServer::UniqueIDBDatabase::performStartVersionChangeTransaction):
1749         (WebCore::IDBServer::UniqueIDBDatabase::didPerformStartVersionChangeTransaction):
1750         (WebCore::IDBServer::UniqueIDBDatabase::beginTransactionInBackingStore): Deleted.
1751         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1752
1753 2019-07-17  Daniel Bates  <dabates@apple.com>
1754
1755         Typing into a cell in a Google Sheet lags behind by one character
1756         https://bugs.webkit.org/show_bug.cgi?id=199587
1757         <rdar://problem/51616845>
1758
1759         Reviewed by Brent Fulgham.
1760
1761         Add a Google Sheets quirk. Put all DOM timers scheduled from keydown and keypress event listeners
1762         into a holding tank. The timers continue to tick, but are barred from executing their action until
1763         the next text insertion or deletion or 32 ms (on device) have elapsed, whichever is sooner. We only
1764         allocate a holding tank once per document, only if the quirk is active, and this allocation is done
1765         when the document schedules a timer on keydown or keypress. The holding tank lives for the lifetime
1766         of the document.
1767
1768         The story behind the quirk:
1769
1770         On keypress Google Sheets schedules timers and expects that a DOM update will occur (i.e. text
1771         will be inserted or deleted) within the same event loop iteration as the dispatched keypress. The
1772         UI Events spec. [1] makes no such guarantee of when a DOM update must occur in relation to the keypress
1773         event. It could happen in the same event loop iteration as the key press (as Google expects), the
1774         next iteration, 500ms later, 2 minutes later, etc. What the spec does guarantee is that by the time
1775         a DOM input event is dispatched that the DOM will be updated. And this is the solution to the problem
1776         Google Sheets is trying to solve, but is doing so using pre-IE 9 technology (though similar
1777         functionality was available via onpropertychange in IE < 9).
1778
1779         See also <https://github.com/w3c/uievents/issues/238>, which is tracking a spec. text update for
1780         this quirk.
1781
1782         Test: fast/events/ios/dom-update-on-keydown-quirk.html
1783
1784         [1] <https://w3c.github.io/uievents/> (Editor's Draft, 14 October 2018)
1785
1786         * SourcesCocoa.txt:
1787         * WebCore.xcodeproj/project.pbxproj:
1788         Add some files to the project.
1789
1790         * dom/Document.cpp:
1791         (WebCore::Document::domTimerHoldingTank): Added.
1792         * dom/Document.h:
1793         (WebCore::Document::domTimerHoldingTankIfExists): Added.
1794
1795         * page/DOMTimer.cpp:
1796         (WebCore::DOMTimer::install): Put the newly instantiated timer into the holding tank.
1797         (WebCore::DOMTimer::removeById): Remove the timer from the holding tank.
1798         (WebCore::DOMTimer::fired): Check if the timer is in the holding tank. If it is and it is a one-
1799         shot timer then schedule it for the next event loop iteration. If it's a repeating timer just
1800         let it continue ticking. Otherwise, do what we no now and execute the timer's action. The reason
1801         we do not suspend timers in the holding tank is because:
1802             1. Far out timers (Google Sheets registers timers as far out as 5 minutes!) are not penalized.
1803             Though smart supension logic could avoid this. See (3).
1804
1805             2. Empirical observations indicate that the keyboard will perform the insertion or deletion
1806             reasonably quickly (not the same event loop iteration as the keydown, but within two iterations out).
1807             So, the timers in the holding tank are short-lived.
1808
1809             3. Simplifies the code. There is no need to keep additional bookkeeping to track multiple timer
1810             suspension reasons (timers currently can only have one suspension reason) or alternatively defer
1811             scheduling a timer until a later time and computing a new "fair" firing time when scheduled.
1812         * page/EventHandler.cpp:
1813         (WebCore::EventHandler::internalKeyEvent): Place a token on the stack to put all DOM timers
1814         scheduled on keydown and keypress into the holding tank if the quirk is enabled.
1815         * page/Quirks.cpp:
1816         (WebCore::Quirks::needsDeferKeyDownAndKeyPressTimersUntilNextEditingCommand const): Added.
1817         * page/Quirks.h:
1818         * page/Settings.yaml: Added setting so that this quirk can be enabled from a layout test. This setting
1819         also lets us enable the quirk for all sites or for certain third-party apps if desired.
1820         * page/ios/DOMTimerHoldingTank.cpp: Added.
1821         (WebCore::DOMTimerHoldingTank::DOMTimerHoldingTank):
1822         (WebCore::DOMTimerHoldingTank::add):
1823         (WebCore::DOMTimerHoldingTank::remove):
1824         (WebCore::DOMTimerHoldingTank::contains):
1825         (WebCore::DOMTimerHoldingTank::removeAll):
1826         (WebCore::DOMTimerHoldingTank::stopExceededMaximumHoldTimer):
1827         * page/ios/DOMTimerHoldingTank.h: Added.
1828         (WebCore::DeferDOMTimersForScope::DeferDOMTimersForScope):
1829         (WebCore::DeferDOMTimersForScope::~DeferDOMTimersForScope):
1830         (WebCore::DeferDOMTimersForScope::isDeferring):
1831
1832 2019-07-17  Darin Adler  <darin@apple.com>
1833
1834         No need for isURLAllowed function in Frame
1835         https://bugs.webkit.org/show_bug.cgi?id=120266
1836
1837         Reviewed by Alex Christensen.
1838
1839         * css/SelectorCheckerTestFunctions.h:
1840         (WebCore::matchesFullScreenPseudoClass): Use is<> instead of
1841         the isFrameElementBase function. Also updated includes and spacing.
1842
1843         * dom/Document.cpp:
1844         (WebCore::Document::resolveStyle): Shortened an old, long comment
1845         that happened to mention HTMLFrameElementBase::isURLAllowed by name.
1846
1847         * dom/Element.h: Deleted isFrameElementBase.
1848
1849         * html/HTMLAppletElement.cpp:
1850         (WebCore::HTMLAppletElement::updateWidget): Tweaked comment.
1851
1852         * html/HTMLBodyElement.cpp:
1853         (WebCore::HTMLBodyElement::insertedIntoAncestor): Moved comment from
1854         here to didFinishInsertingNode, since the code it's talking about is there.
1855         Also got rid of unnecessary local variable.
1856         (WebCore::HTMLBodyElement::didFinishInsertingNode): Moved comment here
1857         and elaborated a bit. Also changed the code to copy margin attributes in a
1858         simpler way without requiring special getter functions. There is a slight
1859         behavior change here, but seems unlikely to affect any websites or tests.
1860         Would be good to add better test coverage, which I think should be done
1861         when fixing the problems described in the FIXME.
1862
1863         * html/HTMLEmbedElement.cpp:
1864         (WebCore::HTMLEmbedElement::updateWidget): allowedToLoadFrameURL -> canLoadURL
1865         Also Tweaked comments.
1866
1867         * html/HTMLFrameElement.cpp:
1868         (WebCore::HTMLFrameElement::rendererIsNeeded): isURLAllowed -> canLoad
1869
1870         * html/HTMLFrameElementBase.cpp:
1871         (WebCore::HTMLFrameElementBase::HTMLFrameElementBase): Removed initial
1872         values for no-longer-needed data members.
1873
1874         (WebCore::HTMLFrameElementBase::canLoadScriptURL const): Renamed from
1875         isURLAllowed. Also refactored so it now calls canLoadURL.
1876         (WebCore::HTMLFrameElementBase::canLoad const): Renamed from isURLAllowed.
1877         Also added FIXME comments about multiple ways that this code incorrectly
1878         handles the empty string. Might inspire some tests and future fixes.
1879         (WebCore::HTMLFrameElementBase::canLoadURL const): Renamed from isURLAllowed.
1880         Added an overload that takes a relative URL string largely to make this
1881         more parallel with the similar code in HTMLPlugInImageElement. Refactored
1882         to call canAddSubframe and isProhibitedSelfReference, removing the need
1883         to call Frame::isURLAllowed.
1884         (WebCore::HTMLFrameElementBase::openURL): isURLAllowed -> canLoad
1885         (WebCore::HTMLFrameElementBase::parseAttribute): Removed unneeded code
1886         to parse marginwidth, marginheight, and scrolling, which are now done
1887         as needed instead. Might have to add code back if we ever add code to
1888         make these cause dynamic updates when changed, but that was not the
1889         behavior of the existing code.
1890         (WebCore::HTMLFrameElementBase::scrollingMode const): Changed to call
1891         attributeWithoutSynchronization rather than reading from a data member.
1892
1893         * html/HTMLFrameElementBase.h: Moved scrollingMode into the .cpp file.
1894         Removed marginWidth and marginHeight since they are no longer called.
1895         Made canContainRangeEndPoint override be private. Renamed isURLAllowed
1896         to canLoad/canLoadScriptURL/canLoadURL. Removed unneeded isFrameElementBase
1897         since is<HTMLFrameElementBase> already works without it. Removed unneeded
1898         data members m_scrolling, m_marginWidth, and m_marginHeight.
1899
1900         * html/HTMLFrameOwnerElement.cpp:
1901         (WebCore::HTMLFrameOwnerElement::HTMLFrameOwnerElement): Moved initialization
1902         of m_contentFrame and m_sandboxFlags to the header.
1903         (WebCore::HTMLFrameOwnerElement::clearContentFrame): 0 -> nullptr
1904         (WebCore::HTMLFrameOwnerElement::canAddSubframe const): Added. Code was moved
1905         here from multiple functions that enforced the subframe count limit.
1906         (WebCore::HTMLFrameOwnerElement::isProhibitedSelfReference const): Added.
1907         Moved code here from Frame::isURLAllowed so it's easy to use as needed.
1908
1909         * html/HTMLFrameOwnerElement.h: Renamed isURLAllowed to canLoadScriptURL.
1910         Added protected canAddSubframe and isProhibitedSelfReference functions.
1911         Initialized the data members here.
1912
1913         * html/HTMLIFrameElement.cpp:
1914         (WebCore::HTMLIFrameElement::sandbox): Added braces for multi-line if statement.
1915         (WebCore::HTMLIFrameElement::parseAttribute): Removed unneeded storage of the
1916         allow attribute value. Added missing code to invalidate m_featurePolicy when
1917         the allow attribute changes. This could change behavior, but unlikely to affect
1918         any websites of tests. Would be good to add a test for this.
1919         (WebCore::HTMLIFrameElement::rendererIsNeeded): isURLAllowed -> canLoad. Also
1920         reordered the code to be more efficient for display: none (why not?).
1921         (WebCore::HTMLIFrameElement::featurePolicy const): Use attributeWithoutSynchronization
1922         to read the allow attribute rather than using a data member.
1923
1924         * html/HTMLIFrameElement.h: Removed the unneeded allow function member and
1925         m_allow data member since DOM reflection takes care of the function and the
1926         featurePolicy function can get the attribute without a data member.
1927
1928         * html/HTMLObjectElement.cpp:
1929         (WebCore::HTMLObjectElement::updateWidget): allowedToLoadFrameURL -> canLoadURL
1930         Also tweaked comments.
1931
1932         * html/HTMLPlugInElement.cpp:
1933         (WebCore::HTMLPlugInElement::canLoadScriptURL const): Added. Code moved here
1934         from HTMLFrameOwnerElement::isURLAllowed. Added comment about why this is not
1935         necessarily correct and might need improvement.
1936
1937         * html/HTMLPlugInElement.h: Added private override of canLoadScriptURL.
1938
1939         * html/HTMLPlugInImageElement.cpp:
1940         (WebCore::HTMLPlugInImageElement::canLoadURL const): Renamed from
1941         allowedToLoadFrameURL and refactored into two functions to match the
1942         structure of the similar function in HTMLFrameElementBase. Also refactored
1943         to use canAddSubframe and isProhibitedSelfReference rather than Frame::isURLAllowed.
1944         (WebCore::HTMLPlugInImageElement::canLoadPlugInContent const): Renamed from
1945         allowedToLoadPluginContent.
1946         (WebCore::HTMLPlugInImageElement::requestObject): allowedToLoadPluginContent
1947         -> canLoadPlugInContent
1948
1949         * html/HTMLPlugInImageElement.h: Renamed functions as mentioned above.
1950
1951         * loader/SubframeLoader.cpp:
1952         (WebCore::SubframeLoader::requestFrame): isURLAllowed -> canLoadScriptURL
1953
1954         * page/FocusController.h: Removed unneeded forward declaration of HTMLFrameOwnerElement.
1955
1956         * page/Frame.cpp:
1957         (WebCore::Frame::isURLAllowed const): Deleted.
1958         * page/Frame.h: Ditto.
1959
1960         * page/FrameView.cpp:
1961         (WebCore::FrameView::init): Removed code to initialize m_margins, since nothing
1962         was looking at it after that.
1963         (WebCore::FrameView::setMarginWidth): Deleted.
1964         (WebCore::FrameView::setMarginHeight): Deleted.
1965
1966         * page/FrameView.h: Removed marginWidth, marginHeight, setMarginWidth,
1967         setMarginHeight, and m_margins because there was no code anywhere calling
1968         marginWidth or marginHeight, and no other side effects of these functions.
1969
1970 2019-07-17  Alex Christensen  <achristensen@webkit.org>
1971
1972         Add a runtime-disabled dialog element skeleton
1973         https://bugs.webkit.org/show_bug.cgi?id=199839
1974
1975         Reviewed by Ryosuke Niwa.
1976
1977         Beginning implementation of https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element
1978         Covered by rebaselining WPT tests.
1979
1980         * CMakeLists.txt:
1981         * DerivedSources-input.xcfilelist:
1982         * DerivedSources-output.xcfilelist:
1983         * DerivedSources.make:
1984         * Sources.txt:
1985         * WebCore.xcodeproj/project.pbxproj:
1986         * bindings/js/WebCoreBuiltinNames.h:
1987         * html/HTMLDialogElement.cpp: Added.
1988         (WebCore::HTMLDialogElement::HTMLDialogElement):
1989         (WebCore::HTMLDialogElement::open):
1990         (WebCore::HTMLDialogElement::setOpen):
1991         (WebCore::HTMLDialogElement::returnValue):
1992         (WebCore::HTMLDialogElement::setReturnValue):
1993         (WebCore::HTMLDialogElement::show):
1994         (WebCore::HTMLDialogElement::showModal):
1995         (WebCore::HTMLDialogElement::close):
1996         * html/HTMLDialogElement.h: Added.
1997         * html/HTMLDialogElement.idl: Added.
1998         * html/HTMLTagNames.in:
1999         * page/RuntimeEnabledFeatures.h:
2000         (WebCore::RuntimeEnabledFeatures::setDialogElementEnabled):
2001         (WebCore::RuntimeEnabledFeatures::dialogElementEnabled const):
2002
2003 2019-07-17  Youenn Fablet  <youenn@apple.com>
2004
2005         Hop to the main thread when doing logging in RealtimeIncomingVideoSourceCocoa
2006         https://bugs.webkit.org/show_bug.cgi?id=199865
2007
2008         Reviewed by Darin Adler.
2009
2010         LoggerHelper routines allow logging messages in system console and inspector console.
2011         These routines iterate through a Vector of log observers which is not thread safe.
2012         Document, the main log observer, also expects to be called on the main thread.
2013         Manually tested (writing a layout test for this would require more than 2 seconds).
2014
2015         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
2016         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
2017
2018 2019-07-17  Commit Queue  <commit-queue@webkit.org>
2019
2020         Unreviewed, rolling out r247505.
2021         https://bugs.webkit.org/show_bug.cgi?id=199871
2022
2023         "Caused failed ASSERT in stress test" (Requested by creid on
2024         #webkit).
2025
2026         Reverted changeset:
2027
2028         "Bytecode cache should use FileSystem"
2029         https://bugs.webkit.org/show_bug.cgi?id=199759
2030         https://trac.webkit.org/changeset/247505
2031
2032 2019-07-17  Youenn Fablet  <youenn@apple.com>
2033
2034         Add release logging to AudioSampleDataSource
2035         https://bugs.webkit.org/show_bug.cgi?id=199814
2036         <rdar://problem/53128140>
2037
2038         Reviewed by Eric Carlson.
2039
2040         Use release logging for AudioSampleDataSource in case of errors.
2041         This requires passing a logger and a logger identifier.
2042         For that purpose, pass a MediaStreamTrackPrivate to it constructor
2043         and reuse its logger and log identifier.
2044
2045         For each log, hop to the main thread as release logging requires to be done in the main thread.
2046         Add specific handling for RealtimeOutgoingAudioSource as its MediaStreamTrack can change in case of replaceTrack.
2047         In that case, we change of logger when changing the MediaStreamTrackPrivate.
2048
2049         No observable change of behavior, covered by existing tests.
2050
2051         * platform/audio/mac/AudioSampleDataSource.h:
2052         * platform/audio/mac/AudioSampleDataSource.mm:
2053         (WebCore::AudioSampleDataSource::create):
2054         (WebCore::AudioSampleDataSource::AudioSampleDataSource):
2055         (WebCore::AudioSampleDataSource::setupConverter):
2056         (WebCore::AudioSampleDataSource::pushSamplesInternal):
2057         (WebCore::AudioSampleDataSource::pullSamplesInternal):
2058         (WebCore::AudioSampleDataSource::setLogger):
2059         (WebCore::AudioSampleDataSource::logChannel const):
2060         * platform/mediastream/RealtimeOutgoingAudioSource.cpp:
2061         (WebCore::RealtimeOutgoingAudioSource::setSource):
2062         * platform/mediastream/RealtimeOutgoingAudioSource.h:
2063         (WebCore::RealtimeOutgoingAudioSource::sourceUpdated):
2064         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
2065         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
2066         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
2067         Instead of using its own logger/identifier member field, reuse its MediaStreamTrackPrivate.
2068         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp:
2069         (WebCore::RealtimeOutgoingAudioSourceCocoa::RealtimeOutgoingAudioSourceCocoa):
2070         (WebCore::RealtimeOutgoingAudioSourceCocoa::sourceUpdated):
2071         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h:
2072         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
2073         (WebCore::WebAudioSourceProviderAVFObjC::prepare):
2074
2075 2019-07-17  Kenneth Russell  <kbr@chromium.org>
2076
2077         Make ANGLE work inside WebKit2's sandbox
2078         https://bugs.webkit.org/show_bug.cgi?id=199844
2079
2080         Reviewed by Alex Christensen.
2081
2082         Fix missing #import introduced at the last minute while removing
2083         some debugging code in the last patch.
2084
2085         Tested with San Angeles WebGL demo and some conformance tests.
2086
2087         * platform/graphics/cocoa/WebGLLayer.mm:
2088
2089 2019-07-17  Andres Gonzalez  <andresg_22@apple.com>
2090
2091         Hang in WebCore::AccessibilityRenderObject::visiblePositionRangeForLine.
2092         https://bugs.webkit.org/show_bug.cgi?id=199845
2093         <rdar://problem/53121017>
2094
2095         Reviewed by Chris Fleizach.
2096
2097         - Added check for upper bound NSNotFound for parameter to visiblePositionRangeForLine.
2098         - Fixed signed/unsigned issue for AXTextMarkerRangeForLine attribute.
2099
2100         * accessibility/AccessibilityRenderObject.cpp:
2101         (WebCore::AccessibilityRenderObject::visiblePositionRangeForLine const):
2102         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2103         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
2104
2105 2019-07-17  Rob Buis  <rbuis@igalia.com>
2106
2107         Add referrerpolicy attribute support for <script> elements
2108         https://bugs.webkit.org/show_bug.cgi?id=185550
2109
2110         Reviewed by Youenn Fablet.
2111
2112         This patch adds 'referrerpolicy' attribute support for script elements.
2113         If set, the value is restricted to the ReferrerPolicy enum, and
2114         if valid it is used for the script fetch.
2115         If not set or invalid, the current behavior is kept.
2116
2117         Tests: http/tests/referrer-policy-script/no-referrer-when-downgrade/cross-origin-http-http.html
2118                http/tests/referrer-policy-script/no-referrer-when-downgrade/cross-origin-http.https.html
2119                http/tests/referrer-policy-script/no-referrer-when-downgrade/same-origin.html
2120                http/tests/referrer-policy-script/no-referrer/cross-origin-http-http.html
2121                http/tests/referrer-policy-script/no-referrer/cross-origin-http.https.html
2122                http/tests/referrer-policy-script/no-referrer/same-origin.html
2123                http/tests/referrer-policy-script/origin-when-cross-origin/cross-origin-http-http.html
2124                http/tests/referrer-policy-script/origin-when-cross-origin/cross-origin-http.https.html
2125                http/tests/referrer-policy-script/origin-when-cross-origin/same-origin.html
2126                http/tests/referrer-policy-script/origin/cross-origin-http-http.html
2127                http/tests/referrer-policy-script/origin/cross-origin-http.https.html
2128                http/tests/referrer-policy-script/origin/same-origin.html
2129                http/tests/referrer-policy-script/same-origin/cross-origin-http-http.html
2130                http/tests/referrer-policy-script/same-origin/cross-origin-http.https.html
2131                http/tests/referrer-policy-script/same-origin/same-origin.html
2132                http/tests/referrer-policy-script/strict-origin-when-cross-origin/cross-origin-http-http.html
2133                http/tests/referrer-policy-script/strict-origin-when-cross-origin/cross-origin-http.https.html
2134                http/tests/referrer-policy-script/strict-origin-when-cross-origin/same-origin.html
2135                http/tests/referrer-policy-script/strict-origin/cross-origin-http-http.html
2136                http/tests/referrer-policy-script/strict-origin/cross-origin-http.https.html
2137                http/tests/referrer-policy-script/strict-origin/same-origin.html
2138                http/tests/referrer-policy-script/unsafe-url/cross-origin-http-http.html
2139                http/tests/referrer-policy-script/unsafe-url/cross-origin-http.https.html
2140                http/tests/referrer-policy-script/unsafe-url/same-origin.html
2141
2142         * bindings/js/CachedScriptFetcher.cpp:
2143         (WebCore::CachedScriptFetcher::requestScriptWithCache const):
2144         * bindings/js/CachedScriptFetcher.h:
2145         (WebCore::CachedScriptFetcher::CachedScriptFetcher):
2146         * dom/InlineClassicScript.h:
2147         * dom/LoadableClassicScript.cpp:
2148         (WebCore::LoadableClassicScript::create):
2149         * dom/LoadableClassicScript.h:
2150         * dom/LoadableModuleScript.cpp:
2151         (WebCore::LoadableModuleScript::create):
2152         (WebCore::LoadableModuleScript::LoadableModuleScript):
2153         * dom/LoadableModuleScript.h:
2154         * dom/LoadableScript.h:
2155         (WebCore::LoadableScript::LoadableScript):
2156         * dom/ScriptElement.cpp:
2157         (WebCore::ScriptElement::requestClassicScript):
2158         (WebCore::ScriptElement::requestModuleScript):
2159         * dom/ScriptElement.h:
2160         * dom/ScriptElementCachedScriptFetcher.h:
2161         (WebCore::ScriptElementCachedScriptFetcher::ScriptElementCachedScriptFetcher):
2162         * html/HTMLIFrameElement.cpp:
2163         (WebCore::HTMLIFrameElement::referrerPolicyForBindings const):
2164         * html/HTMLScriptElement.cpp:
2165         (WebCore::HTMLScriptElement::setReferrerPolicyForBindings):
2166         (WebCore::HTMLScriptElement::referrerPolicyForBindings const):
2167         (WebCore::HTMLScriptElement::referrerPolicy const):
2168         * html/HTMLScriptElement.h:
2169         * html/HTMLScriptElement.idl:
2170         * html/parser/CSSPreloadScanner.cpp:
2171         (WebCore::CSSPreloadScanner::emitRule):
2172         * html/parser/HTMLPreloadScanner.cpp:
2173         (WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest):
2174         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
2175         * html/parser/HTMLResourcePreloader.cpp:
2176         (WebCore::PreloadRequest::resourceRequest):
2177         * html/parser/HTMLResourcePreloader.h:
2178         (WebCore::PreloadRequest::PreloadRequest):
2179         * platform/ReferrerPolicy.cpp:
2180         (WebCore::referrerPolicyToString):
2181         * platform/ReferrerPolicy.h:
2182         * svg/SVGScriptElement.h:
2183
2184 2019-07-16  Christopher Reid  <chris.reid@sony.com>
2185
2186         Bytecode cache should use FileSystem
2187         https://bugs.webkit.org/show_bug.cgi?id=199759
2188
2189         Reviewed by Yusuke Suzuki.
2190
2191         * platform/SharedBuffer.cpp:
2192
2193 2019-07-16  Simon Fraser  <simon.fraser@apple.com>
2194
2195         Fix includes and make a constructor explicit to avoid unified-sources-triggered test failures
2196         https://bugs.webkit.org/show_bug.cgi?id=199849
2197
2198         Reviewed by Wenson Hsieh.
2199         
2200         webkit.org/b/199587 triggered some unexpected test failures because of unified sources include
2201         order. The TextStream operator in ScrollingTreeOverflowScrollingNode::dumpProperties() was invoking
2202         the implicit constructor of TransformOperations.
2203
2204         * page/scrolling/ScrollingTreeOverflowScrollingNode.cpp: Include TextStream.h
2205         * platform/graphics/transforms/TransformOperations.h: Make ctor explicit.
2206
2207 2019-07-16  Antoine Quint  <graouts@apple.com>
2208
2209         REGRESSION: fast/events/watchos/double-tap-to-zoom* tests crashing in com.apple.WebKit: -[WKContentView(WKInteraction) _singleTapDidReset:]
2210         https://bugs.webkit.org/show_bug.cgi?id=199840
2211         <rdar://problem/52856531>
2212
2213         Reviewed by Wenson Hsieh.
2214
2215         Fix a build error that occured when building for the watchOS Simulator in the debug configuration.
2216
2217         * rendering/RenderLayerCompositor.cpp:
2218         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingProxyRole):
2219
2220 2019-07-16  Justin Fan  <justin_fan@apple.com>
2221
2222         [WebGPU] Convert GPUComputePipeline LOG statements to generate GPUErrors
2223         https://bugs.webkit.org/show_bug.cgi?id=199773
2224
2225         Reviewed by Myles C. Maxfield.
2226
2227         Generate a GPUError if GPUComputePipeline creation fails.
2228         Rework the WHLSL test harness to take advantage of this.
2229
2230         Test: webgpu/compute-pipeline-errors.html
2231
2232         * Modules/webgpu/WebGPUComputePipelineDescriptor.cpp:
2233         (WebCore::WebGPUComputePipelineDescriptor::tryCreateGPUComputePipelineDescriptor const):
2234         * Modules/webgpu/WebGPUComputePipelineDescriptor.h:
2235         * Modules/webgpu/WebGPUDevice.cpp:
2236         (WebCore::WebGPUDevice::createComputePipeline const):
2237         * platform/graphics/gpu/GPUBuffer.h:
2238         * platform/graphics/gpu/GPUComputePipeline.h: 
2239                 Now inherits from GPUObjectBase, though this isn't super useful yet
2240                 since GPUComputePipeline itself does not expose any operations that can error. 
2241         * platform/graphics/gpu/GPUDevice.cpp:
2242         (WebCore::GPUDevice::tryCreateComputePipeline const):
2243         * platform/graphics/gpu/GPUDevice.h:
2244         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
2245         (WebCore::GPUBuffer::validateBufferUsage):
2246         * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
2247         (WebCore::trySetMetalFunctions):
2248         (WebCore::trySetFunctions):
2249         (WebCore::convertComputePipelineDescriptor):
2250         (WebCore::tryCreateMTLComputePipelineState):
2251         (WebCore::GPUComputePipeline::tryCreate):
2252         (WebCore::GPUComputePipeline::GPUComputePipeline):
2253
2254 2019-07-11  Justin Fan  <justin_fan@apple.com>
2255
2256         [WebGPU] Move error scopes out of GPUDevice for more portable error generation
2257         https://bugs.webkit.org/show_bug.cgi?id=199740
2258
2259         Reviewed by Myles C. Maxfield.
2260
2261         Move error generation into a separate RefCounted class to allow GPU objects to generate 
2262         errors independent of any GPUDevice.
2263         Create GPUObjectBase to delegate error generation and refactor GPUBuffer to inherit from GPUObjectBase.
2264
2265         No behavior change or new tests. Error scopes covered by error-scopes-test.html.
2266
2267         * Modules/webgpu/WebGPUDevice.cpp:
2268         (WebCore::WebGPUDevice::WebGPUDevice): Now creates a GPUErrorGenerator.
2269         (WebCore::WebGPUDevice::createBuffer const): Pass the GPUErrorGenerator to any created GPUBuffer.
2270         (WebCore::WebGPUDevice::createBufferMapped const): Ditto.
2271         (WebCore::WebGPUDevice::popErrorScope): Shouldn't be const. Can just ask for the GPUError rather than passing a lambda.
2272         (WebCore::WebGPUDevice::pushErrorScope const): Deleted.
2273         (WebCore::WebGPUDevice::popErrorScope const): Deleted.
2274         * Modules/webgpu/WebGPUDevice.h:
2275         (WebCore::WebGPUDevice::pushErrorScope):
2276         * Sources.txt:
2277         * WebCore.xcodeproj/project.pbxproj:
2278         * platform/graphics/gpu/GPUBuffer.h: Now inherits from GPUObjectBase for error generation ease.
2279         * platform/graphics/gpu/GPUDevice.cpp:
2280         (WebCore::GPUDevice::tryCreateBuffer): Ensure GPUBuffers reference the GPUErrorGenerator.
2281         (WebCore::GPUDevice::pushErrorScope): Deleted. No longer needed here.
2282         (WebCore::GPUDevice::popErrorScope): Deleted.
2283         (WebCore::GPUDevice::registerError): Deleted.
2284         * platform/graphics/gpu/GPUDevice.h: Move error scope logic out.
2285         * platform/graphics/gpu/GPUErrorGenerator.cpp: Added.
2286         (WebCore::GPUErrorGenerator::pushErrorScope):
2287         (WebCore::GPUErrorGenerator::popErrorScope):
2288         (WebCore::GPUErrorGenerator::generateError):
2289         * platform/graphics/gpu/GPUErrorGenerator.h: Added.
2290         (WebCore::GPUErrorGenerator::create):
2291         * platform/graphics/gpu/GPUObjectBase.h: Added.
2292         (WebCore::GPUObjectBase::generateError):
2293         (WebCore::GPUObjectBase::GPUObjectBase):
2294         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm: Use the GPUErrorGenerator directly during buffer creation.
2295         (WebCore::GPUBuffer::validateBufferUsage):
2296         (WebCore::GPUBuffer::tryCreate):
2297         (WebCore::GPUBuffer::GPUBuffer):
2298         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
2299         (WebCore::GPUQueue::submit): Prevent possible null dereference.
2300
2301 2019-07-10  Justin Fan  <justin_fan@apple.com>
2302
2303         [WebGPU] Implement GPUError and error scopes
2304         https://bugs.webkit.org/show_bug.cgi?id=199655
2305
2306         Reviewed by Myles C. Maxfield.
2307
2308         Add GPUErrorFilter, GPUError, and the ability to push and pop error scopes on a GPUDevice.
2309         This will allow us to check for WebGPU errors from JavaScript.
2310         Currently, only some GPUBuffer creation errors are reported for testing; more errors will follow in later patches.
2311
2312         Test: webgpu/error-scopes-test.html
2313
2314         * Modules/webgpu/GPUErrorFilter.idl: Added.
2315         * Modules/webgpu/GPUOutOfMemoryError.idl: Added.
2316         * Modules/webgpu/GPUValidationError.idl: Added.
2317         * Modules/webgpu/WebGPUDevice.cpp:
2318         (WebCore::WebGPUDevice::pushErrorScope):
2319         (WebCore::WebGPUDevice::popErrorScope): Resolve the Promise here, since GPUDevice shouldn't worry about DOM layer.
2320         * Modules/webgpu/WebGPUDevice.h:
2321         * Modules/webgpu/WebGPUDeviceErrorScopes.cpp: Added.
2322         (WebCore::WebGPUDeviceErrorScopes::pushErrorScope): Delegates to WebGPUDevice.
2323         (WebCore::WebGPUDeviceErrorScopes::popErrorScope): Ditto.
2324         * Modules/webgpu/WebGPUDeviceErrorScopes.h: Added.
2325         * Modules/webgpu/WebGPUDeviceErrorScopes.idl: Added.
2326         * platform/graphics/gpu/GPUBuffer.h:
2327         * platform/graphics/gpu/GPUDevice.cpp: The actual error stack lives here.
2328         (WebCore::GPUDevice::pushErrorScope):
2329         (WebCore::GPUDevice::popErrorScope): Calls a callback with a GPUError, if any.
2330         (WebCore::GPUDevice::registerError): Actually creates GPUErrors.
2331         * platform/graphics/gpu/GPUDevice.h:
2332         * platform/graphics/gpu/GPUError.cpp: Added.
2333         (WebCore::createError): Factory function for various error types.
2334         * platform/graphics/gpu/GPUError.h: Added.
2335         * platform/graphics/gpu/GPUErrorFilter.h: Added.
2336         * platform/graphics/gpu/GPUOutOfMemoryError.h: Added.
2337         (WebCore::GPUOutOfMemoryError::create):
2338         * platform/graphics/gpu/GPUValidationError.cpp: Added.
2339         (WebCore::GPUValidationError::create):
2340         (WebCore::GPUValidationError::GPUValidationError):
2341         * platform/graphics/gpu/GPUValidationError.h: Added.
2342         (WebCore::GPUValidationError::message const):
2343         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
2344         (WebCore::GPUBuffer::validateBufferUsage): Create an actual GPUValidationError :)
2345         (WebCore::GPUBuffer::tryCreate): Create GPUOutOfMemoryErrors where appropriate.
2346
2347         Add file/name references:
2348         * CMakeLists.txt:
2349         * DerivedSources-input.xcfilelist:
2350         * DerivedSources-output.xcfilelist:
2351         * DerivedSources.make:
2352         * Sources.txt:
2353         * WebCore.xcodeproj/project.pbxproj:
2354         * bindings/js/WebCoreBuiltinNames.h:
2355
2356         Missing includes:
2357         * Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp:
2358
2359 2019-07-16  Commit Queue  <commit-queue@webkit.org>
2360
2361         Unreviewed, rolling out r247493.
2362         https://bugs.webkit.org/show_bug.cgi?id=199841
2363
2364         "The new whlsl-for-loop.html test is failing on the bots"
2365         (Requested by rmorisset on #webkit).
2366
2367         Reverted changeset:
2368
2369         "[WHLSL] Desugar for loops and while loops"
2370         https://bugs.webkit.org/show_bug.cgi?id=199726
2371         https://trac.webkit.org/changeset/247493
2372
2373 2019-07-16  Per Arne Vollan  <pvollan@apple.com>
2374
2375         Prewarm font cache with more fonts
2376         https://bugs.webkit.org/show_bug.cgi?id=199283
2377
2378         Reviewed by Myles C. Maxfield.
2379
2380         Use the existing prewarm method in FontCache to prewarm the cache with a set of font family names.
2381         The font list consists of some of the fonts used by the 10 most popular sites on Alexa top sites.
2382         This is a confirmed improvement in page load time.
2383
2384         No new tests, covered by existing tests.
2385
2386         * page/ProcessWarming.cpp:
2387         (WebCore::ProcessWarming::prewarmGlobally):
2388         * platform/graphics/FontCache.cpp:
2389         (WebCore::FontCache::prewarmGlobally):
2390         * platform/graphics/FontCache.h:
2391         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2392         (WebCore::FontCache::prewarmGlobally):
2393
2394 2019-07-16  Robin Morisset  <rmorisset@apple.com>
2395
2396         [WHLSL] Desugar for loops and while loops
2397         https://bugs.webkit.org/show_bug.cgi?id=199726
2398
2399         Reviewed by Myles C. Maxfield.
2400
2401         This patch makes loops behave a lot more similarly to the spec.
2402         In particular, while loops are just degenerate for loops, so they can be desugared in the parser.
2403         And for loops can themselves be heavily desugared, into having no initializer, one condition and one increment
2404         by putting any initializer in a block around the loop, putting true in the condition if there is none, and putting any litteral in the increment if there is none.
2405
2406         Debugging this patch revealed an unrelated bug where the parser would generate an empty comma expression on ";", which the checker would then choke on.
2407         The parser now generates an empty block in that case (as specified in the spec), which fixes the problem.
2408
2409         Finally, while updating the NameResolver for the new structure of loops I realized that it was needlessly generating extra NameContext.
2410         They are not expected by the spec, that forbids naked variable declarations outside of blocks anyway.
2411         So I removed this unnecessary work, and fixed the parser to correctly forbid such naked variable declarations.
2412
2413         * Modules/webgpu/WHLSL/AST/WHLSLAST.h:
2414         * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h:
2415         (WebCore::WHLSL::AST::ForLoop::ForLoop):
2416         (WebCore::WHLSL::AST::ForLoop::condition):
2417         (WebCore::WHLSL::AST::ForLoop::increment):
2418         * Modules/webgpu/WHLSL/AST/WHLSLStatement.h:
2419         (WebCore::WHLSL::AST::Statement::isVariableDeclarationsStatement const):
2420         * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h: Removed.
2421         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
2422         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
2423         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
2424         (WebCore::WHLSL::ASTDumper::visit):
2425         * Modules/webgpu/WHLSL/WHLSLASTDumper.h:
2426         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
2427         (WebCore::WHLSL::Checker::visit):
2428         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
2429         (WebCore::WHLSL::NameResolver::visit):
2430         * Modules/webgpu/WHLSL/WHLSLNameResolver.h:
2431         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
2432         (WebCore::WHLSL::Parser::parseBlockBody):
2433         (WebCore::WHLSL::Parser::parseForLoop):
2434         (WebCore::WHLSL::Parser::parseWhileLoop):
2435         (WebCore::WHLSL::Parser::parseStatement):
2436         (WebCore::WHLSL::Parser::parseEffectfulExpression):
2437         * Modules/webgpu/WHLSL/WHLSLParser.h:
2438         * Modules/webgpu/WHLSL/WHLSLStatementBehaviorChecker.cpp:
2439         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
2440         (WebCore::WHLSL::Visitor::visit):
2441         * Modules/webgpu/WHLSL/WHLSLVisitor.h:
2442         * WebCore.xcodeproj/project.pbxproj:
2443
2444 2019-07-16  Tim Horton  <timothy_horton@apple.com>
2445
2446         NSTextFinder holes don't scroll with the page
2447         https://bugs.webkit.org/show_bug.cgi?id=199815
2448         <rdar://problem/52280514>
2449
2450         Reviewed by Simon Fraser.
2451
2452         * rendering/ScrollAlignment.h:
2453
2454 2019-07-16  Youenn Fablet  <youenn@apple.com>
2455
2456         [iOS] Make sure the first camera device in the list is the front camera
2457         https://bugs.webkit.org/show_bug.cgi?id=199811
2458         <rdar://problem/53125157>
2459
2460         Reviewed by Jer Noble.
2461
2462         Some websites call getUserMedia with a deviceId constraint and theey pick the
2463         first deviceId in the list provided by enumerateDevices.
2464         On iOS, this is the back camera which is often not what is expected by WebRTC applications.
2465         Instead, make sure the first camera device is the front camera.
2466
2467         Manually tested.
2468
2469         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
2470
2471 2019-07-16  Chris Dumez  <cdumez@apple.com>
2472
2473         Speed up StorageManager::getValues()
2474         https://bugs.webkit.org/show_bug.cgi?id=199812
2475
2476         Reviewed by Alex Christensen.
2477
2478         * storage/StorageMap.cpp:
2479         (WebCore::StorageMap::importItems):
2480         * storage/StorageMap.h:
2481
2482 2019-07-16  Simon Fraser  <simon.fraser@apple.com>
2483
2484         Remove "GraphicsContext 0x7ffd8765f6b0 stack changed by" logging
2485         https://bugs.webkit.org/show_bug.cgi?id=199834
2486
2487         Reviewed by Dean Jackson.
2488
2489         I inadvertently left in a couple of GraphicsContextStateStackChecker (used to detect mismatched
2490         GraphicsContext save/restore) in r246725, so remove them.
2491
2492         * rendering/RenderLayer.cpp:
2493         (WebCore::RenderLayer::paintLayerContents):
2494         * rendering/RenderLayerBacking.cpp:
2495         (WebCore::RenderLayerBacking::paintIntoLayer):
2496
2497 2019-07-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2498
2499         [Text autosizing] [iPadOS] Paragraph text on the front page of LinkedIn.com is not boosted
2500         https://bugs.webkit.org/show_bug.cgi?id=199827
2501         <rdar://problem/53152660>
2502
2503         Reviewed by Zalan Bujtas.
2504
2505         After r247467, we try to avoid boosting some text that might cause vertical overflow due to line height
2506         increasing inside a container that expects a fixed integer number of lines. However, in the case of
2507         linkedin.com, the line height specified is a fixed value of 26px, which greatly exceeds the specified font size
2508         of 14px. In this case, it's safe to boost font size, since doing so would not affect the line height at all.
2509
2510         To handle this case, don't avoid text autosizing due to the "fixed number of lines" heuristic if the line height
2511         is fixed, and is much larger than the font size.
2512
2513         Test: fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates.html
2514
2515         * rendering/style/TextSizeAdjustment.cpp:
2516         (WebCore::AutosizeStatus::updateStatus):
2517
2518 2019-07-16  Zalan Bujtas  <zalan@apple.com>
2519
2520         [ContentChangeObserver] Cancel ongoing content observation when tap is failed/cancelled
2521         https://bugs.webkit.org/show_bug.cgi?id=199828
2522         <rdar://problem/53152696>
2523
2524         Reviewed by Wenson Hsieh.
2525
2526         This patch ensures that we stop the content observation (initiated by touch start) when the tap
2527         is cancelled/failed.
2528
2529         Not testable.
2530
2531         * page/ios/ContentChangeObserver.cpp:
2532         (WebCore::ContentChangeObserver::didCancelPotentialTap):
2533         * page/ios/ContentChangeObserver.h:
2534
2535 2019-07-16  Rob Buis  <rbuis@igalia.com>
2536
2537         Remove support for beforeload on link=prefetch
2538         https://bugs.webkit.org/show_bug.cgi?id=199632
2539
2540         Reviewed by Youenn Fablet.
2541
2542         Remove support for beforeload on link=prefetch
2543         by not calling shouldLoadLink for prefetch.
2544         Also make loadLink return void since it always
2545         succeeds.
2546
2547         Tests: http/wpt/prefetch/beforeload-dynamic.html
2548                http/wpt/prefetch/beforeload.html
2549
2550         * html/HTMLLinkElement.cpp:
2551         (WebCore::HTMLLinkElement::process):
2552         * loader/LinkLoader.cpp:
2553         (WebCore::LinkLoader::prefetchIfNeeded):
2554         (WebCore::LinkLoader::loadLink):
2555         * loader/LinkLoader.h:
2556
2557 2019-07-16  Youenn Fablet  <youenn@apple.com>
2558
2559         Hop to main thread for release logging in RealtimeIncomingAudioSource
2560         https://bugs.webkit.org/show_bug.cgi?id=199813
2561
2562         Reviewed by Eric Carlson.
2563
2564         LoggerHelper routines allow logging messages in system console and inspector console.
2565         These routines iterate through a Vector of log observers which is not thread safe.
2566         Document, the main log observer, also expects to be called on the main thread.
2567         Manually tested (writing a layout test for this would require more than 2 seconds).
2568
2569         * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:
2570         (WebCore::RealtimeIncomingAudioSourceCocoa::OnData):
2571
2572 2019-07-15  Ryan Haddad  <ryanhaddad@apple.com>
2573
2574         Unreviewed, rolling out r247444.
2575
2576         Caused two scrolling tests to fail on iOS Simulator
2577
2578         Reverted changeset:
2579
2580         "Typing into a cell in a Google Sheet lags behind by one
2581         character"
2582         https://bugs.webkit.org/show_bug.cgi?id=199587
2583         https://trac.webkit.org/changeset/247444
2584
2585 2019-07-15  Zalan Bujtas  <zalan@apple.com>
2586
2587         outlook.live.com has odd viewport with edge gap
2588         https://bugs.webkit.org/show_bug.cgi?id=199822
2589         <rdar://problem/53029072>
2590
2591         Reviewed by Wenson Hsieh.
2592
2593         r244944 introduced a viewport width quirk because at certain screen size outlook.live.com's flex setup produced a slighly broken layout.
2594         We don't seem to need this quirk anymore (composed column's min-width is removed.)
2595
2596         * page/Quirks.cpp:
2597         (WebCore::Quirks::shouldIgnoreShrinkToFitContent const): Deleted.
2598         (WebCore::Quirks::overriddenViewLayoutWidth const): Deleted.
2599         * page/Quirks.h:
2600
2601 2019-07-15  Saam Barati  <sbarati@apple.com>
2602
2603         [WHLSL] Matrix memory layout should match HLSL by laying out columns linearly
2604         https://bugs.webkit.org/show_bug.cgi?id=199215
2605
2606         Reviewed by Myles C. Maxfield.
2607
2608         This patch makes it so that we lay out matrices in memory in the same
2609         way HLSL does. This is by laying out columns linearly in memory. So a float4x4
2610         composed by this series of floats in memory:
2611         [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
2612         
2613         composes this logical matrix:
2614         [[ 0,  4,  8, 12]
2615          [ 1,  5,  9, 13]
2616          [ 2,  6, 10, 14]
2617          [ 3,  7, 11, 15]]
2618         
2619         To implement this, we switch to using an array to represent the memory
2620         contents linear memory layout of a matrix. So the matrix float4x3 will now
2621         be an array<float, 12> in metal. Then, we change the indexed getter and
2622         setter methods for matrices to load and store from and to the correct
2623         memory locations. The memory layout of matrices is observable to WHLSL
2624         when using a matrix as an input/output to a shader.
2625
2626         Test: webgpu/whlsl-matrix-memory-layout.html
2627
2628         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
2629         (WebCore::WHLSL::Metal::writeNativeFunction):
2630         * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp:
2631         (WebCore::WHLSL::Metal::writeNativeType):
2632
2633 2019-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
2634
2635         [Text autosizing] [iPadOS] Product label text is clipped in portrait mode on the front page of sephora.com
2636         https://bugs.webkit.org/show_bug.cgi?id=199806
2637         <rdar://problem/52902482>
2638
2639         Reviewed by Zalan Bujtas.
2640
2641         On sephora.com, some product label text is currently boosted by idempotent text autosizing, which causes the
2642         labels be vertically clipped. This patch augments the idempotent text autosizing heuristic to avoid this case by
2643         checking if the element to be boosted has a fixed height or max height, whose value is very close to a small
2644         integer multiple of the line height. In this case, it's likely that the website expects the text to be no more
2645         than a few lines' worth of height, so boosting the text is likely to break the page.
2646
2647         Test: fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates.html
2648
2649         * rendering/style/RenderStyle.cpp:
2650         (WebCore::RenderStyle::isIdempotentTextAutosizingCandidate const):
2651         * rendering/style/TextSizeAdjustment.cpp:
2652         (WebCore::AutosizeStatus::updateStatus):
2653         * rendering/style/TextSizeAdjustment.h:
2654
2655         Rename Fields::DisplayNone to Fields::AvoidSubtree to avoid introducing another bit in RenderStyle's inherited
2656         flags.
2657
2658 2019-07-15  Myles C. Maxfield  <mmaxfield@apple.com>
2659
2660         New York font erroneously gets synthetic bold
2661         https://bugs.webkit.org/show_bug.cgi?id=199653
2662
2663         Unreviewed watchOS build fix.
2664
2665         * page/ProcessWarming.cpp:
2666         (WebCore::ProcessWarming::prewarmGlobally):
2667         * page/cocoa/MemoryReleaseCocoa.mm:
2668         (WebCore::platformReleaseMemory):
2669         * platform/graphics/FontCascadeDescription.cpp:
2670         * platform/graphics/FontDescription.h:
2671         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2672         (WebCore::invalidateFontCache):
2673         (WebCore::lookupFallbackFont):
2674         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
2675         (WebCore::FontCascadeDescription::effectiveFamilyAt const):
2676         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
2677         (WebCore::FontFamilySpecificationCoreText::fontRanges const):
2678         * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
2679
2680 2019-07-15  Commit Queue  <commit-queue@webkit.org>
2681
2682         Unreviewed, rolling out r247462.
2683         https://bugs.webkit.org/show_bug.cgi?id=199816
2684
2685         completely messed up the patch (Requested by litherum on
2686         #webkit).
2687
2688         Reverted changeset:
2689
2690         "New York font erroneously gets synthetic bold"
2691         https://bugs.webkit.org/show_bug.cgi?id=199653
2692         https://trac.webkit.org/changeset/247462
2693
2694 2019-07-11  Simon Fraser  <simon.fraser@apple.com>
2695
2696         Fix builds where HAVE_DESIGN_SYSTEM_UI_FONTS is not defined.
2697
2698         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2699         (WebCore::fontWithFamilySpecialCase):
2700
2701 2019-07-11  Justin Fan  <justin_fan@apple.com>
2702
2703         Unreviewed build fix.
2704
2705         * Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp: Missing include.
2706
2707 2019-07-11  Myles C. Maxfield  <mmaxfield@apple.com>
2708
2709         New York font erroneously gets synthetic bold
2710         https://bugs.webkit.org/show_bug.cgi?id=199653
2711         <rdar://problem/51692592>
2712
2713         Reviewed by Simon Fraser.
2714
2715         This patch adds support for -apple-system-ui-serif, -apple-system-ui-monospaced,
2716         and -apple-system-ui-rounded, behind an SPI that is off-by-default. We don't want
2717         to expose these fonts to the web because we don't a standardization story for them
2718         yet, but we do want some apps to be able to use them.
2719
2720         WebKit clients who want to use these fonts can set
2721         -[WKPreferences _shouldAllowDesignSystemUIFonts] = YES.
2722
2723         The patch generalizes our existing system-ui infrastructure to handle these three
2724         additional fonts. It also explicitly disables the unsupported dot-prefixed names
2725         so they don't leak out into Web content.
2726
2727         Tests: fast/text/design-system-ui-10.html
2728                fast/text/design-system-ui-11.html
2729                fast/text/design-system-ui-12.html
2730                fast/text/design-system-ui-13.html
2731                fast/text/design-system-ui-14.html
2732                fast/text/design-system-ui-15.html
2733                fast/text/design-system-ui-16.html
2734                fast/text/design-system-ui-2.html
2735                fast/text/design-system-ui-3.html
2736                fast/text/design-system-ui-4.html
2737                fast/text/design-system-ui-5.html
2738                fast/text/design-system-ui-6.html
2739                fast/text/design-system-ui-7.html
2740                fast/text/design-system-ui-8.html
2741                fast/text/design-system-ui-9.html
2742                fast/text/design-system-ui.html
2743
2744         * css/CSSFontFace.cpp:
2745         (WebCore::CSSFontFace::shouldAllowDesignSystemUIFonts const):
2746         * css/CSSFontFace.h:
2747         * css/CSSFontFaceSource.cpp:
2748         (WebCore::CSSFontFaceSource::load):
2749         * css/StyleResolver.cpp:
2750         (WebCore::StyleResolver::initializeFontStyle):
2751         * page/Settings.yaml:
2752         * platform/graphics/FontDescription.cpp:
2753         (WebCore::m_shouldAllowDesignSystemUIFonts):
2754         (WebCore::m_shouldAllowUserInstalledFonts): Deleted.
2755         * platform/graphics/FontDescription.h:
2756         (WebCore::FontDescription::shouldAllowDesignSystemUIFonts const):
2757         (WebCore::FontDescription::setShouldAllowDesignSystemUIFonts):
2758         (WebCore::FontDescription::operator== const):
2759         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2760         (WebCore::platformFontLookupWithFamily):
2761         (WebCore::fontWithFamily):
2762         * platform/graphics/cocoa/FontCacheCoreText.h:
2763         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
2764         (WebCore::systemFontUse):
2765         (WebCore::systemFontCascadeList):
2766         (WebCore::FontCascadeDescription::effectiveFamilyCount const):
2767         (WebCore::FontCascadeDescription::effectiveFamilyAt const):
2768         (WebCore::isSystemFontString): Deleted.
2769         (WebCore::isUIFontTextStyle): Deleted.
2770         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
2771         (WebCore::FontPlatformData::ctFont const):
2772         * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
2773         (WebCore::SystemFontDatabaseCoreText::createSystemUI):
2774         (WebCore::SystemFontDatabaseCoreText::createDesignSystemUI):
2775         (WebCore::SystemFontDatabaseCoreText::createTextStyle):
2776         (WebCore::SystemFontDatabaseCoreText::cascadeList):
2777         (WebCore::SystemFontDatabaseCoreText::applyWeightItalicsAndFallbackBehavior):
2778         (WebCore::SystemFontDatabaseCoreText::systemFontParameters):
2779         * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
2780         * platform/graphics/ios/FontCacheIOS.mm:
2781         (WebCore::platformFontWithFamilySpecialCase):
2782         * platform/graphics/mac/FontCacheMac.mm:
2783         (WebCore::platformFontWithFamilySpecialCase):
2784         * style/StyleResolveForDocument.cpp:
2785         (WebCore::Style::resolveForDocument):
2786         * svg/graphics/SVGImage.cpp:
2787         (WebCore::SVGImage::dataChanged):
2788         * testing/InternalSettings.cpp:
2789         (WebCore::InternalSettings::Backup::Backup):
2790         (WebCore::InternalSettings::Backup::restoreTo):
2791         (WebCore::InternalSettings::setShouldAllowDesignSystemUIFonts):
2792         * testing/InternalSettings.h:
2793         * testing/InternalSettings.idl:
2794
2795 2019-07-15  Chris Dumez  <cdumez@apple.com>
2796
2797         Crash under DisplayRefreshMonitorManager::displayWasUpdated()
2798         https://bugs.webkit.org/show_bug.cgi?id=199808
2799         <rdar://problem/53070144>
2800
2801         Reviewed by Geoffrey Garen.
2802
2803         Copy m_monitors before iterating over it because the calling displayLinkFired() on the
2804         monitor may end up calling DisplayRefreshMonitorManager::displayDidRefresh() synchronously,
2805         which removes the monitor from m_monitors.
2806
2807         * platform/graphics/DisplayRefreshMonitorManager.cpp:
2808         (WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
2809
2810 2019-07-15  Yusuke Suzuki  <ysuzuki@apple.com>
2811
2812         [JSC] Improve wasm wpt test results by fixing miscellaneous issues
2813         https://bugs.webkit.org/show_bug.cgi?id=199783
2814
2815         Reviewed by Mark Lam.
2816
2817         Remove WebAssemblyPrototype.
2818
2819         Tests: imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.html
2820                imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker.html
2821                imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.html
2822                imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.worker.html
2823                imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.html
2824                imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.worker.html
2825                imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.html
2826                imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.worker.html
2827                imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.html
2828                imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.worker.html
2829                imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.html
2830                imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker.html
2831                imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.html
2832                imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker.html
2833                imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.html
2834                imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.worker.html
2835                imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.html
2836                imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.worker.html
2837                imported/w3c/web-platform-tests/wasm/jsapi/interface.any.html
2838                imported/w3c/web-platform-tests/wasm/jsapi/interface.any.worker.html
2839                imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.html
2840                imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.worker.html
2841                imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.html
2842                imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.worker.html
2843                imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.html
2844                imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.worker.html
2845                imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.html
2846                imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.worker.html
2847                imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.html
2848                imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.worker.html
2849                imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.html
2850                imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.worker.html
2851                imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.html
2852                imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.worker.html
2853                imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.html
2854                imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.worker.html
2855                imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.html
2856                imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.worker.html
2857                imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.html
2858                imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.worker.html
2859                imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.html
2860                imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.worker.html
2861                imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.html
2862                imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.worker.html
2863                imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.html
2864                imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.worker.html
2865                imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.html
2866                imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.worker.html
2867
2868         * bindings/js/JSDOMWindowBase.cpp:
2869         (WebCore::JSDOMWindowBase::compileStreaming):
2870         (WebCore::JSDOMWindowBase::instantiateStreaming):
2871
2872 2019-07-15  Dean Jackson  <dino@apple.com>
2873
2874         [WebGL] Remove software rendering and simplify context creation on macOS
2875         https://bugs.webkit.org/show_bug.cgi?id=199789
2876
2877         Reviewed by Sam Weinig.
2878
2879         We don't ever want to fall-back to the software renderer. We'd be better
2880         off failing to create the context completely.
2881
2882         Also, the number of fall-back attempts we were making before hitting
2883         the software renderer was overkill. All hardware we support should
2884         handle a 32bpp buffer.
2885
2886         Lastly, we don't want to support supersampling - multisampling only.
2887
2888         I lied… there is one more thing - failing to create the context
2889         was causing an ASSERT trying to remove the GC3D from the global list.
2890
2891         * html/canvas/WebGLRenderingContextBase.cpp:
2892         (WebCore::WebGLRenderingContextBase::create):
2893         * page/Settings.yaml: Remove forceSoftwareWebGL setting.
2894         * platform/graphics/GraphicsContext3DAttributes.h:
2895         * platform/graphics/GraphicsContext3DManager.cpp:
2896         (WebCore::GraphicsContext3DManager::addContext):
2897         (WebCore::GraphicsContext3DManager::removeContext):
2898         (WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance):
2899         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
2900         (WebCore::GraphicsContext3D::GraphicsContext3D):
2901         (WebCore::setPixelFormat): Deleted.
2902
2903 2019-07-14  Dean Jackson  <dino@apple.com>
2904
2905         Move more WebGL things into unified builds
2906         https://bugs.webkit.org/show_bug.cgi?id=199787
2907
2908         Reviewed by Wenson Hsieh.
2909
2910         Unify as many WebGL files as possible.
2911
2912         * Sources.txt:
2913         * WebCore.xcodeproj/project.pbxproj:
2914         * html/canvas/WebGLFramebuffer.cpp:
2915         * html/canvas/WebGLObject.h: Move a helper function into an inline.
2916         (WebCore::objectOrZero):
2917         * html/canvas/WebGLRenderingContextBase.cpp:
2918         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2919         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2920
2921 2019-07-15  Keith Rollin  <krollin@apple.com>
2922
2923         Add missing webgpu includes
2924         https://bugs.webkit.org/show_bug.cgi?id=199802
2925         <rdar://problem/53119120>
2926
2927         Reviewed by Myles C. Maxfield.
2928
2929         WHLSLFunctionWriter.cpp fails to compile on tvOS and watchOS due to
2930         missing includes. This file likely compiles on other platforms due to
2931         the Unified Sources facility that clumps several implementation files
2932         together, exposing those implementation files to the others' includes.
2933         It fails on tvOS and watchOS due to the different ways these
2934         implementation files can get clumped together on different platforms.
2935
2936         No new tests as there is no functional change.
2937
2938         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
2939
2940 2019-07-15  Michael Catanzaro  <mcatanzaro@igalia.com>
2941
2942         Unreviewed, rolling out r247440.
2943
2944         Broke builds
2945
2946         Reverted changeset:
2947
2948         "[JSC] Improve wasm wpt test results by fixing miscellaneous
2949         issues"
2950         https://bugs.webkit.org/show_bug.cgi?id=199783
2951         https://trac.webkit.org/changeset/247440
2952
2953 2019-07-15  Daniel Bates  <dabates@apple.com>
2954
2955         Typing into a cell in a Google Sheet lags behind by one character
2956         https://bugs.webkit.org/show_bug.cgi?id=199587
2957         <rdar://problem/51616845>
2958
2959         Reviewed by Brent Fulgham.
2960
2961         Add a Google Sheets quirk. Put all DOM timers scheduled from keydown and keypress event listeners
2962         into a holding tank. The timers continue to tick, but are barred from executing their action until
2963         the next text insertion or deletion or 32 ms (on device) have elapsed, whichever is sooner. We only
2964         allocate a holding tank once per document, only if the quirk is active, and this allocation is done
2965         when the document schedules a timer on keydown or keypress. The holding tank lives for the lifetime
2966         of the document.
2967
2968         The story behind the quirk:
2969
2970         On keypress Google Sheets schedules timers and expects that a DOM update will occur (i.e. text
2971         will be inserted or deleted) within the same event loop iteration as the dispatched keypress. The
2972         UI Events spec. [1] makes no such guarantee of when a DOM update must occur in relation to the keypress
2973         event. It could happen in the same event loop iteration as the key press (as Google expects), the
2974         next iteration, 500ms later, 2 minutes later, etc. What the spec does guarantee is that by the time
2975         a DOM input event is dispatched that the DOM will be updated. And this is the solution to the problem
2976         Google Sheets is trying to solve, but is doing so using pre-IE 9 technology (though similar
2977         functionality was available via onpropertychange in IE < 9).
2978
2979         See also <https://github.com/w3c/uievents/issues/238>, which is tracking a spec. text update for
2980         this quirk.
2981
2982         Test: fast/events/ios/dom-update-on-keydown-quirk.html
2983
2984         [1] <https://w3c.github.io/uievents/> (Editor's Draft, 14 October 2018)
2985
2986         * SourcesCocoa.txt:
2987         * WebCore.xcodeproj/project.pbxproj:
2988         Add some files to the project.
2989
2990         * dom/Document.cpp:
2991         (WebCore::Document::domTimerHoldingTank): Added.
2992         * dom/Document.h:
2993         (WebCore::Document::domTimerHoldingTankIfExists): Added.
2994
2995         * page/DOMTimer.cpp:
2996         (WebCore::DOMTimer::install): Put the newly instantiated timer into the holding tank.
2997         (WebCore::DOMTimer::removeById): Remove the timer from the holding tank.
2998         (WebCore::DOMTimer::fired): Check if the timer is in the holding tank. If it is and it is a one-
2999         shot timer then schedule it for the next event loop iteration. If it's a repeating timer just
3000         let it continue ticking. Otherwise, do what we no now and execute the timer's action. The reason
3001         we do not suspend timers in the holding tank is because:
3002             1. Far out timers (Google Sheets registers timers as far out as 5 minutes!) are not penalized.
3003             Though smart supension logic could avoid this. See (3).
3004
3005             2. Empirical observations indicate that the keyboard will perform the insertion or deletion
3006             reasonably quickly (not the same event loop iteration as the keydown, but within two iterations out).
3007             So, the timers in the holding tank are short-lived.
3008
3009             3. Simplifies the code. There is no need to keep additional bookkeeping to track multiple timer
3010             suspension reasons (timers currently can only have one suspension reason) or alternatively defer
3011             scheduling a timer until a later time and computing a new "fair" firing time when scheduled.
3012         * page/EventHandler.cpp:
3013         (WebCore::EventHandler::internalKeyEvent): Place a token on the stack to put all DOM timers
3014         scheduled on keydown and keypress into the holding tank if the quirk is enabled.
3015         * page/Quirks.cpp:
3016         (WebCore::Quirks::needsDeferKeyDownAndKeyPressTimersUntilNextEditingCommand const): Added.
3017         * page/Quirks.h:
3018         * page/Settings.yaml: Added setting so that this quirk can be enabled from a layout test. This setting
3019         also lets us enable the quirk for all sites or for certain third-party apps if desired.
3020         * page/ios/DOMTimerHoldingTank.cpp: Added.
3021         (WebCore::DOMTimerHoldingTank::DOMTimerHoldingTank):
3022         (WebCore::DOMTimerHoldingTank::add):
3023         (WebCore::DOMTimerHoldingTank::remove):
3024         (WebCore::DOMTimerHoldingTank::contains):
3025         (WebCore::DOMTimerHoldingTank::removeAll):
3026         (WebCore::DOMTimerHoldingTank::stopExceededMaximumHoldTimer):
3027         * page/ios/DOMTimerHoldingTank.h: Added.
3028         (WebCore::DeferDOMTimersForScope::DeferDOMTimersForScope):
3029         (WebCore::DeferDOMTimersForScope::~DeferDOMTimersForScope):
3030         (WebCore::DeferDOMTimersForScope::isDeferring):
3031
3032 2019-07-15  Ryan Haddad  <ryanhaddad@apple.com>
3033
3034         Unreviewed, rolling out r247397, r247378, r247366.
3035
3036         Broke watchOS builds.
3037
3038         Reverted changesets:
3039
3040         "[WebGPU] Implement GPUError and error scopes"
3041         https://bugs.webkit.org/show_bug.cgi?id=199655
3042         https://trac.webkit.org/changeset/247366/webkit
3043
3044         "[WebGPU] Move error scopes out of GPUDevice for more portable error generation"
3045         https://bugs.webkit.org/show_bug.cgi?id=199740
3046         https://trac.webkit.org/changeset/247397/webkit
3047
3048 2019-07-15  Rob Buis  <rbuis@igalia.com>
3049
3050         MathML WPT test for RadicalDegreeBottomRaisePercent fails
3051         https://bugs.webkit.org/show_bug.cgi?id=183631
3052
3053         Reviewed by Frédéric Wang.
3054
3055         When stretching the radical operator also take thickness
3056         and radical gap into account:
3057         https://mathml-refresh.github.io/mathml-core/#radicals-msqrt-mroot
3058
3059         Test: imported/w3c/web-platform-tests/mathml/presentation-markup/radicals/root-parameters-1.html
3060
3061         * rendering/mathml/RenderMathMLRoot.cpp:
3062         (WebCore::RenderMathMLRoot::layoutBlock):
3063
3064 2019-07-15  Yusuke Suzuki  <ysuzuki@apple.com>
3065
3066         [JSC] Improve wasm wpt test results by fixing miscellaneous issues
3067         https://bugs.webkit.org/show_bug.cgi?id=199783
3068
3069         Reviewed by Mark Lam.
3070
3071         Remove WebAssemblyPrototype.
3072
3073         Tests: imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.html
3074                imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker.html
3075                imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.html
3076                imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.worker.html
3077                imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.html
3078                imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.worker.html
3079                imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.html
3080                imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.worker.html
3081                imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.html
3082                imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.worker.html
3083                imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.html
3084                imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker.html
3085                imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.html
3086                imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker.html
3087                imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.html
3088                imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.worker.html
3089                imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.html
3090                imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.worker.html
3091                imported/w3c/web-platform-tests/wasm/jsapi/interface.any.html
3092                imported/w3c/web-platform-tests/wasm/jsapi/interface.any.worker.html
3093                imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.html
3094                imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.worker.html
3095                imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.html
3096                imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.worker.html
3097                imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.html
3098                imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.worker.html
3099                imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.html
3100                imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.worker.html
3101                imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.html
3102                imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.worker.html
3103                imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.html
3104                imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.worker.html
3105                imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.html
3106                imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.worker.html
3107                imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.html
3108                imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.worker.html
3109                imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.html
3110                imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.worker.html
3111                imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.html
3112                imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.worker.html
3113                imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.html
3114                imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.worker.html
3115                imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.html
3116                imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.worker.html
3117                imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.html
3118                imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.worker.html
3119                imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.html
3120                imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.worker.html
3121
3122         * bindings/js/JSDOMWindowBase.cpp:
3123         (WebCore::JSDOMWindowBase::compileStreaming):
3124         (WebCore::JSDOMWindowBase::instantiateStreaming):
3125
3126 2019-07-15  Youenn Fablet  <youenn@apple.com>
3127
3128         Enable a debug WebRTC mode without any encryption
3129         https://bugs.webkit.org/show_bug.cgi?id=199177
3130         <rdar://problem/52074986>
3131
3132         Reviewed by Eric Carlson.
3133
3134         For every RTCPeerConnection, first set whether to use encryption or not
3135         based on page settings.
3136         If encryption is disabled, log it.
3137         Add internals API to toggle the switch from tests.
3138         Test: webrtc/disable-encryption.html
3139
3140         * Modules/mediastream/RTCPeerConnection.cpp:
3141         (WebCore::RTCPeerConnection::RTCPeerConnection):
3142         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3143         (WebCore::createLibWebRTCPeerConnectionBackend):
3144         * inspector/agents/InspectorPageAgent.cpp:
3145         * page/Settings.yaml:
3146         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
3147         (WebCore::LibWebRTCProvider::setEnableWebRTCEncryption):
3148         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
3149         * testing/Internals.cpp:
3150         (WebCore::Internals::resetToConsistentState):
3151         (WebCore::Internals::setEnableWebRTCEncryption):
3152         * testing/Internals.h:
3153         * testing/Internals.idl:
3154
3155 2019-07-15  Sihui Liu  <sihui_liu@apple.com>
3156
3157         window.openDatabase is not writable
3158         https://bugs.webkit.org/show_bug.cgi?id=199737
3159         <rdar://problem/52551332>
3160
3161         Reviewed by Chris Dumez.
3162
3163         In r246707 we made openDatabase an undetectable attribute of window, and it was set to be read-only. This broke 
3164         some sites which replace window.openDatabase with their own implementation when window.openDatabase does not 
3165         exists or WebSQL is not implemented. 
3166
3167         This patch removes the readonly property and adds a setter for openDatabase.
3168
3169         * Modules/webdatabase/DOMWindowWebDatabase.idl:
3170         * bindings/js/JSDOMWindowCustom.cpp:
3171         (WebCore::JSDOMWindow::setOpenDatabase):
3172
3173 2019-07-15  Youenn Fablet  <youenn@apple.com>
3174
3175         Filter SDP c lines
3176         https://bugs.webkit.org/show_bug.cgi?id=199791
3177
3178         Reviewed by Eric Carlson.
3179
3180         As discussed in https://github.com/rtcweb-wg/mdns-ice-candidates/issues/91,
3181         use 0.0.0.0 for c lines when filtering the SDP.
3182         Covered by updated test.
3183
3184         * Modules/mediastream/PeerConnectionBackend.cpp:
3185         (WebCore::PeerConnectionBackend::filterSDP const):
3186
3187 2019-07-15  Zalan Bujtas  <zalan@apple.com>
3188
3189         naver.com: Video stops when tapping on the video to use buttons
3190         https://bugs.webkit.org/show_bug.cgi?id=199784
3191         <rdar://problem/48068610>
3192
3193         Reviewed by Maciej Stachowiak.
3194
3195         Opt out of simulated mouse event sending for tv.naver.com.
3196         When tv.naver.com receives the simulated mouseUp at touchEnd, it pauses the video right away and calls preventDefault()
3197         which prevents us from running the hover heuristics.
3198
3199         * page/Quirks.cpp:
3200         (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
3201
3202 2019-07-15  Michael Catanzaro  <mcatanzaro@igalia.com>
3203
3204         [GTK] GitHub breaks on FreeBSD because of "unsupported browser"
3205         https://bugs.webkit.org/show_bug.cgi?id=199745
3206
3207         Reviewed by Carlos Garcia Campos.
3208
3209         It's been a while since I last updated the fake version numbers in our user agent, both for
3210         the user agent quirks for naughty websites and also the Safari version in our standard user
3211         agent. Update them. This should fix github.com on FreeBSD at least. I also noticed some
3212         wonkiness on Google Docs recently that I thought required this update, but I didn't do
3213         anything about it at the time because I wasn't able to reproduce the issue when I tried
3214         again later.
3215
3216         This could absolutely break websites, because the web is awful, but that's calculated risk.
3217
3218         * platform/UserAgentQuirks.cpp:
3219         (WebCore::UserAgentQuirks::stringForQuirk):
3220         * platform/glib/UserAgentGLib.cpp:
3221         (WebCore::buildUserAgentString):
3222
3223 2019-07-14  Chris Dumez  <cdumez@apple.com>
3224
3225         Add threading assertion to WeakPtrFactory::createWeakPtr()
3226         https://bugs.webkit.org/show_bug.cgi?id=199639
3227
3228         Reviewed by Ryosuke Niwa.
3229
3230         * platform/ScrollableArea.cpp:
3231         * rendering/RenderObject.cpp:
3232
3233 2019-07-14  Dean Jackson  <dino@apple.com>
3234
3235         WebGL not supported on WKWebView on UIKit for Mac
3236         https://bugs.webkit.org/show_bug.cgi?id=199785
3237         <rdar://problem/52911449>
3238
3239         Reviewed by Antoine Quint.
3240
3241         UIKit for Mac was not creating a CGLPixelFormatObj because
3242         it wasn't using the code hidden in PLATFORM(MAC). Instead
3243         we should be guarding for USE(OPENGL).
3244
3245         There are still some inconsistencies: <rdar://53062794>
3246
3247         Test: webgl/smell-test.html
3248
3249         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
3250         (WebCore::GraphicsContext3D::GraphicsContext3D):
3251         (WebCore::GraphicsContext3D::allowOfflineRenderers const): We have to return
3252         true for this, since we don't have access to the Window Server.
3253
3254 2019-07-13  Wenson Hsieh  <wenson_hsieh@apple.com>
3255
3256         [Text autosizing] [iPadOS] Further adjust our heuristics to determine text autosizing candidates
3257         https://bugs.webkit.org/show_bug.cgi?id=199780
3258         <rdar://problem/52289088>
3259
3260         Reviewed by Simon Fraser.
3261
3262         Our current idempotent text autosizing candidate heuristic makes the right judgment call most of the time, but
3263         there is still a large batch of text autosizing bugs left unfixed by the first iteration of the heuristic added
3264         in r246781. This patch attempts to address most of these bugs by adjusting the decision-tree-based heuristic
3265         once again, mostly with improvements to the model generation pipeline.
3266
3267         During the first iteration, I placed emphasis on tuning the max tree depth and min leaf size hyperparameters
3268         when coming up with my decision tree, and didn't consider the inclusion or exclusion of each feature as a
3269         hyperparameters. As such, the trees generated using the pipeline tended to use too many features, and as a
3270         result, tended to have cross-validation overall accuracy scores hovering around 73%.
3271
3272         In this revised model generation pipeline, I now consider the inclusion of each feature (along with max depth
3273         and min leaf size, as before) as a hyperparameter. Since this increases the number of hyperparameters by many
3274         orders of magnitude, a naive grid search (as described in the prior ChangeLog entry) is no longer a tractible
3275         procedure for tuning hyperparameters to the training algorithm.
3276
3277         Instead, I now use a stochastic greedy algorithm to search for good sets of hyperparameters; this process begins
3278         with seeding some number (usually 20-24) of "searchers" with completely randomized sets of hyperparameters (i.e.
3279         random max depth, random leaf size, and random subsets of features). I then evaluate the average performance of
3280         each set of hyperparameters by using them to generate 2000 decision trees over 90% of the training data, and
3281         then cross-validating these trees against the remaining 10%. These cross-validation scores are aggregated into a
3282         single confusion matrix, which is then passed into a loss function that computes a single value indicating how
3283         well training with the set of hyperparameters generalized to cross-validation data. After experimenting with
3284         various loss functions, I settled on the following:
3285
3286         `k(false positive rate)^2 + (false negative rate)^2`
3287
3288         ...where a constant k is chosen to penalize false positives (i.e. broken layout) more harshly than false
3289         negatives (small text). Additionally, squaring the false negative and false positive rates seems to help avoid
3290         converging on solutions that heavily favor reducing only false positives or false negatives, or vice versa.
3291
3292         The stochastic algorithm starts by computing a loss value for the randomly generated configuration. Then, for
3293         an indefinite number of iterations, it randomly mutates the configuration (e.g. by adding or removing features,
3294         or changing min leaf size or max tree depth) and computes a new loss value for the mutated configuration. If the
3295         mutated configuration performs better (i.e. achieves lower loss) than the current configuration, I set the
3296         current configuration to be the mutated configuration. Otherwise, I keep the current (non-mutated) configuration
3297         as-is. The stochastic algorithm then proceeds, ad-infinitum, with this current configuration.
3298
3299         Of course, since each mutation is small, this strategy so far is prone to leaving each searcher stuck in local
3300         optima. To mitigate this, for each searcher, I keep track of a side-table of configurations that have already
3301         been tested; when random mutations would normally lead to testing a configuration that has already been tested,
3302         each searcher instead increases the chance of applying additional mutations. This has the effect of searchers
3303         initially exhausting similar configurations, and expanding to test more and more dissimilar configurations as
3304         the local alternatives all turn out to be worse. This allows searchers to effectively jump out of local optima
3305         after being stuck for a long time.
3306
3307         So, using these strategies, I simultaneously ran a handful of searchers until they all appeared to converge
3308         (a process that takes 8-12 hours on my current dataset). Many of the searchers achieved configurations with
3309         cross-validation scores of 81% and above, up from the 73% of the previous attempt. These additionally have the
3310         added bonus of reducing the number of features, often making the final trees themselves shallower and simpler to
3311         understand than before.
3312
3313         This patch introduces one such decision tree generated using a set of hyperparameters acquired via this
3314         stochasic search algorithm; it appears to simultaneously use fewer features, and achieve better cross-validation
3315         performance.
3316
3317         Test: fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates.html
3318
3319         * css/StyleResolver.cpp:
3320         (WebCore::StyleResolver::adjustRenderStyleForTextAutosizing):
3321
3322         Adjust the early return to bail if either (1) the element is a candidate and the computed size is already equal
3323         to the boosted size, or (2) the element is not a candidate and the computed size is already equal to the
3324         specified size. Since the autosizing candidate heuristic depends on styles specified on the element itself (as
3325         opposed to styles on any element in the ancestor chain), a parent may be an autosizing candidate, but a child of
3326         it may not.
3327
3328         * rendering/style/RenderStyle.cpp:
3329         (WebCore::RenderStyle::isIdempotentTextAutosizingCandidate const):
3330
3331         Revamp the idempotent text autosizing candidate heuristic. See the explanation above for more details.
3332
3333         * rendering/style/RenderStyle.h:
3334
3335         Remove some bits from RenderStyle's autosizeStatus, now that we care about fewer bits of information from the
3336         inherited flags.
3337
3338         * rendering/style/TextSizeAdjustment.cpp:
3339         (WebCore::AutosizeStatus::updateStatus):
3340         * rendering/style/TextSizeAdjustment.h:
3341
3342 2019-07-13  Simon Fraser  <simon.fraser@apple.com>
3343
3344         Don't do async overflow scrolling for visibility:hidden scrollers
3345         https://bugs.webkit.org/show_bug.cgi?id=199779
3346
3347         Reviewed by Dean Jackson.
3348         
3349         An overflow:scroll with visibility:hidden is not scrollable on macOS, even if it has visible
3350         content. So disable async overflow:scroll when the scroller has non-visible visibility (this also
3351         takes visibility on ancestors into account).
3352         
3353         visibility:hidden overflow:scroll can be common because some JS libraries use it
3354         (https://github.com/wnr/element-resize-detector).
3355
3356         Test: compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers.html
3357
3358         * rendering/RenderLayer.cpp:
3359         (WebCore::RenderLayer::canUseCompositedScrolling const): Don't use hasVisibleContent() because
3360         that's affected by  visible children.
3361
3362 2019-07-13  Robin Morisset  <rmorisset@apple.com>
3363
3364         [WHLSL] Return statements don't need to keep track of the function they're in
3365         https://bugs.webkit.org/show_bug.cgi?id=199763
3366
3367         Reviewed by Myles C. Maxfield.
3368
3369         Return::m_function is only used in the Checker, and it can easily enough keep track of the current function.
3370         This means we no longer need to keep track of the current function in the NameResolver, and we can save 8 bytes per Return
3371
3372         Since I was touching the NameResolver I also removed a few pointless overrides of Visitor::visit().
3373
3374         No new tests as there is no intended functional change.
3375
3376         * Modules/webgpu/WHLSL/AST/WHLSLReturn.h:
3377         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
3378         (WebCore::WHLSL::Checker::visit):
3379         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
3380         (WebCore::WHLSL::NameResolver::NameResolver):
3381         (WebCore::WHLSL::resolveTypeNamesInFunctions):
3382         * Modules/webgpu/WHLSL/WHLSLNameResolver.h:
3383
3384 2019-07-13  Andres Gonzalez  <andresg_22@apple.com>
3385
3386         Add accessibility support to WKDataListSuggestionsView.
3387         https://bugs.webkit.org/show_bug.cgi?id=199772
3388         <rdar://problem/47095851>
3389
3390         Reviewed by Chris Fleizach.
3391
3392         Localizable strings for accessibility announcements.
3393
3394         * en.lproj/Localizable.strings:
3395
3396 2019-07-13  Chris Dumez  <cdumez@apple.com>
3397
3398         Drop non thread-safe usage of WeakPtr in VideoFullscreenInterfaceAVKit
3399         https://bugs.webkit.org/show_bug.cgi?id=199775
3400
3401         Reviewed by Eric Carlson.
3402
3403         The VideoFullscreenInterfaceAVKit constructor was making a weakPtr on the UI Thread
3404         of an WebThread object. The WeakPtr would then be used as a data member throughout
3405         the class on the UIThread. This is not thread-safe.
3406
3407         This patch switches to using a raw pointer instead of a WeakPtr. This is a partial
3408         rollout of r243298, which turned the raw pointer into a WeakPtr for hardening
3409         purposes. For extra safety, this patch updates the VideoFullscreenControllerContext
3410         so that it notifies its clients (i.e. PlaybackSessionInterfaceAVKit) that it is
3411         getting destroyed, so that they can null-out their m_videoFullscreenModel &
3412         m_fullscreenChangeObserver data members. This gives the sames guarantees as WeakPtr
3413         but in a thread-safe way.
3414
3415         This is very similar to the fix that was done for PlaybackSessionInterfaceAVKit in
3416         r247380.
3417
3418         * platform/cocoa/VideoFullscreenModel.h:
3419         (WebCore::VideoFullscreenModelClient::modelDestroyed):
3420         * platform/ios/VideoFullscreenInterfaceAVKit.h:
3421         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
3422         (VideoFullscreenInterfaceAVKit::setVideoFullscreenModel):
3423         (VideoFullscreenInterfaceAVKit::setVideoFullscreenChangeObserver):
3424         (VideoFullscreenInterfaceAVKit::modelDestroyed):
3425         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3426         (VideoFullscreenControllerContext::~VideoFullscreenControllerContext):
3427
3428 2019-07-13  Zalan Bujtas  <zalan@apple.com>
3429
3430         Cannot bring up custom media controls at all on v.youku.com
3431         https://bugs.webkit.org/show_bug.cgi?id=199699
3432         <rdar://problem/51835327>
3433
3434         Reviewed by Simon Fraser.
3435
3436         The "find the node under the finger" heuristic should only find nodes that are visible to hit-testing.
3437
3438         When the user taps on the screen, we run a "find the best node under the finger" heuristic and use the node's location
3439         to dispatch the associated event (e.g. mousePressed).
3440         Ideally the "best node under the finger" and the final target node for the associated event are the same.
3441         However these two methods configure the hit-testing process differently which could lead to node mismatch.
3442         The "best node" heuristic calls hit-testing with AllowChildFrameContent. This flag allows hit-testing to descend into
3443         subframes even if the subframe is not visible to hit-testing (visibility: hidden).
3444         While event dispatching never descends into subfames through hit-testing, but instead it forwards the dispatching to subframes that are visible to hit-testing.
3445
3446         This patch addresses the mismatching node issue by calling the descending version of hit-testing with a flag that enforces visiblity check before descending into a subframe.
3447
3448         Tests: fast/events/touch/ios/visibility-hidden-iframe-click.html
3449                fast/events/touch/ios/visibility-hidden-nested-iframe-click.html
3450
3451         * page/ios/FrameIOS.mm:
3452         (WebCore::Frame::hitTestResultAtViewportLocation):
3453         * rendering/HitTestRequest.h:
3454         (WebCore::HitTestRequest::skipsChildFrameContentInvisibleToHitTest const):
3455         * rendering/RenderWidget.cpp:
3456         (WebCore::RenderWidget::nodeAtPoint):
3457
3458 2019-07-13  Chris Dumez  <cdumez@apple.com>
3459
3460         Fix non thread-safe usage of makeWeakPtr() in MediaPlayerPrivateAVFoundation
3461         https://bugs.webkit.org/show_bug.cgi?id=199777
3462
3463         Reviewed by Eric Carlson.
3464
3465         The code was calling makeWeakPtr() on a main-thread object, from a background thread.
3466         This is not thread safe. To address the issue, this patches creates the WeakPtr ahead
3467         of time, on the main thread.
3468
3469         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
3470         (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
3471         (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification):
3472         (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
3473         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
3474
3475 2019-07-12  Thibault Saunier  <tsaunier@igalia.com>
3476
3477         [GStreamer] Mock GStreamer realtime sources should keep a Ref of their mock realtime media sources
3478         https://bugs.webkit.org/show_bug.cgi?id=194326
3479
3480         WrappedMockRealtimeVideoSource is a subclass of RealtimeMediaSource which is refcounted, we can't
3481         use a unique_ptr on those.
3482
3483         Also changed m_wrappedSource type to its actual type so it is cleaner even if needed
3484         to upcast it to RealtimeMediaSource so some method that are made private in the mock
3485         can still be called.
3486
3487         Reviewed by Youenn Fablet.
3488
3489         This fixes MediaStream tests
3490
3491         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
3492         (WebCore::WrappedMockRealtimeAudioSource::create):
3493         (WebCore::WrappedMockRealtimeAudioSource::asRealtimeMediaSource):
3494         (WebCore::WrappedMockRealtimeAudioSource::WrappedMockRealtimeAudioSource):
3495         (WebCore::m_wrappedSource):
3496         (WebCore::MockGStreamerAudioCaptureSource::startProducingData):
3497         (WebCore::MockGStreamerAudioCaptureSource::settings):
3498         (WebCore::MockGStreamerAudioCaptureSource::capabilities):
3499         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h:
3500         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp:
3501         (WebCore::WrappedMockRealtimeVideoSource::create):
3502         (WebCore::WrappedMockRealtimeVideoSource::asRealtimeMediaSource):
3503         (WebCore::WrappedMockRealtimeVideoSource::WrappedMockRealtimeVideoSource):
3504         (WebCore::m_wrappedSource):
3505         (WebCore::MockGStreamerVideoCaptureSource::settings):
3506         (WebCore::MockGStreamerVideoCaptureSource::capabilities):
3507         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h:
3508
3509 2019-07-12  Alex Christensen  <achristensen@webkit.org>
3510
3511         Change RELEASE_ASSERT in DocumentWriter::addData to ASSERT and early return
3512         https://bugs.webkit.org/show_bug.cgi?id=199756
3513         <rdar://problem/51554775>
3514
3515         Reviewed by Brady Eidson.
3516
3517         Attempts to reach this assertion were unsuccessful, but sometimes this assertion crashes.
3518         Let's change it to an early return to prevent crashes.
3519
3520         * loader/DocumentWriter.cpp:
3521         (WebCore::DocumentWriter::addData):
3522
3523 2019-07-12  Justin Fan  <justin_fan@apple.com>
3524
3525         [WebGPU] Move error scopes out of GPUDevice for more portable error generation
3526         https://bugs.webkit.org/show_bug.cgi?id=199740
3527
3528         Reviewed by Myles C. Maxfield.
3529
3530         Move error generation into a separate RefCounted class to allow GPU objects to generate 
3531         errors independent of any GPUDevice.
3532         Create GPUObjectBase to delegate error generation and refactor GPUBuffer to inherit from GPUObjectBase.
3533
3534         No behavior change or new tests. Error scopes covered by error-scopes-test.html.
3535
3536         * Modules/webgpu/WebGPUDevice.cpp:
3537         (WebCore::WebGPUDevice::WebGPUDevice): Now creates a GPUErrorGenerator.
3538         (WebCore::WebGPUDevice::createBuffer const): Pass the GPUErrorGenerator to any created GPUBuffer.
3539         (WebCore::WebGPUDevice::createBufferMapped const): Ditto.
3540         (WebCore::WebGPUDevice::popErrorScope): Shouldn't be const. Can just ask for the GPUError rather than passing a lambda.
3541         (WebCore::WebGPUDevice::pushErrorScope const): Deleted.
3542         (WebCore::WebGPUDevice::popErrorScope const): Deleted.
3543         * Modules/webgpu/WebGPUDevice.h:
3544         (WebCore::WebGPUDevice::pushErrorScope):
3545         * Sources.txt:
3546         * WebCore.xcodeproj/project.pbxproj:
3547         * platform/graphics/gpu/GPUBuffer.h: Now inherits from GPUObjectBase for error generation ease.
3548         * platform/graphics/gpu/GPUDevice.cpp:
3549         (WebCore::GPUDevice::tryCreateBuffer): Ensure GPUBuffers reference the GPUErrorGenerator.
3550         (WebCore::GPUDevice::pushErrorScope): Deleted. No longer needed here.
3551         (WebCore::GPUDevice::popErrorScope): Deleted.
3552         (WebCore::GPUDevice::registerError): Deleted.
3553         * platform/graphics/gpu/GPUDevice.h: Move error scope logic out.
3554         * platform/graphics/gpu/GPUErrorGenerator.cpp: Added.
3555         (WebCore::GPUErrorGenerator::pushErrorScope):
3556         (WebCore::GPUErrorGenerator::popErrorScope):
3557         (WebCore::GPUErrorGenerator::generateError):
3558         * platform/graphics/gpu/GPUErrorGenerator.h: Added.
3559         (WebCore::GPUErrorGenerator::create):
3560         * platform/graphics/gpu/GPUObjectBase.h: Added.
3561         (WebCore::GPUObjectBase::generateError):
3562         (WebCore::GPUObjectBase::GPUObjectBase):
3563         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm: Use the GPUErrorGenerator directly during buffer creation.
3564         (WebCore::GPUBuffer::validateBufferUsage):
3565         (WebCore::GPUBuffer::tryCreate):
3566         (WebCore::GPUBuffer::GPUBuffer):
3567         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
3568         (WebCore::GPUQueue::submit): Prevent possible null dereference.
3569
3570 2019-07-12  Youenn Fablet  <youenn@apple.com>
3571
3572         Add release logging for quota checks
3573         https://bugs.webkit.org/show_bug.cgi?id=199697
3574
3575         Reviewed by Alex Christensen.
3576
3577         Log whether a request to extend quota is made and the result of the request.
3578         This logging should happen in the networking process.
3579         No change of behavior.
3580
3581         * platform/Logging.h:
3582         * storage/StorageQuotaManager.cpp:
3583         (WebCore::StorageQuotaManager::askForMoreSpace):
3584         (WebCore::StorageQuotaManager::processPendingRequests):
3585
3586 2019-07-12  Youenn Fablet  <youenn@apple.com>
3587
3588         Stopping a cloned MediaStream video track should not stop any other video track
3589         https://bugs.webkit.org/show_bug.cgi?id=199635
3590
3591         Reviewed by Eric Carlson.
3592
3593         In case a track is requesting its source to end, the
3594         RealtimeVideoSource should request its own source to end and not stop it directly.
3595
3596         Also, if a track is removing itself as an observer to a RealtimeVideoSource, we should
3597         stop the underlying source only if this one does not have any other observer.
3598         Covered by updated test.
3599
3600         * platform/mediastream/RealtimeMediaSource.cpp:
3601         (WebCore::RealtimeMediaSource::removeObserver):
3602         * platform/mediastream/RealtimeMediaSource.h:
3603         * platform/mediastream/RealtimeVideoSource.cpp:
3604         (WebCore::RealtimeVideoSource::requestToEnd):
3605         (WebCore::RealtimeVideoSource::stopBeingObserved):
3606         * platform/mediastream/RealtimeVideoSource.h:
3607
3608 2019-07-12  Timothy Hatcher  <timothy@apple.com>
3609
3610         Drop DarkModeCSSEnabled as an experimental feature and always enable it.
3611         https://bugs.webkit.org/show_bug.cgi?id=199725
3612         rdar://problem/52970972
3613
3614         Reviewed by Megan Gardner.
3615
3616         Tests: css-dark-mode
3617
3618         * css/CSSComputedStyleDeclaration.cpp:
3619         (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
3620         * css/MediaQueryEvaluator.cpp:
3621         (WebCore::prefersColorSchemeEvaluate):
3622         * css/MediaQueryExpression.cpp:
3623         (WebCore::featureWithValidIdent):
3624         (WebCore::isFeatureValidWithoutValue):
3625         * css/parser/CSSPropertyParser.cpp:
3626         (WebCore::CSSPropertyParser::parseSingleValue):
3627         * html/HTMLMetaElement.cpp:
3628         (WebCore::HTMLMetaElement::process):
3629         * page/RuntimeEnabledFeatures.h:
3630         (WebCore::RuntimeEnabledFeatures::setDarkModeCSSEnabled): Deleted.
3631         (WebCore::RuntimeEnabledFeatures::darkModeCSSEnabled const): Deleted.
3632
3633 2019-07-12  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3634
3635         Refactor ShadowBlur: remove some class variables and use function parameters instead.
3636         https://bugs.webkit.org/show_bug.cgi?id=199511
3637
3638         Reviewed by Said Abou-Hallawa.
3639
3640         On the ShadowBlur class it is confusing to know if the status of the m_layerImage buffer or the
3641         values calculated by calculateLayerBoundingRect() are valid between the different function calls.
3642
3643         To avoid this problem, pass this values as function parameters instead of storing them in the class.
3644
3645         No new tests, no intended behaviour change.
3646
3647         * platform/graphics/ShadowBlur.cpp:
3648         (WebCore::ShadowBlur::ShadowBlur):
3649         (WebCore::ShadowBlur::calculateLayerBoundingRect):
3650         (WebCore::ShadowBlur::drawShadowBuffer):
3651         (WebCore::ShadowBlur::drawRectShadow): Pass the parameters from the callback.
3652         (WebCore::ShadowBlur::drawInsetShadow): Ditto.
3653         (WebCore::ShadowBlur::drawRectShadowWithoutTiling):
3654         (WebCore::ShadowBlur::drawInsetShadowWithoutTiling):
3655         (WebCore::ShadowBlur::drawRectShadowWithTiling):
3656         (WebCore::ShadowBlur::drawInsetShadowWithTiling):
3657         (WebCore::ShadowBlur::drawLayerPieces):
3658         (WebCore::ShadowBlur::drawLayerPiecesAndFillCenter):
3659         (WebCore::ShadowBlur::blurShadowBuffer):
3660         (WebCore::ShadowBlur::blurAndColorShadowBuffer):
3661         (WebCore::ShadowBlur::drawShadowLayer):
3662         * platform/graphics/ShadowBlur.h: Use a struct to pass the values calculated on calculateLayerBoundingRect().
3663
3664 2019-07-12  Adrian Perez de Castro  <aperez@igalia.com>
3665
3666         [ATK] Avoid unneeded call to to core(selection) in listObjectForSelection()
3667         https://bugs.webkit.org/show_bug.cgi?id=199748
3668         <rdar://problem/52995908>
3669
3670         Reviewed by Konstantin Tokarev.
3671
3672         No new tests needed.
3673
3674         * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:
3675         (listObjectForCoreSelection): Renamed from listObjectForSelection() and remove the
3676         unneeded call to core() now that coreSelection is passed directly to the function.
3677         (optionFromList): Change to pass coreSelection directly to listObjectForCoreSelection().
3678
3679 2019-07-11  Chris Dumez  <cdumez@apple.com>
3680
3681         Fix non-thread safe use of makeWeakPtr() under MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::processInputNotify()
3682         https://bugs.webkit.org/show_bug.cgi?id=199727
3683
3684         Reviewed by Eric Carlson.
3685
3686         Stop calling makeWeakPtr() on a main thread object from a background thread.
3687
3688         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
3689         (WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::processInputNotify):
3690
3691 2019-07-11  Youenn Fablet  <youenn@apple.com>
3692
3693         Register a MediaStreamTrack as media producer only if it is a capture track
3694         https://bugs.webkit.org/show_bug.cgi?id=199566
3695         <rdar://problem/52761361>
3696
3697         Addressing post-landing comment to simplify setMuted call.
3698         Unreviewed.
3699
3700         * Modules/mediastream/MediaStreamTrack.cpp:
3701         (WebCore::MediaStreamTrack::MediaStreamTrack):
3702
3703 2019-07-11  Youenn Fablet  <youenn@apple.com>
3704
3705         Protect CoreAudioSharedUnit::m_clients for accessing in different threads simultaneously
3706         https://bugs.webkit.org/show_bug.cgi?id=199717
3707
3708         Reviewed by Eric Carlson.
3709
3710         Add a lock whenever accessing to m_clients.
3711         Manual tests show that audio capture still works.
3712
3713         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
3714         (WebCore::CoreAudioSharedUnit::addClient):
3715         (WebCore::CoreAudioSharedUnit::removeClient):
3716         (WebCore::CoreAudioSharedUnit::forEachClient const):
3717         (WebCore::CoreAudioSharedUnit::processMicrophoneSamples):
3718         (WebCore::CoreAudioSharedUnit::captureFailed):
3719
3720 2019-07-11  Chris Dumez  <cdumez@apple.com>
3721
3722         Drop non thread-safe usage of WeakPtr in PlaybackSessionInterfaceAVKit
3723         https://bugs.webkit.org/show_bug.cgi?id=199698
3724
3725         Reviewed by Eric Carlson.
3726
3727         The PlaybackSessionInterfaceAVKit constructor was making a weakPtr on the UI Thread
3728         of an WebThread object. The WeakPtr would then be used as a data member throughout
3729         the class on the UIThread. This is not thread-safe.
3730
3731         This patch switches to using a raw pointer instead of a WeakPtr. This is a partial
3732         rollout of r243337, which turned the raw pointer into a WeakPtr for hardening
3733         purposes. For extra safety, this patch updates the VideoFullscreenControllerContext
3734         so that it notifies its clients (i.e. PlaybackSessionInterfaceAVKit) that it is
3735         getting destroyed, so that they can null-out their m_playbackSessionModel data
3736         member. This gives the sames guarantees than WeakPtr but in a thread-safe way.
3737
3738         * platform/cocoa/PlaybackSessionModel.h:
3739         (WebCore::PlaybackSessionModelClient::modelDestroyed):
3740         * platform/ios/PlaybackSessionInterfaceAVKit.h:
3741         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
3742         (WebCore::PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit):
3743         (WebCore::PlaybackSessionInterfaceAVKit::~PlaybackSessionInterfaceAVKit):
3744         (WebCore::PlaybackSessionInterfaceAVKit::playbackSessionModel const):
3745         (WebCore::PlaybackSessionInterfaceAVKit::modelDestroyed):
3746         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3747         (VideoFullscreenControllerContext::~VideoFullscreenControllerContext):
3748         (VideoFullscreenControllerContext::addClient):
3749         (VideoFullscreenControllerContext::removeClient):
3750
3751 2019-07-11  Simon Fraser  <simon.fraser@apple.com>
3752
3753         Fix builds where HAVE_DESIGN_SYSTEM_UI_FONTS is not defined.
3754
3755         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3756         (WebCore::fontWithFamilySpecialCase):
3757
3758 2019-07-11  Justin Fan  <justin_fan@apple.com>
3759
3760         Unreviewed build fix.
3761
3762         * Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp: Missing include.
3763
3764 2019-07-11  Myles C. Maxfield  <mmaxfield@apple.com>
3765
3766         New York font erroneously gets synthetic bold
3767         https://bugs.webkit.org/show_bug.cgi?id=199653
3768         <rdar://problem/51692592>
3769
3770         Reviewed by Simon Fraser.
3771
3772         This patch adds support for -apple-system-ui-serif, -apple-system-ui-monospaced,
3773         and -apple-system-ui-rounded, behind an SPI that is off-by-default. We don't want
3774         to expose these fonts to the web because we don't a standardization story for them
3775         yet, but we do want some apps to be able to use them.
3776
3777         WebKit clients who want to use these fonts can set
3778         -[WKPreferences _shouldAllowDesignSystemUIFonts] = YES.
3779
3780         The patch generalizes our existing system-ui infrastructure to handle these three
3781         additional fonts. It also explicitly disables the unsupported dot-prefixed names
3782         so they don't leak out into Web content.
3783
3784         Tests: fast/text/design-system-ui-10.html
3785                fast/text/design-system-ui-11.html
3786                fast/text/design-system-ui-12.html
3787                fast/text/design-system-ui-13.html
3788                fast/text/design-system-ui-14.html
3789                fast/text/design-system-ui-15.html
3790                fast/text/design-system-ui-16.html
3791                fast/text/design-system-ui-2.html
3792                fast/text/design-system-ui-3.html
3793                fast/text/design-system-ui-4.html
3794                fast/text/design-system-ui-5.html
3795                fast/text/design-system-ui-6.html
3796                fast/text/design-system-ui-7.html
3797                fast/text/design-system-ui-8.html
3798                fast/text/design-system-ui-9.html
3799                fast/text/design-system-ui.html
3800
3801         * css/CSSFontFace.cpp:
3802         (WebCore::CSSFontFace::shouldAllowDesignSystemUIFonts const):
3803         * css/CSSFontFace.h:
3804         * css/CSSFontFaceSource.cpp:
3805         (WebCore::CSSFontFaceSource::load):
3806         * css/StyleResolver.cpp:
3807         (WebCore::StyleResolver::initializeFontStyle):
3808         * page/Settings.yaml:
3809         * platform/graphics/FontDescription.cpp:
3810         (WebCore::m_shouldAllowDesignSystemUIFonts):
3811         (WebCore::m_shouldAllowUserInstalledFonts): Deleted.
3812         * platform/graphics/FontDescription.h:
3813         (WebCore::FontDescription::shouldAllowDesignSystemUIFonts const):
3814         (WebCore::FontDescription::setShouldAllowDesignSystemUIFonts):
3815         (WebCore::FontDescription::operator== const):
3816         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3817         (WebCore::platformFontLookupWithFamily):
3818         (WebCore::fontWithFamily):
3819         * platform/graphics/cocoa/FontCacheCoreText.h:
3820         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
3821         (WebCore::systemFontUse):
3822         (WebCore::systemFontCascadeList):
3823         (WebCore::FontCascadeDescription::effectiveFamilyCount const):
3824         (WebCore::FontCascadeDescription::effectiveFamilyAt const):
3825         (WebCore::isSystemFontString): Deleted.
3826         (WebCore::isUIFontTextStyle): Deleted.
3827         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
3828         (WebCore::FontPlatformData::ctFont const):
3829         * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
3830         (WebCore::SystemFontDatabaseCoreText::createSystemUI):
3831         (WebCore::SystemFontDatabaseCoreText::createDesignSystemUI):
3832         (WebCore::SystemFontDatabaseCoreText::createTextStyle):
3833         (WebCore::SystemFontDatabaseCoreText::cascadeList):
3834         (WebCore::SystemFontDatabaseCoreText::applyWeightItalicsAndFallbackBehavior):
3835         (WebCore::SystemFontDatabaseCoreText::systemFontParameters):
3836         * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
3837         * platform/graphics/ios/FontCacheIOS.mm:
3838         (WebCore::platformFontWithFamilySpecialCase):
3839         * platform/graphics/mac/FontCacheMac.mm:
3840         (WebCore::platformFontWithFamilySpecialCase):
3841         * style/StyleResolveForDocument.cpp:
3842         (WebCore::Style::resolveForDocument):
3843         * svg/graphics/SVGImage.cpp:
3844         (WebCore::SVGImage::dataChanged):
3845         * testing/InternalSettings.cpp:
3846         (WebCore::InternalSettings::Backup::Backup):
3847         (WebCore::InternalSettings::Backup::restoreTo):
3848         (WebCore::InternalSettings::setShouldAllowDesignSystemUIFonts):
3849         * testing/InternalSettings.h:
3850         * testing/InternalSettings.idl:
3851
3852 2019-07-11  Pablo Saavedra  <psaavedra@igalia.com>
3853
3854         [WPE][GTK] Build failure with ENABLE_ACCESSIBILITY=OFF
3855         https://bugs.webkit.org/show_bug.cgi?id=199625
3856
3857         Added ENABLE(ACCESSIBILITY) and replaced HAVE(ACCESSIBILITY)
3858         with ENABLE(ACCESSIBILITY) in the code.
3859
3860         Additionally, the TestRunner code generator now honors the
3861         Conditional IDL format.
3862
3863         No new tests as there is no intended functional change
3864
3865         Reviewed by Konstantin Tokarev.
3866
3867         * accessibility/AXObjectCache.cpp:
3868         * accessibility/AXObjectCache.h:
3869         * accessibility/AccessibilityObject.cpp:
3870         (WebCore::AccessibilityObject::detach):
3871         (WebCore::AccessibilityObject::isDetached const):
3872         * accessibility/AccessibilityObject.h:
3873         * accessibility/atk/AXObjectCacheAtk.cpp:
3874         * accessibility/atk/AccessibilityObjectAtk.cpp:
3875         * accessibility/atk/WebKitAccessible.cpp:
3876         * accessibility/atk/WebKitAccessible.h:
3877         * accessibility/atk/WebKitAccessibleHyperlink.cpp:
3878         * accessibility/atk/WebKitAccessibleHyperlink.h:
3879         * accessibility/atk/WebKitAccessibleInterfaceAction.cpp:
3880         * accessibility/atk/WebKitAccessibleInterfaceAction.h:
3881         * accessibility/atk/WebKitAccessibleInterfaceComponent.cpp:
3882         * accessibility/atk/WebKitAccessibleInterfaceComponent.h:
3883         * accessibility/atk/WebKitAccessibleInterfaceDocument.cpp:
3884         * accessibility/atk/WebKitAccessibleInterfaceDocument.h:
3885         * accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp:
3886         * accessibility/atk/WebKitAccessibleInterfaceEditableText.h:
3887         * accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.cpp:
3888         * accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.h:
3889         * accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp:
3890         * accessibility/atk/WebKitAccessibleInterfaceHypertext.h:
3891         * accessibility/atk/WebKitAccessibleInterfaceImage.cpp:
3892         * accessibility/atk/WebKitAccessibleInterfaceImage.h:
3893         * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:
3894         * accessibility/atk/WebKitAccessibleInterfaceSelection.h:
3895         * accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
3896         * accessibility/atk/WebKitAccessibleInterfaceTable.h:
3897         * accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp:
3898         * accessibility/atk/WebKitAccessibleInterfaceTableCell.h:
3899         * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
3900         * accessibility/atk/WebKitAccessibleInterfaceText.h:
3901         * accessibility/atk/WebKitAccessibleInterfaceValue.cpp:
3902         * accessibility/atk/WebKitAccessibleInterfaceValue.h:
3903         * accessibility/atk/WebKitAccessibleUtil.cpp:
3904         * accessibility/atk/WebKitAccessibleUtil.h:
3905         * accessibility/ios/AXObjectCacheIOS.mm:
3906         * accessibility/ios/AccessibilityObjectIOS.mm:
3907         * accessibility/ios/WebAccessibilityObjectWrapperIOS.h:
3908         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3909         * accessibility/mac/AXObjectCacheMac.mm:
3910         * accessibility/mac/AccessibilityObjectBase.mm:
3911         * accessibility/mac/AccessibilityObjectMac.mm:
3912         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
3913         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3914         * accessibility/win/AccessibilityObjectWin.cpp:
3915         * accessibility/win/AccessibilityObjectWrapperWin.cpp:
3916         * dom/Document.cpp:
3917         (WebCore::Document::prepareForDestruction):
3918         * editing/FrameSelection.h:
3919         * editing/atk/FrameSelectionAtk.cpp:
3920         * html/HTMLTextFormControlElement.cpp:
3921         (WebCore::HTMLTextFormControlElement::setInnerTextValue):
3922         * testing/Internals.cpp:
3923         (WebCore::Internals::resetToConsistentState):
3924
3925 2019-07-11  Justin Fan  <justin_fan@apple.com>
3926
3927         [WebGPU] Implement GPUError and error scopes
3928         https://bugs.webkit.org/show_bug.cgi?id=199655
3929
3930         Reviewed by Myles C. Maxfield.
3931
3932         Add GPUErrorFilter, GPUError, and the ability to push and pop error scopes on a GPUDevice.
3933         This will allow us to check for WebGPU errors from JavaScript.
3934         Currently, only some GPUBuffer creation errors are reported for testing; more errors will follow in later patches.
3935
3936         Test: webgpu/error-scopes-test.html
3937
3938         * Modules/webgpu/GPUErrorFilter.idl: Added.
3939         * Modules/webgpu/GPUOutOfMemoryError.idl: Added.
3940         * Modules/webgpu/GPUValidationError.idl: Added.
3941         * Modules/webgpu/WebGPUDevice.cpp: