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