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