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