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