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