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