[GTK] Implement connected and disconnected events of GAMEPAD API with libmanette
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2020-05-20  ChangSeok Oh  <changseok@webkit.org>
2
3         [GTK] Implement connected and disconnected events of GAMEPAD API with libmanette
4         https://bugs.webkit.org/show_bug.cgi?id=133854
5
6         Reviewed by Carlos Garcia Campos.
7
8         This patch brings initial GAMEPAD API support to the gtk port. We use libmanette,
9         a simple GObject game controller library to handle gamepad connection and input.
10         This change aims to implement two GAMEPAD API events: 'gamepadconnected' and 'gamepaddisconnected'
11         on top of libmanette. Rest of API will be implemented by following patches.
12
13         No new tests since existing tests can cover this change.
14
15         * PlatformGTK.cmake: Add header & library paths for libmanette.
16         * SourcesGTK.txt:
17         * platform/gamepad/manette/GUniquePtrManette.h: Added to define a smart pointer for ManetteMonitor.
18         * platform/gamepad/manette/ManetteGamepad.cpp: Added. A wrapper class for ManetteDevice.
19           A ManetteGamepad instance is created per a physically connected gamepad. Currently,
20           it is empty but input handling login will be placed in this class.
21         (WebCore::ManetteGamepad::ManetteGamepad):
22         * platform/gamepad/manette/ManetteGamepad.h: Added.
23         * platform/gamepad/manette/ManetteGamepadProvider.cpp: Added. A manager class
24           for ManetteGamepad instances. This class represents ManetteMonitor that
25           handles connection and disconnection of gamepads. Many parts of this class implementation
26           is brought from HIDGamepad.cpp
27         (WebCore::ManetteGamepadProvider::singleton):
28         (WebCore::onDeviceConnected):
29         (WebCore::onDeviceDisconnected):
30         (WebCore::ManetteGamepadProvider::ManetteGamepadProvider):
31         (WebCore::ManetteGamepadProvider::startMonitoringGamepads):
32         (WebCore::ManetteGamepadProvider::stopMonitoringGamepads):
33         (WebCore::ManetteGamepadProvider::deviceConnected):
34         (WebCore::ManetteGamepadProvider::deviceDisconnected):
35         (WebCore::ManetteGamepadProvider::indexForNewlyConnectedDevice):
36         (WebCore::ManetteGamepadProvider::connectionDelayTimerFired):
37         (WebCore::ManetteGamepadProvider::removeGamepadForDevice):
38         * platform/gamepad/manette/ManetteGamepadProvider.h: Added.
39
40 2020-05-20  Antoine Quint  <graouts@apple.com>
41
42         Potential crash in PointerCaptureController::cancelPointer()
43         https://bugs.webkit.org/show_bug.cgi?id=208347
44         <rdar://problem/59866247>
45
46         Reviewed by David Kilzer and Daniel Bates.
47
48         * page/PointerCaptureController.cpp:
49         (WebCore::PointerCaptureController::cancelPointer):
50
51 2020-05-20  Oriol Brufau  <obrufau@igalia.com>
52
53         [css-grid] Fix auto repeat with multiple tracks and gutters
54         https://bugs.webkit.org/show_bug.cgi?id=182922
55
56         Reviewed by Manuel Rego Casasnovas.
57
58         The code that computes the number of auto repeat tracks wrongly assumes
59         that the second argument of the repeat() notation is a single track
60         function. That was true in the beginning, however specs were later on
61         modified to allow a <track-list>. We support a <track-list> as a second
62         argument since long ago but the code that computes the number of
63         auto-repeat tracks was never updated.
64
65         This patch modifies two places that relate to the gaps between the
66         auto-repeat tracks, which ensures the proper total length.
67
68         This is a port of https://crrev.com/620278 from Chromium.
69
70         Tests: fast/css-grid-layout/grid-auto-repeat-huge-grid.html
71                imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-multiple-values-001.html
72
73         * rendering/RenderGrid.cpp:
74         (WebCore::RenderGrid::computeAutoRepeatTracksCount const):
75
76 2020-05-20  Simon Fraser  <simon.fraser@apple.com>
77
78         Plumb the display's nominal refresh rate down to ScrollingTree for use in scroll synchronization
79         https://bugs.webkit.org/show_bug.cgi?id=212159
80
81         Reviewed by Tim Horton.
82
83         Plumb an Optional<unsigned> down windowScreenDidChange, which contains the nominal
84         display refresh rate (as frames per second) if available. On macOS, we get this
85         from CVDisplayLinkGetNominalOutputVideoRefreshPeriod().
86
87         To read it, WebProcessPool::nominalFramesPerSecondForDisplay() makes a DisplayLink
88         that doesn't get any observers, but that DisplayLink will very likely get used
89         as soon as we schedule a rendering update.
90
91         * page/Chrome.cpp:
92         (WebCore::Chrome::windowScreenDidChange):
93         * page/Chrome.h:
94         * page/Page.cpp:
95         (WebCore::Page::scrollingCoordinator):
96         (WebCore::Page::windowScreenDidChange):
97         * page/Page.h:
98         (WebCore::Page::displayNominalFramesPerSecond const):
99         * page/scrolling/AsyncScrollingCoordinator.cpp:
100         (WebCore::AsyncScrollingCoordinator::windowScreenDidChange):
101         * page/scrolling/AsyncScrollingCoordinator.h:
102         * page/scrolling/ScrollingCoordinator.h:
103         (WebCore::ScrollingCoordinator::windowScreenDidChange):
104         * page/scrolling/ScrollingTree.cpp:
105         (WebCore::ScrollingTree::windowScreenDidChange):
106         * page/scrolling/ScrollingTree.h:
107         * platform/HostWindow.h:
108
109 2020-05-20  Chris Dumez  <cdumez@apple.com>
110
111         Disable support for BeforeLoadEvent
112         https://bugs.webkit.org/show_bug.cgi?id=212140
113         <rdar://problem/62847577>
114
115         Reviewed by Antti Koivisto.
116
117         Disable support for BeforeLoadEvent. Other browsers do not support it and
118         Chrome dropped it shortly after the fork:
119         - https://bugs.chromium.org/p/chromium/issues/detail?id=333318
120
121         This is a synchronous event and therefore very dangerous.
122
123         Test: fast/frames/didBecomeCurrentDocumentInFrame-crash.html
124
125         * bindings/js/WebCoreBuiltinNames.h:
126         * dom/BeforeLoadEvent.idl:
127         * dom/Node.cpp:
128         (WebCore::Node::dispatchBeforeLoadEvent):
129         * page/RuntimeEnabledFeatures.h:
130         (WebCore::RuntimeEnabledFeatures::setLegacyBeforeLoadEventEnabled):
131         (WebCore::RuntimeEnabledFeatures::legacyBeforeLoadEventEnabled const):
132
133 2020-05-20  Zalan Bujtas  <zalan@apple.com>
134
135         RenderObject::VisibleRectContext members should not be prefixed with m_
136         https://bugs.webkit.org/show_bug.cgi?id=212154
137
138         Reviewed by Simon Fraser.
139
140         * rendering/RenderBox.cpp:
141         (WebCore::RenderBox::applyCachedClipAndScrollPosition const):
142         (WebCore::RenderBox::computeVisibleRectInContainer const):
143         * rendering/RenderInline.cpp:
144         (WebCore::RenderInline::computeVisibleRectInContainer const):
145         * rendering/RenderObject.cpp:
146         (WebCore::RenderObject::computeVisibleRectInContainer const):
147         * rendering/RenderObject.h:
148         * rendering/RenderTableCell.cpp:
149         (WebCore::RenderTableCell::computeVisibleRectInContainer const):
150         * rendering/RenderView.cpp:
151         (WebCore::RenderView::computeVisibleRectInContainer const):
152         * rendering/svg/RenderSVGRoot.cpp:
153         (WebCore::RenderSVGRoot::computeFloatVisibleRectInContainer const):
154
155 2020-05-20  Myles C. Maxfield  <mmaxfield@apple.com>
156
157         [iPadOS] -webkit-text-size-adjust:percentage doesn't work
158         https://bugs.webkit.org/show_bug.cgi?id=212122
159         <rdar://problem/54560875>
160
161         Reviewed by Wenson Hsieh.
162
163         We've gotten many bug reports that -webkit-text-size-adjust:X% no longer works in
164         WebKit on iPads. We don't want to just start honoring the value, because our
165         testing indicates that, with desktop-class browsing on iPad, more sites work better
166         when we don't honor percentages. However, if Safari is using the mobile content mode,
167         or if a native app has local content, it should be possible to get the old behavior
168         of honoring percentages.
169
170         This patch adds a new Setting, idempotentModeAutosizingOnlyHonorsPercentages, which
171         is hooked up to the desktop-class browsing feature. When
172         WebPageProxy::effectiveContentModeAfterAdjustingPolicies() determines that the
173         WebContentMode::Mobile mode should be used, it sets the new setting, which
174         causes idempotent text autosizing mode to have the same behavior that WKWebViews
175         on iPadOS used to have: -w-t-s-a:auto and -w-t-s-a:none have no effect, but
176         -w-t-s-a:X% is honored. This affects both Safari and WKWebView apps.
177
178         If a native app wants the old behavior, they can set
179         WKWebpagePreferences.preferredContentMode = WKContentModeMobile to force the old
180         iPad behavior. It's expected that apps with legacy content would be doing this
181         anyway.
182
183         Tests: fast/text-autosizing/ios/idempotentmode/idempotent-percentage.html
184                TestWebKitAPI.PreferredContentMode.IdempotentModeAutosizingOnlyHonorsPercentages
185
186         * loader/DocumentLoader.cpp:
187         (WebCore::DocumentLoader::applyPoliciesToSettings):
188         * loader/DocumentLoader.h:
189         (WebCore::DocumentLoader::setIdempotentModeAutosizingOnlyHonorsPercentages):
190         (WebCore::DocumentLoader::idempotentModeAutosizingOnlyHonorsPercentages const):
191         * page/Settings.yaml:
192         * style/StyleAdjuster.cpp:
193         (WebCore::Style::Adjuster::adjustmentForTextAutosizing):
194         * style/StyleBuilderCustom.h:
195         (WebCore::Style::computeBaseSpecifiedFontSize):
196         * style/StyleBuilderState.cpp:
197         (WebCore::Style::BuilderState::updateFontForTextSizeAdjust):
198
199 2020-05-20  ChangSeok Oh  <changseok@webkit.org>
200
201         Move the TextStream logging definition in VisibleSelection.cpp to the outside of the TREE_DEBUGGING guard
202         https://bugs.webkit.org/show_bug.cgi?id=212127
203
204         Reviewed by Simon Fraser.
205
206         A linking failure occurs after r261819 where ENABLE_TREE_DEBUGGING is disabled.
207         The TextStream logging defining is placed inside the guard while its declaration is not since r218976.
208
209         Build fix, no functionality changed.
210
211         * editing/VisibleSelection.cpp:
212         (WebCore::operator<<):
213
214 2020-05-20  Andres Gonzalez  <andresg_22@apple.com>
215
216         Fix for accessibility-node-memory-management.html in isolated tree mode.
217         https://bugs.webkit.org/show_bug.cgi?id=212142
218
219         Reviewed by Chris Fleizach.
220
221         LayoutTests/accessibility/accessibility-node-memory-management.html.
222
223         - Fix in applyPendingChanges that was not removing removed nodes from
224         the nodes map. This was causing that some detached AXIsolatedObjects
225         were being returned.
226         - Also handle the case where pending changes can come from a detached
227         AXObject with invalid ID and no platform wrapper.
228         - updateChildren better handles the case when the notification target
229         is not in the isolated tree by walking up the object hierarchy until it
230         finds an associated object that does have a corresponding isolated object.
231
232         * accessibility/isolatedtree/AXIsolatedTree.cpp:
233         (WebCore::AXIsolatedTree::treeForPageID):
234         (WebCore::AXIsolatedTree::updateChildren):
235         (WebCore::AXIsolatedTree::applyPendingChanges):
236
237 2020-05-20  Antoine Quint  <graouts@apple.com>
238
239         [Web Animations] Animation engine should not wake up every tick for steps timing functions
240         https://bugs.webkit.org/show_bug.cgi?id=212103
241         <rdar://problem/62737868>
242
243         Unreviewed. Clean up some stray FIXMEs mistakenly commited in the previous commit.
244
245         * animation/AnimationTimeline.cpp:
246         (WebCore::AnimationTimeline::updateCSSTransitionsForElementAndProperty):
247         * style/StyleTreeResolver.cpp:
248         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
249
250 2020-05-20  Antoine Quint  <graouts@apple.com>
251
252         [Web Animations] Animation engine should not wake up every tick for steps timing functions
253         https://bugs.webkit.org/show_bug.cgi?id=212103
254         <rdar://problem/62737868>
255
256         Reviewed by Simon Fraser.
257
258         Tests: webanimations/scheduling-of-animation-with-steps-timing-function-on-effect.html
259                webanimations/scheduling-of-animation-with-steps-timing-function-on-keyframe.html
260                webanimations/scheduling-of-css-animation-with-explicit-steps-timing-function-on-some-keyframes.html
261                webanimations/scheduling-of-css-animation-with-implicit-steps-timing-function.html
262
263         When an animation uses a steps() timing function, it will appear to animate discretely between values such
264         that there is only n visual changes, where n is the number of steps provided. This gives us an opportunity
265         to be more efficient when scheduling animations using steps() timing functions.
266
267         In WebAnimation::timeToNextTick() we now ask the associated effect for the amount of progress until the next
268         step. For an effect-wide steps() timing function, we can use the provided iteration progress. For animations
269         with a linear effect-wide timing function (the default), we have to map the provided iteration progress to
270         a keyframe interval, provided that interval uses a steps() timing function.
271
272         The new {Animation|Keyframe}Effect::progressUntilNextStep() method returns WTF::nullopt for any other case.
273
274         In order to test this, we add a new internals.timeToNextAnimationTick(animation) method which we use in the
275         two new tests.
276
277         * animation/AnimationEffect.cpp:
278         (WebCore::AnimationEffect::progressUntilNextStep const):
279         * animation/AnimationEffect.h:
280         * animation/KeyframeEffect.cpp:
281         (WebCore::KeyframeEffect::setBlendingKeyframes):
282         (WebCore::KeyframeEffect::computeSomeKeyframesUseStepsTimingFunction):
283         (WebCore::KeyframeEffect::timingFunctionForKeyframeAtIndex const): Avoid any out-of-bounds use of the underlying data
284         structures by returning nullptr for cases where we don't have an explicit keyframe. We also make the function const
285         such that it may be called from progressUntilNextStep(), it always was const but wasn't marked as such.
286         (WebCore::KeyframeEffect::progressUntilNextStep const):
287         * animation/KeyframeEffect.h:
288         * animation/WebAnimation.cpp:
289         (WebCore::WebAnimation::timeToNextTick const):
290         * animation/WebAnimation.h:
291         * animation/WebAnimation.idl:
292         * testing/Internals.cpp:
293         (WebCore::Internals::timeToNextAnimationTick const):
294         * testing/Internals.h:
295         * testing/Internals.idl:
296
297 2020-05-20  Noam Rosenthal  <noam@webkit.org>
298
299         Fix table sizing when 'max-width' is used
300         https://bugs.webkit.org/show_bug.cgi?id=115156
301
302         Reviewed by Zalan Bujtas.
303
304         Based on previous patch by László Langó  <lango@inf.u-szeged.hu>
305
306         Test: fast/table/html-table-width-max-width-constrained.html
307
308         A table should always be wide enough to contain its content (preferred logical width).
309         This constraint should be stronger than the table style's specified min-width/width.
310
311         The behavior matches the spec, and behavior on Firefox/Chrome.
312
313         * rendering/RenderTable.cpp:
314         (WebCore::RenderTable::updateLogicalWidth):
315                 Max-width should only affect the table's max preferred width.
316
317         (WebCore::RenderTable::computePreferredLogicalWidths):
318                 Change the order of constraints so that content constraint is stronger than style width/max-width constraint.
319
320 2020-05-20  Carlos Garcia Campos  <cgarcia@igalia.com>
321
322         REGRESSION(r261554): [GTK] Version 2.29.1 crashes using drag-n-drop API
323         https://bugs.webkit.org/show_bug.cgi?id=212136
324
325         Reviewed by Adrian Perez de Castro.
326
327         * platform/gtk/PasteboardGtk.cpp:
328         (WebCore::Pasteboard::read): Use m_selectionData if present.
329
330 2020-05-20  Philippe Normand  <pnormand@igalia.com>
331
332         [GStreamer] <img> tag needs to support video formats
333         https://bugs.webkit.org/show_bug.cgi?id=180370
334
335         Reviewed by Xabier Rodriguez-Calvar.
336
337         GStreamer implementation of the ImageDecoder. It currently doesn't support zero-copy
338         rendering though due to the the NativeImagePtr requirement.
339
340         * platform/GStreamer.cmake:
341         * platform/MIMETypeRegistry.cpp:
342         (WebCore::MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType):
343         * platform/graphics/ImageDecoder.cpp:
344         (WebCore::ImageDecoder::create):
345         (WebCore::ImageDecoder::supportsMediaType):
346         * platform/graphics/gstreamer/ImageDecoderGStreamer.cpp: Added.
347         (WebCore::toSample):
348         (WebCore::ImageDecoderGStreamer::create):
349         (WebCore::ImageDecoderGStreamer::ImageDecoderGStreamer):
350         (WebCore::ImageDecoderGStreamer::supportsContainerType):
351         (WebCore::ImageDecoderGStreamer::canDecodeType):
352         (WebCore::ImageDecoderGStreamer::encodedDataStatus const):
353         (WebCore::ImageDecoderGStreamer::size const):
354         (WebCore::ImageDecoderGStreamer::repetitionCount const):
355         (WebCore::ImageDecoderGStreamer::uti const):
356         (WebCore::ImageDecoderGStreamer::frameOrientationAtIndex const):
357         (WebCore::ImageDecoderGStreamer::frameDurationAtIndex const):
358         (WebCore::ImageDecoderGStreamer::frameHasAlphaAtIndex const):
359         (WebCore::ImageDecoderGStreamer::frameBytesAtIndex const):
360         (WebCore::ImageDecoderGStreamer::createFrameImageAtIndex):
361         (WebCore::ImageDecoderGStreamer::setData):
362         (WebCore::ImageDecoderGStreamer::clearFrameBufferCache):
363         (WebCore::ImageDecoderGStreamer::sampleAtIndex const):
364         (WebCore::ImageDecoderGStreamer::InnerDecoder::decodebinPadAddedCallback):
365         (WebCore::ImageDecoderGStreamer::InnerDecoder::connectDecoderPad):
366         (WebCore::ImageDecoderGStreamer::handleSample):
367         (WebCore::ImageDecoderGStreamer::InnerDecoder::handleMessage):
368         (WebCore::ImageDecoderGStreamer::InnerDecoder::preparePipeline):
369         (WebCore::ImageDecoderGStreamer::InnerDecoder::run):
370         (WebCore::ImageDecoderGStreamer::InnerDecoder::encodedDataStatus const):
371         (WebCore::ImageDecoderGStreamer::pushEncodedData):
372         * platform/graphics/gstreamer/ImageDecoderGStreamer.h: Added.
373         * platform/graphics/gstreamer/ImageGStreamer.h:
374         (WebCore::ImageGStreamer::createImage):
375         (WebCore::ImageGStreamer::image):
376         (WebCore::ImageGStreamer::setCropRect):
377         (WebCore::ImageGStreamer::rect):
378         (WebCore::ImageGStreamer::hasAlpha const):
379         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
380         (WebCore::ImageGStreamer::ImageGStreamer):
381         * platform/graphics/gstreamer/MediaSampleGStreamer.h:
382
383 2020-05-20  Andy Estes  <aestes@apple.com>
384
385         [Mac] UI processes spin when creating the "Share" context menu item
386         https://bugs.webkit.org/show_bug.cgi?id=212137
387         <rdar://problem/54498394>
388
389         Reviewed by Wenson Hsieh.
390
391         Ran update-webkit-localizable-strings.
392
393         * en.lproj/Localizable.strings:
394
395 2020-05-20  Zalan Bujtas  <zalan@apple.com>
396
397         [LFC][TFC] Internal table boxes should take collapsed border into account
398         https://bugs.webkit.org/show_bug.cgi?id=212135
399
400         Reviewed by Antti Koivisto.
401
402         Use the collapsed border value to compute the borders for sections, rows and cells.
403         The collapsed border is propagated to the table box and the adjacent cell boxes.  
404
405         Test: fast/layoutformattingcontext/table-simple-border-collapse.html
406
407         * layout/LayoutUnits.h:
408         (WebCore::Layout::operator/):
409         * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
410         (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox):
411         * layout/tableformatting/TableFormattingContext.cpp:
412         (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows):
413         (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
414         (WebCore::Layout::TableFormattingContext::layoutCell):
415         * layout/tableformatting/TableGrid.h:
416         (WebCore::Layout::TableGrid::setCollapsedBorder):
417         (WebCore::Layout::TableGrid::collapsedBorder const):
418
419 2020-05-20  Youenn Fablet  <youenn@apple.com>
420
421         [Mac] Use preferedPixelBufferFormat for AVVideoCaptureSource
422         https://bugs.webkit.org/show_bug.cgi?id=212071
423
424         Reviewed by Eric Carlson.
425
426         Manually tested.
427
428         * platform/mediastream/mac/AVVideoCaptureSource.mm:
429         (WebCore::avVideoCapturePixelBufferFormat):
430
431 2020-05-20  Carlos Garcia Campos  <cgarcia@igalia.com>
432
433         Unreviewed. Fix GTK4 build with GTK 3.98.4
434
435         * platform/gtk/GtkUtilities.cpp:
436         (WebCore::convertWidgetPointToScreenPoint):
437         * platform/gtk/GtkVersioning.h:
438         (gtk_widget_destroy):
439         * platform/gtk/PlatformScreenGtk.cpp:
440         (WebCore::screenDPI):
441
442 2020-05-12  Carlos Garcia Campos  <cgarcia@igalia.com>
443
444         [GTK4] Add support for drag and drop operations
445         https://bugs.webkit.org/show_bug.cgi?id=211779
446
447         Reviewed by Adrian Perez de Castro.
448
449         Move the code to create a GdkTexture from an Image from CursorGtk to ImageGtk and add Image::gdkTexture().
450
451         * platform/graphics/BitmapImage.h:
452         * platform/graphics/Image.h:
453         (WebCore::Image::gdkTexture):
454         * platform/graphics/gtk/ImageGtk.cpp:
455         (WebCore::BitmapImage::gdkTexture):
456         * platform/gtk/CursorGtk.cpp:
457         (WebCore::createCustomCursor):
458
459 2020-05-20  Sam Weinig  <weinig@apple.com>
460
461         Remove unused Color::getHSV function
462         https://bugs.webkit.org/show_bug.cgi?id=212119
463
464         Reviewed by Simon Fraser.
465
466         * platform/graphics/Color.cpp:
467         (WebCore::Color::getHSV const): Deleted.
468         * platform/graphics/Color.h:
469         Remove Color::getHSV(). It was unused outside of the API test for it.    
470
471 2020-05-20  Youenn Fablet  <youenn@apple.com>
472
473         Allow calling VideoSampleObserver::videoSampleAvailable from a background thread
474         https://bugs.webkit.org/show_bug.cgi?id=212024
475
476         Reviewed by Eric Carlson.
477
478         Allow RealtimeMediaSource::videoSampleAvailable to be called on a background thread, typically the capture thread.
479         Make WebRTC remote sources and mock capture sources do that.
480
481         RealtimeMediaSource is then updating its intrinsic size from the generation thread while updating its size in the main thread.
482         The size() getter can be called from both threads.
483
484         Existing consumers do the following:
485         - media player will hop to the main thread.
486         - media recorder will do processing from the background thread.
487         - WebRTC sender will do processing from the background thread, except when sending black frames where this will still be done on the main thread.
488         This is ok as we ensure either we send black frames on the main thread (and we do not observe the source) or we observe the source to send.
489
490         Follow-ups will migrate the real capture sources as well as migrating media player processing out of the main thread.
491         Covered by existing tests.
492
493         * platform/MediaSample.h:
494         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
495         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
496         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable):
497         * platform/mediastream/RealtimeMediaSource.cpp:
498         (WebCore::RealtimeMediaSource::videoSampleAvailable):
499         (WebCore::RealtimeMediaSource::setIntrinsicSize):
500         * platform/mediastream/RealtimeMediaSource.h:
501         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
502         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
503         (WebCore::MockRealtimeVideoSourceMac::MockRealtimeVideoSourceMac):
504         (WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer):
505         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h:
506         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
507         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
508         (WebCore::RealtimeIncomingVideoSourceCocoa::processNewSample): Deleted.
509
510 2020-05-20  Oriol Brufau  <obrufau@igalia.com>
511
512         Fix computeMarginLogicalSizeForChild to check auto margins in the right axis
513         https://bugs.webkit.org/show_bug.cgi?id=212113
514
515         Reviewed by Manuel Rego Casasnovas.
516
517         GridLayoutFunctions::computeMarginLogicalSizeForChild checks for 'auto'
518         margins before retrieving the margin size, since these should be treated
519         as 0. However, for orthogonal grid items, it used to check the wrong axis.
520         So if an item had 'margin-top: auto' and 'margin-left: 5px', when asking
521         for the horizontal margin we could get 0px instead of 5px due to the
522         auto margin in the vertical axis.
523
524         Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-minimum-width-orthogonal-001.html
525
526         * rendering/GridLayoutFunctions.cpp:
527         (WebCore::GridLayoutFunctions::computeMarginLogicalSizeForChild):
528         (WebCore::GridLayoutFunctions::marginLogicalSizeForChild):
529
530 2020-05-19  Fujii Hironori  <Hironori.Fujii@sony.com>
531
532         [WinCairo] ASSERT(m_eglDisplay == EGL_NO_DISPLAY) fails in ~PlatformDisplay()
533         https://bugs.webkit.org/show_bug.cgi?id=212065
534
535         Reviewed by Don Olmstead.
536
537         PlatformDisplay destoys m_eglDisplay by using std::atexit to
538         ensure they are destructed before EGL's atexit handler (Bug 157973).
539         However, calling eglTerminate in atexit handler causes a
540         crash on Windows (Bug 145832, Bug 170331).
541
542         Then, r214688 added shutDownEglDisplays() and explicitly call it
543         in shutDownWebKit() to destory m_eglDisplay in Windows WebKit1.
544         However, Windows WebKit2 may call _exit() in IPC::Connection's
545         WorkQueue thread. It doesn't seem a good idea that explicitly
546         destructing m_eglDisplay by calling shutDownEglDisplays().
547
548         Remove shutDownEglDisplays() and the assertion for Windows.
549
550         * platform/graphics/PlatformDisplay.cpp:
551         (WebCore::PlatformDisplay::~PlatformDisplay): Conditioned out the
552         assertion for PLATFORM(WIN).
553         (WebCore::PlatformDisplay::initializeEGLDisplay): Restored the
554         original atexit handler of r201595.
555         (WebCore::PlatformDisplay::shutDownEglDisplays): Deleted.
556         * platform/graphics/PlatformDisplay.h:
557
558 2020-05-19  Darin Adler  <darin@apple.com>
559
560         REGRESSION (r259930): Dictation marker at start of text is removed when added trailing whitespace is collapsed
561         https://bugs.webkit.org/show_bug.cgi?id=212093
562
563         Reviewed by Daniel Bates.
564
565         * dom/DocumentMarkerController.cpp:
566         (WebCore::DocumentMarkerController::shiftMarkers): Use int to do the math before clamping to
567         unsigned. This protects against underflow.
568
569 2020-05-19  Sam Weinig  <weinig@apple.com>
570
571         Remove almost always incorrect Color::getRGBA
572         https://bugs.webkit.org/show_bug.cgi?id=212059
573
574         Reviewed by Darin Adler and Simon Fraser.
575
576         Removes the awkward and almost always incorrect out parameter based Color::getRGBA. Most existing callsites
577         were updated to use Color::toSRGBAComponentsLossy() or other more ExtendedColor supporting functions (like 
578         cachedCGColor()). 
579         
580         Also adds tuple-like adaptors for FloatComponents to allow it to be used
581         with structured bindings. For example:
582         
583             auto [r, g, b, a] = myFloatComponents;
584
585         * platform/graphics/Color.h:
586         * platform/graphics/Color.cpp:
587         (WebCore::Color::light const):
588         (WebCore::Color::dark const):
589         (WebCore::Color::isDark const):
590         Adopt toSRGBAComponentsLossy() to make these not return totally incorrect values.
591
592         (WebCore::Color::colorSpaceAndComponents const):
593         Added. Returns a std::pair<ColorSpace, FloatComponents> for functions that need
594         to operate on the components in a ColorSpace aware way. Used by toSRGBAComponentsLossy
595         and leakCGColor() for now, but will be useful going forward as well.
596
597         (WebCore::Color::toSRGBAComponentsLossy const):
598         Re-implement using colorSpaceAndComponents() to simplify implementation.
599
600         (WebCore::Color::getRGBA const): Deleted.
601         
602         * platform/graphics/ColorUtilities.cpp:
603         (WebCore::FloatComponents::FloatComponents): Deleted.
604         (WebCore::sRGBColorToLinearComponents): Deleted.
605         * platform/graphics/ColorUtilities.h:
606         (WebCore::FloatComponents::get const):
607         Remove uses of the Color class to simplify inlining (Color.h already needs to know about
608         FloatComponents). 
609             - FloatComponents constructor replaced by Color::toSRGBAComponentsLossy(). 
610             - sRGBColorToLinearComponents replaced by calling rgbToLinearComponents(color.toSRGBAComponentsLossy()).
611         
612         Also adds std::tuple adaptors for FloatComponents to allow using with stuctured bindings. 
613
614         * page/cocoa/ResourceUsageOverlayCocoa.mm:
615         (WebCore::HistoricMemoryCategoryInfo::HistoricMemoryCategoryInfo):
616         Replace getRGBA with cachedCGColor.
617         
618         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
619         (PlatformCALayerWin::setBackgroundColor):
620         Replace getRGBA with cachedCGColor.
621
622         * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
623         (PlatformCALayerWinInternal::setBorderColor):
624         Replace getRGBA with cachedCGColor.
625
626         * platform/graphics/cairo/CairoUtilities.cpp:
627         (WebCore::setSourceRGBAFromColor):
628         Replace getRGBA with toSRGBAComponentsLossy.
629
630         * platform/graphics/cairo/GradientCairo.cpp:
631         (WebCore::addColorStopRGBA):
632         (WebCore::setCornerColorRGBA):
633         (WebCore::interpolateColorStop):
634         Replace getRGBA with toSRGBAComponentsLossy.
635
636         * platform/graphics/cg/ColorCG.cpp:
637         (WebCore::leakCGColor):
638         (WebCore::cachedCGColor):
639         Simplify implementation (and remove use of getRGBA) by using colorSpaceAndComponents().
640
641         * platform/graphics/cg/GradientCG.cpp:
642         (WebCore::Gradient::platformGradient):
643         Replace getRGBA with colorSpaceAndComponent(). 
644         
645         * platform/graphics/filters/FELighting.cpp:
646         (WebCore::FELighting::drawLighting):
647         Replace FloatComponents constructor taking a Color (which used getRGBA) with toSRGBAComponentsLossy.
648     
649         * platform/graphics/filters/FilterOperations.cpp:
650         (WebCore::FilterOperations::transformColor const):
651         (WebCore::FilterOperations::inverseTransformColor const):
652         Replace getRGBA with toSRGBAComponentsLossy.
653
654         * platform/graphics/gtk/ColorGtk.cpp:
655         (WebCore::Color::operator GdkRGBA const):
656         Replace getRGBA with toSRGBAComponentsLossy.
657
658         * platform/graphics/texmap/TextureMapperGL.cpp:
659         (WebCore::TextureMapperGL::drawBorder):
660         (WebCore::TextureMapperGL::drawNumber):
661         (WebCore::prepareFilterProgram):
662         (WebCore::TextureMapperGL::drawSolidColor):
663         Replace getRGBA with toSRGBAComponentsLossy.
664
665         * platform/graphics/win/GradientDirect2D.cpp:
666         (WebCore::Gradient::generateGradient):
667         Replace getRGBA with toSRGBAComponentsLossy.
668
669         * platform/graphics/win/GraphicsContextCGWin.cpp:
670         (WebCore::GraphicsContext::drawDotsForDocumentMarker):
671         (WebCore::setCGStrokeColor): Deleted.
672         (WebCore::spellingPatternColor): Deleted.
673         (WebCore::grammarPatternColor): Deleted.
674         Replace use of getRGBA with direct use of SimpleColor instead.
675         
676         * rendering/TextPaintStyle.cpp:
677         (WebCore::textColorIsLegibleAgainstBackgroundColor):
678         Replace implicit FloatComponents construction taking a Color (which used getRGBA) with explicit toSRGBAComponentsLossy.
679
680 2020-05-19  Eric Carlson  <eric.carlson@apple.com>
681
682         Update some media logging
683         https://bugs.webkit.org/show_bug.cgi?id=212109
684
685         Reviewed by Jer Noble.
686
687         No new tests, no functional change.
688
689         * html/HTMLMediaElement.cpp:
690         (WebCore::HTMLMediaElement::insertedIntoAncestor):
691         (WebCore::HTMLMediaElement::didFinishInsertingNode):
692         (WebCore::HTMLMediaElement::removedFromAncestor):
693         (WebCore::HTMLMediaElement::checkPlaybackTargetCompatablity):
694         (WebCore::HTMLMediaElement::canPlayType const):
695         (WebCore::HTMLMediaElement::waitForSourceChange):
696         (WebCore::HTMLMediaElement::noneSupported):
697         (WebCore::HTMLMediaElement::mediaLoadingFailed):
698         (WebCore::HTMLMediaElement::fastSeek):
699         (WebCore::HTMLMediaElement::seek):
700         (WebCore::HTMLMediaElement::seekInternal):
701         (WebCore::HTMLMediaElement::seekTask):
702         (WebCore::HTMLMediaElement::finishSeek):
703         (WebCore::HTMLMediaElement::currentMediaTime const):
704         (WebCore::HTMLMediaElement::setPreload):
705         (WebCore::HTMLMediaElement::playInternal):
706         (WebCore::HTMLMediaElement::pauseInternal):
707         (WebCore::HTMLMediaElement::setLoop):
708         (WebCore::HTMLMediaElement::setControls):
709         (WebCore::HTMLMediaElement::setVolume):
710         (WebCore::HTMLMediaElement::setMuted):
711         (WebCore::HTMLMediaElement::hardwareMutedStateDidChange):
712         (WebCore::HTMLMediaElement::configureTextTrackGroup):
713         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
714         (WebCore::HTMLMediaElement::mediaPlayerVolumeChanged):
715         (WebCore::HTMLMediaElement::mediaPlayerMuteChanged):
716         (WebCore::HTMLMediaElement::mediaPlayerDurationChanged):
717         (WebCore::HTMLMediaElement::mediaPlayerRateChanged):
718         (WebCore::HTMLMediaElement::mediaPlayerPlaybackStateChanged):
719         (WebCore::HTMLMediaElement::mediaPlayerResourceNotSupported):
720         (WebCore::HTMLMediaElement::mediaPlayerSizeChanged):
721         (WebCore::HTMLMediaElement::mediaPlayerRenderingModeChanged):
722         (WebCore::HTMLMediaElement::mediaPlayerEngineUpdated):
723         (WebCore::HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable):
724         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
725         (WebCore::HTMLMediaElement::updatePlayState):
726         (WebCore::HTMLMediaElement::stop):
727         (WebCore::HTMLMediaElement::suspend):
728         (WebCore::HTMLMediaElement::resume):
729         (WebCore::HTMLMediaElement::visibilityStateChanged):
730         (WebCore::HTMLMediaElement::addEventListener):
731         (WebCore::HTMLMediaElement::removeEventListener):
732         (WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent):
733         (WebCore::HTMLMediaElement::setShouldPlayToPlaybackTarget):
734         (WebCore::HTMLMediaElement::remoteHasAvailabilityCallbacksChanged):
735         (WebCore::HTMLMediaElement::enterFullscreen):
736         (WebCore::HTMLMediaElement::exitFullscreen):
737         (WebCore::HTMLMediaElement::didBecomeFullscreenElement):
738         (WebCore::HTMLMediaElement::setClosedCaptionsVisible):
739         (WebCore::HTMLMediaElement::mediaCanStart):
740         (WebCore::HTMLMediaElement::setShouldDelayLoadEvent):
741         (WebCore::HTMLMediaElement::suspendPlayback):
742         (WebCore::HTMLMediaElement::resumeAutoplaying):
743         (WebCore::HTMLMediaElement::mayResumePlayback):
744         (WebCore::HTMLMediaElement::didReceiveRemoteControlCommand):
745         (WebCore::HTMLMediaElement::setBufferingPolicy):
746         (WebCore::HTMLMediaElement::purgeBufferedDataIfPossible):
747         * platform/audio/PlatformMediaSession.cpp:
748         (WebCore::PlatformMediaSession::setState):
749         (WebCore::PlatformMediaSession::beginInterruption):
750         (WebCore::PlatformMediaSession::endInterruption):
751         (WebCore::PlatformMediaSession::clientWillBeginAutoplaying):
752         (WebCore::PlatformMediaSession::clientWillBeginPlayback):
753         (WebCore::PlatformMediaSession::processClientWillPausePlayback):
754         (WebCore::PlatformMediaSession::clientWillPausePlayback):
755         (WebCore::PlatformMediaSession::clientWillBeDOMSuspended):
756         (WebCore::PlatformMediaSession::pauseSession):
757         (WebCore::PlatformMediaSession::stopSession):
758         (WebCore::PlatformMediaSession::didReceiveRemoteControlCommand):
759
760 2020-05-19  Daniel Bates  <dabates@apple.com>
761
762         Blue dotted underline with alternatives only shown for last word, gets lost for previous insertions
763         https://bugs.webkit.org/show_bug.cgi?id=212097
764         <rdar://problem/61913405>
765
766         Reviewed by Darin Adler.
767
768         Fix up two cases, <space> is a literal ' ' and | is the position of the caret:
769             1. Space inserted after marker, here's what it looks like BEFORE insertion (i.e. endOfFirstWord == startOfSelection):
770                 hello|
771
772             This case is detected when the end of the next word (relative to caret) would be at the start of the
773             word that begins before or on the caret.
774
775             2. Space inserted before marker, here's what it looks like BEFORE insertion (i.e. startOfLastWord == endOfSelection):
776                 |hello
777
778             This case is detected when the end of the previous word (relative to caret) would be at the end of the
779             word that ends after or on the caret.
780
781         Note ^^^ example uses a caret, but code is slightly more general and works when the current selection
782         is a range. Though I didn't explicitly test that because my bug is specific to having a caret selection.
783
784         * editing/Editor.cpp:
785         (WebCore::Editor::insertTextWithoutSendingTextEvent): Do not remove markers if selection starts at the
786         beginning of a new word. This is detected by looking at the character before the selection start to see
787         if it is a space or newline. This will be false when there is no preceding character (e.g. start of document),
788         but that's OK because it doesn't matter what we pass to updateMarkersForWordsAffectedByEditing() - there's
789         no markers to remove anyway, let alone text for markers to exist in. I don't use isStartOfWord() here
790         because that would incorrectly return false if the current selection is at the end of a paragraph. I could have
791         fixed that up by checking isEndOfParagraph() as well, but isStartOfWord() + isEndOfParagraph() is less
792         efficient than just looking at the previous character directly. So, I did that instead.
793         (WebCore::Editor::updateMarkersForWordsAffectedByEditing): Save off the original end of the first word and
794         start of the last word positions before mutating them. Update early return checks to use these saved values
795         instead of comparing against the start and end of the current selection, which weren't correct. Saved positioned
796         are aligned by word, but start and end of current selection may NOT be. So, comparison was asymmetric: lhs was
797         word aligned position, but rhs may not be.
798
799         * editing/Editor.h: While I am here, fix up a param name to match what it is called in the .cpp.
800
801         * testing/Internals.cpp:
802         (WebCore::Internals::hasDictationAlternativesMarker): Added
803         * testing/Internals.h:
804         * testing/Internals.idl:
805         Add new functionality for testing purposes.
806
807
808 2020-05-19  Oriol Brufau  <obrufau@igalia.com>
809
810         Fix marginLogicalSizeForChild to check auto margins in the right axis
811         https://bugs.webkit.org/show_bug.cgi?id=212055
812
813         Reviewed by Manuel Rego Casasnovas.
814
815         GridLayoutFunctions::marginLogicalSizeForChild checks for 'auto' margins
816         before retrieving the margin size, since these should be treated as 0.
817         However, for orthogonal grid items, it used to check the wrong axis.
818         So if an item had 'margin-top: auto' and 'margin-left: 5px', when asking
819         for the horizontal margin we could get 0px instead of 5px due to the
820         auto margin in the vertical axis.
821
822         Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-minimum-height-orthogonal-001.html
823
824         * rendering/GridLayoutFunctions.cpp:
825         (WebCore::GridLayoutFunctions::marginLogicalSizeForChild):
826
827 2020-05-19  Jacob Uphoff  <jacob_uphoff@apple.com>
828
829         Unreviewed, reverting r261856.
830
831         This caused internal assertion failures.
832
833         Reverted changeset:
834
835         "Allow calling VideoSampleObserver::videoSampleAvailable from
836         a background thread"
837         https://bugs.webkit.org/show_bug.cgi?id=212024
838         https://trac.webkit.org/changeset/261856
839
840 2020-05-19  David Kilzer  <ddkilzer@apple.com>
841
842         IDBRequestData and IDBClient::TransactionOperation should initialize IndexedDB::IndexRecordType field
843         <https://webkit.org/b/212096>
844         <rdar://problem/63406376>
845
846         Reviewed by Geoffrey Garen.
847
848         IDBRequestData tested by IPC::Decoder::decode() and
849         IPC::Encoder::operator<<() running on WebKit2 API and layout
850         tests.
851
852         * Modules/indexeddb/IndexedDB.h:
853         (WTF::EnumTraits<WebCore::IndexedDB::IndexRecordType>): Add.
854         * Modules/indexeddb/client/TransactionOperation.h:
855         (WebCore::IDBClient::TransactionOperation::m_indexRecordType):
856         - Add default initializer.
857         * Modules/indexeddb/shared/IDBRequestData.h:
858         (WebCore::IDBRequestData::m_indexRecordType):
859         - Add default initializer.
860         (WebCore::IDBRequestData::encode const):
861         (WebCore::IDBRequestData::decode):
862         - Switch from encodeEnum() and decodeEnum() to modern
863           equivalents that check for valid enum values.
864
865 2020-05-19  Simon Fraser  <simon.fraser@apple.com>
866
867         Push a PlatformDisplayID to scrolling trees, and allow the scrolling thread to get displayDidRefresh notifications
868         https://bugs.webkit.org/show_bug.cgi?id=211034
869
870         Reviewed by Sam Weinig.
871
872         As work towards scrolling thread synchronization with main thread (webkit.org/b210884), allow
873         ScrollingTree to get a displayDidRefresh() call on the scrolling thread. Each
874         tree is associated with a Page which is associated with a display, so the ScrollingTree
875         needs to have a PlatformDisplayID to know which notifications to respond to.
876
877         Eventually, displayDidRefresh() will be used to trigger layer updates on the scrolling
878         thread if the main thread is periodically unresponsive.
879
880         * page/Page.cpp:
881         (WebCore::Page::scrollingCoordinator):
882         (WebCore::Page::windowScreenDidChange):
883         * page/scrolling/AsyncScrollingCoordinator.cpp:
884         (WebCore::AsyncScrollingCoordinator::windowScreenDidChange):
885         * page/scrolling/AsyncScrollingCoordinator.h:
886         * page/scrolling/ScrollingCoordinator.h:
887         (WebCore::ScrollingCoordinator::windowScreenDidChange):
888         * page/scrolling/ScrollingTree.cpp:
889         (WebCore::ScrollingTree::windowScreenDidChange):
890         (WebCore::ScrollingTree::displayID):
891         * page/scrolling/ScrollingTree.h:
892         (WebCore::ScrollingTree::displayDidRefresh):
893         * page/scrolling/ThreadedScrollingTree.cpp:
894         (WebCore::ThreadedScrollingTree::displayDidRefresh):
895         * page/scrolling/ThreadedScrollingTree.h:
896
897 2020-05-19  Simon Fraser  <simon.fraser@apple.com>
898
899         [iOS] Programmaic scroll of "scrolling=no" iframe fails
900         https://bugs.webkit.org/show_bug.cgi?id=212063
901         <rdar://problem/57049514>
902
903         Reviewed by Antti Koivisto.
904
905         ScrollView::setScrollPosition() calls requestScrollPositionUpdate(), and if this returns
906         false it relies on the confusingly-named updateScrollbars() to actually do the scroll.
907         This code path is hit for "scrolling=no" frames, which are not scroll-coordinated.
908
909         ScrollView::updateScrollbars() fails to set the scroll position on iOS, where managesScrollbars()
910         returns false, so fix that.
911
912         Test: fast/scrolling/progammatic-scroll-scrolling-no-frame.html
913
914         * platform/ScrollView.cpp:
915         (WebCore::ScrollView::updateScrollbars):
916
917 2020-05-19  Andy Estes  <aestes@apple.com>
918
919         [Apple Pay] Add testing and logging for ApplePaySetup
920         https://bugs.webkit.org/show_bug.cgi?id=211972
921         <rdar://problem/63291965>
922
923         Reviewed by Alex Christensen.
924
925         Test: http/tests/ssl/applepay/ApplePaySetup.https.html
926
927         * DerivedSources-input.xcfilelist:
928         * DerivedSources-output.xcfilelist:
929         * DerivedSources.make:
930         * Modules/applepay/ApplePaySetup.cpp:
931         (WebCore::ApplePaySetup::getSetupFeatures):
932         (WebCore::ApplePaySetup::begin):
933         (WebCore::ApplePaySetup::ApplePaySetup):
934         (WebCore::ApplePaySetup::stop):
935         * Modules/applepay/ApplePaySetup.idl:
936         * Modules/applepay/ApplePaySetupConfiguration.h: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl.
937         * Modules/applepay/ApplePaySetupConfiguration.idl: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl.
938         * Modules/applepay/ApplePaySetupFeature.idl:
939         * Modules/applepay/ApplePaySetupFeature.mm:
940         (WebCore::ApplePaySetupFeature::state const):
941         * Modules/applepay/ApplePaySetupFeatureState.h: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl.
942         * Modules/applepay/ApplePaySetupFeatureState.idl: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl.
943         * Modules/applepay/ApplePaySetupFeatureType.idl:
944         * Modules/applepay/ApplePaySetupFeatureWebCore.h:
945         * Modules/applepay/ApplePaySetupWebCore.h:
946         (WebCore::ApplePaySetup::create):
947         * Modules/applepay/PaymentCoordinator.cpp:
948         (WebCore::PaymentCoordinator::setApplePayIsActiveIfAllowed const):
949         (WebCore::PaymentCoordinator::getSetupFeatures):
950         (WebCore::PaymentCoordinator::beginApplePaySetup):
951         (WebCore::PaymentCoordinator::endApplePaySetup):
952         * Modules/applepay/PaymentCoordinator.h:
953         * Modules/applepay/PaymentCoordinatorClient.h:
954         (WebCore::PaymentCoordinatorClient::getSetupFeatures):
955         (WebCore::PaymentCoordinatorClient::beginApplePaySetup):
956         * SourcesCocoa.txt:
957         * WebCore.xcodeproj/project.pbxproj:
958         * testing/MockApplePaySetupFeature.cpp: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureWebCore.h.
959         (WebCore::MockApplePaySetupFeature::create):
960         (WebCore::MockApplePaySetupFeature::MockApplePaySetupFeature):
961         * testing/MockApplePaySetupFeature.h: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureWebCore.h.
962         * testing/MockPaymentCoordinator.cpp:
963         (WebCore::MockPaymentCoordinator::addSetupFeature):
964         (WebCore::MockPaymentCoordinator::getSetupFeatures):
965         (WebCore::MockPaymentCoordinator::beginApplePaySetup):
966         * testing/MockPaymentCoordinator.h:
967         * testing/MockPaymentCoordinator.idl:
968
969 2020-05-19  Sergio Villar Senin  <svillar@igalia.com>
970
971         [WebXR] Implement requestSession()
972         https://bugs.webkit.org/show_bug.cgi?id=211888
973
974         Reviewed by Youenn Fablet.
975
976         This patch adds a preliminar implementation of the requestSession()
977         API used to get a WebXRSession from the UA. It includes a fairly good
978         amount of checks to verify that the request can be satisfied given the
979         device's enabled features per session modes. The specs also describe how
980         to request persmission for some actions using the Permissions API which
981         WebKit does not currently implement. That should be done in a follow up
982         patch perhaps using a similar approach to other APIs as Geolocation for
983         example.
984
985         In order to get some of the requestSession() tests passing the session
986         finalization (shutdown) had to be implemented too.
987
988         Several tests where unskipped for WPE port as they're now passing.
989
990         * Modules/webxr/WebXRRenderState.cpp:
991         (WebCore::WebXRRenderState::create): Pass XRSessionMode as argument
992         instead of a WebXRSession.
993         * Modules/webxr/WebXRRenderState.h: Ditto.
994         * Modules/webxr/WebXRSession.cpp:
995         (WebCore::WebXRSession::create): Added.
996         (WebCore::WebXRSession::WebXRSession): Added.
997         (WebCore::WebXRSession::renderState const):
998         (WebCore::WebXRSession::inputSources const):
999         (WebCore::WebXRSession::shutdown): Shutdown process called on session end.
1000         (WebCore::WebXRSession::end): Implemented session ending.
1001         * Modules/webxr/WebXRSession.h: Added create() and private constructor. Fixed some naming.
1002         * Modules/webxr/WebXRSystem.cpp:
1003         (WebCore::WebXRSystem::DummyInlineDevice::DummyInlineDevice): Contructor for the
1004         dummy inline device.
1005         (WebCore::WebXRSystem::ensureImmersiveXRDeviceIsSelected): Use a counter instead of a boolean
1006         to track testing devices as there might be more than 1.
1007         (WebCore::WebXRSystem::obtainCurrentDevice): Implemented from specs text.
1008         (WebCore::WebXRSystem::immersiveSessionRequestIsAllowedForGlobalObject const): Ditto.
1009         (WebCore::WebXRSystem::inlineSessionRequestIsAllowedForGlobalObject const): Ditto.
1010         (WebCore::WebXRSystem::resolveRequestedFeatures const): Ditto.
1011         (WebCore::WebXRSystem::isXRPermissionGranted const): Ditto.
1012         (WebCore::WebXRSystem::requestSession): Ditto.
1013         (WebCore::WebXRSystem::registerSimulatedXRDeviceForTesting): Use a counter instead of a bool.
1014         Also use a reference in the method argument.
1015         (WebCore::WebXRSystem::unregisterSimulatedXRDeviceForTesting): Ditto.
1016         (WebCore::WebXRSystem::sessionEnded): Added, used by sessions to notify the XRSystem.
1017         * Modules/webxr/WebXRSystem.h:
1018         * Modules/webxr/WebXRSystem.idl: Call requestSession with Document.
1019         * dom/TaskSource.h: Added a WebXR task source.
1020         * platform/xr/PlatformXR.h: Specs state that devices have a list of enabled features per session
1021         mode so store them in a hashmap instead of in a Vector.
1022         (PlatformXR::Device::supports const): Use the new Hashmap of session modes.
1023         (PlatformXR::Device::setEnabledFeatures): Ditto.
1024         (PlatformXR::Device::enabledFeatures const): Ditto.
1025         (PlatformXR::Device::setSupportedModes): Deleted.
1026         * platform/xr/openxr/PlatformXR.cpp:
1027         (PlatformXR::Instance::Impl::collectSupportedSessionModes): Return session modes if any.
1028         (PlatformXR::Instance::enumerateImmersiveXRDevices): Fill in features per session mode.
1029         * testing/WebXRTest.cpp:
1030         (WebCore::WebXRTest::simulateDeviceConnection): Fill in features per session mode.
1031         (WebCore::WebXRTest::disconnectAllDevices): Pass a reference to unregister.
1032
1033 2020-05-19  Antti Koivisto  <antti@apple.com>
1034
1035         Animation of font-size with rem values is incorrect
1036         https://bugs.webkit.org/show_bug.cgi?id=194765
1037         <rdar://problem/48171742>
1038
1039         Reviewed by Antoine Quint.
1040
1041         Test: animations/keyframe-rem-unit.html
1042
1043         'rem' computation fails on first style resolution because the document element style is not available.
1044
1045         * style/StyleResolver.cpp:
1046         (WebCore::Style::Resolver::styleForKeyframe):
1047
1048         Provide the override value, needed because the style can't be found from DOM tree yet.
1049
1050 2020-05-19  Andy Estes  <aestes@apple.com>
1051
1052         [Apple Pay] Add testing and logging for ApplePaySetup
1053         https://bugs.webkit.org/show_bug.cgi?id=211972
1054         <rdar://problem/63291965>
1055
1056         Reviewed by Alex Christensen.
1057
1058         Added support for ApplePaySetup to MockPaymentCoordinator and wrote a test.
1059
1060         Added release logging for ApplePaySetup and removed a noisy log message
1061         from setApplePayIsActiveIfAllowed.
1062
1063         Test: http/tests/ssl/applepay/ApplePaySetup.https.html
1064
1065         * DerivedSources-input.xcfilelist:
1066         * DerivedSources-output.xcfilelist:
1067         * DerivedSources.make:
1068         * Modules/applepay/ApplePaySetup.cpp:
1069         (WebCore::ApplePaySetup::getSetupFeatures):
1070         (WebCore::ApplePaySetup::begin):
1071         (WebCore::ApplePaySetup::ApplePaySetup):
1072         (WebCore::ApplePaySetup::stop):
1073         * Modules/applepay/ApplePaySetup.idl:
1074         * Modules/applepay/ApplePaySetupConfiguration.h: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl.
1075         * Modules/applepay/ApplePaySetupConfiguration.idl: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl.
1076         * Modules/applepay/ApplePaySetupFeature.idl:
1077         * Modules/applepay/ApplePaySetupFeature.mm:
1078         (WebCore::ApplePaySetupFeature::state const):
1079         * Modules/applepay/ApplePaySetupFeatureState.h: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl.
1080         * Modules/applepay/ApplePaySetupFeatureState.idl: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureType.idl.
1081         * Modules/applepay/ApplePaySetupFeatureType.idl:
1082         * Modules/applepay/ApplePaySetupFeatureWebCore.h:
1083         * Modules/applepay/ApplePaySetupWebCore.h:
1084         (WebCore::ApplePaySetup::create):
1085         * Modules/applepay/PaymentCoordinator.cpp:
1086         (WebCore::PaymentCoordinator::setApplePayIsActiveIfAllowed const):
1087         (WebCore::PaymentCoordinator::getSetupFeatures):
1088         (WebCore::PaymentCoordinator::beginApplePaySetup):
1089         (WebCore::PaymentCoordinator::endApplePaySetup):
1090         * Modules/applepay/PaymentCoordinator.h:
1091         * Modules/applepay/PaymentCoordinatorClient.h:
1092         (WebCore::PaymentCoordinatorClient::getSetupFeatures):
1093         (WebCore::PaymentCoordinatorClient::beginApplePaySetup):
1094         * SourcesCocoa.txt:
1095         * WebCore.xcodeproj/project.pbxproj:
1096         * testing/MockApplePaySetupFeature.cpp: Copied from Source/WebCore/Modules/applepay/ApplePaySetup.idl.
1097         (WebCore::MockApplePaySetupFeature::create):
1098         (WebCore::MockApplePaySetupFeature::MockApplePaySetupFeature):
1099         * testing/MockApplePaySetupFeature.h: Copied from Source/WebCore/Modules/applepay/ApplePaySetupFeatureWebCore.h.
1100         * testing/MockPaymentCoordinator.cpp:
1101         (WebCore::MockPaymentCoordinator::addSetupFeature):
1102         (WebCore::MockPaymentCoordinator::getSetupFeatures):
1103         (WebCore::MockPaymentCoordinator::beginApplePaySetup):
1104         * testing/MockPaymentCoordinator.h:
1105         * testing/MockPaymentCoordinator.idl:
1106
1107 2020-05-19  Youenn Fablet  <youenn@apple.com>
1108
1109         Allow calling VideoSampleObserver::videoSampleAvailable from a background thread
1110         https://bugs.webkit.org/show_bug.cgi?id=212024
1111
1112         Reviewed by Eric Carlson.
1113
1114         Allow RealtimeMediaSource::videoSampleAvailable to be called on a background thread, typically the capture thread.
1115         Make WebRTC remote sources and mock capture sources do that.
1116
1117         RealtimeMediaSource is then updating its intrinsic size from the generation thread while updating its size in the main thread.
1118         The size() getter can be called from both threads.
1119
1120         Existing consumers do the following:
1121         - media player will hop to the main thread.
1122         - media recorder will do processing from the background thread.
1123         - WebRTC sender will do processing from the background thread, except when sending black frames where this will still be done on the main thread.
1124         This is ok as we ensure either we send black frames on the main thread (and we do not observe the source) or we observe the source to send.
1125
1126         Follow-ups will migrate the real capture sources as well as migrating media player processing out of the main thread.
1127         Covered by existing tests.
1128
1129         * platform/MediaSample.h:
1130         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1131         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
1132         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable):
1133         * platform/mediastream/RealtimeMediaSource.cpp:
1134         (WebCore::RealtimeMediaSource::videoSampleAvailable):
1135         (WebCore::RealtimeMediaSource::setIntrinsicSize):
1136         * platform/mediastream/RealtimeMediaSource.h:
1137         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
1138         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
1139         (WebCore::MockRealtimeVideoSourceMac::MockRealtimeVideoSourceMac):
1140         (WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer):
1141         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h:
1142         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
1143         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
1144         (WebCore::RealtimeIncomingVideoSourceCocoa::processNewSample): Deleted.
1145
1146 2020-05-19  Michael Catanzaro  <mcatanzaro@gnome.org>
1147
1148         REGRESSION(r257463): [GTK] Build failure with -DENABLE_GLES2=ON
1149         https://bugs.webkit.org/show_bug.cgi?id=212043
1150
1151         Reviewed by Philippe Normand.
1152
1153         Fix the typo "Platfom" -> "Platform"
1154
1155         * platform/graphics/gstreamer/PlatformDisplayGStreamer.cpp:
1156         (createGstGLDisplay):
1157
1158 2020-05-18  Simon Fraser  <simon.fraser@apple.com>
1159
1160         Move some of the more chatty Scrolling logging to a ScrollingTree channel
1161         https://bugs.webkit.org/show_bug.cgi?id=212061
1162
1163         Reviewed by Tim Horton.
1164
1165         Move logging about the scrolling tree to a new channel.
1166
1167         * page/FrameView.cpp:
1168         (WebCore::FrameView::scrollToFragmentInternal):
1169         (WebCore::FrameView::scrollToAnchor):
1170         * page/scrolling/AsyncScrollingCoordinator.cpp:
1171         (WebCore::AsyncScrollingCoordinator::createNode):
1172         (WebCore::AsyncScrollingCoordinator::insertNode):
1173         * page/scrolling/ScrollingStateTree.cpp:
1174         (WebCore::ScrollingStateTree::createUnparentedNode):
1175         (WebCore::ScrollingStateTree::insertNode):
1176         (WebCore::ScrollingStateTree::unparentNode):
1177         (WebCore::ScrollingStateTree::unparentChildrenAndDestroyNode):
1178         (WebCore::ScrollingStateTree::detachAndDestroySubtree):
1179         * page/scrolling/ScrollingTree.cpp:
1180         (WebCore::ScrollingTree::commitTreeState):
1181         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1182         (WebCore::ScrollingTreeScrollingNode::scrollTo):
1183         * page/scrolling/ThreadedScrollingTree.cpp:
1184         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
1185         * page/scrolling/cocoa/ScrollingTreeOverflowScrollProxyNode.mm:
1186         (WebCore::ScrollingTreeOverflowScrollProxyNode::applyLayerPositions):
1187         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
1188         (WebCore::ScrollingCoordinatorMac::commitTreeStateIfNeeded):
1189         * platform/Logging.h:
1190         * rendering/RenderLayerCompositor.cpp:
1191         (WebCore::RenderLayerCompositor::attachScrollingNode):
1192
1193 2020-05-18  David Kilzer  <ddkilzer@apple.com>
1194
1195         Replace TextIndicatorOptions with OptionSet<TextIndicatorOption>
1196         <https://webkit.org/b/212051>
1197         <rdar://problem/63368556>
1198
1199         Reviewed by Simon Fraser.
1200
1201         Use OptionSet<TextIndicatorOption> everywhere
1202         TextIndicatorOptions was previously used, plus:
1203         - Make TextIndicatorOption an enum class.  Remove
1204           "TextIndicatorOption" prefix so TextIndicatorOptionBar becomes
1205           TextIndicatorOption::Bar.
1206         - Remove TextIndicatorOptionDefault because OptionSet<>
1207           initializes to zero.
1208         - Replace static variables (including two globals in WebCore)
1209           with constexpr variables.
1210
1211         * page/TextIndicator.cpp:
1212         (WebCore::TextIndicator::createWithRange):
1213         (WebCore::TextIndicator::createWithSelectionInFrame):
1214         (WebCore::snapshotOptionsForTextIndicatorOptions):
1215         (WebCore::takeSnapshots):
1216         (WebCore::hasAnyIllegibleColors):
1217         (WebCore::initializeIndicator):
1218         * page/TextIndicator.h:
1219         * platform/ios/DragImageIOS.mm:
1220         (WebCore::createDragImageForLink):
1221         (WebCore::createDragImageForSelection):
1222         (WebCore::createDragImageForRange):
1223         * testing/Internals.h:
1224
1225 2020-05-18  Andy Estes  <aestes@apple.com>
1226
1227         http/tests/ssl/applepay/ApplePayInstallmentConfiguration.https.html fails in public SDK builds
1228         https://bugs.webkit.org/show_bug.cgi?id=212000
1229         <rdar://problem/63323082>
1230
1231         Reviewed by Youenn Fablet.
1232
1233         * Configurations/FeatureDefines.xcconfig:
1234         * bindings/js/WebCoreBuiltinNames.h:
1235
1236 2020-05-18  Myles C. Maxfield  <mmaxfield@apple.com>
1237
1238         [WebGPU] Validation for GPUDevice.createTexture()
1239         https://bugs.webkit.org/show_bug.cgi?id=211882
1240         <rdar://problem/63215999>
1241
1242         Reviewed by Dean Jackson.
1243
1244         Add lots of validation for texture creation. The logic was gathered by
1245         trial and error.
1246
1247         Before this patch, we didn't have any validation. This is a first pass, as
1248         the validation logic isn't spelled out in the spec. Next, I will make a pull
1249         request to the spec to match this patch.
1250
1251         This patch also updates three pieces of our IDL files to match the spec for
1252         WebGPU: One to remove GPUTextureUsage.NONE which was replaced with just 0,
1253         one to remove GPUTextureDescriptor.arrayLayerCount, which was deleted in
1254         favor of using regular dimension fields, and one to add [EnforceRange] to
1255         various values.
1256
1257         This patch also updates GPUDevice to have a GPUErrorScopes object, which is
1258         required for good error messages.
1259
1260         Test: webgpu/texture-creation.html
1261
1262         * Modules/webgpu/GPUExtent3D.idl:
1263         * Modules/webgpu/GPUTextureDescriptor.idl:
1264         * Modules/webgpu/WebGPUDevice.cpp:
1265         (WebCore::WebGPUDevice::tryCreate):
1266         (WebCore::WebGPUDevice::createTexture const):
1267         * Modules/webgpu/WebGPUDevice.h:
1268         * platform/graphics/gpu/GPUDevice.cpp:
1269         (WebCore::maximumMipLevelCount):
1270         (WebCore::GPUDevice::tryCreateTexture const):
1271         * platform/graphics/gpu/GPUDevice.h:
1272         (WebCore::GPUDevice::setErrorScopes):
1273         * platform/graphics/gpu/GPUExtent3D.h:
1274         * platform/graphics/gpu/GPUObjectBase.h:
1275         (WebCore::GPUObjectBase::errorScopes const):
1276         (WebCore::GPUObjectBase::errorScopes): Deleted.
1277         * platform/graphics/gpu/GPUTexture.h:
1278         * platform/graphics/gpu/GPUTextureDescriptor.h:
1279         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
1280         (WebCore::mtlTextureTypeForGPUTextureDescriptor):
1281         (WebCore::mtlTextureUsageForGPUTextureUsageFlags):
1282         (WebCore::tryCreateMtlTextureDescriptor):
1283         (WebCore::GPUTexture::tryCreate):
1284
1285 2020-05-18  Oriol Brufau  <obrufau@igalia.com>
1286
1287         [css-grid] Clear the override width for computing percent margins
1288         https://bugs.webkit.org/show_bug.cgi?id=209461
1289
1290         Reviewed by Manuel Rego Casasnovas.
1291
1292         When calculating the min-content contribution of a grid item of an auto
1293         sized grid track we must consider the grid item's margin. When the grid
1294         item's area is indefinite, a percent margin is resolved to zero.
1295         However, when performing a relayout, the percent margin may be solved
1296         against the previously computed grid area, since the grid item has
1297         already an OverrideContainingBlockLogicalWidth value.
1298
1299         In order to re-compute the percent margin properly, we need to clear
1300         the previously override value. It's important to be careful of not
1301         clearing the override value set during intrinsic size, since we need
1302         it for the actual layout phase. Hence, we only reset the 'override'
1303         value when we are executing a definite strategy.
1304
1305         Tests: imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-minimum-contribution-with-percentages.html
1306                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-item-dynamic-min-contribution-001.html
1307                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-003.html
1308                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-004.html
1309                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-005.html
1310                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-006.html
1311                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-007.html
1312                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-008.html
1313                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-009.html
1314                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-010.html
1315                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-011.html
1316                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-012.html
1317                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-013.html
1318                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-margins-014.html
1319                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-003.html
1320                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-004.html
1321                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-005.html
1322                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-006.html
1323                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-007.html
1324                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-008.html
1325                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-009.html
1326                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-010.html
1327                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-011.html
1328                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-012.html
1329                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-013.html
1330                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-percentage-paddings-014.html
1331
1332         * rendering/GridTrackSizingAlgorithm.cpp:
1333         (WebCore::hasRelativeMarginOrPaddingForChild):
1334         (WebCore::hasRelativeOrIntrinsicSizeForChild):
1335         (WebCore::shouldClearOverrideContainingBlockContentSizeForChild):
1336         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
1337         (WebCore::GridTrackSizingAlgorithmStrategy::minLogicalSizeForChild const):
1338         (WebCore::DefiniteSizeStrategy::minLogicalSizeForChild const):
1339         (WebCore::DefiniteSizeStrategy::minContentForChild const):
1340         * rendering/GridTrackSizingAlgorithm.h:
1341
1342 2020-05-18  David Kilzer  <ddkilzer@apple.com>
1343
1344         Follow-up: Use default initializers in TextIndicatorData
1345         <https://webkit.org/b/212039>
1346         <rdar://problem/63355619>
1347
1348         * page/TextIndicator.h:
1349         (WebCore::TextIndicatorData::contentImageScaleFactor):
1350         - Simon Fraser says 1 is a better default than 0.
1351
1352 2020-05-18  Peng Liu  <peng.liu6@apple.com>
1353
1354         Add a quirk to allow an embedded Twitter video to play with one tapping
1355         https://bugs.webkit.org/show_bug.cgi?id=211932
1356
1357         Reviewed by Maciej Stachowiak.
1358
1359         * html/MediaElementSession.cpp:
1360         (WebCore::MediaElementSession::playbackPermitted const):
1361         Need to check the topDocument for the existence of user interactions.
1362         (WebCore::MediaElementSession::updateMediaUsageIfChanged): Ditto.
1363
1364         * page/Quirks.cpp:
1365         (WebCore::Quirks::needsPerDocumentAutoplayBehavior const):
1366         Add the missing needsQuirks() checking.
1367         (WebCore::Quirks::shouldAutoplayForArbitraryUserGesture const):
1368         Add a the quirk for twitter.com.
1369
1370         * platform/audio/ios/MediaSessionManagerIOS.mm:
1371         (WebCore::MediaSessionManageriOS::sessionWillBeginPlayback):
1372         Clarify the log message.
1373
1374 2020-05-18  Simon Fraser  <simon.fraser@apple.com>
1375
1376         Content disappears on CSS parallax example
1377         https://bugs.webkit.org/show_bug.cgi?id=212045
1378         <rdar://problem/63194217>
1379
1380         Reviewed by Tim Horton.
1381         
1382         In r261632 I fixed parallax scrolling by migrating the perspective transform onto
1383         the scroll container layer, and making the scrolled contents layer a "preserve3D" layer.
1384         
1385         However, scrolling is achieved by changing the boundsOrigin of the scrolled contents layer,
1386         so the computation of the perspective matrix, which is a "child layer transform", has to
1387         take this boundsOrigin into account, otherwise we compute bad coverage rects, and drop
1388         backing store erroneously.
1389
1390         Test: compositing/tiling/perspective-on-scroller-tile-coverage.html
1391
1392         * platform/graphics/FloatPoint3D.h:
1393         (WebCore::FloatPoint3D::FloatPoint3D):
1394         (WebCore::FloatPoint3D::move):
1395         (WebCore::operator +=):
1396         (WebCore::operator -=):
1397         (WebCore::operator+):
1398         (WebCore::operator-):
1399         * platform/graphics/ca/GraphicsLayerCA.cpp:
1400         (WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush const):
1401         (WebCore::GraphicsLayerCA::layerTransform const):
1402         (WebCore::GraphicsLayerCA::adjustCoverageRect const):
1403         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
1404
1405 2020-05-18  David Kilzer  <ddkilzer@apple.com>
1406
1407         Use default initializers in TextIndicatorData
1408         <https://webkit.org/b/212039>
1409         <rdar://problem/63355619>
1410
1411         Reviewed by Alex Christensen.
1412
1413         Tested by IPC::Decoder::decode() and IPC::Encoder::operator<<()
1414         running on WebKit2 API and layout tests.
1415
1416         * page/TextIndicator.h:
1417         (WebCore::TextIndicatorData):
1418         - Add default initializers.
1419         (WTF::EnumTraits<WebCore::TextIndicatorPresentationTransition>):
1420         - Add EnumTraits so TextIndicatorPresentationTransition may be
1421           used by IPC::Decoder::decode() and IPC::Encoder::operator<<().
1422
1423 2020-05-18  Simon Fraser  <simon.fraser@apple.com>
1424
1425         Fix operator== and hash() for ExtendedColor
1426         https://bugs.webkit.org/show_bug.cgi?id=211993
1427
1428         Post-landing followup. ExtendedColor operator== has to do exact comparison to be
1429         consistent with hash().
1430
1431         * platform/graphics/ExtendedColor.h:
1432         (WebCore::operator==):
1433
1434 2020-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1435
1436         Replace uses of +self with +class
1437         https://bugs.webkit.org/show_bug.cgi?id=212041
1438
1439         Reviewed by Darin Adler.
1440
1441         No change in behavior.
1442
1443         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1444         (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
1445         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
1446         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
1447         (WebCore::PlatformCALayer::isWebLayer):
1448
1449 2020-05-18  Ross Kirsling  <ross.kirsling@sony.com>
1450
1451         Unreviewed restabilization of non-unified build. 
1452
1453         * accessibility/AXObjectCache.cpp:
1454         * html/HTMLAttachmentElement.h:
1455         * inspector/agents/InspectorCSSAgent.cpp:
1456         * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
1457         * layout/tableformatting/TableFormattingContextGeometry.cpp:
1458         * layout/tableformatting/TableFormattingState.cpp:
1459         * rendering/RenderTextFragment.h:
1460         * rendering/style/KeyframeList.h:
1461
1462 2020-05-18  Pinki Gyanchandani  <pgyanchandani@apple.com>
1463
1464         Null Ptr Deref @ WebCore::CSSValue::classType
1465         https://bugs.webkit.org/show_bug.cgi?id=212036
1466
1467         Reviewed by Geoffrey Garen.
1468
1469         Calculated value for a primitive value type can be NULL for a CSS property. Added a null check before dereferencing it.
1470
1471         Test: editing/execCommand/null_calc_primitive_value_for_css_property.html
1472
1473         * css/CSSPrimitiveValue.cpp:
1474         (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):
1475
1476 2020-05-18  Simon Fraser  <simon.fraser@apple.com>
1477
1478         Implement conversion between P3 and sRGB color
1479         https://bugs.webkit.org/show_bug.cgi?id=211998
1480
1481         Reviewed by Daniel Bates.
1482         
1483         Color::toSRGBAComponentsLossy() was a lie because it didn't actually convert extended
1484         colors into sRGB. Fix that by converting P3 and linaerRGB colors into sRGB, using the color
1485         math from CSS Color 4.
1486
1487         Renamed the various "linear to sRGB" functions because they work for any RGB colors,
1488         not just sRGB.
1489
1490         * platform/graphics/Color.cpp:
1491         (WebCore::Color::toSRGBAComponentsLossy const):
1492         * platform/graphics/Color.h:
1493         * platform/graphics/ColorUtilities.cpp:
1494         (WebCore::linearToRGBColorComponent):
1495         (WebCore::RGBToLinearColorComponent):
1496         (WebCore::sRGBColorToLinearComponents):
1497         (WebCore::RGBToLinearComponents):
1498         (WebCore::linearToRGBComponents):
1499         (WebCore::XYZToLinearSRGB):
1500         (WebCore::linearSRGBToXYZ):
1501         (WebCore::XYZToLinearP3):
1502         (WebCore::linearP3ToXYZ):
1503         (WebCore::P3ToSRGB):
1504         (WebCore::sRGBToP3):
1505         (WebCore::ColorMatrix::transformedColorComponents const):
1506         (WebCore::linearToSRGBColorComponent): Deleted.
1507         (WebCore::sRGBToLinearColorComponent): Deleted.
1508         (WebCore::sRGBToLinearComponents): Deleted.
1509         (WebCore::linearToSRGBComponents): Deleted.
1510         * platform/graphics/ColorUtilities.h:
1511
1512 2020-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1513
1514         Allow clipboard API access when pasting from a menu item or key binding
1515         https://bugs.webkit.org/show_bug.cgi?id=211990
1516         <rdar://problem/63308916>
1517
1518         Reviewed by Megan Gardner.
1519
1520         Allow the contents of the clipboard to be programmatically requested by the page while pasting from trusted UI
1521         (i.e. the paste menu item, or when WebKit API is called by the app to trigger the paste). This allows the
1522         'reading' part of the async clipboard API (`read` and `readText`) to be used when the user pastes in an editable
1523         element, without having to fall back to showing the DOM paste access menu.
1524
1525         Note that this change should not have an effect on the pasteboard security model, since it only grants the page
1526         programmatic access to the contents of the pasteboard in the case where access to the pasteboard has already
1527         been granted by the user. Additionally, even in the event that the web process is compromised, even if the web
1528         process can be tricked into believing it has been granted pasteboard access, the changes in r259151 will prevent
1529         it from being able to request pasteboard data, unless the user (or the application, on behalf of the user) has
1530         explicitly pasted via trusted API calls that are inaccessible from the web process.
1531
1532         Test: editing/async-clipboard/clipboard-read-while-pasting.html
1533
1534         * editing/Editor.cpp:
1535         (WebCore::Editor::paste):
1536         (WebCore::Editor::pasteAsPlainText):
1537         (WebCore::Editor::pasteAsQuotation):
1538
1539         If `FromMenuOrKeyBinding::Yes` is passed in, set the `m_pastingFromMenuOrKeyBinding` flag to true during the
1540         scope of the paste command.
1541
1542         * editing/Editor.h:
1543         (WebCore::Editor::isPastingFromMenuOrKeyBinding const):
1544         * editing/EditorCommand.cpp:
1545         (WebCore::executePaste):
1546         (WebCore::executePasteAndMatchStyle):
1547         (WebCore::executePasteAsPlainText):
1548         (WebCore::executePasteAsQuotation):
1549
1550         Pass in `FromMenuOrKeyBinding::Yes` when triggering the paste from a menu item or key binding.
1551
1552         * page/Frame.cpp:
1553         (WebCore::Frame::requestDOMPasteAccess):
1554
1555         When pasting from menu or key binding, grant the page DOM paste access without requiring the DOM paste access
1556         UI to be shown and confirmed.
1557
1558 2020-05-18  Per Arne Vollan  <pvollan@apple.com>
1559
1560         [Win] Fix AppleWin build
1561         https://bugs.webkit.org/show_bug.cgi?id=212030
1562
1563         Reviewed by Brent Fulgham.
1564
1565         The build fails because the number of bitfields in GreaterThanOrSameSizeAsStyleRareInheritedData does not match the
1566         actual number of bitfields in StyleRareInheritedData.
1567
1568         * rendering/style/StyleRareInheritedData.cpp:
1569
1570 2020-05-18  Rob Buis  <rbuis@igalia.com>
1571
1572         Remove certain headers when a redirect causes a request method change
1573         https://bugs.webkit.org/show_bug.cgi?id=205119
1574
1575         Reviewed by Youenn Fablet.
1576
1577         Implement step 11 of HTTP-redirect fetch [1] to redirect to GET
1578         method, remove body and strip certain headers for 301, 302 and 303 redirects.
1579
1580         Tests: imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.html
1581                imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.any.worker.html
1582
1583         * loader/SubresourceLoader.cpp:
1584         (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
1585         * platform/network/HTTPHeaderNames.in:
1586         * platform/network/ResourceRequestBase.cpp:
1587         (WebCore::shouldUseGet):
1588         (WebCore::ResourceRequestBase::redirectAsGETIfNeeded):
1589         (WebCore::ResourceRequestBase::redirectedRequest const):
1590         * platform/network/ResourceRequestBase.h:
1591
1592 2020-05-18  Antti Koivisto  <antti@apple.com>
1593
1594         [Wheel event region] Invalidation for root style
1595         https://bugs.webkit.org/show_bug.cgi?id=212029
1596
1597         Reviewed by Simon Fraser.
1598
1599         Test: fast/scrolling/mac/wheel-event-listener-region-root-invalidation.html
1600
1601         Invalidate the region when event listeners change on Document or Window.
1602
1603         * dom/Document.cpp:
1604         (WebCore::Document::invalidateEventListenerRegions):
1605         * dom/Document.h:
1606         (isType):
1607         * dom/Element.cpp:
1608         (WebCore::Element::invalidateEventListenerRegions):
1609         * dom/Element.h:
1610         * dom/EventTarget.cpp:
1611         (WebCore::EventTarget::addEventListener):
1612         (WebCore::EventTarget::removeEventListener):
1613         (WebCore::EventTarget::removeAllEventListeners):
1614         (WebCore::EventTarget::invalidateEventListenerRegions):
1615         * dom/EventTarget.h:
1616         * style/StyleAdjuster.cpp:
1617         (WebCore::Style::Adjuster::adjustEventListenerRegionTypesForRootStyle):
1618         * style/StyleAdjuster.h:
1619         * style/StyleResolveForDocument.cpp:
1620         (WebCore::Style::resolveForDocument):
1621
1622 2020-05-18  Simon Fraser  <simon.fraser@apple.com>
1623
1624         Find doesn't always scroll search results into view
1625         https://bugs.webkit.org/show_bug.cgi?id=212007
1626         <rdar://problem/36333321>
1627
1628         Reviewed by Wenson Hsieh.
1629
1630         HighlightData::collectBounds() could produce overly large bounds, causing the selection
1631         to fail to scroll into view.
1632         
1633         This happened when multiple block ancestors were added to 'renderers', with empty
1634         rects. The process of mapping that empty rect to a quad via localToAbsoluteQuad()
1635         could produce an empty quad at a fractional offset, then calling enclosingBoundingBox()
1636         on the quad would create a 1x1 rectangle, which got unioned with selectionRect.
1637
1638         Fix by skipping entries with empty rects.
1639
1640         Add a Selection log channel and some logging that makes this trivial to see.
1641
1642         Test: editing/selection/selection-bounds-fractional-containing-blocks.html
1643
1644         * platform/Logging.h:
1645         * rendering/HighlightData.cpp:
1646         (WebCore::HighlightData::collectBounds const):
1647
1648 2020-05-18  Darin Adler  <darin@apple.com>
1649
1650         Add iterator checking to ListHashSet
1651         https://bugs.webkit.org/show_bug.cgi?id=211669
1652
1653         Reviewed by Anders Carlsson.
1654
1655         * page/ios/ContentChangeObserver.h: Added an include of Element.h, needed to call
1656         makeWeakPtr in an inline function. This is due to a change in the way makeWeakPtr
1657         now checks the type of the argument. It's possible we could refine it further to
1658         relax this requirement, but it seems OK to include Element.h here.
1659
1660 2020-05-18  Zalan Bujtas  <zalan@apple.com>
1661
1662         [LFC][TFC] Add support for computing the collapsed table border
1663         https://bugs.webkit.org/show_bug.cgi?id=212003
1664
1665         Reviewed by Antti Koivisto.
1666
1667         UAs must compute an initial left and right border width for the table by examining
1668         the first and last cells in the first row of the table.
1669         The left border width of the table is half of the first cell's collapsed left border,
1670         and the right border width of the table is half of the last cell's collapsed right border.
1671         The top border width of the table is computed by examining all cells who collapse their top
1672         borders with the top border of the table. The top border width of the table is equal to half of the
1673         maximum collapsed top border. The bottom border width is computed by examining all cells whose bottom borders collapse
1674         with the bottom of the table. The bottom border width is equal to half of the maximum collapsed bottom border.
1675
1676         https://www.w3.org/TR/CSS22/tables.html#collapsing-borders
1677
1678         This patch implements the table box part of the border collapsing. Inner table elements need to implement collapsing as well.
1679
1680         * layout/LayoutState.cpp:
1681         (WebCore::Layout::LayoutState::ensureTableFormattingState):
1682         * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
1683         (WebCore::Layout::TableWrapperBlockFormattingContext::layoutTableBox):
1684         (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox):
1685         (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox):
1686         * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.h:
1687         * layout/tableformatting/TableFormattingContext.cpp:
1688         (WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints):
1689         (WebCore::Layout::TableFormattingContext::ensureTableGrid):
1690         * layout/tableformatting/TableFormattingContext.h:
1691         * layout/tableformatting/TableFormattingState.cpp:
1692         (WebCore::Layout::TableFormattingState::TableFormattingState):
1693         * layout/tableformatting/TableFormattingState.h:
1694
1695 2020-05-18  Antoine Quint  <graouts@apple.com>
1696
1697         Clean up media controls content for Apple platforms
1698         https://bugs.webkit.org/show_bug.cgi?id=212011
1699         <rdar://problem/63298588>
1700
1701         Reviewed by Dean Jackson.
1702
1703         We strip Copyright and other comments from the CSS and JS media controls files.
1704
1705         * WebCore.xcodeproj/project.pbxproj:
1706
1707 2020-05-18  Alicia Boya García  <aboya@igalia.com>
1708
1709         [GStreamer][MediaSource] Remove orphaned tracks in updateTracks()
1710         https://bugs.webkit.org/show_bug.cgi?id=211980
1711
1712         Reviewed by Xabier Rodriguez-Calvar.
1713
1714         This patch ensures tracks missing from a subsequent updateTracks()
1715         calls are removed from the player.
1716
1717         This fixes regressions on the following tests caused on r261683.
1718
1719         imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-removetrack.https.html
1720         imported/w3c/web-platform-tests/mediacapture-streams/MediaStreamTrack-applyConstraints.https.html
1721
1722         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1723         (WebCore::hashSetFromHashMapKeys):
1724         (WebCore::MediaPlayerPrivateGStreamer::updateTracks):
1725
1726 2020-05-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1727
1728         [GTK] "ASSERTION FAILED: !m_adoptionIsRequired" when double clicking on a word
1729         https://bugs.webkit.org/show_bug.cgi?id=211957
1730
1731         Reviewed by Adrian Perez de Castro.
1732
1733         Make SelectionData non-refcounted. We can just move in most of the cases to avoid copies.
1734
1735         * platform/Pasteboard.h:
1736         * platform/gtk/PasteboardGtk.cpp:
1737         (WebCore::Pasteboard::createForDragAndDrop):
1738         (WebCore::Pasteboard::Pasteboard):
1739         (WebCore::Pasteboard::selectionData const):
1740         * platform/gtk/SelectionData.h:
1741
1742 2020-05-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1743
1744         [GTK] Add WebKitContextMenuItemType for paste as plaintext
1745         https://bugs.webkit.org/show_bug.cgi?id=177638
1746
1747         Reviewed by Michael Catanzaro.
1748
1749         Add paste as plain text context menu item for rich editable content.
1750
1751         * page/ContextMenuController.cpp:
1752         (WebCore::ContextMenuController::contextMenuItemSelected):
1753         (WebCore::ContextMenuController::populate):
1754         (WebCore::ContextMenuController::checkOrEnableIfNeeded const):
1755         * platform/ContextMenuItem.h:
1756         * platform/LocalizedStrings.h:
1757         * platform/gtk/LocalizedStringsGtk.cpp:
1758         (WebCore::contextMenuItemTagPasteAsPlainText):
1759
1760 2020-05-17  Simon Fraser  <simon.fraser@apple.com>
1761
1762         Fix operator== and hash() for ExtendedColor
1763         https://bugs.webkit.org/show_bug.cgi?id=211993
1764
1765         Reviewed by Sam Weinig.
1766
1767         Color::operator== and hash() were wrong for extended color. Fix operator==
1768         to compare extended colors. Extended and non-extended colors have to always
1769         conpare as non-equal to preserve computed style behavior, currently.
1770
1771         Fix hash() to hash the color components and colorspace for ExtendedColor.
1772
1773         Add some API tests for these code paths.
1774
1775         * platform/graphics/Color.cpp:
1776         (WebCore::extendedColorsEqual):
1777         * platform/graphics/Color.h:
1778         (WebCore::operator==):
1779         (WebCore::Color::hash const):
1780         * platform/graphics/ColorUtilities.cpp:
1781         (WebCore::areEssentiallyEqual):
1782         * platform/graphics/ColorUtilities.h:
1783         (WebCore::operator==):
1784         (WebCore::operator!=):
1785         * platform/graphics/ExtendedColor.cpp:
1786         (WebCore::ExtendedColor::hash const):
1787         * platform/graphics/ExtendedColor.h:
1788         (WebCore::operator==):
1789         (WebCore::operator!=):
1790
1791 2020-05-17  Zalan Bujtas  <zalan@apple.com>
1792
1793         [LFC][BFC] Introduce TableWrapperBlockFormattingContext
1794         https://bugs.webkit.org/show_bug.cgi?id=211996
1795
1796         Reviewed by Antti Koivisto.
1797
1798         Table wrapper box establishes a special BFC with only captions and the actual table box in it.
1799         It mostly behaves like a normal BFC but the table box requires some special handing when it comes
1800         to padding/border and width/height computation.
1801         This patch moves the table box specific code from generic BFC to this new subclass. 
1802
1803         * Sources.txt:
1804         * WebCore.xcodeproj/project.pbxproj:
1805         * layout/FormattingContext.h:
1806         * layout/LayoutContext.cpp:
1807         (WebCore::Layout::LayoutContext::createFormattingContext):
1808         * layout/blockformatting/BlockFormattingContext.cpp:
1809         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
1810         * layout/blockformatting/BlockFormattingContext.h:
1811         (): Deleted.
1812         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1813         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
1814         * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: Added.
1815         (WebCore::Layout::TableWrapperBlockFormattingContext::TableWrapperBlockFormattingContext):
1816         (WebCore::Layout::TableWrapperBlockFormattingContext::layoutInFlowContent):
1817         (WebCore::Layout::TableWrapperBlockFormattingContext::layoutTableBox):
1818         (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox):
1819         (WebCore::Layout::TableWrapperBlockFormattingContext::computeHeightAndMarginForTableBox):
1820         * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.h: Added.
1821
1822 2020-05-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1823
1824         [GTK] Move to new Pasteboard API
1825         https://bugs.webkit.org/show_bug.cgi?id=177633
1826
1827         Reviewed by Adrian Perez de Castro.
1828
1829         Add support for custom data and remove the support for unknown data types that is currently unused.
1830
1831         * editing/gtk/EditorGtk.cpp:
1832         (WebCore::Editor::writeSelectionToPasteboard): Set the contentOrigin.
1833         * editing/gtk/WebContentReaderGtk.cpp:
1834         (WebCore::shouldReplaceSubresourceURL): Helper to decide whether to replace the subresource URL.
1835         (WebCore::WebContentMarkupReader::readHTML): Create a fragment for HTML sanitizing it if needed.
1836         * platform/Pasteboard.h:
1837         * platform/PasteboardCustomData.h:
1838         (WebCore::PasteboardCustomData::gtkType): Mime type name for GTK custom pasteboard data.
1839         * platform/SharedBuffer.h:
1840         * platform/glib/SharedBufferGlib.cpp:
1841         (WebCore::SharedBuffer::createGBytes const): Create a GBytes wrapping the SharedBuffer data.
1842         * platform/gtk/PasteboardGtk.cpp:
1843         (WebCore::Pasteboard::writeString):
1844         (WebCore::Pasteboard::write):
1845         (WebCore::Pasteboard::read):
1846         (WebCore::Pasteboard::hasData):
1847         (WebCore::Pasteboard::typesSafeForBindings):
1848         (WebCore::Pasteboard::typesForLegacyUnsafeBindings):
1849         (WebCore::Pasteboard::readOrigin):
1850         (WebCore::Pasteboard::readString):
1851         (WebCore::Pasteboard::readStringInCustomData):
1852         (WebCore::Pasteboard::fileContentState):
1853         (WebCore::Pasteboard::writeCustomData):
1854         * platform/gtk/SelectionData.cpp:
1855         (WebCore::SelectionData::clearAllExceptFilenames):
1856         * platform/gtk/SelectionData.h:
1857         (WebCore::SelectionData::setCustomData):
1858         (WebCore::SelectionData::customData const):
1859         (WebCore::SelectionData::hasCustomData const):
1860         (WebCore::SelectionData::clearCustomData):
1861
1862 2020-05-16  Simon Fraser  <simon.fraser@apple.com>
1863
1864         Some color-related cleanup
1865         https://bugs.webkit.org/show_bug.cgi?id=211991
1866
1867         Reviewed by Sam Weinig.
1868
1869         Change FloatComponents and ColorComponents to use std::array<>.
1870
1871         Add Color::toSRGBAComponentsLossy() to make explicit potentially lossy conversions
1872         between P3 and sRGB colors, and call it in places where we do that conversion.
1873
1874         Add const in a few places.
1875
1876         * Headers.cmake:
1877         * WebCore.xcodeproj/project.pbxproj:
1878         * platform/graphics/Color.cpp:
1879         (WebCore::Color::Color):
1880         (WebCore::Color::toSRGBAComponentsLossy const):
1881         (WebCore::Color::asExtended const):
1882         * platform/graphics/Color.h:
1883         * platform/graphics/ColorUtilities.cpp:
1884         (WebCore::ColorMatrix::ColorMatrix):
1885         * platform/graphics/ColorUtilities.h:
1886         (WebCore::FloatComponents::FloatComponents):
1887         (): Deleted.
1888         * platform/graphics/ExtendedColor.cpp:
1889         (WebCore::ExtendedColor::create):
1890         (WebCore::ExtendedColor::cssText const):
1891         * platform/graphics/ExtendedColor.h:
1892         (WebCore::ExtendedColor::red const):
1893         (WebCore::ExtendedColor::green const):
1894         (WebCore::ExtendedColor::blue const):
1895         (WebCore::ExtendedColor::alpha const):
1896         (WebCore::ExtendedColor::channels const):
1897         (WebCore::ExtendedColor::ExtendedColor):
1898         * platform/graphics/cg/ColorCG.cpp:
1899         (WebCore::leakCGColor):
1900         * platform/graphics/filters/FETurbulence.cpp:
1901         (WebCore::FETurbulence::fillRegion const):
1902         * platform/graphics/filters/FilterOperation.cpp:
1903         (WebCore::InvertLightnessFilterOperation::transformColor const):
1904         (WebCore::InvertLightnessFilterOperation::inverseTransformColor const):
1905         * platform/graphics/gtk/ColorGtk.cpp:
1906         (WebCore::Color::operator GdkRGBA const):
1907         * platform/graphics/win/ColorDirect2D.cpp:
1908         (WebCore::Color::operator D2D1_COLOR_F const):
1909         (WebCore::Color::operator D2D1_VECTOR_4F const):
1910
1911 2020-05-16  Andy Estes  <aestes@apple.com>
1912
1913         Fix the build after r261785.
1914
1915         * Modules/applepay/PaymentInstallmentConfiguration.mm:
1916         (WebCore::fromDecimalNumber):
1917
1918 2020-05-16  David Kilzer  <ddkilzer@apple.com>
1919
1920         Let Xcode have its way with WebCore project
1921
1922         * WebCore.xcodeproj/project.pbxproj:
1923         - Resort TableLayout.cpp.
1924
1925 2020-05-16  Zalan Bujtas  <zalan@apple.com>
1926
1927         Add missing is<RenderTableSection> check.
1928
1929         Unreviewed.
1930
1931         * layout/Verification.cpp:
1932         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
1933
1934 2020-05-16  Andy Estes  <aestes@apple.com>
1935
1936         REGRESSION (r260717): installmentConfiguration member is no longer available on ApplePayPaymentRequest
1937         https://bugs.webkit.org/show_bug.cgi?id=211911
1938         <rdar://problem/63236367>
1939
1940         Reviewed by Tim Horton.
1941
1942         Prior to r260717, installmentConfiguration was a member of ApplePayRequestBase, making it
1943         available on ApplePayRequest and ApplePayPaymentRequest. In r260717, it was mistakenly
1944         moved to ApplePayRequest.
1945
1946         This change moves it back to ApplePayRequestBase, adds infrastructure for regression testing
1947         ApplePayInstallmentConfiguration, and adds a regression test.
1948
1949         Test: http/tests/ssl/applepay/ApplePayInstallmentConfiguration.https.html
1950
1951         * Modules/applepay/ApplePayInstallmentConfiguration.idl:
1952         * Modules/applepay/ApplePayRequestBase.cpp:
1953         (WebCore::convertAndValidate):
1954         (WebCore::finishConverting): Deleted.
1955         * Modules/applepay/ApplePayRequestBase.idl:
1956         * Modules/applepay/PaymentInstallmentConfiguration.mm:
1957         (WebCore::fromDecimalNumber):
1958         (WebCore::applePaySetupFeatureType):
1959         (WebCore::PaymentInstallmentConfiguration::applePayInstallmentConfiguration const):
1960         * Modules/applepay/PaymentInstallmentConfigurationWebCore.h:
1961         * Modules/applepay/paymentrequest/ApplePayRequest.idl:
1962         * testing/MockPaymentCoordinator.cpp:
1963         (WebCore::MockPaymentCoordinator::showPaymentUI):
1964         * testing/MockPaymentCoordinator.h:
1965         * testing/MockPaymentCoordinator.idl:
1966
1967 2020-05-16  Zalan Bujtas  <zalan@apple.com>
1968
1969         [LFC][TFC] Ignore table padding when borders are collapsed
1970         https://bugs.webkit.org/show_bug.cgi?id=211984
1971
1972         Reviewed by Antti Koivisto.
1973
1974         Table padding has no room left when the table border is collapsed with the inner table elements.
1975
1976         Test: fast/layoutformattingcontext/table-simple-border-collapse-with-padding.html
1977
1978         * layout/Verification.cpp:
1979         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
1980         * layout/layouttree/LayoutBox.cpp:
1981         (WebCore::Layout::Box::isPaddingApplicable const):
1982
1983 2020-05-16  Zalan Bujtas  <zalan@apple.com>
1984
1985         [LFC][TFC] Take vertical spacing into account when setting the height of a cell with rowspan
1986         https://bugs.webkit.org/show_bug.cgi?id=211976
1987
1988         Reviewed by Antti Koivisto.
1989
1990         When a cell spans over multiple rows, the height of the cell includes the vertical spacing between those spanned rows as well.
1991
1992         Test: fast/layoutformattingcontext/table-simple-rowspan-with-spacing.html
1993
1994         * layout/tableformatting/TableFormattingContext.cpp:
1995         (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells):
1996
1997 2020-05-15  Antti Koivisto  <antti@apple.com>
1998
1999         Nullptr crash in MediaQueryMatcher::evaluateAll
2000         https://bugs.webkit.org/show_bug.cgi?id=211963
2001         <rdar://problem/62850977>
2002
2003         Reviewed by Brent Fulgham.
2004
2005         Test: fast/media/media-query-list-mutation.html
2006
2007         * css/MediaQueryMatcher.cpp:
2008         (WebCore::MediaQueryMatcher::evaluateAll):
2009
2010         Copy the vector before iterating.
2011
2012 2020-05-15  Jack Lee  <shihchieh_lee@apple.com>
2013
2014         Nullptr crash in WebCore::Node::treeScope() when processing nested list insertion commands.
2015         https://bugs.webkit.org/show_bug.cgi?id=211964
2016         <rdar://problem/63224871>
2017
2018         Reviewed by Geoffrey Garen.
2019
2020         Load event may fire in fixOrphanedListChild() and change the node tree. In doApplyForSingleParagraph check for 
2021         disconnected node returned by fixOrphanedListChild() and bail out.
2022
2023         Test: editing/inserting/nested-list-insertion-crash.html
2024
2025         * editing/InsertListCommand.cpp:
2026         (WebCore::InsertListCommand::doApplyForSingleParagraph):
2027
2028 2020-05-15  Alex Christensen  <achristensen@webkit.org>
2029
2030         Use enum serialization instead of casting to/from uint32_t
2031         https://bugs.webkit.org/show_bug.cgi?id=211885
2032         <rdar://problem/60106629> and <rdar://problem/60107663>
2033
2034         Reviewed by Geoffrey Garen.
2035
2036         This doesn't change anything except make stricter checks at IPC boundaries.
2037
2038         * accessibility/AccessibilityRenderObject.cpp:
2039         (WebCore::AccessibilityRenderObject::visiblePositionRangeForLine const):
2040         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2041         (-[WebAccessibilityObjectWrapper accessibilityModifySelection:increase:]):
2042         * editing/EditingBehavior.h:
2043         * editing/Editor.cpp:
2044         (WebCore::Editor::shouldSmartDelete):
2045         (WebCore::Editor::deleteWithDirection):
2046         (WebCore::Editor::misspelledWordAtCaretOrRange const):
2047         (WebCore::Editor::guessesForMisspelledOrUngrammatical):
2048         (WebCore::Editor::markMisspellingsAfterTypingToWord):
2049         (WebCore::Editor::markAndReplaceFor):
2050         (WebCore::Editor::handleAcceptedCandidate):
2051         * editing/EditorCommand.cpp:
2052         (WebCore::executeDeleteBackward):
2053         (WebCore::executeDeleteBackwardByDecomposingPreviousCharacter):
2054         (WebCore::executeDeleteForward):
2055         (WebCore::executeDeleteToBeginningOfLine):
2056         (WebCore::executeDeleteToBeginningOfParagraph):
2057         (WebCore::executeDeleteToEndOfLine):
2058         (WebCore::executeDeleteToEndOfParagraph):
2059         (WebCore::executeDeleteWordBackward):
2060         (WebCore::executeDeleteWordForward):
2061         (WebCore::executeForwardDelete):
2062         (WebCore::executeMoveBackward):
2063         (WebCore::executeMoveBackwardAndModifySelection):
2064         (WebCore::executeMoveDown):
2065         (WebCore::executeMoveDownAndModifySelection):
2066         (WebCore::executeMoveForward):
2067         (WebCore::executeMoveForwardAndModifySelection):
2068         (WebCore::executeMoveLeft):
2069         (WebCore::executeMoveLeftAndModifySelection):
2070         (WebCore::executeMoveRight):
2071         (WebCore::executeMoveRightAndModifySelection):
2072         (WebCore::executeMoveToBeginningOfDocument):
2073         (WebCore::executeMoveToBeginningOfDocumentAndModifySelection):
2074         (WebCore::executeMoveToBeginningOfLine):
2075         (WebCore::executeMoveToBeginningOfLineAndModifySelection):
2076         (WebCore::executeMoveToBeginningOfParagraph):
2077         (WebCore::executeMoveToBeginningOfParagraphAndModifySelection):
2078         (WebCore::executeMoveToBeginningOfSentence):
2079         (WebCore::executeMoveToBeginningOfSentenceAndModifySelection):
2080         (WebCore::executeMoveToEndOfDocument):
2081         (WebCore::executeMoveToEndOfDocumentAndModifySelection):
2082         (WebCore::executeMoveToEndOfSentence):
2083         (WebCore::executeMoveToEndOfSentenceAndModifySelection):
2084         (WebCore::executeMoveToEndOfLine):
2085         (WebCore::executeMoveToEndOfLineAndModifySelection):
2086         (WebCore::executeMoveToEndOfParagraph):
2087         (WebCore::executeMoveToEndOfParagraphAndModifySelection):
2088         (WebCore::executeMoveParagraphBackwardAndModifySelection):
2089         (WebCore::executeMoveParagraphForwardAndModifySelection):
2090         (WebCore::executeMoveUp):
2091         (WebCore::executeMoveUpAndModifySelection):
2092         (WebCore::executeMoveWordBackward):
2093         (WebCore::executeMoveWordBackwardAndModifySelection):
2094         (WebCore::executeMoveWordForward):
2095         (WebCore::executeMoveWordForwardAndModifySelection):
2096         (WebCore::executeMoveWordLeft):
2097         (WebCore::executeMoveWordLeftAndModifySelection):
2098         (WebCore::executeMoveWordRight):
2099         (WebCore::executeMoveWordRightAndModifySelection):
2100         (WebCore::executeMoveToLeftEndOfLine):
2101         (WebCore::executeMoveToLeftEndOfLineAndModifySelection):
2102         (WebCore::executeMoveToRightEndOfLine):
2103         (WebCore::executeMoveToRightEndOfLineAndModifySelection):
2104         (WebCore::executeSelectLine):
2105         (WebCore::executeSelectParagraph):
2106         (WebCore::executeSelectSentence):
2107         (WebCore::executeSelectWord):
2108         * editing/FrameSelection.cpp:
2109         (WebCore::FrameSelection::FrameSelection):
2110         (WebCore::FrameSelection::willBeModified):
2111         (WebCore::FrameSelection::modifyExtendingRight):
2112         (WebCore::FrameSelection::modifyExtendingForward):
2113         (WebCore::FrameSelection::modifyMovingRight):
2114         (WebCore::FrameSelection::modifyMovingForward):
2115         (WebCore::FrameSelection::modifyExtendingLeft):
2116         (WebCore::FrameSelection::modifyExtendingBackward):
2117         (WebCore::FrameSelection::modifyMovingLeft):
2118         (WebCore::FrameSelection::modifyMovingBackward):
2119         (WebCore::isBoundary):
2120         (WebCore::FrameSelection::textSelectionIntent):
2121         (WebCore::textSelectionWithDirectionAndGranularity):
2122         (WebCore::FrameSelection::modify):
2123         (WebCore::FrameSelection::clear):
2124         (WebCore::FrameSelection::willBeRemovedFromFrame):
2125         (WebCore::FrameSelection::updateAppearance):
2126         (WebCore::FrameSelection::wordSelectionContainingCaretSelection):
2127         (WebCore::FrameSelection::rangeByAlteringCurrentSelection const):
2128         * editing/FrameSelection.h:
2129         * editing/TextGranularity.h:
2130         (): Deleted.
2131         * editing/TypingCommand.cpp:
2132         (WebCore::editActionForTypingCommand):
2133         (WebCore::TypingCommand::deleteKeyPressed):
2134         (WebCore::TypingCommand::forwardDeleteKeyPressed):
2135         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
2136         (WebCore::TypingCommand::insertLineBreak):
2137         (WebCore::TypingCommand::insertParagraphSeparator):
2138         (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent):
2139         (WebCore::TypingCommand::deleteSelection):
2140         * editing/TypingCommand.h:
2141         * editing/VisibleSelection.cpp:
2142         (WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity):
2143         * editing/VisibleSelection.h:
2144         * editing/VisibleUnits.cpp:
2145         (WebCore::directionIsDownstream):
2146         (WebCore::atBoundaryOfGranularity):
2147         (WebCore::withinTextUnitOfGranularity):
2148         (WebCore::nextWordBoundaryInDirection):
2149         (WebCore::nextSentenceBoundaryInDirection):
2150         (WebCore::nextParagraphBoundaryInDirection):
2151         (WebCore::positionOfNextBoundaryOfGranularity):
2152         (WebCore::enclosingTextUnitOfGranularity):
2153         (WebCore::charactersAroundPosition):
2154         (WebCore::wordRangeFromPosition):
2155         (WebCore::closestWordBoundaryForPosition):
2156         (WebCore::rangeExpandedByCharactersInDirectionAtWordBoundary):
2157         (WebCore::wordBoundaryForPositionWithoutCrossingLine):
2158         * editing/cocoa/DataDetection.mm:
2159         (WebCore::DataDetection::detectItemAroundHitTestResult):
2160         * editing/cocoa/DictionaryLookup.mm:
2161         * editing/mac/DictionaryLookupLegacy.mm:
2162         * html/canvas/WebGLRenderingContextBase.cpp:
2163         (WebCore::WebGLRenderingContextBase::create):
2164         * loader/FrameLoaderClient.h:
2165         (WebCore::FrameLoaderClient::webGLPolicyForURL const):
2166         (WebCore::FrameLoaderClient::resolveWebGLPolicyForURL const):
2167         (): Deleted.
2168         * loader/FrameLoaderTypes.h:
2169         * page/ContextMenuController.cpp:
2170         (WebCore::ContextMenuController::contextMenuItemSelected):
2171         * page/DOMSelection.cpp:
2172         (WebCore::DOMSelection::modify):
2173         * page/DragController.cpp:
2174         (WebCore::DragController::concludeEditDrag):
2175         * page/EventHandler.cpp:
2176         (WebCore::EventHandler::updateSelectionForMouseDownDispatchingSelectStart):
2177         (WebCore::EventHandler::selectClosestWordFromHitTestResult):
2178         (WebCore::EventHandler::selectClosestContextualWordFromMouseEvent):
2179         (WebCore::EventHandler::selectClosestContextualWordOrLinkFromMouseEvent):
2180         (WebCore::EventHandler::handleMousePressEventTripleClick):
2181         (WebCore::EventHandler::handleMousePressEventSingleClick):
2182         (WebCore::EventHandler::updateSelectionForMouseDrag):
2183         (WebCore::setInitialKeyboardSelection):
2184         (WebCore::handleKeyboardSelectionMovement):
2185         * rendering/HitTestResult.cpp:
2186         (WebCore::HitTestResult::isOverTextInsideFormControlElement const):
2187
2188 2020-05-15  Simon Fraser  <simon.fraser@apple.com>
2189
2190         Rename the mapLocalToContainer() container argument, since it's not just used for repaint
2191         https://bugs.webkit.org/show_bug.cgi?id=211974
2192
2193         Reviewed by Zalan Bujtas.
2194
2195         mapLocalToContainer() is a generic geometry mapping function, and not just used for repaint,
2196         so rename the "repaintContainer" argument to "ancestorContainer".
2197
2198         Also fix some weirdly named variables in RenderMultiColumnFlow.
2199
2200         * rendering/RenderBox.cpp:
2201         (WebCore::RenderBox::mapLocalToContainer const):
2202         * rendering/RenderBox.h:
2203         * rendering/RenderFragmentedFlow.cpp:
2204         (WebCore::RenderFragmentedFlow::mapLocalToContainer const):
2205         * rendering/RenderFragmentedFlow.h:
2206         * rendering/RenderInline.cpp:
2207         (WebCore::RenderInline::mapLocalToContainer const):
2208         (WebCore::RenderInline::pushMappingToContainer const):
2209         * rendering/RenderMultiColumnFlow.cpp:
2210         (WebCore::RenderMultiColumnFlow::addFragmentToThread):
2211         (WebCore::RenderMultiColumnFlow::mapFromFlowToFragment const):
2212         (WebCore::RenderMultiColumnFlow::physicalTranslationOffsetFromFlowToFragment const):
2213         (WebCore::RenderMultiColumnFlow::physicalTranslationFromFlowToFragment const):
2214         * rendering/RenderObject.cpp:
2215         (WebCore::RenderObject::mapLocalToContainer const):
2216         (WebCore::RenderObject::localToContainerQuad const):
2217         (WebCore::RenderObject::localToContainerPoint const):
2218         * rendering/RenderObject.h:
2219         * rendering/RenderView.cpp:
2220         (WebCore::RenderView::mapLocalToContainer const):
2221         * rendering/svg/RenderSVGForeignObject.cpp:
2222         (WebCore::RenderSVGForeignObject::mapLocalToContainer const):
2223         * rendering/svg/RenderSVGForeignObject.h:
2224         * rendering/svg/RenderSVGInline.cpp:
2225         (WebCore::RenderSVGInline::mapLocalToContainer const):
2226         * rendering/svg/RenderSVGInline.h:
2227         * rendering/svg/RenderSVGModelObject.cpp:
2228         (WebCore::RenderSVGModelObject::mapLocalToContainer const):
2229         * rendering/svg/RenderSVGModelObject.h:
2230         * rendering/svg/RenderSVGRoot.cpp:
2231         (WebCore::RenderSVGRoot::mapLocalToContainer const):
2232         * rendering/svg/RenderSVGRoot.h:
2233         * rendering/svg/RenderSVGText.cpp:
2234         (WebCore::RenderSVGText::mapLocalToContainer const):
2235         * rendering/svg/RenderSVGText.h:
2236         * rendering/svg/SVGRenderSupport.cpp:
2237         (WebCore::SVGRenderSupport::mapLocalToContainer):
2238         * rendering/svg/SVGRenderSupport.h:
2239
2240 2020-05-15  Simon Fraser  <simon.fraser@apple.com>
2241
2242         REGRESSION (r249091): Can't click on a video in the second column of a paginated web view
2243         https://bugs.webkit.org/show_bug.cgi?id=211973
2244         <rdar://problem/61418775>
2245
2246         Reviewed by Zalan Bujtas.
2247
2248         In r249091 I made clip layer computation use offsetFromAncestor() by default, but this turns
2249         out to give different behavior from mapping via renderers in columns.
2250
2251         The bug was that accumulateOffsetTowardsAncestor() would map through the
2252         RenderMultiColumnFlow columns if the ancestorLayer was the one that was using columns,
2253         but mapping via renderers only maps through columns if converting to some ancestor of
2254         the columnated renderer.
2255
2256         I did not investigate why this only affects video.
2257
2258         Test: fast/multicol/clipped-video-in-second-column.html
2259
2260         * rendering/RenderLayer.cpp:
2261         (WebCore::accumulateOffsetTowardsAncestor):
2262         (WebCore::RenderLayer::calculateClipRects const):
2263
2264 2020-05-15  Kenneth Russell  <kbr@chromium.org>
2265
2266         OES_texture_float internal format conversion must depend on WEBGL_color_buffer_float
2267         https://bugs.webkit.org/show_bug.cgi?id=211971
2268
2269         Reviewed by Dean Jackson.
2270
2271         Only adjust the internal formats of textures created for the WebGL
2272         1.0 OES_texture_float extension if the WEBGL_color_buffer_float
2273         extension has been enabled.
2274
2275         Covered by the WebGL 1.0 OES_texture_float conformance tests when
2276         run on iOS with another forthcoming fix to ANGLE which will enable
2277         the OES_texture_float extension on that platform.
2278
2279         * platform/graphics/angle/ExtensionsGLANGLE.cpp:
2280         (WebCore::ExtensionsGLANGLE::ensureEnabled):
2281         (WebCore::ExtensionsGLANGLE::adjustWebGL1TextureInternalFormat):
2282         * platform/graphics/angle/ExtensionsGLANGLE.h:
2283         * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
2284         (WebCore::GraphicsContextGLOpenGL::texImage2DDirect):
2285
2286 2020-05-15  Oriol Brufau  <obrufau@igalia.com>
2287
2288         [css-grid] Treat percentages as auto for the minimum contribution
2289         https://bugs.webkit.org/show_bug.cgi?id=195967
2290
2291         Reviewed by Manuel Rego Casasnovas.
2292
2293         The minimum contribution of a grid item is the outer size resulting from
2294         the minimum size if the computed preferred size behaves as auto, or the
2295         min-content contribution otherwise.
2296
2297         If the preferred size is a percentage, it should be resolved with
2298         respect to the grid area, which depends on the minimum contribution
2299         of the item. Thus the percentage is cyclic and behaves as auto.
2300
2301         Before this change, WebKit only checked whether the preferred size is
2302         auto, not whether it behaves as auto. In fact this was according to
2303         an older version of the spec, but it was changed in
2304         https://github.com/w3c/csswg-drafts/issues/2367
2305
2306         Test: imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-minimum-contribution-with-percentages.html
2307
2308         Some cases in the test still fail due to bug 209461.
2309
2310         * rendering/GridTrackSizingAlgorithm.cpp:
2311         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
2312
2313 2020-05-15  Antoine Quint  <graouts@apple.com>
2314
2315         [Web Animations] Animation with a single keyframe is not accelerated
2316         https://bugs.webkit.org/show_bug.cgi?id=188730
2317         <rdar://problem/43481113>
2318
2319         Reviewed by Dean Jackson.
2320
2321         Test: webanimations/accelerated-animation-single-keyframe.html
2322
2323         Prior to attempting to run an accelerated effect, ensure that the KeyframeList passed to
2324         RenderLayerModelObject::startAnimation() does not have implicit keyframes since eventually
2325         GraphicsLayerCA::animationCanBeAccelerated() would be called and would reject a single-keyframe
2326         animation. To do this, we use the same code used in Style::Resolver::keyframeStylesForAnimation()
2327         which we refactor in the new KeyframeList::fillImplicitKeyframes() method.
2328
2329         * animation/KeyframeEffect.cpp:
2330         (WebCore::KeyframeEffect::copyPropertiesFromSource):
2331         (WebCore::KeyframeEffect::applyPendingAcceleratedActions):
2332         * rendering/style/KeyframeList.cpp:
2333         (WebCore::KeyframeList::hasImplicitKeyframes const):
2334         (WebCore::KeyframeList::copyKeyframes):
2335         (WebCore::zeroPercentKeyframe):
2336         (WebCore::hundredPercentKeyframe):
2337         (WebCore::KeyframeList::fillImplicitKeyframes):
2338         * rendering/style/KeyframeList.h:
2339         * style/StyleResolver.cpp:
2340         (WebCore::Style::Resolver::keyframeStylesForAnimation):
2341
2342 2020-05-15  Said Abou-Hallawa  <sabouhallawa@apple.com>
2343
2344         The initial value of "transform-box" should be "view-box"
2345         https://bugs.webkit.org/show_bug.cgi?id=211927
2346
2347         Reviewed by Simon Fraser.
2348
2349         Specs: https://drafts.csswg.org/css-transforms/#transform-box.
2350
2351         Test: svg/transforms/svg-transform-box-initial.html
2352
2353         * css/CSSProperties.json:
2354         * rendering/style/RenderStyle.h:
2355         (WebCore::RenderStyle::initialTransformBox):
2356
2357 2020-05-15  Andres Gonzalez  <andresg_22@apple.com>
2358
2359         Fix for crash in accessibility/mac/replace-text-with-range-on-webarea-element.html in isolated tree mode.
2360         https://bugs.webkit.org/show_bug.cgi?id=211954
2361
2362         Reviewed by Chris Fleizach.
2363
2364         Fixes crash in isolated tree mode in accessibility/mac/replace-text-with-range-on-webarea-element.html.
2365
2366         * accessibility/AXObjectCache.cpp:
2367         (WebCore::AXObjectCache::postTextStateChangeNotification): Check for null object before dereferencing.
2368         (WebCore::AXObjectCache::rootWebArea): Reverted to returning an AXObject since it is not needed to return AXCoreObject.
2369         * accessibility/AXObjectCache.h:
2370
2371 2020-05-15  Zalan Bujtas  <zalan@apple.com>
2372
2373         [LFC][TFC] Move column and row balancing logic to a dedicated class
2374         https://bugs.webkit.org/show_bug.cgi?id=211937
2375
2376         Reviewed by Antti Koivisto.
2377
2378         * Sources.txt:
2379         * WebCore.xcodeproj/project.pbxproj:
2380         * layout/tableformatting/TableFormattingContext.cpp:
2381         (WebCore::Layout::TableFormattingContext::layoutInFlowContent):
2382         (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows):
2383         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraSpace):
2384         (WebCore::Layout::ColumnSpan::hasSpan): Deleted.
2385         (WebCore::Layout::ColumnSpan::isSpanned): Deleted.
2386         (WebCore::Layout::ColumnSpan::spanCount): Deleted.
2387         (WebCore::Layout::ColumnSpan::startSpan): Deleted.
2388         (WebCore::Layout::ColumnSpan::endSpan): Deleted.
2389         (WebCore::Layout::ColumnSpan::index): Deleted.
2390         (WebCore::Layout::ColumnSpan::size): Deleted.
2391         (WebCore::Layout::ColumnSpan::spacing): Deleted.
2392         (WebCore::Layout::RowSpan::hasSpan): Deleted.
2393         (WebCore::Layout::RowSpan::isSpanned): Deleted.
2394         (WebCore::Layout::RowSpan::spanCount): Deleted.
2395         (WebCore::Layout::RowSpan::startSpan): Deleted.
2396         (WebCore::Layout::RowSpan::endSpan): Deleted.
2397         (WebCore::Layout::RowSpan::index): Deleted.
2398         (WebCore::Layout::RowSpan::size): Deleted.
2399         (WebCore::Layout::RowSpan::spacing): Deleted.
2400         (WebCore::Layout::GridSpace::isEmpty const): Deleted.
2401         (): Deleted.
2402         (WebCore::Layout::max): Deleted.
2403         (WebCore::Layout::operator-): Deleted.
2404         (WebCore::Layout::operator+=): Deleted.
2405         (WebCore::Layout::operator-=): Deleted.
2406         (WebCore::Layout::operator/): Deleted.
2407         (WebCore::Layout::distributeAvailableSpace): Deleted.
2408         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace): Deleted.
2409         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace): Deleted.
2410         * layout/tableformatting/TableFormattingContext.h:
2411         * layout/tableformatting/TableFormattingState.h:
2412         (WebCore::Layout::TableFormattingState::tableGrid const):
2413         * layout/tableformatting/TableGrid.h:
2414         (WebCore::Layout::TableGrid::widthConstraints const):
2415         (WebCore::Layout::TableGrid::Rows::list const):
2416         (WebCore::Layout::TableGrid::widthConstraints): Deleted.
2417         (WebCore::Layout::TableGrid::Rows::rowList const): Deleted.
2418
2419 2020-05-15  Alicia Boya García  <aboya@igalia.com>
2420
2421         [GStreamer][MediaStream] Fix missing video size
2422         https://bugs.webkit.org/show_bug.cgi?id=211938
2423
2424         Reviewed by Philippe Normand.
2425
2426         r261683 redefined m_currentVideoStreamId. Under the new design, tracks
2427         have several states:
2428
2429         - "wanted": a track has been selected from JavaScript, or chosen by
2430           default.
2431
2432         - "requested": a track that is expected to be chosen by the next
2433           STREAMS_SELECTED message.
2434
2435         - "current": a track that has been selected after the STREAMS_SELECTED
2436           message has been handled.
2437
2438         naturalSize() used to check m_currentVideoStreamId to look for the
2439         video size, but this is called relatively early before the track
2440         becomes "current" under the new design.
2441
2442         Since the size tags can't be queried at any time, it makes sense to
2443         use m_wantedVideoStreamId instead.
2444
2445         This fixes the following tests which were previously regressed:
2446
2447         fast/mediastream/get-user-media-constraints.html
2448         fast/mediastream/getUserMedia-video-rescaling.html
2449         fast/mediastream/mediastreamtrack-video-clone.html
2450         imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-MediaElement-firstframe.https.html
2451         fast/mediastream/media-stream-renders-first-frame.html
2452
2453         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2454         (WebCore::MediaPlayerPrivateGStreamer::naturalSize const):
2455
2456 2020-05-15  Antti Koivisto  <antti@apple.com>
2457
2458         [Wheel event region] Invalidation when changing listeners on elements
2459         https://bugs.webkit.org/show_bug.cgi?id=211895
2460
2461         Reviewed by Simon Fraser.
2462
2463         Doesn't handle root (window/document) invalidation yet.
2464
2465         Test: fast/scrolling/mac/wheel-event-listener-region-element-invalidation.html
2466
2467         * dom/EventTarget.cpp:
2468         (WebCore::EventTarget::addEventListener):
2469         (WebCore::EventTarget::removeEventListener):
2470         (WebCore::EventTarget::removeAllEventListeners):
2471
2472         Invalidate element style on wheel event changes.
2473
2474         * rendering/RenderElement.cpp:
2475         (WebCore::RenderElement::styleWillChange):
2476         * rendering/RenderLayer.cpp:
2477         (WebCore::RenderLayer::invalidateEventRegion):
2478
2479         Build on non-iOS platforms.
2480
2481         * rendering/RenderLayerBacking.cpp:
2482         (WebCore::RenderLayerBacking::maintainsEventRegion const):
2483
2484         Factor into function so it can be shared with RenderLayer::invalidateEventRegion.
2485
2486         (WebCore::RenderLayerBacking::updateEventRegion):
2487         * rendering/RenderLayerBacking.h:
2488
2489 2020-05-15  Antoine Quint  <graouts@apple.com>
2490
2491         Cursor should not update on a 20ms timer
2492         https://bugs.webkit.org/show_bug.cgi?id=211884
2493         <rdar://problem/63220368>
2494
2495         Reviewed by Simon Fraser.
2496
2497         Test: fast/events/mouse-cursor-udpate-during-raf.html
2498
2499         Update cursors after rAF callbacks have been serviced and layout has been updated.
2500
2501         * page/Page.cpp:
2502         (WebCore::Page::updateRendering):
2503         (WebCore::Page::doAfterUpdateRendering):
2504
2505 2020-05-15  Andres Gonzalez  <andresg_22@apple.com>
2506
2507         Update the isolated tree only if isolated tree mode is enabled.
2508         https://bugs.webkit.org/show_bug.cgi?id=211936
2509
2510         Reviewed by Chris Fleizach.
2511
2512         Check for isIsolatedTreeEnabled before updating the isolated tree.
2513
2514         * accessibility/AXObjectCache.cpp:
2515         (WebCore::AXObjectCache::updateIsolatedTree):
2516
2517 2020-05-15  Adrian Perez de Castro  <aperez@igalia.com>
2518
2519         [GTK3] Bring back usage of GtkMenu for context menus
2520         https://bugs.webkit.org/show_bug.cgi?id=211557
2521
2522         Reviewed by Carlos Garcia Campos.
2523
2524         No new tests needed.
2525
2526         * platform/gtk/GtkVersioning.h: Remove GtkPopover functions used only for context menus.
2527
2528 2020-05-14  Said Abou-Hallawa  <sabouhallawa@apple.com>
2529
2530         Unreviewed. Fix build warning after r261113
2531
2532         Remove unused variable.
2533
2534         * dom/ScriptedAnimationController.cpp:
2535         (WebCore::ScriptedAnimationController::preferredScriptedAnimationInterval const):
2536
2537 2020-05-14  Andres Gonzalez  <andresg_22@apple.com>
2538
2539         Expose isColumnHeaderCell and isRowHeaderCell through AXCoreObject.
2540         https://bugs.webkit.org/show_bug.cgi?id=211919
2541
2542         Reviewed by Chris Fleizach.
2543
2544         Multiple tests including accessibility/crash-table-recursive-layout.html.
2545
2546         - Expose isColumn/RowHeaderCell through AXCoreObject in order to make the
2547         return value of AccessibilityTable::cellForColumnAndRow an AXCoreObject.
2548         - Implemented these methods for AXIsolatedObject.
2549         - isolatedCopy the accessibilityDescription property.
2550
2551         * accessibility/AccessibilityObject.h:
2552         * accessibility/AccessibilityObjectInterface.h:
2553         * accessibility/AccessibilityTable.cpp:
2554         (WebCore::AccessibilityTable::cellForColumnAndRow): Removed incorrect
2555         assert since children are AXCoreObjects and not necessarily AccessibilityTableCells.
2556         * accessibility/AccessibilityTable.h:
2557         * accessibility/AccessibilityTableCell.cpp:
2558         (WebCore::AccessibilityTableCell::isTableCellInSameRowGroup):
2559         (WebCore::AccessibilityTableCell::isTableCellInSameColGroup):
2560         (WebCore::AccessibilityTableCell::columnHeaders):
2561         (WebCore::AccessibilityTableCell::rowHeaders):
2562         * accessibility/AccessibilityTableCell.h:
2563         * accessibility/AccessibilityTableColumn.cpp:
2564         (WebCore::AccessibilityTableColumn::addChildren):
2565         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2566         (-[WebAccessibilityObjectWrapper accessibilityElementForRow:andColumn:]):
2567         * accessibility/isolatedtree/AXIsolatedObject.cpp:
2568         (WebCore::AXIsolatedObject::initializeAttributeData):
2569         * accessibility/isolatedtree/AXIsolatedObject.h:
2570
2571 2020-05-14  Timothy Hatcher  <timothy@apple.com>
2572
2573         Add baseURL version of _WKUserStyleSheet forWKWebView.
2574         https://bugs.webkit.org/show_bug.cgi?id=211926
2575         rdar://problem/62074675
2576
2577         Reviewed by Devin Rousso.
2578
2579         Consolidate the paths taken for adding a UserStyleSheet. The m_injectedStyleSheetToSource
2580         was missing for page specific style sheets since it was another loop.
2581
2582         * dom/ExtensionStyleSheets.cpp:
2583         (WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache const):
2584         (WebCore::ExtensionStyleSheets::injectPageSpecificUserStyleSheet):
2585         (WebCore::ExtensionStyleSheets::removePageSpecificUserStyleSheet):
2586         (WebCore::ExtensionStyleSheets::detachFromDocument):
2587         * dom/ExtensionStyleSheets.h:
2588
2589 2020-05-14  Jiewen Tan  <jiewen_tan@apple.com>
2590
2591         [WebAuthn] Relaxing signature length requirements for U2fRegister
2592         https://bugs.webkit.org/show_bug.cgi?id=209645
2593         <rdar://problem/63204591>
2594
2595         Reviewed by Brent Fulgham.
2596
2597         It turns out the length range specified from the spec, i.e., [71, 73] is wrong.
2598         https://fidoalliance.org/specs/fido-u2f-v1.2-ps-20170411/fido-u2f-raw-message-formats-v1.2-ps-20170411.html#registration-response-message-success
2599
2600         It should actually be [70, 72]. However, as a middleware to relay the messages, user agents
2601         are not necessary to check the length. Therefore, the check is relaxed to make the code more robust.
2602
2603         Covered by existing tests.
2604
2605         * Modules/webauthn/fido/U2fResponseConverter.cpp:
2606         (fido::WebCore::createFidoAttestationStatementFromU2fRegisterResponse):
2607
2608 2020-05-14  Timothy Hatcher  <timothy@apple.com>
2609
2610         Add sourceURL to _evaluateJavaScript: so the scripts appear in Web Inspector.
2611         https://bugs.webkit.org/show_bug.cgi?id=211904
2612         rdar://problem/62074376
2613
2614         Reviewed by Devin Rousso.
2615
2616         Added sourceURL to RunJavaScriptParameters. Use it instead of the frame's document URL.
2617
2618         * bindings/js/RunJavaScriptParameters.h:
2619         (WebCore::RunJavaScriptParameters::RunJavaScriptParameters):
2620         (WebCore::RunJavaScriptParameters::encode const):
2621         (WebCore::RunJavaScriptParameters::decode):
2622         * bindings/js/ScriptController.cpp:
2623         (WebCore::ScriptController::executeScriptInWorldIgnoringException):
2624         (WebCore::ScriptController::executeScriptInWorld):
2625         (WebCore::ScriptController::callInWorld):
2626         (WebCore::ScriptController::executeUserAgentScriptInWorld):
2627
2628 2020-05-14  Eric Carlson  <eric.carlson@apple.com>
2629
2630         [Cocoa] Don't clear NowPlaying state unless it was set
2631         https://bugs.webkit.org/show_bug.cgi?id=211899
2632         <rdar://problem/62249870>
2633
2634         Reviewed by Jer Noble.
2635
2636         Test: media/now-playing-status-without-media.html
2637
2638         * platform/audio/PlatformMediaSessionManager.h:
2639         (WebCore::PlatformMediaSessionManager::haveEverRegisteredAsNowPlayingApplication const): Method
2640         added for testing.
2641
2642         * platform/audio/cocoa/MediaSessionManagerCocoa.h:
2643         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
2644         (WebCore::MediaSessionManagerCocoa::updateNowPlayingInfo): Don't clear NowPlaying state unless
2645         it was setup in the first place.
2646
2647         * testing/Internals.cpp:
2648         (WebCore::Internals::nowPlayingState const): Add new property.
2649         * testing/Internals.h:
2650         * testing/Internals.idl:
2651
2652 2020-05-14  Andres Gonzalez  <andresg_22@apple.com>
2653
2654         AXCoreObject font comparison methods should take another AXCoreObject instead of a RenderObject.
2655         https://bugs.webkit.org/show_bug.cgi?id=211909
2656
2657         Reviewed by Chris Fleizach.
2658
2659         Covered by existing tests.
2660
2661         - In order for font comparison methods to be implementted for both
2662         AXObjects and AXIsolatedObjects, they should take another AXCoreObject
2663         to compare against, instead of a RenderObject.
2664         - The AXIsolatedObject implementation of these methods is forwarded to
2665         the associated AXObject and dispatched to the main thread.
2666         - Implemented AXIsolatedObject::accessibilityDescription, hasUnderline and isUnvisited.
2667
2668         * accessibility/AccessibilityObject.cpp:
2669         (WebCore::Accessibility::isAccessibilityObjectSearchMatchAtIndex):
2670         * accessibility/AccessibilityObject.h:
2671         * accessibility/AccessibilityObjectInterface.h:
2672         (WebCore::AXCoreObject::isNativeListBox const):
2673         * accessibility/AccessibilityRenderObject.cpp:
2674         (WebCore::AccessibilityRenderObject::hasSameFont const):
2675         (WebCore::AccessibilityRenderObject::hasSameFontColor const):
2676         (WebCore::AccessibilityRenderObject::hasSameStyle const):
2677         * accessibility/AccessibilityRenderObject.h:
2678         * accessibility/isolatedtree/AXIsolatedObject.cpp:
2679         (WebCore::AXIsolatedObject::initializeAttributeData):
2680         (WebCore::AXIsolatedObject::hasSameFont const):
2681         (WebCore::AXIsolatedObject::hasSameFontColor const):
2682         (WebCore::AXIsolatedObject::hasSameStyle const):
2683         (WebCore::AXIsolatedObject::isNativeListBox const): Deleted, implemented in base class.
2684         (WebCore::AXIsolatedObject::isUnvisited const): Deleted, inlined in header.
2685         (WebCore::AXIsolatedObject::hasUnderline const): Deleted, inlined in header.
2686         (WebCore::AXIsolatedObject::accessibilityDescription const): Deleted, inlined in header.
2687         * accessibility/isolatedtree/AXIsolatedObject.h:
2688
2689 2020-05-14  Nikita Vasilyev  <nvasilyev@apple.com>
2690
2691         Web Inspector: front-end shouldn't change the order of User Style Sheet rules
2692         https://bugs.webkit.org/show_bug.cgi?id=210893
2693         <rdar://problem/61937118>
2694
2695         Reviewed by Devin Rousso.
2696
2697         Previously, some style sheets were falsly detected as Inspector::Protocol::CSS::StyleSheetOrigin::User
2698         causing incorrect order of style rules in Web Inspector.
2699
2700         Test: inspector/css/getMatchedStylesForNode.html
2701
2702         * inspector/agents/InspectorCSSAgent.cpp:
2703         (WebCore::InspectorCSSAgent::detectOrigin):
2704
2705 2020-05-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2706
2707         [macOS] Update the placeholder icon image for attachment elements with progress="0"
2708         https://bugs.webkit.org/show_bug.cgi?id=211898
2709         <rdar://problem/63203900>
2710
2711         Reviewed by Timothy Hatcher.
2712
2713         Refactor logic for creating an attachment placeholder image into a separate helper method, with a
2714         WebKitAdditions implementation when HAVE(SYSTEM_ATTACHMENT_PLACEHOLDER_ICON) is defined.
2715
2716         * rendering/RenderThemeMac.mm:
2717         (WebCore::createAttachmentPlaceholderImage):
2718         (WebCore::paintAttachmentIconPlaceholder):
2719
2720 2020-05-14  Chris Dumez  <cdumez@apple.com>
2721
2722         Regression(r254856) Family Health iOS app is broken due to lack for WebSQL support
2723         https://bugs.webkit.org/show_bug.cgi?id=211896
2724         <rdar://problem/63025045>
2725
2726         Reviewed by Maciej Stachowiak.
2727
2728         Add RuntimeApplicationChecks function to identify Family Health app on iOS.
2729
2730         * platform/RuntimeApplicationChecks.h:
2731         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2732         (WebCore::IOSApplication::isFamilyHealthApp):
2733
2734 2020-05-14  Andres Gonzalez  <andresg_22@apple.com>
2735
2736         AXIsolatedTree::updateChildren needs to apply pending changes before updating the given node.
2737         https://bugs.webkit.org/show_bug.cgi?id=211790
2738
2739         Reviewed by Chris Fleizach.
2740
2741         Covered by multiple tests.
2742
2743         AXIsolatedTree::updateChildren may be fired for an isolated object that
2744         is still in the pending changes list, and thus nodeForID would fail,
2745         causing the isolated tree to not be updated. This patch calls
2746         applyPendingChanges before updating the given node's children.
2747         Additional logging was added including the logging of the AXObjectCache
2748         object hierarchy.
2749
2750         * accessibility/AXLogger.cpp:
2751         (WebCore::AXLogger::log):
2752         (WebCore::operator<<):
2753         * accessibility/AXLogger.h:
2754         * accessibility/AXObjectCache.cpp:
2755         (WebCore::AXObjectCache::remove):
2756         (WebCore::AXObjectCache::postNotification):
2757         (WebCore::AXObjectCache::performDeferredCacheUpdate):
2758         (WebCore::AXObjectCache::updateIsolatedTree):
2759         * accessibility/AXObjectCache.h:
2760         * accessibility/isolatedtree/AXIsolatedTree.cpp:
2761         (WebCore::AXIsolatedTree::updateNode):
2762         (WebCore::AXIsolatedTree::updateSubtree):
2763         (WebCore::AXIsolatedTree::updateChildren):
2764         (WebCore::AXIsolatedTree::focusedNode):
2765         (WebCore::AXIsolatedTree::removeNode):
2766         (WebCore::AXIsolatedTree::removeSubtree):
2767         (WebCore::AXIsolatedTree::applyPendingChanges):
2768         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2769         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2770
2771 2020-05-14  Andres Gonzalez  <andresg_22@apple.com>
2772
2773         Fix for crash in LayoutTest in isolated tree mode.
2774         https://bugs.webkit.org/show_bug.cgi?id=211894
2775
2776         Reviewed by Chris Fleizach.
2777
2778         Several LayoutTests.
2779
2780         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2781         (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]): Check backing object for nullity before dereferencing.
2782
2783 2020-05-14  Andres Gonzalez  <andresg_22@apple.com>
2784
2785         AXIsolatedObject::isOnScreen needs to be dispatched to the main thread.
2786         https://bugs.webkit.org/show_bug.cgi?id=211893
2787
2788         Reviewed by Chris Fleizach.
2789
2790         Covered by existing tests.
2791
2792         * accessibility/isolatedtree/AXIsolatedObject.cpp:
2793         (WebCore::AXIsolatedObject::children): Split assert into two lines for readability.
2794         (WebCore::AXIsolatedObject::isOnScreen const): Forward to associated AXObject and dispatch to the main thread.
2795
2796 2020-05-14  Andres Gonzalez  <andresg_22@apple.com>
2797
2798         Implementation of AXIsolatedObject::hasPlainText.
2799         https://bugs.webkit.org/show_bug.cgi?id=211892
2800
2801         Reviewed by Chris Fleizach.
2802
2803         Covered by existing tests.
2804
2805         Adding hasPlainText to the cached properties map.
2806
2807         * accessibility/isolatedtree/AXIsolatedObject.cpp:
2808         (WebCore::AXIsolatedObject::initializeAttributeData):
2809         (WebCore::AXIsolatedObject::hasPlainText const): Deleted, inlined in header.
2810         * accessibility/isolatedtree/AXIsolatedObject.h:
2811
2812 2020-05-14  Sergio Villar Senin  <svillar@igalia.com>
2813
2814         Unreviewed build fix.
2815
2816         * html/HTMLCanvasElement.cpp:
2817         (WebCore::HTMLCanvasElement::createContextWebGL): downcast m_context to
2818         WebGLRenderingContextBase before calling isXRCompatible(). It's created
2819         as a WebGLRenderingContextBase but stored in a CanvasRenderingContext.
2820
2821 2020-05-14  Andres Gonzalez  <andresg_22@apple.com>
2822
2823         Replacing and inserting text need to be dispatched to the main thread.
2824         https://bugs.webkit.org/show_bug.cgi?id=211863
2825
2826         Reviewed by Chris Fleizach.
2827
2828         Covered by existing tests.
2829
2830         In isolated tree mode WebAccessibilityObjectWrapper accessibilityReplaceRange
2831         and InsertText may be called on the secondary thread. Thus the AXIsolatedObject
2832         implementation of this functionality needs to forward these calls to the
2833         associated AXObject on the main thread.
2834
2835         * accessibility/isolatedtree/AXIsolatedObject.cpp:
2836         (WebCore::AXIsolatedObject::replaceTextInRange):
2837         (WebCore::AXIsolatedObject::insertText):
2838         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2839         (-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]):
2840         (-[WebAccessibilityObjectWrapper accessibilityInsertText:]):
2841
2842 2020-05-14  Antoine Quint  <graouts@apple.com>
2843
2844         Cursor should not update on a 20ms timer
2845         https://bugs.webkit.org/show_bug.cgi?id=211884
2846         <rdar://problem/63220368>
2847
2848         Reviewed by Antti Koivisto.
2849
2850         Update the cursor during page rendering rather than using a 20ms timer.
2851
2852         * page/EventHandler.cpp:
2853         (WebCore::EventHandler::EventHandler):
2854         (WebCore::EventHandler::clear):
2855         (WebCore::EventHandler::updateCursorIfNeeded):
2856         (WebCore::EventHandler::handleMouseMoveEvent):
2857         (WebCore::EventHandler::scheduleCursorUpdate):
2858         (WebCore::EventHandler::cursorUpdateTimerFired): Deleted.
2859         * page/EventHandler.h:
2860         * page/Page.cpp:
2861         (WebCore::Page::updateRendering):
2862
2863 2020-05-14  Philippe Normand  <pnormand@igalia.com>
2864
2865         [GStreamer] webrtc/disable-encryption.html is a crashing flaky
2866         https://bugs.webkit.org/show_bug.cgi?id=211166
2867
2868         Reviewed by Xabier Rodriguez-Calvar.
2869
2870         Make sure the audio and video mediastream source elements are correctly removed and disposed
2871         from their parent bin when resetting the track sources. Before this change there was a
2872         possibility of disposing the elements while they were still in PLAYING state.
2873
2874         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
2875         (WebCore::_WebKitMediaStreamSrc::SourceData::reset):
2876         (WebCore::webkitMediaStreamSrcDispose):
2877         (WebCore::webkitMediaStreamSrcRemoveTrackByType):
2878
2879 2020-05-14  Adrian Perez de Castro  <aperez@igalia.com>
2880
2881         Non-unified build fixed, mid May 2020 edition
2882         https://bugs.webkit.org/show_bug.cgi?id=211859
2883
2884         Unreviewed build.
2885
2886         No new tests needed.
2887
2888         * Modules/indexeddb/server/UniqueIDBDatabase.cpp: Add missing IDBBindingUtilities.h and
2889         IDBSerializationContext.h includes.
2890         * accessibility/AccessibilityRenderObject.cpp: Add missing EventHandler.h include.
2891         * css/parser/CSSParserToken.cpp: Add missing RuntimeEnabledFeatures.h include.
2892         * editing/gtk/WebContentReaderGtk.cpp: Add missing Blob.h include.
2893         * html/canvas/OESTextureHalfFloat.cpp: Add missing ExtensionsGL.h include.
2894         * page/ShareDataReader.h: Add missing ExceptionOr.h include.
2895         * rendering/ContentfulPaintChecker.cpp: Add missing RenderView.h include.
2896         * rendering/style/StyleRareInheritedData.h: Add missing RenderStyleConstants.h and
2897         wtf/OptionSet.h includes.
2898         * rendering/style/StyleRareNonInheritedData.h: Add missing TouchAction.h and wtf/OptionSet.h
2899         includes.
2900         * style/StyleAdjuster.h: Add missing RenderStyleConstants.h include and forward declaration
2901         for WebCore::EventTarget.
2902
2903 2020-05-14  Alicia Boya García  <aboya@igalia.com>
2904
2905         [GStreamer] Playbin3 track switch rework
2906         https://bugs.webkit.org/show_bug.cgi?id=211623
2907
2908         Reviewed by Philippe Normand.
2909
2910         This patch reworks how track selection and reporting of selected
2911         tracks is done in the player.
2912
2913         The following found limitations and assumptions in current GStreamer
2914         have informed this patch:
2915
2916         a) Although the API for playbin3 is designed to be able to accept any
2917         number of tracks of any kind, this is not supported in practice.
2918
2919         b) The first track of each type is always selected. Even in playbin3
2920         mode, looking for GST_STREAM_FLAG_SELECT is not a reliable method, as
2921         in most cases the demuxer does not set it at all. [qtdemux never sets
2922         it at all, and matroskademux only sets it in certain cases.]
2923
2924         c) Sending GST_EVENT_SELECT_STREAMS is only safe at certain moments.
2925         It's not safe before pre-roll, after EOS or during the handling of
2926         another SELECT_STREAMS.
2927
2928         d) Selecting text tracks with playbin APIs is not relevant. All text
2929         tracks are already being picked by WebKitTextCombiner, unaffected by
2930         playbin track selection.
2931
2932         e) Tracks requested in a GST_EVENT_SELECT_STREAMS are eventually
2933         selected. On the other hand,  looking at
2934         GST_MESSAGE_STREAMS_SELECTED's content is not reliable, as this has
2935         been seen to miss tracks depending on thread luck.
2936
2937         This patch takes the points above into account to rework how track
2938         selection is handled in MediaPlayerPrivateGStreamer and fix the
2939         following issues:
2940
2941         1) In playbin3 mode, no track was marked as selected initially,
2942         because of reliance on GST_STREAM_FLAG_SELECT.
2943
2944         2) In playbin2 mode, sometimes tracks would not be initially marked as
2945         selected. This occurred because of reliance on the "selected" property
2946         in inputselector sinkpads, whose initialization is racy -- it can
2947         occur after the track has been added and picked up by WebKit.
2948
2949         3) In playbin3 mode, the limitations explained before has been honored
2950         to make track selection stable, delaying SELECT_STREAMS events until
2951         they are safe to send.
2952
2953         This patch doesn't introduce significative behavior changes, rather
2954         aiming for improving the stabilitity of the player. Existing tests
2955         should provide enough coverage.
2956
2957         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
2958         (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
2959         (WebCore::AudioTrackPrivateGStreamer::setEnabled):
2960         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
2961         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2962         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
2963         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio):
2964         (WebCore::MediaPlayerPrivateGStreamer::updateEnabledVideoTrack):
2965         (WebCore::MediaPlayerPrivateGStreamer::updateEnabledAudioTrack):
2966         (WebCore::MediaPlayerPrivateGStreamer::playbin3SendSelectStreamsIfAppropriate):
2967         (WebCore::MediaPlayerPrivateGStreamer::updateTracks):
2968         (WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage):
2969         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
2970         (WebCore::MediaPlayerPrivateGStreamer::didEnd):
2971         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2972         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
2973         (WebCore::TrackPrivateBaseGStreamer::TrackPrivateBaseGStreamer):
2974         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
2975         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
2976         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
2977         (WebCore::VideoTrackPrivateGStreamer::setSelected):
2978         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
2979
2980 2020-05-14  Philippe Normand  <pnormand@igalia.com>
2981
2982         [GStreamer] Can't replay blob videos in web.whatsapp.com
2983         https://bugs.webkit.org/show_bug.cgi?id=192540
2984
2985         Reviewed by Xabier Rodriguez-Calvar.
2986
2987         This is a variant of bug 211627 but I could reproduce it only for videos. Unfortunately I
2988         wasn't able to write a reliable test for this.
2989
2990         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2991         (WebCore::MediaPlayerPrivateGStreamer::updateBufferingStatus): Prevent the fill timer from
2992         running forever after buffering completed.
2993         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2994         (webKitWebSrcMakeRequest): Don't buffer blobs, this doesn't seem useful as they're already
2995         in memory anyway.
2996
2997 2020-05-06  Sergio Villar Senin  <svillar@igalia.com>
2998
2999         [WebXR] Implement WebGLRenderingContextBase::makeXRCompatible()
3000         https://bugs.webkit.org/show_bug.cgi?id=211506
3001
3002         Reviewed by Youenn Fablet.
3003
3004         The WebXR spec defines a way to mark a WebGLRenderingContext as
3005         compatible with WebXR. This can be made at creation time (by setting the
3006         xrCompatible) attribute or by calling makeXRCompatible().
3007
3008         There are several web-platform-tests testing/using this feature, however we
3009         cannot enable them right now as we need some other features to be implemented
3010         first.
3011
3012         * Modules/webxr/NavigatorWebXR.cpp:
3013         (WebCore::NavigatorWebXR::xr): Do not pass ScriptExecutionContext and use
3014         the Navigator's instead.
3015         * Modules/webxr/NavigatorWebXR.h: Ditto.
3016         * Modules/webxr/NavigatorWebXR.idl: Ditto.
3017         * Modules/webxr/WebXRSystem.h: expose ensureImmersiveXRDeviceIsSelected() and
3018         hasActiveImmersiveXRDevice() to be used from canvas and the rendering context.
3019         * html/HTMLCanvasElement.cpp:
3020         (WebCore::HTMLCanvasElement::createContextWebGL): call
3021         ensureImmersiveXRDeviceIsSelected() if xrCompatible is set.
3022         * html/canvas/WebGLContextAttributes.idl: Added xrCompatible.
3023         * html/canvas/WebGLRenderingContextBase.cpp:
3024         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
3025         Initialize m_isXRCompatible.
3026         (WebCore::WebGLRenderingContextBase::makeXRCompatible): Implemented.
3027         * html/canvas/WebGLRenderingContextBase.h: Defined makeXRCompatible().
3028         * html/canvas/WebGLRenderingContextBase.idl: Added makeXRCompatible().
3029         * platform/graphics/GraphicsContextGLAttributes.h: Added xrCompatible.
3030         * testing/Internals.cpp:
3031         (WebCore::Internals::xrTest): Simplified the usage of NavigatorWebXR.
3032
3033 2020-05-13  Zalan Bujtas  <zalan@apple.com>
3034
3035         [LFC][TFC] Add support for cases when the balancing is not based on the initial width
3036         https://bugs.webkit.org/show_bug.cgi?id=211878
3037
3038         Reviewed by Antti Koivisto.
3039
3040         This patch adds support for the cases when the table stretches all the way to the maximum content size,
3041         and we still choose the minimum width as the initial width and the maximum width as the base for balancing the extra space.
3042
3043         Consider the following 2 tables:
3044
3045         <table>
3046           <tr><td style="width: 20px"></td><td>some long long long content</td></tr>
3047           <tr><td style="width: 20px"></td><td>22px width content</td></tr>
3048         </table>
3049
3050         <table>
3051           <tr><td style="width: 20px"></td><td>some long long long content</td></tr>
3052           <tr><td style="width: 20px"></td><td id=fixed_width style="width: 22px;">22px width content</td></tr>
3053         </table>
3054
3055         These tables have the same maximum widths and they both stretch to that size. 
3056         However the second table will end up with a wider first and narrower second column because of the
3057         width property on the [fixed_width] cell.
3058         While the first table applies the maximum width for each columns, the second table uses the minimum width as the
3059         initial width and balances the extra space using the maximum width (as the distribution ratio).
3060         This produces a very different layout where the first table has no line wrapping, while
3061         the second table wraps the "some long long long content" text (even though the used max widths are the same for each cells).
3062
3063         Test: fast/layoutformattingcontext/table-fixed-width-with-max-distribution.html
3064
3065         * layout/tableformatting/TableFormattingContext.cpp:
3066         (WebCore::Layout::ColumnSpan::spacing):
3067         (WebCore::Layout::RowSpan::spacing):
3068         (WebCore::Layout::distributeAvailableSpace):
3069         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace):
3070         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace):
3071
3072 2020-05-13  Zalan Bujtas  <zalan@apple.com>
3073
3074         Do not clear selection/repaint when the renderer gets moved during tree normalization.
3075         https://bugs.webkit.org/show_bug.cgi?id=211865
3076         <rdar://problem/62849044>
3077
3078         Reviewed by Antti Koivisto.
3079
3080         While detachFromRenderElement should really be about "this renderer is being detached from its parent", some code in here assumes
3081         the renderer is not only going to be detached but also going to be destroyed. Ideally such code should live in RenderObject::willBeDestroyed(),
3082         but no tree walk is possible in there anymore.
3083
3084         The reason for the crash is that when we split the inline for continuation, we construct new anonymous containers and move subtrees over
3085         to these new renderers. However at this point these new parent containers are not yet attached to the tree
3086         so any tree-walking cleanup code will fail (in detachFromRenderElement).
3087
3088         Test: fast/repaint/do-no-repaint-on-internal-move.html
3089
3090         * rendering/updating/RenderTreeBuilder.cpp:
3091         (WebCore::RenderTreeBuilder::detachFromRenderElement):
3092         * rendering/updating/RenderTreeBuilder.h:
3093         * rendering/updating/RenderTreeBuilderInline.cpp:
3094         (WebCore::RenderTreeBuilder::Inline::splitInlines):
3095
3096 2020-05-13  Devin Rousso  <drousso@apple.com>
3097
3098         Web Inspector: show EventTarget listeners as an internal property
3099         https://bugs.webkit.org/show_bug.cgi?id=211766
3100
3101         Reviewed by Timothy Hatcher.
3102
3103         Test: inspector/runtime/getProperties-internalProperties.html
3104
3105         Add a `listeners` internal property for `EventTarget` objects with the value
3106         ```
3107             listeners: {
3108                 <event>: [
3109                     {
3110                         callback: <function>
3111                         capture: <boolean>
3112                         passive: <boolean>
3113                         once: <boolean>
3114                     }
3115                     ...
3116                 ]
3117                 ...
3118             }
3119         ```
3120         so long as at least one `JSEventListener` has been added prior to that point.
3121
3122         * inspector/WebInjectedScriptHost.cpp:
3123         (WebCore::objectForEventTargetListeners): Added.
3124         (WebCore::WebInjectedScriptHost::getInternalProperties):
3125         Drive-by: only add the `name` internal property if the `Worker` actually has a name.
3126
3127 2020-05-13  Devin Rousso  <drousso@apple.com>
3128
3129         Web Inspector: rename CSS.StyleSheetOrigin.Regular to CSS.StyleSheetOrigin.Author to match the spec
3130         https://bugs.webkit.org/show_bug.cgi?id=211827
3131
3132         Reviewed by Timothy Hatcher.
3133
3134         Tests: inspector/css/add-rule.html
3135                inspector/css/getMatchedStylesForNode.html
3136
3137         * inspector/agents/InspectorCSSAgent.cpp:
3138         (WebCore::InspectorCSSAgent::asInspectorStyleSheet):
3139         (WebCore::InspectorCSSAgent::detectOrigin):
3140         * inspector/InspectorStyleSheet.cpp:
3141         (WebCore::InspectorStyleSheet::buildObjectForRule):
3142
3143 2020-05-13  Yusuke Suzuki  <ysuzuki@apple.com>
3144
3145         JSDOMWindowBase m_windowCloseWatchpoints must be Ref<>
3146         https://bugs.webkit.org/show_bug.cgi?id=211844
3147
3148         Reviewed by Mark Lam.
3149
3150         JSDOMWindowBase::m_windowCloseWatchpoints is WatchpointSet, not Ref<WatchpointSet>. And it is passed to JSC IC layer via PropertySlot::setWatchpoint(...).
3151         And ProxyableAccessCase can hold it as `RefPtr<WatchpointSet> m_additionalSet;`, this is wrong.
3152
3153         This patch hides WatchpointSet constructor behind `protected` to disallow non Ref<> WatchpointSet construction. We made it `protected` since InferredValueWatchpointSet
3154         inherits WatchpointSet and uses this constructor.
3155
3156         Possibly, this does not matter: ProxyableAccessCase keeps Structure, which points to JSDOMWindowBase. So, it would not happen that ProxyableAccessCase has a wrong pointer
3157         to WatchpointSet since JSDOMWindowBase is kept alive anyway. But avoid using RefCounted objects without RefCount allocation is better since this can cause bugs easily.
3158
3159         * bindings/js/JSDOMWindowBase.cpp:
3160         (WebCore::JSDOMWindowBase::JSDOMWindowBase):
3161         (WebCore::JSDOMWindowBase::fireFrameClearedWatchpointsForWindow):
3162         * bindings/js/JSDOMWindowBase.h:
3163         * bindings/js/JSDOMWindowCustom.cpp:
3164         (WebCore::JSDOMWindow::getOwnPropertySlot):
3165
3166 2020-05-13  Jack Lee  <shihchieh_lee@apple.com>
3167
3168         Nullptr crash in InsertParagraphSeparatorCommand::doApply when the canonical position is uneditable
3169         https://bugs.webkit.org/show_bug.cgi?id=211864
3170         <rdar://problem/62982161>
3171
3172         Reviewed by Geoffrey Garen.
3173
3174         The position returned by positionAvoidingSpecialElementBoundary() is uneditable so we need to 
3175         check for uneditable insertion position and bail out before calling insertNodeAt to avoid assertion.
3176
3177         Test: editing/inserting/insert-img-uneditable-canonical-position-crash.html
3178
3179         * editing/InsertParagraphSeparatorCommand.cpp:
3180         (WebCore::InsertParagraphSeparatorCommand::doApply):
3181
3182 2020-05-13  Jack Lee  <shihchieh_lee@apple.com>
3183
3184         Nullptr crash in DeleteSelectionCommand::doApply() when merge node is disconnected.
3185         https://bugs.webkit.org/show_bug.cgi?id=211793
3186         <rdar://problem/62993645>
3187
3188         Reviewed by Geoffrey Garen.
3189
3190         Check for disconnected merge destination and endingSelection() after mergeParagraph is
3191         Called and bail out to avoid using corrupted positions for node insertion.
3192
3193         Test: editing/inserting/insert-text-merge-node-removed-crash.html
3194
3195         * editing/CompositeEditCommand.cpp:
3196         (WebCore::CompositeEditCommand::moveParagraphs):
3197         * editing/DeleteSelectionCommand.cpp:
3198         (WebCore::DeleteSelectionCommand::mergeParagraphs):
3199
3200 2020-05-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
3201
3202         Re-enable 'OutsideViewport' rAF throttling
3203         https://bugs.webkit.org/show_bug.cgi?id=211482
3204
3205         Reviewed by Darin Adler.
3206
3207         Test: fast/animation/request-animation-frame-throttling-outside-viewport.html
3208
3209         Make preferredFrameInterval return AggressiveThrottlingAnimationInterval
3210         if the OutsideViewport throttling reason exists.
3211
3212         Add an internal setting for enabling 'OutsideViewport' rAF throttling. It
3213         is on by default but it is off by default for DRT and WTR. An Internals
3214         API is added to enable it for specific tests which want to test its
3215         functionality.
3216
3217         * page/FrameView.cpp:
3218         (WebCore::FrameView::updateScriptedAnimationsAndTimersThrottlingState):
3219         * page/Page.cpp:
3220         (WebCore::Page::setOutsideViewportThrottlingEnabledForTesting):
3221         * page/Page.h:
3222         (WebCore::Page::canUpdateThrottlingReason const):
3223         * platform/graphics/AnimationFrameRate.h:
3224         (WebCore::preferredFrameInterval):
3225         (WebCore::operator<<):
3226         * testing/Internals.cpp:
3227         (WebCore::Internals::resetToConsistentState):
3228         (WebCore::Internals::setOutsideViewportThrottlingEnabled):
3229         * testing/Internals.h:
3230         * testing/Internals.idl:
3231
3232 2020-05-13  Andres Gonzalez  <andresg_22@apple.com>
3233
3234         Remove unnecessary assert in {WebAccessibilityObjectWrapper attachmentView].
3235         https://bugs.webkit.org/show_bug.cgi?id=211857
3236
3237         Reviewed by Chris Fleizach.
3238
3239         This assert is unnecessary since the backing object that is relevant is
3240         the one on the main thread. This was causing crashes in LayoutTest in
3241         isolated tree mode.
3242
3243         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3244         (-[WebAccessibilityObjectWrapper attachmentView]):
3245
3246 2020-05-13  Jer Noble  <jer.noble@apple.com>
3247
3248         Replace isNullFunctionPointer with real weak-linking support
3249         https://bugs.webkit.org/show_bug.cgi?id=211751
3250
3251         Reviewed by Sam Weinig.
3252
3253         Use the new WTF_WEAK_LINK_FORCE_IMPORT macro.
3254
3255         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
3256         (WebCore::LibWebRTCProvider::webRTCAvailable):
3257
3258 2020-05-13  Andres Gonzalez  <andresg_22@apple.com>
3259
3260         Implementation of AXIsolatedObject::hasBoldFont and hasItalicFont.
3261         https://bugs.webkit.org/show_bug.cgi?id=211858
3262
3263         Reviewed by Chris Fleizach.
3264
3265         Added hasBoldFont and hasItalicFont to the cached properties map.
3266
3267         * accessibility/isolatedtree/AXIsolatedObject.cpp:
3268         (WebCore::AXIsolatedObject::initializeAttributeData): Added properties to cache.
3269         (WebCore::AXIsolatedObject::hasBoldFont const): Deleted. Inlined in header.
3270         (WebCore::AXIsolatedObject::hasItalicFont const): Deleted. Inlined in header.
3271         * accessibility/isolatedtree/AXIsolatedObject.h:
3272
3273 2020-05-13  Tim Horton  <timothy_horton@apple.com>
3274
3275         Add SPI for reverting to touch events for iPad trackpad interactions
3276         https://bugs.webkit.org/show_bug.cgi?id=211824
3277         <rdar://problem/61363084>
3278
3279         Reviewed by Megan Gardner.
3280
3281         * loader/DocumentLoader.h:
3282         (WebCore::DocumentLoader::mouseEventPolicy const):
3283         (WebCore::DocumentLoader::setMouseEventPolicy):
3284
3285 2020-05-13  Kenneth Russell  <kbr@chromium.org>
3286
3287         Bad flicker on three.js example
3288         https://bugs.webkit.org/show_bug.cgi?id=183151
3289
3290         Reviewed by Dean Jackson.
3291
3292         With preserveDrawingBuffer:true and antialias:false, allocate an
3293         intermediate texture and FBO, and blit from it to the destination
3294         texture in prepareTexture(). Use wipeAlphaChannelFromPixels on iOS
3295         as well as macOS.
3296
3297         In addition to fixing the test case from the bug, this also fixes
3298         the webgl/2.0.0/conformance2/textures/webgl_canvas/ layout tests,
3299         which will be re-enabled in a subsequent patch. It also passes the
3300         more stringent webgl_canvas conformance tests in
3301         https://github.com/KhronosGroup/WebGL/pull/3071 .
3302
3303         * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
3304         (WebCore::GraphicsContextGLOpenGL::readPixelsAndConvertToBGRAIfNecessary):
3305         (WebCore::GraphicsContextGLOpenGL::reshapeFBOs):
3306         (WebCore::GraphicsContextGLOpenGL::resolveMultisamplingIfNecessary):
3307         (WebCore::GraphicsContextGLOpenGL::readPixels):
3308         (WebCore::GraphicsContextGLOpenGL::validateDepthStencil):
3309         (WebCore::GraphicsContextGLOpenGL::prepareTexture):
3310         (WebCore::GraphicsContextGLOpenGL::reshape):
3311         * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
3312         (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
3313         (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):
3314         * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
3315
3316 2020-05-13  Wenson Hsieh  <wenson_hsieh@apple.com>
3317
3318         [iOS] "Copy" context menu action for attachment element does not work in Mail
3319         https://bugs.webkit.org/show_bug.cgi?id=211817
3320         <rdar://problem/58043110>
3321
3322         Reviewed by Tim Horton.
3323
3324         Minor refactoring to help support writing attachment data to the pasteboard when using context menu actions to
3325         copy an attachment element on iOS. See below for more details, as well as the WebKit ChangeLog entry.
3326
3327         Test: WKAttachmentTestsIOS.CopyAttachmentUsingElementAction
3328
3329         * editing/Editor.cpp:
3330         (WebCore::Editor::platformContentTypeForBlobType const):
3331         (WebCore::Editor::promisedAttachmentInfo):
3332
3333         Move promisedAttachmentInfo out of DragController and into Editor, so that it is accessible outside of drag
3334         and drop code.
3335
3336         * editing/Editor.h:
3337         * editing/cocoa/EditorCocoa.mm:
3338         (WebCore::Editor::platformContentTypeForBlobType const):
3339
3340         Move this private helper function out of DragController as well, and into Editor.
3341
3342         * page/DragClient.h:
3343         * page/DragController.cpp:
3344         (WebCore::DragController::startDrag):
3345
3346         Refactor this to use Editor::promisedAttachmentInfo().
3347
3348         (WebCore::DragController::platformContentTypeForBlobType const): Deleted.
3349         (WebCore::DragController::promisedAttachmentInfo): Deleted.
3350         * page/DragController.h:
3351         * page/mac/DragControllerMac.mm:
3352         (WebCore::DragController::platformContentTypeForBlobType const): Deleted.
3353
3354 2020-05-13  Antoine Quint  <graouts@apple.com>
3355
3356         [Web Animations] Calling reverse() on an accelerated animation has no effect
3357         https://bugs.webkit.org/show_bug.cgi?id=204717
3358         <rdar://problem/62503582>
3359
3360         Reviewed by Dean Jackson.
3361
3362         Test: webanimations/accelerated-animation-playback-rate.html
3363
3364         We completely ignored the playbackRate set on a WebAnimation object when considering whether we could run an accelerated animation.
3365         To address this we do several things.
3366
3367         First, we now add a playbackRate() on Animation objects such that we can make GraphicsLayerCA aware of the originating WebAnimation's
3368         playback rate and use this data to opt out of running CA animations for animations with a playbackRate other than 1 in
3369         GraphicsLayerCA::animationCanBeAccelerated(). We'll be looking to add support for variable playback rates for CA animations in
3370         https://bugs.webkit.org/show_bug.cgi?id=211839.
3371
3372         Then, we make sure to completely replace an accelerated animation whenever one of the properties affected timing would change. Up until
3373         now we would onyl do this for a change in the effective currentTime, but this needs to also happen when the current time doesn't change
3374         but the animation may have changed playback rate or any of its timing properties that could change the duration of the animation. So we
3375         remove the "Seek" command and instead use an "UpdateTiming" command that will remove the existing animation and add a new one.
3376
3377         This allows us to remove any notion of seeking in GraphicsLayer since now we'll just create a new animation when its timing attributes
3378         changed.
3379
3380         This revealed an issue where if we called animationFinished() and startAnimation() on a RenderLayerModelObject in succession, theanimation
3381         removal would not occur on the GraphicsLayerCA because we disregarded any pending accelerated action for an animation we knew would be
3382         replaced. We now ensure we honor the removal in GraphicsLayerCA::appendToUncommittedAnimations().
3383
3384         * animation/AnimationEffect.cpp:
3385         (WebCore::AnimationEffect::updateTiming):
3386         * animation/AnimationEffect.h:
3387         * animation/CSSAnimation.cpp:
3388         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
3389         * animation/KeyframeEffect.cpp:
3390         (WebCore::KeyframeEffect::addPendingAcceleratedAction):
3391         (WebCore::KeyframeEffect::animationDidChangeTimingProperties):
3392         (WebCore::KeyframeEffect::applyPendingAcceleratedActions):
3393         (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const):
3394         (WebCore::KeyframeEffect::animationDidSeek): Deleted.
3395         * animation/KeyframeEffect.h:
3396         * animation/WebAnimation.cpp:
3397         (WebCore::WebAnimation::effectTimingDidChange):
3398         (WebCore::WebAnimation::setCurrentTime):
3399         (WebCore::WebAnimation::setPlaybackRate):
3400         (WebCore::WebAnimation::updatePlaybackRate):
3401         (WebCore::WebAnimation::reverse):
3402         * animation/WebAnimation.h:
3403         * platform/animation/Animation.h:
3404         (WebCore::Animation::playbackRate const):
3405         (WebCore::Animation::setPlaybackRate):
3406         * platform/graphics/GraphicsLayer.h:
3407         (WebCore::GraphicsLayer::pauseAnimation):
3408         (WebCore::GraphicsLayer::seekAnimation): Deleted.
3409         * platform/graphics/ca/GraphicsLayerCA.cpp:
3410         (WebCore::GraphicsLayerCA::animationCanBeAccelerated const):
3411         (WebCore::GraphicsLayerCA::updateAnimations):
3412         (WebCore::GraphicsLayerCA::pauseCAAnimationOnLayer):
3413         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
3414         (WebCore::GraphicsLayerCA::seekAnimation):&n