[iOS] Crash in WebKit::WebPage::positionInformation via Range::startPosition
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-07-05  Ryosuke Niwa  <rniwa@webkit.org>
2
3         [iOS] Crash in WebKit::WebPage::positionInformation via Range::startPosition
4         https://bugs.webkit.org/show_bug.cgi?id=199503
5
6         Reviewed by Wenson Hsieh.
7
8         * editing/Editor.cpp:
9         (WebCore::Editor::compositionRange const): Added a FIXME.
10
11 2019-07-02  Myles C. Maxfield  <mmaxfield@apple.com>
12
13         [WHLSL] Standard library is too big to directly include in WebCore
14         https://bugs.webkit.org/show_bug.cgi?id=198186
15         <rdar://problem/51288898>
16
17         Reviewed by Saam Barati.
18
19         This patch adds almost the entire remainder of the standard library. There are a few
20         pieces missing:
21         - step() because of https://bugs.webkit.org/show_bug.cgi?id=199289
22         - sign() also because of https://bugs.webkit.org/show_bug.cgi?id=199289
23         - faceforward() because it calls sign()
24         - Some of the more rarely-used texturing functions (e.g. Gather()) https://bugs.webkit.org/show_bug.cgi?id=195813
25         - RWTextures https://bugs.webkit.org/show_bug.cgi?id=198985
26
27         There were two problems with adding so many standard library functions:
28         - We didn't want to increase the WebCore binary size that much
29         - Compiling all the functions at runtime took 7 seconds, which is much too long
30
31         This patch addresses the first problem by gzipping the standard library before including it in the binary.
32         At runtime, we use libcompression to unzip it.
33
34         To address the second problem, we did some analysis and found that 14% of that 7 seconds was simply
35         destroying all the AST nodes. Even if we eliminated all processing of the AST, simply having the AST
36         of the entire standard library built and destroyed would still be too slow. Therefore, this patch limits
37         which parts of the standard library get parsed in the first place. All the functions in the standard library
38         file are sorted by name, and each group of functions with the same name are preceeded by a comment of the
39         form /* Functions named xyz */. At build time, a Python script looks for all these comments, and builds a
40         map from function name to character offset inside the file where those functions begin. At run time, we
41         parse the user program first, look for all function calls within it, and look up those function call names
42         in the map to see which part of the standard library holds those functions. We then parse just that part.
43         Because the standard library can call other functions in the standard library, we do this in a loop until
44         we have exhausted all the functions.
45
46         Covered by existing tests.
47
48         * DerivedSources-input.xcfilelist:
49         * DerivedSources-output.xcfilelist:
50         * DerivedSources.make: gzip the standard library, and add a build step to generate the offset map.
51         * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:
52         (WebCore::WHLSL::AST::CallExpression::setOverloads):
53         (WebCore::WHLSL::AST::CallExpression::function): Every caller of this ASSERT()s the result. Might as well
54         move the ASSERT() into the function.
55         (WebCore::WHLSL::AST::CallExpression::setFunction):
56         * Modules/webgpu/WHLSL/Cocoa/WHLSLStandardLibraryUtilities.cpp: Added.
57         (WebCore::WHLSL::decompressStandardLibrary): Use libcompression. This is why this file is in a Cocoa/
58         subfolder, and is listed in SourcesCocoa.txt instead of Sources.txt.
59         (WebCore::WHLSL::decompressAndDecodeStandardLibrary):
60         (WebCore::WHLSL::NameFinder::takeFunctionNames):
61         (WebCore::WHLSL::includeStandardLibrary): Include only the bits of the standard library which are relevant,
62         as described above.
63         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp: Only emit MSL code for functions which are actually
64         reached. The MSL compiler is a significant amount of our compile time, so reducing the size of the emitted
65         program can significantly improve compile times.
66         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
67         (WebCore::WHLSL::Metal::sharedMetalFunctions):
68         (WebCore::WHLSL::Metal::metalFunctions):
69         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
70         (WebCore::WHLSL::Metal::writeNativeFunction):
71         - Change how load() and store() are written. We need explicit functions because we have explicit atomic
72           types, which HLSL doesn't have. load() and store() aren't present in HLSL.
73         - Delete f16tof32 because they're probably not important and are not obvious how to implement. We can re-add
74           them again later if necessary.
75         - Various fixes to make us generate the correct MSL code for each standard library function.
76         * Modules/webgpu/WHLSL/WHLSLBuildStandardLibraryFunctionMap.py: Added. Build the function map as described
77         above.
78         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
79         (WebCore::WHLSL::resolveByInstantiation): Previously, the standard library included an operator== for two
80         pointers. However, that function should be generated by the compiler instead. This fixes the bug in the
81         compiler which allows the compiler to correctly generate the right function. This also prompted me to file
82         https://bugs.webkit.org/show_bug.cgi?id=199335
83         (WebCore::WHLSL::checkOperatorOverload):
84         (WebCore::WHLSL::Checker::visit):
85         * Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.cpp: Update to the new function() signature.
86         * Modules/webgpu/WHLSL/WHLSLLexer.h: Add a new position() method to the lexer. This isn't actually used
87         in this patch, but it's useful when doing some analysis during parsing. 
88         (WebCore::WHLSL::Lexer::Lexer):
89         (WebCore::WHLSL::Lexer::consumeToken):
90         (WebCore::WHLSL::Lexer::peek const):
91         (WebCore::WHLSL::Lexer::peekFurther const):
92         (WebCore::WHLSL::Lexer::position const):
93         (WebCore::WHLSL::Lexer::state const):
94         (WebCore::WHLSL::Lexer::setState):
95         (WebCore::WHLSL::Lexer::isFullyConsumed const): Fixes a bug where isFullyConsumed() might return true even
96         when there is a token in the ring buffer.
97         (WebCore::WHLSL::Lexer::peek): Deleted.
98         (WebCore::WHLSL::Lexer::peekFurther): Deleted.
99         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
100         (WebCore::WHLSL::NameResolver::visit): Drive-by partial fix of https://bugs.webkit.org/show_bug.cgi?id=199347
101         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp: Call includeStandardLibrary().
102         (WebCore::WHLSL::prepareShared):
103         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
104         * Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp:
105         * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt:
106         * Modules/webgpu/WHLSL/WHLSLStandardLibraryFunctionMap.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp.
107         * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp.
108         * SourcesCocoa.txt:
109         * WebCore.xcodeproj/project.pbxproj:
110
111 2019-07-05  Youenn Fablet  <youenn@apple.com>
112
113         Add fetch quirk for www.bnz.co.nz
114         https://bugs.webkit.org/show_bug.cgi?id=199518
115         rdar://problem/52230914
116
117         Reviewed by Chris Dumez.
118
119         Use fetch quirk to make bnz main page load properly.
120         Manually tested.
121
122         * page/Quirks.cpp:
123         (WebCore::Quirks::shouldIgnoreInvalidSignal const):
124
125 2019-07-05  Robin Morisset  <rmorisset@apple.com>
126
127         [WHLSL] Optimize the lexer
128         https://bugs.webkit.org/show_bug.cgi?id=199520
129
130         Reviewed by Myles Maxfield.
131
132         This patch includes a number of small optimizations to the lexer:
133         - By creating two new types of Token (Invalid and EOF), we can avoid having to manipulate Optional<Token> everywhere
134         - By combining the lexing of identifiers, keywords and operator names, we can avoid re-reading them several times
135         - By storing mere offsets in the tokens instead of string views, we save space in the common case where the string view is unused (e.g. for keywords)
136         - By storing mere offsets in the tokens instead of line numbers, we can simplify the whitespace and comment lexing; and we can easily recompute the line number on demand
137         - By using templates we can avoid constructing and destructing vectors at runtime every time we call tryTypes, consumeTypes or peekTypes; as well as avoiding a call to find().
138         - I also hoisted the length check out of the loop in Lexer::string()
139         All of this combined brought the time spent in the parser when running LayoutTests/webgpu/whlsl-test-harness-test.html 5 times on my machine from 612ms to 462ms.
140
141         I also removed the 'anyCharacter' method since it was dead code.
142         I also removed Lexer::position(), but it is directly equivalent now to peek().startOffset.
143
144         No new tests as there is no intended functional change.
145
146         * Modules/webgpu/WHLSL/WHLSLLexer.cpp:
147         (WebCore::WHLSL::Lexer::Token::typeName):
148         (WebCore::WHLSL::Lexer::consumeTokenFromStream):
149         (WebCore::WHLSL::Lexer::lineNumberFromOffset):
150         (WebCore::WHLSL::isWhitespace):
151         (WebCore::WHLSL::isNewline):
152         (WebCore::WHLSL::Lexer::skipWhitespaceAndComments):
153         (WebCore::WHLSL::Lexer::digitStar const):
154         (WebCore::WHLSL::Lexer::completeOperatorName const):
155         * Modules/webgpu/WHLSL/WHLSLLexer.h:
156         (WebCore::WHLSL::Lexer::Lexer):
157         (WebCore::WHLSL::Lexer::Token::stringView):
158         (WebCore::WHLSL::Lexer::consumeToken):
159         (WebCore::WHLSL::Lexer::peek const):
160         (WebCore::WHLSL::Lexer::peekFurther const):
161         (WebCore::WHLSL::Lexer::state const):
162         (WebCore::WHLSL::Lexer::setState):
163         (WebCore::WHLSL::Lexer::isFullyConsumed const):
164         (WebCore::WHLSL::Lexer::errorString):
165         (WebCore::WHLSL::Lexer::string const):
166         * Modules/webgpu/WHLSL/WHLSLNameResolver.h:
167         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
168         (WebCore::WHLSL::Parser::parse):
169         (WebCore::WHLSL::Parser::peek):
170         (WebCore::WHLSL::Parser::peekFurther):
171         (WebCore::WHLSL::Types::includes):
172         (WebCore::WHLSL::Types::appendNameTo):
173         (WebCore::WHLSL::Types<t>::includes):
174         (WebCore::WHLSL::Types<t>::appendNameTo):
175         (WebCore::WHLSL::Parser::peekTypes):
176         (WebCore::WHLSL::Parser::tryType):
177         (WebCore::WHLSL::Parser::tryTypes):
178         (WebCore::WHLSL::Parser::consumeType):
179         (WebCore::WHLSL::Parser::consumeTypes):
180         (WebCore::WHLSL::Parser::consumeIntegralLiteral):
181         (WebCore::WHLSL::Parser::parseConstantExpression):
182         (WebCore::WHLSL::Parser::parseTypeArgument):
183         (WebCore::WHLSL::Parser::parseTypeSuffixAbbreviated):
184         (WebCore::WHLSL::Parser::parseTypeSuffixNonAbbreviated):
185         (WebCore::WHLSL::Parser::parseType):
186         (WebCore::WHLSL::Parser::parseTypeDefinition):
187         (WebCore::WHLSL::Parser::parseBuiltInSemantic):
188         (WebCore::WHLSL::Parser::parseResourceSemantic):
189         (WebCore::WHLSL::Parser::parseQualifiers):
190         (WebCore::WHLSL::Parser::parseStructureElement):
191         (WebCore::WHLSL::Parser::parseStructureDefinition):
192         (WebCore::WHLSL::Parser::parseEnumerationDefinition):
193         (WebCore::WHLSL::Parser::parseEnumerationMember):
194         (WebCore::WHLSL::Parser::parseNativeTypeDeclaration):
195         (WebCore::WHLSL::Parser::parseParameter):
196         (WebCore::WHLSL::Parser::parseComputeFunctionDeclaration):
197         (WebCore::WHLSL::Parser::parseVertexOrFragmentFunctionDeclaration):
198         (WebCore::WHLSL::Parser::parseRegularFunctionDeclaration):
199         (WebCore::WHLSL::Parser::parseBlockBody):
200         (WebCore::WHLSL::Parser::parseSwitchCase):
201         (WebCore::WHLSL::Parser::parseVariableDeclaration):
202         (WebCore::WHLSL::Parser::parseStatement):
203         (WebCore::WHLSL::Parser::parseEffectfulAssignment):
204         (WebCore::WHLSL::Parser::parseLimitedSuffixOperator):
205         (WebCore::WHLSL::Parser::parseSuffixOperator):
206         (WebCore::WHLSL::Parser::completeAssignment):
207         (WebCore::WHLSL::Parser::parsePossibleTernaryConditional):
208         (WebCore::WHLSL::Parser::completePossibleLogicalBinaryOperation):
209         (WebCore::WHLSL::Parser::completePossibleRelationalBinaryOperation):
210         (WebCore::WHLSL::Parser::completePossibleShift):
211         (WebCore::WHLSL::Parser::completePossibleAdd):
212         (WebCore::WHLSL::Parser::completePossibleMultiply):
213         (WebCore::WHLSL::Parser::parsePossiblePrefix):
214         (WebCore::WHLSL::Parser::parseCallExpression):
215         (WebCore::WHLSL::Parser::parseTerm):
216         * Modules/webgpu/WHLSL/WHLSLParser.h:
217         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
218         (WebCore::WHLSL::anonymousToken):
219
220 2019-07-05  Robin Morisset  <rmorisset@apple.com>
221
222         [WHLSL] Remove the phase resolveCallsInFunctions
223         https://bugs.webkit.org/show_bug.cgi?id=199474
224
225         Reviewed by Myles Maxfield.
226
227         This pass only stores into each property access and call expression vectors of all the functions it might be calling, for use by the Checker afterwards.
228         But the checker is perfectly able to compute a pointer to these vectors by itself.
229         So by removing this pass, we gain the following:
230         - One less pass over the AST
231         - No need to copy these vectors (which can be large for heavily overloaded functions, of which there are quite a few in the stdlib)
232         - No need to have these vectors in the expressions, saving 24 bytes per CallExpression and 72 bytes per PropertyAccessExpression
233         - No need to allocate and then destroy these vectors.
234
235         No new tests as there is no intended functional change.
236
237         * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:
238         (WebCore::WHLSL::AST::CallExpression::castReturnType):
239         * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h:
240         * Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp:
241         (WebCore::WHLSL::AutoInitialize::visit):
242         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
243         (WebCore::WHLSL::resolveFunction):
244         (WebCore::WHLSL::Checker::finishVisiting):
245         (WebCore::WHLSL::Checker::visit):
246         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
247         (WebCore::WHLSL::NameResolver::NameResolver):
248         (WebCore::WHLSL::NameResolver::visit):
249         * Modules/webgpu/WHLSL/WHLSLNameResolver.h:
250         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
251         (WebCore::WHLSL::prepareShared):
252
253 2019-07-05  Youenn Fablet  <youenn@apple.com>
254
255         [iOS] Local capture MediaStreamTrack does not render in portrait mode
256         https://bugs.webkit.org/show_bug.cgi?id=199519
257         <rdar://problem/52689720>
258
259         Reviewed by Eric Carlson.
260
261         RealtimeVideoSource was badly computing its size in case of rotation.
262         Whenever its underlying source is notifying of settings change,
263         compute the size and transpose it only in left/right case.
264
265         Update mock video source to cover that case.
266         Covered by updated test.
267
268         * platform/mediastream/RealtimeVideoSource.cpp:
269         (WebCore::RealtimeVideoSource::sourceSettingsChanged):
270         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
271         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
272         (WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer):
273         * platform/mock/MockRealtimeVideoSource.cpp:
274         (WebCore::MockRealtimeVideoSource::settings):
275         (WebCore::MockRealtimeVideoSource::orientationChanged):
276         (WebCore::MockRealtimeVideoSource::monitorOrientation):
277         * platform/mock/MockRealtimeVideoSource.h:
278
279 2019-07-05  Ryan Haddad  <ryanhaddad@apple.com>
280
281         Unreviewed, rolling out r247115.
282
283         Breaks lldbWebKitTester (and by extension, test-webkitpy)
284
285         Reverted changeset:
286
287         "[WHLSL] Standard library is too big to directly include in
288         WebCore"
289         https://bugs.webkit.org/show_bug.cgi?id=198186
290         https://trac.webkit.org/changeset/247115
291
292 2019-07-05  Ryan Haddad  <ryanhaddad@apple.com>
293
294         Unreviewed, rolling out r247159.
295
296         IndexedDB layout tests are failing the new assert.
297
298         Reverted changeset:
299
300         "ASSERT that a sessionID is valid when encoding it"
301         https://bugs.webkit.org/show_bug.cgi?id=199302
302         https://trac.webkit.org/changeset/247159
303
304 2019-07-05  Ryan Haddad  <ryanhaddad@apple.com>
305
306         Unreviewed, rolling out r247123.
307
308         Caused TestWebKitAPI.Challenge.BasicProposedCredential to
309         fail.
310
311         Reverted changeset:
312
313         "Only allow fetching and removing session credentials from
314         WebsiteDataStore"
315         https://bugs.webkit.org/show_bug.cgi?id=199385
316         https://trac.webkit.org/changeset/247123
317
318 2019-07-05  Youenn Fablet  <youenn@apple.com>
319
320         ASSERT that a sessionID is valid when encoding it
321         https://bugs.webkit.org/show_bug.cgi?id=199302
322
323         Reviewed by Darin Adler.
324
325         For IDBValue, instead of encoding an invalid session ID, encode a boolean that tells there is no sessionID.
326         For IDBRequestData, keep track of whether there is an IDBDatabaseIdentifier
327         and encode/decode accordingly to not encode an invalid sessionID.
328         No observable change of behavior.
329
330         * Modules/indexeddb/IDBValue.h:
331         (WebCore::IDBValue::sessionID const):
332         (WebCore::IDBValue::encode const):
333         (WebCore::IDBValue::decode):
334         * Modules/indexeddb/shared/IDBRequestData.cpp:
335         (WebCore::IDBRequestData::isolatedCopy):
336         * Modules/indexeddb/shared/IDBRequestData.h:
337         (WebCore::IDBRequestData::databaseIdentifier const):
338         (WebCore::IDBRequestData::decode):
339
340 2019-07-05  Zalan Bujtas  <zalan@apple.com>
341
342         [LFC][IFC] Inline runs should be relative to the line's top/left initially
343         https://bugs.webkit.org/show_bug.cgi?id=199157
344         <rdar://problem/52053415>
345
346         Reviewed by Antti Koivisto.
347
348         Let's construct the runs relative to the line's top/left and convert them relative to the formatting root's border box top/left
349         when the line is being closed. When the line moves (floats etc) we don't have to move each runs individually.
350
351         * layout/inlineformatting/InlineLine.cpp:
352         (WebCore::Layout::Line::close):
353         (WebCore::Layout::Line::moveLogicalLeft):
354         (WebCore::Layout::Line::appendInlineContainerStart):
355         (WebCore::Layout::Line::appendTextContent):
356         (WebCore::Layout::Line::appendNonReplacedInlineBox):
357         (WebCore::Layout::Line::appendHardLineBreak):
358
359 2019-07-05  Antti Koivisto  <antti@apple.com>
360
361         REGRESSION(r244218): desmos.com: Cannot scroll formulas region when region is scrollable
362         https://bugs.webkit.org/show_bug.cgi?id=199508
363         <rdar://problem/50925173>
364
365         Reviewed by Zalan Bujtas.
366
367         The page invokes preventDefault on simulated mouse events which stops scrolling.
368         To fix, add a quirk that turns simulated mouse events non-cancelable.
369
370         * dom/MouseEvent.h:
371         * dom/ios/MouseEventIOS.cpp:
372         (WebCore::MouseEvent::create):
373         * page/Quirks.cpp:
374         (WebCore::Quirks::simulatedMouseEventTypeForTarget const):
375         (WebCore::Quirks::shouldDispatchSimulatedMouseEventsOnTarget const): Deleted.
376
377         To avoid adding more similar functions, and for future flexibility, make this one return the type too.
378
379         * page/Quirks.h:
380
381 2019-07-05  Zalan Bujtas  <zalan@apple.com>
382
383         [LFC][IFC] Empty text node should generate empty InlineTextItem
384         https://bugs.webkit.org/show_bug.cgi?id=199495
385         <rdar://problem/52643225>
386
387         Reviewed by Antti Koivisto.
388
389         Empty text nodes generate empty RenderText renderers but they don't generate inline boxes.
390         This patch aligns LFC with the current rendering code.
391
392         * layout/inlineformatting/InlineLine.cpp:
393         (WebCore::Layout::Line::appendTextContent):
394         * layout/inlineformatting/InlineTextItem.cpp:
395         (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
396
397 2019-07-05  Adrian Perez de Castro  <aperez@igalia.com>
398
399         [ATK] Do not use C linkage for functions using C++ features
400         https://bugs.webkit.org/show_bug.cgi?id=199510
401         <rdar://problem/52674702>
402
403         Reviewed by Carlos Garcia Campos.
404
405         No new tests needed.
406
407         * accessibility/atk/WebKitAccessible.h: Move function and type declarations involving
408         C++ features outside of the block delimited by the G_BEGIN_DECLS and G_END_DECLS macros,
409         which were setting the C linkage.
410
411 2019-07-05  Antoine Quint  <graouts@apple.com>
412
413         [Pointer Events] Respect pointer capture when dispatching mouse boundary events and updating :hover
414         https://bugs.webkit.org/show_bug.cgi?id=198999
415         <rdar://problem/51979477>
416
417         Reviewed by Dean Jackson.
418
419         Up until now, we would not account for pointer capture (see ​https://w3c.github.io/pointerevents/#pointer-capture) when dispatching
420         mouse boundary events (mouseover, mouseout, mouseenter, mouseleave) and their counterpart pointer events. We would also not account
421         for it when updating :hover styles.
422
423         Now, when pointer capture changes for an element, we call setCapturingMouseEventsElement() on the EventHandler such that the element
424         that would naturally hit-test is overridden by the pointer capture element when identifying which target to use for the dispatch of
425         boundary mouse events. Additionally, when calling Document::prepareMouseEvent(), we also use the pointer capture element to
426         pass down to Document::updateHoverActiveState() such that :hover styles are applied to the correct element.
427
428         * dom/Document.cpp:
429         (WebCore::Document::prepareMouseEvent): When a new event is going to be dispatched, we must run the Process Pending Capture Element
430         steps as mandated by the Pointer Events spec. Calling this will dispatch the appropriate pointer capture change events and also
431         required boundary events since EventHandler::setCapturingMouseEventsElement() calls into EventHandler::updateMouseEventTargetNode().
432         Since this may update the capturing mouse events element, we ensure that we call updateHoverActiveState() with a flag that indicates that.
433         Finally, we use the capturing mouse events element instead of the hit-testing element to pass to updateHoverActiveState() to ensure
434         that is has :hover styles applied.
435         (WebCore::Document::updateHoverActiveState): Account for the new CaptureChange flag to force the invalidation of the :hover and :active
436         elements chain at all times when the capturing mouse events element changed.
437         * dom/Document.h:
438         * dom/PointerEvent.h: Update PointerEvent::createForPointerCapture() to take specific parameters rather than a single PointerEvent to
439         set the pointerId, isPrimary and pointerType properties of the generated event. This is required to call processPendingPointerCapture()
440         outside of PointerEvent dispatch logic since we now call it from Document::prepareMouseEvent() where we haven't yet generated such an
441         event.
442         * page/EventHandler.cpp:
443         (WebCore::EventHandler::pointerCaptureElementDidChange): When a new pointer capture element is set, call updateMouseEventTargetNode()
444         to ensure that boundary events are fired to indicate the pointer capture state change.
445         (WebCore::EventHandler::prepareMouseEvent): Keep track of the last PlatformMouseEvent used to prepare a mouse event so that we can use
446         it when setCapturingMouseEventsElement() is called.
447         * page/EventHandler.h:
448         * page/PointerCaptureController.cpp:
449         (WebCore::PointerCaptureController::pointerCaptureElement): Since Document::prepareMouseEvent() needs to know the current pointer capture
450         element, add a new public method that indicates the pointer capture element if that element is contained in the provided document. We need
451         to provide the document since PointerCaptureController is owned by the Page and may manage several documents.
452         (WebCore::PointerCaptureController::dispatchEvent): Only run the Process Pending Capture Element steps when dealing with a touch or pen
453         event since those steps are already ran for mouse events in Document::prepareMouseEvent(). Additionally, since the element target is already
454         set to be the pointer capture element with the changes made to processPendingPointerCapture(), and because on iOS pointer capture is always
455         active, we can remove the code that would retarget the event to the pointer capture element.
456         (WebCore::PointerCaptureController::pointerEventWasDispatched):
457         (WebCore::PointerCaptureController::cancelPointer):
458         (WebCore::PointerCaptureController::processPendingPointerCapture): We now call into EventHandler::setCapturingMouseEventsElement() when the
459         capture target element changes. We must be careful to call this method prior to dispatching the "gotpointercapture" event and after dispatching
460         the "lostpointercapture" event so that boundary events are fired at the right time.
461         * page/PointerCaptureController.h:
462
463 2019-07-04  Zalan Bujtas  <zalan@apple.com>
464
465         [ContentChangeObserver] didFinishTransition triggers a nested style recalc via isConsideredClickable
466         https://bugs.webkit.org/show_bug.cgi?id=199506
467         <rdar://problem/52656221>
468
469         Reviewed by Ryosuke Niwa.
470
471         isConsideredClickable() may trigger style update through Node::computeEditability. Let's adjust the observer state in the next runloop. 
472
473         Test: fast/events/touch/ios/content-observation/animation-end-with-visiblity-change-and-recursive-update-style.html
474
475         * page/ios/ContentChangeObserver.cpp:
476         (WebCore::ContentChangeObserver::didFinishTransition):
477         * page/ios/ContentChangeObserver.h:
478
479 2019-07-04  Zalan Bujtas  <zalan@apple.com>
480
481         [ContentChangeObserver] Limit mouseOut dispatching after synthetic click to YouTube.com
482         https://bugs.webkit.org/show_bug.cgi?id=199497
483         <rdar://problem/52361019>
484
485         Reviewed by Wenson Hsieh.
486
487         r242798 introduced synthetic mouseOut dispatching soon after sythentic click to dismiss certain type of content (e.g. video control bar on YouTube).
488         However on many sites, it resulted in dismissing useful content, like menu panes and other, non-clickable but informative content.
489         This patch limits the mouseOut dispatching to YouTube.com.
490
491         Test: fast/events/touch/ios/content-observation/mouse-out-event-should-not-fire-on-click.html
492
493         * page/Quirks.cpp:
494         (WebCore::Quirks::needsYouTubeMouseOutQuirk const):
495         * page/Quirks.h:
496         * page/Settings.yaml:
497         * testing/InternalSettings.cpp:
498         (WebCore::InternalSettings::Backup::Backup):
499         (WebCore::InternalSettings::Backup::restoreTo):
500         (WebCore::InternalSettings::setShouldDispatchSyntheticMouseOutAfterSyntheticClick):
501         * testing/InternalSettings.h:
502         * testing/InternalSettings.idl:
503
504 2019-07-04  Ryan Haddad  <ryanhaddad@apple.com>
505
506         Unreviewed, rolling out r247127.
507
508         Broke the watchOS build.
509
510         Reverted changeset:
511
512         "[WHLSL] Remove the phase resolveCallsInFunctions"
513         https://bugs.webkit.org/show_bug.cgi?id=199474
514         https://trac.webkit.org/changeset/247127
515
516 2019-07-03  Simon Fraser  <simon.fraser@apple.com>
517
518         Some layers inside overflow:scroll don't move back to correct positions when the contents are shrunk
519         https://bugs.webkit.org/show_bug.cgi?id=199464
520         rdar://problem/52613285
521
522         Reviewed by Sam Weinig.
523         
524         When an overflow scroller's content shrink and it becomes non-scrollable, the 'boundsOrigin' in
525         the ancestor clipping stacks of related layers wouldn't get reset to zero, leaving layers in
526         the wrong place, so always set boundsOrigin to zero on the clipping layers of non-overflow entries
527         in the ancestor clipping stack.
528
529         Test: compositing/scrolling/async-overflow-scrolling/become-non-scrollable-with-child.html
530
531         * rendering/RenderLayerBacking.cpp:
532         (WebCore::RenderLayerBacking::updateGeometry):
533
534 2019-07-04  Konstantin Tokarev  <annulen@yandex.ru>
535
536         HyphenationLibHyphen: Include GLib-related headers only for PLATFORM(GTK)
537         https://bugs.webkit.org/show_bug.cgi?id=199469
538
539         Reviewed by Michael Catanzaro.
540
541         Also added compile guard for a couple of functions used only in GTK port.
542
543         * platform/text/hyphen/HyphenationLibHyphen.cpp:
544
545 2019-07-03  Eric Carlson  <eric.carlson@apple.com>
546
547         [MSE] Add more debug and error logging
548         https://bugs.webkit.org/show_bug.cgi?id=199473
549         <rdar://problem/52615882>
550
551         Reviewed by Jer Noble.
552
553         * Modules/mediasource/SourceBuffer.cpp:
554         (WebCore::SourceBuffer::provideMediaData): Log if we don't enqueue every buffer.
555
556         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
557         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal): Log if we return
558         without starting playback.
559
560         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
561         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Log if 
562         prerollDecodeWithCompletionHandler fails.
563
564 2019-07-03  Simon Fraser  <simon.fraser@apple.com>
565
566         RELEASE_ASSERT in WebCore: WebCore::ScrollingStateTree::insertNode()
567         https://bugs.webkit.org/show_bug.cgi?id=199479
568         rdar://problem/52392556
569
570         Reviewed by Zalan Bujtas.
571         
572         Certain compositing tree updates could leave a layer with a ScrollingProxy role, but having an
573         AncestorClippingStack with no overflow scrolling layers - for example, a related scroller could become
574         scrollable, but we failed to mark the layer with the ancestor clippings stack as needing a geometry update.
575
576         When this happened updateScrollingNodeForScrollingProxyRole() would return 0, causing the next child to be
577         inserted with a parent of 0 (which should only happen for the root), and triggering a release assert in
578         ScrollingStateTree::insertNode().
579
580         Fix by ensuring that updateScrollingNodeForScrollingProxyRole() always returns the existing parentNodeID if we
581         don't have a new node to insert.
582
583         Test: scrollingcoordinator/scrolling-tree/scrolling-proxy-with-no-scrolling-layer.html
584
585         * rendering/RenderLayerBacking.cpp:
586         (WebCore::RenderLayerBacking::updateAncestorClippingStack):
587         * rendering/RenderLayerCompositor.cpp:
588         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingProxyRole):
589
590 2019-07-03  Konstantin Tokarev  <annulen@yandex.ru>
591
592         RenderLayerCompositor.cpp should include RenderImage.h
593         https://bugs.webkit.org/show_bug.cgi?id=199478
594
595         Reviewed by Michael Catanzaro.
596
597         * rendering/RenderLayerCompositor.cpp:
598
599 2019-07-03  Robin Morisset  <rmorisset@apple.com>
600
601         [WHLSL] Remove the phase resolveCallsInFunctions
602         https://bugs.webkit.org/show_bug.cgi?id=199474
603
604         Reviewed by Myles C. Maxfield.
605
606         This pass only stores into each property access and call expression vectors of all the functions it might be calling, for use by the Checker afterwards.
607         But the checker is perfectly able to compute a pointer to these vectors by itself.
608         So by removing this pass, we gain the following:
609         - One less pass over the AST
610         - No need to copy these vectors (which can be large for heavily overloaded functions, of which there are quite a few in the stdlib)
611         - No need to have these vectors in the expressions, saving 24 bytes per CallExpression and 72 bytes per PropertyAccessExpression
612         - No need to allocate and then destroy these vectors.
613
614         No new tests as there is no intended functional change.
615
616         * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:
617         (WebCore::WHLSL::AST::CallExpression::castReturnType):
618         * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h:
619         * Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp:
620         (WebCore::WHLSL::AutoInitialize::visit):
621         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
622         (WebCore::WHLSL::resolveFunction):
623         (WebCore::WHLSL::Checker::finishVisiting):
624         (WebCore::WHLSL::Checker::visit):
625         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
626         (WebCore::WHLSL::NameResolver::NameResolver):
627         (WebCore::WHLSL::NameResolver::visit):
628         * Modules/webgpu/WHLSL/WHLSLNameResolver.h:
629         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
630         (WebCore::WHLSL::prepareShared):
631
632 2019-07-03  Robin Morisset  <rmorisset@apple.com>
633
634         [WHLSL] Make the destructor of VariableDeclaration non-virtual
635         https://bugs.webkit.org/show_bug.cgi?id=199460
636
637         Reviewed by Myles C. Maxfield.
638
639         Three steps:
640         - Remove WHLSL::AST::Value, inlining it into its children (it is trivial, it just has one field m_origin with a getter and nothing else)
641         - Mark WHLSL::AST::VariableDeclaration final
642         - Now that it inherits from nothing and nothing can inherit from it, there is no reason for it to have any virtual method, including its destructor.
643
644         This not only saves 8 bytes from every variable declaration (for the virtual table pointer), it also should make destructing the AST at the end of compilation a bit faster by removing the virtual destructor call.
645
646         No new tests as there is no intended functional change.
647
648         * Modules/webgpu/WHLSL/AST/WHLSLAST.h:
649         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
650         (WebCore::WHLSL::AST::Expression::Expression):
651         (WebCore::WHLSL::AST::Expression::origin const):
652         * Modules/webgpu/WHLSL/AST/WHLSLStatement.h:
653         (WebCore::WHLSL::AST::Statement::Statement):
654         (WebCore::WHLSL::AST::Statement::origin const):
655         * Modules/webgpu/WHLSL/AST/WHLSLValue.h: Removed.
656         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
657         * Modules/webgpu/WHLSL/WHLSLParser.h:
658         * WebCore.xcodeproj/project.pbxproj:
659
660 2019-07-03  Sihui Liu  <sihui_liu@apple.com>
661
662         Only allow fetching and removing session credentials from WebsiteDataStore
663         https://bugs.webkit.org/show_bug.cgi?id=199385
664
665         Reviewed by Alex Christensen.
666
667         Fetch and remove only session credentials from NSURLCredentialStorage.
668
669         Modified existing API tests: WKWebsiteDataStore.FetchPersistentCredentials
670
671         * platform/network/CredentialStorage.cpp:
672         (WebCore::CredentialStorage::originsWithCredentials const):
673         (WebCore::CredentialStorage::originsWithSessionCredentials):
674         (WebCore::CredentialStorage::removeSessionCredentialsWithOrigins):
675         (WebCore::CredentialStorage::clearSessionCredentials):
676         * platform/network/CredentialStorage.h:
677         * platform/network/mac/CredentialStorageMac.mm:
678         (WebCore::CredentialStorage::originsWithSessionCredentials):
679         (WebCore::CredentialStorage::removeSessionCredentialsWithOrigins):
680         (WebCore::CredentialStorage::clearSessionCredentials):
681         (WebCore::CredentialStorage::originsWithPersistentCredentials): Deleted.
682
683 2019-07-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
684
685         The destructor of CSSAnimationControllerPrivate must explicitly clear the composite animations
686         https://bugs.webkit.org/show_bug.cgi?id=199415
687
688         Reviewed by Simon Fraser.
689
690         After the destructor of CSSAnimationControllerPrivate exists, the non
691         static members are deleted. When the HashMap m_compositeAnimations is
692         deleted, its entries are deleted. The destructor of CompositeAnimation
693         calls the method CSSAnimationControllerPrivate::animationWillBeRemoved()
694         back through its back reference m_animationController. The non static
695         members of CSSAnimationControllerPrivate are being deleted and it is
696         incorrect to try to use any of these members after exiting the destructor.
697
698         We need to explicitly clear the composite animations before exiting the 
699         destructor of CSSAnimationControllerPrivate.
700
701         * page/animation/CSSAnimationController.cpp:
702         (WebCore::CSSAnimationControllerPrivate::~CSSAnimationControllerPrivate):
703
704 2019-07-03  Jer Noble  <jer.noble@apple.com>
705
706         HTMLMediaElement can hold onto display sleep assertion while process is suspended.
707         https://bugs.webkit.org/show_bug.cgi?id=199471
708         <rdar://problem/52124320>
709
710         If the WebContent process is suspended before HTMLMediaElement gets a callback telling it
711         that the MediaPlayer has stopped playing, the SleepDisabler may stay set (and hold a display
712         or system sleep assertion) for the entire duration the process is suspended, causing excess
713         power drain.
714
715         Add a PlatformMediaSessionClient method (and an implementation in HTMLMediaElement) which will
716         be called during the preperation for process suspension, and in this callback, clear the
717         SleepDisabler token.
718
719         Reviewed by Eric Carlson.
720
721         * html/HTMLMediaElement.cpp:
722         (WebCore::HTMLMediaElement::shouldDisableSleep const):
723         (WebCore::HTMLMediaElement::processIsSuspendedChanged):
724         * html/HTMLMediaElement.h:
725         * platform/audio/PlatformMediaSession.h:
726         (WebCore::PlatformMediaSessionClient::processIsSuspendedChanged):
727         * platform/audio/PlatformMediaSessionManager.cpp:
728         (WebCore::PlatformMediaSessionManager::processWillSuspend):
729         (WebCore::PlatformMediaSessionManager::processDidResume):
730         * platform/audio/PlatformMediaSessionManager.h:
731         (WebCore::PlatformMediaSessionManager::processIsSuspended const):
732
733 2019-07-03  Jonathan Bedard  <jbedard@apple.com>
734
735         [Catalina] Enable WebKit build
736         https://bugs.webkit.org/show_bug.cgi?id=199209
737
738         Reviewed by Darin Adler.
739
740         No new tests, Catalina test expectations will be migrated in the near future.
741
742         * WebCorePrefix.h: Exclude the header which declares SecTrustedApplicationCreateFromPath unavailable on Mac.
743         * crypto/mac/SerializedCryptoKeyWrapMac.mm: Ensure that we define SecTrustedApplicationCreateFromPath
744         before other headers declare it unavailable on Mac.
745
746 2019-07-02  Myles C. Maxfield  <mmaxfield@apple.com>
747
748         [WHLSL] Standard library is too big to directly include in WebCore
749         https://bugs.webkit.org/show_bug.cgi?id=198186
750         <rdar://problem/51288898>
751
752         Reviewed by Saam Barati.
753
754         This patch adds almost the entire remainder of the standard library. There are a few
755         pieces missing:
756         - step() because of https://bugs.webkit.org/show_bug.cgi?id=199289
757         - sign() also because of https://bugs.webkit.org/show_bug.cgi?id=199289
758         - faceforward() because it calls sign()
759         - Some of the more rarely-used texturing functions (e.g. Gather()) https://bugs.webkit.org/show_bug.cgi?id=195813
760         - RWTextures https://bugs.webkit.org/show_bug.cgi?id=198985
761
762         There were two problems with adding so many standard library functions:
763         - We didn't want to increase the WebCore binary size that much
764         - Compiling all the functions at runtime took 7 seconds, which is much too long
765
766         This patch addresses the first problem by gzipping the standard library before including it in the binary.
767         At runtime, we use libcompression to unzip it.
768
769         To address the second problem, we did some analysis and found that 14% of that 7 seconds was simply
770         destroying all the AST nodes. Even if we eliminated all processing of the AST, simply having the AST
771         of the entire standard library built and destroyed would still be too slow. Therefore, this patch limits
772         which parts of the standard library get parsed in the first place. All the functions in the standard library
773         file are sorted by name, and each group of functions with the same name are preceeded by a comment of the
774         form /* Functions named xyz */. At build time, a Python script looks for all these comments, and builds a
775         map from function name to character offset inside the file where those functions begin. At run time, we
776         parse the user program first, look for all function calls within it, and look up those function call names
777         in the map to see which part of the standard library holds those functions. We then parse just that part.
778         Because the standard library can call other functions in the standard library, we do this in a loop until
779         we have exhausted all the functions.
780
781         Covered by existing tests.
782
783         * DerivedSources-input.xcfilelist:
784         * DerivedSources-output.xcfilelist:
785         * DerivedSources.make: gzip the standard library, and add a build step to generate the offset map.
786         * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:
787         (WebCore::WHLSL::AST::CallExpression::setOverloads):
788         (WebCore::WHLSL::AST::CallExpression::function): Every caller of this ASSERT()s the result. Might as well
789         move the ASSERT() into the function.
790         (WebCore::WHLSL::AST::CallExpression::setFunction):
791         * Modules/webgpu/WHLSL/Cocoa/WHLSLStandardLibraryUtilities.cpp: Added.
792         (WebCore::WHLSL::decompressStandardLibrary): Use libcompression. This is why this file is in a Cocoa/
793         subfolder, and is listed in SourcesCocoa.txt instead of Sources.txt.
794         (WebCore::WHLSL::decompressAndDecodeStandardLibrary):
795         (WebCore::WHLSL::NameFinder::takeFunctionNames):
796         (WebCore::WHLSL::includeStandardLibrary): Include only the bits of the standard library which are relevant,
797         as described above.
798         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp: Only emit MSL code for functions which are actually
799         reached. The MSL compiler is a significant amount of our compile time, so reducing the size of the emitted
800         program can significantly improve compile times.
801         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
802         (WebCore::WHLSL::Metal::sharedMetalFunctions):
803         (WebCore::WHLSL::Metal::metalFunctions):
804         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
805         (WebCore::WHLSL::Metal::writeNativeFunction):
806         - Change how load() and store() are written. We need explicit functions because we have explicit atomic
807           types, which HLSL doesn't have. load() and store() aren't present in HLSL.
808         - Delete f16tof32 because they're probably not important and are not obvious how to implement. We can re-add
809           them again later if necessary.
810         - Various fixes to make us generate the correct MSL code for each standard library function.
811         * Modules/webgpu/WHLSL/WHLSLBuildStandardLibraryFunctionMap.py: Added. Build the function map as described
812         above.
813         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
814         (WebCore::WHLSL::resolveByInstantiation): Previously, the standard library included an operator== for two
815         pointers. However, that function should be generated by the compiler instead. This fixes the bug in the
816         compiler which allows the compiler to correctly generate the right function. This also prompted me to file
817         https://bugs.webkit.org/show_bug.cgi?id=199335
818         (WebCore::WHLSL::checkOperatorOverload):
819         (WebCore::WHLSL::Checker::visit):
820         * Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.cpp: Update to the new function() signature.
821         * Modules/webgpu/WHLSL/WHLSLLexer.h: Add a new position() method to the lexer. This isn't actually used
822         in this patch, but it's useful when doing some analysis during parsing. 
823         (WebCore::WHLSL::Lexer::Lexer):
824         (WebCore::WHLSL::Lexer::consumeToken):
825         (WebCore::WHLSL::Lexer::peek const):
826         (WebCore::WHLSL::Lexer::peekFurther const):
827         (WebCore::WHLSL::Lexer::position const):
828         (WebCore::WHLSL::Lexer::state const):
829         (WebCore::WHLSL::Lexer::setState):
830         (WebCore::WHLSL::Lexer::isFullyConsumed const): Fixes a bug where isFullyConsumed() might return true even
831         when there is a token in the ring buffer.
832         (WebCore::WHLSL::Lexer::peek): Deleted.
833         (WebCore::WHLSL::Lexer::peekFurther): Deleted.
834         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
835         (WebCore::WHLSL::NameResolver::visit): Drive-by partial fix of https://bugs.webkit.org/show_bug.cgi?id=199347
836         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp: Call includeStandardLibrary().
837         (WebCore::WHLSL::prepareShared):
838         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
839         * Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp:
840         * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt:
841         * Modules/webgpu/WHLSL/WHLSLStandardLibraryFunctionMap.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp.
842         * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp.
843         * SourcesCocoa.txt:
844         * WebCore.xcodeproj/project.pbxproj:
845
846 2019-07-03  Jer Noble  <jer.noble@apple.com>
847
848         Exception thrown from -[AVSampleBufferRenderSynchronizer addRenderer:], not a valid renderer.
849         https://bugs.webkit.org/show_bug.cgi?id=199419
850         <rdar://problem/52141139>
851
852         Reviewed by Eric Carlson.
853
854         Sometimes, -[AVSampleBufferDisplayLayer init] will return nil. When that happens, passing a nil
855         pointer to -addRenderer: will throw an exception.
856
857         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
858         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
859
860 2019-07-03  Robin Morisset  <rmorisset@apple.com>
861
862         [WHLSL] "Semantic" should be held by a unique_ptr, not an Optional
863         https://bugs.webkit.org/show_bug.cgi?id=199462
864
865         Reviewed by Myles C. Maxfield.
866
867         Most StructureElement, FunctionDeclaration and (especially) VariableDeclaration don't have a 'Semantic' field.
868         Using an Optional<Semantic> to represent this is a major memory waste, as Semantic is 56 bytes, so Optional<Semantic> is 64 bytes!
869         Putting one level of indirection through a unique_ptr thus saves 56 bytes for each VariableDeclaration (and FunctionDeclaration and StructureElement) that does not have a Semantic,
870         at the low cost of one pointer dereference when accessing the field for those that have one.
871
872         This patch also reorders the fields of FunctionDefinition to save another 8 bytes.
873
874         No new tests as there is no intended functional change.
875
876         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
877         (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration):
878         (WebCore::WHLSL::AST::FunctionDeclaration::semantic):
879         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
880         (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression):
881         * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h:
882         (WebCore::WHLSL::AST::StructureElement::StructureElement):
883         (WebCore::WHLSL::AST::StructureElement::semantic):
884         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
885         (WebCore::WHLSL::AST::VariableDeclaration::VariableDeclaration):
886         (WebCore::WHLSL::AST::VariableDeclaration::semantic):
887         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
888         (WebCore::WHLSL::resolveWithOperatorAnderIndexer):
889         (WebCore::WHLSL::resolveWithOperatorLength):
890         (WebCore::WHLSL::resolveWithReferenceComparator):
891         * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp:
892         (WebCore::WHLSL::Gatherer::visit):
893         (WebCore::WHLSL::gatherEntryPointItems):
894         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
895         (WebCore::WHLSL::Parser::parseSemantic):
896         * Modules/webgpu/WHLSL/WHLSLParser.h:
897         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
898         (WebCore::WHLSL::preserveVariableLifetimes):
899         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
900         (WebCore::WHLSL::wrapAnderCallArgument):
901         (WebCore::WHLSL::modify):
902         (WebCore::WHLSL::PropertyResolver::visit):
903         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
904         (WebCore::WHLSL::synthesizeArrayOperatorLength):
905         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
906         (WebCore::WHLSL::synthesizeConstructors):
907         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
908         (WebCore::WHLSL::synthesizeEnumerationFunctions):
909         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
910         (WebCore::WHLSL::synthesizeStructureAccessors):
911
912 2019-07-03  Robin Morisset  <rmorisset@apple.com>
913
914         [WHLSL] WHLSL::AST::Node is useless
915         https://bugs.webkit.org/show_bug.cgi?id=199391
916
917         Reviewed by Dean Jackson.
918
919         It has no member, no non-trivial method, and we never access an AST node completely generically.
920         So WHLSL::AST::Node can be removed, as a first step towards removing the virtual table pointer from most AST nodes (and avoiding a virtual destructor call at the end of the compiler).
921
922         No new test because there is no functional change.
923
924         * Modules/webgpu/WHLSL/AST/WHLSLAST.h:
925         * Modules/webgpu/WHLSL/AST/WHLSLBaseFunctionAttribute.h:
926         * Modules/webgpu/WHLSL/AST/WHLSLBaseSemantic.h:
927         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h:
928         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
929         * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h:
930         * Modules/webgpu/WHLSL/AST/WHLSLReplaceWith.h: Renamed from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNode.h.
931         (WebCore::WHLSL::AST::replaceWith):
932         * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h:
933         * Modules/webgpu/WHLSL/AST/WHLSLType.h:
934         * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h:
935         * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
936         * Modules/webgpu/WHLSL/AST/WHLSLValue.h:
937         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
938         * Modules/webgpu/WHLSL/WHLSLParser.h:
939         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
940         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
941         * WebCore.xcodeproj/project.pbxproj:
942
943 2019-07-03  Youenn Fablet  <youenn@apple.com>
944
945         Strengthen updating/removing of registrations from the database
946         https://bugs.webkit.org/show_bug.cgi?id=199450
947         rdar://problem/51891395
948
949         Reviewed by Chris Dumez.
950
951         SWServerWorker is ref counted and has a ref to its SWServer.
952         There is thus a possibility for SWServerWorker to live longer than its SWServer.
953         To mitigate this, have SWServerWorker use a WeakPtr<SWServer> and
954         check whether SWServer is null when receiving messages from WebProcess.
955         Make also sure that RegistrationStore updated registration map does not get corrupted by checking
956         the registration keys explicitly.
957
958         Covered by existing tests.
959
960         * workers/service/ServiceWorkerRegistrationKey.h:
961         (WebCore::ServiceWorkerRegistrationKey::operator!= const):
962         (WebCore::ServiceWorkerRegistrationKey::isEmpty const):
963         * workers/service/server/RegistrationStore.cpp:
964         (WebCore::RegistrationStore::updateRegistration):
965         (WebCore::RegistrationStore::removeRegistration):
966         (WebCore::RegistrationStore::addRegistrationFromDatabase):
967         * workers/service/server/RegistrationStore.h:
968         * workers/service/server/SWServer.cpp:
969         (WebCore::SWServer::workerByID const):
970         (WebCore::SWServer::removeRegistration):
971         * workers/service/server/SWServer.h:
972         * workers/service/server/SWServerWorker.cpp:
973         (WebCore::SWServerWorker::SWServerWorker):
974         (WebCore::m_scriptResourceMap):
975         (WebCore::SWServerWorker::contextData const):
976         (WebCore::SWServerWorker::terminate):
977         (WebCore::SWServerWorker::scriptContextFailedToStart):
978         (WebCore::SWServerWorker::scriptContextStarted):
979         (WebCore::SWServerWorker::didFinishInstall):
980         (WebCore::SWServerWorker::didFinishActivation):
981         (WebCore::SWServerWorker::contextTerminated):
982         (WebCore::SWServerWorker::findClientByIdentifier const):
983         (WebCore::SWServerWorker::matchAll):
984         (WebCore::SWServerWorker::userAgent const):
985         (WebCore::SWServerWorker::claim):
986         (WebCore::SWServerWorker::skipWaiting):
987         (WebCore::SWServerWorker::setHasPendingEvents):
988         (WebCore::SWServerWorker::setState):
989         * workers/service/server/SWServerWorker.h:
990         (WebCore::SWServerWorker::server):
991
992 2019-07-03  Sam Weinig  <weinig@apple.com>
993
994         Adopt simple structured bindings in more places
995         https://bugs.webkit.org/show_bug.cgi?id=199247
996
997         Reviewed by Alex Christensen.
998
999         Replaces simple uses of std::tie() with structured bindings. Does not touch
1000         uses of std::tie() that are not initial declarations, use std::ignore or in
1001         case where the binding is captured by a lambda, as structured bindings don't
1002         work for those cases yet.
1003
1004         * css/StyleResolver.cpp:
1005         (WebCore::checkForOrientationChange):
1006         * page/csp/ContentSecurityPolicy.cpp:
1007         (WebCore::ContentSecurityPolicy::allowInlineScript const):
1008         (WebCore::ContentSecurityPolicy::allowInlineStyle const):
1009         * platform/graphics/ComplexTextController.cpp:
1010         (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
1011         * platform/graphics/PathUtilities.cpp:
1012         (WebCore::PathUtilities::pathWithShrinkWrappedRectsForOutline):
1013         * platform/graphics/WidthIterator.cpp:
1014         (WebCore::WidthIterator::advanceInternal):
1015         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1016         (WebCore::FontCache::createFontPlatformData):
1017         (WebCore::FontCache::systemFallbackForCharacters):
1018         (WebCore::FontCache::lastResortFallbackFont):
1019         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
1020         (WebCore::FontFamilySpecificationCoreText::fontRanges const):
1021         * platform/network/SocketStreamHandleImpl.cpp:
1022         (WebCore::cookieDataForHandshake):
1023         * rendering/InlineTextBox.cpp:
1024         (WebCore::InlineTextBox::selectionState):
1025         (WebCore::createMarkedTextFromSelectionInBox):
1026         * rendering/svg/SVGInlineTextBox.cpp:
1027         (WebCore::SVGInlineTextBox::paintSelectionBackground):
1028         * style/StyleResolveForDocument.cpp:
1029         (WebCore::Style::resolveForDocument):
1030         * svg/animation/SVGSMILElement.cpp:
1031         (WebCore::SVGSMILElement::constructAttributeName const):
1032
1033 2019-07-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1034
1035         REGRESSION (iOS 13): Tapping an element with a click event handler no longer clears the selection
1036         https://bugs.webkit.org/show_bug.cgi?id=199430
1037
1038         Reviewed by Tim Horton.
1039
1040         After <trac.webkit.org/r245067>, we no longer immediately clear the text selection when recognizing a single tap
1041         in WKContentView, and instead only clear it out in the case where the single tap didn't result in a click event
1042         in the web process. This fixed an issue wherein the text selection would be prematurely cleared when tapping,
1043         but also made it such that tapping on an element with a click event handler would not cause the selection to
1044         change, even if preventDefault() is not called on mousedown. On web pages that add a click event listener to
1045         `document.body`, it's nearly impossible to dismiss text selections by tapping elsewhere in the body.
1046
1047         On macOS, this works because EventHandler::handleMousePressEventSingleClick contains logic to modify the
1048         selection when handling a mousedown, as a part of default behavior. However, there is platform-specific logic
1049         added in <trac.webkit.org/r233311> that avoids changing the selection when handling a synthetic mousedown on
1050         iOS; this is because we defer to the single tap text interaction gesture on iOS, which (among other things)
1051         provides additional support for moving the selection to word boundaries, instead of the editing position
1052         directly under the click.
1053
1054         However, no such platform-specific text interaction single tap gesture exists for non-editable text, so there's
1055         no reason we need to bail in the case where the root editable element is null. We can fix this bug without
1056         breaking the fix in r233311 by matching macOS behavior and not bailing via early return in the case where the
1057         single tap would move selection into non-editable text.
1058
1059         Tests: editing/selection/ios/clear-selection-after-tapping-on-element-with-click-handler.html
1060                editing/selection/ios/persist-selection-after-tapping-on-element-with-mousedown-handler.html
1061
1062         * page/EventHandler.cpp:
1063         (WebCore::EventHandler::handleMousePressEventSingleClick):
1064
1065 2019-07-03  Ryan Haddad  <ryanhaddad@apple.com>
1066
1067         Unreviewed, rolling out r246616.
1068
1069         Caused http/tests/inspector/network/har/har-page.html to fail
1070         on Catalina.
1071
1072         Reverted changeset:
1073
1074         "Web Inspector: Network: replace CFNetwork SPI with new API
1075         where able"
1076         https://bugs.webkit.org/show_bug.cgi?id=198762
1077         https://trac.webkit.org/changeset/246616
1078
1079 2019-07-03  Andres Gonzalez  <andresg_22@apple.com>
1080
1081         Safari hanging while loading pages - WebCore::AccessibilityRenderObject::visiblePositionRangeForLine.
1082         https://bugs.webkit.org/show_bug.cgi?id=199434
1083         <rdar://problem/52475140>
1084
1085         Reviewed by Chris Fleizach.
1086
1087         Tests were disabled until underlying bug is fixed.
1088
1089         Rolling out a workaround for CharacterIterator::advance bug because it
1090         seems to be causing a hang in Safari.
1091         * editing/Editing.cpp:
1092         (WebCore::visiblePositionForIndexUsingCharacterIterator):
1093
1094 2019-07-02  Simon Fraser  <simon.fraser@apple.com>
1095
1096         REGRESSION (r246723): ScrollingTreeOverflowScrollProxyNode::m_overflowScrollingNodeID is uninitialized sometimes
1097         https://bugs.webkit.org/show_bug.cgi?id=199432
1098
1099         Reviewed by Antti Koivisto.
1100         
1101         I noticed while debugging rdar://problem/52291642 that m_overflowScrollingNodeID was uninitialized in
1102         ScrollingTreeOverflowScrollProxyNode. This could lead to the wrong node being found by m_scrollingTree->nodeForID(),
1103         which could result in type confusion bugs.
1104         
1105         This can happen with negative z-order layers when we fail to find their related scrolling tree node
1106         on the first pass.
1107
1108         * page/scrolling/cocoa/ScrollingTreeOverflowScrollProxyNode.h:
1109
1110 2019-07-02  Zan Dobersek  <zdobersek@igalia.com>
1111
1112         FetchResponse::BodyLoader should not be movable
1113         https://bugs.webkit.org/show_bug.cgi?id=199380
1114
1115         Reviewed by Youenn Fablet.
1116
1117         The FetchResponse::BodyLoader class has a FetchLoader member that is
1118         initialized in the start() method with the reference of the owning
1119         FetchResponse::BodyLoader object. This reference doesn't change when
1120         the FetchResponse::BodyLoader object is moved into a different object
1121         and the FetchLoader unique_ptr along with it, leading to problems when
1122         that FetchLoader tries to invoke the FetchLoaderClient methods on the
1123         FetchResponse::BodyLoader object that's been moved from and is possibly
1124         already destroyed.
1125
1126         To avoid this, the FetchResponse::BodyLoader has the move constructor
1127         removed and is now managed through std::unique_ptr instead of Optional,
1128         ensuring the FetchResponse::BodyLoader object itself isn't moved around.
1129
1130         * Modules/fetch/FetchResponse.cpp:
1131         (WebCore::FetchResponse::fetch):
1132         (WebCore::FetchResponse::BodyLoader::didSucceed):
1133         (WebCore::FetchResponse::BodyLoader::didFail):
1134         * Modules/fetch/FetchResponse.h:
1135
1136 2019-07-02  Said Abou-Hallawa  <sabouhallawa@apple.com>
1137
1138         Assertion fires when animating the 'class' attribute of an SVG element
1139         https://bugs.webkit.org/show_bug.cgi?id=197372
1140
1141         Reviewed by Ryosuke Niwa.
1142
1143         All instances of SVG animated properties have to share a single animVal
1144         such that once its value is progressed, all the instances will see the
1145         change. This was not happening for SVGAnimatedPrimitiveProperty. To do
1146         that we need to:
1147
1148         -- Introduce the new template class SVGSharedPrimitiveProperty which is
1149            derived from SVGProperty. This class manages a single primitive value.
1150         -- Change the type of SVGAnimatedPrimitiveProperty::m_animVal to
1151            RefPtr<SVGSharedPrimitiveProperty<PropertyType>>. The master property
1152            creates it and all the instances hold references to the same pointer.
1153         -- Change the type of SVGAnimatedPrimitiveProperty::m_baseVal to
1154            Ref<SVGSharedPrimitiveProperty<PropertyType>> for simplicity and get
1155            rid of SVGAnimatedPrimitiveProperty::m_state.
1156         -- Override the virtual methods instanceStartAnimation() and
1157            instanceStopAnimation() of SVGAnimatedPrimitiveProperty.
1158         -- SVGAnimatedStringAnimator should invalidate the style of the target
1159            element if attribute name is 'class' and when its animVal changes.
1160
1161         * WebCore.xcodeproj/project.pbxproj:
1162         * svg/properties/SVGAnimatedPrimitiveProperty.h:
1163         (WebCore::SVGAnimatedPrimitiveProperty::setBaseVal):
1164         (WebCore::SVGAnimatedPrimitiveProperty::setBaseValInternal):
1165         (WebCore::SVGAnimatedPrimitiveProperty::baseVal const):
1166         (WebCore::SVGAnimatedPrimitiveProperty::setAnimVal):
1167         (WebCore::SVGAnimatedPrimitiveProperty::animVal const):
1168         (WebCore::SVGAnimatedPrimitiveProperty::animVal):
1169         (WebCore::SVGAnimatedPrimitiveProperty::currentValue const):
1170         (WebCore::SVGAnimatedPrimitiveProperty::SVGAnimatedPrimitiveProperty):
1171         (WebCore::SVGAnimatedPrimitiveProperty::ensureAnimVal):
1172         * svg/properties/SVGAnimatedPropertyAnimatorImpl.h:
1173         * svg/properties/SVGAttributeAnimator.cpp:
1174         (WebCore::SVGAttributeAnimator::invalidateStyle):
1175         (WebCore::SVGAttributeAnimator::applyAnimatedStylePropertyChange):
1176         (WebCore::SVGAttributeAnimator::removeAnimatedStyleProperty):
1177         * svg/properties/SVGAttributeAnimator.h:
1178         * svg/properties/SVGSharedPrimitiveProperty.h: Added.
1179         (WebCore::SVGSharedPrimitiveProperty::create):
1180         (WebCore::SVGSharedPrimitiveProperty::value const):
1181         (WebCore::SVGSharedPrimitiveProperty::value):
1182         (WebCore::SVGSharedPrimitiveProperty::setValue):
1183         (WebCore::SVGSharedPrimitiveProperty::SVGSharedPrimitiveProperty):
1184
1185 2019-07-02  Andres Gonzalez  <andresg_22@apple.com>
1186
1187         Enhance support of aria-haspopup per ARIA 1.1 specification.
1188         https://bugs.webkit.org/show_bug.cgi?id=199216
1189         <rdar://problem/46221342>
1190
1191         Reviewed by Chris Fleizach.
1192
1193         Test button-with-aria-haspopup-role.html was expanded to cover testing
1194         of new functionality.
1195
1196         * accessibility/AccessibilityObject.cpp:
1197         (WebCore::AccessibilityObject::popupValue const): replaces hasPopupValue.
1198         (WebCore::AccessibilityObject::hasPopupValue const): Deleted.
1199         * accessibility/AccessibilityObject.h:
1200         * accessibility/AccessibilityRenderObject.cpp:
1201         (WebCore::AccessibilityRenderObject::hasPopup const): method rename.
1202         * accessibility/atk/WebKitAccessible.cpp:
1203         (webkitAccessibleGetAttributes): method rename.
1204         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1205         (-[WebAccessibilityObjectWrapper accessibilityPopupValue]):
1206         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1207         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1208
1209 2019-07-02  Saam Barati  <sbarati@apple.com>
1210
1211         [WHLSL] Import bitwise bool tests
1212         https://bugs.webkit.org/show_bug.cgi?id=199093
1213
1214         Reviewed by Myles C. Maxfield.
1215
1216         Add standard library functions for:
1217         - bool bit ops
1218         - converting from bool to number
1219         - converting from number to bool
1220
1221         Test: webgpu/whlsl-bitwise-bool-ops.html
1222
1223         * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt:
1224
1225 2019-07-02  Takashi Komori  <Takashi.Komori@sony.com>
1226
1227         [Curl] Fix CookieJarCurl::getRawCookie.
1228         https://bugs.webkit.org/show_bug.cgi?id=199300
1229
1230         Reviewed by Fujii Hironori.
1231
1232         On wincairo some cookie information was not displayed in WebInspector's storage tab as
1233         CookieJarCurl::getRawCookies was calling CookieJarDB::searchCookies with wrong arguments.
1234         This patch fixes it.
1235
1236         Test: http/tests/inspector/page/get-cookies.html
1237
1238         * platform/network/curl/CookieJarCurl.cpp:
1239         (WebCore::CookieJarCurl::getRawCookies const):
1240
1241 2019-07-02  Robin Morisset  <rmorisset@apple.com>
1242
1243         [WHLSL] the initializer in VariableDeclaration should be a std::unique_ptr, not Optional<UniqueRef<..>>
1244         https://bugs.webkit.org/show_bug.cgi?id=199389
1245
1246         Reviewed by Sam Weinig.
1247
1248         Optional<UniqueRef<..>> is not only semantically weird (UniqueRef is basically a unique_ptr that promises not to be null), but also inefficient, wasting 8 bytes for the boolean in Optional.
1249         It is a pattern that appears throughout the AST. In this patch I start by removing it in a fairly simple spot: the initializer for VariableDeclaration.
1250
1251         No test because there is no intended functional change.
1252
1253         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
1254         (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression):
1255         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
1256         (WebCore::WHLSL::AST::VariableDeclaration::VariableDeclaration):
1257         (WebCore::WHLSL::AST::VariableDeclaration::initializer):
1258         (WebCore::WHLSL::AST::VariableDeclaration::takeInitializer):
1259         (WebCore::WHLSL::AST::VariableDeclaration::setInitializer):
1260         * Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp:
1261         (WebCore::WHLSL::AutoInitialize::visit):
1262         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
1263         (WebCore::WHLSL::resolveWithOperatorAnderIndexer):
1264         (WebCore::WHLSL::resolveWithOperatorLength):
1265         (WebCore::WHLSL::resolveWithReferenceComparator):
1266         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
1267         (WebCore::WHLSL::Parser::parseParameter):
1268         (WebCore::WHLSL::Parser::parseVariableDeclaration):
1269         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
1270         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
1271         (WebCore::WHLSL::wrapAnderCallArgument):
1272         (WebCore::WHLSL::modify):
1273         (WebCore::WHLSL::PropertyResolver::visit):
1274         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
1275         (WebCore::WHLSL::synthesizeArrayOperatorLength):
1276         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
1277         (WebCore::WHLSL::synthesizeConstructors):
1278         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
1279         (WebCore::WHLSL::synthesizeEnumerationFunctions):
1280         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
1281         (WebCore::WHLSL::synthesizeStructureAccessors):
1282
1283 2019-07-02  Jer Noble  <jer.noble@apple.com>
1284
1285         Pipe suport for 'cenc' init data type into CDMFairPlayStreaming
1286         https://bugs.webkit.org/show_bug.cgi?id=199381
1287
1288         Reviewed by Eric Carlson.
1289
1290         Expose the parsing of 'cenc' init data from InitDataRegistry, so it can be used in the
1291         evaluation steps inside CDMFairPlayStreaming.
1292
1293         + Add a new method, extractPsshBoxesFromCenc() which returns an optional array of
1294           unique_ptrs to different types of ISOPSSHBoxes.
1295         + Add a peekScheme() method to ISOPSSHBox so that we can create the correct subclass
1296           of ISOPSSHBox from the above method.
1297         + Remove an extra definition of fairPlaySystemID() from CDMFairPlayStreaming.
1298         + Add 'cenc' to the list of supported types in CDMPrivateFairPlayStreaming::vaildInitDataTypes().
1299         + Add support for 'cenc' in CDMPrivateFairPlayStreaming::supportsInitData().
1300         + Format the 'cenc' init data as an encodec-JSON structure for AVContentKeySession.
1301         + Update the ISOFairPlayStreamingKeyRequestInfoBox to be a ISOFullBox.
1302         + Update the box name of ISOFairPlayStreamingInitDataBox.
1303
1304         * Modules/encryptedmedia/InitDataRegistry.cpp:
1305         (WebCore::InitDataRegistry::extractPsshBoxesFromCenc):
1306         (WebCore::InitDataRegistry::extractKeyIDsCenc):
1307         (WebCore::InitDataRegistry::sanitizeCenc):
1308         (WebCore::InitDataRegistry::cencName):
1309         (WebCore::InitDataRegistry::keyidsName):
1310         (WebCore::InitDataRegistry::webmName):
1311         (WebCore::extractKeyIDsCenc): Deleted.
1312         (WebCore::sanitizeCenc): Deleted.
1313         * Modules/encryptedmedia/InitDataRegistry.h:
1314         (WebCore::SourceBuffer::changeType):
1315         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
1316         (WebCore::validInitDataTypes):
1317         (WebCore::CDMPrivateFairPlayStreaming::supportsInitData const):
1318         (WebCore::CDMPrivateFairPlayStreaming::fairPlaySystemID): Deleted.
1319         * platform/graphics/avfoundation/CDMFairPlayStreaming.h:
1320         * platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.h:
1321         (isType):
1322         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
1323         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestLicense):
1324         * platform/graphics/iso/ISOProtectionSystemSpecificHeaderBox.cpp:
1325         (WebCore::ISOProtectionSystemSpecificHeaderBox::peekSystemID):
1326         * platform/graphics/iso/ISOProtectionSystemSpecificHeaderBox.h:
1327
1328 2019-07-02  Daniel Bates  <dabates@apple.com>
1329
1330         [iOS] Cannot tab cycle through credit card fields on antonsvpatisserie.com checkout page
1331         https://bugs.webkit.org/show_bug.cgi?id=196053
1332         <rdar://problem/49093034>
1333
1334         Reviewed by Wenson Hsieh.
1335
1336         Remove the iOS override for isKeyboardFocusable() so that the focus controller allows
1337         iframes to be keyboard focusable.
1338
1339         Tests: fast/events/ios/tab-cycle.html
1340                fast/events/ios/tab-into-text-field-inside-iframe.html
1341
1342         * html/HTMLIFrameElement.h:
1343
1344 2019-07-02  Daniel Bates  <dabates@apple.com>
1345
1346         Left and right option key has Unidentified key identifier
1347         https://bugs.webkit.org/show_bug.cgi?id=199392
1348         <rdar://problem/52497604>
1349
1350         Reviewed by Wenson Hsieh.
1351
1352         Fix up switch case for left Option key and add a case statement for the right Option key.
1353
1354         * platform/ios/PlatformEventFactoryIOS.mm:
1355         (WebCore::codeForKeyEvent):
1356
1357 2019-07-02  Antti Koivisto  <antti@apple.com>
1358
1359         Crash when adding inline stylesheet to shadow tree in document with null base URL
1360         https://bugs.webkit.org/show_bug.cgi?id=199400
1361
1362         Reviewed by Zalan Bujtas.
1363
1364         We compute CSSParserContextHash for the inline stylesheet cache but that hits a nullptr crash
1365         if the document happens to have null base URL (which is uncommon but possible).
1366
1367         Test: fast/shadow-dom/stylesheet-in-shadow-without-base-url-crash.html
1368
1369         * css/parser/CSSParserContext.h:
1370         (WebCore::CSSParserContextHash::hash):
1371
1372         Null check the base URL (like other strings), it is a valid case.
1373
1374 2019-07-02  Devin Rousso  <drousso@apple.com>
1375
1376         Web Inspector: Debug: "Reset Web Inspector" should also clear the saved window size and attachment side
1377         https://bugs.webkit.org/show_bug.cgi?id=198956
1378
1379         Reviewed by Matt Baker.
1380
1381         * inspector/InspectorFrontendClient.h:
1382
1383         * inspector/InspectorFrontendClientLocal.h:
1384         * inspector/InspectorFrontendClientLocal.cpp:
1385         (WebCore::InspectorFrontendClientLocal::Settings::deleteProperty): Added.
1386         (WebCore::InspectorFrontendClientLocal::resetWindowState): Added.
1387
1388         * inspector/InspectorFrontendHost.idl:
1389         * inspector/InspectorFrontendHost.h:
1390         * inspector/InspectorFrontendHost.cpp:
1391         (WebCore::InspectorFrontendHost::reset): Added.
1392
1393 2019-07-01  Zalan Bujtas  <zalan@apple.com>
1394
1395         [Text autosizing] [iPadOS] AutosizeStatus::idempotentTextSize returns the computed font size in certain cases.
1396         https://bugs.webkit.org/show_bug.cgi?id=199382
1397         <rdar://problem/52483097>
1398
1399         Reviewed by Wenson Hsieh.
1400
1401         Adjust the font size on the style only when the autosized value is different from the computed value. 
1402
1403         * css/StyleResolver.cpp:
1404         (WebCore::StyleResolver::adjustRenderStyleForTextAutosizing):
1405
1406 2019-07-01  Chris Dumez  <cdumez@apple.com>
1407
1408         It should not be possible to trigger a load while in the middle of restoring a page in PageCache
1409         https://bugs.webkit.org/show_bug.cgi?id=199190
1410         <rdar://problem/52114552>
1411
1412         Reviewed by Brady Eidson.
1413
1414         Test: http/tests/security/navigate-when-restoring-cached-page.html
1415
1416         * history/CachedFrame.cpp:
1417         (WebCore::CachedFrame::open):
1418         Stop attaching the cached document before calling FrameLoader::open() given that the previous document
1419         is still attached to the frame at this point. This avoids having 2 documents attached to the same frame
1420         during a short period of time.
1421
1422         * loader/FrameLoader.cpp:
1423         (WebCore::FrameLoader::open):
1424         We now attach the cached document to the frame *after* calling FrameLoader::clear(), which means that
1425         the previous document now has been detached from this frame.
1426
1427         (WebCore::FrameLoader::detachChildren):
1428         As per the HTML specification [1], an attempt to navigate should fail if the prompt to unload algorithm
1429         is being run for the active document of browsingContext. Note that the "prompt to unload" algorithm [2]
1430         includes firing the 'unload' event in the current document and in all the documents in the subframes.
1431         As a result, FrameLoader::detachChildren() is the right prevent such navigations. We were actually trying
1432         to do this via the SubframeLoadingDisabler stack variable inside detachChildren(). The issue is that this
1433         only prevents navigation in the subframes (i.e. <iframe> elements), not the main frame. As a result,
1434         script would be able to navigate the top-frame even though detachChildren() is being called on the top
1435         frame. To address the issue, I now create a NavigationDisabler variable in the scope of detachChildren()
1436         when detachChildren() is called on the top frame. NavigationDisabler prevents all navigations within the
1437         page, including navigations on the main/top frame.
1438
1439         [1] https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate
1440         [2] https://html.spec.whatwg.org/multipage/browsing-the-web.html#prompt-to-unload-a-document
1441
1442 2019-07-01  Truitt Savell  <tsavell@apple.com>
1443
1444         Unreviewed, rolling out r246844.
1445
1446         Broke 12 tests in imported/w3c/web-platform-
1447         tests/pointerevents/
1448
1449         Reverted changeset:
1450
1451         "[Pointer Events] Respect pointer capture when dispatching
1452         mouse boundary events and updating :hover"
1453         https://bugs.webkit.org/show_bug.cgi?id=198999
1454         https://trac.webkit.org/changeset/246844
1455
1456 2019-07-01  Truitt Savell  <tsavell@apple.com>
1457
1458         Unreviewed, rolling out r246849.
1459
1460         12 tests broken in r246844 require this to be rolled out.
1461
1462         Reverted changeset:
1463
1464         "[Pointer Events] Respect pointer capture when dispatching
1465         mouse boundary events and updating :hover"
1466         https://bugs.webkit.org/show_bug.cgi?id=198999
1467         https://trac.webkit.org/changeset/246849
1468
1469 2019-07-01  Alex Christensen  <achristensen@webkit.org>
1470
1471         Null check provisionalItem in FrameLoader::continueLoadAfterNavigationPolicy
1472         https://bugs.webkit.org/show_bug.cgi?id=199327
1473         <rdar://problem/48262384>
1474
1475         Reviewed by Darin Adler.
1476
1477         * loader/FrameLoader.cpp:
1478         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
1479         Sometimes provisionalItem is null.  Let's not crash.
1480
1481 2019-07-01  Truitt Savell  <tsavell@apple.com>
1482
1483         Unreviewed, rolling out r246958.
1484
1485         Broke inspector/dom/getAccessibilityPropertiesForNode.html
1486
1487         Reverted changeset:
1488
1489         "Enhance support of aria-haspopup per ARIA 1.1 specification."
1490         https://bugs.webkit.org/show_bug.cgi?id=199216
1491         https://trac.webkit.org/changeset/246958
1492
1493 2019-07-01  Brady Eidson  <beidson@apple.com>
1494
1495         More judiciously handle clearing/creation of DOMWindows for new Documents.
1496         <rdar://problem/51665406> and https://bugs.webkit.org/show_bug.cgi?id=198786
1497
1498         Reviewed by Chris Dumez.
1499
1500         * bindings/js/ScriptController.cpp:
1501         (WebCore::ScriptController::executeIfJavaScriptURL):
1502
1503         * loader/DocumentWriter.cpp:
1504         (WebCore::DocumentWriter::replaceDocumentWithResultOfExecutingJavascriptURL): Rename for clarity.
1505         (WebCore::DocumentWriter::begin): Handle DOMWindow taking/creation inside FrameLoader::clear via a lambda. 
1506         (WebCore::DocumentWriter::replaceDocument): Deleted.
1507         * loader/DocumentWriter.h:
1508
1509         * loader/FrameLoader.cpp:
1510         (WebCore::FrameLoader::clear): Take a "handleDOMWindowCreation" lambda to run after clearing the previous document.
1511         * loader/FrameLoader.h:
1512
1513 2019-07-01  Zalan Bujtas  <zalan@apple.com>
1514
1515         [iPadOS] Tapping on the bottom part of youtube video behaves as if controls were visible
1516         https://bugs.webkit.org/show_bug.cgi?id=199349
1517         <rdar://problem/51955744>
1518
1519         Reviewed by Simon Fraser.
1520
1521         Synthetic click event should not be dispatched to a node that is initially hidden (by opacity: 0) and becomes visible by the touchStart event.
1522         While this behaves different from macOS where opacity: 0; content is "clickable", it impoves usability on certain sites like YouTube.com. 
1523
1524         Test: fast/events/touch/ios/content-observation/opacity-change-happens-on-touchstart-with-transition2.html
1525
1526         * dom/Node.cpp:
1527         (WebCore::Node::defaultEventHandler):
1528         * page/ios/ContentChangeObserver.cpp:
1529         (WebCore::ContentChangeObserver::isConsideredHidden):
1530         (WebCore::ContentChangeObserver::reset):
1531         (WebCore::isConsideredHidden): Deleted.
1532         * page/ios/ContentChangeObserver.h:
1533         (WebCore::ContentChangeObserver::setHiddenTouchTarget):
1534         (WebCore::ContentChangeObserver::resetHiddenTouchTarget):
1535         (WebCore::ContentChangeObserver::hiddenTouchTarget const):
1536
1537 2019-06-28  Brent Fulgham  <bfulgham@apple.com>
1538
1539         [FTW] Build WebCore
1540         https://bugs.webkit.org/show_bug.cgi?id=199199
1541
1542         Reviewed by Don Olmstead.
1543
1544         Make some minor corrections needed to get FTW WebCore to build and link.
1545
1546         * PlatformFTW.cmake: Added.
1547         * platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp:
1548         (WebCore::GlyphPage::fill):
1549         * platform/graphics/win/GraphicsContextDirect2D.cpp:
1550         (WebCore::GraphicsContext::setURLForRect):
1551         * platform/graphics/win/PatternDirect2D.cpp:
1552         * platform/graphics/win/SimpleFontDataDirect2D.cpp:
1553         * platform/image-decoders/ScalableImageDecoder.cpp:
1554         (WebCore::ScalableImageDecoder::setTargetContext): Added stub.
1555         * platform/image-decoders/ScalableImageDecoder.h:
1556         * platform/network/curl/CookieJarDB.cpp:
1557         (WebCore::CookieJarDB::hasCookies):
1558         (WebCore::CookieJarDB::canAcceptCookie):
1559
1560 2019-07-01  Wenson Hsieh  <wenson_hsieh@apple.com>
1561
1562         iOS: REGRESSION(async scroll): Caret doesn't scroll when scrolling textarea
1563         https://bugs.webkit.org/show_bug.cgi?id=198217
1564         <rdar://problem/51097296>
1565
1566         Reviewed by Simon Fraser.
1567
1568         Add a ScrollingLayerPositionAction argument to ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling, and
1569         avoid bailing early in the case where ScrollingLayerPositionAction::Set is used. See the WebKit ChangeLog for
1570         more detail.
1571
1572         Test: editing/selection/ios/update-selection-after-overflow-scroll.html
1573
1574         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1575         (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
1576         * page/scrolling/ScrollingTreeScrollingNode.h:
1577
1578 2019-07-01  Antti Koivisto  <antti@apple.com>
1579
1580         REGRESSION(r240047): Overflow scrollers on WK1 fail to update their content size when it changes
1581         https://bugs.webkit.org/show_bug.cgi?id=199360
1582         <rdar://problem/51643386>
1583
1584         Reviewed by Simon Fraser.
1585
1586         r240047 replaced didCommitChangesForLayer() mechanism by a more narrow didChangePlatformLayerForLayer.
1587         Unfortunately on WK1 we relied on scroll layers being invalidated after every size (and scrollbar) change.
1588         Without this invalidation we don't call WebChromeClientIOS::addOrUpdateScrollingLayer and the UIKit delegate
1589         that resizes the UIScrollView content.
1590
1591         Fix by removing the scroll layer invalidation mechanism from LegacyWebKitScrollingLayerCoordinator completely and instead
1592         simply update all scroll layers after commit. The UIKit delegate doesn't do any significant work if nothing changes,
1593         this was not a very meaninful optimization.
1594
1595         * rendering/RenderLayerCompositor.cpp:
1596         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlush):
1597
1598         Update all scroll layers after flush (similar to viewport constrained layers).
1599
1600         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
1601         (WebCore::LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer):
1602         (WebCore::LegacyWebKitScrollingLayerCoordinator::addScrollingLayer):
1603         (WebCore::LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer):
1604         (WebCore::LegacyWebKitScrollingLayerCoordinator::registerScrollingLayersNeedingUpdate): Deleted.
1605         (WebCore::LegacyWebKitScrollingLayerCoordinator::didChangePlatformLayerForLayer): Deleted.
1606         * rendering/RenderLayerCompositor.h:
1607
1608 2019-07-01  Philippe Normand  <pnormand@igalia.com>
1609
1610         [GStreamer] Cannot play Bert's Bytes radio stream from http://radio.dos.nl/
1611         https://bugs.webkit.org/show_bug.cgi?id=198376
1612
1613         Reviewed by Xabier Rodriguez-Calvar.
1614
1615         The delayed startup was due to a mix of buffering feedback
1616         messages not handled correctly by the player. We were handling
1617         download and streaming buffering metrics without distinction.
1618         Range requests (used for seeking) were also triggering on-disk
1619         buffering in some cases. The buffering percentage estimation based
1620         on network read position was not working either because uint64_t
1621         division doesn't return a floating point value.
1622
1623         No new tests, existing media tests cover this patch.
1624
1625         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1626         (WebCore::MediaPlayerPrivateGStreamer::commitLoad):
1627         (WebCore::MediaPlayerPrivateGStreamer::play):
1628         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
1629         (WebCore::MediaPlayerPrivateGStreamer::processBufferingStats):
1630         (WebCore::MediaPlayerPrivateGStreamer::updateBufferingStatus):
1631         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired):
1632         (WebCore::MediaPlayerPrivateGStreamer::maxTimeLoaded const):
1633         (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const):
1634         (WebCore::MediaPlayerPrivateGStreamer::updateStates):
1635         (WebCore::MediaPlayerPrivateGStreamer::updateDownloadBufferingFlag):
1636         (WebCore::MediaPlayerPrivateGStreamer::setPreload):
1637         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1638         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1639         (webkitWebSrcReset):
1640         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
1641
1642 2019-07-01  Miguel Gomez  <magomez@igalia.com>
1643
1644         REGRESSION(r246963) GTK's debug build is broken
1645         https://bugs.webkit.org/show_bug.cgi?id=199358
1646
1647         Reviewed by Michael Catanzaro.
1648
1649         Add traits to be able to downcast AnimatedBackingStoreClient.
1650
1651         * platform/graphics/nicosia/NicosiaAnimatedBackingStoreClient.h:
1652         (Nicosia::AnimatedBackingStoreClient::AnimatedBackingStoreClient):
1653         (Nicosia::AnimatedBackingStoreClient::type const):
1654         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1655         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
1656
1657 2019-07-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1658
1659         Unreviewed. Fix GTK build with GSTREAMER_GL disabled after r246710
1660
1661         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1662
1663 2019-07-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1664
1665         WebSockets: add support for sending blob messages when using web sockets platform APIs
1666         https://bugs.webkit.org/show_bug.cgi?id=199189
1667
1668         Reviewed by Youenn Fablet.
1669
1670         * Headers.cmake: Add missing headers.
1671
1672 2019-07-01  Miguel Gomez  <magomez@igalia.com>
1673
1674         [WPE][GTK] Content disappearing when using CSS transforms
1675         https://bugs.webkit.org/show_bug.cgi?id=181757
1676
1677         Reviewed by Žan Doberšek.
1678
1679         During each layer flush, create an AnimatedBackingStoreClient instance for each layer that
1680         has a backingStore and is to be animated, and send that client to the appropriate
1681         TextureMapperLayer on the compositor thread. During each frame rendering, the client will
1682         use the future layer position (currently 50ms in the future) to check whether new tiles are
1683         required to keep the animation ongoing, and notify the appropriate CoordinatedGraphicsLayer so
1684         it can perform a layer flush and provide new tiles.
1685
1686         * platform/TextureMapper.cmake:
1687         * platform/graphics/nicosia/NicosiaAnimatedBackingStoreClient.h: Added.
1688         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
1689         (Nicosia::CompositionLayer::flushState):
1690         * platform/graphics/texmap/TextureMapperAnimation.cpp:
1691         (WebCore::TextureMapperAnimation::applyKeepingInternalState):
1692         (WebCore::TextureMapperAnimations::applyKeepingInternalState):
1693         * platform/graphics/texmap/TextureMapperAnimation.h:
1694         * platform/graphics/texmap/TextureMapperLayer.cpp:
1695         (WebCore::TextureMapperLayer::computeTransformsRecursive):
1696         (WebCore::TextureMapperLayer::setAnimatedBackingStoreClient):
1697         (WebCore::TextureMapperLayer::syncAnimations):
1698         * platform/graphics/texmap/TextureMapperLayer.h:
1699         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1700         (WebCore::CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer):
1701         (WebCore::clampToContentsRectIfRectIsInfinite):
1702         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
1703         (WebCore::CoordinatedGraphicsLayer::requestBackingStoreUpdate):
1704         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
1705         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1706
1707 2019-06-30  Antti Koivisto  <antti@apple.com>
1708
1709         Use separate variables for moving and stationary scrolling relationships in RemoteLayerTreeNode
1710         https://bugs.webkit.org/show_bug.cgi?id=199348
1711
1712         Reviewed by Darin Adler.
1713
1714         * page/scrolling/ScrollingStateStickyNode.cpp:
1715         * page/scrolling/ScrollingTree.cpp:
1716         (WebCore::ScrollingTree::commitTreeState):
1717         * page/scrolling/ScrollingTree.h:
1718         (WebCore::ScrollingTree::activeOverflowScrollProxyNodes):
1719         (WebCore::ScrollingTree::activePositionedNodes):
1720         (WebCore::ScrollingTree::nodesWithRelatedOverflow): Deleted.
1721
1722         Use separate sets for overflow proxies and positioned nodes.
1723         Use Refs to nodes instead of ids to simplify client code. This doesn't affect lifetimes, these sets are cleared
1724         at the beginning of each commit.
1725
1726         * page/scrolling/cocoa/ScrollingTreeOverflowScrollProxyNode.mm:
1727         (WebCore::ScrollingTreeOverflowScrollProxyNode::commitStateBeforeChildren):
1728         * page/scrolling/cocoa/ScrollingTreePositionedNode.mm:
1729         (WebCore::ScrollingTreePositionedNode::commitStateBeforeChildren):
1730
1731 2019-06-30  Andres Gonzalez  <andresg_22@apple.com>
1732
1733         Enhance support of aria-haspopup per ARIA 1.1 specification.
1734         https://bugs.webkit.org/show_bug.cgi?id=199216
1735         <rdar://problem/46221342>
1736
1737         Reviewed by Chris Fleizach.
1738
1739         Test button-with-aria-haspopup-role.html was expanded to cover testing
1740         of new functionality.
1741
1742         * accessibility/AccessibilityObject.cpp:
1743         (WebCore::AccessibilityObject::popupValue const): replaces hasPopupValue.
1744         (WebCore::AccessibilityObject::hasPopupValue const): Deleted.
1745         * accessibility/AccessibilityObject.h:
1746         * accessibility/AccessibilityRenderObject.cpp:
1747         (WebCore::AccessibilityRenderObject::hasPopup const): method rename.
1748         * accessibility/atk/WebKitAccessible.cpp:
1749         (webkitAccessibleGetAttributes): method rename.
1750         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1751         (-[WebAccessibilityObjectWrapper accessibilityPopupValue]):
1752         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1753         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1754
1755 2019-06-30  Zalan Bujtas  <zalan@apple.com>
1756
1757         [LFC] Implement Layout::printLayoutTreeForLiveDocuments
1758         https://bugs.webkit.org/show_bug.cgi?id=199343
1759         <rdar://problem/52393047>
1760
1761         Reviewed by Antti Koivisto.
1762
1763         * layout/layouttree/LayoutTreeBuilder.cpp:
1764         (WebCore::Layout::printLayoutTreeForLiveDocuments):
1765         * page/FrameViewLayoutContext.cpp:
1766         (WebCore::layoutUsingFormattingContext):
1767
1768 2019-06-22  Darin Adler  <darin@apple.com>
1769
1770         Streamline some string code, focusing on functions that were using substringSharingImpl
1771         https://bugs.webkit.org/show_bug.cgi?id=198898
1772
1773         Reviewed by Daniel Bates.
1774
1775         * css/CSSComputedStyleDeclaration.cpp:
1776         (WebCore::CSSComputedStyleDeclaration::CSSComputedStyleDeclaration): Take a StringView
1777         instead of a String argument for the pseudo-element name. This prevents us from having
1778         to use substringSharingImpl to strip off leading colons.
1779         (WebCore::CSSComputedStyleDeclaration::create): Moved this function in here since it's
1780         no longer being inlined.
1781
1782         * css/CSSComputedStyleDeclaration.h: Moved the create function to no longer be inlined,
1783         since it's better to have the constructor be inlined in the create function instead.
1784         Changed the pseudo-element name argument to be a StringView rather than a String.
1785         Also initialize m_refCount in the class definition.
1786
1787         * css/CSSSelector.cpp:
1788         (WebCore::CSSSelector::parsePseudoElementType): Take a StringView instead of a String.
1789         * css/CSSSelector.h: Updated for the above change.
1790
1791         * css/SelectorPseudoTypeMap.h: Change both parse functions to take StringView. Before
1792         one took a StringImpl and the other used const StringView&, which is not as good as
1793         StringView.
1794
1795         * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: Use StringView, not
1796         const StringView&.
1797
1798         * css/makeSelectorPseudoElementsMap.py: Use StringView rather than StringImpl.
1799
1800         * css/parser/CSSParserImpl.cpp:
1801         (WebCore::CSSParserImpl::parsePageSelector): Use a StringView for the pseudo-element
1802         name. It was already computed as a StringView, but the old code converted it to
1803         an AtomicString.
1804
1805         * css/parser/CSSParserSelector.cpp:
1806         (WebCore::CSSParserSelector::parsePagePseudoSelector): Take a StringView, and
1807         return a std::unique_ptr.
1808         (WebCore::CSSParserSelector::parsePseudoElementSelector): Renamed to not mention
1809         StringView in function name. Take a StringView, not a StringView&. Do the lowercasing
1810         inside this function rather than having it be a caller responsibility. Don't convert
1811         from a StringView to an AtomicString before starting to parse; only do it in the
1812         "unknown/custom" case. Return a std::unique_ptr.
1813         (WebCore::CSSParserSelector::parsePseudoClassSelector): Ditto.
1814         * css/parser/CSSParserSelector.h: Make the three parse functions all take a StringView
1815         and all return a std::unique_ptr. They were already creating objects, but before
1816         callers just had to know to adopt.
1817         * css/parser/CSSSelectorParser.cpp:
1818         (WebCore::CSSSelectorParser::consumePseudo): Updated to use improved parse
1819         functions above.
1820
1821         * page/DOMWindow.cpp:
1822         (WebCore::DOMWindow::getMatchedCSSRules const): Updated to use the new
1823         parsePseudoElementType above and use StringView::substring instead of
1824         String::substringSharingImpl.
1825
1826         * platform/Length.cpp:
1827         (WebCore::newCoordsArray): Local string that is "spacified" can't have any non-Latin-1
1828         characters, so use LChar instead of UChar.
1829
1830         * rendering/RenderText.cpp:
1831         (WebCore::convertNoBreakSpaceToSpace): Renamed for clarity. Also use constexpr
1832         instead of inline since this is a pure function.
1833         (WebCore::capitalize): Tighten up logic a bit.
1834
1835 2019-06-29  Simon Fraser  <simon.fraser@apple.com>
1836
1837         Remove a PLATFORM(IOS_FAMILY) related to repaint offsets in composited scrolling layers
1838         https://bugs.webkit.org/show_bug.cgi?id=199342
1839
1840         Reviewed by Zalan Bujtas.
1841
1842         Code in RenderObject::shouldApplyCompositedContainerScrollsForRepaint() adds VisibleRectContextOption::ApplyCompositedContainerScrolls
1843         only for iOS, and RenderLayerBacking::setContentsNeedDisplayInRect() subtracts out scroll position for only iOS,
1844         so remove this iOS-specific code.
1845
1846         Blame for this code mentions touch event regions, so I tested these but they use absoluteBoundingBoxRect()
1847         which doesn't hit this code. Still, I added a layout test for touch regions inside scrolled overflow.
1848
1849         Existing tests exist for repaint inside scrolled overflow.
1850
1851         Test: fast/events/touch/ios/touch-event-regions/scrolled-overflow.html
1852
1853         * rendering/RenderLayerBacking.cpp:
1854         (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
1855         * rendering/RenderObject.cpp:
1856         (WebCore::RenderObject::shouldApplyCompositedContainerScrollsForRepaint): Deleted.
1857         (WebCore::RenderObject::visibleRectContextForRepaint): Deleted.
1858         * rendering/RenderObject.h:
1859         (WebCore::RenderObject::visibleRectContextForRepaint):
1860
1861 2019-06-28  Tim Horton  <timothy_horton@apple.com>
1862
1863         iOS WebKit2 find-in-page indicator doesn't move with 'overflow: scroll'
1864         https://bugs.webkit.org/show_bug.cgi?id=175032
1865         <rdar://problem/29346482>
1866
1867         Reviewed by Wenson Hsieh.
1868
1869         * editing/FrameSelection.cpp:
1870         (WebCore::FrameSelection::selectionBounds const):
1871         (WebCore::FrameSelection::revealSelection):
1872         * editing/FrameSelection.h:
1873         Make selectionBounds' clipToVisibleContent param an enum class.
1874
1875         * page/TextIndicator.cpp:
1876         (WebCore::initializeIndicator):
1877         Save the un-clipped selection rect; otherwise we'll frequently save 0, 0
1878         here when finding a match that is off-screen.
1879
1880 2019-06-28  Zalan Bujtas  <zalan@apple.com>
1881
1882         [Text autosizing][iPadOS] bing.com is hard to read even with boosted text because of the line height
1883         https://bugs.webkit.org/show_bug.cgi?id=199318
1884         <rdar://problem/51826096>
1885
1886         Reviewed by Wenson Hsieh.
1887
1888         Initial implementation of line height boosting on iPadOs. It enlarges line height in certain cases to improve readability when the text content feels too dense.
1889         It kicks in only for relatively small text (12px) where it slightly (1.25x) changes the line height to widen the gap between lines.
1890
1891         * css/StyleResolver.cpp:
1892         (WebCore::StyleResolver::adjustRenderStyleForTextAutosizing):
1893
1894 2019-06-28  Alex Christensen  <achristensen@webkit.org>
1895
1896         Make getHostnamesWithCookies more robust
1897         https://bugs.webkit.org/show_bug.cgi?id=199334
1898         <rdar://problem/51860593>
1899
1900         Reviewed by Brent Fulgham.
1901
1902         Crash logs suggest either httpCookies is returning a nil cookie or a cookie without a domain.
1903         This should not happen, but if it does we shouldn't crash.
1904
1905         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1906         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
1907
1908 2019-06-28  chris fleizach  <cfleizach@apple.com>
1909
1910         AX: Both convertToNSArray() functions in WebAccessibilityObjectWrapperBase.mm leak every NSMutableArray returned
1911         https://bugs.webkit.org/show_bug.cgi?id=199306
1912
1913         Reviewed by David Kilzer.
1914
1915         Stop leaking every instance of convertToNSArray and return an autoreleased version.
1916         Remove unneeded casts.
1917
1918         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1919         (-[WebAccessibilityObjectWrapper accessibilityFindMatchingObjects:]):
1920         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
1921         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
1922         (convertToNSArray):
1923         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1924         (-[WebAccessibilityObjectWrapper childrenVectorArray]):
1925         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1926         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
1927
1928 2019-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
1929
1930         Followup to r246931
1931         https://bugs.webkit.org/show_bug.cgi?id=199331
1932
1933         Reviewed by Tim Horton.
1934
1935         Extend the site-specific quirk added in r246931 to *.sharepoint.com, so that it fixes Word for enterprise
1936         customers as well.
1937
1938         * page/Quirks.cpp:
1939         (WebCore::Quirks::shouldAvoidResizingWhenInputViewBoundsChange const):
1940
1941 2019-06-28  Timothy Hatcher  <timothy@apple.com>
1942
1943         Rename effectiveAppearanceIsInactive and useInactiveAppearance to better match UIUserInterfaceLevel.
1944         https://bugs.webkit.org/show_bug.cgi?id=199336
1945         rdar://problem/52348938
1946
1947         Reviewed by Tim Horton.
1948
1949         * css/StyleColor.h:
1950         * dom/Document.cpp:
1951         (WebCore::Document::useElevatedUserInterfaceLevel const):
1952         (WebCore::Document::styleColorOptions const):
1953         (WebCore::Document::useInactiveAppearance const): Deleted.
1954         * dom/Document.h:
1955         * page/Page.cpp:
1956         (WebCore::Page::effectiveAppearanceDidChange):
1957         * page/Page.h:
1958         (WebCore::Page::useElevatedUserInterfaceLevel const):
1959         (WebCore::Page::useInactiveAppearance const): Deleted.
1960         * platform/ios/LocalCurrentTraitCollection.h:
1961         (WebCore::LocalCurrentTraitCollection::usingElevatedUserInterfaceLevel const):
1962         (WebCore::LocalCurrentTraitCollection::usingBaseLevelAppearance const): Deleted.
1963         * platform/ios/LocalCurrentTraitCollection.mm:
1964         (WebCore::LocalCurrentTraitCollection::LocalCurrentTraitCollection):
1965         * rendering/RenderThemeIOS.mm:
1966         (WebCore::RenderThemeIOS::systemColor const):
1967         * testing/InternalSettings.cpp:
1968         (WebCore::InternalSettings::setUseDarkAppearanceInternal):
1969
1970 2019-06-28  Simon Fraser  <simon.fraser@apple.com>
1971
1972         REGRESSION (r239984): pages with custom scrollbars also show normal scrollbars
1973         https://bugs.webkit.org/show_bug.cgi?id=199321
1974         <rdar://problem/52308095>
1975
1976         Reviewed by Timothy Hatcher.
1977
1978         Revert the part of r239984 that made isCustomScrollbar() virtual, since theme().registerScrollbar()
1979         calls it from the base class constructor.
1980
1981         I wasn't able to make a test that tests rendering of overlay scrollbars (webkit.org/b/199323).
1982
1983         * platform/Scrollbar.cpp:
1984         (WebCore::Scrollbar::Scrollbar):
1985         * platform/Scrollbar.h:
1986         (WebCore::Scrollbar::isCustomScrollbar const):
1987         * rendering/RenderScrollbar.cpp:
1988         (WebCore::RenderScrollbar::RenderScrollbar):
1989         * rendering/RenderScrollbar.h:
1990
1991 2019-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
1992
1993         Need a way for SPI clients to know when to avoid resizing to accommodate for the input view bounds
1994         https://bugs.webkit.org/show_bug.cgi?id=199331
1995         <rdar://problem/52116170>
1996
1997         Reviewed by Tim Horton.
1998
1999         Add a new quirk to avoid resizing the web view when input view bounds change.
2000
2001         * page/Quirks.cpp:
2002         (WebCore::Quirks::shouldAvoidResizingWhenInputViewBoundsChange const):
2003         * page/Quirks.h:
2004
2005 2019-06-28  Konstantin Tokarev  <annulen@yandex.ru>
2006
2007         Remove traces of ENABLE_ICONDATABASE remaining after its removal in 219733
2008         https://bugs.webkit.org/show_bug.cgi?id=199317
2009
2010         Reviewed by Michael Catanzaro.
2011
2012         While IconDatabase and all code using it was removed,
2013         ENABLE_ICONDATABASE still exists as build option and C++ macro.
2014
2015         * Configurations/FeatureDefines.xcconfig:
2016         * Resources/urlIcon.png: Removed file which was only used in
2017         IconDatabase.cpp.
2018
2019 2019-06-28  Fujii Hironori  <Hironori.Fujii@sony.com>
2020
2021         [Win] unresolved external symbol "JSC::JSObject::didBecomePrototype(void)" referenced in function "JSC::Structure::create(...)"
2022         https://bugs.webkit.org/show_bug.cgi?id=199312
2023
2024         Reviewed by Keith Miller.
2025
2026         WinCairo port, clang-cl Release builds reported a following linkage error:
2027
2028         > WebCore.lib(UnifiedSource-4babe430-10.cpp.obj) : error LNK2019: unresolved external symbol "public: void __cdecl JSC::JSObject::didBecomePrototype(void)" (?didBecomePrototype@JSObject@JSC@@QEAAXXZ) referenced in function "public: static class JSC::Structure * __cdecl JSC::Structure::create(class JSC::VM &,class JSC::JSGlobalObject *,class JSC::JSValue,class JSC::TypeInfo const &,struct JSC::ClassInfo const *,unsigned char,unsigned int)" (?create@Structure@JSC@@SAPEAV12@AEAVVM@2@PEAVJSGlobalObject@2@VJSValue@2@AEBVTypeInfo@2@PEBUClassInfo@2@EI@Z)
2029
2030         No new tests because there is no behavior change.
2031
2032         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: Include <JavaScriptCore/JSCInlines.h>,
2033         and do not include headers which is included by it.
2034
2035 2019-06-27  Zalan Bujtas  <zalan@apple.com>
2036
2037         REGRESSION(r244633): e-mail with "height: 100%" causes unstable layout.
2038         https://bugs.webkit.org/show_bug.cgi?id=199303
2039         <rdar://problem/51340927>
2040
2041         Reviewed by Tim Horton.
2042
2043         This patch restores the previous behavior (pre r244633) where we intentionally reported stale content size value to
2044         avoid unstable layout for content like height: 100px.
2045
2046         * page/FrameView.cpp:
2047         (WebCore::FrameView::autoSizeIfEnabled):
2048
2049 2019-06-27  Fujii Hironori  <Hironori.Fujii@sony.com>
2050
2051         [WinCairo][MediaFoundation] Stop using soft linking for Media Foundation
2052         https://bugs.webkit.org/show_bug.cgi?id=198783
2053         <rdar://problem/52301843>
2054
2055         Unreviewed compilation warning fix. clang-cl reports:
2056
2057         ..\..\Source\WebCore\platform\graphics\win\MediaPlayerPrivateMediaFoundation.cpp(526,10): warning: address of function 'MFCreateTopology' will always evaluate to 'true' [-Wpointer-bool-conversion]
2058             if (!MFCreateTopology)
2059                 ~^~~~~~~~~~~~~~~~
2060         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2061         (WebCore::MediaPlayerPrivateMediaFoundation::createTopologyFromSource): Removed the pointer check of MFCreateTopology.
2062
2063 2019-06-27  Fujii Hironori  <Hironori.Fujii@sony.com>
2064
2065         [WinCairo][MediaFoundation] Stop using soft linking for Media Foundation
2066         https://bugs.webkit.org/show_bug.cgi?id=198783
2067
2068         Reviewed by Alex Christensen.
2069
2070         WinCairo is supporting Windows 7 or newer. It doesn't need soft
2071         linking anymore.
2072
2073         No new tests because there is no behavior change.
2074
2075         * PlatformWinCairo.cmake: Added libraries to WebCore_LIBRARIES.
2076         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2077         (WebCore::mimeTypeCache):
2078         (WebCore::MediaPlayerPrivateMediaFoundation::setRate):
2079         (WebCore::MediaPlayerPrivateMediaFoundation::setAllChannelVolumes):
2080         (WebCore::MediaPlayerPrivateMediaFoundation::createSession):
2081         (WebCore::MediaPlayerPrivateMediaFoundation::endSession):
2082         (WebCore::MediaPlayerPrivateMediaFoundation::startCreateMediaSource):
2083         (WebCore::MediaPlayerPrivateMediaFoundation::createTopologyFromSource):
2084         (WebCore::MediaPlayerPrivateMediaFoundation::createOutputNode):
2085         (WebCore::MediaPlayerPrivateMediaFoundation::createSourceStreamNode):
2086         (WebCore::MediaPlayerPrivateMediaFoundation::updateReadyState):
2087         (WebCore::MediaPlayerPrivateMediaFoundation::videoDisplay):
2088         (WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::createOptimalVideoType):
2089         (WebCore::MediaPlayerPrivateMediaFoundation::VideoScheduler::setFrameRate):
2090         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample):
2091         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::initializeD3D):
2092         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::createD3DSample):
2093
2094 2019-06-27  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2095
2096          Fix build error on WebCore when disabling ENABLE_INDEXED_DATABASE.
2097         https://bugs.webkit.org/show_bug.cgi?id=199286
2098
2099          Unreviewed build fix.
2100
2101          * testing/Internals.cpp: Make method conditional.
2102          * testing/Internals.h: Ditto.
2103          * testing/Internals.idl: Ditto.
2104
2105 2019-06-27  Simon Fraser  <simon.fraser@apple.com>
2106
2107         Fix crash in ScrollingStateNode::insertChild()
2108         https://bugs.webkit.org/show_bug.cgi?id=199297
2109         rdar://problem/49415136
2110
2111         Reviewed by Tim Horton.
2112
2113         Crash data suggest that 'parent' can be deleted in ScrollingStateTree::insertNode(). To avoid this,
2114         have ScrollingStateTree::m_stateNodeMap store RefPts, and do the same for ScrollingTree::m_nodeMap.
2115
2116         * page/scrolling/ScrollingStateNode.cpp:
2117         (WebCore::ScrollingStateNode::ScrollingStateNode): The relaxAdoptionRequirement() is required
2118         to avoid ASSERT(!m_adoptionIsRequired) when the node is added to the tree in its constructor.
2119         * page/scrolling/ScrollingStateTree.cpp:
2120         (WebCore::ScrollingStateTree::unparentNode):
2121         (WebCore::ScrollingStateTree::unparentChildrenAndDestroyNode):
2122         (WebCore::ScrollingStateTree::detachAndDestroySubtree):
2123         (WebCore::ScrollingStateTree::stateNodeForID const):
2124         * page/scrolling/ScrollingStateTree.h:
2125         * page/scrolling/ScrollingTree.cpp:
2126         (WebCore::ScrollingTree::updateTreeFromStateNode):
2127         * page/scrolling/ScrollingTree.h:
2128
2129 2019-06-27  Simon Fraser  <simon.fraser@apple.com>
2130
2131         REGRESSION (r246869): ASSERTION FAILED: !renderer().hasRepaintLayoutRects() || renderer().repaintLayoutRects().m_repaintRect == renderer().clippedOverflowRectForRepaint(renderer().containerForRepaint())
2132         https://bugs.webkit.org/show_bug.cgi?id=199274
2133
2134         Reviewed by Zalan Bujtas.
2135
2136         When layer backing sharing changes, we need to clear cached repaint rects, since they
2137         painting root changes.
2138
2139         * rendering/RenderLayer.cpp:
2140         (WebCore::RenderLayer::setBackingProviderLayer):
2141
2142 2019-06-27  Beth Dakin  <bdakin@apple.com>
2143
2144         Upstream use of MACCATALYST
2145         https://bugs.webkit.org/show_bug.cgi?id=199245
2146         rdar://problem/51687723
2147
2148         Reviewed by Tim Horton.
2149
2150         * Configurations/Base.xcconfig:
2151         * Configurations/FeatureDefines.xcconfig:
2152         * Configurations/SDKVariant.xcconfig:
2153         * Configurations/WebCore.xcconfig:
2154         * Modules/geolocation/ios/GeolocationPositionIOS.mm:
2155         (WebCore::GeolocationPosition::GeolocationPosition):
2156         * editing/cocoa/DictionaryLookup.mm:
2157         (-[WebRevealHighlight drawHighlightContentForItem:context:]):
2158         (WebCore::showPopupOrCreateAnimationController):
2159         * editing/cocoa/WebContentReaderCocoa.mm:
2160         * page/Navigator.h:
2161         * page/SettingsBase.cpp:
2162         (WebCore::SettingsBase::defaultContentChangeObserverEnabled):
2163         * page/cocoa/MemoryReleaseCocoa.mm:
2164         (WebCore::platformReleaseMemory):
2165         * platform/audio/ios/AudioSessionIOS.mm:
2166         (WebCore::AudioSession::setCategory):
2167         (WebCore::AudioSession::routingContextUID const):
2168         * platform/cocoa/ParentalControlsContentFilter.mm:
2169         (WebCore::canHandleResponse):
2170         * platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm:
2171         (WebCore::AVAssetMIMETypeCache::isAvailable const):
2172         * platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.mm:
2173         (WebCore::AVStreamDataParserMIMETypeCache::isAvailable const):
2174         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2175         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
2176         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
2177         * platform/graphics/cv/ImageTransferSessionVT.h:
2178         * platform/graphics/cv/ImageTransferSessionVT.mm:
2179         (WebCore::cvPixelFormatOpenGLKey):
2180         (WebCore::ImageTransferSessionVT::ImageTransferSessionVT):
2181         * platform/ios/PasteboardIOS.mm:
2182         (WebCore::Pasteboard::readPasteboardWebContentDataForType):
2183         (WebCore::Pasteboard::supportedWebContentPasteboardTypes):
2184         * platform/ios/PlatformPasteboardIOS.mm:
2185         (WebCore::registerItemToPasteboard):
2186         (WebCore::PlatformPasteboard::write):
2187         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2188         (-[WebAVPlayerLayer setVideoGravity:]):
2189         * platform/ios/WebItemProviderPasteboard.mm:
2190         (-[WebItemProviderRegistrationInfoList itemProvider]):
2191         (-[WebItemProviderLoadResult canBeRepresentedAsFileUpload]):
2192         (-[WebItemProviderPasteboard numberOfFiles]):
2193         * platform/network/cf/CertificateInfoCFNet.cpp:
2194         (WebCore::CertificateInfo::summaryInfo const):
2195
2196 2019-06-27  Brent Fulgham  <bfulgham@apple.com>
2197
2198         Correct document lifecycle while processing commands
2199         https://bugs.webkit.org/show_bug.cgi?id=199146
2200         <rdar://problem/52047462>
2201
2202         Reviewed by Darin Adler.
2203
2204         Protect the document while commands are being processed since script may run
2205         during the style resolution. We should protect against this.
2206
2207         * dom/Document.cpp:
2208         (WebCore::command):
2209
2210 2019-06-27  Jon Davis  <jond@apple.com>
2211
2212         Add status for Web Bluetooth Scanning standards specification.
2213         https://bugs.webkit.org/show_bug.cgi?id=199235
2214
2215         Reviewed by Joseph Pecoraro.
2216
2217         * features.json:
2218
2219 2019-06-27  Saam Barati  <sbarati@apple.com>
2220
2221         Make WEBGPU enabled only on Mojave and later.
2222
2223         Rubber-stamped by Myles C. Maxfield.
2224
2225         We're going to look into re-enabling it on High Sierra in:
2226         https://bugs.webkit.org/show_bug.cgi?id=199275
2227
2228         * Configurations/FeatureDefines.xcconfig:
2229
2230 2019-06-27  Antti Koivisto  <antti@apple.com>
2231
2232         REGRESSION (touch-action): Can't scroll vertically when touching a horizontally-scrollable element on instagram.com
2233         https://bugs.webkit.org/show_bug.cgi?id=199268
2234         <rdar://problem/52246473>
2235
2236         Reviewed by Antoine Quint.
2237
2238         Test: pointerevents/ios/touch-action-region-manipulation.html
2239
2240         Having a restrictive touch-action value like 'pan-y' on on element and then having a descendant with
2241         'touch-action: manipulation' computes to 'none'.
2242
2243         * css/StyleResolver.cpp:
2244         (WebCore::computeEffectiveTouchActions):
2245
2246         For value 'manipulation' return the current effective value, similar to the reverse case above.
2247         Set intersection should only be computed out of restrictive values (pan-x/pan-y/pinch-zoom/none).
2248
2249 2019-06-27  Carlos Garcia Campos  <cgarcia@igalia.com>
2250
2251         [SOUP] Use libsoup WebSockets API
2252         https://bugs.webkit.org/show_bug.cgi?id=199151
2253
2254         Reviewed by Michael Catanzaro.
2255
2256         Use createWebSocketChannel() from the provider also for libsoup when WEBKIT_USE_SOUP_WEBSOCKETS env var is set.
2257
2258         * Modules/websockets/ThreadableWebSocketChannel.cpp:
2259         (WebCore::ThreadableWebSocketChannel::create):
2260
2261 2019-06-27  Devin Rousso  <drousso@apple.com>
2262
2263         Web Inspector: throw an error if console.count/console.countReset is called with an object that throws an error from toString
2264         https://bugs.webkit.org/show_bug.cgi?id=199252
2265
2266         Reviewed by Joseph Pecoraro.
2267
2268         Parse the arguments passed to `console.count` and `console.countReset` before sending it to
2269         the `ConsoleClient` so that an error can be thrown if the first argument doesn't `toString`
2270         nicely (e.g. without throwing an error).
2271
2272         Generate call stacks for `console.countReset` to match other `console` methods. Also do this
2273         for `console.time`, `console.timeLog`, and `console.timeEnd`. Limit the call stack to only
2274         have the top frame, so no unnecessary/extra data is sent to the frontend (right now, only
2275         the call location is displayed).
2276
2277         Rename `title` to `label` for `console.time`, `console.timeLog`, and `console.timeEnd` to
2278         better match the spec.
2279
2280         Updated existing LayoutTests:
2281          - inspector/console/console-count.html
2282          - inspector/console/console-api.html
2283
2284         Also covered by existing WPT tests.
2285
2286         * inspector/InspectorInstrumentation.h:
2287         (WebCore::InspectorInstrumentation::consoleCount):
2288         (WebCore::InspectorInstrumentation::consoleCountReset):
2289         (WebCore::InspectorInstrumentation::startConsoleTiming):
2290         (WebCore::InspectorInstrumentation::logConsoleTiming):
2291         (WebCore::InspectorInstrumentation::stopConsoleTiming):
2292         * inspector/InspectorInstrumentation.cpp:
2293         (WebCore::InspectorInstrumentation::consoleCountImpl):
2294         (WebCore::InspectorInstrumentation::consoleCountResetImpl):
2295         (WebCore::InspectorInstrumentation::startConsoleTimingImpl):
2296         (WebCore::InspectorInstrumentation::logConsoleTimingImpl):
2297         (WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
2298
2299         * page/PageConsoleClient.h:
2300         * page/PageConsoleClient.cpp:
2301         (WebCore::PageConsoleClient::count):
2302         (WebCore::PageConsoleClient::countReset):
2303         (WebCore::PageConsoleClient::time):
2304         (WebCore::PageConsoleClient::timeLog):
2305         (WebCore::PageConsoleClient::timeEnd):
2306
2307         * workers/WorkerConsoleClient.h:
2308         * workers/WorkerConsoleClient.cpp:
2309         (WebCore::WorkerConsoleClient::count):
2310         (WebCore::WorkerConsoleClient::countReset):
2311         (WebCore::WorkerConsoleClient::time):
2312         (WebCore::WorkerConsoleClient::timeLog):
2313         (WebCore::WorkerConsoleClient::timeEnd):
2314
2315         * worklets/WorkletConsoleClient.h:
2316         * worklets/WorkletConsoleClient.cpp:
2317         (WebCore::WorkletConsoleClient::count):
2318         (WebCore::WorkletConsoleClient::countReset):
2319
2320 2019-06-27  Saam Barati  <sbarati@apple.com>
2321
2322         [WHLSL] Implement arrays and MakeArrayReference
2323         https://bugs.webkit.org/show_bug.cgi?id=198414
2324
2325         Reviewed by Myles C. Maxfield.
2326
2327         This patch implements WHLSL arrays. The main implementation detail is that
2328         arrays get compiled to use Metal's array type. To make everything work, this
2329         patch also fixes a few bugs:
2330         - The checker now allows "operator.length" to be called on arrays. Prior to
2331         this patch, it was just allowed on array references.
2332         
2333         - The preserve variable lifetimes pass now looks at MakeArrayReference nodes.
2334         Prior to this patch, it just looked at MakePointerExpression.
2335         
2336         - We were producing the wrong type for ander arguments for indexed accesses
2337         on array types. We were saying the argument that was produced was a reference
2338         to an array instead of an array reference to the element type.
2339         
2340         - The trie we compose for the reverse type hierarchy was inserting elements
2341         into the wrong "children" vector. We were always inserting things into the
2342         top level vector. This is wrong when we have a nesting of types > 1.
2343         
2344         I also found a bug with having arrays of pointers when writing this patch.
2345         Work on this will take place in a follow up: https://bugs.webkit.org/show_bug.cgi?id=199197
2346
2347         Tests: webgpu/whlsl-huge-array.html
2348                webgpu/whlsl-make-array-reference.html
2349                webgpu/whlsl-simple-arrays.html
2350                webgpu/whlsl-two-dimensional-array.html
2351
2352         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
2353         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
2354         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
2355         (WebCore::WHLSL::Metal::writeNativeFunction):
2356         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
2357         (WebCore::WHLSL::Metal::TypeNamer::insert):
2358         (WebCore::WHLSL::Metal::TypeNamer::emitUnnamedTypeDefinition):
2359         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.h:
2360         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
2361         (WebCore::WHLSL::resolveByInstantiation):
2362         (WebCore::WHLSL::Checker::visit):
2363         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
2364         (WebCore::WHLSL::EscapedVariableCollector::escapeVariableUse):
2365         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
2366         (WebCore::WHLSL::wrapAnderCallArgument):
2367         (WebCore::WHLSL::anderCallArgument):
2368         * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt:
2369
2370 2019-06-27  Fujii Hironori  <Hironori.Fujii@sony.com>
2371
2372         [CMake] Bump cmake_minimum_required version to 3.10
2373         https://bugs.webkit.org/show_bug.cgi?id=199181
2374
2375         Reviewed by Don Olmstead.
2376
2377         No new tests because there is no behavior change.
2378
2379         * CMakeLists.txt:
2380
2381 2019-06-26  Simon Fraser  <simon.fraser@apple.com>
2382
2383         [Async overflow scrolling] Fix missing or misplaced content inside overflow:scroll
2384         https://bugs.webkit.org/show_bug.cgi?id=199253
2385         rdar://problem/51855156, rdar://problem/51934514
2386
2387         Reviewed by Zalan Bujtas.
2388
2389         This patch fixes a couple of related issues triggered by failing to composite layers inside non-stacking-context
2390         overflow scroll.
2391
2392         First, we relied on overlap testing to composite position:relative layers inside overflow:scroll, but this only
2393         worked when they came later in z-order, so didn't work for layers with negative z-index.
2394         RenderLayerCompositor::requiresCompositingForIndirectReason() was intended to trigger compositing in such cases,
2395         but it only did so for position:absolute inside stacking-context scroller, because
2396         isNonScrolledLayerInsideScrolledCompositedAncestor() tested ancestorMovedByScroller && !layerMovedByScroller.
2397
2398         I fixed this by sharing code between the three places that ask whether compositing crosses a containing-block
2399         boundary to call a single function, RenderLayerCompositor::layerScrollBehahaviorRelativeToCompositedAncestor(),
2400         that returns a ScrollPositioningBehavior. We now do compositing for both "moves" and "stationary" behaviors (but
2401         not "none"), ensuring that position:relative inside non-stacking scroller is always composited.
2402
2403         However, this would trigger compositing on layers that should be using backing sharing; if they were outside the
2404         visible part of the scroller, the overlap code would not trigger, but the
2405         "IndirectCompositingReason::OverflowScrollPositioning" code would. This is undesirable; any layer that can use
2406         backing sharing should, because that's fewer composited layers, so smaller layer trees and less backing store.
2407         To fix this, I moved the backing-sharing check before the overlap check in
2408         RenderLayerCompositor::computeCompositingRequirements().
2409
2410         The "layer.setHasCompositingDescendant(currentState.subtreeIsCompositing)" line was in the wrong place,
2411         triggering assertions on some content; "subtreeIsCompositing" only refers to child layers, so this bit needs to
2412         be set right after we've traversed the z-order lists.
2413
2414         Tests: compositing/scrolling/async-overflow-scrolling/hidden-relative-layer-content-in-scroller.html
2415                compositing/scrolling/async-overflow-scrolling/layer-for-negative-z-in-scroller.html
2416                compositing/scrolling/async-overflow-scrolling/negative-z-in-scroller.html
2417
2418         * rendering/RenderLayerCompositor.cpp:
2419         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
2420         (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
2421         (WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason const):
2422         (WebCore::isScrolledByOverflowScrollLayer):
2423         (WebCore::enclosingCompositedScrollingLayer):
2424         (WebCore::RenderLayerCompositor::layerScrollBehahaviorRelativeToCompositedAncestor):
2425         (WebCore::RenderLayerCompositor::computeCoordinatedPositioningForLayer const):
2426         (WebCore::isNonScrolledLayerInsideScrolledCompositedAncestor): Deleted.
2427         (WebCore::RenderLayerCompositor::layerContainingBlockCrossesCoordinatedScrollingBoundary): Deleted.
2428         * rendering/RenderLayerCompositor.h:
2429
2430 2019-06-26  Ryosuke Niwa  <rniwa@webkit.org>
2431
2432         ReplacementFragment should not have script observable side effects
2433         https://bugs.webkit.org/show_bug.cgi?id=199147
2434
2435         Reviewed by Wenson Hsieh.
2436
2437         Fixed the bug that ReplacementFragment has script observable side effects.
2438
2439         Use a brand new document for sanitization where the script is disabled for test rendering,
2440         and remove style and script elements as well as event handlers before the test rendering
2441         and the actual pasting.
2442
2443         Test: editing/pasteboard/paste-contents-with-side-effects.html
2444
2445         * editing/ReplaceSelectionCommand.cpp:
2446         (WebCore::ReplacementFragment::document): Deleted.
2447         (WebCore::ReplacementFragment::ReplacementFragment): Use createPageForSanitizingWebContent
2448         to create our own document for test rendering. We need to copy over the computed style
2449         from the root editable element (editing host) to respect whitespace treatment, etc...
2450         (WebCore::ReplacementFragment::removeContentsWithSideEffects): Moved from removeHeadContents.
2451         Now removes event handlers and JavaScript URLs.
2452         (WebCore::ReplacementFragment::insertFragmentForTestRendering): Renamed variable names.
2453         (WebCore::ReplaceSelectionCommand::willApplyCommand): Create the plain text and HTML markup
2454         for beforeinput and input events before ReplacementFragment removes contents with side effects.
2455         (WebCore::ReplaceSelectionCommand::ensureReplacementFragment): The removal of head elements
2456         is now done in ReplacementFragment's constructor.
2457
2458 2019-06-26  Andy Estes  <aestes@apple.com>
2459
2460         [Payment Request] Set state to Closed when show() is called during an active session
2461         https://bugs.webkit.org/show_bug.cgi?id=199239
2462
2463         Reviewed by Alex Christensen.
2464
2465         According to step 7 of https://w3c.github.io/payment-request/#show-method (as of 26 June
2466         2019), when another payment request is showing, calling show() should set the [[state]]
2467         internal slot to Closed in addition to rejecting the show promise with an AbortError. WebKit
2468         was only doing the latter. Let's do both.
2469
2470         Test: http/tests/paymentrequest/payment-is-showing.https.html
2471
2472         * Modules/paymentrequest/PaymentRequest.cpp:
2473         (WebCore::PaymentRequest::show):
2474
2475 2019-06-26  Joseph Pecoraro  <pecoraro@apple.com>
2476
2477         Web Inspector: Implement console.countReset
2478         https://bugs.webkit.org/show_bug.cgi?id=199200
2479
2480         Reviewed by Devin Rousso.
2481
2482         Updated existing tests.
2483
2484         * inspector/InspectorInstrumentation.cpp:
2485         (WebCore::InspectorInstrumentation::consoleCountImpl):
2486         (WebCore::InspectorInstrumentation::consoleCountResetImpl):
2487         * inspector/InspectorInstrumentation.h:
2488         (WebCore::InspectorInstrumentation::consoleCountReset):
2489         * page/PageConsoleClient.cpp:
2490         (WebCore::PageConsoleClient::countReset):
2491         * page/PageConsoleClient.h:
2492         * workers/WorkerConsoleClient.cpp:
2493         (WebCore::WorkerConsoleClient::countReset):
2494         * workers/WorkerConsoleClient.h:
2495         * worklets/WorkletConsoleClient.cpp:
2496         (WebCore::WorkletConsoleClient::countReset):
2497         * worklets/WorkletConsoleClient.h:
2498
2499 2019-06-26  Antoine Quint  <graouts@apple.com>
2500
2501         [Pointer Events] Respect pointer capture when dispatching mouse boundary events and updating :hover
2502         https://bugs.webkit.org/show_bug.cgi?id=198999
2503         <rdar://problem/51979477>
2504
2505         Reviewed by Dean Jackson.
2506
2507         Make sure we don't return early prior to setting the flag that prevents re-entrancy, or else we would never
2508         enter this function again. No new tests, this was caught because Pointer Events WPT tests on iOS tests regressed.
2509
2510         * page/PointerCaptureController.cpp:
2511         (WebCore::PointerCaptureController::processPendingPointerCapture):
2512
2513 2019-06-26  Myles C. Maxfield  <mmaxfield@apple.com>
2514
2515         REGRESSION: ( r246394 ) webgpu/whlsl-buffer-fragment.html and webgpu/whlsl-buffer-vertex.html are failing
2516         https://bugs.webkit.org/show_bug.cgi?id=199012
2517
2518         Reviewed by Saam Barati.
2519
2520         * platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
2521         (WebCore::isAcceptableDevice):
2522         (WebCore::GPUDevice::tryCreate):
2523
2524 2019-06-26  Simon Fraser  <simon.fraser@apple.com>
2525
2526         Incorrect clippping with overflow:scroll inside oveflow:hidden with border-radius
2527         https://bugs.webkit.org/show_bug.cgi?id=199135
2528         rdar://problem/51882383
2529
2530         Reviewed by Zalan Bujtas.
2531         
2532         In some cases the geometry of the shape mask layer added to m_childContainmentLayer, for
2533         border-radius, was incorrect. GraphicsLayerCA::updateClippingStrategy() treated
2534         the rounded rect as if it were in renderer coordinates, but to match the other geometry
2535         on GraphicsLayer, it should in GraphicsLayer coordinates, so we need to offset by
2536         clipLayer->offsetFromRenderer().
2537         
2538         In addition, RenderLayerBacking::updateChildClippingStrategy() is called from
2539         the updateConfiguration(), which is before we've set offsetFromRenderer() on the clipLayer.
2540         This first call is really to find out whether the platform supports this rounded rect
2541         as a shape mask.
2542         
2543         So we need to call setMasksToBoundsRect() a second time in RenderLayerBacking::updateGeometry()
2544         after clipLayers's offsetFromRenderer() has been computed.
2545
2546         Test: compositing/scrolling/async-overflow-scrolling/border-radius-on-scroll-container.html
2547
2548         * platform/graphics/ca/GraphicsLayerCA.cpp:
2549         (WebCore::GraphicsLayerCA::updateClippingStrategy):
2550         * rendering/RenderLayerBacking.cpp:
2551         (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
2552         (WebCore::RenderLayerBacking::updateDescendantClippingLayer):
2553         (WebCore::RenderLayerBacking::updateChildClippingStrategy):
2554
2555 2019-06-26  Antoine Quint  <graouts@apple.com>
2556
2557         [Pointer Events] Respect pointer capture when dispatching mouse boundary events and updating :hover
2558         https://bugs.webkit.org/show_bug.cgi?id=198999
2559         <rdar://problem/51979477>
2560
2561         Reviewed by Dean Jackson.
2562
2563         Up until now, we would not account for pointer capture (see ​https://w3c.github.io/pointerevents/#pointer-capture) when dispatching
2564         mouse boundary events (mouseover, mouseout, mouseenter, mouseleave) and their counterpart pointer events. We would also not account
2565         for it when updating :hover styles.
2566
2567         Now, when pointer capture changes for an element, we call setCapturingMouseEventsElement() on the EventHandler such that the element
2568         that would naturally hit-test is overridden by the pointer capture element when identifying which target to use for the dispatch of
2569         boundary mouse events. Additionally, when calling Document::prepareMouseEvent(), we also use the pointer capture element to
2570         pass down to Document::updateHoverActiveState() such that :hover styles are applied to the correct element.
2571
2572         * dom/Document.cpp:
2573         (WebCore::Document::prepareMouseEvent): When a new event is going to be dispatched, we must run the Process Pending Capture Element
2574         steps as mandated by the Pointer Events spec. Calling this will dispatch the appropriate pointer capture change events and also
2575         required boundary events since EventHandler::setCapturingMouseEventsElement() calls into EventHandler::updateMouseEventTargetNode().
2576         Since this may update the capturing mouse events element, we ensure that we call updateHoverActiveState() with a flag that indicates that.
2577         Finally, we use the capturing mouse events element instead of the hit-testing element to pass to updateHoverActiveState() to ensure
2578         that is has :hover styles applied.
2579         (WebCore::Document::updateHoverActiveState): Account for the new CaptureChange flag to force the invalidation of the :hover and :active
2580         elements chain at all times when the capturing mouse events element changed.
2581         * dom/Document.h:
2582         * dom/PointerEvent.h: Update PointerEvent::createForPointerCapture() to take specific parameters rather than a single PointerEvent to
2583         set the pointerId, isPrimary and pointerType properties of the generated event. This is required to call processPendingPointerCapture()
2584         outside of PointerEvent dispatch logic since we now call it from Document::prepareMouseEvent() where we haven't yet generated such an
2585         event.
2586         * page/EventHandler.cpp:
2587         (WebCore::EventHandler::pointerCaptureElementDidChange): When a new pointer capture element is set, call updateMouseEventTargetNode()
2588         to ensure that boundary events are fired to indicate the pointer capture state change.
2589         (WebCore::EventHandler::prepareMouseEvent): Keep track of the last PlatformMouseEvent used to prepare a mouse event so that we can use
2590         it when setCapturingMouseEventsElement() is called.
2591         * page/EventHandler.h:
2592         * page/PointerCaptureController.cpp:
2593         (WebCore::PointerCaptureController::pointerCaptureElement): Since Document::prepareMouseEvent() needs to know the current pointer capture
2594         element, add a new public method that indicates the pointer capture element if that element is contained in the provided document. We need
2595         to provide the document since PointerCaptureController is owned by the Page and may manage several documents.
2596         (WebCore::PointerCaptureController::dispatchEvent): Only run the Process Pending Capture Element steps when dealing with a touch or pen
2597         event since those steps are already ran for mouse events in Document::prepareMouseEvent(). Additionally, since the element target is already
2598         set to be the pointer capture element with the changes made to processPendingPointerCapture(), and because on iOS pointer capture is always
2599         active, we can remove the code that would retarget the event to the pointer capture element.
2600         (WebCore::PointerCaptureController::pointerEventWasDispatched):
2601         (WebCore::PointerCaptureController::cancelPointer):
2602         (WebCore::PointerCaptureController::processPendingPointerCapture): We now call into EventHandler::setCapturingMouseEventsElement() when the
2603         capture target element changes. We must be careful to call this method prior to dispatching the "gotpointercapture" event and after dispatching
2604         the "lostpointercapture" event so that boundary events are fired at the right time.
2605         * page/PointerCaptureController.h:
2606
2607 2019-06-25  Fujii Hironori  <Hironori.Fujii@sony.com>
2608
2609         [WinCairo] incorrect font height for 'Google Sans Display' font
2610         https://bugs.webkit.org/show_bug.cgi?id=198909
2611
2612         Reviewed by Frédéric Wang.
2613
2614         r191893 changed to use OS/2 typo metrics, but its calculation
2615         wasn't correct. And, there is no reliable way to get OS/2 table by
2616         using Windows API. Revert the part of r191893 change at the
2617         moment.
2618
2619         * platform/graphics/win/SimpleFontDataCairoWin.cpp:
2620         (WebCore::Font::platformInit):
2621         * platform/graphics/win/SimpleFontDataWin.cpp:
2622         (WebCore::Font::initGDIFont):
2623         Reverted the part of r191893 change, and added FIXME comments.
2624
2625 2019-06-25  Timothy Hatcher  <timothy@apple.com>
2626
2627         Clicking the up/down spin buttons for a number input increments/decrements by 2.
2628         https://bugs.webkit.org/show_bug.cgi?id=198809
2629
2630         Reviewed by Tim Horton.
2631
2632         AppKit no longer registers NSScrollerButtonDelay and NSScrollerButtonPeriod in the base
2633         NSUserDefaults for an app. This caused our use to always get 0s when setting the click
2634         and hold timer, causing the value to increment quickly for a single press.
2635
2636         * platform/mac/ScrollbarThemeMac.h:
2637         (WebCore::ScrollbarThemeMac::initialAutoscrollTimerDelay): Added. Hardcode 500ms.
2638         (WebCore::ScrollbarThemeMac::autoscrollTimerDelay): Added. Hardcode 50ms.
2639         * platform/mac/ScrollbarThemeMac.mm:
2640         (WebCore::ScrollbarThemeMac::preferencesChanged): Removed use of old user defaults.
2641         (WebCore::ScrollbarThemeMac::initialAutoscrollTimerDelay): Deleted.
2642         (WebCore::ScrollbarThemeMac::autoscrollTimerDelay): Deleted.
2643
2644 2019-06-25  Keith Miller  <keith_miller@apple.com>
2645
2646         Unreviewed, windows build fix.
2647
2648         * bindings/js/JSDOMGlobalObject.h:
2649
2650 2019-06-25  Keith Miller  <keith_miller@apple.com>
2651
2652         Add didBecomePrototype() calls to global context prototypes
2653         https://bugs.webkit.org/show_bug.cgi?id=199202
2654
2655         Reviewed by Mark Lam.
2656
2657         This fixes some crashes related to asserting that all prototypes
2658         have been marked as such in JSC from
2659         https://trac.webkit.org/changeset/246801. It's ok to call
2660         didBecomePrototype here as we setting up the world state right now
2661         so we won't be having a bad time.
2662
2663         We don't automatically call didBecomePrototype() for
2664         setPrototypeWithoutTransition because existing objects may already
2665         have this structure so it seems more reasonable to be explicit
2666         there.
2667
2668         * bindings/js/JSWindowProxy.cpp:
2669         (WebCore::JSWindowProxy::setWindow):
2670         * bindings/js/WorkerScriptController.cpp:
2671         (WebCore::WorkerScriptController::initScript):
2672         * worklets/WorkletScriptController.cpp:
2673         (WebCore::WorkletScriptController::initScriptWithSubclass):
2674
2675 2019-06-25  Joseph Pecoraro  <pecoraro@apple.com>
2676
2677         Web Inspector: Implement console.timeLog
2678         https://bugs.webkit.org/show_bug.cgi?id=199184
2679
2680         Reviewed by Devin Rousso.
2681
2682         Updated existing tests.
2683
2684         * inspector/InspectorInstrumentation.cpp:
2685         (WebCore::InspectorInstrumentation::logConsoleTimingImpl):
2686         * inspector/InspectorInstrumentation.h:
2687         (WebCore::InspectorInstrumentation::logConsoleTiming):
2688         * page/PageConsoleClient.cpp:
2689         (WebCore::PageConsoleClient::timeLog):
2690         * page/PageConsoleClient.h:
2691         * workers/WorkerConsoleClient.cpp:
2692         (WebCore::WorkerConsoleClient::timeLog):
2693         * workers/WorkerConsoleClient.h:
2694         * worklets/WorkletConsoleClient.cpp:
2695         (WebCore::WorkletConsoleClient::timeLog):
2696         * worklets/WorkletConsoleClient.h:
2697
2698 2019-06-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2699
2700         Add user agent quirk for bankofamerica.com
2701         https://bugs.webkit.org/show_bug.cgi?id=199154
2702
2703         Reviewed by Carlos Garcia Campos.
2704
2705         This suppresses an unsupported browser warning.
2706
2707         * platform/UserAgentQuirks.cpp:
2708         (WebCore::urlRequiresMacintoshPlatform):
2709
2710 2019-06-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2711
2712         Fully rename WebKitGTK+ -> WebKitGTK everywhere
2713         https://bugs.webkit.org/show_bug.cgi?id=199159
2714
2715         Reviewed by Carlos Garcia Campos.
2716
2717         * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
2718         (webkitAccessibleTextGetStringAtOffset):
2719         * platform/UserAgentQuirks.cpp:
2720         (WebCore::urlRequiresMacintoshPlatform):
2721         * platform/network/soup/NetworkStorageSessionSoup.cpp:
2722         (WebCore::NetworkStorageSession::saveCredentialToPersistentStorage):
2723         * rendering/RenderThemeGtk.cpp:
2724         (WebCore::RenderThemeGtk::adjustTextFieldStyle const):
2725
2726 2019-06-25  Rob Buis  <rbuis@igalia.com>
2727
2728         Introduce LinkLoadParameters
2729         https://bugs.webkit.org/show_bug.cgi?id=198960
2730
2731         Reviewed by Frédéric Wang.
2732
2733         Avoid the long parameters lists in LinkLoader by moving them
2734         to LinkLoadParameters.
2735
2736         No new tests because there is no behavior change.
2737
2738         * html/HTMLLinkElement.cpp:
2739         (WebCore::HTMLLinkElement::process):
2740         * loader/LinkLoader.cpp:
2741         (WebCore::LinkLoader::loadLinksFromHeader):
2742         (WebCore::LinkLoader::preconnectIfNeeded):
2743         (WebCore::LinkLoader::preloadIfNeeded):
2744         (WebCore::LinkLoader::prefetchIfNeeded):
2745         (WebCore::LinkLoader::loadLink):
2746         * loader/LinkLoader.h:
2747
2748 2019-06-24  Wenson Hsieh  <wenson_hsieh@apple.com>
2749
2750         [Text autosizing] [iPadOS] Revise our heuristics to determine idempotent text autosizing candidates
2751         https://bugs.webkit.org/show_bug.cgi?id=198763
2752         <rdar://problem/51826266>
2753
2754         Reviewed by Simon Fraser.
2755
2756         This patch adjusts existing text autosizing heuristics, based on a survey of text on websites in the Alexa top
2757         500 that shrink down to fit the viewport when requesting the desktop version of the site. The new heuristic is
2758         derived from training decision trees against the dataset obtained from this survey, and balances false positives
2759         (cases where layout is broken due to autosizing) against overall accuracy (measured using cross-validation).
2760
2761         See below for more details. Additionally, please refer to the link in the radar for more details, as well as
2762         resources used to generate, validate, and analyze these decision trees.
2763
2764         Test: fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates.html
2765
2766         * css/StyleResolver.cpp:
2767         (WebCore::StyleResolver::adjustRenderStyleForTextAutosizing):
2768         * rendering/style/RenderStyle.cpp:
2769         (WebCore::RenderStyle::isIdempotentTextAutosizingCandidate const):
2770
2771         Rename AutosizeStatus::shouldSkipSubtree to RenderStyle::isIdempotentTextAutosizingCandidate. We relocate this
2772         logic to RenderStyle, such that we're able to ask the element's RenderStyle questions when determining whether
2773         the element should be autosized.
2774
2775         Of course, this patch additionally revamps the heuristic used to determine whether it is safe to autosize an
2776         element. Our current heuristic in trunk simply checks for the presence of inline block display, out of flow
2777         positioning and a fixed height ancestor; if any of these conditions are satisfied, we opt the element out of
2778         text autosizing. This is an excellent strategy for boosting some runs of text while avoiding autosizing in the
2779         vast majority of cases where increasing font size may lead to layout breakage (e.g. overlapping or clipped text,
2780         content unexpectedly flowing to the next line, etc.). However, it also avoids boosting font sizes in many
2781         scenarios where boosting font sizes is desired; for concrete examples, see the (currently 24) radars about small
2782         font sizes that are duped to <rdar://problem/51826266>.
2783
2784         To help analyze and identify trends in autosizable and non-autosizable text, we assembled a dataset of elements
2785         with text from the Alexa top 500 that either: (1) were too small and could be boosted safely, or (2) would break
2786         layout if boosted. With this labeled dataset, we then trained binary decision trees to classify the data. Each
2787         decision tree was trained with a number of hyperparameters: namely, maximum depth, minimum leaf size, and the
2788         amount of bias towards negative samples (i.e. the ratio of the weight of a non-autosizable sample relative to
2789         the weight of an autosizable sample).
2790
2791         For each 3-tuple of these hyperparameters (800 in total: max depth between 3 and 10, min leaf size between 1 and
2792         10 and bias between 1 and 10), for 5000 iterations each, we split the full dataset into a training dataset and
2793         a cross-validation dataset, trained a decision tree using the training set, and tested against the cross-
2794         validation set to compute average precision, recall, and overall accuracy for each tuple of hyperparameters.
2795
2796         The decision tree introduced in this patch was generated using a hand-picked set of hyperparameters (max depth
2797         10, min leaf size 4, and negative bias 2) to provide a balance between precision scores (limiting layout
2798         breakage) and recall score (ensuring that small text is mostly autosized), while optimizing for overall
2799         accuracy. Cross-validation scores predict that the overall accuracy of this classifier is approximately 70%, up
2800         from the current accuracy in trunk (~53%).
2801
2802         * rendering/style/RenderStyle.h:
2803
2804         Grow the width of `autosizeStatus` from 4 to 8 (notably, this does not increase the size of RenderStyle).
2805
2806         * rendering/style/TextSizeAdjustment.cpp:
2807         (WebCore::AutosizeStatus::updateStatus):
2808         (WebCore::AutosizeStatus::shouldSkipSubtree const): Deleted.
2809         * rendering/style/TextSizeAdjustment.h:
2810
2811         Introduce new text autosizing state flags, and remove some existing ones.
2812
2813 2019-06-24  Commit Queue  <commit-queue@webkit.org>
2814
2815         Unreviewed, rolling out r246714.
2816         https://bugs.webkit.org/show_bug.cgi?id=199179
2817
2818         revert to do patch in a different way. (Requested by keith_mi_
2819         on #webkit).
2820
2821         Reverted changeset:
2822
2823         "All prototypes should call didBecomePrototype()"
2824         https://bugs.webkit.org/show_bug.cgi?id=196315
2825         https://trac.webkit.org/changeset/246714
2826
2827 2019-06-24  Sihui Liu  <sihui_liu@apple.com>
2828
2829         REGRESSION (r244436): IndexedDB Uint8Array returned as ArrayBuffer
2830         https://bugs.webkit.org/show_bug.cgi?id=198738
2831         <rdar://problem/51614053>
2832
2833         Reviewed by Brady Eidson.
2834
2835         In InexedDB, two binary keys are the same as long as their data is the same.
2836
2837         Modified tests: storage/indexeddb/key-type-binary.html
2838                         storage/indexeddb/key-type-binary-private.html
2839
2840         * bindings/js/IDBBindingUtilities.cpp:
2841         (WebCore::injectIDBKeyIntoScriptValue):
2842         * bindings/js/SerializedScriptValue.cpp:
2843         (WebCore::CloneDeserializer::readArrayBufferView):
2844
2845 2019-06-24  Sihui Liu  <sihui_liu@apple.com>
2846
2847         Remove WebSQL quirk for nytimes.com
2848         https://bugs.webkit.org/show_bug.cgi?id=199175
2849
2850         Reviewed by Geoffrey Garen.
2851
2852         Removed unused code.
2853
2854         * bindings/scripts/CodeGeneratorJS.pm:
2855         (GenerateRuntimeEnableConditionalString):
2856         * bindings/scripts/IDLAttributes.json:
2857         * page/Quirks.cpp:
2858         (WebCore::Quirks::hasBrokenEncryptedMediaAPISupportQuirk const):
2859         (WebCore::Quirks::hasWebSQLSupportQuirk const): Deleted.
2860         * page/Quirks.h:
2861
2862 2019-06-24  Brady Eidson  <beidson@apple.com>
2863
2864         Null deref in WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad.
2865         <rdar://problem/51535942> and https://bugs.webkit.org/show_bug.cgi?id=199123
2866
2867         Reviewed by Andy Estes.
2868
2869         * loader/FrameLoaderStateMachine.h:
2870         (WebCore::FrameLoaderStateMachine::stateForDebugging const):
2871
2872 2019-06-24  Simon Fraser  <simon.fraser@apple.com>
2873
2874         REGRESSION (r246725 ): Crashes on twitch.tv
2875         https://bugs.webkit.org/show_bug.cgi?id=199176
2876         rdar://problem/52071249
2877
2878         Reviewed by Zalan Bujtas.
2879         
2880         With a composited negative z-index child inside a scroller, we can register the overflow scroll
2881         proxy node before we've traversed the overflow layer, so it that layer hasn't got its OverflowScrollingNode
2882         yet. Thus, AsyncScrollingCoordinator::setRelatedOverflowScrollingNodes() can be called with an empty vector.
2883         Avoid crashing when this happens.
2884
2885         Test: scrollingcoordinator/scrolling-tree/scroller-with-negative-z-child.html
2886
2887         * page/scrolling/AsyncScrollingCoordinator.cpp:
2888         (WebCore::AsyncScrollingCoordinator::setRelatedOverflowScrollingNodes):
2889         * page/scrolling/cocoa/ScrollingTreeOverflowScrollProxyNode.mm:
2890         (WebCore::ScrollingTreeOverflowScrollProxyNode::commitStateBeforeChildren):
2891
2892 2019-06-24  Chris Dumez  <cdumez@apple.com>
2893
2894         Pages using Google's anti-flicker optimization may take ~5 seconds to do initial paint
2895         https://bugs.webkit.org/show_bug.cgi?id=199173
2896         <rdar://problem/45968770>
2897
2898         Reviewed by Geoffrey Garen.
2899
2900         Pages using Google's anti-flicker optimization [1] take ~5 seconds to do initial paint when
2901         analytics.js load is blocked by a content blocker.
2902
2903         To address the issue, this patch introduces a quirk behind an experimental feature flag that
2904         calls window.dataLayer.hide.end() on the page when the load of https://www.google-analytics.com/analytics.js
2905         is blocked by a content blocker. Note that this is more robust than dropping the 'async-hide'
2906         class from document.documentElement since the class name is customizable by the caller.
2907         A message is logged in the console when the quirk causes window.dataLayer.hide.end() to get called
2908         early.
2909
2910         [1] https://developers.google.com/optimize/
2911
2912         * contentextensions/ContentExtensionsBackend.cpp:
2913         (WebCore::ContentExtensions::ContentExtensionsBackend::processContentRuleListsForLoad):
2914         * page/Settings.yaml:
2915
2916 2019-06-24  John Wilander  <wilander@apple.com>
2917
2918         Remove IsITPFirstPartyWebsiteDataRemovalEnabled as runtime check
2919         https://bugs.webkit.org/show_bug.cgi?id=199164
2920         <rdar://problem/52061147>
2921
2922         Reviewed by Brent Fulgham.
2923
2924         No new tests. Just a removal of a runtime feature check. The functionality
2925         already has a layout test.
2926
2927         We've had this toggle as a safety thing since mid-March. No need for it any longer.
2928
2929         * page/RuntimeEnabledFeatures.h:
2930         (WebCore::RuntimeEnabledFeatures::isITPDatabaseEnabled const):
2931         (WebCore::RuntimeEnabledFeatures::setIsITPFirstPartyWebsiteDataRemovalEnabled): Deleted.
2932         (WebCore::RuntimeEnabledFeatures::isITPFirstPartyWebsiteDataRemovalEnabled const): Deleted.
2933
2934 2019-06-24  Jer Noble  <jer.noble@apple.com>
2935
2936         iOS 12.2 Drawing portrait video to canvas is sideways
2937         https://bugs.webkit.org/show_bug.cgi?id=196772
2938         <rdar://problem/49781802>
2939
2940         Reviewed by Eric Carlson.
2941
2942         Test: media/video-orientation-canvas.html
2943
2944         Move rotation code into its own ImageRotationSessionVT class for re-use across
2945         all existing classes with rotation operations. Should slightly increase performance
2946         for painting rotated media files, as the rotation only occurs once per frame, rather
2947         than once per drawing operation.
2948
2949         * WebCore.xcodeproj/project.pbxproj:
2950         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
2951         (WebCore::ImageDecoderAVFObjC::RotationProperties::isIdentity const): Deleted.
2952         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
2953         (WebCore::ImageDecoderAVFObjC::readTrackMetadata):
2954         (WebCore::ImageDecoderAVFObjC::storeSampleBuffer):
2955         (WebCore::ImageDecoderAVFObjC::setTrack):
2956         (WebCore::transformToRotationProperties): Deleted.
2957         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2958         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2959         (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged):
2960         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastPixelBuffer):
2961         (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
2962         * platform/graphics/cv/ImageRotationSessionVT.h: Added.
2963         (WebCore::ImageRotationSessionVT::RotationProperties::isIdentity const):
2964         (WebCore::ImageRotationSessionVT::rotationProperties const):
2965         (WebCore::ImageRotationSessionVT::rotatedSize):
2966         * platform/graphics/cv/ImageRotationSessionVT.mm: Added.
2967         (WebCore::transformToRotationProperties):
2968         (WebCore::ImageRotationSessionVT::ImageRotationSessionVT):
2969         (WebCore::ImageRotationSessionVT::rotate):
2970         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
2971         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h:
2972         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm:
2973         (WebCore::rotationToAngle):
2974         (WebCore::RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer):
2975         (WebCore::computeRotatedWidthAndHeight): Deleted.
2976
2977 2019-06-24  Zalan Bujtas  <zalan@apple.com>
2978
2979         [StyleResolver] Pass RenderStyle& instead of RenderStyle* to updateFont() related functions.
2980         https://bugs.webkit.org/show_bug.cgi?id=199167
2981         <rdar://problem/52062669>
2982
2983         Reviewed by Antti Koivisto.
2984
2985         It is expected to have a valid RenderStyle object here (and existing code relies on it).
2986
2987         * css/StyleResolver.cpp:
2988         (WebCore::checkForOrientationChange):
2989         (WebCore::StyleResolver::updateFont):
2990         (WebCore::StyleResolver::checkForTextSizeAdjust):
2991         (WebCore::StyleResolver::checkForZoomChange):
2992         (WebCore::StyleResolver::checkForGenericFamilyChange):
2993         * css/StyleResolver.h:
2994
2995 2019-06-24  Antoine Quint  <graouts@apple.com>
2996
2997         [Pointer Events WPT] Unskip imported/w3c/web-platform-tests/pointerevents/pointerevent_lostpointercapture_is_first.html
2998         https://bugs.webkit.org/show_bug.cgi?id=197005
2999
3000         Reviewed by Dean Jackson.
3001
3002         We were calling processPendingPointerCapture() at the wrong time, calling in after dispatching a PointerEvent rather than before.
3003         We now do this correctly in the consolidated PointerCaptureController::dispatchEvent() method, which we call for dispatching all
3004         PointerEvents, save for gotpointercapture and lostpointercapture since these should not yield the processing of the pending pointer
3005         capture per the spec.
3006
3007         This uncovered a couple of new issues. First, since we would now call processPendingPointerCapture() and dispatch a lostpointercapture
3008         event earlier, the alternative lostpointercapture dispatch when an element is removed (which is dispatched asynchronously on the
3009         document) would be dispatched *after* dispatching the event in processPendingPointerCapture(). We now check in processPendingPointerCapture()
3010         whether the event target is connected to fix this. This makes sure pointerevent_lostpointercapture_for_disconnected_node.html doesn't regress.
3011
3012         Finally, we must also call processPendingPointerCapture() when implicitly releasing pointer capture during handling of a "pointerup" event.
3013         This ensures that pointerevent_releasepointercapture_invalid_pointerid.html doesn't regress.
3014
3015         As a result of all these changes, we now pass imported/w3c/web-platform-tests/pointerevents/pointerevent_lostpointercapture_is_first.html reliably.
3016
3017         * page/PointerCaptureController.cpp:
3018         (WebCore::PointerCaptureController::dispatchEventForTouchAtIndex):
3019         (WebCore::PointerCaptureController::dispatchEvent): We now more closely adhere to the spec when determining what the pointer capture target is by
3020         only checking for the target override. We can now do this safely since we call processPendingPointerCapture() before and not after event dispatch.
3021         (WebCore::PointerCaptureController::pointerEventWasDispatched):
3022         (WebCore::PointerCaptureController::processPendingPointerCapture): Cache the pending target override to make sure that dispatching a "gotpointercapture"
3023         or "lostpointercapture" event during this function does not alter it until the next call is made when the next event is dispatched.
3024
3025 2019-06-24  Greg Doolittle  <gr3g@apple.com>
3026
3027         Web Inspector: AXI: Audit: image label test is throwing spurious errors on elements with existing alt attr, but no value: <img alt>
3028         https://bugs.webkit.org/show_bug.cgi?id=194754
3029
3030         Reviewed by Chris Fleizach.
3031
3032         Test: accessibility/img-alt-attribute-unassigned-value.html
3033
3034         * accessibility/AccessibilityObject.cpp:
3035         (WebCore::AccessibilityObject::computedRoleString const):
3036
3037 2019-06-24  Adrian Perez de Castro  <aperez@igalia.com>
3038
3039         [WPE][GTK] Fixes for compilation with unified builds disabled
3040         https://bugs.webkit.org/show_bug.cgi?id=199155
3041
3042         Reviewed by Michael Catanzaro.
3043
3044         No new tests needed.
3045
3046         * rendering/LayerAncestorClippingStack.h: Add missing inclusion of RenderLayer.h
3047
3048 2019-06-24  Michael Catanzaro  <mcatanzaro@igalia.com>
3049
3050         Add user agent quirk for Google Drive
3051         https://bugs.webkit.org/show_bug.cgi?id=199153
3052
3053         Reviewed by Carlos Garcia Campos.
3054
3055         This suppresses an unsupported browser warning.
3056
3057         * platform/UserAgentQuirks.cpp:
3058         (WebCore::urlRequiresMacintoshPlatform):
3059         (WebCore::urlRequiresLinuxDesktopPlatform):
3060
3061 2019-06-24  Charlie Turner  <cturner@igalia.com>
3062
3063         [GStreamer][MSE] Pausing video sometimes causes skip to finish
3064         https://bugs.webkit.org/show_bug.cgi?id=197355
3065
3066         Reviewed by Philippe Normand.
3067
3068         Covered by existing tests.
3069
3070         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3071         (WebCore::MediaPlayerPrivateGStreamerMSE::currentMediaTime const):
3072         Assuming that when m_eosPending is on and we're paused() that the
3073         network resource is fully loaded and the end is reached is clearly
3074         wrong. Whether this is now correct is unclear...
3075
3076 2019-06-24  Charlie Turner  <cturner@igalia.com>
3077
3078         [GStreamer] Volume level sometimes changes inappropriately
3079         https://bugs.webkit.org/show_bug.cgi?id=197358
3080
3081         Reviewed by Xabier Rodriguez-Calvar.
3082
3083         Be consistent with our application of volume scaling. We were
3084         setting volumes using cubic interpolation in setVolume() and using
3085         the inverse in volume(); however setting initial volumes was done
3086         linearly in setStreamVolumeElement, which was causing strange
3087         jumps in the volume level at non-deterministic times. The fix
3088         looks to be that we should use linear interpolation consistently,
3089         since PulseAudio already applies cubic scaling to software
3090         volumes.
3091
3092         Covered by existing tests.
3093
3094         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3095         (WebCore::MediaPlayerPrivateGStreamer::paused const): Bump the
3096         logging here to LOG level, it's very spammy at DEBUG.
3097         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3098         (WebCore::MediaPlayerPrivateGStreamerBase::setVolume): Switch to
3099         linear interpolation.
3100         (WebCore::MediaPlayerPrivateGStreamerBase::volume const): Ditto.
3101         (WebCore::MediaPlayerPrivateGStreamerBase::notifyPlayerOfVolumeChange):
3102         Ditto.
3103         (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement):
3104         Ditto, and be consistent here with the API, do not set the raw
3105         volume managed by MediaElement.
3106
3107 2019-06-24  Antoine Quint  <graouts@apple.com>
3108
3109         [Pointer Events] Respect pointer capture when dispatching mouse boundary events and updating :hover
3110         https://bugs.webkit.org/show_bug.cgi?id=198999
3111         <rdar://problem/51979477>
3112
3113         Unreviewed.
3114
3115         Rolling back all changes made for this bug (r246728 + r246716 + r246674) as it regressed one test
3116         (imported/w3c/web-platform-tests/pointerevents/pointerevent_mouse_pointercapture_in_frame.html).
3117
3118         * dom/Document.cpp:
3119         (WebCore::Document::prepareMouseEvent):
3120         (WebCore::Document::updateHoverActiveState):
3121         * page/EventHandler.cpp:
3122         (WebCore::EventHandler::handleMousePressEvent):
3123         (WebCore::EventHandler::handleMouseMoveEvent):
3124         (WebCore::EventHandler::handleMouseReleaseEvent):
3125         (WebCore::EventHandler::setCapturingMouseEventsElement):
3126         * page/EventHandler.h:
3127         * page/PointerCaptureController.cpp:
3128         (WebCore::PointerCaptureController::releasePointerCapture):
3129         (WebCore::PointerCaptureController::hasPointerCapture):
3130         (WebCore::PointerCaptureController::dispatchEventForTouchAtIndex):
3131         (WebCore::PointerCaptureController::dispatchEvent):
3132         (WebCore::PointerCaptureController::processPendingPointerCapture):
3133         (WebCore::PointerCaptureController::pointerCaptureElement): Deleted.
3134         * page/PointerCaptureController.h:
3135         * rendering/HitTestRequest.h:
3136         (WebCore::HitTestRequest::includesAllElementsUnderPoint const):
3137         (WebCore::HitTestRequest::pointerCaptureElementChanged const): Deleted.
3138
3139 2019-06-23  Antoine Quint  <graouts@apple.com>
3140
3141         [Pointer Events] Respect pointer capture when dispatching mouse boundary events and updating :hover
3142         https://bugs.webkit.org/show_bug.cgi?id=198999
3143         <rdar://problem/52005663>
3144
3145         Reviewed by Dean Jackson.
3146
3147         We should only set the mouse events capturing element in EventHandler if we're dealing with mouse-originated Pointer Events (part 2).
3148
3149         * page/PointerCaptureController.cpp:
3150         (WebCore::PointerCaptureController::releasePointerCapture):
3151
3152 2019-06-23  Simon Fraser  <simon.fraser@apple.com>
3153
3154         [Async overflow scroll] Clipped composited layers inside overflow scroll jitter and get incorrectly clipped
3155         https://bugs.webkit.org/show_bug.cgi?id=199133
3156         rdar://problem/43614439
3157
3158         Reviewed by Antti Koivisto.
3159
3160         Currently a composited layer with an overflow:scroll ancestor (which is not a paint-order
3161         ancestor) gets a single "ancestor clip layer" that represents the intersection of all the
3162         clips provided by its containing-block ancestors with non-visible overflow (both scrolling
3163         and non-scrolling ones).
3164
3165         To correctly update clips with async overflow scroll, this single clip layer needs to be
3166         broken up into multiple clipping ancestors. We need a separate layer, and scrolling tree
3167         node for each ancestor that is an overflow scroll, and layers that represent non-moving
3168         clips (i.e. overflow:hidden and 'clip') between them. This patch adds
3169         LayerAncestorClippingStack to represent this stack of clipping layers. For example with the
3170         following content:
3171         
3172         <div style="overflow:hidden"> <--- A
3173             <div style="overflow:scroll"> <--- B
3174                 <div style="overflow:hidden"> <--- C
3175                     <div style="overflow:hidden"> <--- D
3176                         <div style="overflow:scroll">  <--- E
3177                             <div style="overflow:hidden"> <--- F
3178                                 <div style="overflow:hidden"> <--- G
3179                                     <div></div> <--- H
3180                                 <div>
3181                             <div>
3182                         <div>
3183                     <div>
3184                 <div>
3185             <div>
3186         <div>
3187         
3188         the composited RenderLayer for H owns a LayerAncestorClippingStack with the following contents:
3189             [clip - A]
3190             [scroller - B]
3191             [clip - intersection of C and D]
3192             [scroller - E]
3193             [clip - intersection of F and G]
3194
3195         Each stack entry has a 'masksToBounds' GraphicsLayer for clipping. Entries representing
3196         overflow:scroll clips have a ScrollingNodeID for their OverflowScrollProxy scrolling tree
3197         node (which references the actual OverflowScrollingNode). The non-scroller clips in this
3198         stack are computed unconstrained by the enclosing overflow:scroll.
3199
3200         When the OverflowScrollingNode is scrolled, the boundsOrigin of related OverflowScrollProxy nodes
3201         is adjusted to move the descendant layers (other clipping layers, or composited layers).
3202
3203         OverflowScrollProxy nodes thus take over the role that "Moves" ScrollingTreePositionedNode had.
3204         With this patch, ScrollingTreePositionedNode are purely for absolute position inside non-containing-block
3205         stacking context overflow scroll. LayoutConstraints is renamed to AbsolutePositionConstraints accordingly.
3206
3207         Tests: compositing/scrolling/async-overflow-scrolling/clipped-layer-in-overflow-clipped-by-scroll.html
3208                compositing/scrolling/async-overflow-scrolling/clipped-layer-in-overflow-nested.html
3209                compositing/scrolling/async-overflow-scrolling/clipped-layer-in-overflow.html
3210                compositing/scrolling/async-overflow-scrolling/layer-in-overflow-clip-to-hidden.html
3211                compositing/scrolling/async-overflow-scrolling/layer-in-overflow-clip-to-visible.html
3212                compositing/scrolling/async-overflow-scrolling/layer-in-overflow-gain-clipping-layer.html
3213                compositing/scrolling/async-overflow-scrolling/layer-in-overflow-in-clipped.html
3214                compositing/scrolling/async-overflow-scrolling/layer-in-overflow-lose-clipping-layer.html
3215                compositing/scrolling/async-overflow-scrolling/layer-in-overflow.html
3216                scrollingcoordinator/scrolling-tree/clipped-layer-in-overflow-nested.html
3217                scrollingcoordinator/scrolling-tree/clipped-layer-in-overflow.html
3218
3219         * Sources.txt:
3220         * WebCore.xcodeproj/project.pbxproj:
3221         * page/scrolling/AsyncScrollingCoordinator.cpp:
3222         (WebCore::AsyncScrollingCoordinator::setPositionedNodeConstraints):
3223         (WebCore::AsyncScrollingCoordinator::setPositionedNodeGeometry): Deleted.
3224         * page/scrolling/AsyncScrollingCoordinator.h:
3225         * page/scrolling/ScrollingConstraints.cpp:
3226         (WebCore::operator<<):
3227         * page/scrolling/ScrollingConstraints.h:
3228         (WebCore::AbsolutePositionConstraints::operator== const):
3229         (WebCore::AbsolutePositionConstraints::operator!= const):
3230         (WebCore::LayoutConstraints::operator== const): Deleted.
3231         (WebCore::LayoutConstraints::operator!= const): Deleted.
3232         (WebCore::LayoutConstraints::alignmentOffset const): Deleted.
3233         (WebCore::LayoutConstraints::setAlignmentOffset): Deleted.
3234         (WebCore::LayoutConstraints::layerPositionAtLastLayout const): Deleted.
3235         (WebCore::LayoutConstraints::setLayerPositionAtLastLayout): Deleted.
3236         (WebCore::LayoutConstraints::scrollPositioningBehavior const): Deleted.
3237         (WebCore::LayoutConstraints::setScrollPositioningBehavior): Deleted.
3238         * page/scrolling/ScrollingCoordinator.h:
3239         (WebCore::ScrollingCoordinator::setPositionedNodeConstraints):
3240         (WebCore::ScrollingCoordinator::setPositionedNodeGeometry): Deleted.
3241         * page/scrolling/ScrollingStatePositionedNode.cpp:
3242         (WebCore::ScrollingStatePositionedNode::updateConstraints):
3243         * page/scrolling/ScrollingStatePositionedNode.h:
3244         * page/scrolling/ScrollingTree.cpp:
3245         (WebCore::ScrollingTree::commitTreeState):
3246         * page/scrolling/ScrollingTree.h:
3247         (WebCore::ScrollingTree::nodesWithRelatedOverflow):
3248         (WebCore::ScrollingTree::positionedNodesWithRelatedOverflow): Deleted.
3249         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
3250         (WebCore::ScrollingTreeFixedNode::applyLayerPositions):
3251         * page/scrolling/cocoa/ScrollingTreeOverflowScrollProxyNode.mm:
3252         (WebCore::ScrollingTreeOverflowScrollProxyNode::commitStateBeforeChildren):
3253         * page/scrolling/cocoa/ScrollingTreePositionedNode.h:
3254         (WebCore::ScrollingTreePositionedNode::scrollPositioningBehavior const): Deleted.
3255         * page/scrolling/cocoa/ScrollingTreePositionedNode.mm:
3256         (WebCore::ScrollingTreePositionedNode::commitStateBeforeChildren):
3257         (WebCore::ScrollingTreePositionedNode::scrollDeltaSinceLastCommit const):
3258         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
3259         (WebCore::ScrollingTreeStickyNode::computeLayerPosition const):
3260         * rendering/LayerAncestorClippingStack.cpp: Added.
3261         (WebCore::LayerAncestorClippingStack::LayerAncestorClippingStack):
3262         (WebCore::LayerAncestorClippingStack::equalToClipData const):
3263         (WebCore::LayerAncestorClippingStack::hasAnyScrollingLayers const):
3264         (WebCore::LayerAncestorClippingStack::clear):
3265         (WebCore::LayerAncestorClippingStack::detachFromScrollingCoordinator):
3266         (WebCore::LayerAncestorClippingStack::firstClippingLayer const):
3267         (WebCore::LayerAncestorClippingStack::lastClippingLayer const):
3268         (WebCore::LayerAncestorClippingStack::lastOverflowScrollProxyNodeID const):
3269         (WebCore::LayerAncestorClippingStack::updateScrollingNodeLayers):
3270         (WebCore::LayerAncestorClippingStack::updateWithClipData):
3271         (WebCore::operator<<):
3272         * rendering/LayerAncestorClippingStack.h: Added.
3273         (WebCore::CompositedClipData::CompositedClipData):
3274         (WebCore::CompositedClipData::operator== const):
3275         (WebCore::CompositedClipData::operator!= const):
3276         (WebCore::LayerAncestorClippingStack::stack):
3277         (WebCore::LayerAncestorClippingStack::stack const):
3278         * rendering/RenderLayerBacking.cpp:
3279         (WebCore::RenderLayerBacking::~RenderLayerBacking):
3280         (WebCore::RenderLayerBacking::updateDebugIndicators):
3281         (WebCore::RenderLayerBacking::destroyGraphicsLayers):
3282         (WebCore::RenderLayerBacking::updateTransform):
3283         (WebCore::RenderLayerBacking::updateBlendMode):
3284         (WebCore::RenderLayerBacking::updateAfterLayout):
3285         (WebCore::RenderLayerBacking::updateConfiguration):
3286         (WebCore::computeOffsetFromAncestorGraphicsLayer):
3287         (WebCore::RenderLayerBacking::computePrimaryGraphicsLayerRect const):
3288         (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect const):
3289         (WebCore::RenderLayerBacking::updateGeometry):
3290         (WebCore::RenderLayerBacking::updateInternalHierarchy):
3291         (WebCore::RenderLayerBacking::updateAncestorClippingStack):
3292         (WebCore::RenderLayerBacking::updateAncestorClipping):
3293         (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
3294         (WebCore::RenderLayerBacking::scrollingNodeIDForChildren const):
3295         (WebCore::RenderLayerBacking::childForSuperlayers const):
3296         (WebCore::RenderLayerBacking::backingStoreMemoryEstimate const):
3297         (WebCore::operator<<):
3298         (WebCore::RenderLayerBacking::updateAncestorClippingLayer): Deleted.
3299         (WebCore::RenderLayerBacking::coordinatedScrollingRoles const): Deleted.
3300         * rendering/RenderLayerBacking.h:
3301         * rendering/RenderLayerCompositor.cpp:
3302         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
3303         (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
3304         (WebCore::RenderLayerCompositor::layerStyleChanged): We need to run the checks for changed
3305         clipping whether or not this layer has backing, because a non-composited layer with clipping can be
3306         represented in the clipping stack of some other layer.
3307         (WebCore::RenderLayerCompositor::clippedByAncestor const):
3308         (WebCore::RenderLayerCompositor::updateAncestorClippingStack const):
3309         (WebCore::RenderLayerCompositor::computeAncestorClippingStack const): The output of this function
3310         is a Vector<CompositedClipData> which represents the ancestor clipping stack, but without the proxy node
3311         and GraphicsLayer information. It's input to LayerAncestorClippingStack::updateWithClipData() which does
3312         the merging of old and new states.
3313         (WebCore::collectRelatedCoordinatedScrollingNodes):
3314         (WebCore::RenderLayerCompositor::removeFromScrollCoordinatedLayers):
3315         (WebCore::scrollCoordinationRoleForNodeType):
3316         (WebCore::RenderLayerCompositor::attachScrollingNode):
3317         (WebCore::RenderLayerCompositor::registerScrollingNodeID):
3318         (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayerWithRole):
3319         (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer):
3320         (WebCore::RenderLayerCompositor::coordinatedScrollingRolesForLayer const): Code moved from RenderLayerBacking.
3321         (WebCore::RenderLayerCompositor::updateScrollCoordinationForLayer):
3322         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingProxyRole):
3323         (WebCore::RenderLayerCompositor::updateScrollingNodeForPositioningRole):
3324         * rendering/RenderLayerCompositor.h:
3325         (WebCore::allScrollCoordinationRoles):
3326
3327 2019-06-23  Simon Fraser  <simon.fraser@apple.com>
3328
3329         Add OverflowScrollProxyNodes to the scrolling tree
3330         https://bugs.webkit.org/show_bug.cgi?id=199132
3331
3332         Reviewed by Antti Koivisto.
3333
3334         Add ScrollingStateOverflowScrollProxyNode and ScrollingTreeOverflowScrollProxyNode. These
3335         nodes represent clip and scroll position for an overflow:scroll in the containing block chain,