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