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