4385280c69d8ab06f09a7bdc3c147a3b85558772
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-08-09  Youenn Fablet  <youenn@apple.com>
2
3         Remove MediaStreamRegistry
4         https://bugs.webkit.org/show_bug.cgi?id=200570
5
6         Reviewed by Eric Carlson.
7
8         MediaStream cannot be registered as an URL by JavaScript.
9         Remove MediaStreamRegistry and the 'src' loading specific handling in HTMLMediaElement.
10         Implement ending of capture track by directly handling MediaStreamTrack which is more accurate.
11         No change of behavior.
12
13         * Modules/mediastream/MediaStream.cpp:
14         (WebCore::MediaStream::MediaStream):
15         (WebCore::MediaStream::~MediaStream):
16         (WebCore::MediaStream::stop):
17         * Modules/mediastream/MediaStream.h:
18         * Modules/mediastream/MediaStreamRegistry.cpp: Removed.
19         * Modules/mediastream/MediaStreamRegistry.h: Removed.
20         * Modules/mediastream/MediaStreamTrack.cpp:
21         (WebCore::MediaStreamTrack::MediaStreamTrack):
22         (WebCore::MediaStreamTrack::~MediaStreamTrack):
23         (WebCore::MediaStreamTrack::endCapture):
24         * Modules/mediastream/MediaStreamTrack.h:
25         * Sources.txt:
26         * WebCore.xcodeproj/project.pbxproj:
27         * dom/Document.cpp:
28         (WebCore::Document::stopMediaCapture):
29         * html/HTMLMediaElement.cpp:
30         (WebCore::HTMLMediaElement::loadResource):
31
32 2019-08-09  Víctor Manuel Jáquez Leal  <vjaquez@igalia.com>
33
34         [GL][GStreamer] activate wrapped shared context
35         https://bugs.webkit.org/show_bug.cgi?id=196966
36
37         Reviewed by Žan Doberšek.
38
39         This patch consists in four parts:
40
41         1\ When the media player is instantiated, and it is intended to
42         render textures, it will create a wrapped object of the
43         application's GL context, and in order to populate the wrapped
44         object with the GL vtable, the context has to be current. Thus,
45         this patch makes current the shared WebKit application context,
46         and populate the wrapped GstGLContext by activating it and filling
47         in it. Afterwards, the wrapped context is deactivated.
48
49         2\ This patch makes GL texture use the RGBA color space, thus the
50         color transformation is done in GStreamer, and no further color
51         transformation is required in WebKit.
52
53         3\ Since it is not necessary to modify behavior if the decoder is
54         imxvpudecoder, its identification and label were removed.
55
56         4\ As only RGBA is used, the old color conversions when rendering
57         using Cairo (fallback) were changed to convert the RGBA, as in
58         GStreamer's format, to ARGB32, as in Cairo format -which depends
59         on endianness.
60
61         No new tests because there is no behavior change.
62
63         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
64         (WebCore::ImageGStreamer::ImageGStreamer): Only convert GStreamer
65         RGBA to Cairo RGB32.
66         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
67         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Removes
68         the IMX VPU identification.
69         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
70         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
71         Intializes the wrapped GL Context.
72         (WebCore::MediaPlayerPrivateGStreamerBase::updateTextureMapperFlags):
73         Removes frame's color conversion.
74         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL):
75         Instead of parsing a string, the GstCaps are created manually, and
76         it is set to appsink, rather than a filtered linking.
77         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
78         Removes ImxVPU enumeration value.
79         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
80         Adds NoConvert option to texture copier, setting an identity
81         matrix.
82         (WebCore::VideoTextureCopierGStreamer::updateColorConversionMatrix):
83         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h: Adds
84         NoConvert enumeration value.
85
86 2019-08-09  Ryosuke Niwa  <rniwa@webkit.org>
87
88         REGRESSION (iOS 13): united.com web forms do not respond to taps
89         https://bugs.webkit.org/show_bug.cgi?id=200531
90
91         Reviewed by Antti Koivisto and Wenson Hsieh.
92
93         The bug is caused by the content change observer detecting “Site Feedback” link at the bottom of
94         the page (https://www.united.com/ual/en/US/account/enroll/default) constantly getting re-generated
95         in every frame via requestAnimationFrame when the page is opened with iPhone UA string.
96         Note that the content re-generation can be reproduced even in Chrome if iPhone UA string is used.
97
98         Ignore this constant content change in ContentChangeObserver as a site specific quirk.
99
100         In the future, we should make ContentChangeObserver observe the final location of each element
101         being observed so that we can ignore content that like this which is placed outside the viewport,
102         and/or far away from where the user tapped.
103
104         * page/Quirks.cpp:
105         (WebCore::Quirks::shouldIgnoreContentChange const): Added.
106         * page/Quirks.h:
107         * page/ios/ContentChangeObserver.cpp:
108         (WebCore::ContentChangeObserver::shouldObserveVisibilityChangeForElement):
109
110 2019-08-08  Devin Rousso  <drousso@apple.com>
111
112         Web Inspector: Page: don't allow the domain to be disabled
113         https://bugs.webkit.org/show_bug.cgi?id=200109
114
115         Reviewed by Brian Burg.
116
117         The `PageAgent` is relied on by many of the other agents, so much so that it doesn't make
118         sense to support the ability to "disable" (as well as "enable") the agent.
119
120         When the first frontend connects, we should treat the `PageAgent` as active and available.
121
122         * inspector/agents/InspectorPageAgent.h:
123         * inspector/agents/InspectorPageAgent.cpp:
124         (WebCore::InspectorPageAgent::didCreateFrontendAndBackend):
125         (WebCore::InspectorPageAgent::willDestroyFrontendAndBackend):
126         (WebCore::InspectorPageAgent::timestamp):
127         (WebCore::InspectorPageAgent::enable): Deleted.
128         (WebCore::InspectorPageAgent::disable): Deleted.
129
130         * inspector/agents/InspectorApplicationCacheAgent.cpp:
131         (WebCore::InspectorApplicationCacheAgent::updateApplicationCacheStatus):
132         (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
133         (WebCore::InspectorApplicationCacheAgent::assertFrameWithDocumentLoader):
134         * inspector/agents/InspectorCSSAgent.cpp:
135         (WebCore::InspectorCSSAgent::createStyleSheet):
136         * inspector/agents/InspectorDOMAgent.cpp:
137         (WebCore::InspectorDOMAgent::highlightSelector):
138         (WebCore::InspectorDOMAgent::highlightFrame):
139         (WebCore::InspectorDOMAgent::buildObjectForNode):
140         * inspector/agents/InspectorTimelineAgent.cpp:
141         (WebCore::InspectorTimelineAgent::setFrameIdentifier):
142         * inspector/agents/page/PageNetworkAgent.cpp:
143         (WebCore::PageNetworkAgent::loaderIdentifier):
144         (WebCore::PageNetworkAgent::frameIdentifier):
145         (WebCore::PageNetworkAgent::scriptExecutionContext):
146         * inspector/agents/page/PageRuntimeAgent.cpp:
147         (WebCore::PageRuntimeAgent::didCreateMainWorldContext):
148         (WebCore::PageRuntimeAgent::reportExecutionContextCreation):
149
150         * testing/Internals.cpp:
151         (WebCore::InspectorStubFrontend::InspectorStubFrontend):
152         (WebCore::InspectorStubFrontend::frontendLoaded): Added.
153         (WebCore::InspectorStubFrontend::closeWindow):
154         (WebCore::InspectorStubFrontend::sendMessageToFrontend):
155         (WebCore::InspectorStubFrontend::frontendPage): Deleted.
156         Ensure that the backend always gets notified via `InspectorFrontendHost.loaded` so that
157         messages being sent to the frontend are batched.
158
159 2019-08-08  Chris Lord  <clord@igalia.com>
160
161         Short-cut WebGLRenderingContext::getParameter() for ALPHA_BITS when alpha channel is disabled
162         https://bugs.webkit.org/show_bug.cgi?id=200499
163
164         Reviewed by Darin Adler.
165
166         This patch adds a shortcut when a framebuffer isn't bound on WebGL
167         canvases when retrieving ALPHA_BITS.
168
169         No new tests, covered by existing tests.
170
171         * html/canvas/WebGLRenderingContext.cpp:
172         (WebCore::WebGLRenderingContext::getParameter):
173         Return 0 for ALPHA_BITS if canvas has no alpha component.
174         * html/canvas/WebGL2RenderingContext.cpp:
175         (WebCore::WebGLRenderingContext::getParameter):
176         Return 0 for ALPHA_BITS if canvas has no alpha component.
177
178 2019-08-08  Chris Dumez  <cdumez@apple.com>
179
180         ScrollingStateNode is not ThreadSafeRefCounted but is ref'd / deref'd from several threads
181         https://bugs.webkit.org/show_bug.cgi?id=200545
182
183         Reviewed by Antti Koivisto.
184
185         The ScrollingStateTree and its ScrollingStateNodes are being passed to the scrolling thread.
186         ScrollingStateNode is not ThreadSafeRefCounted, which is potentially unsafe. Make it
187         ThreadSafeRefCounted for safety in this patch given that using RefCounted here is either
188         wrong or fragile.
189
190         * page/scrolling/ScrollingStateNode.h:
191
192 2019-08-08  Brent Fulgham  <bfulgham@apple.com>
193
194         [FTW] Get WebKit, WebKit2, and MiniBrowser building and executing
195         https://bugs.webkit.org/show_bug.cgi?id=200539
196         <rdar://problem/54082550>
197
198         Reviewed by Dean Jackson.
199
200         * platform/graphics/win/BackingStoreBackendDirect2D.h:
201         (WebCore::BackingStoreBackendDirect2D::renderTarget const):
202         (WebCore::BackingStoreBackendDirect2D::surface const):
203         (): Deleted.
204         * platform/graphics/win/BackingStoreBackendDirect2DImpl.cpp:
205         (WebCore::BackingStoreBackendDirect2DImpl::~BackingStoreBackendDirect2DImpl):
206         (WebCore::BackingStoreBackendDirect2DImpl::scroll):
207         (WebCore::createDirect2DImageSurfaceWithFastMalloc): Deleted.
208         * platform/graphics/win/BackingStoreBackendDirect2DImpl.h:
209         * platform/graphics/win/DIBPixelData.cpp:
210         (WebCore::DIBPixelData::DIBPixelData):
211         * platform/graphics/win/DIBPixelData.h:
212         * platform/graphics/win/Direct2DOperations.cpp:
213         (WebCore::Direct2D::fillRectWithRoundedHole):
214         (WebCore::Direct2D::fillRectWithGradient):
215         (WebCore::Direct2D::drawGlyphs):
216         (WebCore::Direct2D::PlatformContextStateSaver::PlatformContextStateSaver): Deleted.
217         (WebCore::Direct2D::PlatformContextStateSaver::~PlatformContextStateSaver): Deleted.
218         (WebCore::Direct2D::PlatformContextStateSaver::save): Deleted.
219         (WebCore::Direct2D::PlatformContextStateSaver::restore): Deleted.
220         (WebCore::Direct2D::PlatformContextStateSaver::didSave const): Deleted.
221         * platform/graphics/win/Direct2DOperations.h:
222         * platform/graphics/win/Direct2DUtilities.cpp:
223         (WebCore::Direct2D::bitmapSize):
224         (WebCore::Direct2D::bitmapResolution):
225         (WebCore::Direct2D::createWicBitmap):
226         (WebCore::Direct2D::createBitmap):
227         (WebCore::Direct2D::createGDIRenderTarget):
228         (WebCore::Direct2D::copyRectFromOneSurfaceToAnother):
229         * platform/graphics/win/Direct2DUtilities.h:
230         * platform/graphics/win/GraphicsContextDirect2D.cpp:
231         (WebCore::GraphicsContext::GraphicsContext):
232         (WebCore::GraphicsContext::platformContext const):
233         (WebCore::GraphicsContextPlatformPrivate::setAlpha):
234         (WebCore::GraphicsContext::savePlatformState):
235         (WebCore::GraphicsContext::restorePlatformState):
236         (WebCore::GraphicsContext::releaseWindowsContext):
237         (WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate):
238         (WebCore::GraphicsContextPlatformPrivate::beginDraw):
239         (WebCore::GraphicsContextPlatformPrivate::endDraw):
240         (WebCore::GraphicsContext::beginDraw):
241         (WebCore::GraphicsContext::endDraw):
242         (WebCore::GraphicsContext::setCTM):
243         (WebCore::GraphicsContext::isAcceleratedContext const):
244         * platform/graphics/win/GraphicsContextImplDirect2D.cpp:
245         (WebCore::GraphicsContextImplDirect2D::fillRect):
246         (WebCore::GraphicsContextImplDirect2D::fillRectWithRoundedHole):
247         (WebCore::GraphicsContextImplDirect2D::drawGlyphs):
248         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
249         (WebCore::GraphicsContextPlatformPrivate::platformContext):
250         * platform/graphics/win/PathDirect2D.cpp:
251         (WebCore::Path::transform):
252         * platform/graphics/win/PlatformContextDirect2D.cpp:
253         (WebCore::PlatformContextDirect2D::beginDraw):
254         (WebCore::PlatformContextDirect2D::endDraw):
255         * platform/graphics/win/PlatformContextDirect2D.h:
256         (WebCore::PlatformContextStateSaver::PlatformContextStateSaver):
257         (WebCore::PlatformContextStateSaver::~PlatformContextStateSaver):
258         (WebCore::PlatformContextStateSaver::save):
259         (WebCore::PlatformContextStateSaver::restore):
260         (WebCore::PlatformContextStateSaver::didSave const):
261
262 2019-08-08  Chris Dumez  <cdumez@apple.com>
263
264         Unreviewed, address post-landing review comments for r248431.
265
266         * Modules/indexeddb/IDBRequest.h:
267
268 2019-08-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
269
270         [iOS] Position image information should respect the image orientation
271         https://bugs.webkit.org/show_bug.cgi?id=200487
272
273         Reviewed by Simon Fraser.
274
275         Re-factor CachedImage::imageSizeForRenderer() into another overriding
276         function which does not scale the imageSize. Therefore the new function
277         returns FloatSize while the original function returns LayoutSize.
278
279         * loader/cache/CachedImage.cpp:
280         (WebCore::CachedImage::imageSizeForRenderer const):
281         * loader/cache/CachedImage.h:
282         * rendering/RenderElement.h:
283
284 2019-08-08  Devin Rousso  <drousso@apple.com>
285
286         Web Inspector: rename `queryObjects` to `queryInstances` for clarity
287         https://bugs.webkit.org/show_bug.cgi?id=200520
288
289         Reviewed by Brian Burg.
290
291         Test: inspector/console/queryInstances.html
292
293         * inspector/CommandLineAPIModuleSource.js:
294         (CommandLineAPIImpl.prototype.queryInstances): Added.
295         (CommandLineAPIImpl.prototype.queryObjects):
296
297 2019-08-08  Chris Dumez  <cdumez@apple.com>
298
299         Fix thread safety bug in AudioSourceProviderAVFObjC::prepare()
300         https://bugs.webkit.org/show_bug.cgi?id=200542
301
302         Reviewed by Jer Noble.
303
304         Fix thread safety bug in AudioSourceProviderAVFObjC::prepare(). It calls callOnMainThread()
305         from a background thread and captures makeRef(*this) in the lambda, even though |this| is a
306         AudioSourceProviderAVFObjC, which subclasses RefCounted, not ThreadSafeRefCounted.
307
308         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
309
310 2019-08-08  Chris Dumez  <cdumez@apple.com>
311
312         Make IDBRequest ThreadSafeRefCounted
313         https://bugs.webkit.org/show_bug.cgi?id=200540
314
315         Reviewed by Alex Christensen.
316
317         Make IDBRequest ThreadSafeRefCounted, as it looks like it is being ref'd / deref'd
318         from several threads, in IDBConnectionProxy::notifyOpenDBRequestBlocked() for
319         example.
320
321         * Modules/indexeddb/IDBRequest.h:
322
323 2019-08-08  Brady Eidson  <beidson@apple.com>
324
325         Do not allow navigations of frames about to get replaced by the result of evaluating javascript: URLs
326         <rdar://problem/53788893> and https://bugs.webkit.org/show_bug.cgi?id=198786
327
328         Reviewed by Geoff Garen.
329
330         Covered by API Test
331
332         Add a "willReplaceWithResultOfExecutingJavascriptURL" flag which is respected inside FrameLoader::isNavigationAllowed
333
334         * bindings/js/ScriptController.cpp:
335         (WebCore::ScriptController::executeIfJavaScriptURL):
336         * bindings/js/ScriptController.h:
337         (WebCore::ScriptController::willReplaceWithResultOfExecutingJavascriptURL const):
338
339         * loader/FrameLoader.cpp:
340         (WebCore::FrameLoader::isNavigationAllowed const):
341
342 2019-08-08  Rob Buis  <rbuis@igalia.com>
343
344         Add runtime flag for lazy image loading
345         https://bugs.webkit.org/show_bug.cgi?id=199794
346
347         Reviewed by Darin Adler.
348
349         Add loading attribute and expose it on HTMLImageElement.
350
351         * html/HTMLAttributeNames.in:
352         * html/HTMLImageElement.idl:
353         * page/RuntimeEnabledFeatures.h:
354         (WebCore::RuntimeEnabledFeatures::setLazyImageLoadingEnabled):
355         (WebCore::RuntimeEnabledFeatures::lazyImageLoadingEnabled const):
356
357 2019-08-08  Miguel Gomez  <magomez@igalia.com>
358
359         [GTK][WPE] Remove the reference to WebCore::Animation from TextureMapperAnimation
360         https://bugs.webkit.org/show_bug.cgi?id=200533
361
362         Reviewed by Žan Doberšek.
363
364         Pass the relevant parameters to TextureMapperAnimation instead of creating a new WebCore::Animation
365         inside it.
366
367         * platform/graphics/texmap/TextureMapperAnimation.cpp:
368         (WebCore::timingFunctionForAnimationValue):
369         (WebCore::TextureMapperAnimation::TextureMapperAnimation):
370         (WebCore::TextureMapperAnimation::apply):
371         (WebCore::TextureMapperAnimation::isActive const):
372         * platform/graphics/texmap/TextureMapperAnimation.h:
373         (WebCore::TextureMapperAnimation::keyframes const):
374         (WebCore::TextureMapperAnimation::timingFunction const):
375         (WebCore::TextureMapperAnimation::animation const): Deleted.
376
377 2019-08-08  Charlie Turner  <cturner@igalia.com>
378
379         [GTK] WebKitWebProcess crashes when viewing an HTML with a <video> element referencing unknown file
380         https://bugs.webkit.org/show_bug.cgi?id=200530
381
382         Reviewed by Xabier Rodriguez-Calvar.
383
384         Not amenable to unit testing.
385
386         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
387         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired):
388
389 2019-08-07  Saam Barati  <sbarati@apple.com>
390
391         [WHLSL] Prune unreachable stdlib functions after the Checker runs
392         https://bugs.webkit.org/show_bug.cgi?id=200518
393
394         Reviewed by Robin Morisset.
395
396         We now prune unreachable stdlib functions after the checker runs. We must
397         do this after the checker runs because that's when we resolve all remaining
398         function calls. While we can't prune unreachable user code, because we must
399         still report errors in it, we can prune unreachable standard library code
400         because we know a priori that it has no errors. This is a 10ms end-to-end
401         speedup in compute_boids.
402
403         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
404         (WebCore::WHLSL::prepareShared):
405         * Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.cpp: Added.
406         (WebCore::WHLSL::pruneUnreachableStandardLibraryFunctions):
407         * Modules/webgpu/WHLSL/WHLSLPruneUnreachableStandardLibraryFunctions.h: Added.
408         * Sources.txt:
409         * WebCore.xcodeproj/project.pbxproj:
410
411 2019-08-07  Kate Cheney  <katherine_cheney@apple.com>
412
413         Adopt non-deprecated CGColorSpace API
414         https://bugs.webkit.org/show_bug.cgi?id=184358
415
416         Reviewed by Darin Adler.
417
418         * platform/ScreenProperties.h:
419         (WebCore::ScreenData::decode):
420
421         We changed the deprecated CGColorSpaceCreateWithICCProfile function to 
422         CGColorSpaceCreateWithICCData. 
423  
424 2019-08-07  Sam Weinig  <weinig@apple.com>
425
426         [WHLSL] Metal code generation takes a long time uniquing UnnamedTypes
427         https://bugs.webkit.org/show_bug.cgi?id=200512
428
429         Reviewed by Saam Barati.
430
431         Instead of using a trie for unnamed type uniquing, use the same technique used
432         in SynthesizeConstructors and use a HashMap of UnnamedTypeKeys. To make this
433         profitable, we also need to devirtualize the hash and equality functions on
434         UnnamedType, instead using an enum + switch. While this change only devirtualizes
435         the UnnamedType subtree, we should probably do it for the entire AST in a future
436         change.
437
438         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
439         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
440         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
441         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
442         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
443         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.cpp: Added.
444         (WebCore::WHLSL::AST::UnnamedType::hash const):
445         (WebCore::WHLSL::AST::UnnamedType::operator== const):
446          * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
447         Devirtualize hash, operator== and type predicates.
448
449         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedTypeHash.h: Added.
450         (WebCore::WHLSL::UnnamedTypeKey::UnnamedTypeKey):
451         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
452         (WebCore::WHLSL::UnnamedTypeKey::UnnamedTypeKey): Deleted.
453         Moved UnnamedTypeKey into it's own header from WHLSLSynthesizeConstructors.cpp
454         
455         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
456         (WebCore::WHLSL::Metal::BaseTypeNameNode::BaseTypeNameNode):
457         (WebCore::WHLSL::Metal::BaseTypeNameNode::kind):
458         (WebCore::WHLSL::Metal::BaseTypeNameNode::isReferenceTypeNameNode const):
459         (WebCore::WHLSL::Metal::BaseTypeNameNode::isPointerTypeNameNode const):
460         (WebCore::WHLSL::Metal::BaseTypeNameNode::isArrayReferenceTypeNameNode const):
461         (WebCore::WHLSL::Metal::BaseTypeNameNode::isArrayTypeNameNode const):
462         Devirtualize BaseTypeNameNode as well. In a future change, we should consider removing
463         this class entirely and instead mapping directly to a parent/mangled name pair.
464  
465         (WebCore::WHLSL::Metal::TypeNamer::visit):
466         (WebCore::WHLSL::Metal::TypeNamer::find):
467         (WebCore::WHLSL::Metal::TypeNamer::createNameNode):
468         (WebCore::WHLSL::Metal::parent):
469         (WebCore::WHLSL::Metal::TypeNamer::insert):
470         (WebCore::WHLSL::Metal::TypeNamer::emitUnnamedTypeDefinition):
471         (WebCore::WHLSL::Metal::TypeNamer::emitMetalTypeDefinitions):
472         (WebCore::WHLSL::Metal::TypeNamer::mangledNameForType):
473         (WebCore::WHLSL::Metal::findInVector): Deleted.
474         (WebCore::WHLSL::Metal::find): Deleted.
475         (WebCore::WHLSL::Metal::TypeNamer::emitAllUnnamedTypeDefinitions): Deleted.
476         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.h:
477         Switch from a Vector based trie to a HashMap for UnnamedType uniquing. Also
478         use UnnamedType::Kind where possible with switch statements to clarify code.
479
480         * WebCore.xcodeproj/project.pbxproj:
481         Add new files.
482
483 2019-08-07  Devin Rousso  <drousso@apple.com>
484
485         Web Inspector: Uncaught Exception: TimelineAgent already enabled
486         https://bugs.webkit.org/show_bug.cgi?id=200513
487
488         Reviewed by Joseph Pecoraro.
489
490         Call `disable` when the last frontend disconnects, so that if Web Inspector is reopened the
491         `TimelineAgent` is back to being in a disabled state.
492
493         * inspector/agents/InspectorTimelineAgent.cpp:
494         (WebCore::InspectorTimelineAgent::willDestroyFrontendAndBackend):
495
496 2019-08-07  Jer Noble  <jer.noble@apple.com>
497
498         Muted <video> elements can block display from sleeping.
499         https://bugs.webkit.org/show_bug.cgi?id=200511
500
501         Reviewed by Eric Carlson.
502
503         Test: media/video-muted-holds-sleep-assertion.html
504
505         Modify the shouldDisableSleep() method to take muting into account.
506
507         * html/HTMLMediaElement.cpp:
508         (WebCore::HTMLMediaElement::shouldDisableSleep const):
509
510 2019-08-07  Robin Morisset  <rmorisset@apple.com>
511
512         [WHLSL] Simplify and eliminate redundant work in WHLSLFunctionWriter.cpp
513         https://bugs.webkit.org/show_bug.cgi?id=200460
514
515         Reviewed by Myles Maxfield.
516
517         2 trivial simplifications:
518         - Replace FunctionDeclarationWriter by a standalone function, there was no reason to make it a subclass of Visitor
519         - Avoid an exponential blow-up in the computation of reachable functions.
520
521         I have way too much noise on my system (swings back and forth between 7 and 12ms for this phase) to measure a performance win,
522         but since this patch simplifies things without adding complexity I think it is worth it.
523
524         No new test as there is no functional change intended.
525
526         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
527         (WebCore::WHLSL::Metal::declareFunction):
528         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
529         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::RenderFunctionDefinitionWriter):
530         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::ComputeFunctionDefinitionWriter):
531         (WebCore::WHLSL::Metal::sharedMetalFunctions):
532         (WebCore::WHLSL::Metal::metalFunctions):
533
534 2019-08-07  Saam Barati  <sbarati@apple.com>
535
536         [WHLSL] checkRecursion, checkTextureReferences, and EscapedVariableCollector should skip stdlib functions
537         https://bugs.webkit.org/show_bug.cgi?id=200510
538
539         Reviewed by Myles C. Maxfield.
540
541         We can skip walking the stdlib part of the AST in various semantic checking phases:
542         - checkRecursion: the stdlib does not have recursion
543         - checkTextureReferences: the stdlib does not have references to textures
544         - EscapedVariableCollector: this is used inside preserveVariableLifetimes, and
545           the stdlib never escapes any variables.
546         
547         This patch speeds up checkRecursion, checkTextureReferences, and preserveVariableLifetimes
548         by about 1ms each, leading to a 3ms compile time speedup in compute_boids.
549
550         * Modules/webgpu/WHLSL/WHLSLCheckTextureReferences.cpp:
551         (WebCore::WHLSL::TextureReferencesChecker::visit):
552         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
553         (WebCore::WHLSL::preserveVariableLifetimes):
554         (WebCore::WHLSL::EscapedVariableCollector::escapeVariableUse): Deleted.
555         (WebCore::WHLSL::EscapedVariableCollector::takeEscapedVariables): Deleted.
556         * Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp:
557
558 2019-08-08  Simon Fraser  <simon.fraser@apple.com>
559
560         Add to InteractionInformationAtPosition information about whether the element is in a subscrollable region
561         https://bugs.webkit.org/show_bug.cgi?id=200374
562         rdar://problem/54095519
563
564         Reviewed by Tim Horton.
565
566         Add to InteractionInformationAtPosition a ScrollingNodeID which represents the enclosing scrolling
567         node that affects the targeted element's position. We use this to find a UIScrollView in the UI process.
568         
569         The entrypoint to finding the enclosing scrolling node is ScrollingCoordinator::scrollableContainerNodeID(),
570         which calls RenderLayerCompositor::asyncScrollableContainerNodeID() to look for a scrolling ancestor in
571         the current frame, and then looks for an enclosing scrollable frame, or a scrolling ancestor in
572         the enclosing frame.
573         
574         There's a bit of subtlety in RenderLayerCompositor::asyncScrollableContainerNodeID() because if you're asking
575         for the node that scrolls the renderer, if the renderer itself has a layer and is scrollable, you want
576         its enclosing scroller.
577
578         * page/scrolling/AsyncScrollingCoordinator.cpp:
579         (WebCore::AsyncScrollingCoordinator::scrollableContainerNodeID const):
580         * page/scrolling/AsyncScrollingCoordinator.h:
581         * page/scrolling/ScrollingCoordinator.cpp:
582         (WebCore::scrollableContainerNodeID const):
583         * page/scrolling/ScrollingCoordinator.h:
584         * rendering/RenderLayer.h:
585         * rendering/RenderLayerCompositor.cpp:
586         (WebCore::RenderLayerCompositor::asyncScrollableContainerNodeID):
587         * rendering/RenderLayerCompositor.h:
588
589 2019-08-07  Saam Barati  <sbarati@apple.com>
590
591         [WHLSL] cache results of argumentTypeForAndOverload inside Checker
592         https://bugs.webkit.org/show_bug.cgi?id=200462
593
594         Reviewed by Robin Morisset.
595
596         When I profiled the time we spent in the checker, it turned out that 
597         argumentTypeForAndOverload is one of the most expensive functions. If
598         we just cache the results of that function, we can avoid 99% of the
599         duplicate allocations that function does in compute_boids. This patch
600         is a ~4ms speedup in the checker on compute_boids.
601
602         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp:
603         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
604         (WebCore::WHLSL::AndOverloadTypeKey::AndOverloadTypeKey):
605         (WebCore::WHLSL::AndOverloadTypeKey::isEmptyValue const):
606         (WebCore::WHLSL::AndOverloadTypeKey::isHashTableDeletedValue const):
607         (WebCore::WHLSL::AndOverloadTypeKey::hash const):
608         (WebCore::WHLSL::AndOverloadTypeKey::operator== const):
609         (WebCore::WHLSL::AndOverloadTypeKey::Hash::hash):
610         (WebCore::WHLSL::AndOverloadTypeKey::Hash::equal):
611         (WebCore::WHLSL::AndOverloadTypeKey::Traits::isEmptyValue):
612         (WebCore::WHLSL::Checker::argumentTypeForAndOverload):
613         (WebCore::WHLSL::Checker::finishVisiting):
614         (WebCore::WHLSL::argumentTypeForAndOverload): Deleted.
615
616 2019-08-07  Youenn Fablet  <youenn@apple.com>
617
618         Remove IDBDatabaseIdentifier::m_sessionID
619         https://bugs.webkit.org/show_bug.cgi?id=200489
620
621         Reviewed by Darin Adler.
622
623         IDBDatabaseIdentifier can be created without a valid session ID.
624         Its session ID is only used in NetworkProcess where it can be retrieved from the IDBServer.
625         In WebProcess, session ID is also known from the IDB connection.
626         Update SQLiteIDBBackingStore to store a session ID which is given from its IDBServer.
627         No observable change of behavior.
628
629         * Modules/indexeddb/IDBDatabaseIdentifier.cpp:
630         (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier):
631         (WebCore::IDBDatabaseIdentifier::isolatedCopy const):
632         * Modules/indexeddb/IDBDatabaseIdentifier.h:
633         (WebCore::IDBDatabaseIdentifier::hash const):
634         (WebCore::IDBDatabaseIdentifier::databaseName const):
635         (WebCore::IDBDatabaseIdentifier::encode const):
636         (WebCore::IDBDatabaseIdentifier::decode):
637         (WebCore::IDBDatabaseIdentifier::sessionID const): Deleted.
638         * Modules/indexeddb/IDBFactory.cpp:
639         (WebCore::IDBFactory::openInternal):
640         (WebCore::IDBFactory::deleteDatabase):
641         * Modules/indexeddb/server/IDBServer.cpp:
642         (WebCore::IDBServer::IDBServer::createBackingStore):
643         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
644         (WebCore::IDBServer::SQLiteIDBBackingStore::SQLiteIDBBackingStore):
645         (WebCore::IDBServer::SQLiteIDBBackingStore::getBlobRecordsForObjectStoreRecord):
646         (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord):
647         (WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords):
648         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey):
649         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
650         (WebCore::IDBServer::SQLiteIDBBackingStore::sessionID const):
651         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
652         (WebCore::IDBServer::SQLiteIDBCursor::internalFetchNextRecord):
653
654 2019-08-07  Chris Dumez  <cdumez@apple.com>
655
656         Fix thread safety issue under JSHistory::visitAdditionalChildren()
657         https://bugs.webkit.org/show_bug.cgi?id=200504
658
659         Reviewed by Darin Adler.
660
661         JSHistory::visitAdditionalChildren() is called from a GC thread and was calling
662         History::cachedState() whose implementation goes deep into WebCore
663         (FrameLoader / HistoryController). Among other things, it null checks m_window
664         which is a WeakPtr and then later dereferences it to get the Frame object, which
665         is not safe from the non-main thread.
666
667         To address the issue, introduce a simpler cachedStateForGC() getter which is
668         thread safe, and use it in JSHistory::visitAdditionalChildren().
669
670         * bindings/js/JSHistoryCustom.cpp:
671         (WebCore::JSHistory::visitAdditionalChildren):
672         * page/History.h:
673
674 2019-08-07  Priyanka Agarwal  <pagarwal999@apple.com>
675
676         Allow clients to toggle a text input field between being viewable and having characters hidden while maintaining 
677         a yellow auto-filled appearance
678         https://bugs.webkit.org/show_bug.cgi?id=200037
679         rdar://problem/51900961
680
681         Reviewed by Daniel Bates.
682
683         Tests: fast/forms/auto-fill-button/hide-auto-fill-strong-password-viewable-treatment-when-form-is-reset.html
684                fast/forms/auto-fill-button/input-strong-password-viewable.html
685
686         * css/CSSSelector.cpp:
687         (WebCore::CSSSelector::selectorText const):
688         Adding CSSSelector case for new pseudo class of AutofillStrongPasswordViewable.
689
690         * css/CSSSelector.h: Added PseudoClassAutofillStrongPasswordViewable
691
692         * css/SelectorChecker.cpp:
693         (WebCore::SelectorChecker::checkOne const): Added handling for SelectorChecker.cpp
694
695         * css/SelectorCheckerTestFunctions.h:
696         (WebCore::isAutofilledStrongPasswordViewable):
697         Checking if the element is an input element and considered to be
698         AutoFilled and Viewable. Returns a boolean accordingly.
699
700         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
701         Add -webkit-autofill-strong-password-viewable css class.
702
703         * css/html.css:
704         (input:-webkit-autofill, input:-webkit-autofill-strong-password, input:-webkit-autofill-strong-password-viewable):
705         (input:-webkit-autofill-strong-password-viewable):
706         (input:-webkit-autofill, input:-webkit-autofill-strong-password): Deleted. Updated to include viewable pseudo class.
707
708         * cssjit/SelectorCompiler.cpp:
709         (WebCore::SelectorCompiler::addPseudoClassType):
710         Add case handling for PseudoClassAutofillStrongPasswordViewable.
711
712         * html/HTMLInputElement.cpp:
713         (WebCore::HTMLInputElement::HTMLInputElement):
714         Add boolean m_isAutoFilledAndViewable for representing if the
715         input element is both AutoFilled and should be viewable.
716         Don't update the viewable treatment in setValueFromRenderer() because even if the user makes edits to the input field
717         the visual treatment should still be applied.
718
719         (WebCore::HTMLInputElement::resignStrongPasswordAppearance):
720         Updates boolean representing if input element is autofilled and viewable to false.
721
722         (WebCore::HTMLInputElement::reset):
723         Updates boolean representing if input element is autofilled and viewable to false.
724
725         (WebCore::HTMLInputElement::setAutoFilledAndViewable):
726         Setter function for the boolean of m_isAutoFilledAndViewable.
727
728         * html/HTMLInputElement.h:
729         (WebCore::HTMLInputElement::isAutoFilledAndViewable const):
730         Creating boolean value for m_isAutoFilledAndViewable.
731
732         * testing/Internals.cpp:
733         (WebCore::Internals::setAutoFilledAndViewable): Adding for testing purposes.
734         * testing/Internals.h: Adding for testing purposes.
735         * testing/Internals.idl:
736
737 2019-08-07  Wenson Hsieh  <wenson_hsieh@apple.com>
738
739         Declarations and implementations of findCaret(Min|Max)imumOffset have inconsistent signatures
740         https://bugs.webkit.org/show_bug.cgi?id=200503
741
742         Reviewed by Darin Adler.
743
744         No change in behavior.
745
746         * rendering/SimpleLineLayoutFunctions.h:
747
748         Update these function declarations to take "const RenderText&", which matches the signatures of their inline
749         implementations below.
750
751 2019-08-07  Wenson Hsieh  <wenson_hsieh@apple.com>
752
753         Extra space inserted at start of line when inserting a newline in Mail compose
754         https://bugs.webkit.org/show_bug.cgi?id=200490
755         <rdar://problem/53501354>
756
757         Reviewed by Antti Koivisto.
758
759         This started happening after r244494, which deferred editor state computation until the next layer tree flush
760         when changing selection. After inserting a paragraph, the act of computing an editor state ensured that the text
761         node containing the caret drops out of simple line layout, while grabbing the characters near the selection
762         (i.e., calling charactersAroundPosition). This meant that when we subsequently ask positionAfterSplit whether it
763         isRenderedCharacter() at the end of the command, we are guaranteed to have line boxes, so we get a meaningful
764         answer and avoid inserting an extra non-breaking space.
765
766         However, after r244494, we defer the editor state computation until the end of the edit command; this means that
767         we may not have line boxes for positionAfterSplit's text node renderer, due to remaining in simple line layout.
768         In turn, this means that we end up hitting the assertion in containsRenderedCharacterOffset in debug builds; on
769         release builds, we simply return false from containsRenderedCharacterOffset, which causes us to insert an extra
770         space.
771
772         To fix this, we educate RenderText::containsRenderedCharacterOffset about simple line layout.
773
774         Test: editing/inserting/insert-paragraph-in-designmode-document.html
775
776         * rendering/RenderText.cpp:
777         (WebCore::RenderText::containsRenderedCharacterOffset const):
778         (WebCore::RenderText::containsCaretOffset const):
779
780         Changed to use SimpleLineLayout::containsOffset.
781
782         * rendering/SimpleLineLayoutFunctions.h:
783         (WebCore::SimpleLineLayout::containsOffset):
784
785         I first contrasted the behavior of RenderTextLineBoxes::containsOffset in the cases where the OffsetType is
786         CaretOffset or CharacterOffset, and found that the only interesting differences were:
787
788         1. The caret offset type case has special handling for line breaks.
789         2. Both offset types have handling for reversed text.
790         3. The end offset of a line box contains a caret offset, but not a character offset.
791
792         For the purposes of OffsetType CharacterOffset, (1) is irrelevant; furthermore, (2) is already not handled by
793         logic in containsCaretOffset(). Thus, the only major difference in the CharacterOffset case should be (3), which
794         we handle by only allowing the case where the given offset is equal to the very end of a text run for caret
795         offsets, and not character offsets.
796
797         (WebCore::SimpleLineLayout::containsCaretOffset): Deleted.
798
799         Renamed to just containsOffset.
800
801 2019-08-07  Youenn Fablet  <youenn@apple.com>
802
803         ASSERT that a sessionID is valid when encoding it
804         https://bugs.webkit.org/show_bug.cgi?id=199302
805
806         Reviewed by Darin Adler.
807
808         For IDBValue, instead of encoding an invalid session ID, encode a boolean that tells there is no sessionID.
809         For IDBRequestData, keep track of whether there is an IDBDatabaseIdentifier
810         and encode/decode accordingly to not encode an invalid sessionID.
811         No observable change of behavior.
812
813         * Modules/indexeddb/IDBValue.h:
814         (WebCore::IDBValue::sessionID const):
815         (WebCore::IDBValue::encode const):
816         (WebCore::IDBValue::decode):
817         * Modules/indexeddb/shared/IDBRequestData.cpp:
818         (WebCore::IDBRequestData::isolatedCopy):
819         * Modules/indexeddb/shared/IDBRequestData.h:
820         (WebCore::IDBRequestData::databaseIdentifier const):
821         (WebCore::IDBRequestData::decode):
822
823 2019-08-07  Zalan Bujtas  <zalan@apple.com>
824
825         [LFC] Rename FormattingContext::layoutOutOfFlowDescendants to layoutOutOfFlowContent
826         https://bugs.webkit.org/show_bug.cgi?id=200502
827         <rdar://problem/54032534>
828
829         Reviewed by Antti Koivisto.
830
831         The layoutOutOfFlowDescendants name is not entirely accurate. In a formatting context we only
832         lay out the out-of-flow boxes that actually belong to the current formatting context.
833
834         <div style="float: left">
835           <div id=outer style="position: absolute">
836             <div id=inner style="position: absolute"></div>
837           </div>
838         </div>
839
840         The float's formatting context only lays out the outer absolutely positioned box. The inner box
841         (which is also an out-of-flow descendant of the float box) is taken care of by the outer box.
842
843         * layout/FormattingContext.cpp:
844         (WebCore::Layout::FormattingContext::layoutOutOfFlowContent const):
845         (WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const):
846         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): Deleted.
847         * layout/FormattingContext.h:
848         * layout/LayoutState.cpp:
849         (WebCore::Layout::LayoutState::layoutFormattingContextSubtree):
850         * layout/blockformatting/BlockFormattingContext.cpp:
851         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
852         * layout/inlineformatting/InlineFormattingContext.cpp:
853         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
854
855 2019-08-07  Zalan Bujtas  <zalan@apple.com>
856
857         [LFC] Introduce Layout::Phase class
858         https://bugs.webkit.org/show_bug.cgi?id=200473
859         <rdar://problem/53996061>
860
861         Reviewed by Antti Koivisto.
862
863         It helps to check whether we could run certain actions like layout while constructing the tree.
864
865         * Sources.txt:
866         * WebCore.xcodeproj/project.pbxproj:
867         * layout/LayoutState.h:
868         * layout/floats/FloatingContext.cpp:
869         * layout/inlineformatting/InlineLine.cpp:
870         * layout/layouttree/LayoutBox.cpp:
871         (WebCore::Layout::Box::establishesFormattingContext const):
872         (WebCore::Layout::Box::containingBlock const):
873         (WebCore::Layout::Box::formattingContextRoot const):
874         * layout/layouttree/LayoutTreeBuilder.cpp:
875         (WebCore::Layout::TreeBuilder::createLayoutTree):
876
877 2019-08-07  Chris Lord  <clord@igalia.com>
878
879         context-attributes-alpha-depth-stencil-antialias fails on WPE WebKit
880         https://bugs.webkit.org/show_bug.cgi?id=200434
881
882         Reviewed by Žan Doberšek.
883
884         This patch fixes 16-bit surfaces being used for FBOs with no
885         alpha component when using the GLES implementation of GraphicsContext3D.
886
887         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
888         (WebCore::GraphicsContext3D::reshapeFBOs):
889         Use GL_UNSIGNED_BYTE instead of GL_UNSIGNED_SHORT_5_6_5 for surfaces with no alpha.
890
891 2019-08-06  Saam Barati  <sbarati@apple.com>
892
893         [WHLSL] Make resolveFunction in Checker faster
894         https://bugs.webkit.org/show_bug.cgi?id=200287
895
896         Reviewed by Robin Morisset.
897
898         This patch makes compute_boids faster by making function overload
899         resolution faster inside the Checker. It's a ~6ms speedup in the
900         checker. The main idea is to limit the number of overloads we need
901         to look for by using a hash table that describes a function's type
902         instead of just using a hash table keyed by a function's name.
903         
904         The interesting implementation detail here is we must construct entries
905         in the hash table such that they still allow constants to be resolved to
906         various types. This means that the key in the hash table must normalize
907         the vector of types it uses to express a function's identity. The normalization
908         rules are:
909         - int => float
910         - uint => float
911         - T* => float*
912         - T[] => float*
913         
914         The first two rules are because int constants can be matched against
915         the float and uint types. The latter two rules are because the null
916         literal can be matched against any pointer or any array reference
917         (we pick float* arbitrarily). Even though it seems like these
918         normalization rules would drastically broaden the efficacy of the hash
919         table, we still see a 100x reduction in the number of overloads we must
920         resolve inside compute_boids. We go from having to resolve 400,000
921         overloads to just resolving 4,000.
922
923         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
924         (WebCore::WHLSL::FunctionKey::FunctionKey):
925         (WebCore::WHLSL::FunctionKey::isEmptyValue const):
926         (WebCore::WHLSL::FunctionKey::isHashTableDeletedValue const):
927         (WebCore::WHLSL::FunctionKey::hash const):
928         (WebCore::WHLSL::FunctionKey::operator== const):
929         (WebCore::WHLSL::FunctionKey::Hash::hash):
930         (WebCore::WHLSL::FunctionKey::Hash::equal):
931         (WebCore::WHLSL::FunctionKey::Traits::isEmptyValue):
932         (WebCore::WHLSL::Checker::Checker):
933         (WebCore::WHLSL::Checker::wrappedFloatType):
934         (WebCore::WHLSL::Checker::genericPointerType):
935         (WebCore::WHLSL::Checker::normalizedTypeForFunctionKey):
936         (WebCore::WHLSL::Checker::resolveFunction):
937         (WebCore::WHLSL::Checker::finishVisiting):
938         (WebCore::WHLSL::Checker::visit):
939         (WebCore::WHLSL::resolveFunction): Deleted.
940
941 2019-08-06  Loïc Yhuel  <loic.yhuel@softathome.com>
942
943         Fix 32-bit Linux build after r248282
944         https://bugs.webkit.org/show_bug.cgi?id=200491
945
946         Reviewed by Youenn Fablet.
947
948         minInterToneGapMs must be a size_t like interToneGap for std::max call.
949         The other constants are updated for consistency, even if the compiler
950         was able to cast them automatically.
951
952         * Modules/mediastream/RTCDTMFSender.cpp:
953
954 2019-08-06  Commit Queue  <commit-queue@webkit.org>
955
956         Unreviewed, rolling out r248289.
957         https://bugs.webkit.org/show_bug.cgi?id=200488
958
959         Broke internal builds (Requested by drousso on #webkit).
960
961         Reverted changeset:
962
963         "Web Inspector: Styles: show @supports CSS groupings"
964         https://bugs.webkit.org/show_bug.cgi?id=200419
965         https://trac.webkit.org/changeset/248289
966
967 2019-08-06  Chris Dumez  <cdumez@apple.com>
968
969         Fix inefficiency in HTTPHeaderMap::set(CFStringRef, const String&)
970         https://bugs.webkit.org/show_bug.cgi?id=200475
971
972         Reviewed by Darin Adler.
973
974         In the case where CFStringGetCStringPtr() succeeds in returning us a pointer
975         to the CFStringRef underlying characters but it is not a common header, we
976         would fall back to calling HTTPHeaderMap::set(const String&, const String&)
977         which would unecessarily call findHTTPHeaderName() again to try and determine
978         if it is a common header. Avoid this by introducing a new setUncommonHeader()
979         private method and calling this one instead. Also got rid of some code
980         duplication at the same time.
981
982         * platform/network/HTTPHeaderMap.cpp:
983         (WebCore::HTTPHeaderMap::set):
984         (WebCore::HTTPHeaderMap::setUncommonHeader):
985         * platform/network/HTTPHeaderMap.h:
986         * platform/network/HTTPParsers.cpp:
987         (WebCore::parseHTTPHeader):
988         * testing/MockCDMFactory.cpp:
989         (WebCore::MockCDMInstance::setServerCertificate):
990
991 2019-08-06  Saam Barati  <sbarati@apple.com>
992
993         [WHLSL] Remove the auto initialize variables pass
994         https://bugs.webkit.org/show_bug.cgi?id=200472
995
996         Reviewed by Robin Morisset.
997
998         From a separation of concerns perspective, it's a bit nicer to make variables
999         without initializers call their default constructors as a transformation over the AST.
1000         This removes the need for the lowering to need to worry about such things. However,
1001         changing metal lowering to deal with this is trivial. It means we need to change one
1002         line of code in Metal code generation, and we get to remove a ~50 LOC AST pass.
1003         Also, in this case, it saves us from the compile time hit of having to run the
1004         auto initialize variables phase, which takes ~1.2ms on compute_boids.
1005
1006         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
1007         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
1008         * Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp: Removed.
1009         * Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.h: Removed.
1010         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
1011         (WebCore::WHLSL::prepareShared):
1012         * Sources.txt:
1013         * WebCore.xcodeproj/project.pbxproj:
1014
1015 2019-08-06  Sam Weinig  <weinig@apple.com>
1016
1017         WHLSL Metal code generation unnecessarily does string copies by passing partial results as Strings
1018         https://bugs.webkit.org/show_bug.cgi?id=200471
1019
1020         Reviewed by Saam Barati.
1021
1022         Avoid string copies by passing a single StringBuilder all the way through Metal code
1023         generation and only converting to a String when passing the constructed shader to Metal
1024         API.
1025         
1026         Where possible, use StringView in lieu of String for temporary strings being passed to
1027         the StringBuilder to avoid the allocation overhead of StringImpl. 
1028
1029         * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h:
1030         (WebCore::WHLSL::AST::toString):
1031         Switch to StringView.
1032
1033         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h:
1034         (WebCore::WHLSL::AST::BuiltInSemantic::toString const):
1035         Switch to StringView.
1036
1037         * Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h:
1038         (WebCore::WHLSL::AST::toString):
1039         Switch to StringView.
1040
1041         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
1042         Remove unnecessary "private:".
1043     
1044         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h:
1045         (WebCore::WHLSL::AST::ResourceSemantic::toString):
1046         Switch to StringView.
1047
1048         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
1049         (WebCore::WHLSL::Metal::EntryPointScaffolding::emitResourceHelperTypes):
1050         (WebCore::WHLSL::Metal::EntryPointScaffolding::emitResourceSignature):
1051         (WebCore::WHLSL::Metal::EntryPointScaffolding::emitBuiltInsSignature):
1052         (WebCore::WHLSL::Metal::EntryPointScaffolding::emitMangledInputPath):
1053         (WebCore::WHLSL::Metal::EntryPointScaffolding::emitMangledOutputPath):
1054         (WebCore::WHLSL::Metal::EntryPointScaffolding::emitUnpackResourcesAndNamedBuiltIns):
1055         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::emitHelperTypes):
1056         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::emitSignature):
1057         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::emitUnpack):
1058         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::emitPack):
1059         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::emitHelperTypes):
1060         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::emitSignature):
1061         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::emitUnpack):
1062         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::emitPack):
1063         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::emitHelperTypes):
1064         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::emitSignature):
1065         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::emitUnpack):
1066         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::emitPack):
1067         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceHelperTypes): Deleted.
1068         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceSignature): Deleted.
1069         (WebCore::WHLSL::Metal::EntryPointScaffolding::builtInsSignature): Deleted.
1070         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledInputPath): Deleted.
1071         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledOutputPath): Deleted.
1072         (WebCore::WHLSL::Metal::EntryPointScaffolding::unpackResourcesAndNamedBuiltIns): Deleted.
1073         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::helperTypes): Deleted.
1074         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::signature): Deleted.
1075         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::unpack): Deleted.
1076         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::pack): Deleted.
1077         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::helperTypes): Deleted.
1078         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::signature): Deleted.
1079         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::unpack): Deleted.
1080         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::pack): Deleted.
1081         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::helperTypes): Deleted.
1082         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::signature): Deleted.
1083         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::unpack): Deleted.
1084         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::pack): Deleted.
1085         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.h:
1086         Rather than have scaffolding return strings, pass in StringBuilders everywhere. 
1087
1088         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
1089         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
1090         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
1091         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitConstantExpressionString):
1092         (WebCore::WHLSL::Metal::generateMetalFunctionsMapping):
1093         (WebCore::WHLSL::Metal::emitSharedMetalFunctions):
1094         (WebCore::WHLSL::Metal::emitMetalFunctions):
1095         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::FunctionDeclarationWriter): Deleted.
1096         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::toString): Deleted.
1097         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::toString): Deleted.
1098         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::constantExpressionString): Deleted.
1099         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::RenderFunctionDefinitionWriter): Deleted.
1100         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::ComputeFunctionDefinitionWriter): Deleted.
1101         (WebCore::WHLSL::Metal::sharedMetalFunctions): Deleted.
1102         (WebCore::WHLSL::Metal::metalFunctions): Deleted.
1103         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.h:
1104         Rather than returning Strings from function generation functions, pass in StringBuilders everywhere.
1105
1106         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp:
1107         (WebCore::WHLSL::Metal::metalCodeProlog):
1108         (WebCore::WHLSL::Metal::dumpMetalCodeIfNeeded):
1109         (WebCore::WHLSL::Metal::generateMetalCode):
1110         (WebCore::WHLSL::Metal::generateMetalCodeShared): Deleted.
1111         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h:
1112         Switch RenderMetalCode and ComputeMetalCode to contain StringBuilders to allow
1113         delaying conversion to String to the latest point possible.
1114         
1115         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
1116         (WebCore::WHLSL::Metal::TypeNamer::emitMetalTypeDeclarations):
1117         (WebCore::WHLSL::Metal::TypeNamer::emitUnnamedTypeDefinition):
1118         (WebCore::WHLSL::Metal::TypeNamer::emitNamedTypeDefinition):
1119         (WebCore::WHLSL::Metal::TypeNamer::emitAllUnnamedTypeDefinitions):
1120         (WebCore::WHLSL::Metal::TypeNamer::emitMetalTypeDefinitions):
1121         (WebCore::WHLSL::Metal::TypeNamer::emitMetalTypes):
1122         (WebCore::WHLSL::Metal::MetalTypeDeclarationWriter::MetalTypeDeclarationWriter): Deleted.
1123         (WebCore::WHLSL::Metal::MetalTypeDeclarationWriter::toString): Deleted.
1124         (WebCore::WHLSL::Metal::MetalTypeDeclarationWriter::visit): Deleted.
1125         (WebCore::WHLSL::Metal::TypeNamer::metalTypeDeclarations): Deleted.
1126         (WebCore::WHLSL::Metal::TypeNamer::metalTypeDefinitions): Deleted.
1127         (WebCore::WHLSL::Metal::TypeNamer::metalTypes): Deleted.
1128         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.h:
1129         Rather than returning Strings from function generation functions, pass in StringBuilders everywhere.
1130
1131         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
1132         (WebCore::WHLSL::Parser::parseResourceSemantic):
1133         Remove use of _str, which allocates a String, and just use a StringView directly.
1134
1135         * Modules/webgpu/WHLSL/WHLSLPrepare.h:
1136         Switch RenderPrepareResult and ComputePrepareResult to contain StringBuilders to allow
1137         delaying conversion to String to the latest point possible.
1138
1139         * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
1140         (WebCore::trySetFunctions):
1141         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
1142         (WebCore::trySetFunctions):
1143         Convert StringBuilders to String at the last moment necessary. Adds a FIXME to improve
1144         in the future by adding direct conversion from StringBuilder to NSString to avoid another
1145         copy.
1146
1147 2019-08-06  Saam Barati  <sbarati@apple.com>
1148
1149         [WHLSL] Reduce the number of variables that make it into the global struct by skipping stdlib functions and internal uses of MakePointerExpression/MakeArrayReference
1150         https://bugs.webkit.org/show_bug.cgi?id=200463
1151
1152         Reviewed by Myles C. Maxfield.
1153
1154         This patch makes it so that we put fewer variables in the global struct.
1155         This decreases end-to-end running time in compute_boids by 30% (with p = 0.0001).
1156         
1157         We achieve this in two ways:
1158         1. We track if each function is user code or "standard library" code. We also
1159         count native functions as the standard library. We know a priori that the
1160         standard library never escapes any variables. So the preserve variable
1161         lifetimes phase skips analyzing all standard library functions and also
1162         skips passing the global struct to any standard library functions.
1163         
1164         2. We internally emit MakePointerExpression/MakeArrayReferenceExpression nodes in
1165         the compiler in various phases. We sometimes emit these nodes in such a way
1166         that we know that this address-of expression does not cause the variable to
1167         escape. We now mark each address-of expressions as either:
1168         - Conservatively escaping. We conservatively do this for all user code.
1169         - Not escaping. This means that this address-of operation definitely does
1170         not escape the variable. If a variable never has an escaping use, we will
1171         omit putting this variable in the struct.
1172
1173         * Modules/webgpu/WHLSL/AST/WHLSLAddressEscapeMode.h: Added.
1174         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
1175         (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration):
1176         (WebCore::WHLSL::AST::FunctionDeclaration::parsingMode const):
1177         * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h:
1178         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression):
1179         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::mightEscape const):
1180         * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h:
1181         (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression):
1182         (WebCore::WHLSL::AST::MakePointerExpression::mightEscape const):
1183         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
1184         (WebCore::WHLSL::resolveWithOperatorAnderIndexer):
1185         (WebCore::WHLSL::resolveWithOperatorLength):
1186         (WebCore::WHLSL::resolveWithReferenceComparator):
1187         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
1188         (WebCore::WHLSL::Parser::parse):
1189         (WebCore::WHLSL::Parser::parseComputeFunctionDeclaration):
1190         (WebCore::WHLSL::Parser::parseVertexOrFragmentFunctionDeclaration):
1191         (WebCore::WHLSL::Parser::parseRegularFunctionDeclaration):
1192         (WebCore::WHLSL::Parser::parseOperatorFunctionDeclaration):
1193         (WebCore::WHLSL::Parser::parsePossiblePrefix):
1194         * Modules/webgpu/WHLSL/WHLSLParser.h:
1195         * Modules/webgpu/WHLSL/WHLSLParsingMode.h: Added.
1196         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
1197         (WebCore::WHLSL::prepareShared):
1198         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
1199         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
1200         (WebCore::WHLSL::wrapAnderCallArgument):
1201         (WebCore::WHLSL::modify):
1202         (WebCore::WHLSL::PropertyResolver::visit):
1203         * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp:
1204         (WebCore::WHLSL::includeStandardLibrary):
1205         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
1206         (WebCore::WHLSL::synthesizeArrayOperatorLength):
1207         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
1208         (WebCore::WHLSL::synthesizeConstructors):
1209         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
1210         (WebCore::WHLSL::synthesizeEnumerationFunctions):
1211         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
1212         (WebCore::WHLSL::synthesizeStructureAccessors):
1213         * WebCore.xcodeproj/project.pbxproj:
1214
1215 2019-08-06  Jer Noble  <jer.noble@apple.com>
1216
1217         Adopt -expectMinimumUpcomingSampleBufferPresentationTime:
1218         https://bugs.webkit.org/show_bug.cgi?id=200457
1219         <rdar://problem/53961130>
1220
1221         Reviewed by Eric Carlson.
1222
1223         Test: media/media-source/media-source-minimumupcomingpresentationtime.html
1224
1225         Adopt a new API vended by AVSampleBufferDisplayLayer, piped from SourceBuffer down
1226         through SourceBufferPrivate to SourceBufferPrivateAVFObjC. This value should be
1227         reset and updated when new samples are appended.
1228
1229         * Modules/mediasource/SourceBuffer.cpp:
1230         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
1231         (WebCore::SourceBuffer::provideMediaData):
1232         (WebCore::SourceBuffer::updateMinimumUpcomingPresentationTime):
1233         (WebCore::SourceBuffer::resetMinimumUpcomingPresentationTime):
1234         (WebCore::SourceBuffer::minimumUpcomingPresentationTimeForTrackID):
1235         (WebCore::SourceBuffer::setMaximumQueueDepthForTrackID):
1236         * Modules/mediasource/SourceBuffer.h:
1237         * platform/graphics/SourceBufferPrivate.h:
1238         (WebCore::SourceBufferPrivate::canSetMinimumUpcomingPresentationTime const):
1239         (WebCore::SourceBufferPrivate::setMinimumUpcomingPresentationTime):
1240         (WebCore::SourceBufferPrivate::clearMinimumUpcomingPresentationTime):
1241         (WebCore::SourceBufferPrivate::enqueuedSamplesForTrackID):
1242         (WebCore::SourceBufferPrivate::minimumUpcomingPresentationTimeForTrackID):
1243         (WebCore::SourceBufferPrivate::setMaximumQueueDepthForTrackID):
1244         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1245         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1246         (WebCore::SourceBufferPrivateAVFObjC::canSetMinimumUpcomingPresentationTime const):
1247         (WebCore::SourceBufferPrivateAVFObjC::setMinimumUpcomingPresentationTime):
1248         (WebCore::SourceBufferPrivateAVFObjC::clearMinimumUpcomingPresentationTime):
1249         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
1250         (WebCore::MockSourceBufferPrivate::minimumUpcomingPresentationTimeForTrackID):
1251         (WebCore::MockSourceBufferPrivate::setMaximumQueueDepthForTrackID):
1252         (WebCore::MockSourceBufferPrivate::canSetMinimumUpcomingPresentationTime const):
1253         (WebCore::MockSourceBufferPrivate::setMinimumUpcomingPresentationTime):
1254         (WebCore::MockSourceBufferPrivate::clearMinimumUpcomingPresentationTime):
1255         * platform/mock/mediasource/MockSourceBufferPrivate.h:
1256         * testing/Internals.cpp:
1257         (WebCore::Internals::minimumUpcomingPresentationTimeForTrackID):
1258         (WebCore::Internals::setMaximumQueueDepthForTrackID):
1259         * testing/Internals.h:
1260         * testing/Internals.idl:
1261
1262 2019-08-06  Antti Koivisto  <antti@apple.com>
1263
1264         Add release assert against InvalidationRuleSet mutation during invalidation
1265         https://bugs.webkit.org/show_bug.cgi?id=200467
1266
1267         Reviewed by Chris Dumez.
1268
1269         Try to get a more informative stack for rdar://problem/53413013
1270
1271         * css/DocumentRuleSets.cpp:
1272         (WebCore::DocumentRuleSets::~DocumentRuleSets):
1273         (WebCore::DocumentRuleSets::collectFeatures const):
1274         * css/DocumentRuleSets.h:
1275         * style/AttributeChangeInvalidation.cpp:
1276         (WebCore::Style::AttributeChangeInvalidation::invalidateStyleWithRuleSets):
1277         * style/ClassChangeInvalidation.cpp:
1278         (WebCore::Style::ClassChangeInvalidation::invalidateStyleWithRuleSets):
1279
1280 2019-08-06  Antti Koivisto  <antti@apple.com>
1281
1282         REGRESSION: Cannot tap on any buttons on m.naver.com home screen on iPad
1283         https://bugs.webkit.org/show_bug.cgi?id=200466
1284
1285         Reviewed by Zalan Bujtas.
1286
1287         The page calls preventDefault() for a mouse event generated by a site specific quirk.
1288
1289         * page/Quirks.cpp:
1290         (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
1291
1292         Disable the quirk for the "m." subdomain. This is a mobile site that don't need or expect them.
1293
1294 2019-08-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1295
1296         [iPadOS] Unable to increase zoom level on Google using the Aa menu
1297         https://bugs.webkit.org/show_bug.cgi?id=200453
1298         <rdar://problem/52278579>
1299
1300         Reviewed by Tim Horton.
1301
1302         Makes a couple of minor adjustments to how layout size scale factor is handled in ViewportConfiguration, to
1303         address some scenarios in which adjusting WKWebView's _viewScale does not have any apparent effect on the page.
1304         See changes below for more detail.
1305
1306         Tests: fast/viewport/ios/non-responsive-viewport-after-changing-view-scale.html
1307                fast/viewport/ios/responsive-viewport-with-minimum-width-after-changing-view-scale.html
1308
1309         * page/ViewportConfiguration.cpp:
1310         (WebCore::ViewportConfiguration::initialScaleFromSize const):
1311
1312         When the page is either zoomed in or zoomed out using _viewScale, let the specified initial scale take
1313         precedence over the scale computed by fitting the content width to the view width, or the scale computed by
1314         fitting the content height to the view height.
1315
1316         This avoids a scenario in which nothing happens when increasing view scale in a responsively designed web page
1317         that has a fixed minimum width. Before this change, when computing the initial scale at a view scale that would
1318         not allow the entire content width of the page to fit within the viewport, the new initial scale would remain
1319         unchanged if the initial scale in the meta viewport is not also set to 1, because a new initial scale would be
1320         computed in ViewportConfiguration::initialScaleFromSize to accomodate for the entire content width.
1321
1322         Our new behavior allows us to zoom into the page, even if doing so would cause horizontal scrolling.
1323
1324         (WebCore::ViewportConfiguration::updateConfiguration):
1325
1326         When the page is either zoomed in or zoomed out using _viewScale and the default viewport configuration has a
1327         fixed width (e.g. on iPhone), then adjust the width of the default viewport configuration to account for the
1328         _viewScale. For example, the default width of a viewport-less web page is 980px on iPhone; at a view scale of 2,
1329         this would become 490px instead, and at 0.5 view scale, it would become 1960px.
1330
1331         This ensures that on iPhone, for web pages without a meta viewport, changing the view scale still changes the
1332         layout and initial scale of the web page.
1333
1334         * page/ViewportConfiguration.h:
1335         (WebCore::ViewportConfiguration::layoutSizeIsExplicitlyScaled const):
1336
1337 2019-08-05  Zalan Bujtas  <zalan@apple.com>
1338
1339         [LFC] Remove out-of-flow descendants from Container
1340         https://bugs.webkit.org/show_bug.cgi?id=200430
1341         <rdar://problem/53923980>
1342
1343         Reviewed by Antti Koivisto.
1344
1345         The out-of-flow descendant list is the last "formatting context type" bit in the layout tree.
1346         Let's cached them in the FormattingStates instead for now. 
1347
1348         * layout/FormattingContext.cpp:
1349         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1350         * layout/FormattingContext.h:
1351         * layout/FormattingState.h:
1352         (WebCore::Layout::FormattingState::addOutOfFlowBox):
1353         (WebCore::Layout::FormattingState::outOfFlowBoxes const):
1354         * layout/LayoutState.cpp:
1355         (WebCore::Layout::LayoutState::layoutFormattingContextSubtree):
1356         (WebCore::Layout::LayoutState::createFormattingStateForFormattingRootIfNeeded):
1357         (WebCore::Layout::LayoutState::run):
1358         * layout/LayoutState.h:
1359         * layout/blockformatting/BlockFormattingContext.cpp:
1360         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
1361         * layout/inlineformatting/InlineFormattingContext.cpp:
1362         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
1363         * layout/layouttree/LayoutBox.h:
1364         * layout/layouttree/LayoutContainer.cpp:
1365         (WebCore::Layout::Container::addOutOfFlowDescendant): Deleted.
1366         * layout/layouttree/LayoutContainer.h:
1367         * layout/layouttree/LayoutTreeBuilder.cpp:
1368         (WebCore::Layout::TreeBuilder::createLayoutTree):
1369         * page/FrameViewLayoutContext.cpp:
1370         (WebCore::layoutUsingFormattingContext):
1371
1372 2019-08-05  Devin Rousso  <drousso@apple.com>
1373
1374         Web Inspector: Styles: show @supports CSS groupings
1375         https://bugs.webkit.org/show_bug.cgi?id=200419
1376
1377         Reviewed by Joseph Pecoraro.
1378
1379         Test: inspector/css/getMatchedStylesForNode.html
1380
1381         * inspector/InspectorStyleSheet.cpp:
1382         (WebCore::buildArrayForGroupings): Added.
1383         (WebCore::InspectorStyleSheet::buildObjectForRule):
1384         (WebCore::buildMediaObject): Deleted.
1385         (WebCore::fillMediaListChain): Deleted.
1386
1387         * css/MediaList.h:
1388         * css/MediaList.cpp:
1389         (WebCore::MediaQuerySet::MediaQuerySet):
1390         Remove the `lastLine` as it was never set by anyone and wasn't used by Web Inspector.
1391
1392 2019-08-05  Youenn Fablet  <youenn@apple.com>
1393
1394         Make Logger::log thread safe so that it can be used from background threads
1395         https://bugs.webkit.org/show_bug.cgi?id=200448
1396
1397         Reviewed by Eric Carlson.
1398
1399         No change of behavior.
1400
1401         * dom/Document.cpp:
1402         (WebCore::crossThreadCopy):
1403         (WebCore::Document::didLogMessage):
1404         Make sure to hop to the main thread if needed.
1405         * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:
1406         (WebCore::RealtimeIncomingAudioSourceCocoa::OnData):
1407         Remove hopping to the main thread.
1408         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
1409         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
1410         Remove hopping to the main thread.
1411
1412 2019-08-05  Devin Rousso  <drousso@apple.com>
1413
1414         Can't use $0, $1 etc when inspecting Google Docs pages because the content uses these for function names
1415         https://bugs.webkit.org/show_bug.cgi?id=195834
1416
1417         Reviewed by Joseph Pecoraro.
1418
1419         Allow the user to alias saved results by providing a different prefix (e.g. "$") from within
1420         Web Inspector. When changing the alias, all existing saved results will update to be
1421         reference-able from the new alias.
1422
1423         Test: inspector/runtime/setSavedResultAlias.html
1424
1425         * inspector/CommandLineAPIModuleSource.js:
1426         (CommandLineAPI):
1427
1428 2019-08-05  Devin Rousso  <drousso@apple.com>
1429
1430         Web Inspector: Timelines: disable related agents when the tab is closed
1431         https://bugs.webkit.org/show_bug.cgi?id=200118
1432
1433         Reviewed by Joseph Pecoraro.
1434
1435         Rework how `enable`/`disable` is used for timeline-related agents so that events are not sent
1436         and data isn't kept alive when the Timelines tab isn't enabled.
1437
1438         * inspector/agents/InspectorTimelineAgent.h:
1439         * inspector/agents/InspectorTimelineAgent.cpp:
1440         (WebCore::InspectorTimelineAgent::didCreateFrontendAndBackend):
1441         (WebCore::InspectorTimelineAgent::willDestroyFrontendAndBackend):
1442         (WebCore::InspectorTimelineAgent::enable):
1443         (WebCore::InspectorTimelineAgent::disable):
1444         (WebCore::InspectorTimelineAgent::start):
1445         (WebCore::InspectorTimelineAgent::stop):
1446         (WebCore::InspectorTimelineAgent::internalStart):
1447         (WebCore::InspectorTimelineAgent::internalStop):
1448         (WebCore::InspectorTimelineAgent::startFromConsole):
1449         (WebCore::InspectorTimelineAgent::stopFromConsole):
1450         (WebCore::InspectorTimelineAgent::mainFrameStartedLoading):
1451         (WebCore::InspectorTimelineAgent::startProgrammaticCapture):
1452         (WebCore::InspectorTimelineAgent::stopProgrammaticCapture):
1453         Rename `m_enabled*` to `m_tracking*` to match other timeline-related agents.
1454
1455         * inspector/agents/InspectorMemoryAgent.h:
1456         * inspector/agents/InspectorMemoryAgent.cpp:
1457         (WebCore::InspectorMemoryAgent::didCreateFrontendAndBackend):
1458         (WebCore::InspectorMemoryAgent::willDestroyFrontendAndBackend):
1459         (WebCore::InspectorMemoryAgent::enable):
1460         (WebCore::InspectorMemoryAgent::disable):
1461         (WebCore::InspectorMemoryAgent::didHandleMemoryPressure):
1462
1463         * inspector/InstrumentingAgents.h:
1464         (WebCore::InstrumentingAgents::trackingInspectorTimelineAgent): Added.
1465         (WebCore::InstrumentingAgents::setTrackingInspectorTimelineAgent): Added.
1466         (WebCore::InstrumentingAgents::persistentInspectorTimelineAgent): Added.
1467         (WebCore::InstrumentingAgents::setPersistentInspectorTimelineAgent): Added.
1468         * inspector/InstrumentingAgents.cpp:
1469         (WebCore::InstrumentingAgents::reset):
1470         * inspector/InspectorInstrumentation.h:
1471         * inspector/InspectorInstrumentation.cpp:
1472         (WebCore::InspectorInstrumentation::didInstallTimerImpl):
1473         (WebCore::InspectorInstrumentation::didRemoveTimerImpl):
1474         (WebCore::InspectorInstrumentation::willCallFunctionImpl):
1475         (WebCore::InspectorInstrumentation::willDispatchEventImpl):
1476         (WebCore::InspectorInstrumentation::willDispatchEventOnWindowImpl):
1477         (WebCore::InspectorInstrumentation::willEvaluateScriptImpl):
1478         (WebCore::InspectorInstrumentation::willFireTimerImpl):
1479         (WebCore::InspectorInstrumentation::didInvalidateLayoutImpl):
1480         (WebCore::InspectorInstrumentation::willLayoutImpl):
1481         (WebCore::InspectorInstrumentation::willCompositeImpl):
1482         (WebCore::InspectorInstrumentation::didCompositeImpl):
1483         (WebCore::InspectorInstrumentation::willPaintImpl):
1484         (WebCore::InspectorInstrumentation::didPaintImpl):
1485         (WebCore::InspectorInstrumentation::willRecalculateStyleImpl):
1486         (WebCore::InspectorInstrumentation::didScheduleStyleRecalculationImpl):
1487         (WebCore::InspectorInstrumentation::didCommitLoadImpl):
1488         (WebCore::InspectorInstrumentation::frameStartedLoadingImpl):
1489         (WebCore::InspectorInstrumentation::startConsoleTimingImpl):
1490         (WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
1491         (WebCore::InspectorInstrumentation::consoleTimeStampImpl):
1492         (WebCore::InspectorInstrumentation::startProfilingImpl):
1493         (WebCore::InspectorInstrumentation::stopProfilingImpl):
1494         (WebCore::InspectorInstrumentation::timelineAgentTracking): Added.
1495         (WebCore::InspectorInstrumentation::didRequestAnimationFrameImpl):
1496         (WebCore::InspectorInstrumentation::didCancelAnimationFrameImpl):
1497         (WebCore::InspectorInstrumentation::willFireAnimationFrameImpl):
1498         (WebCore::InspectorInstrumentation::willFireObserverCallbackImpl):
1499         (WebCore::InspectorInstrumentation::retrieveTimelineAgent):
1500         (WebCore::InspectorInstrumentation::timelineAgentEnabled): Deleted.
1501         * bindings/js/JSExecStateInstrumentation.h:
1502         (WebCore::JSExecState::instrumentFunctionInternal):
1503         Rename for clarity/correctness:
1504          - `inspectorTimelineAgent` => `trackingInspectorTimelineAgent`
1505          - `persistentInspectorTimelineAgent` => `inspectorTimelineAgent`
1506
1507 2019-08-05  Fujii Hironori  <Hironori.Fujii@sony.com>
1508
1509         [Win] Specifying huge font-size causes crashing
1510         https://bugs.webkit.org/show_bug.cgi?id=200340
1511
1512         Reviewed by Don Olmstead.
1513
1514         Covered by existing tests.
1515
1516         * platform/graphics/win/FontPlatformDataWin.cpp:
1517         (WebCore::FontPlatformData::FontPlatformData): Use GetTextFace to
1518         get font face names instead of GetOutlineTextMetrics which returns
1519         null for huge size fonts.
1520
1521 2019-08-05  Youenn Fablet  <youenn@apple.com>
1522
1523         Response constructor doesn't throw on disturbed ReadableStream
1524         https://bugs.webkit.org/show_bug.cgi?id=200130
1525         <rdar://problem/53550351>
1526
1527         Reviewed by Alex Christensen.
1528
1529         Make FetchBody::extract return an exception in error cases.
1530         Update call sites accordingly.
1531         Add the error case as per https://fetch.spec.whatwg.org/#concept-bodyinit-extract, ReadableStream handling.
1532
1533         Covered by updated and rebased tests.
1534
1535         * Modules/beacon/NavigatorBeacon.cpp:
1536         (WebCore::NavigatorBeacon::sendBeacon):
1537         * Modules/fetch/FetchBody.cpp:
1538         (WebCore::FetchBody::extract):
1539         * Modules/fetch/FetchBody.h:
1540         * Modules/fetch/FetchBodyOwner.cpp:
1541         (WebCore::FetchBodyOwner::extractBody):
1542         * Modules/fetch/FetchBodyOwner.h:
1543         * Modules/fetch/FetchRequest.cpp:
1544         (WebCore::FetchRequest::initializeWith):
1545         (WebCore::FetchRequest::setBody):
1546         * Modules/fetch/FetchResponse.cpp:
1547         (WebCore::FetchResponse::create):
1548         * Modules/streams/ReadableStreamInternals.js:
1549         (readableStreamPipeTo): fix a case where the promise would be unhandled and would show up in
1550         unhandledrejectionhandler.
1551
1552 2019-08-05  Youenn Fablet  <youenn@apple.com>
1553
1554         Support RTCRtpSender.dtmf
1555         https://bugs.webkit.org/show_bug.cgi?id=200431
1556
1557         Reviewed by Eric Carlson.
1558
1559         Add a new backend interface to RTCDTMFSender and implementation of it using libwebrtc.
1560         Update RTCDTMFSender to use that new backend and make RTCRtpSender return a RTCDTMFSender
1561         conditionally on a newly added runtime flag.
1562         Update RTCDTMFSender implementation based on https://w3c.github.io/webrtc-pc/#peer-to-peer-dtmf.
1563
1564         Covered by rebased tests.
1565
1566         * Modules/mediastream/PeerConnectionBackend.cpp:
1567         (WebCore::PeerConnectionBackend::context const):
1568         (WebCore::PeerConnectionBackend::transceiverFromSender):
1569         * Modules/mediastream/PeerConnectionBackend.h:
1570         * Modules/mediastream/RTCDTMFSender.cpp:
1571         (WebCore::RTCDTMFSender::RTCDTMFSender):
1572         (WebCore::RTCDTMFSender::canInsertDTMF const):
1573         (WebCore::RTCDTMFSender::toneBuffer const):
1574         (WebCore::isToneCharacterInvalid):
1575         (WebCore::RTCDTMFSender::insertDTMF):
1576         (WebCore::RTCDTMFSender::playNextTone):
1577         (WebCore::RTCDTMFSender::onTonePlayed):
1578         (WebCore::RTCDTMFSender::toneTimerFired):
1579         (WebCore::RTCDTMFSender::stop):
1580         (WebCore::RTCDTMFSender::activeDOMObjectName const):
1581         (WebCore::RTCDTMFSender::canSuspendForDocumentSuspension const):
1582         * Modules/mediastream/RTCDTMFSender.h:
1583         * Modules/mediastream/RTCDTMFSender.idl:
1584         * Modules/mediastream/RTCDTMFToneChangeEvent.cpp:
1585         * Modules/mediastream/RTCDTMFToneChangeEvent.h:
1586         * Modules/mediastream/RTCDTMFToneChangeEvent.idl:
1587         * Modules/mediastream/RTCRtpSender.cpp:
1588         (WebCore::RTCRtpSender::dtmf):
1589         (WebCore::RTCRtpSender::currentTransceiverDirection const):
1590         * Modules/mediastream/RTCRtpSender.h:
1591         * Modules/mediastream/RTCRtpSender.idl:
1592         * Modules/mediastream/RTCRtpSenderBackend.h:
1593         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
1594         (WebCore::LibWebRTCRtpSenderBackend::createDTMFBackend):
1595         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
1596         * Sources.txt:
1597         * WebCore.xcodeproj/project.pbxproj:
1598         * dom/EventNames.in:
1599         * dom/EventTargetFactory.in:
1600         * page/RuntimeEnabledFeatures.h:
1601         (WebCore::RuntimeEnabledFeatures::webRTCDTMFEnabled const):
1602         (WebCore::RuntimeEnabledFeatures::setWebRTCDTMFEnabled):
1603         * platform/mediastream/RTCDTMFSenderBackend.h: Added.
1604         * platform/mediastream/RTCDTMFSenderHandler.h: Removed.
1605         * platform/mediastream/RTCDTMFSenderHandlerClient.h: Removed.
1606         * platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.cpp: Added.
1607         (WebCore::toWTFString):
1608         (WebCore::LibWebRTCDTMFSenderBackend::LibWebRTCDTMFSenderBackend):
1609         (WebCore::LibWebRTCDTMFSenderBackend::~LibWebRTCDTMFSenderBackend):
1610         (WebCore::LibWebRTCDTMFSenderBackend::canInsertDTMF):
1611         (WebCore::LibWebRTCDTMFSenderBackend::playTone):
1612         (WebCore::LibWebRTCDTMFSenderBackend::tones const):
1613         (WebCore::LibWebRTCDTMFSenderBackend::duration const):
1614         (WebCore::LibWebRTCDTMFSenderBackend::interToneGap const):
1615         (WebCore::LibWebRTCDTMFSenderBackend::OnToneChange):
1616         (WebCore::LibWebRTCDTMFSenderBackend::onTonePlayed):
1617         * platform/mediastream/libwebrtc/LibWebRTCDTMFSenderBackend.h: Added.
1618
1619 2019-08-05  Saam Barati  <sbarati@apple.com>
1620
1621         [WHLSL] Inline all native function calls
1622         https://bugs.webkit.org/show_bug.cgi?id=200350
1623
1624         Reviewed by Robin Morisset.
1625
1626         Native functions calls tend to be really small. If we inline in the generated
1627         Metal code, we end up with faster Metal compile times. On compute_boids, this
1628         provides a ~10ms improvement.
1629
1630         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
1631         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
1632         (WebCore::WHLSL::Metal::sharedMetalFunctions):
1633         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
1634         (WebCore::WHLSL::Metal::inlineNativeFunction):
1635         (WebCore::WHLSL::Metal::writeNativeFunction): Deleted.
1636         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h:
1637
1638 2019-08-05  Youenn Fablet  <youenn@apple.com>
1639
1640         RealtimeOutgoingAudioSource::pullAudioData is no longer needed
1641         https://bugs.webkit.org/show_bug.cgi?id=200450
1642
1643         Reviewed by Geoffrey Garen.
1644
1645         No change of behavior, removing base class method declaration.
1646
1647         * platform/mediastream/RealtimeOutgoingAudioSource.h:
1648         (WebCore::RealtimeOutgoingAudioSource::pullAudioData): Deleted.
1649         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h:
1650         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h:
1651
1652 2019-08-05  Saam Barati  <sbarati@apple.com>
1653
1654         [WHLSL] Add compile time flag to dump metal compile times
1655         https://bugs.webkit.org/show_bug.cgi?id=200447
1656
1657         Reviewed by Myles C. Maxfield.
1658
1659         * Modules/webgpu/WHLSL/WHLSLPrepare.h:
1660         * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
1661         (WebCore::trySetFunctions):
1662         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
1663         (WebCore::trySetFunctions):
1664
1665 2019-08-05  Chris Dumez  <cdumez@apple.com>
1666
1667         navigator.geolocation wrapper should not become GC-collectable once its frame is detached
1668         https://bugs.webkit.org/show_bug.cgi?id=200436
1669
1670         Reviewed by Darin Adler.
1671
1672         navigator.geolocation wrapper should not become GC-collectable once its frame is detached, given
1673         that it can outlive the frame. Instead, tie the navigator.geolocation wrapper's lifetime to its
1674         Navigator's.
1675
1676         Test: fast/dom/navigator-property-gc-after-frame-detach.html
1677
1678         * Modules/geolocation/Geolocation.cpp:
1679         (WebCore::Geolocation::create):
1680         (WebCore::Geolocation::Geolocation):
1681         (WebCore::Geolocation::navigator):
1682         (WebCore::Geolocation::frame const):
1683         * Modules/geolocation/Geolocation.h:
1684         * Modules/geolocation/Geolocation.idl:
1685         * Modules/geolocation/NavigatorGeolocation.cpp:
1686         (WebCore::NavigatorGeolocation::NavigatorGeolocation):
1687         (WebCore::NavigatorGeolocation::from):
1688         (WebCore::NavigatorGeolocation::geolocation):
1689         (WebCore::NavigatorGeolocation::geolocation const):
1690         * Modules/geolocation/NavigatorGeolocation.h:
1691         * bindings/js/JSNavigatorCustom.cpp:
1692         (WebCore::JSNavigator::visitAdditionalChildren):
1693         * bindings/js/JSWorkerNavigatorCustom.cpp:
1694         (WebCore::JSWorkerNavigator::visitAdditionalChildren):
1695         * bindings/scripts/CodeGeneratorJS.pm:
1696         (GenerateImplementation):
1697         * bindings/scripts/IDLAttributes.json:
1698         * page/Navigator.cpp:
1699         (WebCore::Navigator::plugins):
1700         (WebCore::Navigator::mimeTypes):
1701         * page/NavigatorBase.h:
1702         * plugins/DOMMimeTypeArray.cpp:
1703         (WebCore::DOMMimeTypeArray::DOMMimeTypeArray):
1704         * plugins/DOMMimeTypeArray.h:
1705         * plugins/DOMMimeTypeArray.idl:
1706         * plugins/DOMPluginArray.cpp:
1707         (WebCore::DOMPluginArray::DOMPluginArray):
1708         * plugins/DOMPluginArray.h:
1709         * plugins/DOMPluginArray.idl:
1710         * workers/service/ServiceWorkerContainer.h:
1711         * workers/service/ServiceWorkerContainer.idl:
1712
1713 2019-08-05  Andy Estes  <aestes@apple.com>
1714
1715         [WebIDL] Support partial dictionaries and conditional dictionary members
1716         https://bugs.webkit.org/show_bug.cgi?id=200441
1717
1718         Reviewed by Alex Christensen.
1719
1720         Added new bindings tests.
1721
1722         * bindings/scripts/CodeGeneratorJS.pm:
1723         (GenerateDictionaryImplementationContent):
1724         * bindings/scripts/IDLParser.pm:
1725         (parsePartialDefinition):
1726         (parsePartialInterface): Deleted.
1727         (parsePartialDictionary): Deleted.
1728         * bindings/scripts/generate-bindings.pl:
1729         (generateBindings):
1730         * bindings/scripts/preprocess-idls.pl:
1731         (getPartialNamesFromIDL):
1732         (getPartialInterfaceNameFromIDL): Deleted.
1733         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1734         (WebCore::convertDictionary<TestEventConstructor::Init>):
1735         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
1736         (WebCore::convertDictionary<DictionaryImplName>):
1737         (WebCore::convertDictionaryToJS):
1738         * bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
1739         * bindings/scripts/test/TestStandaloneDictionary.idl:
1740         * bindings/scripts/test/TestSupplemental.idl:
1741
1742 2019-08-05  Devin Rousso  <drousso@apple.com>
1743
1744         Web Inspector: rename "Stylesheet" to "Style Sheet" to match spec text
1745         https://bugs.webkit.org/show_bug.cgi?id=200422
1746
1747         Reviewed by Joseph Pecoraro.
1748
1749         No observable change in functionality.
1750
1751         * inspector/agents/InspectorPageAgent.h:
1752         * inspector/agents/InspectorPageAgent.cpp:
1753         (WebCore::InspectorPageAgent::resourceTypeJSON):
1754         (WebCore::InspectorPageAgent::inspectorResourceType):
1755
1756 2019-08-05  Takashi Komori  <Takashi.Komori@sony.com>
1757
1758         [Curl] implement CertificateInfo::summaryInfo
1759         https://bugs.webkit.org/show_bug.cgi?id=191498
1760
1761         Reviewed by Alex Christensen.
1762
1763         Implement CertificaeInfo::SummaryInfo.
1764         This patch makes WebInspector show summary of certificates.
1765
1766         Tests: http/tests/inspector/network/resource-security-certificate.html
1767                http/tests/inspector/network/getSerializedCertificate.html
1768
1769         * platform/Curl.cmake:
1770         * platform/network/curl/CertificateInfo.h:
1771         (WTF::Persistence::Coder<WebCore::CertificateInfo>::encode):
1772         (WTF::Persistence::Coder<WebCore::CertificateInfo>::decode):
1773         (WebCore::CertificateInfo::summaryInfo const): Deleted.
1774         * platform/network/curl/CertificateInfoCurl.cpp:
1775         (WebCore::CertificateInfo::summaryInfo const):
1776         * platform/network/curl/CurlSSLVerifier.cpp:
1777         (WebCore::CurlSSLVerifier::collectInfo):
1778         (WebCore::CurlSSLVerifier::verifyCallback):
1779         (WebCore::StackOfX509::StackOfX509): Deleted.
1780         (WebCore::StackOfX509::~StackOfX509): Deleted.
1781         (WebCore::StackOfX509::count): Deleted.
1782         (WebCore::StackOfX509::item): Deleted.
1783         (): Deleted.
1784         (WebCore::BIOHolder::BIOHolder): Deleted.
1785         (WebCore::BIOHolder::~BIOHolder): Deleted.
1786         (WebCore::BIOHolder::write): Deleted.
1787         (WebCore::BIOHolder::asCertificate): Deleted.
1788         (WebCore::pemDataFromCtx): Deleted.
1789         * platform/network/curl/CurlSSLVerifier.h:
1790         * platform/network/curl/OpenSSLHelper.cpp: Added.
1791         (OpenSSL::deleter<X509>::operator()):
1792         (OpenSSL::StackOfGeneralName::StackOfGeneralName):
1793         (OpenSSL::StackOfGeneralName::~StackOfGeneralName):
1794         (OpenSSL::StackOfGeneralName::operator bool):
1795         (OpenSSL::StackOfGeneralName::count):
1796         (OpenSSL::StackOfGeneralName::item):
1797         (OpenSSL::StackOfX509::StackOfX509):
1798         (OpenSSL::StackOfX509::~StackOfX509):
1799         (OpenSSL::StackOfX509::count):
1800         (OpenSSL::StackOfX509::item):
1801         (OpenSSL::BIO::BIO):
1802         (OpenSSL::BIO::~BIO):
1803         (OpenSSL::BIO::getDataAsVector const):
1804         (OpenSSL::BIO::getDataAsString const):
1805         (OpenSSL::BIO::readX509):
1806         (OpenSSL::BIO::get):
1807         (OpenSSL::pemDataFromCtx):
1808         (OpenSSL::createCertificateInfo):
1809         (OpenSSL::toString):
1810         (OpenSSL::getCommonName):
1811         (OpenSSL::getSubjectName):
1812         (OpenSSL::convertASN1TimeToSeconds):
1813         (OpenSSL::getSubjectAltName):
1814         (OpenSSL::createSummaryInfo):
1815         * platform/network/curl/OpenSSLHelper.h: Copied from Source/WebCore/platform/network/curl/CertificateInfoCurl.cpp.
1816
1817 2019-08-04  Youenn Fablet  <youenn@apple.com>
1818
1819         WebRTC: got incorrect `this` in negotiationneeded event
1820         https://bugs.webkit.org/show_bug.cgi?id=200427
1821
1822         Reviewed by Darin Adler.
1823
1824         Make sure a dom object created through a JS built-in constructor is added to the wrapper cache.
1825
1826         Test: webrtc/onnegotiationneeded.html
1827
1828         * bindings/js/JSDOMBuiltinConstructor.h:
1829         (WebCore::createJSObjectFromWrapper):
1830         (WebCore::createJSObject):
1831
1832 2019-08-04  Sam Weinig  <weinig@apple.com>
1833
1834         Mangled WHLSL names don't need to allocate Strings
1835         https://bugs.webkit.org/show_bug.cgi?id=200429
1836
1837         Reviewed by Saam Barati.
1838
1839         To avoid allocating strings for each mangled name used to transform WHLSL to Metal, which we'd
1840         like to avoid since it is both unnecessarily expensive in time and space, we can instead just
1841         store the unique integer identifier that was being used to construct the String. 
1842         
1843         Since the existing mangled names were all of the form "prefix" + unsigned integer value (where 
1844         prefix could be "type", "enumerationMember", "structureElement", "variable" or "function") we
1845         strongly type the integer by storing it in a struct (MangledVariableName, MangledTypeName, etc.)
1846         When the full name is actually needed, StringTypeAdapter's specialized for the structs are
1847         used to write directly into the preallocated buffers of StringBuilders or makeString().
1848
1849         * Modules/webgpu/WHLSL/Metal/WHLSLMangledNames.h: Added.
1850         (WebCore::WHLSL::Metal::MangledVariableName):
1851         (WebCore::WHLSL::Metal::MangledTypeName):
1852         (WebCore::WHLSL::Metal::MangledStructureElementName):
1853         (WebCore::WHLSL::Metal::MangledEnumerationMemberName):
1854         (WebCore::WHLSL::Metal::MangledFunctionName):
1855         Adds structs for each type of mangled name and StringTypeAdapter specializations for
1856         each to allow their use in StringBuilder.flexibleAppend() or makeString(). 
1857         
1858         Additionally, a Variant, MangledOrNativeTypeName, of MangledTypeName and String is 
1859         declared to allow for the few cases where a native type (e.g. float4) is needed. The
1860         StringTypeAdapter for MangledOrNativeTypeName could be generalized for any Variant
1861         in the future, but I left it non-general for now, as it is non-obvious if one would
1862         want to store Variant<Types...>, and have each member function construct a temporary
1863         StringTypeAdapter, or store a Variant<StringTypeAdapter<Types>...> and perform conversion
1864         in the construction.
1865
1866         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
1867         (WebCore::WHLSL::Metal::EntryPointScaffolding::EntryPointScaffolding):
1868         (WebCore::WHLSL::Metal::internalTypeForSemantic):
1869         (WebCore::WHLSL::Metal::EntryPointScaffolding::builtInsSignature):
1870         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledInputPath):
1871         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::VertexEntryPointScaffolding):
1872         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::signature):
1873         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::pack):
1874         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::FragmentEntryPointScaffolding):
1875         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::signature):
1876         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::pack):
1877         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::ComputeEntryPointScaffolding):
1878         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::signature):
1879         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::pack):
1880         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.h:
1881         (WebCore::WHLSL::Metal::EntryPointScaffolding::parameterVariables):
1882         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
1883         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::FunctionDeclarationWriter):
1884         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::visit):
1885         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
1886         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::generateNextVariableName):
1887         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValueWithNullability):
1888         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValue):
1889         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendLeftValue):
1890         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValue):
1891         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValueAndNullability):
1892         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastLeftValue):
1893         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
1894         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitLoop):
1895         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::RenderFunctionDefinitionWriter):
1896         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::createEntryPointScaffolding):
1897         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::ComputeFunctionDefinitionWriter):
1898         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::createEntryPointScaffolding):
1899         (WebCore::WHLSL::Metal::sharedMetalFunctions):
1900         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.h:
1901         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h:
1902         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
1903         (WebCore::WHLSL::Metal::writeNativeFunction):
1904         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h:
1905         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
1906         (WebCore::WHLSL::Metal::BaseTypeNameNode::BaseTypeNameNode):
1907         (WebCore::WHLSL::Metal::BaseTypeNameNode::mangledName const):
1908         (WebCore::WHLSL::Metal::ArrayTypeNameNode::ArrayTypeNameNode):
1909         (WebCore::WHLSL::Metal::ArrayReferenceTypeNameNode::ArrayReferenceTypeNameNode):
1910         (WebCore::WHLSL::Metal::PointerTypeNameNode::PointerTypeNameNode):
1911         (WebCore::WHLSL::Metal::ReferenceTypeNameNode::ReferenceTypeNameNode):
1912         (WebCore::WHLSL::Metal::MetalTypeDeclarationWriter::MetalTypeDeclarationWriter):
1913         (WebCore::WHLSL::Metal::TypeNamer::metalTypeDeclarations):
1914         (WebCore::WHLSL::Metal::TypeNamer::emitNamedTypeDefinition):
1915         (WebCore::WHLSL::Metal::TypeNamer::mangledNameForType):
1916         (WebCore::WHLSL::Metal::TypeNamer::mangledNameForEnumerationMember):
1917         (WebCore::WHLSL::Metal::TypeNamer::mangledNameForStructureElement):
1918         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.h:
1919         (WebCore::WHLSL::Metal::TypeNamer::generateNextTypeName):
1920         (WebCore::WHLSL::Metal::TypeNamer::generateNextStructureElementName):
1921         (WebCore::WHLSL::Metal::TypeNamer::generateNextEnumerationMemberName):
1922         * Modules/webgpu/WHLSL/WHLSLPrepare.h:
1923         Replace uses of String with the appropriate mangled name type.
1924
1925         * WebCore.xcodeproj/project.pbxproj:
1926         Add WHLSLMangledNames.h
1927
1928         * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
1929         (WebCore::trySetFunctions):
1930         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
1931         (WebCore::trySetFunctions):
1932         Convert the mangled names to Strings for passing to Metal API. NOTE: We could avoid having the
1933         toString() member function on MangledFunctionName if we allowed makeString() to take a single
1934         argument.
1935
1936 2019-08-04  Chris Dumez  <cdumez@apple.com>
1937
1938         Ping loads should not prevent page caching
1939         https://bugs.webkit.org/show_bug.cgi?id=200418
1940         <rdar://problem/53901632>
1941
1942         Reviewed by Darin Adler.
1943
1944         We normally prevent page caching if there were any pending subresource loads when navigating,
1945         to avoid caching partial / broken content. However, this should not apply to Ping / Beacon
1946         loads since those do not impact page rendering and can outlive the page.
1947
1948         Tests: http/tests/navigation/page-cache-pending-ping-load-cross-origin.html
1949                http/tests/navigation/page-cache-pending-ping-load-same-origin.html
1950
1951         * history/PageCache.cpp:
1952         (WebCore::PageCache::addIfCacheable):
1953         After we've fired the 'pagehide' event in each frame, stop all the loads again. This is needed
1954         since pages are allowed to start ping / beacon loads in their 'pagehide' handlers. If we do not
1955         stop those loads, then the next call to canCachePage() would fail because the DocumentLoader is
1956         still loading. Note that we're not actually preventing these ping loads from hitting the server
1957         since we never cancel page loads and those can outlive their page.
1958
1959         * loader/DocumentLoader.cpp:
1960         (WebCore::shouldPendingCachedResourceLoadPreventPageCache):
1961         (WebCore::areAllLoadersPageCacheAcceptable):
1962         Make sure that Ping / Beacon / Prefetches / Icon loads do not prevent page caching.
1963
1964         (WebCore::DocumentLoader::addSubresourceLoader):
1965         Tweak assertion that was incorrect since we actually allow ping / beacon loads when the
1966         document is about to enter PageCache (while firing pagehide event).
1967
1968 2019-08-04  Zalan Bujtas  <zalan@apple.com>
1969
1970         [LFC][TFC] Create formatting context/state.
1971         https://bugs.webkit.org/show_bug.cgi?id=200428
1972         <rdar://problem/53913625>
1973
1974         Reviewed by Antti Koivisto.
1975
1976         * layout/LayoutState.cpp:
1977         (WebCore::Layout::LayoutState::createFormattingStateForFormattingRootIfNeeded):
1978         (WebCore::Layout::LayoutState::createFormattingContext):
1979
1980 2019-08-04  Zalan Bujtas  <zalan@apple.com>
1981
1982         [LFC] Cleanup preferred width computation
1983         https://bugs.webkit.org/show_bug.cgi?id=200426
1984         <rdar://problem/53912607>
1985
1986         Reviewed by Antti Koivisto.
1987
1988         The intrinsic width for a formatting root box has 2 sets of values now. One set(min/max) is stored in the established formatting context's state
1989         while the other is in the formatting context's state where the box lives.
1990
1991         <div style="position: absolute"><div style="float: left; border: 1px solid green">foobar</div></div>
1992
1993         The float box participates in the formatting context established by the absolutely position box, but it also establishes an inline formatting context.
1994         The min/max width pair in the established context is the width of the "foobar" (same value for min/max). This set is stored in the inline formatting state.
1995         However the float box has horizontal border so the "final" min/max width pair is expanded by this border value and stored in the formatting state where
1996         the box lives (which is different from the one it establishes).
1997
1998         This and the "remove the formatting context type classes from the tree" changes open up interesting optimization opportunities.
1999         Here is a very simple case:
2000         <div style="display: inline-block; width: auto;">
2001           <div style="float: left">some text</div>
2002           <div style="float: left">some super long .... text</div>
2003           <div></div>
2004         </div>
2005         In order to lay out this content properly, we
2006         1. Compute the min/max width of the first float (expensive text measuring)
2007         2. Compute the min/max width of the second float (some more expensive text measuring)
2008         3. Compute the min/max width of the inline-block (that is pretty much the 2 float's min/max)
2009         4. Lay out the 2 floats, the empty div and the inline-block using these min/max width pairs.
2010
2011         Now if the inline-block box's display value is changed to "block" and the positioning is to absolute (style="display: box; position: absolute;")
2012         we currently(on trunk) tear down the render tree, build a new one and run all the steps again from #1 to #4.
2013
2014         In LFC, we start with the following layout tree
2015         <container> -> block formatting context
2016           <container> -> inline formatting context
2017             <anonymous inline box>
2018           <container> -> inline formatting context
2019             <anonymous inline box>
2020           <container> -> inline formatting context
2021         and when the style change happens, we don't need to tear down the tree at all. Not only that, but since every formatting contexts stay the same
2022         we can just reuse their states and actually skip all the steps (even the positioning since the absolutely positioned container has static top/bottom/left/right).
2023
2024         Surprisingly the final layout produces the exact same "display boxes" as the original layout.
2025
2026         * layout/FormattingContext.h:
2027         (WebCore::Layout::FormattingContext::IntrinsicWidthConstraints::expand):
2028         * layout/FormattingContextGeometry.cpp:
2029         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
2030         * layout/FormattingState.h:
2031         (WebCore::Layout::FormattingState::setIntrinsicWidthConstraints):
2032         (WebCore::Layout::FormattingState::intrinsicWidthConstraints const):
2033         (WebCore::Layout::FormattingState::setIntrinsicWidthConstraintsForBox):
2034         (WebCore::Layout::FormattingState::clearIntrinsicWidthConstraints):
2035         (WebCore::Layout::FormattingState::intrinsicWidthConstraintsForBox const):
2036         * layout/blockformatting/BlockFormattingContext.cpp:
2037         (WebCore::Layout::BlockFormattingContext::computedIntrinsicWidthConstraints const):
2038         (WebCore::Layout::BlockFormattingContext::computeIntrinsicWidthConstraints const): Deleted.
2039         * layout/blockformatting/BlockFormattingContext.h:
2040         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2041         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
2042         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraintsNeedChildrenWidth): Deleted.
2043         * layout/displaytree/DisplayBox.h:
2044         (WebCore::Display::Box::horizontalMarginBorderAndPadding const):
2045         * layout/inlineformatting/InlineFormattingContext.cpp:
2046         (WebCore::Layout::nextInPreOrder):
2047         (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints const):
2048         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingRoot const):
2049         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const): Deleted.
2050         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFloatBox const): Deleted.
2051         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForInlineBlock const): Deleted.
2052         * layout/inlineformatting/InlineFormattingContext.h:
2053         * layout/tableformatting/TableFormattingContext.cpp:
2054         (WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints const):
2055         * layout/tableformatting/TableFormattingContext.h:
2056
2057 2019-08-03  Devin Rousso  <drousso@apple.com>
2058
2059         Web Inspector: DOM: add a special breakpoint for "All Events"
2060         https://bugs.webkit.org/show_bug.cgi?id=200285
2061
2062         Reviewed by Joseph Pecoraro.
2063
2064         Similar to the existing "All Requests" breakpoint, there should be a way to set a breakpoint
2065         that would pause for any DOM event, regardless of the event's name. This is useful for
2066         situations where the event name isn't known, or where one simply want's to pause on the next
2067         entry to the event loop.
2068
2069         Along these lines, make the "requestAnimationFrame", "setTimeout", and "setInterval"
2070         event breakpoints into special breakpoints that can be added/removed via the create
2071         breakpoint context menu. This simplifies the process for setting these breakpoints, and also
2072         makes them more discoverable (most people wouldn't consider them to be "events").
2073
2074         Tests: inspector/dom/breakpoint-for-event-listener.html
2075                inspector/dom-debugger/event-animation-frame-breakpoints.html
2076                inspector/dom-debugger/event-breakpoint-with-navigation.html
2077                inspector/dom-debugger/event-interval-breakpoints.html
2078                inspector/dom-debugger/event-listener-breakpoints.html
2079                inspector/dom-debugger/event-timeout-breakpoints.html
2080
2081         * inspector/agents/InspectorDOMDebuggerAgent.h:
2082         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
2083         (WebCore::InspectorDOMDebuggerAgent::disable):
2084         (WebCore::InspectorDOMDebuggerAgent::frameDocumentUpdated):
2085         (WebCore::InspectorDOMDebuggerAgent::setEventBreakpoint):
2086         (WebCore::InspectorDOMDebuggerAgent::removeEventBreakpoint):
2087         (WebCore::InspectorDOMDebuggerAgent::willHandleEvent):
2088         (WebCore::InspectorDOMDebuggerAgent::willFireTimer):
2089         (WebCore::InspectorDOMDebuggerAgent::willFireAnimationFrame):
2090         (WebCore::InspectorDOMDebuggerAgent::discardBindings): Deleted.
2091         Make `eventName` optional for `addEventBreakpoint`/`removeEventBreakpoint`. When omitted,
2092         the corresponding breakpoint that is added/removed is treated as a global breakpoint that
2093         applies to all events of that type (e.g. a global `listener` breakpoint would pause for any
2094         event that is fired).
2095
2096 2019-08-03  Zalan Bujtas  <zalan@apple.com>
2097
2098         [LFC] Remove formatting context type leaf classes
2099         https://bugs.webkit.org/show_bug.cgi?id=200224
2100         <rdar://problem/53661907>
2101
2102         Reviewed by Antti Koivisto.
2103
2104         Let's keep the layout tree formatting context type independent.
2105
2106         * Sources.txt:
2107         * WebCore.xcodeproj/project.pbxproj:
2108         * layout/inlineformatting/InlineFormattingContext.cpp:
2109         (WebCore::Layout::InlineFormattingContext::layout const):
2110         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
2111         (WebCore::Layout::InlineFormattingContext::initializeMarginBorderAndPaddingForGenericInlineBox const):
2112         (WebCore::Layout::InlineFormattingContext::collectInlineContent const):
2113         * layout/inlineformatting/InlineFormattingContext.h:
2114         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
2115         (WebCore::Layout::inlineItemWidth):
2116         (WebCore::Layout::LineLayout::placeInlineItem):
2117         * layout/inlineformatting/InlineItem.h:
2118         * layout/inlineformatting/InlineTextItem.cpp:
2119         (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
2120         (WebCore::Layout::InlineTextItem::InlineTextItem):
2121         (WebCore::Layout::InlineTextItem::split const):
2122         * layout/inlineformatting/InlineTextItem.h:
2123         (WebCore::Layout::InlineTextItem::inlineBox const): Deleted.
2124         * layout/inlineformatting/text/TextUtil.cpp:
2125         (WebCore::Layout::TextUtil::width):
2126         (WebCore::Layout::TextUtil::split):
2127         * layout/inlineformatting/text/TextUtil.h:
2128         * layout/layouttree/LayoutBox.cpp:
2129         (WebCore::Layout::Box::Box):
2130         (WebCore::Layout::Box::~Box):
2131         (WebCore::Layout::Box::formattingContextRoot const):
2132         (WebCore::Layout::Box::setTextContent):
2133         (WebCore::Layout::Box::hasTextContent const):
2134         (WebCore::Layout::Box::textContent const):
2135         (WebCore::Layout::Box::replaced const):
2136         (WebCore::Layout::Box::replaced):
2137         (WebCore::Layout::Box::rareDataMap):
2138         (WebCore::Layout::Box::rareData const):
2139         (WebCore::Layout::Box::ensureRareData):
2140         (WebCore::Layout::Box::removeRareData):
2141         * layout/layouttree/LayoutBox.h:
2142         (WebCore::Layout::Box::isLineBreakBox const):
2143         (WebCore::Layout::Box::hasRareData const):
2144         (WebCore::Layout::Box::setHasRareData):
2145         (WebCore::Layout::Box::isInlineBox const): Deleted.
2146         (WebCore::Layout::Box::replaced const): Deleted.
2147         (WebCore::Layout::Box::replaced): Deleted.
2148         * layout/layouttree/LayoutContainer.h:
2149         (WebCore::Layout::Container::firstChild const): Deleted.
2150         (WebCore::Layout::Container::lastChild const): Deleted.
2151         (WebCore::Layout::Container::hasChild const): Deleted.
2152         (WebCore::Layout::Container::hasInFlowChild const): Deleted.
2153         (WebCore::Layout::Container::hasInFlowOrFloatingChild const): Deleted.
2154         (WebCore::Layout::Container::outOfFlowDescendants const): Deleted.
2155         * layout/layouttree/LayoutInlineBox.cpp: Removed.
2156         * layout/layouttree/LayoutInlineBox.h: Removed.
2157         * layout/layouttree/LayoutLineBreakBox.cpp: Removed.
2158         * layout/layouttree/LayoutLineBreakBox.h: Removed.
2159         * layout/layouttree/LayoutTreeBuilder.cpp:
2160         (WebCore::Layout::TreeBuilder::createLayoutBox):
2161         (WebCore::Layout::outputLayoutBox):
2162
2163 2019-08-03  Zalan Bujtas  <zalan@apple.com>
2164
2165         [LFC] Remove formatting context type container classes.
2166         https://bugs.webkit.org/show_bug.cgi?id=200202
2167
2168         Reviewed by Antti Koivisto.
2169
2170         These are formatting context specific classes. Let's try to have a layout tree without such types.
2171
2172         * Sources.txt:
2173         * WebCore.xcodeproj/project.pbxproj:
2174         * layout/blockformatting/BlockFormattingContext.cpp:
2175         (WebCore::Layout::BlockFormattingContext::computeIntrinsicWidthConstraints const):
2176         * layout/inlineformatting/InlineFormattingContext.cpp:
2177         (WebCore::Layout::InlineFormattingContext::layout const):
2178         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPaddingForInlineContainer const):
2179         * layout/inlineformatting/InlineFormattingContext.h:
2180         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
2181         (WebCore::Layout::InlineFormattingContext::InlineLayout::layout const):
2182         * layout/inlineformatting/InlineLine.cpp:
2183         (WebCore::Layout::Line::appendTextContent):
2184         * layout/layouttree/LayoutBlockContainer.cpp: Removed.
2185         * layout/layouttree/LayoutBlockContainer.h: Removed.
2186         * layout/layouttree/LayoutBox.cpp:
2187         (WebCore::Layout::Box::establishesInlineFormattingContext const):
2188         (WebCore::Layout::Box::establishesInlineFormattingContextOnly const):
2189         (WebCore::Layout::Box::formattingContextRoot const):
2190         * layout/layouttree/LayoutBox.h:
2191         (WebCore::Layout::Box::isBlockContainer const):
2192         (WebCore::Layout::Box::isInlineContainer const):
2193         (WebCore::Layout::Box::isInlineBox const):
2194         (WebCore::Layout::Box::establishesInlineFormattingContext const): Deleted.
2195         (WebCore::Layout::Box::establishesInlineFormattingContextOnly const): Deleted.
2196         * layout/layouttree/LayoutInlineContainer.cpp: Removed.
2197         * layout/layouttree/LayoutInlineContainer.h: Removed.
2198         * layout/layouttree/LayoutIterator.h:
2199         (WebCore::Layout::LayoutBoxTraversal::firstChild):
2200         * layout/layouttree/LayoutTreeBuilder.cpp:
2201         (WebCore::Layout::TreeBuilder::createLayoutTree):
2202         (WebCore::Layout::TreeBuilder::createLayoutBox):
2203         (WebCore::Layout::TreeBuilder::createTableStructure):
2204         (WebCore::Layout::outputLayoutBox):
2205         * layout/layouttree/LayoutTreeBuilder.h:
2206         * page/FrameViewLayoutContext.cpp:
2207         (WebCore::layoutUsingFormattingContext):
2208
2209 2019-08-02  Robin Morisset  <rmorisset@apple.com>
2210
2211         [WHLSL] Avoid visiting the full AST in computeDimensions
2212         https://bugs.webkit.org/show_bug.cgi?id=200410
2213
2214         Reviewed by Myles C. Maxfield.
2215
2216         Avoid visiting the full AST in computeDimensions
2217         This cuts the time spent in computeDimensions on compute_boids.html from about 2ms to about 0.002ms.
2218
2219         No new tests as there is no functional change intended.
2220
2221         * Modules/webgpu/WHLSL/WHLSLComputeDimensions.cpp:
2222         (WebCore::WHLSL::computeDimensions):
2223         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
2224
2225 2019-08-02  Ryosuke Niwa  <rniwa@webkit.org>
2226
2227         Ref Frame in DOMWindow::screen* functions
2228         https://bugs.webkit.org/show_bug.cgi?id=200409
2229
2230         Reviewed by Simon Fraser.
2231
2232         Ref Frame in the following functions.
2233
2234         * page/DOMWindow.cpp:
2235         (WebCore::DOMWindow::innerHeight const):
2236         (WebCore::DOMWindow::innerWidth const):
2237         (WebCore::DOMWindow::screenX const):
2238         (WebCore::DOMWindow::screenY const):
2239         (WebCore::DOMWindow::scrollX const):
2240         (WebCore::DOMWindow::scrollY const):
2241
2242 2019-08-02  Mark Lam  <mark.lam@apple.com>
2243
2244         [ARM64E] Harden the diversity of the DOMJIT::Signature::unsafeFunction pointer.
2245         https://bugs.webkit.org/show_bug.cgi?id=200292
2246         <rdar://problem/53706881>
2247
2248         Reviewed by Geoffrey Garen.
2249
2250         * bindings/scripts/CodeGeneratorJS.pm:
2251         (GenerateImplementation):
2252         - Update to work with the new DOMJIT::Signature constructor.
2253
2254         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2255         - Re-base test results.
2256
2257 2019-08-02  Keith Rollin  <krollin@apple.com>
2258
2259         Consistently use Obj-C boolean literals
2260         https://bugs.webkit.org/show_bug.cgi?id=200405
2261         <rdar://problem/53880043>
2262
2263         Reviewed by Simon Fraser, Joseph Pecoraro.
2264
2265         There are places where we use equivalent but different expressions for
2266         Obj-C boolean objects. For example, we use both [NSNumber
2267         numberWithBool:YES] and @YES. There are places where both are used in
2268         the same function, such as -[WebPreferences initialize]. The boolean
2269         literal is in greater use and is more succinct, so standardize on
2270         that. Also, change @(YES/NO) to @YES/NO.
2271
2272         No new tests -- no new or changed functionality.
2273
2274         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2275         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
2276         * platform/graphics/cv/ImageTransferSessionVT.mm:
2277         (WebCore::ImageTransferSessionVT::ImageTransferSessionVT):
2278         (WebCore::ImageTransferSessionVT::setSize):
2279         (WebCore::ImageTransferSessionVT::ioSurfacePixelBufferCreationOptions):
2280         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
2281         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferPool):
2282         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
2283         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
2284         * platform/network/mac/ResourceHandleMac.mm:
2285         (WebCore::ResourceHandle::applySniffingPoliciesIfNeeded):
2286
2287 2019-08-02  Andres Gonzalez  <andresg_22@apple.com>
2288
2289         Add accessibility object method to determine whether an element is inside a table cell. Needed for iOS accessibility client.
2290         https://bugs.webkit.org/show_bug.cgi?id=200394
2291         <rdar://problem/52914964>
2292
2293         Reviewed by Chris Fleizach.
2294
2295         Explicitly returning BOOL to avoid error in some compiler configurations.
2296         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2297         (-[WebAccessibilityObjectWrapper _accessibilityIsInTableCell]):
2298
2299 2019-08-02  Devin Rousso  <drousso@apple.com>
2300
2301         Web Inspector: fix inverted check in InspectorDOMStorageAgent::enable
2302         Followup to r248179.
2303
2304         Rubber-stamped by Joseph Pecoraro.
2305
2306         * inspector/agents/InspectorDOMStorageAgent.cpp:
2307         (WebCore::InspectorDOMStorageAgent::enable):
2308
2309 2019-08-02  Fujii Hironori  <Hironori.Fujii@sony.com>
2310
2311         [Curl] Crash while destructing a URL in ~SocketStreamHandle due to data race
2312         https://bugs.webkit.org/show_bug.cgi?id=200378
2313
2314         Reviewed by Ross Kirsling.
2315
2316         URL::isolatedCopy() is called in the worker thread. URL is using a
2317         thread-unsafe ref-counter. It should be called in the main thread.
2318
2319         Covered by existing tests.
2320
2321         * platform/network/curl/SocketStreamHandleImpl.h:
2322         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
2323         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl): Call URL::isolatedCopy() in the main thread.
2324         (WebCore::SocketStreamHandleImpl::threadEntryPoint): Added a URL argument.
2325
2326 2019-08-02  Sihui Liu  <sihui_liu@apple.com>
2327
2328         API tests using permanent credentials should clear credentials left by previous tests
2329         https://bugs.webkit.org/show_bug.cgi?id=199729
2330
2331         Reviewed by Alex Christensen.
2332
2333         Update existing API tests.
2334
2335         * platform/network/CredentialStorage.cpp:
2336         (WebCore::CredentialStorage::clearSessionCredentials):
2337         (WebCore::CredentialStorage::clearPermanentCredentialsForProtectionSpace): Deleted.
2338         * platform/network/CredentialStorage.h:
2339         * platform/network/mac/CredentialStorageMac.mm:
2340         (WebCore::CredentialStorage::clearPermanentCredentialsForProtectionSpace): Deleted.
2341
2342 2019-08-02  Devin Rousso  <drousso@apple.com>
2343
2344         Web Inspector: Storage: disable related agents when the tab is closed
2345         https://bugs.webkit.org/show_bug.cgi?id=200117
2346
2347         Reviewed by Joseph Pecoraro.
2348
2349         Rework how `enable`/`disable` is used for storage-related agents so that events are not sent
2350         and data isn't kept alive when the Storage tab isn't enabled.
2351
2352         Covered by existing tests.
2353
2354         * inspector/agents/InspectorApplicationCacheAgent.h:
2355         * inspector/agents/InspectorApplicationCacheAgent.cpp:
2356         (WebCore::InspectorApplicationCacheAgent::willDestroyFrontendAndBackend):
2357         (WebCore::InspectorApplicationCacheAgent::enable):
2358         (WebCore::InspectorApplicationCacheAgent::disable): Added.
2359
2360         * inspector/agents/InspectorDOMStorageAgent.cpp:
2361         (WebCore::InspectorDOMStorageAgent::enable):
2362         (WebCore::InspectorDOMStorageAgent::disable):
2363
2364         * inspector/agents/InspectorDatabaseAgent.cpp:
2365         (WebCore::InspectorDatabaseAgent::enable):
2366         (WebCore::InspectorDatabaseAgent::disable):
2367
2368 2019-08-02  Devin Rousso  <drousso@apple.com>
2369
2370         Web Inspector: Timelines: Develop > Start Timeline Recording doesn't work when focused on a detached inspector window
2371         https://bugs.webkit.org/show_bug.cgi?id=200125
2372         <rdar://problem/53543008>
2373
2374         Reviewed by Brian Burg.
2375
2376         Always show the Timelines tab in Web Inspector whenever timeline recording starts/stops.
2377         Notify the UIProcess whenever the timeline recording state changes.
2378
2379         * inspector/InspectorClient.h:
2380         (WebCore::InspectorClient::timelineRecordingChanged): Added.
2381
2382         * inspector/agents/InspectorTimelineAgent.h:
2383         * inspector/agents/InspectorTimelineAgent.cpp:
2384         (WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
2385         (WebCore::InspectorTimelineAgent::internalStart):
2386         (WebCore::InspectorTimelineAgent::internalStop):
2387
2388 2019-08-02  Yury Semikhatsky  <yurys@chromium.org>
2389
2390         Web Inspector: Crash when interacting with Template Content in Console
2391         https://bugs.webkit.org/show_bug.cgi?id=196280
2392
2393         Reviewed by Joseph Pecoraro.
2394
2395         Test: inspector/dom/inspect-template-node.html
2396
2397         * bindings/js/JSDOMBindingSecurity.cpp:
2398         (WebCore::canAccessDocument): if target element is from a
2399         <template> use its host document to check the access. Elements
2400         from the host document always have access to its template elements content.
2401         * inspector/agents/InspectorDOMAgent.cpp:
2402         (WebCore::InspectorDOMAgent::resolveNode): templates are created in
2403         special template document which doesn't have a frame, in such case get
2404         the frame from the host document.
2405
2406 2019-08-02  Ryosuke Niwa  <rniwa@webkit.org>
2407
2408         Harden NodeRareData::m_connectedFrameCount
2409         https://bugs.webkit.org/show_bug.cgi?id=200300
2410
2411         Reviewed by Geoffrey Garen.
2412
2413         Use unsinged integer type in NodeRareData::m_connectedFrameCount since it's padded anyway.
2414
2415         * dom/Node.cpp:
2416         (WebCore::Node::decrementConnectedSubframeCount): Check that hasRareNode() is true in release builds.
2417         * dom/NodeRareData.h:
2418
2419 2019-08-02  Ryosuke Niwa  <rniwa@webkit.org>
2420
2421         Document::resume should delay resetting of form control elements.
2422         https://bugs.webkit.org/show_bug.cgi?id=200376
2423
2424         Reviewed by Geoffrey Garen.
2425
2426         Delay the execution of form control element resets until the next task
2427         to avoid synchronously mutating DOM during page cache restoration.
2428
2429         Test: fast/frames/restoring-page-cache-should-not-run-scripts.html
2430
2431         * html/HTMLFormElement.cpp:
2432         (WebCore::HTMLFormElement::resumeFromDocumentSuspension):
2433         * html/HTMLInputElement.cpp:
2434         (WebCore::HTMLInputElement::resumeFromDocumentSuspension):
2435
2436 2019-08-02  Youenn Fablet  <youenn@apple.com>
2437
2438         [iOS] Directly use RealtimeMediaSourceCenter to compute the media capture  state
2439         https://bugs.webkit.org/show_bug.cgi?id=200368
2440         <rdar://problem/53191450>
2441
2442         Unreviewed.
2443         Build fix by guarding with MEDIA_STREAM in addition to IOS.
2444
2445         * dom/Document.cpp:
2446         (WebCore::Document::updateIsPlayingMedia):
2447         (WebCore::Document::pageMutedStateDidChange):
2448
2449 2019-08-02  Andres Gonzalez  <andresg_22@apple.com>
2450
2451         Add accessibility object method to determine whether an element is inside a table cell. Needed for iOS accessibility client.
2452         https://bugs.webkit.org/show_bug.cgi?id=200394
2453         <rdar://problem/52914964>
2454
2455         Reviewed by Chris Fleizach.
2456
2457         Test: accessibility/ios-simulator/element-in-table-cell.html
2458
2459         Added _accessibilityIsInTableCell needed for iOS accessibility client.
2460         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2461         (-[WebAccessibilityObjectWrapper _accessibilityIsInTableCell]):
2462
2463 2019-08-02  Eric Carlson  <eric.carlson@apple.com>
2464
2465         [macOS, iOS] webaudio/silent-audio-interrupted-in-background.html sometimes crashes
2466         https://bugs.webkit.org/show_bug.cgi?id=200396
2467         <rdar://problem/53819720>
2468
2469         Reviewed by Youenn Fablet.
2470
2471         No new test, this fixes an existing test.
2472
2473         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
2474         (WebCore::AudioSourceProviderAVFObjC::~AudioSourceProviderAVFObjC): Drop the
2475         lock before clearing m_tapStorage. 
2476
2477 2019-08-02  Youenn Fablet  <youenn@apple.com>
2478
2479         [iOS] Directly use RealtimeMediaSourceCenter to compute the media capture  state
2480         https://bugs.webkit.org/show_bug.cgi?id=200368
2481         <rdar://problem/53191450>
2482
2483         Reviewed by Eric Carlson.
2484
2485         Instead of registering a MediaStreamTrack as a media producer to compute capture state,
2486         go directly to the sources from the RealtimeMediaSourceCenter.
2487         Do the same when requested to mute capture tracks.
2488
2489         No observable change of behavior.
2490         Covered by manual test on iOS and existing tests.
2491
2492         * Modules/mediastream/MediaStreamTrack.cpp:
2493         (WebCore::MediaStreamTrack::MediaStreamTrack):
2494         (WebCore::MediaStreamTrack::~MediaStreamTrack):
2495         (WebCore::MediaStreamTrack::mediaState const):
2496         (WebCore::sourceCaptureState):
2497         (WebCore::MediaStreamTrack::captureState):
2498         (WebCore::MediaStreamTrack::muteCapture):
2499         * Modules/mediastream/MediaStreamTrack.h:
2500         * dom/Document.cpp:
2501         (WebCore::Document::updateIsPlayingMedia):
2502         (WebCore::Document::pageMutedStateDidChange):
2503
2504 2019-08-02  Chris Dumez  <cdumez@apple.com>
2505
2506         DOMWindow properties may get GC'd before their Window object
2507         https://bugs.webkit.org/show_bug.cgi?id=200359
2508
2509         Reviewed by Ryosuke Niwa.
2510
2511         DOMWindow properties may get GC'd before their Window object once their frame is detached. This
2512         is unexpected behavior given that these properties persist on the Window after the frame is
2513         detached. This patch thus updates their bindings so that they live as long as their window, not
2514         their frame.
2515
2516         Note that this also fixes a thread-safety issue since DOMWindowProperty::frame() would get called
2517         from GC threads, although its implementation looks like:
2518         """
2519           return m_window ? m_window->frame() : nullptr;
2520         """
2521
2522         Because m_window is a WeakPtr<DOMWindow> and because windows get destroyed on the main thread,
2523         we could in theory crash when dereferencing m_window->frame() from the GC thread.
2524
2525         Test: fast/dom/dom-window-property-gc-after-frame-detach.html
2526
2527         * bindings/js/JSDOMWindowCustom.cpp:
2528         (WebCore::JSDOMWindow::visitAdditionalChildren):
2529         * bindings/scripts/CodeGeneratorJS.pm:
2530         (GenerateImplementation):
2531         * bindings/scripts/IDLAttributes.json:
2532         * css/StyleMedia.idl:
2533         * loader/appcache/DOMApplicationCache.idl:
2534         * page/BarProp.idl:
2535         * page/DOMSelection.idl:
2536         * page/History.idl:
2537         * page/Location.idl:
2538         * page/Navigator.idl:
2539         * page/Screen.idl:
2540         * page/VisualViewport.idl:
2541         * plugins/DOMMimeTypeArray.idl:
2542         * plugins/DOMPluginArray.idl:
2543         * storage/Storage.idl:
2544
2545 2019-08-02  Konstantin Tokarev  <annulen@yandex.ru>
2546
2547         Remove constructors and operators of FontPlatformData defined only for Freetype
2548         https://bugs.webkit.org/show_bug.cgi?id=200379
2549
2550         Reviewed by Carlos Garcia Campos.
2551
2552         These methods only make maintenance harder, as all data fields are
2553         trivially copyable. Constructors generated by compiler should be used
2554         instead.
2555
2556         * platform/graphics/FontPlatformData.h:
2557         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
2558
2559 2019-08-02  Konstantin Tokarev  <annulen@yandex.ru>
2560
2561         Remove unused constructor declaration from FontPlatformData
2562         https://bugs.webkit.org/show_bug.cgi?id=200371
2563
2564         Reviewed by Carlos Garcia Campos.
2565
2566         It is not implemented by any port.
2567
2568         * platform/graphics/FontPlatformData.h:
2569
2570 2019-08-01  Chris Dumez  <cdumez@apple.com>
2571
2572         Pages using MessagePorts should be PageCacheable
2573         https://bugs.webkit.org/show_bug.cgi?id=200366
2574         <rdar://problem/53837882>
2575
2576         Reviewed by Geoffrey Garen.
2577
2578         Allow a page to enter PageCache, even if it has MessagePorts (potentially with
2579         pending messages). If there are pending messages on the MessagePorts when
2580         entering PageCache, those will get dispatched upon restoring from PageCache.
2581
2582         Test: fast/history/page-cache-MessagePort-pending-message.html
2583
2584         * dom/MessagePort.cpp:
2585         (WebCore::MessagePort::messageAvailable):
2586         (WebCore::MessagePort::dispatchMessages):
2587         Do not dispatch messages while in PageCache.
2588
2589         (WebCore::MessagePort::canSuspendForDocumentSuspension const):
2590         Allow pages with MessagePort objects to enter PageCache.
2591
2592         * dom/ScriptExecutionContext.cpp:
2593         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
2594         Make sure pending messages on MessagePorts get dispatched asynchronously after restoring
2595         from PageCache.
2596
2597         * loader/DocumentLoader.cpp:
2598         (WebCore::areAllLoadersPageCacheAcceptable):
2599         Make sure only CachedResources that are still loading upon load cancelation prevent
2600         entering PageCache.
2601
2602 2019-08-01  Konstantin Tokarev  <annulen@yandex.ru>
2603
2604         Fix compilation of PageConsoleClient with !ENABLE(VIDEO)
2605         https://bugs.webkit.org/show_bug.cgi?id=200380
2606
2607         Reviewed by Joseph Pecoraro.
2608
2609         * page/PageConsoleClient.cpp:
2610         (WebCore::PageConsoleClient::screenshot):
2611
2612 2019-08-01  Mark Lam  <mark.lam@apple.com>
2613
2614         Add crash diagnostics for debugging unexpected zapped cells.
2615         https://bugs.webkit.org/show_bug.cgi?id=200149
2616         <rdar://problem/53570112>
2617
2618         Reviewed by Yusuke Suzuki.
2619
2620         No new tests because this is a feature for debugging crashes.  It has been tested
2621         manually by modifying the code to force a crash at the point of interest.
2622
2623         Added some comments to document the hashes of known subspaces.
2624
2625         * bindings/js/WebCoreJSClientData.cpp:
2626         (WebCore::JSVMClientData::JSVMClientData):
2627
2628 2019-08-01  Saam Barati  <sbarati@apple.com>
2629
2630         [WHLSL] Do simple nullptr check elimination using basic data flow analysis when generating metal code
2631         https://bugs.webkit.org/show_bug.cgi?id=200352
2632
2633         Reviewed by Myles C. Maxfield.
2634
2635         When doing metal code generation, we frequently know whether something
2636         is null or not. This patch does a basic propagation of this information
2637         to avoid emitting excessive null checks in the generated Metal code.
2638         This is a 6% speedup (with a p value of 0.0001) in Metal compile times
2639         on compute_boids.
2640
2641         An example of a null check we now eliminate is:
2642         ```
2643         int x;
2644         thread int* ptr = &x; // We know that the lvalue for "x" is non-null, so we produce a non-null rvalue here.
2645         *ptr = 42; // We know that the "ptr" rvalue is non-null, so we omit the null check.
2646         ```
2647
2648         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
2649         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValueWithNullability):
2650         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendRightValue):
2651         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::appendLeftValue):
2652         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastValueAndNullability):
2653         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::takeLastLeftValue):
2654         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
2655
2656 2019-08-01  Alex Christensen  <achristensen@webkit.org>
2657
2658         Move FormData zip file generation to NetworkProcess and enable it for all WebKit clients for uploading directories
2659         https://bugs.webkit.org/show_bug.cgi?id=200102
2660         <rdar://problem/53275114>
2661
2662         Reviewed by Darin Adler.
2663
2664         To enable directory uploading in WebKit2, we extended WebKit1's model of asking the application to generate a file for uploading.
2665         This means the WebProcess needed access to everything necessary to zip a whole directory, and clients that have not implemented
2666         the strange WKBundlePageUIClient callbacks won't be able to upload directories.  Safari's implementation had already been copied
2667         to BlobDataFileReference::generateReplacementFile, so I reused that code to do the zipping.  Instead of a complicated model of
2668         keeping track of a filename, possibly a generated filename, and whether we think we own the file or not and having nobody clean up,
2669         we now do the generation, use, and cleaning up in the network process starting with a new function generateFilesForUpload.
2670         This removes unimplemented SPI in WebUIDelegatePrivate in WebKitLegacy and stops calling the WKBundlePageUIClient related to upload
2671         file generation and replaces them with automatic behavior equivalent to Safari's implementation of the WKBundlePageUIClient calls.
2672         Since we no longer need to do these file operations in the WebProcess, I am also reverting r245322 and r246077 which tightens the sandbox.
2673
2674         Covered by an API test.
2675
2676         * Modules/fetch/FetchBody.cpp:
2677         (WebCore::FetchBody::extract):
2678         (WebCore::FetchBody::bodyAsFormData const):
2679         * loader/FormSubmission.cpp:
2680         (WebCore::FormSubmission::create):
2681         * loader/FrameLoader.cpp:
2682         (WebCore::FrameLoader::submitForm):
2683         (WebCore::FrameLoader::loadDifferentDocumentItem):
2684         * loader/ResourceLoader.cpp:
2685         (WebCore::ResourceLoader::didReceiveResponse):
2686         (WebCore::ResourceLoader::cleanupForError):
2687         * page/Chrome.cpp:
2688         (WebCore::ChromeClient::shouldReplaceWithGeneratedFileForUpload): Deleted.
2689         (WebCore::ChromeClient::generateReplacementFile): Deleted.
2690         * page/ChromeClient.h:
2691         * platform/network/FormData.cpp:
2692         (WebCore::FormData::FormData):
2693         (WebCore::FormData::~FormData):
2694         (WebCore::FormData::createMultiPart):
2695         (WebCore::FormDataElement::lengthInBytes const):
2696         (WebCore::FormData::appendFile):
2697         (WebCore::FormData::appendFileRange):
2698         (WebCore::FormData::appendMultiPartFileValue):
2699         (WebCore::FormData::appendMultiPartKeyValuePairItems):
2700         (WebCore::FormData::resolveBlobReferences):
2701         (WebCore::generateFileForUpload):
2702         (WebCore::FormData::generateFilesForUpload):
2703         (WebCore::FormData::generateFiles): Deleted.
2704         (WebCore::FormData::hasGeneratedFiles const): Deleted.
2705         (WebCore::FormData::hasOwnedGeneratedFiles const): Deleted.
2706         (WebCore::FormData::removeGeneratedFilesIfNeeded): Deleted.
2707         * platform/network/FormData.h:
2708         (WebCore::FormDataElement::FormDataElement):
2709         (WebCore::FormDataElement::EncodedFileData::isolatedCopy const):
2710         (WebCore::FormDataElement::EncodedFileData::operator== const):
2711         (WebCore::FormDataElement::EncodedFileData::encode const):
2712         (WebCore::FormDataElement::EncodedFileData::decode):
2713         * platform/network/cf/FormDataStreamCFNet.cpp:
2714         (WebCore::advanceCurrentStream):
2715         (WebCore::formCreate):
2716         (WebCore::formFinalize):
2717         (WebCore::createHTTPBodyCFReadStream):
2718         * platform/network/mac/BlobDataFileReferenceMac.mm:
2719         (WebCore::generateFileForUpload):
2720         (WebCore::BlobDataFileReference::generateReplacementFile):
2721         * xml/XMLHttpRequest.cpp:
2722         (WebCore::XMLHttpRequest::send):
2723
2724 2019-08-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2725
2726         [Text autosizing] [iPadOS] Add targeted hacks to address some remaining text autosizing issues
2727         https://bugs.webkit.org/show_bug.cgi?id=200271
2728         <rdar://problem/51734741>
2729
2730         Reviewed by Zalan Bujtas.
2731
2732         Makes some targeted adjustments to the text autosizing heuristic, to ensure compatibility with several high-
2733         profile websites. See changes below for more detail.
2734
2735         Tests:  fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidate-special-cases.html
2736                 fast/text-autosizing/ios/idempotentmode/line-height-boosting.html
2737
2738         * css/StyleResolver.cpp:
2739         (WebCore::StyleResolver::adjustRenderStyleForTextAutosizing):
2740
2741         Avoid clipped sidebar links on sohu.com by not performing line-height boosting in the case where the element
2742         probably has a small, fixed number of lines. See below for more detail. Additionally, don't attempt to adjust
2743         the line height using the boosted font size, in the case where the element is not a candidate for idempotent
2744         text autosizing.
2745
2746         * rendering/style/RenderStyle.cpp:
2747         (WebCore::RenderStyle::isIdempotentTextAutosizingCandidate const):
2748
2749         Make various targeted hacks to fix a few websites:
2750
2751         -   Add a special case for top navigation bar links on yandex.ru, where line height greatly exceeds the
2752             specified font size.
2753
2754         -   Avoid boosting some related video links on v.youku.com by considering the line-clamp CSS property when
2755             determining the maximum number of lines of text an element is expected to contain.
2756
2757         -   Avoid boosting some front page links on asahi.com, which have non-repeating background images.
2758
2759         -   Add several other adjustments to more aggressively boost pieces of text on Google search results, such as
2760             taking the `word-break` CSS property into account.
2761
2762         The bottom few pixels of sidebar links on naver.com are also no longer clipped after these changes.
2763
2764         * rendering/style/TextSizeAdjustment.cpp:
2765         (WebCore::AutosizeStatus::probablyContainsASmallFixedNumberOfLines):
2766
2767         Pulls out a piece of the heuristic added to fix sephora.com in r247467 out into a separate helper method. To
2768         recap, this heuristic identifies elements with both a fixed height and fixed line height, for which the fixed
2769         height is close to an integer multiple of the line height.
2770
2771         Also makes several small tweaks in the process: (1) change the max difference between fixed line height and
2772         font size from 6 to 5 to ensure that some multiline caption text on Google search results is boosted, and (2)
2773         replace usages of `lineHeight()` with `specifiedLineHeight()`, which current prevents this function from being
2774         truly idempotent.
2775
2776         (WebCore::AutosizeStatus::updateStatus):
2777         * rendering/style/TextSizeAdjustment.h:
2778
2779 2019-07-31  Mark Lam  <mark.lam@apple.com>
2780
2781         Rename DOMJIT safe/unsafeFunction to functionWithTypeChecks and functionWithoutTypeChecks.
2782         https://bugs.webkit.org/show_bug.cgi?id=200323
2783
2784         Reviewed by Yusuke Suzuki.
2785
2786         No new tests.  This is just a refactoring exercise.
2787
2788         * bindings/scripts/CodeGeneratorJS.pm:
2789         (GetArgumentTypeForFunctionWithoutTypeCheck):
2790         (GenerateImplementation):
2791         (GenerateOperationDefinition):
2792         (ToNativeForFunctionWithoutTypeCheck):
2793         (GetUnsafeArgumentType): Deleted.
2794         (UnsafeToNative): Deleted.
2795         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2796         (WebCore::jsTestDOMJITPrototypeFunctionGetAttributeWithoutTypeCheck):
2797         (WebCore::jsTestDOMJITPrototypeFunctionItemWithoutTypeCheck):
2798         (WebCore::jsTestDOMJITPrototypeFunctionHasAttributeWithoutTypeCheck):
2799         (WebCore::jsTestDOMJITPrototypeFunctionGetElementByIdWithoutTypeCheck):
2800         (WebCore::jsTestDOMJITPrototypeFunctionGetElementsByNameWithoutTypeCheck):
2801         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetAttribute): Deleted.
2802         (WebCore::unsafeJsTestDOMJITPrototypeFunctionItem): Deleted.
2803         (WebCore::unsafeJsTestDOMJITPrototypeFunctionHasAttribute): Deleted.
2804         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementById): Deleted.
2805         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementsByName): Deleted.
2806
2807 2019-08-01  Carlos Garcia Campos  <cgarcia@igalia.com>
2808
2809         [SOUP] WebSockets: add support for extensions when using web sockets libsoup API
2810         https://bugs.webkit.org/show_bug.cgi?id=199943
2811
2812         Reviewed by Alex Christensen.
2813
2814         Add SOUP_TYPE_WEBSOCKET_EXTENSION_MANAGER feature to the soup session to enable WebSocket extensions.
2815
2816         Tests: http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-comp-bit-onoff.html
2817                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-invalid-parameter.html
2818                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-parameter.html
2819                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-set-bfinal.html
2820                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-split-frames.html
2821                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-unsolicited-negotiation-response.html
2822                http/tests/websocket/tests/hybi/imported/blink/permessage-deflate-window-bits.html
2823
2824         * platform/network/soup/SoupNetworkSession.cpp:
2825         (WebCore::SoupNetworkSession::SoupNetworkSession):
2826
2827 2019-08-01  Chris Dumez  <cdumez@apple.com>
2828
2829         [iOS][WK1] Unsafe unsafe of WeakPtr<Document> from UIThread under PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit()
2830         https://bugs.webkit.org/show_bug.cgi?id=200324
2831
2832         Reviewed by Ryosuke Niwa.
2833
2834         The Document is a WebThread object, but a WeakPtr<Document> was dereferenced from the
2835         UIThread in HTMLMediaElement::supportsSeeking(), from the PlaybackSessionInterfaceAVKit
2836         constructor. To address the issue we now grab the WebThread lock before constructing
2837         the PlaybackSessionInterfaceAVKit.
2838
2839         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2840         (VideoFullscreenControllerContext::setUpFullscreen):
2841
2842 2019-08-01  Carlos Garcia Campos  <cgarcia@igalia.com>
2843
2844         [SOUP] Switch to use libsoup WebSockets API
2845         https://bugs.webkit.org/show_bug.cgi?id=200162
2846
2847         Reviewed by Michael Catanzaro.
2848
2849         Use the libsoup WebSockets API unconditionally for libsoup based ports.
2850
2851         * Modules/websockets/ThreadableWebSocketChannel.cpp:
2852         (WebCore::ThreadableWebSocketChannel::create): Do not check the env var anymore.
2853         * platform/SourcesSoup.txt:
2854         * platform/network/SocketStreamHandleImpl.cpp:
2855         * platform/network/StorageSessionProvider.h:
2856         * platform/network/soup/SocketStreamHandleImpl.h:
2857         * platform/network/soup/SocketStreamHandleImplSoup.cpp: Removed.
2858
2859 2019-07-31  Devin Rousso  <drousso@apple.com>
2860
2861         Web Inspector: Debugger: support emulateUserGesture parameter in Debugger.evaluateOnCallFrame
2862         https://bugs.webkit.org/show_bug.cgi?id=200272
2863
2864         Reviewed by Joseph Pecoraro.
2865
2866         When paused, evaluating in the console should still respect the "Emulate User Gesture" checkbox.
2867
2868         Tests: inspector/debugger/evaluateOnCallFrame-emulateUserGesture.html
2869                inspector/debugger/evaluateOnCallFrame-emulateUserGesture-userIsInteracting.html
2870
2871         * inspector/agents/page/PageDebuggerAgent.h:
2872         * inspector/agents/page/PageDebuggerAgent.cpp:
2873         (WebCore::PageDebuggerAgent::evaluateOnCallFrame): Added.
2874
2875 2019-07-31  Saam Barati  <sbarati@apple.com>
2876
2877         [WHLSL] Replace memsetZero function with inline "= { }" code
2878         https://bugs.webkit.org/show_bug.cgi?id=200328
2879
2880         Reviewed by Robin Morisset.
2881
2882         This is a ~20ms metal compile time improvement on compute_boids.
2883
2884         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
2885         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
2886         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
2887         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
2888         (WebCore::WHLSL::Metal::writeNativeFunction):
2889         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.h:
2890
2891 2019-07-31  Andy Estes  <aestes@apple.com>
2892
2893         REGRESSION (r240942): first visually non-empty layout milestone is not reached in media documents until after the video finishes loading
2894         https://bugs.webkit.org/show_bug.cgi?id=200293
2895         <rdar://problem/52937749>
2896
2897         Reviewed by Alex Christensen.
2898
2899         r240942 changed FrameView::qualifiesAsVisuallyNonEmpty() to consider only documents in the
2900         Interactive or Complete ready states as "finished parsing". Documents considered finished
2901         parsing can qualify as visually non-empty even without exceeding the visual character or
2902         pixel thresholds, but documents considered not finished must first exceed one of these
2903         thresholds in order to qualify as visually non-empty.
2904
2905         HTMLDocuments are placed in the Interactive ready state by their HTMLDocumentParsers.
2906         However, HTMLDocument subclasses like ImageDocument and MediaDocument use their own custom
2907         parsers that never set the Interactive ready state on their documents; these documents go
2908         from Loading directly to Complete.
2909
2910         In order for these HTMLDocument subclasses to be considered visually non-empty before they
2911         finish loading they must render something that exceeds the visual character or pixel
2912         thresholds. For image documents, rendering the image is usually enough to cross the
2913         threshold, but for media documents the visual pixel threshold was never crossed because
2914         videos did not contribute to the visually non-empty pixel count.
2915
2916         As a result, media documents are not considered visually non-empty until the main resource
2917         finishes loading. On iOS this means that the layer tree remains frozen until this point,
2918         even though the media might have started autoplaying with audio long before it finished
2919         loading.
2920
2921         Fix this by teaching RenderVideo to contribute the video player's size to FrameView's
2922         visually non-empty pixel count once the video player has loaded enough data to determine its
2923         intrinsic size. Videos that render more than 1024 pixels will qualify a media document as
2924         visually non-empty even when it is still loading its main resource.
2925
2926         Added a new API test.
2927
2928         * rendering/RenderImage.cpp:
2929         (WebCore::RenderImage::imageChanged):
2930         (WebCore::RenderImage::incrementVisuallyNonEmptyPixelCountIfNeeded):
2931         * rendering/RenderImage.h:
2932         * rendering/RenderVideo.cpp:
2933         (WebCore::RenderVideo::updateIntrinsicSize):
2934
2935 2019-07-31  Saam Barati  <sbarati@apple.com>
2936
2937         [WHLSL] Remove UnnamedType copy/move constructors and mark classes as final
2938         https://bugs.webkit.org/show_bug.cgi?id=200188
2939         <rdar://problem/53628171>
2940
2941         Unreviewed followup.
2942
2943         As Darin pointed out in the bugzilla comments, when defining a copy
2944         constructor in C++ (either deleted or an implementation), the move
2945         constructor is implicitly deleted. This match removes the excessive
2946         use of WTF_MAKE_NONMOVABLE when we're already using WTF_MAKE_NONCOPYABLE.
2947
2948         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
2949         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
2950         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
2951         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
2952         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
2953         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
2954
2955 2019-07-31  Zalan Bujtas  <zalan@apple.com>
2956
2957         [ContentChangeObserver] twitch.tv video controls do not always respond to taps in fullscreen
2958         https://bugs.webkit.org/show_bug.cgi?id=200309
2959         <rdar://problem/52964977>
2960
2961         Reviewed by Simon Fraser.
2962
2963         Do not consider an element visible if it is not a descendant of the active fullscreen element.
2964
2965         This patch fixes the cases when the user taps on a button in fullscreen mode while the non-fullscreen content is being mutated and
2966         the ContentChangeObserver mistakenly registers it as a valid, actionable change and as a result we don't fire the click event (stay at hover).
2967
2968         Test: fast/events/touch/ios/content-observation/non-visible-content-change-in-fullscreen-mode.html
2969
2970         * page/ios/ContentChangeObserver.cpp:
2971         (WebCore::fullscreenElement):
2972         (WebCore::ContentChangeObserver::isVisuallyHidden):
2973
2974 2019-07-31  Saam Barati  <sbarati@apple.com>
2975
2976         [WHLSL Remove char/short/half types
2977         https://bugs.webkit.org/show_bug.cgi?id=200312
2978
2979         Reviewed by Myles C. Maxfield.
2980
2981         This patch removes the char/short/half types from WHLSL. Since it's not
2982         supported by all HW, WebGPU is leaving these types out for now. This is
2983         also a huge speedup, since it halves the size of the standard library.
2984         
2985         In the compute_boids demo, WHLSL::prepare goes from running in ~140ms to
2986         running in ~60ms.
2987
2988         Test: webgpu/whlsl/smaller-than-32-bit-types.html
2989
2990         * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp:
2991         (WebCore::WHLSL::Metal::writeNativeType):
2992         * Modules/webgpu/WHLSL/WHLSLIntrinsics.cpp:
2993         (WebCore::WHLSL::Intrinsics::addPrimitive):
2994         (WebCore::WHLSL::Intrinsics::addVector):
2995         (WebCore::WHLSL::Intrinsics::addMatrix):
2996         * Modules/webgpu/WHLSL/WHLSLIntrinsics.h:
2997         (WebCore::WHLSL::Intrinsics::WTF_ARRAY_LENGTH):
2998         (WebCore::WHLSL::Intrinsics::ucharType const): Deleted.
2999         (WebCore::WHLSL::Intrinsics::ushortType const): Deleted.
3000         (WebCore::WHLSL::Intrinsics::charType const): Deleted.
3001         (WebCore::WHLSL::Intrinsics::shortType const): Deleted.
3002         (WebCore::WHLSL::Intrinsics::uchar2Type const): Deleted.
3003         (WebCore::WHLSL::Intrinsics::uchar4Type const): Deleted.
3004         (WebCore::WHLSL::Intrinsics::ushort2Type const): Deleted.
3005         (WebCore::WHLSL::Intrinsics::ushort4Type const): Deleted.
3006         (WebCore::WHLSL::Intrinsics::char2Type const): Deleted.
3007         (WebCore::WHLSL::Intrinsics::char4Type const): Deleted.
3008         (WebCore::WHLSL::Intrinsics::short2Type const): Deleted.
3009         (WebCore::WHLSL::Intrinsics::short4Type const): Deleted.
3010         * Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h:
3011         * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp:
3012         (WebCore::WHLSL::isAcceptableFormat):
3013         * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt:
3014         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
3015         (WebCore::convertTextureFormat):
3016
3017 2019-07-31  Youenn Fablet  <youenn@apple.com>
3018
3019         Use CTFontCreateForCharactersWithLanguageAndOption if available instead of CTFontCreateForCharactersWithLanguage
3020         https://bugs.webkit.org/show_bug.cgi?id=200241
3021
3022         Reviewed by Myles C. Maxfield.
3023
3024         We can use CTFontCreateForCharactersWithLanguageAndOption instead of CTFontCreateForCharactersWithLanguage
3025         as it allows setting more easily the fallback option.
3026         This allows us to never fallback to user installed fonts.
3027         In such a case, we no longer need to wrap the fonts to change the fallback option.
3028         We also prewarm the fonts with the same SPI and use system fallback as the default value.
3029
3030         Covered by existing tests.
3031
3032         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3033         (WebCore::preparePlatformFont):
3034         (WebCore::lookupFallbackFont):
3035         (WebCore::FontCache::systemFallbackForCharacters):
3036         (WebCore::FontCache::prewarm):
3037         (WebCore::fontFamiliesForPrewarming):
3038
3039 2019-07-31  Devin Rousso  <drousso@apple.com>
3040
3041         Web Inspector: Overlay: add page width/height display
3042         https://bugs.webkit.org/show_bug.cgi?id=199369
3043
3044         Reviewed by Joseph Pecoraro.
3045
3046         Show `${width}px x ${height}px` in the corner where the horizontal and vertical rulers meet.
3047         This way, if the rulers shift due to the highlighted content, the page width/height does too.
3048
3049         * inspector/InspectorOverlay.h:
3050         * inspector/InspectorOverlay.cpp:
3051         (WebCore::truncateWithEllipsis):
3052         (WebCore::InspectorOverlay::drawNodeHighlight):
3053         (WebCore::InspectorOverlay::drawQuadHighlight):
3054         (WebCore::InspectorOverlay::drawRulers):
3055         (WebCore::InspectorOverlay::drawElementTitle):
3056
3057 2019-07-31  Youenn Fablet  <youenn@apple.com>
3058
3059         Owners of MultiChannelResampler should make sure that the output bus given to it has the same number of channels
3060         https://bugs.webkit.org/show_bug.cgi?id=200248
3061         <rdar://problem/53411051>
3062
3063         Reviewed by Eric Carlson.
3064
3065         When a track's number of channels changes, MediaStreamAudioSourceNode is expected
3066         to update its MultiChannelResampler and its output number of channels.
3067         MultiChannelResampler expects to have the same number of channels as the output
3068         but it is not always the case since the channel numbers are changed in different threads
3069         and locks do not help there.
3070
3071         Instead, whenever detecting that the number of channels do not match, render silence
3072         and wait for the next rendering where the number of channels should again match.
3073
3074         Add internals API to change the number of channels from 2 to 1 or 1 to 2
3075         to allow testing that code path (iOS only as MacOS audio capture is in UIProcess).
3076         Covered by updated test.
3077
3078         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
3079         (WebCore::MediaElementAudioSourceNode::process):
3080         * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
3081         (WebCore::MediaStreamAudioSourceNode::process):
3082         * platform/audio/MultiChannelResampler.cpp:
3083         (WebCore::MultiChannelResampler::process):
3084         * platform/mediastream/RealtimeMediaSource.h:
3085         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
3086         (WebCore::MockRealtimeAudioSourceMac::reconfigure):
3087         * platform/mock/MockRealtimeAudioSource.cpp:
3088         (WebCore::MockRealtimeAudioSource::setChannelCount):
3089         * platform/mock/MockRealtimeAudioSource.h:
3090         (isType):
3091         * platform/mock/MockRealtimeVideoSource.h:
3092         * testing/Internals.cpp:
3093         (WebCore::Internals::setMockAudioTrackChannelNumber):
3094         * testing/Internals.h:
3095         * testing/Internals.idl:
3096
3097 2019-07-31  Chris Dumez  <cdumez@apple.com>
3098
3099         Element.outerHTML is missing attribute prefixes in some cases in HTML documents
3100         https://bugs.webkit.org/show_bug.cgi?id=200283
3101
3102         Reviewed by Ryosuke Niwa.
3103
3104         When HTML serializing a prefixed element attribute, we should always serialize the
3105         prefix as per [1]. However, our code was only serializing the well-known ones (xml,
3106         xmlns & xlink).
3107
3108         [1] https://html.spec.whatwg.org/#attribute's-serialised-name
3109
3110         Test: fast/dom/Element/outerHTML-prefixed-attribute.html
3111
3112         * editing/MarkupAccumulator.cpp:
3113         (WebCore::htmlAttributeSerialization):
3114         (WebCore::MarkupAccumulator::xmlAttributeSerialization):
3115         (WebCore::MarkupAccumulator::appendAttribute):
3116         * editing/MarkupAccumulator.h:
3117
3118 2019-07-31  Loïc Yhuel  <loic.yhuel@softathome.com>
3119
3120         [GStreamer] Fix printf format warnings for 32-bit build in GST traces
3121         https://bugs.webkit.org/show_bug.cgi?id=200299
3122
3123         Reviewed by Xabier Rodriguez-Calvar.
3124
3125         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3126         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): %zu for size_t
3127         (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered): Ditto
3128         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3129         (webKitWebSrcCreate): G_GUINT64_FORMAT for uint64_t
3130         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp: G_GINT64_FORMAT for int64_t
3131         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp: Ditto
3132
3133 2019-07-31  Andres Gonzalez  <andresg_22@apple.com>
3134
3135         AX: Re-enable accessibility/set-selected-text-range-after-newline.html test.
3136         https://bugs.webkit.org/show_bug.cgi?id=199431
3137         <rdar://problem/52563340>
3138
3139         Reviewed by Chris Fleizach.
3140
3141         - Re-enabled LayoutTests/accessibility/set-selected-text-range-after-newline.html.
3142         - Put back workaround in visiblePositionForIndexUsingCharacterIterator
3143         that is needed for several accessibility issues.
3144         - This workaround was rolled back because it was thought the cause of:
3145         https://bugs.webkit.org/show_bug.cgi?id=199434
3146         It turned out that the actual cause of that hang was unrelated and was
3147         fixed in:
3148         https://bugs.webkit.org/show_bug.cgi?id=199845
3149
3150         * editing/Editing.cpp:
3151         (WebCore::visiblePositionForIndexUsingCharacterIterator):
3152
3153 2019-07-31  Devin Rousso  <drousso@apple.com>
3154
3155         Web Inspector: Second call to setAttributeNS creates non-prefixed attribute
3156         https://bugs.webkit.org/show_bug.cgi?id=200230
3157         <rdar://problem/53712672>
3158
3159         Reviewed by Joseph Pecoraro.
3160
3161         Original patch by Chris Dumez <cdumez@apple.com>.
3162
3163         Test: inspector/dom/attributeModified.html
3164
3165         * dom/Element.cpp:
3166         (WebCore::Element::didAddAttribute):
3167         (WebCore::Element::didModifyAttribute):
3168         (WebCore::Element::didRemoveAttribute):
3169         Use the fully qualified name, not just the local name, when notifying the inspector frontend
3170         about changes to attributes.
3171
3172 2019-07-31  Carlos Garcia Campos  <cgarcia@igalia.com>
3173
3174         [GTK] Datalist element support for TextFieldInputType
3175         https://bugs.webkit.org/show_bug.cgi?id=98934
3176
3177         Reviewed by Michael Catanzaro.
3178
3179         Add support for rendering the arrow indicator of text fields having data list.
3180
3181         * rendering/RenderThemeGtk.cpp:
3182         (WebCore::RenderThemeGtk::paintTextField):
3183         (WebCore::RenderThemeGtk::adjustListButtonStyle const):
3184         (WebCore::RenderThemeGtk::paintListButtonForInput):
3185         (WebCore::RenderThemeGtk::adjustSearchFieldStyle const):
3186         * rendering/RenderThemeGtk.h:
3187
3188 2019-07-30  Tim Horton  <timothy_horton@apple.com>
3189
3190         ASSERTion failure under takeSnapshot after r247846
3191
3192         * page/TextIndicator.cpp:
3193         (WebCore::takeSnapshots):
3194         We now sometimes inflate the scale factor; allow this.
3195
3196 2019-07-30  Saam Barati  <sbarati@apple.com>
3197
3198         [WHLSL] Add a fast path for TypeNamer::insert where we've already seen the type
3199         https://bugs.webkit.org/show_bug.cgi?id=200284
3200
3201         Reviewed by Myles C. Maxfield.
3202
3203         This is a ~27% speedup in the WHLSL::prepare for the compute_boids test.
3204         This optimization makes sense since my previous patch to make UnnamedType
3205         ref counted was also a huge speedup. So the TypeNamer is seeing many
3206         UnnamedTypes which are the same pointer value. On compute_boids, this
3207         makes generateMetalCode ~40ms faster.
3208
3209         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
3210         (WebCore::WHLSL::Metal::TypeNamer::insert):
3211
3212 2019-07-29  Ryosuke Niwa  <rniwa@webkit.org>
3213
3214         WorkerGlobalScope::wrapCryptoKey/unwrapCryptoKey should use local heap objects for replies
3215         https://bugs.webkit.org/show_bug.cgi?id=200179
3216         <rdar://problem/52334658>
3217
3218         Reviewed by Brent Fulgham.
3219
3220         Based on the patch by Jiewen Tan.
3221
3222         WorkerGlobalScope::wrapCryptoKey and WorkerGlobalScope::unwrapCryptoKey had a bug that they could exit
3223         the function before the main thread had finished writing to the result vector passed in to these functions
3224         when the worker's runloop receives MessageQueueTerminated before the main thread finishes writing.
3225
3226         Fixed the bug by creating a new temporary Vector inside a ThreadSafeRefCounted object shared between
3227         the main thread and the worker thread, which extends the lifetime of the Vector until when the worker thread
3228         receives the result or when the main thread finishes writing to the Vector, whichever happens last.
3229
3230         Unfortunately no new tests since there is no reproducible test case, and this crash is highly racy.
3231
3232         * workers/WorkerGlobalScope.cpp:
3233         (WebCore::CryptoBufferContainer): Added.
3234         (WebCore::CryptoBufferContainer::create): Added.
3235         (WebCore::CryptoBufferContainer::buffer): Added.
3236         (WebCore::WorkerGlobalScope::wrapCryptoKey):
3237         (WebCore::WorkerGlobalScope::unwrapCryptoKey):
3238
3239 2019-07-30  Saam Barati  <sbarati@apple.com>
3240
3241         [WHLSL] Checker sets wrong type for property access instruction with an ander
3242         https://bugs.webkit.org/show_bug.cgi?id=200282
3243
3244         Reviewed by Myles C. Maxfield.
3245
3246         We were assigning resulting type based on the base value instead of the ander
3247         of the base value. For example, consider:
3248         ```
3249         struct Point { float x; float y; }
3250         compute main(device Point[] buffer) { buffer[0]; }
3251         ```
3252         
3253         The local variable "buffer" is in the "thread" address space. So we would end up
3254         trying to use the thread address space for "buffer[0]". This caused us to
3255         generate invalid Metal code because we would call a "thread" ander with a
3256         "device" pointer. The fix is to use the "device" address space, which is
3257         the type of the ander we were already setting on this property access instruction.
3258
3259         Test: webgpu/whlsl/device-proper-type-checker.html
3260
3261         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
3262         (WebCore::WHLSL::Checker::finishVisiting):
3263
3264 2019-07-30  Saam Barati  <sbarati@apple.com>
3265
3266         [WHLSL] Make ASTDumper dump types and address spaces
3267         https://bugs.webkit.org/show_bug.cgi?id=200281
3268
3269         Reviewed by Robin Morisset.
3270
3271         This makes it much easier to gain insight into what type resolution
3272         the checker does. I used this logging to debug https://bugs.webkit.org/show_bug.cgi?id=200282
3273
3274         * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h:
3275         (WebCore::WHLSL::AST::TypeAnnotation::isAbstractLeftValue const):
3276         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
3277         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
3278         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
3279         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
3280         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
3281         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
3282         (WebCore::WHLSL::ASTDumper::visit):
3283
3284 2019-07-30  Brent Fulgham  <bfulgham@apple.com>
3285
3286         [FTW] Refactor Direct2D code to follow Cairo's model to support modern WebKit
3287         https://bugs.webkit.org/show_bug.cgi?id=200270
3288
3289         Reviewed by Dean Jackson.
3290
3291         Refactor the Direct2D code in WebCore so that the core routines can be shared
3292         between GraphicsContext and GraphicsContextImpl. Implement PlatformContext,
3293         BackingStoreBackend, and GraphicsContextImpl for the Direct2D engine.
3294        
3295         This patch effectively just moves code around.
3296
3297         * PlatformFTW.cmake:
3298         * platform/graphics/GraphicsContext.h:
3299         * platform/graphics/GraphicsContextImpl.h:
3300         * platform/graphics/ImageSource.cpp:
3301         * platform/graphics/Pattern.h:
3302         * platform/graphics/displaylists/DisplayListRecorder.cpp:
3303         * platform/graphics/displaylists/DisplayListRecorder.h:
3304         * platform/graphics/win/BackingStoreBackendDirect2D.h: Added.
3305         * platform/graphics/win/BackingStoreBackendDirect2DImpl.cpp: Added.
3306         * platform/graphics/win/BackingStoreBackendDirect2DImpl.h: Added.
3307         * platform/graphics/win/Direct2DOperations.cpp: Added.
3308         * platform/graphics/win/Direct2DOperations.h: Added.
3309         * platform/graphics/win/Direct2DUtilities.cpp: Added.
3310         * platform/graphics/win/Direct2DUtilities.h: Added.
3311         * platform/graphics/win/FontCascadeDirect2D.cpp:
3312         * platform/graphics/win/GradientDirect2D.cpp:
3313         * platform/graphics/win/GraphicsContextDirect2D.cpp:
3314         * platform/graphics/win/GraphicsContextImplDirect2D.cpp: Added.
3315         * platform/graphics/win/GraphicsContextImplDirect2D.h: Added.
3316         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
3317         * platform/graphics/win/ImageBufferDataDirect2D.h:
3318         * platform/graphics/win/ImageBufferDirect2D.cpp:
3319         * platform/graphics/win/NativeImageDirect2D.cpp:
3320         * platform/graphics/win/PathDirect2D.cpp:
3321         * platform/graphics/win/PatternDirect2D.cpp:
3322         * platform/graphics/win/PlatformContextDirect2D.cpp: Added.
3323         * platform/graphics/win/PlatformContextDirect2D.h: Added.
3324         * platform/win/DragImageWin.cpp:
3325         * svg/graphics/SVGImage.cpp:
3326
3327 2019-07-30  Myles C. Maxfield  <mmaxfield@apple.com>
3328
3329         REGRESSION(r241288): Text on Yahoo Japan mobile looks too bold
3330         https://bugs.webkit.org/show_bug.cgi?id=200065
3331         <rdar://problem/50912757>
3332
3333         Reviewed by Simon Fraser.
3334
3335         Before r241288, we were mapping Japanese sans-serif to Hiragino Kaku Gothic ProN, which
3336         has a 300 weight and a 600 weight. However, we can't use that font because it's user-installed,
3337         so in r241288 we switched to using Hiragino Sans, which has a 300 weight, a 600 weight, and an
3338         800 weight. According to the CSS font selection algorithm, sites that request a weight of 700
3339         would get the 800 weight instead of the 600 weight, which caused the text to look too heavy.
3340         Therefore, the apparent visual change is from a weight change from 600 to 800.
3341
3342         In general, this is working as intended. However, text on Yahoo Japan looks too heavy in weight
3343         800. Instead, this patch adds a quirk specific to Yahoo Japan that overwrites any font requests
3344         to give them a weight of 600 instead of 700. This way, the lighter font will be used.
3345
3346         No new tests because quirks cannot be tested.
3347
3348         * css/CSSFontSelector.cpp:
3349         (WebCore::resolveGenericFamily):
3350         (WebCore::CSSFontSelector::fontRangesForFamily):
3351         * page/Quirks.cpp:
3352         (WebCore::Quirks::shouldLightenJapaneseBoldSansSerif const):
3353         * page/Quirks.h:
3354
3355 2019-07-31  Simon Fraser  <simon.fraser@apple.com>
3356
3357         [iPadOS] Enable simulated mouse events on iqiyi.com to fix the video controls
3358         https://bugs.webkit.org/show_bug.cgi?id=200322
3359         rdar://problem/53235709
3360
3361         Reviewed by Wenson Hsieh.
3362         
3363         iqiyi.com needs to get mouseMove events for dragging the video scrubber to work.
3364
3365         * page/Quirks.cpp:
3366         (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
3367
3368 2019-07-30  Michael Catanzaro  <mcatanzaro@igalia.com>
3369
3370         Unreviewed, fix GTK build after SoupNetworkSession ownership rework.
3371
3372         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
3373
3374 2019-07-30  Michael Catanzaro  <mcatanzaro@igalia.com>
3375
3376         [GTK] Compilation errors when GL is disabled
3377         https://bugs.webkit.org/show_bug.cgi?id=200223
3378
3379         Unreviewed, keep trying to fix build with -DENABLE_OPENGL=OFF.
3380
3381         The previous commit was sufficient for the 2.24 branch, but on trunk there are more
3382         problems. This doesn't solve all of them, but it gets us closer.
3383
3384         * SourcesGTK.txt:
3385         * platform/graphics/GLContext.h:
3386
3387 2019-07-24  Carlos Garcia Campos  <cgarcia@igalia.com>
3388
3389         [SOUP] Move SoupNetworkSession ownership from NetworkStorageSession to NetworkSession
3390         https://bugs.webkit.org/show_bug.cgi?id=200076
3391
3392         Reviewed by Michael Catanzaro.
3393
3394         Remove the SoupNetworkSession from NetworkStorageSession.
3395
3396         * platform/network/NetworkStorageSession.h:
3397         (WebCore::NetworkStorageSession::cookieStorage const): Return the cookie jar.
3398         * platform/network/StorageSessionProvider.h:
3399         (WebCore::StorageSessionProvider::soupSession const): Temporary add this virtual method that is required by
3400         SocketStreamHandleImplSoup. It will be removed once we switch to libsoup WebSockets API soon.
3401         * platform/network/soup/DNSResolveQueueSoup.cpp:
3402         (WebCore::globalDefaultSoupSessionAccessor): Rework the accessor to return the SoupSession directly since
3403         that's what we really want.
3404         (WebCore::DNSResolveQueueSoup::setGlobalDefaultSoupSessionAccessor):
3405         (WebCore::DNSResolveQueueSoup::updateIsUsingProxy):
3406         (WebCore::DNSResolveQueueSoup::platformResolve):
3407         (WebCore::DNSResolveQueueSoup::resolve):
3408         * platform/network/soup/DNSResolveQueueSoup.h:
3409         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3410         (WebCore::NetworkStorageSession::NetworkStorageSession): Create and setup the default cookie jar.
3411         (WebCore::NetworkStorageSession::~NetworkStorageSession): Only disconnect the cookie jar signals.
3412         (WebCore::NetworkStorageSession::setCookieStorage): Update the cookie jar, now we know it's always a new one.
3413         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
3414         (WebCore::SocketStreamHandleImpl::create): Use the new virtual method from StorageSessionProvider to get the SoupSession.
3415         * platform/network/soup/SoupNetworkSession.cpp:
3416         (WebCore::SoupNetworkSession::SoupNetworkSession): Remove the SoupCookieJar parameter.
3417         * platform/network/soup/SoupNetworkSession.h:
3418
3419 2019-07-30  Michael Catanzaro  <mcatanzaro@igalia.com>
3420
3421         [GTK] Compilation errors when GL is disabled
3422         https://bugs.webkit.org/show_bug.cgi?id=200223
3423
3424         Unreviewed, fix build with -DENABLE_OPENGL=OFF.
3425
3426         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3427         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
3428
3429 2019-07-29  Eric Carlson  <eric.carlson@apple.com>
3430
3431         MediaSource.isTypeSupported claims FLAC-in-MP4 support on iOS and macOS, but plays silence
3432         https://bugs.webkit.org/show_bug.cgi?id=198583
3433         <rdar://problem/51487853>
3434
3435         Reviewed by Maciej Stachowiak.
3436
3437         * platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.h:
3438         (WebCore::AVStreamDataParserMIMETypeCache::canDecodeType): Use anParseExtendedMIMEType:
3439         when it is available.
3440
3441 2019-07-29  Zalan Bujtas  <zalan@apple.com>
3442
3443         [LFC][TFC] <table> initiates a principal block container box called table wrapper box.
3444         https://bugs.webkit.org/show_bug.cgi?id=200198
3445         <rdar://problem/53623803>
3446
3447         Reviewed by Antti Koivisto.
3448
3449         The table wrapper box contains the table box itself and any caption boxes.
3450
3451         * layout/layouttree/LayoutBox.cpp:
3452         (WebCore::Layout::Box::isBlockContainerBox const):
3453         * layout/layouttree/LayoutBox.h:
3454         (WebCore::Layout::Box::isTableCaption const):
3455         (WebCore::Layout::Box::isTableRow const):
3456         (WebCore::Layout::Box::isTableCell const):
3457         * layout/layouttree/LayoutContainer.h:
3458         * layout/layouttree/LayoutTreeBuilder.cpp:
3459         (WebCore::Layout::appendChild):
3460         (WebCore::Layout::TreeBuilder::createLayoutBox):
3461         (WebCore::Layout::TreeBuilder::createTableStructure):
3462         (WebCore::Layout::TreeBuilder::createSubTree):
3463         (WebCore::Layout::outputLayoutBox):
3464         * layout/layouttree/LayoutTreeBuilder.h:
3465
3466 2019-07-29  Justin Fan  <justin_fan@apple.com>
3467
3468         [WebGPU] Replace Vectors with HashSets for tracking resources used by GPUCommandBuffer
3469         https://bugs.webkit.org/show_bug.cgi?id=200200
3470
3471         Reviewed by Myles C. Maxfield.
3472
3473         Resources bound to a command buffer or bind group only need be tracked once rather than once per sub-view. 
3474         This patch cuts GPUQueue.submit validation from 2-12 ms down to ~0 when drawing 12000 triangles in Animometer.
3475
3476         Covered by existing tests; no behavior change expected.
3477
3478         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp: Removed unused variable.
3479         * platform/graphics/gpu/GPUBindGroup.h:
3480         (WebCore::GPUBindGroup::boundBuffers const):
3481         (WebCore::GPUBindGroup::boundTextures const):
3482         * platform/graphics/gpu/GPUCommandBuffer.h:
3483         (WebCore::GPUCommandBuffer::usedBuffers const):
3484         (WebCore::GPUCommandBuffer::usedTextures const):
3485         (WebCore::GPUCommandBuffer::useBuffer):
3486         (WebCore::GPUCommandBuffer::useTexture):
3487         * platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm:
3488         (WebCore::GPUBindGroup::tryCreate):
3489         (WebCore::GPUBindGroup::GPUBindGroup):
3490
3491 2019-07-29  Zalan Bujtas  <zalan@apple.com>
3492
3493         [LFC][TFC] Introduce Box::establishesTableFormattingContext
3494         https://bugs.webkit.org/show_bug.cgi?id=200060
3495
3496         Reviewed by Antti Koivisto.
3497
3498         https://www.w3.org/TR/CSS22/tables.html
3499
3500         The table generates a principal block container box called the table wrapper box that contains the table box itself and any caption boxes.
3501         The table box is a block-level box that contains the table's internal table boxes.
3502         The table wrapper box is block-level for 'display: table', and inline-level; for 'display: inline-table'. The table wrapper box establishes a block
3503         formatting context, and the table box establishes a table formatting context."
3504
3505         * layout/layouttree/LayoutBox.cpp:
3506         (WebCore::Layout::Box::establishesFormattingContext const):
3507         (WebCore::Layout::Box::establishesTableFormattingContext const):
3508         (WebCore::Layout::Box::isBlockLevelBox const):
3509         (WebCore::Layout::Box::isInlineLevelBox const):
3510         (WebCore::Layout::Box::isBlockContainerBox const):
3511         * layout/layouttree/LayoutBox.h:
3512         (WebCore::Layout::Box::isTableWrapperBox const):
3513         (WebCore::Layout::Box::isTableBox const):
3514
3515 2019-07-29  Zalan Bujtas  <zalan@apple.com>
3516
3517         [ContentChangeObserver] didFinishContentChangeObserving should include the type of content change.
3518         https://bugs.webkit.org/show_bug.cgi?id=200247
3519         <rdar://problem/53681149>
3520
3521         Reviewed by Simon Fraser.
3522
3523         Now we don't have to query the content change observer for the type of the change in the callback.
3524
3525         * loader/EmptyClients.h:
3526         * page/ChromeClient.h:
3527         * page/ios/ContentChangeObserver.cpp:
3528         (WebCore::ContentChangeObserver::adjustObservedState):
3529         * page/ios/EventHandlerIOS.mm:
3530         (WebCore::EventHandler::mouseMoved):
3531
3532 2019-07-29  Sergei Glazunov  <glazunov@google.com>
3533
3534         The maximum subframe count check should not be skipped for empty URLs.
3535         https://bugs.webkit.org/show_bug.cgi?id=200032
3536
3537         Reviewed by Ryosuke Niwa.
3538
3539         Move the check closer to the actual frame creation code in `loadSubframe`.
3540
3541         Test: fast/dom/connected-subframe-counter-overflow.html
3542
3543         * dom/Document.cpp:
3544         (WebCore::Document::prepareForDestruction): Assert that all child frames have been detached.
3545         * html/HTMLFrameElementBase.cpp:
3546         (WebCore::HTMLFrameElementBase::canLoad const):
3547         (WebCore::HTMLFrameElementBase::canLoadURL const):
3548         * html/HTMLFrameOwnerElement.cpp:
3549         (WebCore::HTMLFrameOwnerElement::canAddSubframe const): Deleted.
3550         * html/HTMLFrameOwnerElement.h:
3551         * html/HTMLPlugInImageElement.cpp:
3552         (WebCore::HTMLPlugInImageElement::canLoadURL const):
3553         * loader/SubframeLoader.cpp:
3554         (WebCore::SubframeLoader::loadSubframe):
3555
3556 2019-07-29  Zalan Bujtas  <zalan@apple.com>
3557
3558         [ContentChangeObserver] ChromeClient::observedContentChange() name is misleading
3559         https://bugs.webkit.org/show_bug.cgi?id=200238
3560         <rdar://problem/53677038>
3561
3562         Reviewed by Simon Fraser.
3563
3564         This function indicates that we've finished observing content changes.
3565
3566         * loader/EmptyClients.h:
3567         * page/ChromeClient.h:
3568         * page/ios/ContentChangeObserver.cpp:
3569         (WebCore::ContentChangeObserver::adjustObservedState):
3570         * page/ios/EventHandlerIOS.mm:
3571         (WebCore::EventHandler::mouseMoved):
3572
3573 2019-07-29  Sam Weinig  <weinig@apple.com>
3574
3575         StringBuilder::append(makeString(...)) is inefficient
3576         https://bugs.webkit.org/show_bug.cgi?id=200034
3577
3578         Reviewed by Saam Barati.
3579
3580         Replace uses of StringBuilder::append(makeString(...)) with StringBuilder::flexiblAppend(...).
3581         Where possible, also merged consecutive calls to StringBuilder::append(...) into a single call
3582         to StringBuilder::flexiblAppend(...) to avoid unnecessary additional overflow checks and resizes.
3583         Also where possible, replaced StringBuilder with makeString() if no branching was used during
3584         construction.
3585         
3586         A lot more can be done to improve the efficiency of StringBuilder use in the WHLSL code including:
3587         - Using StringView more prevelently, especially when passing a substring to the StringBuilder.
3588         - Passing existing StringBuilders to functions for them to use rather than returning a String and 
3589           then appending that to another StringBuilder.
3590         - Using custom StringTypeAdapters for generated names, rather than storing them as Strings. 
3591
3592         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
3593         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceHelperTypes):
3594         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceSignature):
3595         (WebCore::WHLSL::Metal::EntryPointScaffolding::builtInsSignature):
3596         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledInputPath):
3597         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledOutputPath):
3598         (WebCore::WHLSL::Metal::EntryPointScaffolding::unpackResourcesAndNamedBuiltIns):
3599         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::helperTypes):
3600         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::signature):
3601         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::unpack):
3602         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::pack):
3603         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::helperTypes):
3604         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::signature):
3605         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::unpack):
3606         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::pack):
3607         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::signature):
3608         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
3609         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::visit):
3610         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
3611         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
3612         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::emitLoop):
3613         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp:
3614         (WebCore::WHLSL::Metal::generateMetalCodeShared):
3615         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
3616         (WebCore::WHLSL::Metal::writeNativeFunction):
3617         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
3618         (WebCore::WHLSL::Metal::MetalTypeDeclarationWriter::visit):
3619         (WebCore::WHLSL::Metal::TypeNamer::emitUnnamedTypeDefinition):
3620         (WebCore::WHLSL::Metal::TypeNamer::emitNamedTypeDefinition):
3621         (WebCore::WHLSL::Metal::TypeNamer::metalTypes):
3622         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
3623         (WebCore::WHLSL::Types::appendNameTo):
3624         * rendering/RenderLayerCompositor.cpp:
3625         (WebCore::RenderLayerCompositor::logLayerInfo):
3626         * testing/Internals.cpp:
3627         (WebCore::Internals::ongoingLoadsDescriptions const):
3628
3629 2019-07-29  Megan Gardner  <megan_gardner@apple.com>
3630
3631         Force Reveal to always lookup from menu
3632         https://bugs.webkit.org/show_bug.cgi?id=200186
3633         <rdar://problem/52967940>
3634
3635         Reviewed by Tim Horton.
3636
3637         We currently only have the 'lookup' menu item, so we should always force the 'lookup' action from it.
3638
3639         Reveal is not currently testable.
3640
3641         * editing/cocoa/DictionaryLookup.mm:
3642         (WebCore::showPopupOrCreateAnimationController):
3643
3644 2019-07-29  Simon Fraser  <simon.fraser@apple.com>
3645
3646         REGRESSION (r246899): Subtitles show twice when controls show/hide on hulu.com
3647         https://bugs.webkit.org/show_bug.cgi?id=200187
3648         rdar://problem/53511121
3649
3650         Reviewed by Zalan Bujtas.
3651
3652         When a layer that painted into shared backing moved, we'd fail to repaint its old position
3653         because the RenderLayer's repaint rects are cleared via BackingSharingState::updateBeforeDescendantTraversal().
3654
3655         Recomputing repaint rects is expensive, so we only want to do it when necessary, which is for
3656         layers that start and stop sharing (going into and out of compositing already recomputes them).
3657         So add logic to RenderLayerBacking::setBackingSharingLayers() that recomputes repaint rects
3658         on layers that will no longer use shared backing, and those that are newly using shared
3659         backing.
3660
3661         Test: compositing/shared-backing/backing-sharing-repaint.html
3662
3663         * rendering/RenderLayer.cpp:
3664         (WebCore::RenderLayer::setBackingProviderLayer):
3665         * rendering/RenderLayerBacking.cpp:
3666         (WebCore::RenderLayerBacking::setBackingSharingLayers):
3667         * rendering/RenderLayerCompositor.cpp:
3668         (WebCore::RenderLayerCompositor::BackingSharingState::appendSharingLayer):
3669         (WebCore::RenderLayerCompositor::updateBacking):
3670
3671 2019-07-29  Simon Fraser  <simon.fraser@apple.com>
3672
3673         The touch-action property was ignored on replaced elements (canvas, img etc)
3674         https://bugs.webkit.org/show_bug.cgi?id=200205
3675         rdar://problem/53331224
3676
3677         Reviewed by Antti Koivisto.
3678
3679         The event region painting code didn't handle replaced elements correctly,
3680         causing touch-action to get ignored for <canvas>, <img> etc. Fix by handling
3681         region painting in RenderReplaced.
3682
3683         This still doesn't fix <iframe> but I'm not sure what the correct behavior is there
3684         (webkit.org/b/200204).
3685
3686         Test: pointerevents/ios/touch-action-region-replaced-elements.html
3687
3688         * rendering/RenderReplaced.cpp:
3689         (WebCore::RenderReplaced::paint):
3690         (WebCore::RenderReplaced::shouldPaint):
3691
3692 2019-07-29  Philippe Normand  <pnormand@igalia.com>
3693
3694         REGRESSION(r243058): [GStreamer] WebKitWebSrc's internal queue can exhaust the WebProcess memory
3695         https://bugs.webkit.org/show_bug.cgi?id=199998
3696
3697         Reviewed by Xabier Rodriguez-Calvar.
3698
3699         With the webkitwebsrc rewrite the element lost its ability to tell
3700         the resource loader when to pause and resume downloading because
3701         we don't use appsrc and its enough-data/need-data signals anymore.
3702         So new heuristics are introduced with this patch. Downloading of
3703         resources bigger than 2MiB might pause when the internal adapter
3704         has enough data (2% of the full resource) and resume when the
3705         adapter size goes below 20% of those 2%.
3706
3707         No new tests, the media element spec doesn't clearly mandate how
3708         the resource loading should behave when the element is paused or
3709         how aggressively the resource should be downloaded during
3710         playback.
3711
3712         This patch was functionally tested with a 1.3GiB resource loaded
3713         over the local network, the resource was downloaded in ~30MiB
3714         chunks, stopping and resuming every 20 seconds, approximately.
3715
3716         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3717         (webkit_web_src_class_init):
3718         (webKitWebSrcCreate):
3719         (CachedResourceStreamingClient::responseReceived):
3720         (CachedResourceStreamingClient::dataReceived):
3721
3722 2019-07-29  Carlos Garcia Campos  <cgarcia@igalia.com>
3723
3724         WebSockets: workers never use the platform WebSockets path
3725         https://bugs.webkit.org/show_bug.cgi?id=200161
3726
3727         Reviewed by Michael Catanzaro.
3728
3729         A WebCore::WebSocketChannel is created unconditionally in WorkerThreadableWebSocketChannel::Peer.
3730
3731         * Modules/websockets/ThreadableWebSocketChannel.cpp:
3732         (WebCore::ThreadableWebSocketChannel::create): New create method that receives a Document& and creates the
3733         WebSocket channel checking the runtime enabled features to decide.
3734         * Modules/websockets/ThreadableWebSocketChannel.h:
3735         * Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
3736         (WebCore::WorkerThreadableWebSocketChannel::Peer::Peer): Use ThreadableWebSocketChannel::create().
3737
3738 2019-07-29  Carlos Garcia Campos  <cgarcia@igalia.com>
3739
3740         Multiple context menu actions broken for YouTube videos
3741         https://bugs.webkit.org/show_bug.cgi?id=199999
3742
3743         Reviewed by Eric Carlson.
3744
3745         Do not include CopyMediaLinkItem and OpenMediaInNewWindowItem to the context menu when media URL is not
3746         downloadable or the request can't be handled.
3747
3748         * page/ContextMenuController.cpp:
3749         (WebCore::ContextMenuController::populate):
3750
3751 2019-07-28  Commit Queue  <commit-queue@webkit.org>
3752
3753         Unreviewed, rolling out r247886.
3754         https://bugs.webkit.org/show_bug.cgi?id=200214
3755
3756         "Causes PLT5 regression on some machines" (Requested by mlam|a
3757         on #webkit).
3758
3759         Reverted changeset:
3760
3761         "Add crash diagnostics for debugging unexpected zapped cells."
3762         https://bugs.webkit.org/show_bug.cgi?id=200149
3763         https://trac.webkit.org/changeset/247886
3764
3765 2019-07-28  Tim Horton  <timothy_horton@apple.com>
3766
3767         Fix the release build
3768
3769         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
3770         (WebCore::WHLSL::Metal::TypeNamer::insert):
3771
3772 2019-07-28  Simon Fraser  <simon.fraser@apple.com>
3773
3774         [iOS] Touch regions overlay needs to show touch-action:none
3775         https://bugs.webkit.org/show_bug.cgi?id=200203
3776
3777         Reviewed by Wenson Hsieh.
3778
3779         When I added touch-action overlay painting, I didn't realize that touch-action:none
3780         was an important value to display. But it is, so fix that.
3781
3782         * rendering/RenderLayerBacking.cpp:
3783         (WebCore::patternForTouchAction):
3784
3785 2019-07-27  Saam Barati  <sbarati@apple.com>
3786
3787         [WHLSL] Remove UnnamedType copy/move constructors and mark classes as final
3788         https://bugs.webkit.org/show_bug.cgi?id=200188
3789
3790         Reviewed by Myles C. Maxfield.
3791
3792         Since they are ref counted, you should make taking a ref to them
3793         instead of moving or copying them. This patch encodes that by deleting
3794         the relevant copy/move constructors and assignment operators.
3795
3796         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
3797         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
3798         (WebCore::WHLSL::AST::ArrayType::ArrayType): Deleted.
3799         (WebCore::WHLSL::AST::ArrayType::create): Deleted.
3800         (WebCore::WHLSL::AST::ArrayType::type const): Deleted.
3801         (WebCore::WHLSL::AST::ArrayType::type): Deleted.
3802         (WebCore::WHLSL::AST::ArrayType::numElements const): Deleted.
3803         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
3804         (WebCore::WHLSL::AST::PointerType::PointerType): Deleted.
3805         (WebCore::WHLSL::AST::PointerType::create): Deleted.
3806         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
3807         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
3808         (WebCore::WHLSL::AST::TypeReference::TypeReference): Deleted.
3809         (WebCore::WHLSL::AST::TypeReference::create): Deleted.
3810         (WebCore::WHLSL::AST::TypeReference::name): Deleted.
3811         (WebCore::WHLSL::AST::TypeReference::typeArguments): Deleted.
3812         (WebCore::WHLSL::AST::TypeReference::maybeResolvedType const): Deleted.
3813         (WebCore::WHLSL::AST::TypeReference::resolvedType const): Deleted.
3814         (WebCore::WHLSL::AST::TypeReference::setResolvedType): Deleted.
3815         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
3816
3817 2019-07-27  Justin Fan  <justin_fan@apple.com>
3818
3819         [WebGPU] Update GPUComputePipeline errors to match GPURenderPipeline implementation
3820         https://bugs.webkit.org/show_bug.cgi?id=200097
3821
3822         Reviewed by Myles C. Maxfield.
3823
3824         Remove passing around a functionName in GPUComputePipeline creation in favor of setting it on the GPUErrorScopes.
3825         Also, WebGPU objects no longer create new Ref<>s unless object creation succeeds.
3826
3827         No new tests. Covered by existing tests.
3828
3829         * Modules/webgpu/WebGPUDevice.cpp:
3830         (WebCore::WebGPUDevice::createBuffer const):
3831         (WebCore::WebGPUDevice::createBufferMapped const):
3832         (WebCore::WebGPUDevice::createComputePipeline const):
3833         * platform/graphics/gpu/GPUBuffer.h:
3834         * platform/graphics/gpu/GPUComputePipeline.h:
3835         * platform/graphics/gpu/GPUDevice.cpp:
3836         (WebCore::GPUDevice::tryCreateBuffer):
3837         (WebCore::GPUDevice::tryCreateComputePipeline const):
3838         * platform/graphics/gpu/GPUDevice.h:
3839         * platform/graphics/gpu/GPUErrorScopes.cpp:
3840         (WebCore::GPUErrorScopes::generatePrefixedError): Only validaton errors have messages right now.
3841         * platform/graphics/gpu/GPUErrorScopes.h:
3842         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
3843         (WebCore::GPUBuffer::validateBufferUsage):
3844         (WebCore::GPUBuffer::tryCreate):
3845         (WebCore::GPUBuffer::GPUBuffer):
3846         * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
3847         (WebCore::trySetMetalFunctions):
3848         (WebCore::trySetFunctions):
3849         (WebCore::convertComputePipelineDescriptor):
3850         (WebCore::tryCreateMTLComputePipelineState):
3851         (WebCore::GPUComputePipeline::tryCreate):
3852         (WebCore::GPUComputePipeline::GPUComputePipeline):
3853         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
3854         (WebCore::trySetMetalFunctions):
3855         (WebCore::trySetFunctions):
3856
3857         These classes were made RefCounted in a previous patch; remove their move ctors to fix build.
3858         * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
3859         * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
3860         * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
3861         * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
3862         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
3863         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
3864
3865 2019-07-27  Andres Gonzalez  <andresg_22@apple.com>
3866
3867         Expose the aria-label attribute for <video> elements.
3868         https://bugs.webkit.org/show_bug.cgi?id=200169
3869         <rdar://problem/51754558>
3870
3871         Reviewed by Chris Fleizach.
3872
3873         Tests: accessibility/ios-simulator/media-with-aria-label.html
3874                accessibility/media-with-aria-label.html
3875
3876         We now expose the <video> element to accessibility clients as long as auto-play is not enabled.
3877         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3878         (-[WebAccessibilityObjectWrapper accessibilityIsWebInteractiveVideo]):
3879
3880 2019-07-26  Saam Barati  <sbarati@apple.com>
3881
3882         Unreviewed. Remove invalid assertion after r247878.
3883         We were essentially asserting all UnnamedType* were
3884         unique. But my patch made this no longer the case by
3885         design to make things faster.
3886
3887         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
3888         (WebCore::WHLSL::Metal::TypeNamer::insert):
3889
3890 2019-07-26  Mark Lam  <mark.lam@apple.com>
3891
3892         Add crash diagnostics for debugging unexpected zapped cells.
3893         https://bugs.webkit.org/show_bug.cgi?id=200149
3894         <rdar://problem/53570112>
3895
3896         Reviewed by Yusuke Suzuki, Saam Barati, and Michael Saboff.
3897
3898         No new tests because this is a feature for debugging crashes.  It has been tested
3899         manually by modifying the code to force a crash at the point of interest.
3900
3901         Added some comments to document the hashes of known subspaces.
3902
3903         * bindings/js/WebCoreJSClientData.cpp:
3904         (WebCore::JSVMClientData::JSVMClientData):
3905
3906 2019-07-26  Ryosuke Niwa  <rniwa@webkit.org>
3907
3908         Moving right by word boundary right before an object element followed by a br element hangs
3909         https://bugs.webkit.org/show_bug.cgi?id=200144
3910
3911         Reviewed by Simon Fraser.
3912
3913         The bug was caused by an infinite loop inside wordBreakIteratorForMinOffsetBoundary when it's trying to
3914         find the previous word boundary at the beginning of a word after the object element and the br element.
3915         In this case, previousBox is at the br element after the object element in the preceding line, and
3916         logicallyPreviousBox ends up returning the same inline box (that of the br element), causing a hang.
3917
3918         Here's how. In logicallyPreviousBox, previousRootInlineBoxCandidatePosition returns a legacy position
3919         immediately after the object element. The root inline box for this position (previousRoot) is the one
3920         that contains the object element and the br element. However, when previousTextOrLineBreakBox is called
3921         on this root inline box, "box" argument of the function is set to nullptr, and as a result, the function
3922         finds and returns the same inline box of the br element that was passed to logicallyPreviousBox.
3923
3924         Fixed the bug by passing the starting inline box to previousRootInlineBoxCandidatePosition when its
3925         root inline box is the previous root inline box (previousRoot). Also applied the same fix to
3926         logicallyNextBox even though we don't have a reproduction for that case for now (RTL test case is
3927         unaffected by nextRootInlineBoxCandidatePosition).
3928
3929         Tests: editing/selection/move-by-word-visually-across-object-element-1.html
3930                editing/selection/move-by-word-visually-across-object-element-2.html
3931                editing/selection/move-by-word-visually-across-object-element-3.html
3932
3933         * editing/VisibleUnits.cpp:
3934         (WebCore::logicallyPreviousBox): Fixed the bug.
3935         (WebCore::logicallyNextBox): Ditto.
3936
3937 2019-07-26  Brady Eidson  <beidson@apple.com>
3938
3939         Do not fire readystatechange events at documents about to get replaced by javascript URLs.
3940         <rdar://problem/51665406> and https://bugs.webkit.org/show_bug.cgi?id=198786
3941
3942         Reviewed by Ryosuke Niwa.
3943
3944         Test: http/tests/dom/ready-state-on-javascript-replace.html
3945
3946         We were firing too many readystatechange events, more than other browsers.
3947         Our behavior on this test with this patch now matches Chrome.
3948
3949         (There was even an ancient FIXME alluding to this referencing a spec issue, and that issues has long been resolvedv)
3950
3951         * loader/FrameLoader.cpp:
3952         (WebCore::FrameLoader::stopLoading):
3953
3954 2019-07-26  Zalan Bujtas  <zalan@apple.com>
3955
3956         [iPadOS] wix.com cannot select a template to edit or view
3957