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