Unreviewed. Suppress -Wunused-variable warnings for the unused static
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-05-30  Zan Dobersek  <zdobersek@igalia.com>
2
3         Unreviewed. Suppress -Wunused-variable warnings for the unused static
4         mousePointerID variable by making it a constexpr.
5
6         * platform/PointerID.h:
7
8 2019-05-30  Simon Fraser  <simon.fraser@apple.com>
9
10         Use an OptionSet<> for GraphicsLayerPaintingPhase
11         https://bugs.webkit.org/show_bug.cgi?id=198404
12
13         Reviewed by Tim Horton.
14
15         Replace GraphicsLayerPaintingPhase with OptionSet<GraphicsLayerPaintingPhase>.
16
17         No behavior change.
18
19         * page/PageOverlayController.cpp:
20         (WebCore::PageOverlayController::setPageOverlayNeedsDisplay):
21         (WebCore::PageOverlayController::paintContents):
22         (WebCore::PageOverlayController::notifyFlushRequired):
23         * page/PageOverlayController.h:
24         * page/linux/ResourceUsageOverlayLinux.cpp:
25         * page/mac/ServicesOverlayController.h:
26         * page/mac/ServicesOverlayController.mm:
27         (WebCore::ServicesOverlayController::Highlight::paintContents):
28         * platform/graphics/GraphicsLayer.cpp:
29         (WebCore::GraphicsLayer::dumpProperties const):
30         * platform/graphics/GraphicsLayer.h:
31         (WebCore::GraphicsLayer::paintingPhase const):
32         (WebCore::GraphicsLayer::setPaintingPhase):
33         * platform/graphics/GraphicsLayerClient.h:
34         (WebCore::GraphicsLayerClient::paintContents):
35         * rendering/RenderLayerBacking.cpp:
36         (WebCore::RenderLayerBacking::updateForegroundLayer):
37         (WebCore::RenderLayerBacking::updateBackgroundLayer):
38         (WebCore::RenderLayerBacking::updateMaskingLayer):
39         (WebCore::RenderLayerBacking::updateChildClippingStrategy):
40         (WebCore::RenderLayerBacking::updateScrollingLayers):
41         (WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer const):
42         (WebCore::RenderLayerBacking::paintIntoLayer):
43         (WebCore::RenderLayerBacking::paintContents):
44         * rendering/RenderLayerBacking.h:
45         * rendering/RenderLayerCompositor.cpp:
46         (WebCore::RenderLayerCompositor::paintContents):
47         * rendering/RenderLayerCompositor.h:
48
49 2019-05-30  Youenn Fablet  <youenn@apple.com>
50
51         Fix AVVideoCaptureSource::setFrameRateWithPreset logging
52         https://bugs.webkit.org/show_bug.cgi?id=198392
53
54         Reviewed by Eric Carlson.
55
56         Move logging from setFrameRateWithPreset to setSessionSizeAndFrameRate which does the actual job.
57         This ensures to not log in case of preset being null.
58         No change of behavior.
59
60         * platform/mediastream/mac/AVVideoCaptureSource.mm:
61         (WebCore::AVVideoCaptureSource::setFrameRateWithPreset):
62         (WebCore::AVVideoCaptureSource::setSessionSizeAndFrameRate):
63
64 2019-05-30  Jer Noble  <jer.noble@apple.com>
65
66         Video playback in Safari should continue when CarPlay is plugged in
67         https://bugs.webkit.org/show_bug.cgi?id=198345
68         <rdar://problem/45505750>
69
70         Reviewed by Eric Carlson.
71
72         Test: media/video-isplayingtoautomotiveheadunit.html
73
74         * html/HTMLMediaElement.cpp:
75         (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
76         * platform/audio/PlatformMediaSessionManager.cpp:
77         (WebCore::PlatformMediaSessionManager::setIsPlayingToAutomotiveHeadUnit):
78         * platform/audio/PlatformMediaSessionManager.h:
79         (WebCore::PlatformMediaSessionManager::isPlayingToAutomotiveHeadUnit const):
80         * platform/audio/ios/MediaSessionManagerIOS.h:
81         * platform/audio/ios/MediaSessionManagerIOS.mm:
82         (WebCore::MediaSessionManageriOS::MediaSessionManageriOS):
83         (WebCore::MediaSessionManageriOS::carPlayServerDied):
84         (WebCore::MediaSessionManageriOS::updateCarPlayIsConnected):
85         (-[WebMediaSessionHelper initWithCallback:]):
86         (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
87         (-[WebMediaSessionHelper interruption:]):
88         (-[WebMediaSessionHelper applicationWillEnterForeground:]):
89         (-[WebMediaSessionHelper applicationDidBecomeActive:]):
90         (-[WebMediaSessionHelper applicationWillResignActive:]):
91         (-[WebMediaSessionHelper wirelessRoutesAvailableDidChange:]):
92         (-[WebMediaSessionHelper applicationDidEnterBackground:]):
93         (-[WebMediaSessionHelper carPlayServerDied:]):
94         (-[WebMediaSessionHelper carPlayIsConnectedDidChange:]):
95         * testing/Internals.cpp:
96         (WebCore::Internals::resetToConsistentState):
97         (WebCore::Internals::setIsPlayingToAutomotiveHeadUnit):
98         * testing/Internals.h:
99         * testing/Internals.idl:
100
101 2019-05-30  Youenn Fablet  <youenn@apple.com>
102
103         Add an option to mute audio capture automatically when page is not visible
104         https://bugs.webkit.org/show_bug.cgi?id=198307
105
106         Reviewed by Eric Carlson.
107
108         Reuse video capture mechanism for audio capture.
109         In case document gets in the background, interrupt the audio track if the audio factory requires it.
110         CoreAudioCaptureSourceIOS requires the audio source be interrupted if the app has not the right background mode.
111         It also allows interrupting the audio capture based on a runtime flag.
112
113         Add a runtime flag to control this.
114         Internals API is used to set it for test purposes, off by default.
115         For regular cases, the runtime flag is set through web preferences.
116
117         Test: platform/ios/mediastream/audio-muted-in-background-tab.html
118
119         * dom/Document.cpp:
120         (WebCore::Document::notifyMediaCaptureOfVisibilityChanged):
121         * page/RuntimeEnabledFeatures.h:
122         (WebCore::RuntimeEnabledFeatures::interruptAudioOnPageVisibilityChangeEnabled const):
123         (WebCore::RuntimeEnabledFeatures::setInterruptAudioOnPageVisibilityChangeEnabled):
124         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
125         (WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter):
126         (WebCore::RealtimeMediaSourceCenter::initializeShouldInterruptAudioOnPageVisibilityChange):
127         (WebCore::RealtimeMediaSourceCenter::setCapturePageState):
128         (WebCore::RealtimeMediaSourceCenter::visibilityDidChange):
129         * platform/mediastream/RealtimeMediaSourceCenter.h:
130         (WebCore::RealtimeMediaSourceCenter::shouldInterruptAudioOnPageVisibilityChange):
131         * platform/mediastream/RealtimeMediaSourceFactory.h:
132         (WebCore::AudioCaptureFactory::setAudioCapturePageState):
133         (WebCore::VideoCaptureFactory::setVideoCapturePageState):
134         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.h:
135         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:
136         (WebCore::CoreAudioCaptureSourceFactory::setAudioCapturePageState):
137         (WebCore::CoreAudioCaptureSourceFactoryIOS::shouldInterruptAudioOnPageVisibilityChange):
138         * platform/mediastream/mac/CoreAudioCaptureSource.h:
139         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
140         (WebCore::RealtimeMediaSourceCenter::initializeShouldInterruptAudioOnPageVisibilityChange):
141         * testing/Internals.cpp:
142         (WebCore::Internals::resetToConsistentState):
143         (WebCore::Internals::setShouldInterruptAudioOnPageVisibilityChange):
144         * testing/Internals.h:
145         * testing/Internals.idl:
146
147 2019-05-30  Saam Barati  <sbarati@apple.com>
148
149         [WHLSL] Enforce variable lifetimes
150         https://bugs.webkit.org/show_bug.cgi?id=195794
151         <rdar://problem/50746293>
152
153         Reviewed by Myles C. Maxfield.
154
155         In WHLSL, each variable has global lifetime. So returning a pointer to a
156         local variable is a legitimate and well specified thing to do. Each local
157         variable has a unique place in memory. So, for example:
158         
159         ```
160         thread int* ptr() { int local; return &local; }
161         thread int* ptrPtr() { return ptr(); }
162         ```
163         
164         In the above program, ptr() must always return the same value
165         as ptrPtr(). So, the following would print "42":
166         ```
167         thread int* p = ptrPtr();
168         *ptr() = 42;
169         print(*p);
170         ```
171         
172         To implement these semantics, this patch introduces a new pass which does the
173         following transformations:
174         - It notes every variable whose address is taken in the program.
175         - Each such variable gets defined as a field in a struct.
176         - Each function which is an entry point defines this struct.
177         - Each non entry point takes a pointer to this struct as its final parameter.
178         - Each call to a non-native function is rewritten to pass a pointer to the
179           struct as the last call argument.
180         - Each variable reference to "x", where "x" ends up in the struct, is
181           modified to instead be "struct->x". We store to "struct->x" after declaring
182           "x". If "x" is a function parameter, we store to "struct->x" as the first
183           thing we do in the function body.
184
185         Tests: webgpu/whlsl-ensure-proper-variable-lifetime-2.html
186                webgpu/whlsl-ensure-proper-variable-lifetime-3.html
187                webgpu/whlsl-ensure-proper-variable-lifetime.html
188                webgpu/whlsl-return-local-variable.html
189
190         * Modules/webgpu/WHLSL/AST/WHLSLAST.h:
191         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
192         (WebCore::WHLSL::AST::Expression::Expression):
193         (WebCore::WHLSL::AST::Expression::isGlobalVariableReference const):
194         (WebCore::WHLSL::AST::Expression::origin const): Deleted.
195         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
196         (WebCore::WHLSL::AST::FunctionDeclaration::origin):
197         * Modules/webgpu/WHLSL/AST/WHLSLGlobalVariableReference.h: Added.
198         (WebCore::WHLSL::AST::GlobalVariableReference::GlobalVariableReference):
199         (WebCore::WHLSL::AST::GlobalVariableReference::structField):
200         (WebCore::WHLSL::AST::GlobalVariableReference::base):
201         * Modules/webgpu/WHLSL/AST/WHLSLStatement.h:
202         (WebCore::WHLSL::AST::Statement::Statement):
203         (WebCore::WHLSL::AST::Statement::isStatementList const):
204         (WebCore::WHLSL::AST::Statement::isWhileLoop const):
205         * Modules/webgpu/WHLSL/AST/WHLSLStatementList.h: Added.
206         (WebCore::WHLSL::AST::StatementList::StatementList):
207         (WebCore::WHLSL::AST::StatementList::statements):
208         * Modules/webgpu/WHLSL/AST/WHLSLValue.h:
209         (WebCore::WHLSL::AST::Value::Value):
210         (WebCore::WHLSL::AST::Value::origin const):
211         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
212         (WebCore::WHLSL::AST::VariableDeclaration::VariableDeclaration):
213         (WebCore::WHLSL::AST::VariableDeclaration::takeInitializer):
214         (WebCore::WHLSL::AST::VariableDeclaration::origin const): Deleted.
215         * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h:
216         (WebCore::WHLSL::AST::VariableReference::wrap):
217         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
218         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
219         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
220         (WebCore::WHLSL::ASTDumper::visit):
221         * Modules/webgpu/WHLSL/WHLSLASTDumper.h:
222         (WebCore::WHLSL::dumpASTNode):
223         (WebCore::WHLSL::dumpAST):
224         (WebCore::WHLSL::toString): Deleted.
225         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
226         (WebCore::WHLSL::prepareShared):
227         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp: Added.
228         (WebCore::WHLSL::EscapedVariableCollector::takeEscapedVariables):
229         (WebCore::WHLSL::anonymousToken):
230         (WebCore::WHLSL::PreserveLifetimes::PreserveLifetimes):
231         (WebCore::WHLSL::PreserveLifetimes::makeStructVariableReference):
232         (WebCore::WHLSL::preserveVariableLifetimes):
233         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.h: Added.
234         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
235         (WebCore::WHLSL::Visitor::visit):
236         * Modules/webgpu/WHLSL/WHLSLVisitor.h:
237         * Sources.txt:
238         * WebCore.xcodeproj/project.pbxproj:
239
240 2019-05-30  Ryan Haddad  <ryanhaddad@apple.com>
241
242         Unreviewed, rolling out r245890, 245887.
243
244         Breaks internal builds.
245
246         Reverted changeset:
247         "Video playback in Safari should continue when CarPlay is plugged in"
248         https://bugs.webkit.org/show_bug.cgi?id=198345
249         https://trac.webkit.org/changeset/245887/webkit
250
251 2019-05-30  Dean Jackson  <dino@apple.com>
252
253         Media documents on iPad are too wide in split screen
254         https://bugs.webkit.org/show_bug.cgi?id=198405
255         <rdar://problem/50974548>
256
257         Reviewed by Tim Horton.
258
259         Media documents on iPad had a minimum width of 700px. This
260         was fine in full-screen, but didn't work when then window
261         was smaller, such as split screen or a link preview.
262
263         Tests: media/modern-media-controls/media-documents/media-document-video-ipad-sizing.html
264                media/modern-media-controls/media-documents/media-document-video-iphone-sizing.html
265
266         * Modules/modern-media-controls/controls/media-document.css: Add a media query to
267         detect small windows.
268         * Modules/modern-media-controls/media/media-document-controller.js:
269
270 2019-05-30  Andres Gonzalez  <andresg_22@apple.com>
271
272         Inserting a newline in contenteditable causes two characters to be added instead of one
273         https://bugs.webkit.org/show_bug.cgi?id=197894
274         <rdar://problem/49700998>
275
276         Reviewed by Wenson Hsieh and Chris Fleizach.
277
278         There were two issues with inserting a newline character at the end of 
279         a line that caused problems for accessibility:
280         - the first '\n' inserted after text would result in two line breaks 
281         inserted instead of one. createFragmentFromText in markup.cpp was 
282         splitting the string "\n" into two empty strings and creating a <div> 
283         and a <br> respectively. Then the emission code would emit a '\n' for 
284         the empty div and another for the <br>.
285         - the second problem is a consequence of <rdar://problem/5192593> and 
286         the workaround is the change in editing.cpp in the function
287         visiblePositionForIndexUsingCharacterIterator, similar to what is done
288         in VisibleUnits.cpp for nextBoundary.
289         The rest of the changes in this patch are accessibility changes to 
290         execute the layout tests.
291
292         Tests: accessibility/ios-simulator/set-selected-text-range-after-newline.html
293                accessibility/set-selected-text-range-after-newline.html
294
295         * accessibility/AccessibilityRenderObject.cpp:
296         (WebCore::AccessibilityRenderObject::setSelectedTextRange):
297         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
298         (-[WebAccessibilityObjectWrapper stringForRange:]):
299         (-[WebAccessibilityObjectWrapper _accessibilitySelectedTextRange]):
300         (-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]):
301         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
302         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
303         * editing/Editing.cpp:
304         (WebCore::visiblePositionForIndexUsingCharacterIterator):
305         * editing/markup.cpp:
306         (WebCore::createFragmentFromText):
307
308 2019-05-30  Justin Fan  <justin_fan@apple.com>
309
310         [Web GPU] Vertex Buffers/Input State API updates
311         https://bugs.webkit.org/show_bug.cgi?id=194258
312         <rdar://problem/47806127>
313
314         Reviewed by Myles C. Maxfield.
315
316         The vertex buffer attributes model for GPURenderPipelines in the WebGPU API has been updated.
317         Update our implementation to match.
318
319         No new tests. Existing tests updated to match new behavior.
320
321         * CMakeLists.txt:
322         * DerivedSources-input.xcfilelist:
323         * DerivedSources-output.xcfilelist:
324         * DerivedSources.make:
325         * Modules/webgpu/GPUVertexAttributeDescriptor.idl:
326         * Modules/webgpu/GPUVertexBufferDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/GPUInputStateDescriptor.idl.
327         * Modules/webgpu/GPUVertexInputDescriptor.idl:
328         * Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
329         * Sources.txt:
330         * WebCore.xcodeproj/project.pbxproj:
331         * platform/graphics/gpu/GPURenderPipelineDescriptor.h:
332         * platform/graphics/gpu/GPUVertexAttributeDescriptor.h:
333         * platform/graphics/gpu/GPUVertexBufferDescriptor.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUInputStateDescriptor.h.
334         * platform/graphics/gpu/GPUVertexInputDescriptor.h:
335         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
336         (WebCore::trySetVertexInput): Added. Populate Metal and WHLSL pipeline descriptors with vertex attribute metadata.
337         (WebCore::trySetColorStates): Added. Populate Metal and WHLSL pipeline descriptors with color attachment metadata.
338         (WebCore::convertLayout): Moved.
339         (WebCore::trySetMetalFunctions): Moved.
340         (WebCore::trySetFunctions): Added. WHLSL compilation to Metal SL happens here, then MSL functions are set on pipeline descriptor.
341         (WebCore::convertRenderPipelineDescriptor): Repurposed. Convert a GPURenderPipelineDescriptor to Metal and WHLSL versions.
342         (WebCore::tryCreateMtlRenderPipelineState):
343         (WebCore::GPURenderPipeline::tryCreate):
344         (WebCore::trySetMetalFunctionsForPipelineDescriptor): Deleted.
345         (WebCore::trySetWHLSLFunctionsForPipelineDescriptor): Deleted.
346         (WebCore::trySetFunctionsForPipelineDescriptor): Deleted.
347         (WebCore::trySetInputStateForPipelineDescriptor): Deleted.
348         (WebCore::setColorStatesForColorAttachmentArray): Deleted.
349
350 2019-05-30  Zalan Bujtas  <zalan@apple.com>
351
352         [iOS] Do not linkify telephone numbers inside <a> elements.
353         https://bugs.webkit.org/show_bug.cgi?id=198378
354
355         Reviewed by Chris Dumez.
356
357         Phone number linkifying mutates the DOM in a potentially unexpected way triggering different kinds of failures with JS, CSS selectors etc.
358         This patch tightens the linkifying rule so that content inside an <a> element won't get linkified even when the <a> has no valid href attribute.
359
360         Test: fast/dom/linkify-phone-numbers.html
361
362         * html/parser/HTMLTreeBuilder.cpp:
363         (WebCore::disallowTelephoneNumberParsing):
364
365 2019-05-30  Truitt Savell  <tsavell@apple.com>
366
367         Unreviewed, rolling out r245883.
368
369         Caused 6 webgpu/ layout test failures.
370
371         Reverted changeset:
372
373         "[WHLSL] Parsing and lexing the standard library is slow"
374         https://bugs.webkit.org/show_bug.cgi?id=192890
375         https://trac.webkit.org/changeset/245883
376
377 2019-05-30  Simon Fraser  <simon.fraser@apple.com>
378
379         Move some HistoricalVelocityData code into the cpp file
380         https://bugs.webkit.org/show_bug.cgi?id=198353
381
382         Reviewed by Tim Horton.
383         
384         Now that we have VelocityData.cpp put the non-trivial HistoricalVelocityData::velocityForNewData()
385         into it. append() can become a lambda function.
386
387         * platform/graphics/VelocityData.cpp:
388         (WebCore::HistoricalVelocityData::velocityForNewData):
389         * platform/graphics/VelocityData.h:
390         (WebCore::HistoricalVelocityData::velocityForNewData): Deleted.
391         (WebCore::HistoricalVelocityData::append): Deleted.
392
393 2019-05-30  Truitt Savell  <tsavell@apple.com>
394
395         Fix the iOS build after r245887
396         https://bugs.webkit.org/show_bug.cgi?id=198345
397
398         Unreviewed build fix.
399
400         * platform/audio/ios/MediaSessionManagerIOS.mm:
401         (WebCore::MediaSessionManageriOS::updateCarPlayIsConnected):
402
403 2019-05-30  Jer Noble  <jer.noble@apple.com>
404
405         ASSERTION FAILED: m_scriptExecutionContext under WebCore::AudioContext::isPlayingAudioDidChange()
406         https://bugs.webkit.org/show_bug.cgi?id=181597
407         <rdar://problem/36474088>
408
409         Reviewed by Eric Carlson.
410
411         Because document() is usually null-checked before using (and we can add null-checks where missing),
412         there's no good reason to debug-assert that m_scriptExecutionContext is non-null before downcast<>ing
413         to Document*.
414
415         * Modules/webaudio/AudioContext.cpp:
416         (WebCore::AudioContext::constructCommon):
417         (WebCore::AudioContext::stop):
418         (WebCore::AudioContext::document const):
419         (WebCore::AudioContext::visibilityStateChanged):
420         (WebCore::AudioContext::willBeginPlayback):
421         (WebCore::AudioContext::willPausePlayback):
422         (WebCore::AudioContext::pageMutedStateDidChange):
423
424 2019-05-30  Jer Noble  <jer.noble@apple.com>
425
426         Video playback in Safari should continue when CarPlay is plugged in
427         https://bugs.webkit.org/show_bug.cgi?id=198345
428         <rdar://problem/45505750>
429
430         Reviewed by Eric Carlson.
431
432         Test: media/video-isplayingtoautomotiveheadunit.html
433
434         * html/HTMLMediaElement.cpp:
435         (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
436         * platform/audio/PlatformMediaSessionManager.cpp:
437         (WebCore::PlatformMediaSessionManager::setIsPlayingToAutomotiveHeadUnit):
438         * platform/audio/PlatformMediaSessionManager.h:
439         (WebCore::PlatformMediaSessionManager::isPlayingToAutomotiveHeadUnit const):
440         * platform/audio/ios/MediaSessionManagerIOS.h:
441         * platform/audio/ios/MediaSessionManagerIOS.mm:
442         (WebCore::MediaSessionManageriOS::MediaSessionManageriOS):
443         (WebCore::MediaSessionManageriOS::carPlayServerDied):
444         (WebCore::MediaSessionManageriOS::updateCarPlayIsConnected):
445         (-[WebMediaSessionHelper initWithCallback:]):
446         (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
447         (-[WebMediaSessionHelper interruption:]):
448         (-[WebMediaSessionHelper applicationWillEnterForeground:]):
449         (-[WebMediaSessionHelper applicationDidBecomeActive:]):
450         (-[WebMediaSessionHelper applicationWillResignActive:]):
451         (-[WebMediaSessionHelper wirelessRoutesAvailableDidChange:]):
452         (-[WebMediaSessionHelper applicationDidEnterBackground:]):
453         (-[WebMediaSessionHelper carPlayServerDied:]):
454         (-[WebMediaSessionHelper carPlayIsConnectedDidChange:]):
455         * testing/Internals.cpp:
456         (WebCore::Internals::resetToConsistentState):
457         (WebCore::Internals::setIsPlayingToAutomotiveHeadUnit):
458         * testing/Internals.h:
459         * testing/Internals.idl:
460
461 2019-05-29  Robin Morisset  <rmorisset@apple.com>
462
463         [WHLSL] Parsing and lexing the standard library is slow
464         https://bugs.webkit.org/show_bug.cgi?id=192890
465         <rdar://problem/50746335>
466
467         Reviewed by Myles Maxfield.
468
469         The main idea is to avoid backtracking by instead peeking at the next token (and occasionally at the one after that).
470         This implies a few things:
471         - We can replace the stack of tokens by a trivial ring buffer of size 2 (holding the next token and the one after, or WTF::nullopt if we are at the end of the file).
472         - We now have "completeFooExpression" functions, to avoid having to reparse the prefix of some expression, if we find half-way through what it is.
473
474         I also fixed the following parser bug:
475         - https://bugs.webkit.org/show_bug.cgi?id=198305 [WHLSL] Multiple variables with initializers in a declaration statement crashes the compiler
476             which was due to a mistake I made in the grammar
477
478         Finally I added two new macros: CONSUME_TYPE and PARSE to eliminate about 500 lines of error propagation boilerplate.
479
480         There are still lots of ways of improving the parser and lexer, such as:
481         - finishing the conversion of tokens in the lexer, not bothering with allocating string views
482         - make two special tokens Invalid and EOF, to remove the overhead of Optional
483         - make peekTypes and consumeTypes use templates to avoid constructing a Vector and calling find on it.
484         - Turn the entire lexer into a proper automata, not going through the same characters again and again (this is certainly the largest win by far)
485         - Remove the last few pieces of backtracking from the parser.
486
487         The current patch is already enough to make parsing the full standard library (something like 85k lines) approximately 260ms.
488         This is still longer than I would like, but nowhere near the bottleneck any longer because of some other parts of the compiler.
489
490         * Modules/webgpu/WHLSL/WHLSLLexer.h:
491         (WebCore::WHLSL::Lexer::Lexer):
492         (WebCore::WHLSL::Lexer::consumeToken):
493         (WebCore::WHLSL::Lexer::peek):
494         (WebCore::WHLSL::Lexer::peekFurther):
495         (WebCore::WHLSL::Lexer::state const):
496         (WebCore::WHLSL::Lexer::setState):
497         (WebCore::WHLSL::Lexer::unconsumeToken): Deleted.
498         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
499         (WebCore::WHLSL::Parser::parse):
500         (WebCore::WHLSL::Parser::peek):
501         (WebCore::WHLSL::Parser::peekTypes):
502         (WebCore::WHLSL::Parser::tryType):
503         (WebCore::WHLSL::Parser::tryTypes):
504         (WebCore::WHLSL::Parser::consumeTypes):
505         (WebCore::WHLSL::Parser::parseConstantExpression):
506         (WebCore::WHLSL::Parser::parseTypeArgument):
507         (WebCore::WHLSL::Parser::parseTypeArguments):
508         (WebCore::WHLSL::Parser::parseTypeSuffixAbbreviated):
509         (WebCore::WHLSL::Parser::parseTypeSuffixNonAbbreviated):
510         (WebCore::WHLSL::Parser::parseType):
511         (WebCore::WHLSL::Parser::parseTypeDefinition):
512         (WebCore::WHLSL::Parser::parseResourceSemantic):
513         (WebCore::WHLSL::Parser::parseSpecializationConstantSemantic):
514         (WebCore::WHLSL::Parser::parseStageInOutSemantic):
515         (WebCore::WHLSL::Parser::parseSemantic):
516         (WebCore::WHLSL::Parser::parseQualifiers):
517         (WebCore::WHLSL::Parser::parseStructureElement):
518         (WebCore::WHLSL::Parser::parseStructureDefinition):
519         (WebCore::WHLSL::Parser::parseEnumerationDefinition):
520         (WebCore::WHLSL::Parser::parseEnumerationMember):
521         (WebCore::WHLSL::Parser::parseNativeTypeDeclaration):
522         (WebCore::WHLSL::Parser::parseNumThreadsFunctionAttribute):
523         (WebCore::WHLSL::Parser::parseAttributeBlock):
524         (WebCore::WHLSL::Parser::parseParameter):
525         (WebCore::WHLSL::Parser::parseParameters):
526         (WebCore::WHLSL::Parser::parseFunctionDefinition):
527         (WebCore::WHLSL::Parser::parseComputeFunctionDeclaration):
528         (WebCore::WHLSL::Parser::parseVertexFragmentFunctionDeclaration):
529         (WebCore::WHLSL::Parser::parseRegularFunctionDeclaration):
530         (WebCore::WHLSL::Parser::parseOperatorFunctionDeclaration):
531         (WebCore::WHLSL::Parser::parseFunctionDeclaration):
532         (WebCore::WHLSL::Parser::parseNativeFunctionDeclaration):
533         (WebCore::WHLSL::Parser::parseBlock):
534         (WebCore::WHLSL::Parser::parseBlockBody):
535         (WebCore::WHLSL::Parser::parseIfStatement):
536         (WebCore::WHLSL::Parser::parseSwitchStatement):
537         (WebCore::WHLSL::Parser::parseSwitchCase):
538         (WebCore::WHLSL::Parser::parseForLoop):
539         (WebCore::WHLSL::Parser::parseWhileLoop):
540         (WebCore::WHLSL::Parser::parseDoWhileLoop):
541         (WebCore::WHLSL::Parser::parseVariableDeclaration):
542         (WebCore::WHLSL::Parser::parseVariableDeclarations):
543         (WebCore::WHLSL::Parser::parseStatement):
544         (WebCore::WHLSL::Parser::parseEffectfulExpression):
545         (WebCore::WHLSL::Parser::parseEffectfulAssignment):
546         (WebCore::WHLSL::Parser::parseExpression):
547         (WebCore::WHLSL::Parser::parseTernaryConditional):
548         (WebCore::WHLSL::Parser::completeTernaryConditional):
549         (WebCore::WHLSL::Parser::parseAssignment):
550         (WebCore::WHLSL::Parser::completeAssignment):
551         (WebCore::WHLSL::Parser::parsePossibleTernaryConditional):
552         (WebCore::WHLSL::Parser::parsePossibleLogicalBinaryOperation):
553         (WebCore::WHLSL::Parser::completePossibleLogicalBinaryOperation):
554         (WebCore::WHLSL::Parser::parsePossibleRelationalBinaryOperation):
555         (WebCore::WHLSL::Parser::completePossibleRelationalBinaryOperation):
556         (WebCore::WHLSL::Parser::parsePossibleShift):
557         (WebCore::WHLSL::Parser::completePossibleShift):
558         (WebCore::WHLSL::Parser::parsePossibleAdd):
559         (WebCore::WHLSL::Parser::completePossibleAdd):
560         (WebCore::WHLSL::Parser::parsePossibleMultiply):
561         (WebCore::WHLSL::Parser::completePossibleMultiply):
562         (WebCore::WHLSL::Parser::parsePossiblePrefix):
563         (WebCore::WHLSL::Parser::parsePossibleSuffix):
564         (WebCore::WHLSL::Parser::parseCallExpression):
565         (WebCore::WHLSL::Parser::parseTerm):
566         (WebCore::WHLSL::Parser::parseAddressSpaceType): Deleted.
567         (WebCore::WHLSL::Parser::parseNonAddressSpaceType): Deleted.
568         (WebCore::WHLSL::Parser::parseEntryPointFunctionDeclaration): Deleted.
569         (WebCore::WHLSL::Parser::parseEffectfulPrefix): Deleted.
570         (WebCore::WHLSL::Parser::parseEffectfulSuffix): Deleted.
571         * Modules/webgpu/WHLSL/WHLSLParser.h:
572         (WebCore::WHLSL::Parser::Error::dump const):
573
574 2019-05-29  Jiewen Tan  <jiewen_tan@apple.com>
575
576         Unreviewed, update WebAuthN to "Supported In Preview"
577
578         * features.json:
579
580 2019-05-29  Don Olmstead  <don.olmstead@sony.com>
581
582         Remove ENABLE definitions from WebKit config files
583         https://bugs.webkit.org/show_bug.cgi?id=197858
584
585         Reviewed by Simon Fraser.
586
587         Sync FeatureDefines.xcconfig.
588
589         * Configurations/FeatureDefines.xcconfig:
590
591 2019-05-29  Youenn Fablet  <youenn@apple.com>
592
593         Reestablish WebSWClientConnection in case of network process crash
594         https://bugs.webkit.org/show_bug.cgi?id=198333
595
596         Reviewed by Alex Christensen.
597
598         Refactor DocumentLoader to no longer take a ref to the SWClientConnection.
599         Instead, store the sessionID and get the SWClientConnection from it.
600         Remove unused code from ServiceWorkerContainer.
601
602         Test: http/wpt/service-workers/service-worker-networkprocess-crash.html
603
604         * loader/DocumentLoader.cpp:
605         (WebCore::DocumentLoader::registerTemporaryServiceWorkerClient):
606         (WebCore::DocumentLoader::unregisterTemporaryServiceWorkerClient):
607         * loader/DocumentLoader.h:
608         * workers/service/ServiceWorkerContainer.cpp:
609         * workers/service/ServiceWorkerContainer.h:
610         * workers/service/ServiceWorkerJobClient.h:
611
612 2019-05-29  David Kilzer  <ddkilzer@apple.com>
613
614         IndexedDatabase Server thread in com.apple.WebKit.Networking process leaks objects into an autoreleasePool that's never cleared
615         <https://webkit.org/b/198346>
616         <rdar://problem/50895658>
617
618         Reviewed by Brent Fulgham.
619
620         * Modules/indexeddb/server/IDBServer.cpp:
621         (WebCore::IDBServer::IDBServer::IDBServer):
622         - Pass AutodrainedPoolForRunLoop::Use when creating
623           CrossThreadTaskHandler to fix the bug.
624
625 2019-05-29  Geoffrey Garen  <ggaren@apple.com>
626
627         WeakPtr breaks vtables when upcasting to base classes
628         https://bugs.webkit.org/show_bug.cgi?id=188799
629
630         Reviewed by Youenn Fablet.
631
632         * Modules/encryptedmedia/MediaKeySession.cpp:
633         (WebCore::MediaKeySession::MediaKeySession):
634         * Modules/encryptedmedia/MediaKeySession.h: Adopted modern WeakPtr APIs.
635         Removed redundant WeakPtrFactory.
636
637         * css/CSSFontFace.cpp:
638         (WebCore::CSSFontFace::existingWrapper):
639         * css/CSSFontFace.h: Moved functions out of line to avoid #include
640         explosion for .get().
641
642         * dom/ContainerNode.h:
643         * dom/Document.h:
644         * dom/Element.h: Moved CanMakeWeakPtr to ContainerNode because all
645         subclasses except for DocumentFragment were already so, and we have
646         code that uses WeakPtr<ContainerNode>, which, now that WeakPtr is
647         type-safe, is awkward to do when ContainerNode isn't CanMakeWeakPtr.
648
649         * dom/FullscreenManager.cpp:
650         (WebCore::FullscreenManager::fullscreenRenderer const):
651         * dom/FullscreenManager.h:
652         (WebCore::FullscreenManager::fullscreenRenderer const): Deleted.
653         * html/FormAssociatedElement.cpp:
654         (WebCore::FormAssociatedElement::form const):
655         * html/FormAssociatedElement.h:
656         (WebCore::FormAssociatedElement::form const): Deleted. Moved functions
657         out of line to avoid #include explosion for .get().
658
659         * html/HTMLMediaElement.h: It takes an extra using declaration
660         to disambiguate multiple CanMakeWeakPtr base classes now.
661
662         * loader/MediaResourceLoader.cpp:
663         (WebCore::MediaResourceLoader::requestResource): Removed redundant .get().
664
665         * page/DOMWindowProperty.cpp:
666         (WebCore::DOMWindowProperty::window const):
667         * page/DOMWindowProperty.h:
668         (WebCore::DOMWindowProperty::window const): Deleted.
669         * page/FrameViewLayoutContext.cpp:
670         (WebCore::FrameViewLayoutContext::subtreeLayoutRoot const):
671         * page/FrameViewLayoutContext.h:
672         (WebCore::FrameViewLayoutContext::subtreeLayoutRoot const): Deleted.
673         * page/UndoItem.cpp:
674         (WebCore::UndoItem::undoManager const):
675         * page/UndoItem.h:
676         (WebCore::UndoItem::undoManager const): Deleted. Moved functions out of
677         line to avoid #include explosion for .get().
678
679         * platform/ScrollView.h: It takes an extra using declaration
680         to disambiguate multiple CanMakeWeakPtr base classes now.
681
682         * platform/Widget.cpp:
683         (WebCore::Widget::parent const):
684         * platform/Widget.h:
685         (WebCore::Widget::parent const): Deleted. Moved functions out of line to avoid #include
686         explosion for .get().
687
688         * platform/encryptedmedia/CDMInstanceSession.h: Made
689         CDMInstanceSessionClient CanMakeWeakPtr because we use WeakPtr<CDMInstanceSessionClient>.
690
691         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
692         CanMakeWeakPtr is inherited now.
693
694         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
695         (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
696         (WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC):
697         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
698         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmSession const): Deleted.
699         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::createWeakPtr): Deleted.
700         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
701         (WebCore::CMTimebaseEffectiveRateChangedCallback):
702         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
703         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::play):
704         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pause):
705         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekWithTolerance):
706         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged):
707         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmSession const):
708         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
709         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
710         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
711         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
712         (WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
713         (WebCore::SourceBufferPrivateAVFObjC::flushVideo):
714         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
715         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):
716         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer):
717         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): Modernized WeakPtr API usage.
718
719         * rendering/RenderBlockFlow.cpp:
720         (WebCore::RenderBlockFlow::multiColumnFlowSlowCase const):
721         * rendering/RenderBlockFlow.h:
722         (WebCore::RenderBlockFlow::multiColumnFlow const):
723         * rendering/RenderMultiColumnFlow.cpp:
724         (WebCore::RenderMultiColumnFlow::findColumnSpannerPlaceholder const):
725         * rendering/RenderMultiColumnFlow.h:
726         * rendering/RenderTable.cpp:
727         (WebCore::RenderTable::header const):
728         (WebCore::RenderTable::footer const):
729         (WebCore::RenderTable::firstBody const):
730         (WebCore::RenderTable::topSection const):
731         * rendering/RenderTable.h:
732         (WebCore::RenderTable::header const): Deleted.
733         (WebCore::RenderTable::footer const): Deleted.
734         (WebCore::RenderTable::firstBody const): Deleted.
735         (WebCore::RenderTable::topSection const): Deleted. Moved functions out
736         of line to avoid #include explosion for .get().
737
738 2019-05-29  Antoine Quint  <graouts@apple.com>
739
740         [Pointer Events] toElement and fromElement should be null
741         https://bugs.webkit.org/show_bug.cgi?id=198338
742
743         Reviewed by Dean Jackson.
744
745         * dom/MouseEvent.h:
746         * dom/PointerEvent.h:
747
748 2019-05-29  Ryan Haddad  <ryanhaddad@apple.com>
749
750         Unreviewed, rolling out r245857.
751
752         Breaks internal builds.
753
754         Reverted changeset:
755
756         "WeakPtr breaks vtables when upcasting to base classes"
757         https://bugs.webkit.org/show_bug.cgi?id=188799
758         https://trac.webkit.org/changeset/245857
759
760 2019-05-29  Keith Rollin  <krollin@apple.com>
761
762         Fix builds that don't use makeWindowFromView
763         https://bugs.webkit.org/show_bug.cgi?id=198342
764         <rdar://problem/51228563>
765
766         Reviewed by Wenson Hsieh.
767
768         In some configurations, VideoFullscreenInterfaceAVKit.mm declares but
769         does not use makeWindowFromView. Fix by conditionalizing the the
770         declaration on the same symbol as point where it's used.
771
772         No new tests -- no new functionality.
773
774         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
775
776 2019-05-28  Geoffrey Garen  <ggaren@apple.com>
777
778         WeakPtr breaks vtables when upcasting to base classes
779         https://bugs.webkit.org/show_bug.cgi?id=188799
780
781         Reviewed by Youenn Fablet.
782
783         * Modules/encryptedmedia/MediaKeySession.cpp:
784         (WebCore::MediaKeySession::MediaKeySession):
785         * Modules/encryptedmedia/MediaKeySession.h: Adopted modern WeakPtr APIs.
786         Removed redundant WeakPtrFactory.
787
788         * css/CSSFontFace.cpp:
789         (WebCore::CSSFontFace::existingWrapper):
790         * css/CSSFontFace.h: Moved functions out of line to avoid #include
791         explosion for .get().
792
793         * dom/ContainerNode.h:
794         * dom/Document.h:
795         * dom/Element.h: Moved CanMakeWeakPtr to ContainerNode because all
796         subclasses except for DocumentFragment were already so, and we have
797         code that uses WeakPtr<ContainerNode>, which, now that WeakPtr is
798         type-safe, is awkward to do when ContainerNode isn't CanMakeWeakPtr.
799
800         * dom/FullscreenManager.cpp:
801         (WebCore::FullscreenManager::fullscreenRenderer const):
802         * dom/FullscreenManager.h:
803         (WebCore::FullscreenManager::fullscreenRenderer const): Deleted.
804         * html/FormAssociatedElement.cpp:
805         (WebCore::FormAssociatedElement::form const):
806         * html/FormAssociatedElement.h:
807         (WebCore::FormAssociatedElement::form const): Deleted. Moved functions
808         out of line to avoid #include explosion for .get().
809
810         * html/HTMLMediaElement.h: It takes an extra using declaration
811         to disambiguate multiple CanMakeWeakPtr base classes now.
812
813         * loader/MediaResourceLoader.cpp:
814         (WebCore::MediaResourceLoader::requestResource): Removed redundant .get().
815
816         * page/DOMWindowProperty.cpp:
817         (WebCore::DOMWindowProperty::window const):
818         * page/DOMWindowProperty.h:
819         (WebCore::DOMWindowProperty::window const): Deleted.
820         * page/FrameViewLayoutContext.cpp:
821         (WebCore::FrameViewLayoutContext::subtreeLayoutRoot const):
822         * page/FrameViewLayoutContext.h:
823         (WebCore::FrameViewLayoutContext::subtreeLayoutRoot const): Deleted.
824         * page/UndoItem.cpp:
825         (WebCore::UndoItem::undoManager const):
826         * page/UndoItem.h:
827         (WebCore::UndoItem::undoManager const): Deleted. Moved functions out of
828         line to avoid #include explosion for .get().
829
830         * platform/ScrollView.h: It takes an extra using declaration
831         to disambiguate multiple CanMakeWeakPtr base classes now.
832
833         * platform/Widget.cpp:
834         (WebCore::Widget::parent const):
835         * platform/Widget.h:
836         (WebCore::Widget::parent const): Deleted. Moved functions out of line to avoid #include
837         explosion for .get().
838
839         * platform/encryptedmedia/CDMInstanceSession.h: Made
840         CDMInstanceSessionClient CanMakeWeakPtr because we use WeakPtr<CDMInstanceSessionClient>.
841
842         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
843         CanMakeWeakPtr is inherited now.
844
845         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
846         (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
847         (WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC):
848         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
849         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmSession const): Deleted.
850         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::createWeakPtr): Deleted.
851         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
852         (WebCore::CMTimebaseEffectiveRateChangedCallback):
853         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
854         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::play):
855         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pause):
856         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekWithTolerance):
857         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged):
858         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmSession const):
859         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
860         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
861         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
862         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
863         (WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
864         (WebCore::SourceBufferPrivateAVFObjC::flushVideo):
865         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
866         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):
867         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer):
868         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): Modernized WeakPtr API usage.
869
870         * rendering/RenderBlockFlow.cpp:
871         (WebCore::RenderBlockFlow::multiColumnFlowSlowCase const):
872         * rendering/RenderBlockFlow.h:
873         (WebCore::RenderBlockFlow::multiColumnFlow const):
874         * rendering/RenderMultiColumnFlow.cpp:
875         (WebCore::RenderMultiColumnFlow::findColumnSpannerPlaceholder const):
876         * rendering/RenderMultiColumnFlow.h:
877         * rendering/RenderTable.cpp:
878         (WebCore::RenderTable::header const):
879         (WebCore::RenderTable::footer const):
880         (WebCore::RenderTable::firstBody const):
881         (WebCore::RenderTable::topSection const):
882         * rendering/RenderTable.h:
883         (WebCore::RenderTable::header const): Deleted.
884         (WebCore::RenderTable::footer const): Deleted.
885         (WebCore::RenderTable::firstBody const): Deleted.
886         (WebCore::RenderTable::topSection const): Deleted. Moved functions out
887         of line to avoid #include explosion for .get().
888
889 2019-05-29  Antti Koivisto  <antti@apple.com>
890
891         Scrolling node ordering wrong when a layer has both positioning and fixed/sticky node
892         https://bugs.webkit.org/show_bug.cgi?id=198329
893
894         Reviewed by Darin Adler.
895
896         Test: scrollingcoordinator/scrolling-tree/sticky-in-overflow.html
897
898         With sticky positioning in non-stacking context overflow you currently get structure like
899
900         FrameScrollingNode
901           OverflowScrollingNode
902           StickyNode
903             PositionedNode
904
905         where StickyNode and PositionedNode reference the same layer. Sticky doesn't get applied at all when the overflow moves.
906
907         This patch reverses the order of sticky and positioned. It doesn't fix sticky positioning during scrolling yet,
908         but it does make it less jumpy. It is a prerequisite for the full fix.
909
910         * rendering/RenderLayerCompositor.cpp:
911         (WebCore::RenderLayerCompositor::updateScrollCoordinationForLayer):
912
913 2019-05-29  Ludovico de Nittis  <ludovico.denittis@collabora.com>
914
915         Prepend KEY_ to the last key alias in PlatformEventKeyboardGtk
916         https://bugs.webkit.org/show_bug.cgi?id=198331
917
918         Reviewed by Michael Catanzaro.
919
920         No behavior change.
921
922         With the commit
923         https://bugs.webkit.org/show_bug.cgi?id=198326
924         A gdk key slipped away from the renaming.
925
926         * platform/gtk/PlatformKeyboardEventGtk.cpp:
927         (WebCore::modifiersForGdkKeyEvent):
928
929 2019-05-29  Zalan Bujtas  <zalan@apple.com>
930
931         [LFC][IFC] Move Line class to a dedicated file
932         https://bugs.webkit.org/show_bug.cgi?id=198332
933         <rdar://problem/51221403>
934
935         Reviewed by Antti Koivisto.
936
937         An upcoming refactoring requires the Line class to be in a .h.
938
939         * Sources.txt:
940         * WebCore.xcodeproj/project.pbxproj:
941         * layout/displaytree/DisplayRun.h:
942         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
943         (WebCore::Layout::InlineFormattingContext::LineLayout::initializeLine const):
944         (WebCore::Layout::InlineFormattingContext::LineLayout::computedIntrinsicWidth const):
945         (WebCore::Layout::halfLeadingMetrics): Deleted.
946         (WebCore::Layout::Line::availableWidth const): Deleted.
947         (WebCore::Layout::Line::contentLogicalRight const): Deleted.
948         (WebCore::Layout::Line::contentLogicalWidth const): Deleted.
949         (WebCore::Layout::Line::logicalTop const): Deleted.
950         (WebCore::Layout::Line::logicalLeft const): Deleted.
951         (WebCore::Layout::Line::logicalRight const): Deleted.
952         (WebCore::Layout::Line::logicalBottom const): Deleted.
953         (WebCore::Layout::Line::logicalWidth const): Deleted.
954         (WebCore::Layout::Line::logicalHeight const): Deleted.
955         (WebCore::Layout::Line::LineItem::LineItem): Deleted.
956         (WebCore::Layout::Line::Line): Deleted.
957         (WebCore::Layout::Line::reset): Deleted.
958         (WebCore::Layout::Line::close): Deleted.
959         (WebCore::Layout::Line::removeTrailingTrimmableContent): Deleted.
960         (WebCore::Layout::Line::moveLogicalLeft): Deleted.
961         (WebCore::Layout::Line::moveLogicalRight): Deleted.
962         (WebCore::Layout::isTrimmableContent): Deleted.
963         (WebCore::Layout::Line::trailingTrimmableWidth const): Deleted.
964         (WebCore::Layout::Line::hasContent const): Deleted.
965         (WebCore::Layout::Line::appendNonBreakableSpace): Deleted.
966         (WebCore::Layout::Line::appendInlineContainerStart): Deleted.
967         (WebCore::Layout::Line::appendInlineContainerEnd): Deleted.
968         (WebCore::Layout::Line::appendTextContent): Deleted.
969         (WebCore::Layout::Line::appendNonReplacedInlineBox): Deleted.
970         (WebCore::Layout::Line::appendReplacedInlineBox): Deleted.
971         (WebCore::Layout::Line::appendHardLineBreak): Deleted.
972         * layout/inlineformatting/InlineTextItem.h:
973         * layout/inlineformatting/text/TextUtil.cpp:
974         (WebCore::Layout::TextUtil::isTrimmableContent):
975         * layout/inlineformatting/text/TextUtil.h:
976
977 2019-05-29  Ludovico de Nittis  <ludovico.denittis@collabora.com>
978
979         PlatformEventKeyboardGtk still uses old key aliases
980         https://bugs.webkit.org/show_bug.cgi?id=198326
981
982         Reviewed by Carlos Garcia Campos.
983
984         No behavior change.
985
986         Use the new key names convention prepending "KEY_".
987
988         * platform/gtk/PlatformKeyboardEventGtk.cpp:
989         (WebCore::PlatformKeyboardEvent::keyIdentifierForGdkKeyCode):
990         (WebCore::PlatformKeyboardEvent::windowsKeyCodeForGdkKeyCode):
991         (WebCore::PlatformKeyboardEvent::singleCharacterString):
992         (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
993
994 2019-05-28  Yacine Bandou  <yacine.bandou@softathome.com>
995
996         [MSE][GStreamer] update the readyState correctly in MediaPlayerPrivateGStreamerMSE
997         https://bugs.webkit.org/show_bug.cgi?id=197834
998
999         Reviewed by Xabier Rodriguez-Calvar.
1000
1001         The buffering state and the m_downloadFinished boolean aren't supported in the MSE case.
1002         When the readyState is already "HaveEnoughData", we don't want to revert it to "HaveFutureData",
1003         or else the MediaPlayer would send a "canplay" event instead of a "canplaythrough".
1004
1005         Test: media/media-source/media-source-canplaythrough-event.html
1006
1007         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1008         (WebCore::MediaPlayerPrivateGStreamerMSE::updateStates):
1009
1010 2019-05-28  Fujii Hironori  <Hironori.Fujii@sony.com>
1011
1012         [WinCairo] ASSERTION FAILED: !m_preparingToPlay in MediaPlayerPrivateMediaFoundation::prepareToPlay
1013         https://bugs.webkit.org/show_bug.cgi?id=190747
1014
1015         Reviewed by Alex Christensen.
1016
1017         HTMLMediaElement::prepareToPlay had a assertion ensuring that it
1018         was not called twice. However, it was called twice. The first from
1019         HTMLMediaElement::load, the second from
1020         MediaPlayerPrivateMediaFoundation::onTopologySet.
1021
1022         prepareToPlay started loading. And, loading should be started
1023         after onTopologySet is called back.
1024
1025         Covered by existing tests.
1026
1027         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1028         (WebCore::MediaPlayerPrivateMediaFoundation::onTopologySet): Moved code from prepareToPlay.
1029         (WebCore::MediaPlayerPrivateMediaFoundation::prepareToPlay): Deleted and moved the code to onTopologySet.
1030         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h: Removed prepareToPlay declaration.
1031
1032 2019-05-28  Fujii Hironori  <Hironori.Fujii@sony.com>
1033
1034         [WinCairo][MediaFoundation] Assertion failure in MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample
1035         https://bugs.webkit.org/show_bug.cgi?id=198290
1036
1037         Reviewed by Per Arne Vollan.
1038
1039         Covered by existing tests.
1040
1041         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1042         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample):
1043         Call clear() of m_memSurface before assigning new value.
1044
1045 2019-05-28  Saam Barati  <sbarati@apple.com>
1046
1047         [WHLSL] Type of dereference is the type of the thing we point to, not a pointer to that type
1048         https://bugs.webkit.org/show_bug.cgi?id=198321
1049
1050         Reviewed by Myles C. Maxfield.
1051
1052         Consider this program:
1053         ```
1054         thread int* x;
1055         *x = 42
1056         ```
1057         
1058         In the Checker, we were saying the type of "*x" was "int*" instead of "int".
1059
1060         Test: webgpu/whlsl-dereference-pointer-should-type-check.html
1061
1062         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
1063         (WebCore::WHLSL::Checker::visit):
1064
1065 2019-05-28  Wenson Hsieh  <wenson_hsieh@apple.com>
1066
1067         [iOS] Respect NSItemProvider's registered types when dropping files that are loaded in-place
1068         https://bugs.webkit.org/show_bug.cgi?id=198315
1069         <rdar://problem/51183762>
1070
1071         Reviewed by Tim Horton.
1072
1073         Currently, logic in PasteboardIOS.mm and WebContentReaderCocoa.mm attempts to deduce the content type from the
1074         file path when dropping attachments on iOS. Instead, we should be plumbing the content type through to the
1075         reader.
1076
1077         Test: WKAttachmentTestsIOS.InsertDroppedImageWithNonImageFileExtension
1078
1079         * editing/WebContentReader.h:
1080         * editing/cocoa/WebContentReaderCocoa.mm:
1081         (WebCore::typeForAttachmentElement):
1082
1083         Add a helper method to determine which type to use in attachment elements. This makes the paste
1084         (attachmentForData) and drop (attachmentForFilePaths) behave the same way, with respect to the type attribute
1085         used to represent the attachment.
1086
1087         (WebCore::attachmentForFilePath):
1088
1089         Use the content type, if specified; otherwise, fall back to deducing it from the file path.
1090
1091         (WebCore::attachmentForData):
1092         (WebCore::WebContentReader::readFilePath):
1093         * platform/Pasteboard.h:
1094         (WebCore::PasteboardWebContentReader::readFilePath):
1095
1096         Pass the highest fidelity representation's content type to the web content reader.
1097
1098         * platform/ios/PasteboardIOS.mm:
1099         (WebCore::Pasteboard::readRespectingUTIFidelities):
1100
1101 2019-05-28  Myles C. Maxfield  <mmaxfield@apple.com>
1102
1103         Move idempotent text autosizing to StyleTreeResolver
1104         https://bugs.webkit.org/show_bug.cgi?id=197808
1105         <rdar://problem/50283983>
1106
1107         Reviewed by Antti Koivisto.
1108
1109         This patch migrates the idempotent text autosizing code to live inside style resolution. This is almost
1110         the same as the algorithm that uses the result of layout to calculate autosizing, but this version only
1111         operates on style (and thus doesn't require double layouts). Because it is being run in an environment
1112         with less information, autosizing is occurring in more places, so the curves have been adjusted to make
1113         autosizing not boost as much as the previous implementation did. The new algorithm is modelled after
1114         text-decorations-in-effect. I've claimed 4 of the unused bits in RenderStyle to contain the state of the
1115         autosizing algorithm. StyleResolver::adjustRenderStyle() is where the algorithm is implemented:
1116         - Look at the inherited bits
1117         - Interogate the element's RenderStyle
1118         - Compute new bits for the element, and set them in its RenderStyle
1119         - Based on the newly computed bits, determine whether we should increase the text size
1120         - If so, determine how much using the specified font size, and apply the result to the computed font size
1121
1122         This works because StyleBuilderCustom::applyInheritFontSize() inherits from the specified font size, not
1123         the computed font size.
1124
1125         This patch also will disable autosizing using the other methods (so there aren't two methods of autosizing
1126         fighting each other) and will honor text-size-adjust:none. However, it won't honor text-size-adjust:100%.
1127         If content says text-size-adjust:100%, we will disregard it and take this code path.
1128
1129         Tests: fast/text-autosizing/ios/idempotentmode/css-exposure.html
1130                fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip.html
1131                fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-identity.html
1132                fast/text-autosizing/ios/idempotentmode/idempotent-autosizing.html
1133
1134         * Sources.txt:
1135         * WebCore.xcodeproj/project.pbxproj:
1136         * css/CSSComputedStyleDeclaration.cpp:
1137         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
1138         * css/CSSProperties.json:
1139         * css/StyleBuilderCustom.h:
1140         (WebCore::computeBaseSpecifiedFontSize):
1141         (WebCore::computeLineHeightMultiplierDueToFontSize):
1142         * css/StyleResolver.cpp:
1143         (WebCore::idempotentTextSize):
1144         (WebCore::hasTextChildren):
1145         (WebCore::StyleResolver::adjustRenderStyle):
1146         (WebCore::StyleResolver::checkForTextSizeAdjust):
1147         * page/FrameViewLayoutContext.cpp:
1148         (WebCore::FrameViewLayoutContext::applyTextSizingIfNeeded):
1149         * rendering/RenderBlockFlow.cpp:
1150         (WebCore::RenderBlockFlow::adjustComputedFontSizes):
1151         (WebCore::idempotentTextSize): Deleted.
1152         * rendering/RenderBlockFlow.h:
1153         * rendering/RenderElement.cpp:
1154         (WebCore::includeNonFixedHeight):
1155         (WebCore::RenderElement::adjustComputedFontSizesOnBlocks):
1156         (WebCore::RenderElement::resetTextAutosizing):
1157         * rendering/style/RenderStyle.cpp:
1158         (WebCore::RenderStyle::RenderStyle):
1159         (WebCore::RenderStyle::autosizeStatus const):
1160         (WebCore::RenderStyle::setAutosizeStatus):
1161         * rendering/style/RenderStyle.h:
1162         * rendering/style/TextSizeAdjustment.cpp: Added.
1163         (WebCore::AutosizeStatus::AutosizeStatus):
1164         (WebCore::AutosizeStatus::contains const):
1165         (WebCore::AutosizeStatus::modifiedStatus const):
1166         (WebCore::AutosizeStatus::shouldSkipSubtree const):
1167         * rendering/style/TextSizeAdjustment.h:
1168
1169 2019-05-28  Simon Fraser  <simon.fraser@apple.com>
1170
1171         Use scroll-velocity-based tile coverage for overflow:scroll
1172         https://bugs.webkit.org/show_bug.cgi?id=198294
1173         rdar://problem/48942184
1174
1175         Reviewed by Tim Horton.
1176
1177         Start using a velocity-based tile coverage computation on layers with Type::ScrolledContents,
1178         which is the content layers for overflow:scroll when they get big enough to get tiled.
1179
1180         Move legacy macOS coverage code into adjustTileCoverageForDesktopPageScrolling() because
1181         I don't want to change its behavior in this patch. Use TileController::adjustTileCoverageRectForScrolling()
1182         for iOS and macOS overflow scrolling. Since only iOS page scrolling gets velocity data from the UI
1183         process, compute velocity in TileController using the visible rect top-left.
1184         
1185         For overflow scroll, we have to plumb horizontal and vertical coverage in from
1186         RenderLayerBacking.
1187
1188         Tests: tiled-drawing/scrolling/overflow/overflow-scrolled-down-tile-coverage.html
1189                tiled-drawing/scrolling/overflow/overflow-scrolled-up-tile-coverage.html
1190                tiled-drawing/scrolling/overflow/overflow-tile-coverage.html
1191
1192         * platform/graphics/TiledBacking.h:
1193         * platform/graphics/ca/GraphicsLayerCA.cpp:
1194         (WebCore::GraphicsLayerCA::adjustCoverageRect const):
1195         * platform/graphics/ca/PlatformCALayer.h:
1196         * platform/graphics/ca/TileController.cpp:
1197         (WebCore::TileController::setVelocity):
1198         (WebCore::TileController::adjustTileCoverageRect):
1199         (WebCore::TileController::adjustTileCoverageForDesktopPageScrolling const):
1200         (WebCore::TileController::adjustTileCoverageWithScrollingVelocity const):
1201         (WebCore::TileController::adjustTileCoverageRectForScrolling):
1202         (WebCore::expandRectWithinRect): Deleted.
1203         (WebCore::TileController::adjustTileCoverageRect const): Deleted.
1204         (WebCore::TileController::adjustTileCoverageRectForScrolling const): Deleted.
1205         * platform/graphics/ca/TileController.h:
1206         * rendering/RenderLayer.h:
1207         * rendering/RenderLayerBacking.cpp:
1208         (WebCore::computePageTiledBackingCoverage):
1209         (WebCore::computeOverflowTiledBackingCoverage):
1210         (WebCore::RenderLayerBacking::adjustTiledBackingCoverage):
1211         (WebCore::RenderLayerBacking::updateGeometry):
1212
1213 2019-05-28  Shawn Roberts  <sroberts@apple.com>
1214
1215         Unreviewed, rolling out r245475.
1216
1217         Newly imported test is flaky. Features need flags.
1218
1219         Reverted changeset:
1220
1221         "Implement imagesrcset and imagesizes attributes on link
1222         rel=preload"
1223         https://bugs.webkit.org/show_bug.cgi?id=192950
1224         https://trac.webkit.org/changeset/245475
1225
1226 2019-05-28  Brent Fulgham  <bfulgham@apple.com>
1227
1228         Protect frames during style and layout changes
1229         https://bugs.webkit.org/show_bug.cgi?id=198047
1230         <rdar://problem/50954082>
1231
1232         Reviewed by Zalan Bujtas.
1233
1234         Be more careful about the scope and lifetime of objects that participate in layout or
1235         style updates. If a method decides a layout or style update is needed, it needs to
1236         confirm that the elements it was operating on are still valid and needed in the
1237         current operation.
1238
1239         * accessibility/AXObjectCache.cpp:
1240         (WebCore::AXObjectCache::getOrCreate):
1241         * accessibility/AccessibilityRenderObject.cpp:
1242         (WebCore::AccessibilityRenderObject::accessibilityHitTest const):
1243         * css/CSSComputedStyleDeclaration.cpp:
1244         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
1245         * css/CSSComputedStyleDeclaration.h:
1246         * css/SVGCSSComputedStyleDeclaration.cpp:
1247         (WebCore::ComputedStyleExtractor::svgPropertyValue):
1248         * dom/Document.cpp:
1249         (WebCore::Document::setFocusedElement):
1250         * editing/TypingCommand.cpp:
1251         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
1252         (WebCore::TypingCommand::insertLineBreak):
1253         (WebCore::TypingCommand::insertParagraphSeparator):
1254         (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent):
1255         * editing/ios/EditorIOS.mm:
1256         (WebCore::Editor::setDictationPhrasesAsChildOfElement):
1257         * html/HTMLLabelElement.cpp:
1258         (WebCore::HTMLLabelElement::focus):
1259         * html/HTMLTextAreaElement.cpp:
1260         (WebCore::HTMLTextAreaElement::appendFormData):
1261         * html/ImageDocument.cpp:
1262         (WebCore::ImageDocument::imageClicked):
1263         * html/ValidationMessage.cpp:
1264         (WebCore::ValidationMessage::buildBubbleTree):
1265         * page/FrameView.cpp:
1266         (WebCore::FrameView::autoSizeIfEnabled):
1267         (WebCore::FrameView::trackedRepaintRectsAsText const):
1268         * page/PrintContext.cpp:
1269         (WebCore::PrintContext::pageProperty):
1270         (WebCore::PrintContext::numberOfPages):
1271         (WebCore::PrintContext::spoolAllPagesWithBoundaries):
1272
1273 2019-05-28  Antti Koivisto  <antti@apple.com>
1274
1275         [async scrolling] Fixed positioning inside stacking context overflow scroll is jumpy
1276         https://bugs.webkit.org/show_bug.cgi?id=198292
1277
1278         Reviewed by Darin Adler.
1279
1280         Tests: scrollingcoordinator/ios/fixed-in-stacking-context-overflow-scroll-2.html
1281                scrollingcoordinator/ios/fixed-in-stacking-context-overflow-scroll.html
1282
1283         We were computing delta from the layout scroll position in ScrollingTree::notifyRelatedNodesAfterScrollPositionChange
1284         based on the passed in node only. If any other node had deltas they were not taken into account at all. This would occur
1285         frequently since the function is always invoked for the root node after layer tree commit.
1286
1287         Fix by moving the delta computation (and fetching layoutViewport) to ScrollingTreeFixedNode.
1288
1289         * page/scrolling/ScrollingTree.cpp:
1290         (WebCore::ScrollingTree::applyLayerPositions):
1291
1292         No need to pass offset and layoutViewport around anymore.
1293
1294         (WebCore::ScrollingTree::applyLayerPositionsRecursive):
1295         (WebCore::ScrollingTree::notifyRelatedNodesAfterScrollPositionChange):
1296
1297         Remove the offset and layoutViewport computations.
1298
1299         (WebCore::ScrollingTree::notifyRelatedNodesRecursive):
1300         * page/scrolling/ScrollingTree.h:
1301         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
1302         (WebCore::ScrollingTreeFrameHostingNode::applyLayerPositions):
1303         * page/scrolling/ScrollingTreeFrameHostingNode.h:
1304         * page/scrolling/ScrollingTreeNode.cpp:
1305         (WebCore::ScrollingTreeNode::relatedNodeScrollPositionDidChange):
1306         * page/scrolling/ScrollingTreeNode.h:
1307         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1308         (WebCore::ScrollingTreeScrollingNode::applyLayerPositions):
1309         * page/scrolling/ScrollingTreeScrollingNode.h:
1310         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
1311         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
1312         (WebCore::ScrollingTreeFixedNode::applyLayerPositions):
1313
1314         Compute them here instead, always taking all overflow scrollers up to the closest frame into account.
1315
1316         * page/scrolling/cocoa/ScrollingTreePositionedNode.h:
1317         * page/scrolling/cocoa/ScrollingTreePositionedNode.mm:
1318         (WebCore::ScrollingTreePositionedNode::applyLayerPositions):
1319         (WebCore::ScrollingTreePositionedNode::relatedNodeScrollPositionDidChange):
1320         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
1321         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
1322         (WebCore::ScrollingTreeStickyNode::applyLayerPositions):
1323
1324 2019-05-28  Zalan Bujtas  <zalan@apple.com>
1325
1326         [LFC][Verification] Add additional inline and block checks
1327         https://bugs.webkit.org/show_bug.cgi?id=198252
1328         <rdar://problem/51140687>
1329
1330         Reviewed by Antti Koivisto.
1331
1332         Now we also test the geometry of the blocks with inline formatting contexts.
1333
1334         * layout/Verification.cpp:
1335         (WebCore::Layout::checkForMatchingTextRuns):
1336         (WebCore::Layout::verifyAndOutputSubtree):
1337
1338 2019-05-28  Zalan Bujtas  <zalan@apple.com>
1339
1340         [LFC][IFC] Decouple line layout and processing inline runs.
1341         https://bugs.webkit.org/show_bug.cgi?id=198282
1342         <rdar://problem/51167954>
1343
1344         Reviewed by Antti Koivisto.
1345
1346         This is in preparation for using "createInlineRunsForLine" logic when computing preferred width.
1347
1348         * layout/inlineformatting/InlineFormattingContext.h:
1349         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
1350         (WebCore::Layout::UncommittedContent::size const):
1351         (WebCore::Layout::InlineFormattingContext::LineLayout::createInlineRunsForLine const):
1352         (WebCore::Layout::InlineFormattingContext::LineLayout::layout const):
1353         (WebCore::Layout::InlineFormattingContext::LineLayout::processInlineRuns const):
1354         (WebCore::Layout::InlineFormattingContext::LineLayout::closeLine const): Deleted.
1355         * layout/inlineformatting/InlineFormattingState.h:
1356         (WebCore::Layout::InlineFormattingState::addInlineItem):
1357         * layout/inlineformatting/InlineTextItem.cpp:
1358         (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
1359
1360 2019-05-28  Zalan Bujtas  <zalan@apple.com>
1361
1362         [LFC][IFC] Move intrinsic width computation from InlineFormattingContext to LineLayout
1363         https://bugs.webkit.org/show_bug.cgi?id=198258
1364
1365         Reviewed by Antti Koivisto.
1366
1367         This is in preparation for sharing even more code between line layout and preferred width computation. 
1368
1369         * layout/inlineformatting/InlineFormattingContext.cpp:
1370         (WebCore::Layout::InlineFormattingContext::layout const):
1371         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
1372         * layout/inlineformatting/InlineFormattingContext.h:
1373         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
1374         (WebCore::Layout::InlineFormattingContext::LineLayout::initializeLine const):
1375         (WebCore::Layout::InlineFormattingContext::LineLayout::layout const):
1376         (WebCore::Layout::InlineFormattingContext::LineLayout::computedIntrinsicWidth const):
1377         (WebCore::Layout::InlineFormattingContext::LineLayout::closeLine const):
1378
1379 2019-05-28  Zalan Bujtas  <zalan@apple.com>
1380
1381         [LFC[IFC] Ignore the initial strut's height when the line does not have any content.
1382         https://bugs.webkit.org/show_bug.cgi?id=198268
1383         <rdar://problem/51150057>
1384
1385         Reviewed by Antti Koivisto.
1386
1387         The strut (https://www.w3.org/TR/CSS22/visudet.html#leading) defines the initial logical height
1388         for the line. This height should be ignored though when the line does not have any content. 
1389
1390         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
1391         (WebCore::Layout::InlineFormattingContext::LineLayout::closeLine const):
1392
1393 2019-05-27  Antoine Quint  <graouts@apple.com>
1394
1395         [Pointer Events] Check that capturing data managed by the PointerCaptureController gets cleared upon navigation
1396         https://bugs.webkit.org/show_bug.cgi?id=198191
1397
1398         Reviewed by Dean Jackson.
1399
1400         When the document of the page's main frame changes, make sure we clear all of the data accumulated for the previous document.
1401         I don't think this particular change is testable as none of the data contained in the PointerIdToCapturingDataMap maintained by
1402         the PointerCaptureController contains any data that could be inspected by the page due to other fixes landed to fix wkb.ug/198129,
1403         but I've checked that removing those fixes and using this patch correctly fixes that bug.
1404
1405         * page/Page.cpp:
1406         (WebCore::Page::didChangeMainDocument):
1407         * page/PointerCaptureController.cpp:
1408         (WebCore::PointerCaptureController::PointerCaptureController):
1409         (WebCore::PointerCaptureController::reset):
1410         * page/PointerCaptureController.h:
1411
1412 2019-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1413
1414         [GTK] Use WPEBackend-fdo for accelerating compositing in Wayland instead of the nested compositor
1415         https://bugs.webkit.org/show_bug.cgi?id=197944
1416
1417         Reviewed by Michael Catanzaro.
1418
1419         * PlatformGTK.cmake:
1420         * SourcesGTK.txt:
1421         * platform/graphics/GLContext.cpp:
1422         (WebCore::GLContext::createContextForWindow): Check current display is X11 before trying to create a GLX context.
1423         * platform/graphics/PlatformDisplay.cpp:
1424         (WebCore::PlatformDisplay::createPlatformDisplay): Use USE(WPE_RENDERER) instead of USE(LIBWPE).
1425         * platform/graphics/PlatformDisplay.h:
1426         * platform/graphics/egl/GLContextEGL.cpp:
1427         (WebCore::GLContextEGL::createWindowContext): Use USE(WPE_RENDERER) instead of PLATFORM(WPE).
1428         (WebCore::GLContextEGL::createContext): Ditto.
1429         (WebCore::GLContextEGL::createSharingContext): Ditto.
1430         (WebCore::GLContextEGL::~GLContextEGL): Ditto.
1431         * platform/graphics/egl/GLContextEGL.h:
1432         * platform/graphics/egl/GLContextEGLLibWPE.cpp:
1433         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1434         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): Ditto.
1435         * platform/graphics/libwpe/PlatformDisplayLibWPE.cpp:
1436         (WebCore::PlatformDisplayLibWPE::PlatformDisplayLibWPE): In GTK port set the display as the shared one for compositing.
1437         * platform/graphics/libwpe/PlatformDisplayLibWPE.h:
1438
1439 2019-05-27  Takashi Komori  <Takashi.Komori@sony.com>
1440
1441         [CURL] Fix crashing SocketStreamHandle.
1442         https://bugs.webkit.org/show_bug.cgi?id=197873
1443
1444         Reviewed by Fujii Hironori.
1445
1446         When NetworkSocketStream was destructed SocketStreamHandleImple::platformClose was called wrongly times.
1447         This is because closed state is not set.
1448
1449         Test: http/tests/websocket/tests/hybi/workers/close.html
1450
1451         * platform/network/curl/SocketStreamHandleImpl.h:
1452         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
1453         (WebCore::SocketStreamHandleImpl::platformSendInternal):
1454         (WebCore::SocketStreamHandleImpl::platformClose):
1455         (WebCore::SocketStreamHandleImpl::threadEntryPoint):
1456         (WebCore::SocketStreamHandleImpl::handleError):
1457         (WebCore::SocketStreamHandleImpl::callOnWorkerThread):
1458         (WebCore::SocketStreamHandleImpl::executeTasks):
1459
1460 2019-05-27  Oriol Brufau  <obrufau@igalia.com>
1461
1462         [css-grid] Preserve repeat() notation when serializing declared values
1463         https://bugs.webkit.org/show_bug.cgi?id=197840
1464
1465         Reviewed by Manuel Rego Casasnovas.
1466
1467         Tests: fast/css-grid-layout/grid-element-auto-repeat-get-set.html
1468                fast/css-grid-layout/grid-repeat-calc.html
1469                fast/css-grid-layout/named-grid-line-get-set.html
1470                imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-repeat-002.html
1471
1472         Before this change, a repeat() notation with an integral number of
1473         repetitions was expanded at parse time. This was observable when reading
1474         declared values using JS APIs.
1475
1476         This patch makes the parser preserve that notation, like it was already
1477         happening when the number of repetitions was automatic and not integral.
1478
1479         The resolved value in getComputedStyle() will still be expanded, though,
1480         as required by the spec.
1481
1482         * Sources.txt:
1483         * WebCore.xcodeproj/project.pbxproj:
1484         * css/CSSGridIntegerRepeatValue.cpp: Added.
1485         (WebCore::CSSGridIntegerRepeatValue::customCSSText const):
1486         (WebCore::CSSGridIntegerRepeatValue::equals const):
1487         * css/CSSGridIntegerRepeatValue.h: Added.
1488         * css/CSSValue.cpp:
1489         (WebCore::CSSValue::equals const):
1490         (WebCore::CSSValue::cssText const):
1491         (WebCore::CSSValue::destroy):
1492         * css/CSSValue.h:
1493         (WebCore::CSSValue::isGridIntegerRepeatValue const):
1494         * css/StyleBuilderConverter.h:
1495         (WebCore::StyleBuilderConverter::createGridTrackList):
1496         (WebCore::StyleBuilderConverter::convertGridTrackSizeList):
1497         * css/parser/CSSPropertyParser.cpp:
1498         (WebCore::consumeGridTrackRepeatFunction):
1499
1500 2019-05-27  Chris Dumez  <cdumez@apple.com>
1501
1502         Use a strongly-typed identifier for pages
1503         https://bugs.webkit.org/show_bug.cgi?id=198206
1504
1505         Reviewed by Youenn Fablet.
1506
1507         * WebCore/*:
1508
1509 2019-05-26  Simon Fraser  <simon.fraser@apple.com>
1510
1511         Move GraphicsLayerCA::adjustTiledLayerVisibleRect() to TileController
1512         https://bugs.webkit.org/show_bug.cgi?id=198266
1513
1514         Reviewed by Zalan Bujtas.
1515
1516         GraphicsLayerCA::adjustTiledLayerVisibleRect() was computing tile coverage for a
1517         TiledBacking, just like TileController::adjustTileCoverageRect(), so move the code
1518         into TileController as a first step to unifying more of this code. It's currently
1519         used for tiled compositing layers, including overflow:scroll, and tiled layers
1520         whose coverage may be affected by animations, so it's general-purpose.
1521
1522         TileController::adjustTileCoverageRect() is used for scrollable things, so rename
1523         it to adjustTileCoverageRectForScrolling().
1524
1525         No behavior change.
1526
1527         * platform/graphics/TiledBacking.h:
1528         * platform/graphics/ca/GraphicsLayerCA.cpp:
1529         (WebCore::GraphicsLayerCA::adjustCoverageRect const):
1530         (WebCore::GraphicsLayerCA::adjustTiledLayerVisibleRect): Deleted.
1531         * platform/graphics/ca/GraphicsLayerCA.h:
1532         * platform/graphics/ca/TileController.cpp:
1533         (WebCore::TileController::adjustTileCoverageRect const):
1534         (WebCore::TileController::adjustTileCoverageRectForScrolling const):
1535         * platform/graphics/ca/TileController.h:
1536
1537 2019-05-27  Simon Fraser  <simon.fraser@apple.com>
1538
1539         Fix Apple Internal builds after r245788.
1540
1541         * platform/PlatformScreen.h:
1542         (WebCore::screenHasTouchDevice):
1543         (WebCore::screenIsTouchPrimaryInputDevice):
1544
1545 2019-05-27  Zalan Bujtas  <zalan@apple.com>
1546
1547         [LFC][IFC] Ignore collapsed runs when setting the width on the associated display boxes.
1548         https://bugs.webkit.org/show_bug.cgi?id=198260
1549         <rdar://problem/51145704>
1550
1551         Reviewed by Antti Koivisto.
1552
1553         Collapsed runs don't contribute to the logical width of their containers.
1554
1555         Covered by existing tests.
1556
1557         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
1558         (WebCore::Layout::InlineFormattingContext::LineLayout::closeLine const):
1559
1560 2019-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1561
1562         Unreviewed. Fix GTK distcheck
1563
1564         Move mac headers to platform specific makefile.
1565
1566         * Headers.cmake:
1567         * PlatformMac.cmake:
1568
1569 2019-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
1570
1571         Touch support is reported even when the device doesn't have a touch screen
1572         https://bugs.webkit.org/show_bug.cgi?id=139681
1573
1574         Reviewed by Michael Catanzaro.
1575
1576         Add screenHasTouchDevice() and screenIsTouchPrimaryInputDevice() to PlatformScreen and use it to decide whether
1577         to expose touch events functionality or not.
1578
1579         * bindings/js/WebCoreBuiltinNames.h:
1580         * css/MediaQueryEvaluator.cpp:
1581         (WebCore::hoverEvaluate): Use screenIsTouchPrimaryInputDevice() when touch events are enabled at build time.
1582         (WebCore::anyHoverEvaluate): Use screenHasTouchDevice() when touch events are enabled at build time.
1583         (WebCore::pointerEvaluate): Use screenIsTouchPrimaryInputDevice() when touch events are enabled at build time.
1584         (WebCore::anyPointerEvaluate): Use screenHasTouchDevice() when touch events are enabled at build time.
1585         * dom/GlobalEventHandlers.idl: Make touch event attributes enabled at runtime.
1586         * page/RuntimeEnabledFeatures.cpp:
1587         (WebCore::RuntimeEnabledFeatures::touchEventsEnabled const): Return whether touch events are enabled.
1588         * page/RuntimeEnabledFeatures.h:
1589         (WebCore::RuntimeEnabledFeatures::setTouchEventsEnabled): Force touch events to be enabled or disabled.
1590         * platform/PlatformScreen.h:
1591         (WebCore::screenHasTouchDevice): Just return true when touch events are enabled at build time for non-gtk ports.
1592         (WebCore::screenIsTouchPrimaryInputDevice): Ditto.
1593         * platform/gtk/PlatformScreenGtk.cpp:
1594         (WebCore::screenHasTouchDevice):
1595         (WebCore::screenIsTouchPrimaryInputDevice):
1596         (WebCore::isTouchDevice):
1597         (WebCore::deviceAddedCallback):
1598         (WebCore::deviceRemovedCallback):
1599
1600 2019-05-26  Simon Fraser  <simon.fraser@apple.com>
1601
1602         Move VelocityData to WebCore
1603         https://bugs.webkit.org/show_bug.cgi?id=198261
1604
1605         Reviewed by Antti Koivisto.
1606
1607         Move VelocityData and HistoricalVelocityData to WebCore for future use in overflow scroll.
1608         
1609         VisibleContentRectUpdateInfo can now store a VelocityData (its timestamp is used as
1610         the timetamp for the entire update).
1611
1612         No behavior change.
1613
1614         * Headers.cmake:
1615         * Sources.txt:
1616         * WebCore.xcodeproj/project.pbxproj:
1617         * page/FrameView.cpp:
1618         (WebCore::FrameView::setScrollVelocity):
1619         * page/FrameView.h:
1620         * platform/graphics/TiledBacking.h:
1621         (WebCore::VelocityData::VelocityData): Deleted.
1622         (WebCore::VelocityData::velocityOrScaleIsChanging const): Deleted.
1623         * platform/graphics/ca/TileController.cpp:
1624         (WebCore::TileController::adjustTileCoverageRect const):
1625         * platform/graphics/ca/TileController.h:
1626
1627 2019-05-26  Simon Fraser  <simon.fraser@apple.com>
1628
1629         Add a GraphicsLayer::Type for ScrolledContents
1630         https://bugs.webkit.org/show_bug.cgi?id=198257
1631
1632         Reviewed by Zalan Bujtas.
1633
1634         This ScrolledContents layer type will be used to choose different tiling behaviors
1635         in a future patch.
1636
1637         * platform/graphics/GraphicsLayer.cpp:
1638         (WebCore::GraphicsLayer::supportsLayerType):
1639         * platform/graphics/GraphicsLayer.h:
1640         * platform/graphics/ca/GraphicsLayerCA.cpp:
1641         (WebCore::GraphicsLayer::supportsLayerType):
1642         (WebCore::GraphicsLayerCA::initialize):
1643         (WebCore::GraphicsLayerCA::adjustCoverageRect const):
1644         * rendering/RenderLayerBacking.cpp:
1645         (WebCore::RenderLayerBacking::updateScrollingLayers):
1646         * rendering/RenderLayerCompositor.cpp:
1647         (WebCore::RenderLayerCompositor::ensureRootLayer):
1648
1649 2019-05-26  John Wilander  <wilander@apple.com>
1650
1651         Resource Load Statistics: Downgrade document.referrer to the referrer's eTLD+1 if the page was navigated to with a prevalent resource referrer containing link decoration
1652         https://bugs.webkit.org/show_bug.cgi?id=198227
1653         <rdar://problem/51117258>
1654
1655         Reviewed by Alex Christensen.
1656
1657         Test: http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource.html
1658
1659         * Headers.cmake:
1660         * WebCore.xcodeproj/project.pbxproj:
1661         * dom/Document.cpp:
1662         (WebCore::Document::referrer const):
1663             Now checks if the referrer has been overridden.
1664         (WebCore::Document::wasLoadedWithDataTransferFromPrevalentResource):
1665         (WebCore::Document::downgradeReferrerToRegistrableDomain):
1666         * dom/Document.h:
1667         * page/CrossSiteNavigationDataTransfer.h: Added.
1668             New option set for the growing number of navigational data transfers we care about.
1669         * platform/network/NetworkStorageSession.cpp:
1670         (WebCore::NetworkStorageSession::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource):
1671         (WebCore::NetworkStorageSession::committedCrossSiteLoadWithLinkDecoration): Deleted.
1672             New name since we no longer only look for link decoration but also other means of navigational data transfer.
1673         * platform/network/NetworkStorageSession.h:
1674
1675 2019-05-26  Zalan Bujtas  <zalan@apple.com>
1676
1677         [LFC][Verification] Add areEssentiallyEqual for LayoutRect
1678         https://bugs.webkit.org/show_bug.cgi?id=198250
1679         <rdar://problem/51140119>
1680
1681         Reviewed by Antti Koivisto.
1682
1683         WebKit's inline layout is a mix of int/float/LayoutUnit types, while LFC mostly uses LayoutUnit.
1684         When we compute the used size of a block container (based on the inline tree), the final value might go through a few conversions.
1685
1686         * layout/Verification.cpp:
1687         (WebCore::Layout::areEssentiallyEqual):
1688         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
1689
1690 2019-05-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1691
1692         [iOS] Dropped text, attachments, and images should animate into place
1693         https://bugs.webkit.org/show_bug.cgi?id=198243
1694         <rdar://problem/35205373>
1695
1696         Reviewed by Tim Horton.
1697
1698         Add some hooks to notify the chrome client when an HTMLImageElement's image is finished loading. See WebKit
1699         changelog for more detail.
1700
1701         Test: DragAndDropTests.DropPreviewForImageInEditableArea
1702
1703         * loader/EmptyClients.h:
1704         * page/ChromeClient.h:
1705         * page/Page.cpp:
1706         (WebCore::Page::didFinishLoadingImageForElement):
1707         * page/Page.h:
1708         * rendering/RenderImage.cpp:
1709         (WebCore::RenderImage::notifyFinished):
1710
1711 2019-05-25  Zalan Bujtas  <zalan@apple.com>
1712
1713         [LFC][IFC] Introduce DisplayRun to display tree
1714         https://bugs.webkit.org/show_bug.cgi?id=197198
1715
1716         Reviewed by Antti Koivisto.
1717
1718         Add a simple inline layout implementation. Now we've got DisplayBoxes for layout boxes and
1719         DisplayRuns for inline runs.
1720
1721         * Sources.txt:
1722         * WebCore.xcodeproj/project.pbxproj:
1723         * layout/FormattingContextGeometry.cpp:
1724         (WebCore::Layout::contentHeightForFormattingContextRoot):
1725         * layout/Verification.cpp:
1726         (WebCore::Layout::areEssentiallyEqual):
1727         (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
1728         (WebCore::Layout::checkForMatchingNonTextRuns):
1729         (WebCore::Layout::checkForMatchingTextRuns):
1730         (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
1731         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
1732         (WebCore::Layout::resolveForRelativePositionIfNeeded): Deleted.
1733         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1734         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1735         * layout/displaytree/DisplayBox.cpp:
1736         (WebCore::Display::Box::marginBox const):
1737         (WebCore::Display::Box::nonCollapsedMarginBox const):
1738         (WebCore::Display::Box::borderBox const):
1739         (WebCore::Display::Box::paddingBox const):
1740         (WebCore::Display::Box::contentBox const):
1741         (WebCore::Display::Box::Rect::Rect): Deleted.
1742         * layout/displaytree/DisplayBox.h:
1743         (WebCore::Display::Box::rectWithMargin const):
1744         (WebCore::Display::Box::horizontalMargin const):
1745         (WebCore::Display::Box::Rect::intersects const): Deleted.
1746         (WebCore::Display::Box::Rect::invalidateTop): Deleted.
1747         (WebCore::Display::Box::Rect::invalidateLeft): Deleted.
1748         (WebCore::Display::Box::Rect::invalidateWidth): Deleted.
1749         (WebCore::Display::Box::Rect::invalidateHeight): Deleted.
1750         (WebCore::Display::Box::Rect::hasValidPosition const): Deleted.
1751         (WebCore::Display::Box::Rect::hasValidSize const): Deleted.
1752         (WebCore::Display::Box::Rect::hasValidGeometry const): Deleted.
1753         (WebCore::Display::Box::Rect::invalidatePosition): Deleted.
1754         (WebCore::Display::Box::Rect::setHasValidPosition): Deleted.
1755         (WebCore::Display::Box::Rect::setHasValidSize): Deleted.
1756         (WebCore::Display::Box::Rect::top const): Deleted.
1757         (WebCore::Display::Box::Rect::left const): Deleted.
1758         (WebCore::Display::Box::Rect::bottom const): Deleted.
1759         (WebCore::Display::Box::Rect::right const): Deleted.
1760         (WebCore::Display::Box::Rect::topLeft const): Deleted.
1761         (WebCore::Display::Box::Rect::bottomRight const): Deleted.
1762         (WebCore::Display::Box::Rect::size const): Deleted.
1763         (WebCore::Display::Box::Rect::width const): Deleted.
1764         (WebCore::Display::Box::Rect::height const): Deleted.
1765         (WebCore::Display::Box::Rect::setTopLeft): Deleted.
1766         (WebCore::Display::Box::Rect::setTop): Deleted.
1767         (WebCore::Display::Box::Rect::setLeft): Deleted.
1768         (WebCore::Display::Box::Rect::setWidth): Deleted.
1769         (WebCore::Display::Box::Rect::setHeight): Deleted.
1770         (WebCore::Display::Box::Rect::setSize): Deleted.
1771         (WebCore::Display::Box::Rect::shiftLeftTo): Deleted.
1772         (WebCore::Display::Box::Rect::shiftRightTo): Deleted.
1773         (WebCore::Display::Box::Rect::shiftTopTo): Deleted.
1774         (WebCore::Display::Box::Rect::shiftBottomTo): Deleted.
1775         (WebCore::Display::Box::Rect::moveHorizontally): Deleted.
1776         (WebCore::Display::Box::Rect::moveVertically): Deleted.
1777         (WebCore::Display::Box::Rect::expand): Deleted.
1778         (WebCore::Display::Box::Rect::clone const): Deleted.
1779         (WebCore::Display::Box::Rect::operator LayoutRect const): Deleted.
1780         * layout/displaytree/DisplayRect.h: Added.
1781         (WebCore::Display::Rect::expandHorizontally):
1782         (WebCore::Display::Rect::expandVertically):
1783         (WebCore::Display::Rect::intersects const):
1784         (WebCore::Display::Rect::invalidateTop):
1785         (WebCore::Display::Rect::invalidateLeft):
1786         (WebCore::Display::Rect::invalidateWidth):
1787         (WebCore::Display::Rect::invalidateHeight):
1788         (WebCore::Display::Rect::hasValidPosition const):
1789         (WebCore::Display::Rect::hasValidSize const):
1790         (WebCore::Display::Rect::hasValidGeometry const):
1791         (WebCore::Display::Rect::Rect):
1792         (WebCore::Display::Rect::invalidatePosition):
1793         (WebCore::Display::Rect::setHasValidPosition):
1794         (WebCore::Display::Rect::setHasValidSize):
1795         (WebCore::Display::Rect::top const):
1796         (WebCore::Display::Rect::left const):
1797         (WebCore::Display::Rect::bottom const):
1798         (WebCore::Display::Rect::right const):
1799         (WebCore::Display::Rect::topLeft const):
1800         (WebCore::Display::Rect::bottomRight const):
1801         (WebCore::Display::Rect::size const):
1802         (WebCore::Display::Rect::width const):
1803         (WebCore::Display::Rect::height const):
1804         (WebCore::Display::Rect::setTopLeft):
1805         (WebCore::Display::Rect::setTop):
1806         (WebCore::Display::Rect::setLeft):
1807         (WebCore::Display::Rect::setWidth):
1808         (WebCore::Display::Rect::setHeight):
1809         (WebCore::Display::Rect::setSize):
1810         (WebCore::Display::Rect::shiftLeftTo):
1811         (WebCore::Display::Rect::shiftRightTo):
1812         (WebCore::Display::Rect::shiftTopTo):
1813         (WebCore::Display::Rect::shiftBottomTo):
1814         (WebCore::Display::Rect::moveHorizontally):
1815         (WebCore::Display::Rect::moveVertically):
1816         (WebCore::Display::Rect::expand):
1817         (WebCore::Display::Rect::clone const):
1818         (WebCore::Display::Rect::operator LayoutRect const):
1819         * layout/displaytree/DisplayRun.h: Renamed from Source/WebCore/layout/inlineformatting/InlineRun.h.
1820         (WebCore::Display::Run::TextContext::start const):
1821         (WebCore::Display::Run::TextContext::end const):
1822         (WebCore::Display::Run::TextContext::length const):
1823         (WebCore::Display::Run::TextContext::expand):
1824         (WebCore::Display::Run::logicalTopLeft const):
1825         (WebCore::Display::Run::logicalLeft const):
1826         (WebCore::Display::Run::logicalRight const):
1827         (WebCore::Display::Run::logicalTop const):
1828         (WebCore::Display::Run::logicalBottom const):
1829         (WebCore::Display::Run::logicalWidth const):
1830         (WebCore::Display::Run::logicalHeight const):
1831         (WebCore::Display::Run::setLogicalWidth):
1832         (WebCore::Display::Run::setLogicalTop):
1833         (WebCore::Display::Run::setLogicalLeft):
1834         (WebCore::Display::Run::setLogicalRight):
1835         (WebCore::Display::Run::moveVertically):
1836         (WebCore::Display::Run::moveHorizontally):
1837         (WebCore::Display::Run::expandVertically):
1838         (WebCore::Display::Run::expandHorizontally):
1839         (WebCore::Display::Run::setTextContext):
1840         (WebCore::Display::Run::textContext):
1841         (WebCore::Display::Run::textContext const):
1842         (WebCore::Display::Run::Run):
1843         (WebCore::Display::Run::TextContext::TextContext):
1844         * layout/floats/FloatAvoider.cpp:
1845         (WebCore::Layout::FloatAvoider::rectInContainingBlock const):
1846         * layout/floats/FloatAvoider.h:
1847         (WebCore::Layout::FloatAvoider::rect const):
1848         * layout/floats/FloatBox.cpp:
1849         (WebCore::Layout::FloatBox::rect const):
1850         * layout/floats/FloatBox.h:
1851         * layout/floats/FloatingContext.cpp:
1852         (WebCore::Layout::FloatPair::intersects const):
1853         * layout/floats/FloatingState.h:
1854         (WebCore::Layout::FloatingState::FloatItem::rectWithMargin const):
1855         * layout/inlineformatting/InlineFormattingContext.cpp:
1856         (WebCore::Layout::InlineFormattingContext::layout const):
1857         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
1858         (WebCore::Layout::InlineFormattingContext::initializeMarginBorderAndPaddingForGenericInlineBox const):
1859         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPaddingForInlineContainer const):
1860         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFloatBox const):
1861         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForInlineBlock const):
1862         (WebCore::Layout::InlineFormattingContext::computeHorizontalMargin const):
1863         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
1864         (WebCore::Layout::InlineFormattingContext::collectInlineContent const):
1865         (WebCore::Layout::InlineFormattingContext::computeMargin const): Deleted.
1866         (WebCore::Layout::addDetachingRules): Deleted.
1867         (WebCore::Layout::createAndAppendInlineItem): Deleted.
1868         * layout/inlineformatting/InlineFormattingContext.h:
1869         (WebCore::Layout::InlineFormattingContext::LineLayout::layoutState const):
1870         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
1871         (WebCore::Layout::halfLeadingMetrics):
1872         (WebCore::Layout::Line::availableWidth const):
1873         (WebCore::Layout::Line::contentLogicalRight const):
1874         (WebCore::Layout::Line::contentLogicalWidth const):
1875         (WebCore::Layout::Line::logicalTop const):
1876         (WebCore::Layout::Line::logicalLeft const):
1877         (WebCore::Layout::Line::logicalRight const):
1878         (WebCore::Layout::Line::logicalBottom const):
1879         (WebCore::Layout::Line::logicalWidth const):
1880         (WebCore::Layout::Line::logicalHeight const):
1881         (WebCore::Layout::Line::LineItem::LineItem):
1882         (WebCore::Layout::Line::Line):
1883         (WebCore::Layout::Line::reset):
1884         (WebCore::Layout::Line::close):
1885         (WebCore::Layout::Line::removeTrailingTrimmableContent):
1886         (WebCore::Layout::Line::moveLogicalLeft):
1887         (WebCore::Layout::Line::moveLogicalRight):
1888         (WebCore::Layout::isTrimmableContent):
1889         (WebCore::Layout::Line::trailingTrimmableWidth const):
1890         (WebCore::Layout::Line::hasContent const):
1891         (WebCore::Layout::Line::appendNonBreakableSpace):
1892         (WebCore::Layout::Line::appendInlineContainerStart):
1893         (WebCore::Layout::Line::appendInlineContainerEnd):
1894         (WebCore::Layout::Line::appendTextContent):
1895         (WebCore::Layout::Line::appendNonTextContent):
1896         (WebCore::Layout::Line::appendHardLineBreak):
1897         (WebCore::Layout::UncommittedContent::isEmpty const):
1898         (WebCore::Layout::UncommittedContent::width const):
1899         (WebCore::Layout::UncommittedContent::add):
1900         (WebCore::Layout::UncommittedContent::reset):
1901         (WebCore::Layout::InlineFormattingContext::LineLayout::LineLayout):
1902         (WebCore::Layout::InlineFormattingContext::LineLayout::initializeLine const):
1903         (WebCore::Layout::InlineFormattingContext::LineLayout::layout const):
1904         (WebCore::Layout::InlineFormattingContext::LineLayout::closeLine const):
1905         (WebCore::Layout::InlineFormattingContext::LineLayout::handleFloat const):
1906         (WebCore::Layout::InlineFormattingContext::LineLayout::commitInlineItemToLine const):
1907         (WebCore::Layout::horizontalAdjustmentForAlignment):
1908         (WebCore::Layout::InlineFormattingContext::LineLayout::alignRuns const):
1909         (WebCore::Layout::Line::isClosed const): Deleted.
1910         (WebCore::Layout::Line::isFirstLine const): Deleted.
1911         (WebCore::Layout::Line::runs): Deleted.
1912         (WebCore::Layout::Line::contentLogicalLeft const): Deleted.
1913         (WebCore::Layout::Line::lastRunType const): Deleted.
1914         (WebCore::Layout::Line::init): Deleted.
1915         (WebCore::Layout::Line::adjustLogicalLeft): Deleted.
1916         (WebCore::Layout::Line::adjustLogicalRight): Deleted.
1917         (WebCore::Layout::Line::appendContent): Deleted.
1918         (WebCore::Layout::InlineFormattingContext::LineLayout::initializeNewLine const): Deleted.
1919         (WebCore::Layout::InlineFormattingContext::LineLayout::splitInlineRunIfNeeded const): Deleted.
1920         (WebCore::Layout::InlineFormattingContext::LineLayout::createFinalRuns const): Deleted.
1921         (WebCore::Layout::InlineFormattingContext::LineLayout::postProcessInlineRuns const): Deleted.
1922         (WebCore::Layout::InlineFormattingContext::LineLayout::appendContentToLine const): Deleted.
1923         (WebCore::Layout::InlineFormattingContext::LineLayout::computeFloatPosition const): Deleted.
1924         (WebCore::Layout::InlineFormattingContext::LineLayout::placeInFlowPositionedChildren const): Deleted.
1925         (WebCore::Layout::adjustedLineLogicalLeft): Deleted.
1926         (WebCore::Layout::InlineFormattingContext::LineLayout::justifyRuns): Deleted.
1927         (WebCore::Layout::InlineFormattingContext::LineLayout::computeExpansionOpportunities const): Deleted.
1928         (WebCore::Layout::InlineFormattingContext::LineLayout::runWidth const): Deleted.
1929         * layout/inlineformatting/InlineFormattingState.h:
1930         (WebCore::Layout::InlineFormattingState::inlineItems):
1931         (WebCore::Layout::InlineFormattingState::lineBoxes):
1932         (WebCore::Layout::InlineFormattingState::addInlineItem):
1933         (WebCore::Layout::InlineFormattingState::addInlineRun):
1934         (WebCore::Layout::InlineFormattingState::addLineBox):
1935         (WebCore::Layout::InlineFormattingState::inlineContent): Deleted.
1936         (WebCore::Layout::InlineFormattingState::lastInlineItem const): Deleted.
1937         (WebCore::Layout::InlineFormattingState::appendInlineRun): Deleted.
1938         * layout/inlineformatting/InlineItem.h:
1939         (WebCore::Layout::InlineItem::type const):
1940         (WebCore::Layout::InlineItem::isText const):
1941         (WebCore::Layout::InlineItem::isBox const):
1942         (WebCore::Layout::InlineItem::isHardLineBreak const):
1943         (WebCore::Layout::InlineItem::isFloat const):
1944         (WebCore::Layout::InlineItem::isLineBreak const):
1945         (WebCore::Layout::InlineItem::isContainerStart const):
1946         (WebCore::Layout::InlineItem::isContainerEnd const):
1947         (WebCore::Layout::InlineItem::InlineItem):
1948         (WebCore::Layout::InlineItem::setWidth):
1949         (WebCore::Layout::InlineItem::width const):
1950         (WebCore::Layout::InlineItem::addDetachingRule): Deleted.
1951         (WebCore::Layout::InlineItem::detachingRules const): Deleted.
1952         (WebCore::Layout::InlineItem::nonBreakableStart const): Deleted.
1953         (WebCore::Layout::InlineItem::nonBreakableEnd const): Deleted.
1954         (WebCore::Layout::InlineItem::addNonBreakableStart): Deleted.
1955         (WebCore::Layout::InlineItem::addNonBreakableEnd): Deleted.
1956         (WebCore::Layout::InlineItem::textContent const): Deleted.
1957         * layout/inlineformatting/InlineLineBox.h: Copied from Source/WebCore/layout/floats/FloatBox.h.
1958         (WebCore::Layout::LineBox::logicalTopLeft const):
1959         (WebCore::Layout::LineBox::logicalLeft const):
1960         (WebCore::Layout::LineBox::logicalRight const):
1961         (WebCore::Layout::LineBox::logicalTop const):
1962         (WebCore::Layout::LineBox::logicalBottom const):
1963         (WebCore::Layout::LineBox::logicalWidth const):
1964         (WebCore::Layout::LineBox::logicalHeight const):
1965         (WebCore::Layout::LineBox::LineBox):
1966         * layout/inlineformatting/InlineLineBreaker.cpp:
1967         (WebCore::Layout::LineBreaker::LineBreaker):
1968         (WebCore::Layout::LineBreaker::breakingContext):
1969         (WebCore::Layout::LineBreaker::wordBreakingBehavior const):
1970         (WebCore::Layout::LineBreaker::runWidth const):
1971         (WebCore::Layout::LineBreaker::isAtBreakingOpportunity):
1972         (WebCore::Layout::LineBreaker::textWidth const):
1973         (WebCore::Layout::InlineLineBreaker::InlineLineBreaker): Deleted.
1974         (WebCore::Layout::InlineLineBreaker::nextRun): Deleted.
1975         (WebCore::Layout::InlineLineBreaker::isAtContentEnd const): Deleted.
1976         (WebCore::Layout::InlineLineBreaker::lineBreakingBehavior): Deleted.
1977         (WebCore::Layout::InlineLineBreaker::runWidth const): Deleted.
1978         (WebCore::Layout::InlineLineBreaker::textWidth const): Deleted.
1979         (WebCore::Layout::InlineLineBreaker::splitRun): Deleted.
1980         (WebCore::Layout::InlineLineBreaker::adjustSplitPositionWithHyphenation const): Deleted.
1981         * layout/inlineformatting/InlineLineBreaker.h:
1982         * layout/inlineformatting/InlineRunProvider.cpp: Removed.
1983         * layout/inlineformatting/InlineRunProvider.h: Removed.
1984         * layout/inlineformatting/InlineTextItem.cpp: Added.
1985         (WebCore::Layout::isWhitespaceCharacter):
1986         (WebCore::Layout::isSoftLineBreak):
1987         (WebCore::Layout::moveToNextNonWhitespacePosition):
1988         (WebCore::Layout::moveToNextBreakablePosition):
1989         (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
1990         (WebCore::Layout::InlineTextItem::InlineTextItem):
1991         * layout/inlineformatting/InlineTextItem.h: Copied from Source/WebCore/layout/inlineformatting/text/TextUtil.h.
1992         (WebCore::Layout::InlineTextItem::start const):
1993         (WebCore::Layout::InlineTextItem::end const):
1994         (WebCore::Layout::InlineTextItem::length const):
1995         (WebCore::Layout::InlineTextItem::isWhitespace const):
1996         (WebCore::Layout::InlineTextItem::isCollapsed const):
1997         * layout/inlineformatting/text/TextUtil.cpp:
1998         (WebCore::Layout::TextUtil::hyphenPositionBefore):
1999         (WebCore::Layout::TextUtil::width):
2000         (WebCore::Layout::TextUtil::fixedPitchWidth):
2001         * layout/inlineformatting/text/TextUtil.h:
2002         * layout/layouttree/LayoutBox.h:
2003         * layout/layouttree/LayoutReplaced.cpp:
2004         (WebCore::Layout::Replaced::intrinsicRatio const):
2005         * layout/layouttree/LayoutTreeBuilder.cpp:
2006         (WebCore::Layout::accumulatedOffsetForInFlowPositionedContinuation):
2007         (WebCore::Layout::TreeBuilder::createSubTree):
2008         (WebCore::Layout::outputInlineRuns):
2009         (WebCore::Layout::outputLayoutBox):
2010
2011 2019-05-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2012
2013         [iOS] Respect -[NSItemProvider preferredPresentationSize] when dropping images
2014         https://bugs.webkit.org/show_bug.cgi?id=198242
2015
2016         Reviewed by Beth Dakin.
2017
2018         Teach the web content reader to respect the -preferredPresentationSize when creating attachment-backed image
2019         elements. See below for more details.
2020
2021         Test: WKAttachmentTestsIOS.InsertDroppedImageWithPreferredPresentationSize
2022
2023         * editing/WebContentReader.h:
2024         * editing/cocoa/WebContentReaderCocoa.mm:
2025         (WebCore::attachmentForFilePath):
2026         (WebCore::attachmentForData):
2027
2028         When creating attachment-backed image elements, additionally set width and height attributes from the preferred
2029         presentation size, if specified.
2030
2031         (WebCore::WebContentReader::readFilePath):
2032
2033         Add a version of readFilePath that takes a single file path, and an optional preferred presentation size.
2034
2035         (WebCore::WebContentReader::readFilePaths):
2036
2037         Reimplement readFilePaths in terms of readFilePath.
2038
2039         (WebCore::WebContentReader::readDataBuffer):
2040
2041         Add more plumbing for preferredPresentationSize.
2042
2043         * platform/Pasteboard.h:
2044         (WebCore::PasteboardWebContentReader::readFilePath):
2045         (WebCore::PasteboardWebContentReader::readDataBuffer):
2046         * platform/ios/PasteboardIOS.mm:
2047         (WebCore::Pasteboard::read):
2048         (WebCore::Pasteboard::readRespectingUTIFidelities):
2049
2050         Forward PasteboardItemInfo's preferredPresentationSize to the web content reader.
2051
2052 2019-05-25  Antoine Quint  <graouts@apple.com>
2053
2054         Opt naver.com into simulated mouse events quirk on iOS
2055         https://bugs.webkit.org/show_bug.cgi?id=198248
2056         <rdar://problem/50598281>
2057
2058         Reviewed by Brent Fulgham.
2059
2060         * page/Quirks.cpp:
2061         (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
2062
2063 2019-05-25  Youenn Fablet  <youenn@apple.com>
2064
2065         media/video-remote-control-playpause.html is timing out after r245712
2066         https://bugs.webkit.org/show_bug.cgi?id=198238
2067
2068         Reviewed by Eric Carlson.
2069
2070         Fix regression introduced in r245712.
2071         Covered by test no longer timing out.
2072
2073         * platform/audio/PlatformMediaSessionManager.cpp:
2074         (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback):
2075
2076 2019-05-25  Simon Fraser  <simon.fraser@apple.com>
2077
2078         [Async overflow scrolling] Absolute positioned element inside async overflow scroll didn't get composited sometimes
2079         https://bugs.webkit.org/show_bug.cgi?id=198237
2080
2081         Reviewed by Antti Koivisto.
2082
2083         The logic in requiresCompositingForIndirectReason() that decides if we need to do
2084         compositing for a layer that needs to move independently of its enclosing scroller
2085         was wrong.
2086
2087         Instead of asking question about the enclosing compositing layer, it needs to ask
2088         whether it has different positioning behavior from the layer that it would
2089         otherwise paint into, which is its paint-order parent.
2090
2091         "paintsIntoProvidedBacking" already does a containing-block check against the
2092         scroller, so we know we don't have to do the check in that case.
2093
2094         Test: scrollingcoordinator/scrolling-tree/absolute-inside-stacking-in-scroller.html
2095
2096         * rendering/RenderLayerCompositor.cpp:
2097         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
2098         (WebCore::enclosingCompositedScrollingLayer):
2099         (WebCore::isScrolledByOverflowScrollLayer):
2100         (WebCore::isNonScrolledLayerInsideScrolledCompositedAncestor):
2101         (WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason const):
2102         * rendering/RenderLayerCompositor.h:
2103
2104 2019-05-25  Simon Fraser  <simon.fraser@apple.com>
2105
2106         [macOS] Fix programmatic scroll in RTL overflow with async scrolling enabled
2107         https://bugs.webkit.org/show_bug.cgi?id=198226
2108
2109         Reviewed by Antti Koivisto.
2110
2111         On macOS we need to use a scroll offset to set the layer position, not
2112         a scroll position.
2113
2114         Test: scrollingcoordinator/mac/rtl-programmatic-overflow-scroll.html
2115
2116         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
2117         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
2118
2119 2019-05-24  Joonghun Park  <jh718.park@samsung.com>
2120
2121         Make computed width of non-replaced inline return computed style.
2122         https://bugs.webkit.org/show_bug.cgi?id=197814
2123
2124         Reviewed by Antti Koivisto.
2125
2126         Currently, Computed width of non-replaced inline incorrectly returns "auto"
2127         instead of the computed value.
2128         This patch changes the behavior according to
2129         https://drafts.csswg.org/cssom/#resolved-value as below.
2130
2131         'If the property applies to the element or pseudo-element
2132         and the resolved value of the display property is not none or contents,
2133         then the resolved value is the used value.
2134         Otherwise the resolved value is the computed value.'
2135
2136         * css/CSSComputedStyleDeclaration.cpp:
2137         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
2138
2139 2019-05-24  Myles C. Maxfield  <mmaxfield@apple.com>
2140
2141         [WHLSL] Allow vertex attributes to have arbitrary names in the shader
2142         https://bugs.webkit.org/show_bug.cgi?id=198235
2143
2144         Reviewed by Dean Jackson and Justin Fan.
2145
2146         Metal doesn't allow arbitrary vertex attribute IDs. If you try to create a vertex attribute > 16,
2147         the Metal validation layer will assert. So, we need to have a mapping from whatever the WebGPU
2148         API says the vertex attribute IDs should be to the internally-used vertex attribute IDs.
2149
2150         Test: webgpu/whlsl-arbitrary-vertex-attribute-locations.html
2151
2152         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
2153         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::VertexEntryPointScaffolding):
2154         * Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h:
2155         * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp:
2156         (WebCore::WHLSL::matchVertexAttributes):
2157         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
2158         (WebCore::convertRenderPipelineDescriptor):
2159         (WebCore::trySetInputStateForPipelineDescriptor):
2160
2161 2019-05-24  Timothy Hatcher  <timothy@apple.com>
2162
2163         Refactor how showLetterpressedGlyphsWithAdvances gets the graphics context.
2164         https://bugs.webkit.org/show_bug.cgi?id=198225
2165
2166         Reviewed by Dean Jackson.
2167
2168         * platform/graphics/cocoa/FontCascadeCocoa.mm:
2169         (WebCore::showLetterpressedGlyphsWithAdvances):
2170         (WebCore::FontCascade::drawGlyphs):
2171
2172 2019-05-24  Timothy Hatcher  <timothy@apple.com>
2173
2174         Plumb dark appearance down to GraphicsContext.
2175         https://bugs.webkit.org/show_bug.cgi?id=198224
2176         rdar://problem/51068494
2177
2178         Reviewed by Dean Jackson.
2179
2180         No test yet, as it is not testable until this gets used.
2181
2182         * platform/graphics/GraphicsContext.cpp:
2183         (WebCore::GraphicsContextStateChange::changesFromState const):
2184         (WebCore::GraphicsContextStateChange::accumulate):
2185         (WebCore::GraphicsContextStateChange::apply const):
2186         (WebCore::GraphicsContextStateChange::dump const):
2187         (WebCore::GraphicsContext::setUseDarkAppearance):
2188         * platform/graphics/GraphicsContext.h:
2189         (WebCore::GraphicsContext::useDarkAppearance const):
2190         * rendering/TextPaintStyle.cpp:
2191         (WebCore::TextPaintStyle::operator== const):
2192         (WebCore::computeTextPaintStyle):
2193         (WebCore::updateGraphicsContext):
2194         * rendering/TextPaintStyle.h:
2195
2196 2019-05-24  Youenn Fablet  <youenn@apple.com>
2197
2198         Make sure completion handler is always called in SWServer::startSuspension
2199         https://bugs.webkit.org/show_bug.cgi?id=198215
2200
2201         Reviewed by Alex Christensen.
2202
2203         * workers/service/server/SWServer.cpp:
2204         (WebCore::SWServer::startSuspension):
2205         Make sure completion handler is called in case of no registration store.
2206
2207 2019-05-24  Ryosuke Niwa  <rniwa@webkit.org>
2208
2209         Asssertion failure in dispatchSubtreeModifiedEvent due to TextFieldInputType updating UA shadow tree inside Element::removedFromAncestor
2210         https://bugs.webkit.org/show_bug.cgi?id=198216
2211
2212         Reviewed by Brent Fulgham.
2213
2214         The bug was caused by ListAttributeTargetObserver::idTargetChanged() updating the shadow tree of an input element
2215         within Element::removedFromAncestor via TextFieldInputType::createDataListDropdownIndicator(). Fixed it by
2216         supressing the assertions with ScriptDisallowedScope::EventAllowedScope since it's always safe to update
2217         UA shadow trees of input elements as it's not exposed to author scripts.
2218
2219         Avoiding the creation of dropdown indicator in this particular scenario is a lot more involved and it's not
2220         particularly correct because there could be another datalist element which matches the ID specified in list
2221         content attribute after the removal of the old datalist element.
2222
2223         Test: fast/forms/datalist/datalist-removal-assertion.html
2224
2225         * html/TextFieldInputType.cpp:
2226         (WebCore::TextFieldInputType::createDataListDropdownIndicator):
2227         (WebCore::TextFieldInputType::createContainer):
2228         * html/shadow/DataListButtonElement.cpp:
2229         (WebCore::DataListButtonElement::DataListButtonElement):
2230
2231 2019-05-24  Saam barati  <sbarati@apple.com>
2232
2233         [WHLSL] ReadModifyWriteExpression always has a result and new value expression
2234         https://bugs.webkit.org/show_bug.cgi?id=198079
2235
2236         Reviewed by Myles Maxfield.
2237
2238         Let's not pretend it might not.
2239
2240         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
2241         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression):
2242         (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression):
2243         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeNewValueExpression):
2244         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeResultExpression):
2245         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
2246         (WebCore::WHLSL::ASTDumper::visit):
2247         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
2248         (WebCore::WHLSL::Checker::visit):
2249         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
2250         (WebCore::WHLSL::PropertyResolver::visit):
2251         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
2252         (WebCore::WHLSL::Visitor::visit):
2253
2254 2019-05-23  Simon Fraser  <simon.fraser@apple.com>
2255
2256         With async overflow scrolling, programmatic scroll to a negative offset fails to clamp the scroll offset
2257         https://bugs.webkit.org/show_bug.cgi?id=198208
2258         <rdar://problem/49720087>
2259
2260         Reviewed by Zalan Bujtas.
2261
2262         RenderLayer::scrollToOffset() needs to pass the clamped offset to scrollingCoordinator->requestScrollPositionUpdate(),
2263         otherwise the scrolling tree will round-trip a negative value and scrollLeft will end up negative.
2264
2265         Test: fast/scrolling/programmatic-scroll-to-negative-offset.html
2266
2267         * rendering/RenderLayer.cpp:
2268         (WebCore::RenderLayer::scrollToOffset):
2269
2270 2019-05-23  Devin Rousso  <drousso@apple.com>
2271
2272         Web Inspector: Overlay: rulers/guides should be shown whenever element selection is enabled
2273         https://bugs.webkit.org/show_bug.cgi?id=198088
2274
2275         Reviewed by Timothy Hatcher.
2276
2277         When trying to "measure" the absolute position (to the viewport) or relative position (to
2278         another element) of a given element, often the easiest way is to enable Element Selection
2279         and Show Rulers at the same time.
2280
2281         This can have the undesired "side-effect" of having the rulers be always present, even when
2282         not highlighting any nodes.
2283
2284         The ideal functionality is to allow the rulers/guides to be shown when element selection is
2285         active and a node is hovered, regardless of whether "Show Rulers" is enabled.
2286
2287         * inspector/InspectorOverlay.h:
2288         (WebCore::InspectorOverlay::setShowRulersDuringElementSelection): Added.
2289         * inspector/InspectorOverlay.cpp:
2290         (WebCore::InspectorOverlay::paint):
2291         (WebCore::InspectorOverlay::shouldShowOverlay):
2292         (WebCore::InspectorOverlay::drawNodeHighlight):
2293         (WebCore::InspectorOverlay::drawQuadHighlight):
2294         (WebCore::InspectorOverlay::drawElementTitle):
2295         If `showRulersDuringElementSelection` is enabled, draw rulers whenever any highlight bounds
2296         are calculated, but don't update the overlay if it's the only thing enabled (e.g. if there's
2297         no currently hovered node, the overlay will disappear).
2298
2299         * inspector/agents/InspectorDOMAgent.cpp:
2300         (WebCore::InspectorDOMAgent::willDestroyFrontendAndBackend):
2301         (WebCore::InspectorDOMAgent::inspect):
2302         (WebCore::InspectorDOMAgent::setInspectModeEnabled):
2303         (WebCore::InspectorDOMAgent::setSearchingForNode):
2304         Add an optional `showRulers` parameter to `DOM.setInspectModeEnabled` that supersedes the
2305         current value of `Page.setShowRulers` as to whether rulers/guides are shown.
2306
2307 2019-05-23  Devin Rousso  <drousso@apple.com>
2308
2309         Web Inspector: Overlay: rulers should switch sides if they intersect the highlighted node(s) so they don't obstruct any content
2310         https://bugs.webkit.org/show_bug.cgi?id=198165
2311
2312         Reviewed by Timothy Hatcher.
2313
2314         If the highlighted node is against the top edge of the screen, the top ruler should shift to
2315         the bottom, unless the highlighted node is also against the bottom edge of the screen.
2316
2317         If the highlighted node is against the left edge of the screen, the left ruler should shift
2318         to the right, unless the highlighted node is also against the right edge of the screen.
2319
2320         This way, unless the node is very wide/tall, the rulers won't be drawn on top of anything
2321         being highlighted.
2322
2323         * inspector/InspectorOverlay.h:
2324         * inspector/InspectorOverlay.cpp:
2325         (WebCore::InspectorOverlay::paint):
2326         (WebCore::InspectorOverlay::drawNodeHighlight):
2327         (WebCore::InspectorOverlay::drawQuadHighlight):
2328         (WebCore::InspectorOverlay::drawBounds):
2329         (WebCore::InspectorOverlay::drawRulers):
2330         Drive-by: create an alias for the type (`FloatRect`) used when calculating the bounds of
2331                   everything that's highlighted.
2332
2333 2019-05-23  Saam barati  <sbarati@apple.com>
2334
2335         [WHLSL] Make the AST dumper disambiguate expressions using parenthesis to represent AST construction
2336         https://bugs.webkit.org/show_bug.cgi?id=198199
2337
2338         Reviewed by Myles C. Maxfield.
2339
2340         We would dump "*foo.bar" for "(*foo).bar", which is super confusing.
2341         We now dump "(*foo).bar".
2342
2343         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
2344         (WebCore::WHLSL::ASTDumper::visit):
2345
2346 2019-05-23  Saam barati  <sbarati@apple.com>
2347
2348         [WHLSL] Don't wrap anonymous variables in parens in the AST dumper
2349         https://bugs.webkit.org/show_bug.cgi?id=198196
2350
2351         Reviewed by Myles C. Maxfield.
2352
2353         This makes the dump of 'foo.bar.x = 42' go from
2354         ($(0x7f86d9d94440) = &foo, $(0x7f86d9d944e0) = operator.bar(*$(0x7f86d9d94440)), $(0x7f86d9d944e0) = operator.x=($(0x7f86d9d944e0), 42), *$(0x7f86d9d94440) = operator.bar=(*$(0x7f86d9d94440), $(0x7f86d9d944e0)));
2355         
2356         to:
2357         ($0x7f86d9d94440 = &foo, $0x7f86d9d944e0 = operator.bar(*$0x7f86d9d94440), $0x7f86d9d944e0 = operator.x=($0x7f86d9d944e0, 42), *$0x7f86d9d94440 = operator.bar=(*$0x7f86d9d94440, $0x7f86d9d944e0));
2358
2359         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
2360         (WebCore::WHLSL::ASTDumper::visit):
2361
2362 2019-05-23  Myles C. Maxfield  <mmaxfield@apple.com>
2363
2364         [WHLSL] Implement property resolver
2365         https://bugs.webkit.org/show_bug.cgi?id=195925
2366         <rdar://problem/48219643>
2367
2368         Unreviewed watchOS build fix.
2369
2370         * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h:
2371         (WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression):
2372
2373 2019-05-23  Saam barati  <sbarati@apple.com>
2374
2375         [WHLSL] Property resolver needs to recurse to handle the base when simplifying rvalues
2376         https://bugs.webkit.org/show_bug.cgi?id=198193
2377
2378         Reviewed by Myles Maxfield.
2379
2380         We were only transforming the top most node in the AST. So things like
2381         'x = foo.bar' would work, but 'x = foo.bar.baz' would not.
2382
2383         Test: webgpu/whlsl-nested-dot-expression-rvalue.html
2384
2385         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
2386         (WebCore::WHLSL::PropertyResolver::simplifyRightValue):
2387
2388 2019-05-22  Stephanie Lewis  <slewis@apple.com>
2389
2390         release builds of webkit cannot be used to generate a dyld shared cache
2391         https://bugs.webkit.org/show_bug.cgi?id=198150
2392         <rdar://problem/50675982>
2393
2394         Reviewed by Dan Bernstein.
2395
2396         Restrict the -not_for_dyld_shared_cache linker flag to macosx
2397
2398         * Configurations/WebCore.xcconfig:
2399
2400 2019-05-23  Zalan Bujtas  <zalan@apple.com>
2401
2402         [Hittest] Move hittesting from RenderView to Document
2403         https://bugs.webkit.org/show_bug.cgi?id=198192
2404         <rdar://problem/51077762>
2405
2406         Reviewed by Antti Koivisto.
2407
2408         RenderView is not refcounted and may be destroyed in updateLayout(), so enter hit-testing from Document.
2409
2410         * accessibility/AccessibilityObject.cpp:
2411         (WebCore::AccessibilityObject::press):
2412         * accessibility/AccessibilityRenderObject.cpp:
2413         (WebCore::AccessibilityRenderObject::visiblePositionForPoint const):
2414         * dom/Document.cpp:
2415         (WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower):
2416         (WebCore::FrameFlatteningLayoutDisallower::~FrameFlatteningLayoutDisallower):
2417         (WebCore::Document::scheduleStyleRecalc):
2418         (WebCore::Document::prepareMouseEvent):
2419         (WebCore::Document::hitTest):
2420         * dom/Document.h:
2421         (WebCore::Document::inHitTesting const):
2422         * dom/TreeScope.cpp:
2423         (WebCore::TreeScope::nodeFromPoint):
2424         (WebCore::TreeScope::elementsFromPoint):
2425         * editing/FrameSelection.cpp:
2426         (WebCore::FrameSelection::contains const):
2427         * html/HTMLPlugInElement.cpp:
2428         (WebCore::HTMLPlugInElement::isReplacementObscured):
2429         * html/MediaElementSession.cpp:
2430         (WebCore::isElementMainContentForPurposesOfAutoplay):
2431         * page/DragController.cpp:
2432         (WebCore::elementUnderMouse):
2433         * page/EventHandler.cpp:
2434         (WebCore::EventHandler::handleMouseDraggedEvent):
2435         (WebCore::EventHandler::eventMayStartDrag const):
2436         (WebCore::EventHandler::updateSelectionForMouseDrag):
2437         (WebCore::EventHandler::hitTestResultAtPoint const):
2438         (WebCore::EventHandler::updateCursor):
2439         (WebCore::EventHandler::isInsideScrollbar const):
2440         (WebCore::EventHandler::handleWheelEvent):
2441         (WebCore::EventHandler::hoverTimerFired):
2442         (WebCore::EventHandler::handleDrag):
2443         (WebCore::hitTestResultInFrame):
2444         * page/FrameViewLayoutContext.cpp:
2445         (WebCore::FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange):
2446         * rendering/RenderView.cpp:
2447         (WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower): Deleted.
2448         (WebCore::FrameFlatteningLayoutDisallower::~FrameFlatteningLayoutDisallower): Deleted.
2449         (): Deleted.
2450         (WebCore::RenderView::hitTest): Deleted.
2451         * rendering/RenderView.h:
2452         * rendering/RenderWidget.cpp:
2453         (WebCore::RenderWidget::nodeAtPoint):
2454         * testing/Internals.cpp:
2455         (WebCore::Internals::nodesFromRect const):
2456
2457 2019-05-23  Youenn Fablet  <youenn@apple.com>
2458
2459         CacheStorageConnection callbacks should be completed on network connection close
2460         https://bugs.webkit.org/show_bug.cgi?id=195757
2461
2462         Reviewed by Alex Christensen.
2463
2464         Move HashMap-based callbacks to WorkerCacheStorageConnection.
2465         Make CacheStorageConnection default API to implement use callbacks.
2466         This is used by WebKit layer to do AsyncReply IPC.
2467
2468         Move DOMCacheEngine callbacks to CompletionHandler.
2469
2470         Test: http/wpt/cache-storage/cache-storage-networkprocess-crash.html
2471
2472         * Modules/cache/CacheStorageConnection.cpp:
2473         * Modules/cache/CacheStorageConnection.h:
2474         (WebCore::CacheStorageConnection::engineRepresentation):
2475         * Modules/cache/DOMCacheEngine.h:
2476         * Modules/cache/WorkerCacheStorageConnection.cpp:
2477         (WebCore::recordsDataFromRecords):
2478         (WebCore::recordsDataOrErrorFromRecords):
2479         (WebCore::recordsFromRecordsData):
2480         (WebCore::recordsOrErrorFromRecordsData):
2481         (WebCore::WorkerCacheStorageConnection::open):
2482         (WebCore::WorkerCacheStorageConnection::openOrRemoveCompleted):
2483         (WebCore::WorkerCacheStorageConnection::remove):
2484         (WebCore::WorkerCacheStorageConnection::retrieveCaches):
2485         (WebCore::WorkerCacheStorageConnection::retrieveCachesCompleted):
2486         (WebCore::WorkerCacheStorageConnection::retrieveRecords):
2487         (WebCore::WorkerCacheStorageConnection::retrieveRecordsCompleted):
2488         (WebCore::WorkerCacheStorageConnection::batchDeleteOperation):
2489         (WebCore::WorkerCacheStorageConnection::deleteRecordsCompleted):
2490         (WebCore::WorkerCacheStorageConnection::batchPutOperation):
2491         (WebCore::WorkerCacheStorageConnection::putRecordsCompleted):
2492         (WebCore::WorkerCacheStorageConnection::reference):
2493         (WebCore::WorkerCacheStorageConnection::dereference):
2494         (WebCore::WorkerCacheStorageConnection::clearPendingRequests):
2495         * Modules/cache/WorkerCacheStorageConnection.h:
2496         * page/CacheStorageProvider.h:
2497         (WebCore::CacheStorageProvider::createCacheStorageConnection):
2498
2499 2019-05-23  Youenn Fablet  <youenn@apple.com>
2500
2501         Multiple videos (with audios) with autoplay & playinline not working. Only one video play at a time.
2502         https://bugs.webkit.org/show_bug.cgi?id=193312
2503         <rdar://problem/47189864>
2504
2505         Reviewed by Jer Noble.
2506
2507         Allow all MediaStream backed video elements to play together.
2508         Any non MediaStream backed video will stop all MediaStream backed video elements.
2509         Conversely, all non MediaStream backed videos will stop when playing one MediaStream backed video.
2510
2511         Refactor PlatformMediaSessionManager as the way to iterate through sessions
2512         is not safe when pausing a session: if playing, the session will be moved in the array of sessions.
2513
2514         To handle this, copy the list of sessions before iterating through them.
2515         For extra safety, make sessions WeakPtr.
2516
2517         Add routines for the case of filtering with a predicate taking a const session.
2518         In that case, we do not copy the vector but iterate through it as a small optimization.
2519
2520         Test: webrtc/concurrentVideoPlayback.html
2521
2522         * html/HTMLMediaElement.cpp:
2523         (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager):
2524         (WebCore::HTMLMediaElement::hasMediaStreamSource const):
2525         * html/HTMLMediaElement.h:
2526         * platform/audio/PlatformMediaSession.cpp:
2527         (WebCore::PlatformMediaSession::activeAudioSessionRequired const):
2528         (WebCore::PlatformMediaSession::canPlayConcurrently const):
2529         (WebCore::PlatformMediaSession::activeAudioSessionRequired): Deleted.
2530         * platform/audio/PlatformMediaSession.h:
2531         (WebCore::PlatformMediaSessionClient::hasMediaStreamSource const):
2532         * platform/audio/PlatformMediaSessionManager.cpp:
2533         (WebCore::PlatformMediaSessionManager::has const):
2534         (WebCore::PlatformMediaSessionManager::activeAudioSessionRequired const):
2535         (WebCore::PlatformMediaSessionManager::canProduceAudio const):
2536         (WebCore::PlatformMediaSessionManager::count const):
2537         (WebCore::PlatformMediaSessionManager::beginInterruption):
2538         (WebCore::PlatformMediaSessionManager::endInterruption):
2539         (WebCore::PlatformMediaSessionManager::addSession):
2540         (WebCore::PlatformMediaSessionManager::removeSession):
2541         (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback):
2542         (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback):
2543         (WebCore::PlatformMediaSessionManager::setCurrentSession):
2544         (WebCore::PlatformMediaSessionManager::currentSession const):
2545         (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive):
2546         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive):
2547         (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground):
2548         (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground):
2549         (WebCore::PlatformMediaSessionManager::systemWillSleep):
2550         (WebCore::PlatformMediaSessionManager::systemDidWake):
2551         (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForDocument):
2552         (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForProcess):
2553         (WebCore::PlatformMediaSessionManager::suspendAllMediaPlaybackForDocument):
2554         (WebCore::PlatformMediaSessionManager::resumeAllMediaPlaybackForDocument):
2555         (WebCore::PlatformMediaSessionManager::suspendAllMediaBufferingForDocument):
2556         (WebCore::PlatformMediaSessionManager::resumeAllMediaBufferingForDocument):
2557         (WebCore::PlatformMediaSessionManager::currentSessionsMatching const):
2558         (WebCore::PlatformMediaSessionManager::forEachMatchingSession):
2559         (WebCore::PlatformMediaSessionManager::forEachMatchingSession const):
2560         (WebCore::PlatformMediaSessionManager::forEachSession):
2561         (WebCore::PlatformMediaSessionManager::anyOfSessions const):
2562         (): Deleted.
2563         (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive const): Deleted.
2564         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const): Deleted.
2565         (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const): Deleted.
2566         (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const): Deleted.
2567         (WebCore::PlatformMediaSessionManager::forEachSession const): Deleted.
2568         (WebCore::PlatformMediaSessionManager::findSession const): Deleted.
2569         * platform/audio/PlatformMediaSessionManager.h:
2570         (WebCore::PlatformMediaSessionManager::anyOfSessions const): Deleted.
2571         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
2572         (MediaSessionManagerCocoa::updateSessionState):
2573         (MediaSessionManagerCocoa::beginInterruption):
2574         * platform/audio/ios/MediaSessionManagerIOS.mm:
2575         (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
2576         (WebCore::MediaSessionManageriOS::externalOutputDeviceAvailableDidChange):
2577
2578 2019-05-23  Saam barati  <sbarati@apple.com>
2579
2580         [WHLSL] Add a helper for in-place AST mutation
2581         https://bugs.webkit.org/show_bug.cgi?id=198175
2582
2583         Reviewed by Myles Maxfield.
2584
2585         This makes WHLSL AST mutation code a bit easier to read and write.
2586         
2587         Code that looked like:
2588         ```
2589         static_assert(sizeof(AST::DereferenceExpression) <= sizeof(AST::DotExpression), "Dot expressions need to be able to become dereference expressions without updating backreferences");
2590         void* location = &dotExpression;
2591         dotExpression.~DotExpression();
2592         auto* dereferenceExpression = new (location) AST::DereferenceExpression(WTFMove(origin), WTFMove(callExpression));
2593         ```
2594         
2595         Can now be:
2596         ```
2597         auto* dereferenceExpression = AST::replaceWith<AST::DereferenceExpression>(dotExpression, WTFMove(origin), WTFMove(callExpression));
2598         ```
2599
2600         * Modules/webgpu/WHLSL/AST/WHLSLNode.h:
2601         (WebCore::WHLSL::AST::replaceWith):
2602         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
2603         (WebCore::WHLSL::NameResolver::visit):
2604         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
2605         (WebCore::WHLSL::PropertyResolver::visit):
2606         (WebCore::WHLSL::PropertyResolver::simplifyRightValue):
2607         (WebCore::WHLSL::LeftValueSimplifier::visit):
2608
2609 2019-05-23  Eric Carlson  <eric.carlson@apple.com>
2610
2611         [macOS,iOS] Add always-on logging for AVPlayerTimeControlStatus changes
2612         https://bugs.webkit.org/show_bug.cgi?id=197946
2613         <rdar://problem/50627457>
2614
2615         Reviewed by Jon Lee.
2616
2617         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2618         (WebCore::convertEnumerationToString):
2619         (WTF::LogArgument<AVPlayerTimeControlStatus>::toString):
2620         (WebCore::MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange):
2621
2622 2019-05-23  Antoine Quint  <graouts@apple.com>
2623
2624         [Pointer Events] Compatibility mouse events can only be prevented while the pointer is pressed
2625         https://bugs.webkit.org/show_bug.cgi?id=198178
2626
2627         Reviewed by Dean Jackson.
2628
2629         Test: pointerevents/mouse/compatibility-mouse-events-prevention-mouse-released.html
2630
2631         The Pointer Events spec, in https://www.w3.org/TR/pointerevents/#compatibility-mapping-with-mouse-events, says that "Mouse events
2632         can only be prevented when the pointer is down. Hovering pointers (e.g. a mouse with no buttons pressed) cannot have their mouse
2633         events prevented." We now track whether the pointer is pressed and clear the preventsCompatibilityMouseEvents when the pointer is
2634         moved and it is not pressed.
2635
2636         * page/PointerCaptureController.cpp:
2637         (WebCore::PointerCaptureController::pointerEventWasDispatched):
2638         * page/PointerCaptureController.h:
2639
2640 2019-05-23  Simon Fraser  <simon.fraser@apple.com>
2641
2642         Build fix after r245695.
2643
2644         * dom/Element.cpp:
2645
2646 2019-05-23  Antoine Quint  <graouts@apple.com>
2647
2648         [Pointer Events] The mouseover, mouseout, mouseenter, and mouseleave events should not be prevented while the pointer is down
2649         https://bugs.webkit.org/show_bug.cgi?id=198177
2650
2651         Reviewed by Dean Jackson.
2652
2653         Test: pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed.html
2654
2655         The Pointer Event spec, in https://www.w3.org/TR/pointerevents/#compatibility-mapping-with-mouse-events, says that "the mouseover,
2656         mouseout, mouseenter, and mouseleave events are never prevented (even if the pointer is down)." We add a new static function which
2657         indicates what is "compatibility" mouse event since those should be excluded, along with "click", which we already excluded.
2658
2659         * dom/Element.cpp:
2660         (WebCore::isCompatibilityMouseEvent):
2661         (WebCore::Element::dispatchMouseEvent):
2662
2663 2019-05-23  Jon Davis  <jond@apple.com>
2664
2665         Update feature status for shipped features
2666         https://bugs.webkit.org/show_bug.cgi?id=196783
2667
2668         Reviewed by Timothy Hatcher.
2669         
2670         Updated feature status for Beacon API, CSS Text Decoration Level 4, Intersection Observer,
2671         Conic Gradients, Datalist Element, and Web Share.
2672
2673         * features.json:
2674
2675 2019-05-23  Simon Fraser  <simon.fraser@apple.com>
2676
2677         Create scrolling tree nodes for descendants of position:absolute inside stacking-context overflow
2678         https://bugs.webkit.org/show_bug.cgi?id=198154
2679
2680         Reviewed by Antti Koivisto.
2681         
2682         There exists code that creates scrolling tree nodes for position:absolute when the containing block
2683         chain skips an enclosing scroller, but the compositing ancestor tree includes the scroller. However
2684         this code explicitly checked that the layer was position:absolute.
2685
2686         This needed to be generalized for any layer whose containing block ancestor chain includes
2687         a position:absolute that skips the scroller, for example a transformed inside a position:absolute,
2688         so remove an explicit isAbsolutelyPositioned() check and some similar assertions.
2689
2690         Test: scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow.html
2691
2692         * rendering/RenderLayerCompositor.cpp:
2693         (WebCore::collectStationaryLayerRelatedOverflowNodes):
2694         (WebCore::RenderLayerCompositor::computeCoordinatedPositioningForLayer const):
2695         (WebCore::collectRelatedCoordinatedScrollingNodes):
2696
2697 2019-05-23  Adrian Perez de Castro  <aperez@igalia.com>
2698
2699         Fix a few missing header inclusions often masked by by unified sources
2700         https://bugs.webkit.org/show_bug.cgi?id=198180
2701
2702         Reviewed by Eric Carlson.
2703
2704         * editing/markup.h: Add missing "FloatSize.h" inclusion.
2705         * html/FeaturePolicy.cpp: Add missing "HTMLParserIdioms.h" inclusion.
2706         * platform/text/TextCodec.cpp: Add missing <cstdio> inclusion.
2707
2708 2019-05-23  Myles C. Maxfield  <mmaxfield@apple.com>
2709
2710         [WHLSL] Implement property resolver
2711         https://bugs.webkit.org/show_bug.cgi?id=195925
2712         <rdar://problem/48219643>
2713
2714         Reviewed by Saam Barati and Robin Morisset.
2715
2716         The property resolver is the thing that replaces dot expressions, index expressions, and
2717         read-modify-write expressions with calls to getters, setters, and anders. This patch doesn't
2718         fully implement the property resolver, but implements enough for simple dot expressions to
2719         work. This is enough for us to be able to test most of the rest of the compiler. Index
2720         expressions and read-modify-write expressions are not fully included in this patch, and will
2721         be finished in a follow-up patch.
2722
2723         The property resolver may introduce anonymous variables in various places. In order to do
2724         this, after the property resolver runs, it will insert all these anonymous variables in the
2725         beginning of the function. However, this means that entries in the VariableDeclarations
2726         vector will all shift, which means VariableDeclarations have to be allocated on the heap so
2727         backreferences to them stay valid. This patch moves the storage associated with these values
2728         to living directly in the vector's storage to living in heap storage (via filling the vector
2729         with UniqueRefs).
2730
2731         This patch also adds the third concept of value-ness. We now have right values, left values,
2732         and abstract left values (for things which have setters but have no address). This addition
2733         is required for the analysis the property resolver performs. This concept is also present in
2734         the spec.
2735
2736         Test: webgpu/whlsl-dot-expressions.html
2737
2738         * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h:
2739         (WebCore::WHLSL::AST::TypeAnnotation::TypeAnnotation):
2740         (WebCore::WHLSL::AST::TypeAnnotation::leftAddressSpace const):
2741         (WebCore::WHLSL::AST::TypeAnnotation::isRightValue const):
2742         (WebCore::WHLSL::AST::TypeAnnotation::visit):
2743         * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h:
2744         (WebCore::WHLSL::AST::AssignmentExpression::takeRight):
2745         * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h:
2746         * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h:
2747         * Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h:
2748         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
2749         (WebCore::WHLSL::AST::Expression::maybeResolvedType):
2750         (WebCore::WHLSL::AST::Expression::resolvedType):
2751         (WebCore::WHLSL::AST::Expression::maybeTypeAnnotation const):
2752         (WebCore::WHLSL::AST::Expression::typeAnnotation const):
2753         (WebCore::WHLSL::AST::Expression::setTypeAnnotation):
2754         (WebCore::WHLSL::AST::Expression::addressSpace const): Deleted.
2755         (WebCore::WHLSL::AST::Expression::setAddressSpace): Deleted.
2756         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h:
2757         (WebCore::WHLSL::AST::FloatLiteral::clone const):
2758         * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h:
2759         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp:
2760         (WebCore::WHLSL::AST::IntegerLiteral::valueForSelectedType const):
2761         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h:
2762         (WebCore::WHLSL::AST::IntegerLiteral::clone const):
2763         * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h:
2764         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression):
2765         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::leftValue):
2766         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue): Deleted.
2767         * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h:
2768         (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression):
2769         (WebCore::WHLSL::AST::MakePointerExpression::leftValue):
2770         (WebCore::WHLSL::AST::MakePointerExpression::lValue): Deleted.
2771         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h:
2772         (WebCore::WHLSL::AST::NullLiteral::clone const):
2773         * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h:
2774         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetterOverloads):
2775         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetterOverloads):
2776         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAnderOverloads):
2777         (WebCore::WHLSL::AST::PropertyAccessExpression::getterFunction):
2778         (WebCore::WHLSL::AST::PropertyAccessExpression::anderFunction):
2779         (WebCore::WHLSL::AST::PropertyAccessExpression::threadAnderFunction):
2780         (WebCore::WHLSL::AST::PropertyAccessExpression::setterFunction):
2781         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetterOverloads):
2782         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAnderOverloads):
2783         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetterOverloads):
2784         (WebCore::WHLSL::AST::PropertyAccessExpression::setGetterFunction):
2785         (WebCore::WHLSL::AST::PropertyAccessExpression::setAnderFunction):
2786         (WebCore::WHLSL::AST::PropertyAccessExpression::setThreadAnderFunction):
2787         (WebCore::WHLSL::AST::PropertyAccessExpression::setSetterFunction):
2788         (WebCore::WHLSL::AST::PropertyAccessExpression::takeBase):
2789         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetOverloads): Deleted.
2790         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetOverloads): Deleted.
2791         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAndOverloads): Deleted.
2792         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetOverloads): Deleted.
2793         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetOverloads): Deleted.
2794         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAndOverloads): Deleted.
2795         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
2796         (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference):
2797         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference):
2798         (WebCore::WHLSL::AST::ReadModifyWriteExpression::leftValue):
2799         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeLeftValue):
2800         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeOldValue):
2801         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeNewValue):
2802         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeNewValueExpression):
2803         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeResultExpression):
2804         (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression):
2805         (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue): Deleted.
2806         * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h:
2807         (WebCore::WHLSL::AST::ResolvableType::maybeResolvedType const):
2808         (WebCore::WHLSL::AST::ResolvableType::resolvedType const):
2809         (WebCore::WHLSL::AST::ResolvableType::maybeResolvedType):
2810         (WebCore::WHLSL::AST::ResolvableType::resolvedType):
2811         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp:
2812         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const):
2813         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp:
2814         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const):
2815         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp:
2816         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const):
2817         * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h:
2818         (WebCore::WHLSL::AST::StructureDefinition::find):
2819         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
2820         (WebCore::WHLSL::AST::TypeReference::maybeResolvedType const):
2821         (WebCore::WHLSL::AST::TypeReference::resolvedType const):
2822         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp:
2823         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::valueForSelectedType const):
2824         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h:
2825         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const):
2826         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
2827         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h:
2828         (WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement):
2829         (WebCore::WHLSL::AST::VariableDeclarationsStatement::variableDeclarations):
2830         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
2831         (WebCore::WHLSL::Metal::attributeForSemantic):
2832         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledInputPath):
2833         (WebCore::WHLSL::Metal::EntryPointScaffolding::unpackResourcesAndNamedBuiltIns):
2834         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::helperTypes):
2835         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::unpack):
2836         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
2837         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::visit):
2838         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
2839         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
2840         (WebCore::WHLSL::Metal::writeNativeFunction):
2841         * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp:
2842         (WebCore::WHLSL::Metal::writeNativeType):
2843         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
2844         (WebCore::WHLSL::Metal::findInVector):
2845         (WebCore::WHLSL::Metal::TypeNamer::visit):
2846         (WebCore::WHLSL::Metal::TypeNamer::createNameNode):
2847         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
2848         (WebCore::WHLSL::ASTDumper::visit):
2849         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp:
2850         (WebCore::WHLSL::checkDuplicateFunctions):
2851         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
2852         (WebCore::WHLSL::resolveWithOperatorAnderIndexer):
2853         (WebCore::WHLSL::resolveWithOperatorLength):
2854         (WebCore::WHLSL::resolveWithReferenceComparator):
2855         (WebCore::WHLSL::resolveByInstantiation):
2856         (WebCore::WHLSL::checkOperatorOverload):
2857         (WebCore::WHLSL::Checker::assignTypes):
2858         (WebCore::WHLSL::commit):
2859         (WebCore::WHLSL::Checker::visit):
2860         (WebCore::WHLSL::Checker::recurseAndGetInfo):
2861         (WebCore::WHLSL::Checker::getInfo):
2862         (WebCore::WHLSL::Checker::assignType):
2863         (WebCore::WHLSL::Checker::forwardType):
2864         (WebCore::WHLSL::getUnnamedType):
2865         (WebCore::WHLSL::Checker::finishVisitingPropertyAccess): Deleted.
2866         (WebCore::WHLSL::Checker::recurseAndWrapBaseType): Deleted.
2867         * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp:
2868         (WebCore::WHLSL::Gatherer::takeEntryPointItems):
2869         (WebCore::WHLSL::Gatherer::visit):
2870         * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp:
2871         (WebCore::WHLSL::matchAndCommit):
2872         (WebCore::WHLSL::commit):
2873         (WebCore::WHLSL::inferTypesForCall):
2874         * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp:
2875         (WebCore::WHLSL::getNativeTypeDeclaration):
2876         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
2877         (WebCore::WHLSL::NameResolver::visit):
2878         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
2879         (WebCore::WHLSL::Parser::parseParameters):
2880         (WebCore::WHLSL::Parser::parseVariableDeclarations):
2881         * Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h:
2882         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
2883         (WebCore::WHLSL::prepareShared):
2884         * Modules/webgpu/WHLSL/WHLSLPrepare.h:
2885         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp: Added.
2886         (WebCore::WHLSL::PropertyResolver::visit):
2887         (WebCore::WHLSL::setterCall):
2888         (WebCore::WHLSL::getterCall):
2889         (WebCore::WHLSL::modify):
2890         (WebCore::WHLSL::PropertyResolver::simplifyRightValue):
2891         (WebCore::WHLSL::LeftValueSimplifier::visit):
2892         (WebCore::WHLSL::PropertyResolver::simplifyLeftValue):
2893         (WebCore::WHLSL::resolveProperties):
2894         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h.
2895         * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp:
2896         (WebCore::WHLSL::RecursiveTypeChecker::visit):
2897         * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp:
2898         (WebCore::WHLSL::conversionCost):
2899         * Modules/webgpu/WHLSL/WHLSLResolvingType.h:
2900         (WebCore::WHLSL::ResolvingType::getUnnamedType):
2901         * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt:
2902         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
2903         (WebCore::WHLSL::FindArrayTypes::takeArrayTypes):
2904         (WebCore::WHLSL::synthesizeArrayOperatorLength):
2905         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
2906         (WebCore::WHLSL::FindAllTypes::takeUnnamedTypes):
2907         (WebCore::WHLSL::FindAllTypes::takeNamedTypes):
2908         (WebCore::WHLSL::synthesizeConstructors):
2909         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
2910         (WebCore::WHLSL::synthesizeEnumerationFunctions):
2911         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
2912         (WebCore::WHLSL::synthesizeStructureAccessors):
2913         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
2914         (WebCore::WHLSL::Visitor::visit):
2915         * Modules/webgpu/WHLSL/WHLSLVisitor.h:
2916         * Sources.txt:
2917         * WebCore.xcodeproj/project.pbxproj:
2918         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
2919         (WebCore::trySetWHLSLFunctionsForPipelineDescriptor):
2920
2921 2019-05-22  Myles C. Maxfield  <mmaxfield@apple.com>
2922
2923         font-optical-sizing applies the wrong variation value
2924         https://bugs.webkit.org/show_bug.cgi?id=197528
2925         <rdar://problem/50152854>
2926
2927         Reviewed by Antti Koivisto.
2928
2929         The OpenType spec says in
2930         https://docs.microsoft.com/en-us/typography/opentype/spec/dvaraxistag_opsz
2931
2932         "Scale interpretation: Values can be interpreted as text size, in points."
2933
2934         It turns out that it means "typographic point size" which is equal to CSS pixels, not
2935         CSS points.
2936
2937         There are two parts of the font that are sensitive to optical sizing: variation values and
2938         the trak table. We don't want to set the variation value directly because then the trak table
2939         won't be affected. Instead, we can use kCTFontOpticalSizeAttribute to set both of them together.
2940         We will only do this when the CSS says text-rendering:optimizeLegibility or when the font has
2941         an opsz axis but no STAT table. Otherwise, we won't do anything special, which lets CoreText
2942         handle the default behavior for us. This gives us the same default behavior as the rest of the
2943         system.
2944
2945         Tests: fast/text/variations/optical-sizing-trak-2.html
2946                fast/text/variations/optical-sizing-trak.html
2947                fast/text/variations/optical-sizing-units-2.html
2948                fast/text/variations/optical-sizing-units.html
2949
2950         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2951         (WebCore::FontType::FontType):
2952         (WebCore::preparePlatformFont):
2953         (WebCore::fontWithFamily):
2954         (WebCore::FontCache::systemFallbackForCharacters):
2955         * platform/graphics/cocoa/FontCacheCoreText.h:
2956         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
2957         (WebCore::FontFamilySpecificationCoreText::fontRanges const):
2958         * platform/graphics/mac/FontCustomPlatformData.cpp:
2959         (WebCore::FontCustomPlatformData::fontPlatformData):
2960
2961 2019-05-22  Antti Koivisto  <antti@apple.com>
2962
2963         Subselectors not searched when determining property whitelist for selector
2964         https://bugs.webkit.org/show_bug.cgi?id=198147
2965         <rdar://problem/50405208>
2966
2967         Reviewed by Zalan Bujtas.
2968
2969         This can cause marker elements get style they shouldn't.
2970
2971         Test: fast/lists/marker-style-subselector-whitelist.html
2972
2973         * css/RuleSet.cpp:
2974         (WebCore::determinePropertyWhitelistType):
2975
2976         Check subselectors too.
2977
2978 2019-05-22  Saam barati  <sbarati@apple.com>
2979
2980         WHLSL: fix enum parsing
2981         https://bugs.webkit.org/show_bug.cgi?id=198087
2982
2983         Reviewed by Myles Maxfield.
2984
2985         This fixes two bugs:
2986         
2987         1. We were using a String by reference after moving the underlying owner of
2988         the string. This would lead to the String becoming the empty value, and
2989         crashing when used as a key in a hash map.
2990         2. We were incorrectly producing a syntax error for enum declarations by
2991         saying it's invalid if an enum value was added to a hash map for the first
2992         time. This logic should be negated. We need to error when it's added for
2993         the second time and onwards.
2994
2995         Test: webgpu/whlsl-dont-crash-parsing-enum.html
2996
2997         * Modules/webgpu/WHLSL/AST/WHLSLAST.h: Replaced.
2998         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h:
2999         (WebCore::WHLSL::AST::EnumerationDefinition::add):
3000         * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMember.h:
3001         (WebCore::WHLSL::AST::EnumerationMember::name):
3002         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp: Replaced.
3003         (WebCore::WHLSL::ASTDumper::visit):
3004         * Modules/webgpu/WHLSL/WHLSLASTDumper.h: Replaced.
3005
3006 2019-05-22  Simon Fraser  <simon.fraser@apple.com>
3007
3008         Fix scrolling tree state for more obscure combinations of positioning and paint order
3009         https://bugs.webkit.org/show_bug.cgi?id=198139
3010
3011         Reviewed by Antti Koivisto.
3012
3013         There were three places in RenderLayerCompositor that used a version of ancestor
3014         layer traversal looking at containing blocks, and all three had issues. So make a
3015         shared function to do the ancestor walk, and use it thrice.
3016
3017         isScrolledByOverflowScrollLayer() fumbled containingBlockCanSkipLayers, so failed
3018         to create a scrolling tree node for a composited layer inside position:fixed in
3019         overflow (tested by composited-in-absolute-in-overflow.html).
3020
3021         collectStationaryLayerRelatedOverflowNodes() failed to handle nested
3022         overflow:scroll; it needs to find all the composited scrollers that affect the
3023         position of the given layer relative to its compositing ancestor, which may be the
3024         scroller, or a descendant of the scroller. However, it didn't walk up far enough
3025         and find more that one ancestor. Tested by absolute-in-nested-sc-scrollers.html.
3026
3027         enclosingClippingScopes() was OK but now uses the share function.
3028
3029         Tests: scrollingcoordinator/scrolling-tree/absolute-in-nested-sc-scrollers.html
3030                scrollingcoordinator/scrolling-tree/composited-in-absolute-in-overflow.html
3031
3032         * rendering/RenderLayerCompositor.cpp:
3033         (WebCore::traverseAncestorLayers):
3034         (WebCore::enclosingClippingScopes):
3035         (WebCore::isScrolledByOverflowScrollLayer):
3036         (WebCore::collectStationaryLayerRelatedOverflowNodes):
3037         (WebCore::collectRelatedCoordinatedScrollingNodes):
3038
3039 2019-05-22  Simon Fraser  <simon.fraser@apple.com>
3040
3041         Inner scroller of nested overflow:scrolls jitters when scrolling
3042         https://bugs.webkit.org/show_bug.cgi?id=198131
3043
3044         Reviewed by Antti Koivisto.
3045
3046         enclosingCompositedScrollingLayer(layer) would return the layer itself, rather than
3047         its scrolling ancestor, which meant that a composited scroller nested inside another
3048         scroller would fail to get a "Moves" scrolling tree node, and therefore jitter
3049         when scrolling.
3050
3051         Test: scrollingcoordinator/scrolling-tree/nested-overflow-scroll.html
3052
3053         * rendering/RenderLayerCompositor.cpp:
3054         (WebCore::enclosingCompositedScrollingLayer):
3055
3056 2019-05-22  Ryan Haddad  <ryanhaddad@apple.com>
3057
3058         Unreviewed, rolling out r245598.
3059
3060         Breaks watchOS build.
3061
3062         Reverted changeset:
3063
3064         "font-optical-sizing applies the wrong variation value"
3065         https://bugs.webkit.org/show_bug.cgi?id=197528
3066         https://trac.webkit.org/changeset/245598
3067
3068 2019-05-22  Daniel Bates  <dabates@apple.com>
3069
3070         WebKit does not generate an ESC key event for CMD+.
3071         https://bugs.webkit.org/show_bug.cgi?id=198137
3072         <rdar://problem/51038641>
3073
3074         Reviewed by Brent Fulgham.
3075
3076         This patch maps the Command + '.' keystroke to the 'Escape'. This also requires a change to UIKit to properly pass
3077         the key state to WebKit (see <rdar://problem/46431552>).
3078
3079         * platform/ios/WebEvent.mm:
3080         (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:withInputManagerHint:keyCode:isTabKey:]):
3081
3082 2019-05-22  Ali Juma  <ajuma@chromium.org>
3083
3084         Intersection Observer: bounding client rect is wrong for an inline element
3085         https://bugs.webkit.org/show_bug.cgi?id=198009
3086
3087         Reviewed by Simon Fraser.
3088
3089         Make target rect computation for inline elements share logic with the computation
3090         of bounding client rects.
3091
3092         Test: imported/w3c/web-platform-tests/intersection-observer/inline-with-block-child-client-rect.html
3093
3094         * dom/Document.cpp:
3095         (WebCore::computeIntersectionState):
3096         * dom/Element.cpp:
3097         (WebCore::Element::boundingAbsoluteRectWithoutLayout):
3098         (WebCore::Element::boundingClientRect):
3099         * dom/Element.h:
3100
3101 2019-05-22  Antoine Quint  <graouts@apple.com>
3102
3103         [iOS] Compatibility mouse events aren't prevented by calling preventDefault() on pointerdown
3104         https://bugs.webkit.org/show_bug.cgi?id=198124
3105         <rdar://problem/50410863>
3106
3107         Reviewed by Tim Horton.
3108
3109         This fix builds atop the one made for wkb.ug/198072 which fixes this bug on macOS alone.
3110
3111         In order to correctly prevent "compatibility" mouse events from being dispatched when the initial "pointerdown" event had preventDefault()
3112         called while handled, we need to pass the PointerID for the touch that triggered a tap gesture in the UI process down in the Web process
3113         and into the resulting PlatformMouseEvent. This will allow upon dispatch of a PlatformMouseEvent to call into PointerCaptureController
3114         to identify if the dispatch of mouse events is allowed for the event's PointerID.
3115
3116         To support this, some refactoring was required. The PointerID header is now under platform/ such that PlatformMouseEvent may safely use it.
3117         Additionally, PointerEvent::defaultMousePointerIdentifier() is now a global mousePointerID defined in PointerID.h.
3118
3119         Finally, PointerCaptureController::touchEndedOrWasCancelledForIdentifier() has been renamed to PointerCaptureController::touchWithIdentifierWasRemoved() and
3120         has WEBCORE_EXPORT such that it may be called from WebKit as the indication that a pointer is no longer active will now be initiated in WebKit
3121         on the UI process side.
3122
3123         Testing is covered by the pre-existing imported/w3c/web-platform-tests/pointerevents/pointerevent_suppress_compat_events_on_click.html
3124         which will now run on iOS through a change to WebKitAdditions.
3125
3126         * Headers.cmake:
3127         * WebCore.xcodeproj/project.pbxproj:
3128         * dom/Element.cpp:
3129         (WebCore::Element::dispatchMouseEvent): When dealing with a mouse event on iOS, check whether the mouse event's PointerID allows for compatibility
3130         mouse events to be dispatched using PointerCaptureController::preventsCompatibilityMouseEventsForIdentifier(). The "click" event is not a compatibility
3131         mouse event.
3132         * dom/PointerEvent.h:
3133         * page/PointerCaptureController.cpp:
3134         (WebCore::PointerCaptureController::PointerCaptureController):
3135         (WebCore::PointerCaptureController::touchWithIdentifierWasRemoved):
3136         (WebCore::PointerCaptureController::touchEndedOrWasCancelledForIdentifier): Deleted.
3137         * page/PointerCaptureController.h:
3138         * platform/PlatformMouseEvent.h:
3139         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
3140         (WebCore::PlatformMouseEvent::pointerId const):
3141         * platform/PointerID.h: Renamed from Source/WebCore/dom/PointerID.h.
3142         (WebCore::mousePointerID):
3143
3144 2019-05-22  Jiewen Tan  <jiewen_tan@apple.com>
3145
3146         [WebAuthN] Support Attestation Conveyance Preference
3147         https://bugs.webkit.org/show_bug.cgi?id=192722
3148         <rdar://problem/49939647>
3149
3150         Reviewed by Brent Fulgham.
3151
3152         This patch implements https://www.w3.org/TR/webauthn/#enumdef-attestationconveyancepreference, together with
3153         Step 20 with regard to AttestationConveyancePreference of https://www.w3.org/TR/webauthn/#createCredential.
3154         Few notes with regard to Step 20: 1) We treat indirect attestation as direct attestation as we don't MITM
3155         the attestation process; 2) We won't distinguish self attestation and return it to keep consistency between
3156         the response and the request. If callers want none attestation, they will very likely ignore fmt and attStmt
3157         of the attestation object, and therefore it is meaningless to return self attestation.
3158
3159         Covered by new tests within existing files.
3160
3161         * CMakeLists.txt:
3162         * DerivedSources-input.xcfilelist:
3163         * DerivedSources-output.xcfilelist:
3164         * DerivedSources.make:
3165         * Headers.cmake:
3166         * Modules/webauthn/AttestationConveyancePreference.h: Copied from Source/WebCore/Modules/webauthn/WebAuthenticationUtils.h.
3167         * Modules/webauthn/AttestationConveyancePreference.idl: Copied from Source/WebCore/Modules/webauthn/WebAuthenticationUtils.h.
3168         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
3169         (WebCore::PublicKeyCredentialCreationOptions::encode const):
3170         (WebCore::PublicKeyCredentialCreationOptions::decode):
3171         * Modules/webauthn/PublicKeyCredentialCreationOptions.idl:
3172         * Modules/webauthn/WebAuthenticationConstants.h:
3173         * Modules/webauthn/WebAuthenticationUtils.cpp:
3174         (WebCore::buildAttestationObject):
3175         * Modules/webauthn/WebAuthenticationUtils.h:
3176         * Modules/webauthn/fido/DeviceResponseConverter.cpp:
3177         (fido::readCTAPMakeCredentialResponse):
3178         * Modules/webauthn/fido/DeviceResponseConverter.h:
3179         * Modules/webauthn/fido/FidoConstants.h:
3180         noneAttestationValue is moved to WebAuthenticationConstants.h.
3181         * Modules/webauthn/fido/U2fResponseConverter.cpp:
3182         (fido::readU2fRegisterResponse):
3183         * Modules/webauthn/fido/U2fResponseConverter.h:
3184         * Sources.txt:
3185         * WebCore.xcodeproj/project.pbxproj:
3186
3187 2019-05-22  Zalan Bujtas  <zalan@apple.com>
3188
3189         [Paste] Add support for preferred presentation size when pasting an image
3190         https://bugs.webkit.org/show_bug.cgi?id=198132
3191         <rdar://problem/50886917>
3192
3193         Reviewed by Wenson Hsieh.
3194
3195         Set the pasted <img> width/height attributes when the preferred presentation size is available.
3196
3197         * editing/WebContentReader.h:
3198         * editing/cocoa/WebContentReaderCocoa.mm:
3199         (WebCore::createFragmentForImageAttachment):
3200         (WebCore::WebContentReader::readImage):
3201         * editing/markup.cpp:
3202         (WebCore::createFragmentForImageAndURL):
3203         * editing/markup.h:
3204         * platform/Pasteboard.h:
3205         (WebCore::PasteboardWebContentReader::readImage):
3206         * platform/PasteboardItemInfo.h:
3207         (WebCore::PasteboardItemInfo::encode const):
3208         (WebCore::PasteboardItemInfo::decode):
3209         * platform/ios/PasteboardIOS.mm:
3210         (WebCore::Pasteboard::readPasteboardWebContentDataForType):
3211         (WebCore::Pasteboard::read):
3212         (WebCore::Pasteboard::readRespectingUTIFidelities):
3213         * platform/ios/PlatformPasteboardIOS.mm:
3214         (WebCore::PlatformPasteboard::informationForItemAtIndex):
3215
3216 2019-05-22  Jer Noble  <jer.noble@apple.com>
3217
3218         Hide MediaCapabilities.encodingInfo() when the platform does not support it.
3219         https://bugs.webkit.org/show_bug.cgi?id=197476
3220
3221         Reviewed by Eric Carlson.
3222
3223         Test: platform/mac/media/mediacapabilities/mediacapabilities-encodingInfo-undefined.html
3224
3225         Add a new IDL attribute, CustomEnabled, which allows non Settings-based enabling of attributes and objects.
3226
3227         * Modules/mediacapabilities/MediaCapabilities.idl:
3228         * WebCore.xcodeproj/project.pbxproj:
3229         * bindings/js/JSMediaCapabilitiesCustom.h: Copied from Source/WebCore/Modules/mediacapabilities/MediaCapabilities.idl.
3230         (WebCore::JSMediaCapabilitiesEncodingInfoIsEnabled):
3231         * bindings/scripts/CodeGeneratorJS.pm:
3232         (NeedsRuntimeCheck):
3233         (GenerateRuntimeEnableConditionalString):
3234         * bindings/scripts/IDLAttributes.json:
3235         * bindings/scripts/preprocess-idls.pl:
3236         (GenerateConstructorAttributes):
3237         * platform/mediacapabilities/MediaEngineConfigurationFactory.cpp:
3238         (WebCore::MediaEngineConfigurationFactory::hasDecodingConfigurationFactory):
3239         (WebCore::MediaEngineConfigurationFactory::hasEncodingConfigurationFactory):
3240         * platform/mediacapabilities/MediaEngineConfigurationFactory.h:
3241
3242 2019-05-22  Youenn Fablet  <youenn@apple.com>
3243
3244         Implement Feature policy self/none/* parsing
3245         https://bugs.webkit.org/show_bug.cgi?id=198078
3246
3247         Reviewed by Eric Carlson.
3248
3249         Start to implement https://w3c.github.io/webappsec-feature-policy/#algo-parse-policy-directive
3250         'src' is not supported yet.
3251         Apply the rules to getUserMedia.
3252         Update getDisplayMedia keyword from 'display' to 'display-capture' as per spec.
3253
3254         Test: imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-feature-policy-none.https.html
3255
3256         * Headers.cmake:
3257         * Modules/mediastream/UserMediaController.cpp:
3258         (WebCore::isSecure):
3259         (WebCore::isAllowedByFeaturePolicy):
3260         (WebCore::isAllowedToUse):
3261         * Sources.txt:
3262         * WebCore.xcodeproj/project.pbxproj:
3263         * html/FeaturePolicy.cpp: Added.
3264         (WebCore::isAllowedByFeaturePolicy):
3265         (WebCore::processOriginItem):
3266         (WebCore::updateList):
3267         (WebCore::FeaturePolicy::parse):
3268         (WebCore::FeaturePolicy::allows const):
3269         * html/FeaturePolicy.h: Added.
3270         * html/HTMLIFrameElement.cpp:
3271         (WebCore::HTMLIFrameElement::featurePolicy const):
3272         * html/HTMLIFrameElement.h:
3273
3274 2019-05-21  Jer Noble  <jer.noble@apple.com>
3275
3276         Media controls don't show in WK2 video fullscreen sometimes
3277         https://bugs.webkit.org/show_bug.cgi?id=198094
3278         <rdar://problem/50970661>
3279
3280         Reviewed by Tim Horton.
3281
3282         Ensure that the WebAVPlayerLayer never allows hit testing, as this keeps touches from reaching
3283         AVKit's controls.
3284
3285         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
3286         (-[WebAVPlayerLayer init]):
3287
3288 2019-05-21  Saam barati  <sbarati@apple.com>
3289
3290         WHLSL: Add an AST dumper
3291         https://bugs.webkit.org/show_bug.cgi?id=198059
3292
3293         Reviewed by Myles Maxfield.
3294
3295         This patch makes it so we can dump the WHLSL program's AST.
3296         This will become useful when we're debugging passes that
3297         transform the AST.
3298         
3299         The dumper mostly prints in a style where the dump is almost
3300         valid WHLSL code. E.g, this WHLSL program:
3301         ```
3302         int foo(int arg) {
3303             return arg + 1;
3304         }
3305         ```
3306         
3307         gets dumped as:
3308         ```
3309         int foo(int arg) {
3310            return operator+(arg, 1);
3311         }
3312         ```
3313         
3314         This patch also adds a way to dump between each pass, after
3315         parsing, or at the end of all passes. Currently, this is controlled
3316         by a static variable. I'll make these runtime configurable in a follow
3317         up: https://bugs.webkit.org/show_bug.cgi?id=198097
3318
3319         No new tests because this is used for logging.
3320
3321         * Modules/webgpu/WHLSL/AST/WHLSLAST.h: Added.
3322         * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h:
3323         (WebCore::WHLSL::AST::toString):
3324         * Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.h:
3325         (WebCore::WHLSL::AST::BuiltInSemantic::toString const):
3326         * Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h:
3327         (WebCore::WHLSL::AST::toString):
3328         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.h:
3329         (WebCore::WHLSL::AST::ResourceSemantic::toString):
3330         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
3331         (WebCore::WHLSL::Metal::toString): Deleted.
3332         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp: Added.
3333         (WebCore::WHLSL::ASTDumper::visit):
3334         * Modules/webgpu/WHLSL/WHLSLASTDumper.h: Added.
3335         (WebCore::WHLSL::ASTDumper::toString):
3336         (WebCore::WHLSL::ASTDumper::Indent::Indent):
3337         (WebCore::WHLSL::ASTDumper::bumpIndent):
3338         (WebCore::WHLSL::toString):
3339         (WebCore::WHLSL::dumpAST):
3340         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
3341         (WebCore::WHLSL::dumpASTIfNeeded):
3342         (WebCore::WHLSL::dumpASTAfterParsingIfNeeded):
3343         (WebCore::WHLSL::dumpASTBetweenEachPassIfNeeded):
3344         (WebCore::WHLSL::dumpASTAtEndIfNeeded):
3345         (WebCore::WHLSL::prepareShared):
3346         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
3347         * Sources.txt:
3348         * WebCore.xcodeproj/project.pbxproj:
3349
3350 2019-05-21  Saam barati  <sbarati@apple.com>
3351
3352         WHLSL: Parsing negative int literals parses the positive value instead
3353         https://bugs.webkit.org/show_bug.cgi?id=198096
3354
3355         Reviewed by Dean Jackson.
3356
3357         I also made the code around < INT_MIN a bit easier to follow along with.
3358
3359         No new tests because we haven't imported WHLSL test suite yet.
3360         Verified this works using the AST dumper.
3361
3362         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
3363         (WebCore::WHLSL::intLiteralToInt):
3364
3365 2019-05-21  Myles C. Maxfield  <mmaxfield@apple.com>
3366
3367         font-optical-sizing applies the wrong variation value
3368         https://bugs.webkit.org/show_bug.cgi?id=197528
3369         <rdar://problem/50152854>
3370
3371         Reviewed by Antti Koivisto.
3372
3373         The OpenType spec says in
3374         https://docs.microsoft.com/en-us/typography/opentype/spec/dvaraxistag_opsz
3375
3376         "Scale interpretation: Values can be interpreted as text size, in points."
3377
3378         It turns out that it means "typographic point size" which is equal to CSS pixels, not
3379         CSS points.
3380
3381         There are two parts of the font that are sensitive to optical sizing: variation values and
3382         the trak table. We don't want to set the variation value directly because then the trak table
3383         won't be affected. Instead, we can use kCTFontOpticalSizeAttribute to set both of them together.
3384         We will only do this when the CSS says text-rendering:optimizeLegibility or when the font has
3385         an opsz axis but no STAT table. Otherwise, we won't do anything special, which lets CoreText
3386         handle the default behavior for us. This gives us the same default behavior as the rest of the
3387         system.
3388
3389         Tests: fast/text/variations/optical-sizing-trak-2.html
3390                fast/text/variations/optical-sizing-trak.html
3391                fast/text/variations/optical-sizing-units.html
3392                fast/text/variations/optical-sizing-units-2.html
3393
3394         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3395         (WebCore::FontType::FontType):
3396         (WebCore::preparePlatformFont):
3397         (WebCore::fontWithFamily):
3398         (WebCore::FontCache::systemFallbackForCharacters):
3399         * platform/graphics/cocoa/FontCacheCoreText.h:
3400         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
3401         (WebCore::FontFamilySpecificationCoreText::fontRanges const):
3402         * platform/graphics/mac/FontCustomPlatformData.cpp:
3403         (WebCore::FontCustomPlatformData::fontPlatformData):
3404
3405 2019-05-21  Simon Fraser  <simon.fraser@apple.com>
3406
3407         Layer flashing and poor perf during scrolling of message list on gmail.com and hotmail.com - overlap testing needs to constrained to clipping scopes
3408         https://bugs.webkit.org/show_bug.cgi?id=198091
3409         <rdar://problem/49403082>
3410
3411         Reviewed by Antti Koivisto.
3412         
3413         When overflow:scroll is scrolled asynchronously, we need to have already created compositing layers where necessary
3414         for clipped-out layers in the scrolled content so that we have something to reveal. We also have ensure
3415         that layers inside the scroller (but scrolled out of view) don't trigger overlap with layers outside the scroller.
3416         All this has to work when the containing block hierarchy (clipping/scrolling) doesn't match the paint order hierarchy (structure
3417         of the z-order and compositing trees).
3418
3419         Overlap testing previously simply used a list of rectangles per compositing container (OverlapMapContainer). This is
3420         a series of layer bounds, built up as we traver the layer tree in z-order. Layers contribute to container N-2, and test
3421         against container N-1.
3422         
3423         To handle overlap with non-stacking-context scrollers, introduce the concept of a ClippingScope, which encompasses
3424         a set of layers sharing the same composited-scrolling containing-block ancestor. Within a ClippingScope, layer bounds
3425         are computed unclipped. Between them, bounds are tested clipped.
3426         
3427         Conceptually, each OverlapMapContainer has a tree of ClippingScopes (reflecting the containing-block order tree of
3428         composited overflow scroll), and rects are added to the appropriate ClippingScope. This tree is currently always
3429         root-relative; the root node is the RenderView's RenderLayer, and will accumulate the bounds of layers not inside
3430         composited overflow scroll (just like the old code).
3431         
3432         When a OverlapMapContainer is popped, the list of rectangles in its ClippingScope tree is merged with that of the previous
3433         container.
3434
3435         Tests: compositing/layer-creation/clipping-scope/nested-scroller-overlap.html
3436                compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller.html
3437                compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller.html
3438                compositing/layer-creation/clipping-scope/scroller-with-negative-z-children.html
3439                compositing/layer-creation/clipping-scope/shared-layers-in-scroller.html
3440
3441         * rendering/LayerOverlapMap.cpp:
3442         (WebCore::operator<<):
3443         (WebCore::OverlapMapContainer::OverlapMapContainer):
3444         (WebCore::OverlapMapContainer::ClippingScope::ClippingScope):
3445         (WebCore::OverlapMapContainer::ClippingScope::childWithLayer const):
3446         (WebCore::OverlapMapContainer::ClippingScope::addChildWithLayerAndBounds):
3447         (WebCore::OverlapMapContainer::ClippingScope::addChild):
3448         (WebCore::OverlapMapContainer::ClippingScope::appendRect):
3449         (WebCore::OverlapMapContainer::clippingScopeContainingLayerChildRecursive):
3450         (WebCore::OverlapMapContainer::scopeContainingLayer const):
3451         (WebCore::OverlapMapContainer::rootScope const):
3452         (WebCore::OverlapMapContainer::rootScope):
3453         (WebCore::OverlapMapContainer::add):
3454         (WebCore::OverlapMapContainer::overlapsLayers const):
3455         (WebCore::OverlapMapContainer::mergeClippingScopesRecursive):
3456         (WebCore::OverlapMapContainer::append):
3457         (WebCore::OverlapMapContainer::ensureClippingScopeForLayers):
3458         (WebCore::OverlapMapContainer::findClippingScopeForLayers const):
3459         (WebCore::OverlapMapContainer::recursiveOutputToStream const):
3460         (WebCore::OverlapMapContainer::dump const):
3461         (WebCore::LayerOverlapMap::LayerOverlapMap):
3462         (WebCore::LayerOverlapMap::add):
3463         (WebCore::LayerOverlapMap::overlapsLayers const):
3464         (WebCore::LayerOverlapMap::pushCompositingContainer):
3465         (WebCore::LayerOverlapMap::popCompositingContainer):
3466         (WebCore::OverlapMapContainer::unite): Deleted.
3467         (WebCore::OverlapMapContainer::rectList const): Deleted.
3468         * rendering/LayerOverlapMap.h:
3469         * rendering/RenderLayerCompositor.cpp:
3470         (WebCore::RenderLayerCompositor::BackingSharingState::appendSharingLayer):
3471         (WebCore::RenderLayerCompositor::BackingSharingState::updateBeforeDescendantTraversal):
3472         (WebCore::RenderLayerCompositor::updateCompositingLayers):
3473         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
3474         (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
3475         (WebCore::RenderLayerCompositor::computeExtent const):
3476         (WebCore::createsClippingScope):
3477         (WebCore::enclosingClippingScopes):
3478         (WebCore::RenderLayerCompositor::addToOverlapMap const):
3479         (WebCore::RenderLayerCompositor::updateOverlapMap const):
3480         (WebCore::RenderLayerCompositor::layerOverlaps const):
3481         * rendering/RenderLayerCompositor.h:
3482
3483 2019-05-21  Antoine Quint  <graouts@apple.com>
3484
3485         [macOS] Compatibility mouse events aren't prevented by calling preventDefault() on pointerdown
3486         https://bugs.webkit.org/show_bug.cgi?id=198072
3487         <rdar://problem/50983361>
3488
3489         Reviewed by Dean Jackson.
3490
3491         The Pointer Events spec says that "compatibility" mouse events, which means all mouse events save for "click",
3492         should not be dispatched for a given pointer if preventDefault() was called during the dispatch of the "pointerdown"
3493         event. Additionally, calling preventDefault() during the dispatch of "pointerup" has no effect.
3494
3495         * dom/Element.cpp:
3496         (WebCore::Element::dispatchMouseEvent):
3497         * page/PointerCaptureController.cpp:
3498         (WebCore::PointerCaptureController::preventsCompatibilityMouseEventsForIdentifier):
3499         (WebCore::PointerCaptureController::pointerEventWasDispatched):
3500         * page/PointerCaptureController.h:
3501
3502 2019-05-21  Antti Koivisto  <antti@apple.com>
3503
3504         RTL/overflow scroll tests fail with async overflow enabled
3505         https://bugs.webkit.org/show_bug.cgi?id=196013
3506         <rdar://problem/49066649>
3507
3508         Reviewed by Simon Fraser.
3509
3510         Test: compositing/ios/rtl-overflow-scrolling-2.html
3511
3512         This patch makes the basic RTL cases work in the scrolling tree.
3513
3514         * page/scrolling/AsyncScrollingCoordinator.cpp:
3515         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
3516         * page/scrolling/ScrollingTreeScrollingNode.cpp:
3517         (WebCore::ScrollingTreeScrollingNode::minimumScrollPosition const):
3518         (WebCore::ScrollingTreeScrollingNode::maximumScrollPosition const):
3519
3520         Add missing scroll offset <-> scroll position conversions.
3521
3522 2019-05-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3523
3524         [WPE] Add initial accessibility support using ATK
3525         https://bugs.webkit.org/show_bug.cgi?id=197413
3526
3527         Reviewed by Michael Catanzaro.
3528
3529         Use USE(ATK) instead of PLATFORM(GTK) for ATK related code and use ATK when available for WPE port too.
3530
3531         * PlatformWPE.cmake:
3532         * SourcesWPE.txt:
3533         * accessibility/AXObjectCache.h:
3534         * accessibility/AccessibilityList.cpp:
3535         (WebCore::AccessibilityList::childHasPseudoVisibleListItemMarkers):
3536         * accessibility/AccessibilityNodeObject.cpp:
3537         (WebCore::AccessibilityNodeObject::canSetValueAttribute const):
3538         * accessibility/AccessibilityObject.cpp:
3539         (WebCore::AccessibilityObject::textIteratorBehaviorForTextRange const):
3540         * accessibility/AccessibilityObject.h:
3541         * accessibility/AccessibilityObjectInterface.h:
3542         * accessibility/AccessibilityRenderObject.cpp:
3543         (WebCore::AccessibilityRenderObject::indexForVisiblePosition const):
3544         (WebCore::AccessibilityRenderObject::shouldNotifyActiveDescendant const):
3545         * accessibility/AccessibilityTableColumn.cpp:
3546         (WebCore::AccessibilityTableColumn::computeAccessibilityIsIgnored const):
3547         * accessibility/AccessibilityTableHeaderContainer.cpp:
3548         (WebCore::AccessibilityTableHeaderContainer::computeAccessibilityIsIgnored const):
3549         * accessibility/atk/WebKitAccessible.cpp:
3550         (webkitAccessibleGetAttributes):
3551         * accessibility/wpe/AXObjectCacheWPE.cpp: Removed.
3552         * accessibility/wpe/AccessibilityObjectWPE.cpp: Removed.
3553         * editing/FrameSelection.h:
3554
3555 2019-05-20  Ross Kirsling  <ross.kirsling@sony.com>
3556
3557         Make lossy LayoutUnit constructors explicit
3558         https://bugs.webkit.org/show_bug.cgi?id=191811
3559
3560         Reviewed by Antti Koivisto.
3561
3562         * platform/LayoutUnit.h:
3563         Make lossy unary constructors explicit.
3564         For ergonomics, give float overloads to copy constructor and round/floor/ceil functions.
3565
3566         * css/LengthFunctions.h:
3567         * platform/graphics/LayoutPoint.h:
3568         * platform/graphics/LayoutRect.h:
3569         * platform/graphics/LayoutSize.h:
3570         * rendering/RenderBox.h:
3571         * rendering/RenderElement.h:
3572         Templatize common functions to allow LayoutUnit itself to dictate which types it allows.
3573
3574         * html/shadow/SliderThumbElement.cpp:
3575         * page/FrameView.cpp:
3576         * page/Page.cpp:
3577         * page/SpatialNavigation.cpp:
3578         * page/scrolling/AxisScrollSnapOffsets.cpp:
3579         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3580         * layout/FormattingContextGeometry.cpp:
3581         * layout/FormattingContextQuirks.cpp:
3582         * layout/LayoutState.cpp:
3583         * layout/displaytree/DisplayBox.h:
3584         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
3585         * layout/layouttree/LayoutReplaced.cpp:
3586         * platform/animation/AnimationUtilities.h:
3587         * platform/cocoa/ScrollSnapAnimatorState.mm:
3588         * rendering/BorderEdge.cpp:
3589         * rendering/EllipsisBox.cpp:
3590         * rendering/FixedTableLayout.cpp:
3591         * rendering/InlineBox.cpp:
3592         * rendering/InlineFlowBox.cpp:
3593         * rendering/InlineFlowBox.h:
3594         * rendering/InlineTextBox.cpp:
3595         * rendering/RenderBlock.cpp:
3596         * rendering/RenderBlockFlow.cpp:
3597         * rendering/RenderBlockLineLayout.cpp:
3598         * rendering/RenderBox.cpp:
3599         * rendering/RenderBoxModelObject.cpp:
3600         * rendering/RenderBoxModelObject.h:
3601         * rendering/RenderDeprecatedFlexibleBox.cpp:
3602         * rendering/RenderElement.cpp:
3603         * rendering/RenderImage.cpp:
3604         * rendering/RenderInline.cpp:
3605         * rendering/RenderLineBreak.cpp:
3606         * rendering/RenderListMarker.cpp:
3607         * rendering/RenderMultiColumnSet.cpp:
3608         * rendering/RenderMultiColumnSet.h:
3609         * rendering/RenderObject.cpp:
3610         * rendering/RenderReplaced.cpp:
3611         * rendering/RenderTable.cpp:
3612         * rendering/RenderTableCell.cpp:
3613         * rendering/RenderTableSection.cpp:
3614         * rendering/RenderText.cpp:
3615         * rendering/RenderTextControlMultiLine.cpp:
3616         * rendering/RenderThemeMac.mm:
3617         * rendering/RenderVTTCue.cpp:
3618         * rendering/RenderView.cpp:
3619         * rendering/RootInlineBox.cpp:
3620         * rendering/SimpleLineLayoutFunctions.cpp:
3621         * rendering/SimpleLineLayoutPagination.cpp:
3622         * rendering/SimpleLineLayoutResolver.cpp:
3623         * rendering/line/LineWidth.cpp:
3624         * rendering/mathml/MathOperator.cpp:
3625         * rendering/mathml/RenderMathMLBlock.cpp:
3626         * rendering/mathml/RenderMathMLBlock.h:
3627         * rendering/mathml/RenderMathMLFencedOperator.h:
3628         * rendering/mathml/RenderMathMLFraction.cpp:
3629         * rendering/mathml/RenderMathMLMenclose.cpp:
3630         * rendering/mathml/RenderMathMLOperator.cpp:
3631         * rendering/mathml/RenderMathMLRoot.cpp:
3632         * rendering/mathml/RenderMathMLScripts.cpp:
3633         * rendering/mathml/RenderMathMLToken.cpp:
3634         * rendering/shapes/BoxShape.cpp:
3635         * rendering/shapes/ShapeOutsideInfo.cpp:
3636         * rendering/style/CollapsedBorderValue.h:
3637         * rendering/style/NinePieceImage.cpp:
3638         * rendering/style/NinePieceImage.h:
3639         * rendering/style/RenderStyle.cpp:
3640         * rendering/style/RenderStyle.h:
3641         * rendering/svg/RenderSVGText.cpp:
3642         * rendering/svg/SVGInlineTextBox.cpp:
3643         Make usage of LayoutUnit(float) and LayoutUnit(double) explicit where needed.
3644
3645 2019-05-20  Jer Noble  <jer.noble@apple.com>
3646
3647         Provide an explicit UIModalPresentation style when creating an AVPlayerViewController for fullscreen.
3648         https://bugs.webkit.org/show_bug.cgi?id=198052
3649
3650         Reviewed by Tim Horton.
3651
3652         Make sure AVPlayerViewController has an "overFullScreen" modal style.
3653
3654         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
3655         (-[WebAVPlayerViewController initWithFullscreenInterface:]):
3656
3657 2019-05-20  Chris Dumez  <cdumez@apple.com>
3658
3659         Fix security check in ScriptController::canAccessFromCurrentOrigin()
3660         https://bugs.webkit.org/show_bug.cgi?id=196730
3661         <rdar://problem/49731231>
3662
3663         Reviewed by Ryosuke Niwa.
3664
3665         Fix security check in ScriptController::canAccessFromCurrentOrigin() when there is no
3666         current JS exec state. Instead of returning true unconditionally, we now fall back to
3667         using the accessing document's origin for the security check. The new behavior is
3668         aligned with Blink:
3669         https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/html/html_frame_element_base.cc?rcl=d3f22423d512b45466f1694020e20da9e0c6ee6a&l=62
3670
3671         This fix is based on a patch from Sergei Glazunov <glazunov@google.com>.
3672
3673         Test: http/tests/security/showModalDialog-sync-cross-origin-page-load2.html
3674
3675         * bindings/js/ScriptController.cpp:
3676         (WebCore::ScriptController::canAccessFromCurrentOrigin):
3677         * bindings/js/ScriptController.h:
3678         * html/HTMLFrameElementBase.cpp:
3679         (WebCore::HTMLFrameElementBase::isURLAllowed const):
3680
3681 2019-05-20  Gabe Giosia  <giosia@google.com>
3682
3683         Range getBoundingClientRect returning zero rect on simple text node with <br> before it
3684         https://bugs.webkit.org/show_bug.cgi?id=182181
3685
3686         Reviewed by Antti Koivisto.
3687         
3688         Correct rect of RenderText in a block element when used in a Range
3689         over a line break element. The end offset was miscalculated.
3690
3691         Addded line-break case to fast/dom/Range/getBoundingClientRect.html
3692
3693         * rendering/SimpleLineLayoutFunctions.cpp:
3694         (WebCore::SimpleLineLayout::collectAbsoluteQuadsForRange):
3695         * rendering/SimpleLineLayoutResolver.cpp:
3696         (WebCore::SimpleLineLayout::RunResolver::rangeForRendererWithOffsets const):
3697
3698 2019-05-19  Brent Fulgham  <bfulgham@apple.com>
3699
3700         Unreviewed build fix after r245508.
3701
3702         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: Don't use
3703         an 'import' directive in a C++ file.
3704
3705 2019-05-19  Brent Fulgham  <bfulgham@apple.com>
3706
3707         Wait to get frame until after layout has been run
3708         https://bugs.webkit.org/show_bug.cgi?id=197999
3709         <rdar://problem/50800345>
3710
3711         Reviewed by Alex Christensen.
3712
3713         The current frame can change when layout runs, so don't bother retrieving
3714         the frame until the final layout pass is complete.
3715
3716         Test: fast/dom/window-inner-width-crash.html
3717
3718         * page/DOMWindow.cpp:
3719         (WebCore::DOMWindow::innerHeight const): Move frame access past the
3720         layout operation.
3721         (WebCore::DOMWindow::innerWidth const): Ditto.
3722         (WebCore::DOMWindow::scrollX const): Ditto.
3723         (WebCore::DOMWindow::scrollY const): Ditto.
3724
3725 2019-05-19  Brent Fulgham  <bfulgham@apple.com>
3726
3727         Unreviewed build fix
3728
3729         Attempting to build with only Open Source sources on shipping software with
3730         ASan enabled triggers build failures due to missing includes. This patch adds
3731         the necessary includes to cleanly build WebCore.
3732
3733         * Modules/applepay/ApplePaySession.cpp:
3734         * Modules/applepay/PaymentSession.cpp:
3735         * Modules/mediastream/UserMediaController.cpp:
3736         * bindings/js/ScriptController.cpp:
3737         * contentextensions/ContentExtensionsBackend.cpp:
3738         * dom/Document.cpp:
3739         * dom/ScriptedAnimationController.cpp:
3740         * editing/cocoa/EditorCocoa.mm:
3741         * editing/cocoa/HTMLConverter.mm:
3742         * editing/cocoa/WebContentReaderCocoa.mm:
3743         * editing/markup.cpp:
3744         * history/CachedFrame.cpp:
3745         * html/HTMLDocument.cpp:
3746         * html/HTMLHtmlElement.cpp:
3747         * html/HTMLMediaElement.cpp:
3748         * html/ImageDocument.cpp:
3749         * html/MediaDocument.cpp:
3750         * html/PluginDocument.cpp:
3751         * html/parser/HTMLDocumentParser.cpp:
3752         * html/parser/XSSAuditor.cpp:
3753         * inspector/InspectorInstrumentation.cpp:
3754         * inspector/agents/InspectorApplicationCacheAgent.cpp:
3755         * inspector/agents/InspectorNetworkAgent.cpp:
3756         * inspector/agents/InspectorPageAgent.cpp:
3757         * inspector/agents/page/PageNetworkAgent.cpp:
3758         * loader/ApplicationManifestLoader.cpp:
3759         * loader/FrameLoader.cpp:
3760         * loader/LoadTiming.cpp:
3761         * loader/NetscapePlugInStreamLoader.cpp:
3762         * loader/ResourceLoader.cpp:
3763         * loader/SubresourceLoader.cpp:
3764         * loader/appcache/ApplicationCacheHost.cpp:
3765         * loader/archive/cf/LegacyWebArchive.cpp:
3766         * loader/icon/IconLoader.cpp:
3767         * page/ContextMenuController.cpp:
3768         * page/FrameView.cpp:
3769         * page/Page.cpp:
3770         * page/Performance.cpp:
3771         * page/PerformanceNavigation.cpp:
3772         * page/Quirks.cpp:
3773         * page/UserContentProvider.cpp:
3774         * page/csp/ContentSecurityPolicy.cpp:
3775         * page/mac/PageMac.mm:
3776         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
3777         * svg/graphics/SVGImage.cpp:
3778         * testing/Internals.cpp:
3779
3780 2019-05-19  Antoine Quint  <graouts@apple.com>
3781
3782         [Pointer Events] Listening to a "pointerover", "pointerenter", "pointerout" or "pointerleave" event alone does not fire the event on iOS
3783         https://bugs.webkit.org/show_bug.cgi?id=197882
3784         <rdar://problem/50769116>
3785
3786         Reviewed by Dean Jackson.
3787
3788         Tests: pointerevents/ios/pointerenter-alone.html
3789                pointerevents/ios/pointerleave-alone.html
3790                pointerevents/ios/pointerout-alone.html
3791                pointerevents/ios/pointerover-alone.html
3792
3793         * dom/EventNames.h:
3794         (WebCore::EventNames::isTouchRelatedEventType const):
3795         (WebCore::EventNames::touchRelatedEventNames const):
3796         (WebCore::EventNames::extendedTouchRelatedEventNames const):
3797
3798 2019-05-19  Antoine Quint  <graouts@apple.com>
3799
3800         [Pointer Events] A pointer should be marked as primary for all of its events
3801         https://bugs.webkit.org/show_bug.cgi?id=197909
3802         <rdar://problem/50801608>
3803
3804         Reviewed by Dean Jackson.
3805
3806         Add an ivar for EventHandler which we'll use in WebKitAdditions code to track the touch identifier
3807         of the very first touch to start in a given sequence.
3808
3809         * page/EventHandler.h:
3810
3811 2019-05-19  Darin Adler  <darin@apple.com>
3812
3813         Change String::number to use "shortest" instead of "fixed precision 6 digits"
3814         https://bugs.webkit.org/show_bug.cgi?id=178319
3815
3816         Reviewed by Sam Weinig.
3817
3818         * accessibility/atk/WebKitAccessibleInterfaceValue.cpp:
3819         (webkitAccessibleSetNewValue): Use String::numberToStringFixedPrecision
3820         instead of String::number to be explicit about the fact that it's fixed precision.
3821         * page/linux/ResourceUsageOverlayLinux.cpp:
3822         (gcTimerString): Ditto.
3823
3824         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
3825         (printTransform): Use appendFixedPrecisionNumber instead of appendNumber
3826         to be explicit about the fact that it's fixed precision.
3827         (printLayer): Ditto.
3828         (WebCore::PlatformCALayerWin::layerTreeAsString const): Ditto.
3829         * platform/graphics/freetype/FontCacheFreeType.cpp:
3830         (buildVariationSettings): Ditto.
3831
3832         * svg/SVGNumberList.h: Use appendFixedPrecisionNumber instead of appendNumber
3833         to be explicit about the fact that it's fixed precision. We'll consider moving
3834         to shortest later.
3835
3836         * svg/SVGPathUtilities.cpp:
3837         (WebCore::buildStringFromPath): Use appendNumberShortest instead of
3838         appendNumberECMAScript since these are single-precision.
3839
3840         * svg/SVGPointList.h: Use appendFixedPrecisionNumber instead of appendNumber
3841         to be explicit about the fact that it's fixed precision. We'll consider moving
3842         to shortest later.
3843         * svg/SVGTransformValue.h: Ditto.
3844
3845 2019-05-19  Simon Fraser  <simon.fraser@apple.com>
3846
3847         Layers painting into shared backing need to contribute to overlap
3848         https://bugs.webkit.org/show_bug.cgi?id=198021
3849
3850         Reviewed by Zalan Bujtas.
3851         
3852         Layers that paint into a composited (non-root) layer get added to the overlap map so
3853         that later layers correct overlap them; this is done via the test against currentState.compositingAncestor.
3854
3855         We need the same logic for layers that paint into shared backing; they need to behave
3856         the same way in terms of how they contribute to overlap. We already had currentState.backingSharingAncestor
3857         which was unused, but now use it for this, and correctly null it out when a layer composites.
3858
3859         Bug was noticed during testing, and not known to affect any websites (though it probably does).
3860         
3861         Also move the overlap container popping into updateOverlapMap() so the two callers can
3862         share the code, and more explicitly track whether a container was pushed.
3863
3864         Test: compositing/shared-backing/sharing-child-contributes-to-overlap.html
3865
3866         * rendering/RenderLayerCompositor.cpp:
3867         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
3868         (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
3869         (WebCore::RenderLayerCompositor::updateOverlapMap const):
3870         * rendering/RenderLayerCompositor.h:
3871
3872 2019-05-17  Joonghun Park  <pjh0718@gmail.com>
3873
3874         Implement CSS `display: flow-root` (modern clearfix)
3875         https://bugs.webkit.org/show_bug.cgi?id=165603
3876
3877         Reviewed by Zalan Bujtas.
3878
3879         This change follows https://drafts.csswg.org/css-display-3/#valdef-display-flow-root as below.
3880
3881         'display: flow-root' generates a block container box, and lays out its contents using flow layout.
3882         It always establishes a new block formatting context for its contents.
3883
3884         * css/CSSPrimitiveValueMappings.h:
3885         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3886         * css/CSSValueKeywords.in:
3887         * css/StyleResolver.cpp:
3888         (WebCore::equivalentBlockDisplay):
3889         * css/parser/CSSParserFastPaths.cpp:
3890         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
3891         * rendering/RenderBox.cpp:
3892         (WebCore::RenderBox::createsNewFormattingContext const):
3893         * rendering/RenderElement.cpp:
3894         (WebCore::RenderElement::createFor):
3895         * rendering/style/RenderStyleConstants.h:
3896
3897 2019-05-17  Don Olmstead  <don.olmstead@sony.com>
3898
3899         [CMake] Use builtin FindICU
3900         https://bugs.webkit.org/show_bug.cgi?id=197934
3901
3902         Reviewed by Michael Catanzaro.
3903
3904         Remove uses of ICU_INCLUDE_DIRS and ICU_LIBRARIES.
3905
3906         * CMakeLists.txt:
3907         * PlatformPlayStation.cmake:
3908         * PlatformWPE.cmake:
3909
3910 2019-05-17  Alex Christensen  <achristensen@webkit.org>
3911
3912         Enable legacy EME for iOS WKWebView
3913         https://bugs.webkit.org/show_bug.cgi?id=197964
3914         <rdar://problem/50625666>
3915
3916         Reviewed by Wenson Hsieh.
3917
3918         This was attempted unsuccessfully in r230169.
3919         Verified manually that it works as desired.
3920
3921         * page/RuntimeEnabledFeatures.h:
3922
3923 2019-05-17  Sihui Liu  <sihui_liu@apple.com>
3924
3925         ASSERTION FAILED: !m_backingStore in WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore(uint64_t)
3926         https://bugs.webkit.org/show_bug.cgi?id=197741
3927         <rdar://problem/50625006>
3928
3929         Reviewed by Youenn Fablet.
3930
3931         If an open request is made before a delete request, open task should be performed before delete task on the
3932         database thread. After r242911, open request needs to wait decision of StorageQuotaManager before posting task
3933         to database thread, while delete request needs not. This makes deletion happen before open.
3934
3935         We need to make sure tasks are in correct order by not starting next open or delete request when database is in 
3936         the middle of open or deletion.
3937
3938         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
3939         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentOpenOperation):
3940         (WebCore::IDBServer::UniqueIDBDatabase::handleDatabaseOperations):
3941
3942 2019-05-17  Antoine Quint  <graouts@apple.com>
3943
3944         Add a website policy to disable the legacy -webkit-overflow-scrolling:touch behavior
3945         https://bugs.webkit.org/show_bug.cgi?id=197943
3946         <rdar://problem/49078202>
3947
3948         Reviewed by Brent Fulgham.
3949
3950         Tests: fast/scrolling/ipad/overflow-scrolling-touch-enabled-stacking-modern-compatibility-mode.html
3951                platform/ipad/fast/css/webkit-ov