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