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