Extended Color: Move ColorMatrix to its own files
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2020-05-27  Sam Weinig  <weinig@apple.com>
2
3         Extended Color: Move ColorMatrix to its own files
4         https://bugs.webkit.org/show_bug.cgi?id=212431
5
6         Reviewed by Dean Jackson.
7
8         Move ColorMatrix to its own files from ColorUtilities.h/cpp
9
10         * Headers.cmake:
11         * Sources.txt:
12         * WebCore.xcodeproj/project.pbxproj:
13         * platform/graphics/ColorMatrix.cpp: Copied from Source/WebCore/platform/graphics/ColorUtilities.cpp.
14         * platform/graphics/ColorMatrix.h: Copied from Source/WebCore/platform/graphics/ColorUtilities.h.
15         * platform/graphics/ColorUtilities.cpp:
16         * platform/graphics/ColorUtilities.h:
17         * platform/graphics/filters/FilterOperation.cpp:
18
19 2020-05-27  David Kilzer  <ddkilzer@apple.com>
20
21         Add OptionSetTraits<> and use with WebCore::DragDestinationAction
22         <https://webkit.org/b/212397>
23
24         Reviewed by Alex Christensen.
25
26         * page/DragActions.h:
27         (WTF::OptionSetTraits<WebCore::DragDestinationAction>):
28         - Add for use with OptionSet<>.
29
30 2020-05-27  Wenson Hsieh  <wenson_hsieh@apple.com>
31
32         [Clipboard API] Support reading "image/png" on ClipboardItem
33         https://bugs.webkit.org/show_bug.cgi?id=212339
34         <rdar://problem/63588957>
35
36         Reviewed by Tim Horton.
37
38         Adds support for reading "image/png" data via ClipboardItem.getType(). See below for more details.
39
40         Tests:  ClipboardTests.ConvertTIFFToPNGWhenPasting
41                 editing/async-clipboard/clipboard-read-write-images.html
42
43         * Modules/async-clipboard/Clipboard.cpp:
44         (WebCore::Clipboard::getType):
45         (WebCore::Clipboard::updateSessionValidity):
46
47         Factor out logic for invalidating the `Clipboard`'s active `Pasteboard` object into a helper method. This is
48         invoked after reading data from the clipboard, and verifies that the changeCount of the pasteboard is still the
49         same as it was upon initially reading the contents of the clipboard. If the clipboard contents changed, we
50         invalidate the session, and `Clipboard` is subsequently denied pasteboard access (until the next time the user
51         explicitly grants programmatic pasteboard access).
52
53         Note that this step is here for correctness rather than security. While it is true that a compromised web
54         process could fake the changeCount at any given moment, other fairly recent changes around WebPasteboardProxy in
55         the UI process makes it impossible to take advantage of this fact to arbitrarily read content from the system
56         pasteboard. Instead of simply reading the empty string, this invalidation ensures that we actually reject the
57         promise returned by the async clipboard API.
58
59         * Modules/async-clipboard/Clipboard.h:
60         * Modules/async-clipboard/ClipboardImageReader.cpp: Added.
61
62         Add a PasteboardFileReader subclass that is responsible for sanitizing image data from the pasteboard into
63         data that may be exposed to the page via clipboard API. On both macOS and iOS, this ensures that potentially
64         sensitive EXIF data is stripped via conversion to the platform image type and back. On macOS, this additionally
65         allows us to handle transcoding TIFF data on the pasteboard to PNG (this is covered by the new API test).
66
67         (WebCore::ClipboardImageReader::readBuffer):
68
69         Add a stub implementation for non-Cocoa platforms for now, which don't implement this part of the API.
70
71         (WebCore::ClipboardImageReader::shouldReadBuffer const):
72
73         Add a new hook to skip over certain types when reading pasteboard data into Files. In particular,
74         `ClipboardImageReader` skips over any MIME type that does not match the MIME type specified (for now, this is
75         limited to "image/png", but may be extended to include more image types in the future after we implement more
76         transcoding logic).
77
78         * Modules/async-clipboard/ClipboardImageReader.h: Added.
79         (WebCore::ClipboardImageReader::ClipboardImageReader):
80         (WebCore::ClipboardImageReader::takeResult):
81         * Modules/async-clipboard/ios/ClipboardImageReaderIOS.mm: Added.
82         (WebCore::ClipboardImageReader::readBuffer):
83
84         Add iOS-specific `(PNG) => PNG` transcoding logic.
85
86         * Modules/async-clipboard/mac/ClipboardImageReaderMac.mm: Added.
87         (WebCore::ClipboardImageReader::readBuffer):
88
89         Add macOS-specific `(PNG, TIFF) => PNG` transcoding logic.
90
91         * Sources.txt:
92         * SourcesCocoa.txt:
93         * WebCore.xcodeproj/project.pbxproj:
94         * platform/Pasteboard.h:
95         (WebCore::PasteboardFileReader::shouldReadBuffer const):
96         * platform/cocoa/PasteboardCocoa.mm:
97         (WebCore::Pasteboard::read):
98
99         Add support for targeting a given pasteboard item index when reading files on Cocoa platforms.
100
101         * platform/gtk/PasteboardGtk.cpp:
102         (WebCore::Pasteboard::read):
103         * platform/ios/PlatformPasteboardIOS.mm:
104         (WebCore::safeTypeForDOMToReadAndWriteForPlatformType):
105         (WebCore::webSafeTypes):
106         (WebCore::PlatformPasteboard::informationForItemAtIndex):
107
108         Expose "image/png" as one of the readable pasteboard types on iOS when using the async clipboard API. For some
109         reason, this adjustment was made on macOS, but wasn't done on iOS, which led to a missing "image/png" type when
110         asking for `ClipboardItem.types`.
111
112         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
113
114         Add support for writing "image/png "data to the system pasteboard (note that this data has been sanitized
115         already, as it has been processed through `ClipboardItemTypeLoader::sanitizeDataIfNeeded()`). We simply needed
116         to use `forEachPlatformStringOrBuffer` instead of just `forEachPlatformString` when writing the custom
117         pasteboard data.
118
119         (WebCore::createItemProviderRegistrationList):
120         * platform/libwpe/PasteboardLibWPE.cpp:
121         (WebCore::Pasteboard::read):
122         * platform/win/PasteboardWin.cpp:
123         (WebCore::Pasteboard::read):
124
125 2020-05-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
126
127         REGRESSION (r254541): Valid mime types can only be added to the HashSet of the supported types for encoding
128         https://bugs.webkit.org/show_bug.cgi?id=212427
129
130         Reviewed by Darin Adler.
131
132         Add back a check for the mime type validity which was removed in r254541.
133
134         * platform/MIMETypeRegistry.cpp:
135         (WebCore::MIMETypeRegistry::createMIMETypeRegistryThreadGlobalData):
136
137 2020-05-27  Devin Rousso  <drousso@apple.com>
138
139         Web Inspector: replace `featureGuard` and `availability` with a combined `condition` that accepts any macro
140         https://bugs.webkit.org/show_bug.cgi?id=210014
141
142         Reviewed by Brian Burg.
143
144         Previously, the generated InspectorBackendCommands.js would include code for things that the
145         backend doesn't actually support. By using actual macros and preprocessing that file, we can
146         ensure that the frontend doesn't incorrectly think that something is supported by the page
147         being inspected:
148          - the `Canvas` commands and events related to shader programs/pipelines should only exist
149            when the corresponding context type exists, namely `ENABLE(WEBGL)` and `ENABLE(WEBGPU)`.
150          - iOS doesn't support showing rulers, so create a variant of `DOM.setInspectModeEnabled`
151            that only exists for `PLATFORM(IOS_FAMILY)` that doesn't have the `showRulers` optional
152            parameter, as well as removing `Page.setShowRulers` entirely.
153          - setting the forced appearance should only be possible if dark mode is supported.
154          - web archives only exist if CF is used.
155
156         * inspector/InspectorInstrumentation.h:
157         * inspector/InspectorInstrumentation.cpp:
158         * inspector/agents/InspectorCanvasAgent.h:
159         * inspector/agents/InspectorCanvasAgent.cpp:
160         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
161         (WebCore::InspectorCanvasAgent::enable):
162         (WebCore::InspectorCanvasAgent::startRecording):
163         (WebCore::InspectorCanvasAgent::reset):
164         (WebCore::InspectorCanvasAgent::unbindCanvas):
165         * inspector/InspectorShaderProgram.h:
166         * inspector/InspectorShaderProgram.cpp:
167         (WebCore::InspectorShaderProgram::requestShaderSource):
168         (WebCore::InspectorShaderProgram::updateShader):
169         * inspector/agents/InspectorDOMAgent.h:
170         * inspector/agents/InspectorDOMAgent.cpp:
171         (WebCore::InspectorDOMAgent::setInspectModeEnabled):
172         * inspector/agents/InspectorPageAgent.h:
173         * inspector/agents/InspectorPageAgent.cpp:
174         (WebCore::InspectorPageAgent::enable):
175         (WebCore::InspectorPageAgent::disable):
176         (WebCore::InspectorPageAgent::setForcedAppearance):
177         (WebCore::InspectorPageAgent::archive):
178
179         * Configurations/FeatureDefines.xcconfig:
180         Add `ENABLE_WEB_ARCHIVE` since it's always enabled in wtf/PlatformEnableCocoa.h.
181
182         * inspector/InspectorFrontendHost.idl:
183         Drive-by: replace the `#if` with the IDL `[Conditional=]`.
184
185 2020-05-27  Miguel Gomez  <magomez@igalia.com>
186
187         [WPE] REGRESSION(r253675) Crash when using threaded rendering
188         https://bugs.webkit.org/show_bug.cgi?id=212404
189
190         Reviewed by Carlos Garcia Campos.
191
192         Check whether the GraphicsContext has a PlatformGraphicsContext before trying to paint with
193         it. If there's no PlatformGraphicsContext, paint using the GraphicsContext methods instead.
194
195         * platform/graphics/cairo/ImageBufferCairoBackend.cpp:
196         (WebCore::ImageBufferCairoBackend::draw):
197         (WebCore::ImageBufferCairoBackend::drawPattern):
198
199 2020-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
200
201         Unreviewed. Fix build warning with GTK4
202
203         * platform/gtk/GtkUtilities.cpp:
204         (WebCore::widgetRootCoords):
205
206 2020-05-27  David Kilzer  <ddkilzer@apple.com>
207
208         Use OptionSet<DragDestinationAction> for mask values
209         <https://webkit.org/b/212115>
210         <rdar://problem/63423380>
211
212         Reviewed by Alex Christensen.
213
214         DragDestinationAction is used as both individual values and as a
215         bit mask. This changes bit mask uses to OptionSet<> and renames
216         variables to denote masks.
217
218         * page/DragActions.h:
219         (WebCore::DragDestinationAction):
220         - Convert to enum class and remove *None and *Any values.
221         (WebCore::DragDestinationActionAny):
222         - Add helper function to return OptionSet<DragDestinationAction>
223           with all values set.
224         * page/DragController.cpp:
225         (WebCore::DragController::performDragOperation):
226         (WebCore::DragController::dragEnteredOrUpdated):
227         (WebCore::DragController::tryDocumentDrag):
228         (WebCore::DragController::concludeEditDrag):
229         * page/DragController.h:
230         (WebCore::DragController::dragDestinationAction const): Rename.
231         (WebCore::DragController::dragDestinationActionMask const):
232         - Rename dragDestinationAction() to dragDestinationActionMask().
233         * platform/DragData.cpp:
234         (WebCore::DragData::DragData):
235         * platform/DragData.h:
236         (WebCore::DragData::DragData):
237         - Use DragDestinationActionAny() in place of removed
238           DragDestinationActionAny.
239         (WebCore::DragData::dragDestinationAction const): Rename.
240         (WebCore::DragData::dragDestinationActionMask const):
241         - Rename dragDestinationAction() to dragDestinationActionMask().
242         (WebCore::DragData::operator =):
243         * platform/cocoa/DragDataCocoa.mm:
244         (WebCore::DragData::DragData):
245
246 2020-05-27  Youenn Fablet  <youenn@apple.com>
247
248         Video freezes when attaching a local MediaStream to multiple elements
249         https://bugs.webkit.org/show_bug.cgi?id=194802
250         <rdar://problem/63613107>
251
252         Reviewed by Eric Carlson.
253
254         AVSampleBufferDisplayLayer sometimes does not update the rendering when the same local source is rendered several times.
255         To workaround this, we set kCMSampleAttachmentKey_DisplayImmediately to true, which fixes the issue as per my testing.
256         We clone the sample buffer before setting this property as it might not be thread safe to modify the attachments of a sample
257         that might also be encoded.
258         We implement this at LocalSampleBufferDisplayLayer level and enable this for local capture sources only.
259
260         Manually tested.
261
262         * platform/graphics/avfoundation/SampleBufferDisplayLayer.h:
263         (WebCore::SampleBufferDisplayLayer::setRenderPolicy):
264         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h:
265         (WebCore::LocalSampleBufferDisplayLayer::setRenderPolicy):
266         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:
267         (WebCore::LocalSampleBufferDisplayLayer::enqueueSample):
268         (WebCore::LocalSampleBufferDisplayLayer::removeOldSamplesFromPendingQueue):
269         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
270         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
271         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack):
272         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h:
273         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
274         (WebCore::setSampleBufferAsDisplayImmediately):
275         (WebCore::MediaSampleAVFObjC::setAsDisplayImmediately):
276         (WebCore::MediaSampleAVFObjC::cloneSampleBuffer):
277
278 2020-05-19  Sergio Villar Senin  <svillar@igalia.com>
279
280         [WebXR] Implement XRSession::requestAnimationFrame()
281         https://bugs.webkit.org/show_bug.cgi?id=212099
282
283         Reviewed by Youenn Fablet.
284
285         The WebXR spec defines a requestAnimationFrame() mechanism to provide information about XR tracking devices
286         using callbacks. It's pretty similar to the requestAnimationFrame() exposed by Window but only used
287         to update WebXR content. We're adding a basic implementation of this mechanism as long as cancellation
288         support. It requires some platform code that will be added in follow up patches. That platform code will
289         provide information like devices' refresh rates, pose (position & orientation), display resolution, etc...
290
291         This patch also replaces the type of the callback id from int to unsigned int as per the following change
292         in specs https://github.com/immersive-web/webxr/pull/1062.
293
294         Apart from that we're adding a missing adoptRef() in the testing code that was causing assertions in some
295         of the tests that are being unskipped as part of this change.
296
297         * Modules/webxr/WebXRSession.cpp:
298         (WebCore::WebXRSession::WebXRSession):
299         (WebCore::WebXRSession::animationTimerFired): Added.
300         (WebCore::WebXRSession::scheduleAnimation): Ditto.
301         (WebCore::WebXRSession::requestAnimationFrame): Ditto.
302         (WebCore::WebXRSession::cancelAnimationFrame):
303         * Modules/webxr/WebXRSession.h:
304         * Modules/webxr/XRFrameRequestCallback.h:
305         (WebCore::XRFrameRequestCallback::callbackId):
306         (WebCore::XRFrameRequestCallback::setCallbackId):
307         (WebCore::XRFrameRequestCallback::cancel):
308         (WebCore::XRFrameRequestCallback::isCancelled const):
309         * testing/WebFakeXRDevice.cpp:
310         (WebCore::WebFakeXRDevice::simulateInputSourceConnection):
311         * testing/WebFakeXRDevice.h:
312         * testing/WebFakeXRInputController.h:
313
314 2020-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
315
316         [GTK4] Make PointerLock work
317         https://bugs.webkit.org/show_bug.cgi?id=212314
318
319         Reviewed by Adrian Perez de Castro.
320
321         * platform/gtk/GtkUtilities.cpp:
322         (WebCore::widgetDevicePosition): Helper function to avoid #ifdefs due to GTK version differences.
323         * platform/gtk/GtkUtilities.h:
324
325 2020-05-27  Peng Liu  <peng.liu6@apple.com>
326
327         VideoFullscreenInterfaceAVKit is leaking when a video element enters and exits fullscreen/picture-in-picture
328         https://bugs.webkit.org/show_bug.cgi?id=212293
329
330         Reviewed by Youenn Fablet.
331
332         WebAVPlayerViewControllerDelegate is created and retained by VideoFullscreenInterfaceAVKit,
333         but it has a RefPtr to VideoFullscreenInterfaceAVKit. This leads to a memory leak
334         when a video element enters and exit fullscreen or Picture-in-Picture. This patch
335         replaces the RefPtr with a WeakPtr to fix the leak.
336
337         With this patch, we config playerController in VideoFullscreenInterfaceAVKit::setupFullscreen()
338         and VideoFullscreenInterfaceAVKit::cleanupFullscreen(), so that we can avoid relying on
339         VideoFullscreenManagerProxy::setHasVideo() and VideoFullscreenManagerProxy::setVideoDimensions().
340         Those two functions are driven by IPC messages from the Web process, which may come before
341         VideoFullscreenInterfaceAVKit is constructed or after VideoFullscreenInterfaceAVKit
342         is destroyed.
343
344         Manually tested.
345
346         * platform/ios/VideoFullscreenInterfaceAVKit.h:
347         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
348         (-[WebAVPlayerViewControllerDelegate setFullscreenInterface:]):
349         (VideoFullscreenInterfaceAVKit::setupFullscreen):
350         (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
351
352 2020-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
353
354         [GTK][WTR] EventSender: stop using GdkEvent API in preparation for GTK4
355         https://bugs.webkit.org/show_bug.cgi?id=212298
356
357         Reviewed by Adrian Perez de Castro.
358
359         Add helpers to GtkUtilities to avoid #ifdefs due to GTK version differences.
360
361         * platform/gtk/GtkUtilities.cpp:
362         (WebCore::widgetRootCoords):
363         (WebCore::widgetKeyvalToKeycode):
364         * platform/gtk/GtkUtilities.h:
365
366 2020-05-26  Said Abou-Hallawa  <sabouhallawa@apple.com>
367
368         SMILTimeContainer must protect its m_scheduledAnimations while it does updateAnimations()
369         https://bugs.webkit.org/show_bug.cgi?id=212192
370         <rdar://problem/56717734>
371
372         Reviewed by Youenn Fablet.
373
374         updateAnimations() needs to protect m_scheduledAnimations while processing
375         the scheduled animations. m_scheduledAnimations may be changed from JavaScript
376         callbacks. This will invalidate the HashMap iterators while the one used
377         by the for-loop in updateAnimations() is still in use.
378
379         To allow copying m_scheduledAnimations, the value of the entry has to be
380         of type AnimationVector instead of std::unique_ptr<AnimationVector>.        
381
382         Test: svg/animations/css-animation-reinsert-target.html
383
384         * svg/animation/SMILTimeContainer.cpp:
385         (WebCore::SMILTimeContainer::schedule):
386         (WebCore::SMILTimeContainer::unschedule):
387         (WebCore::SMILTimeContainer::processScheduledAnimations):
388         (WebCore::SMILTimeContainer::updateAnimations):
389         * svg/animation/SMILTimeContainer.h:
390
391 2020-05-26  Alex Christensen  <achristensen@webkit.org>
392
393         MacApplication::isSafari should allow safari bundle id variants
394         https://bugs.webkit.org/show_bug.cgi?id=212401
395
396         Reviewed by Timothy Hatcher.
397
398         There is a test environment with bundle ID com.apple.Safari.something.
399         This change is blocking rdar://problem/63574451
400
401         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
402         (WebCore::MacApplication::isSafari):
403
404 2020-05-26  Simon Fraser  <simon.fraser@apple.com>
405
406         Rendering artifacts when scrolling overlays
407         https://bugs.webkit.org/show_bug.cgi?id=204120
408         <rdar://problem/57121358>
409
410         Reviewed by Zalan Bujtas.
411
412         RenderLayerBacking::setContentsNeedDisplayInRect() needs to adjust repaint rects in the
413         scrolled contents layer by the RenderLayer's scrollOffset, because that's what's used
414         during repaint rect computation. We haven't yet pushed the new scroll offset onto the
415         GraphicsLayer, so m_scrolledContentsLayer->scrollOffset() would be stale here.
416
417         I tested RTL to make sure that scrollOffset(), and not scrollPosition() is the correct
418         function to tall.
419
420         Test: compositing/repaint/compositing-toggle-in-overflow-scroll-repaint.html
421
422         * rendering/RenderLayerBacking.cpp:
423         (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
424
425 2020-05-26  Said Abou-Hallawa  <sabouhallawa@apple.com>
426
427         An SVG animated property animator can stop animation while other animators are still running
428         https://bugs.webkit.org/show_bug.cgi?id=207417
429         <rdar://problem/59278306>
430
431         Reviewed by Simon Fraser.
432
433         An SVG animated property can be animated by multiple animators. When one
434         animator stops the animation, the animVal should not be deleted since it
435         will be used by other animators.
436
437         SVGAnimatedProperty will maintain a WeakHashSet<SVGAttributeAnimator> in
438         which the animator will be added when the animation starts and will be 
439         removed when the the animation stops. When all the animators stops their
440         animations, the animated property may delete the animVal or keep it if it
441         can be referenced by JavaScript.
442
443         Tests: svg/animations/animated-enum-mutiple-animators.svg
444                svg/animations/animated-length-mutiple-animators.svg
445
446         * svg/properties/SVGAnimatedDecoratedProperty.h:
447         * svg/properties/SVGAnimatedPrimitiveProperty.h:
448         * svg/properties/SVGAnimatedProperty.h:
449         (WebCore::SVGAnimatedProperty::isAnimating const):
450         (WebCore::SVGAnimatedProperty::startAnimation):
451         (WebCore::SVGAnimatedProperty::stopAnimation):
452         (WebCore::SVGAnimatedProperty::instanceStartAnimation):
453         (WebCore::SVGAnimatedProperty::instanceStopAnimation):
454         * svg/properties/SVGAnimatedPropertyAnimator.h:
455         * svg/properties/SVGAnimatedPropertyList.h:
456         * svg/properties/SVGAnimatedValueProperty.h:
457         * svg/properties/SVGAttributeAnimator.h:
458
459 2020-05-26  Simon Fraser  <simon.fraser@apple.com>
460
461         REGRESSION (async oveflow): scrubber missing from inline video inside overflow scroll
462         https://bugs.webkit.org/show_bug.cgi?id=212391
463         <rdar://problem/63089859>
464
465         Reviewed by Zalan Bujtas.
466
467         backgroundClipRect() is in the coordinate space of the ClipRectContext's rootLayer, not the receiver,
468         so when converting to absolute coordinates we must use the ClipRectContext's rootLayer.
469
470         Test: compositing/layer-creation/overlap-in-scroller.html
471
472         * rendering/RenderLayerCompositor.cpp:
473         (WebCore::RenderLayerCompositor::addToOverlapMap const):
474
475 2020-05-26  Jer Noble  <jer.noble@apple.com>
476
477         Can't scrub video on https://www.judiciary.senate.gov
478         https://bugs.webkit.org/show_bug.cgi?id=212270
479         <rdar://problem/57922919>
480
481         Reviewed by Eric Carlson.
482
483         Test: media/video-duration-seekable.html
484
485         www.judiciary.senate.gov uses the Akamai Media Player, which doesn't query HTMLMediaElement.duration
486         directly. Rather, when it receives a "durationchange" event, it calculates the duration by using the
487         HTMLMediaElement.seekable ranges to determine the effective media duration. But no event is fired when
488         the seekable ranges change, and when they first query HTMLMediaElement.seekable, AVFoundation hasn't
489         yet updated seekable ranges, so we report an empty set of seekable ranges.
490
491         The HTML specification suggests that UAs "should adopt a very liberal and optimistic view of what is
492         seekable." With that advice in mind, when we are asked by the page for our seekable ranges, and we do
493         not yet have the official ranges from AVPlayerItem, lets just respond with [0, duration).
494
495         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
496         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformMaxTimeSeekable const):
497
498 2020-05-25  Darin Adler  <darin@apple.com>
499
500         Eliminate Color constructors that take strings, moving color parsing entirely into the CSS parser
501         https://bugs.webkit.org/show_bug.cgi?id=212296
502
503         Reviewed by Sam Weinig.
504
505         * css/parser/CSSParser.cpp:
506         (WebCore::CSSParser::parseColor): Moved more of the logic into
507         CSSParserFastPaths::parseSimpleColor. Also added a FIXME about what
508         seems to be a mistake about strict mode.
509         (WebCore::CSSParser::parseColorWorkerSafe): Ditto.
510         (WebCore::CSSParser::parseSystemColor): Removed unused context argument.
511         (WebCore::CSSParser::parseNamedColor): Added.
512         (WebCore::CSSParser::parseHexColor): Added.
513         (WebCore::CSSParser::parseSingleValue): Use auto.
514         (WebCore::CSSParser::parseValue): Ditto.
515
516         * css/parser/CSSParser.h: Exported parseColor. Removed unused value pool
517         and strict arguments from parseColorWorkerSafe. Removed unused context
518         argument from parseSystemColor. Added parseNamedColor and parseHexColor.
519
520         * css/parser/CSSParserFastPaths.cpp:
521         (WebCore::parseSimpleLengthValue): Take a StringView.
522         (WebCore::finishParsingHexColor): Added, logic moved from Color constructor.
523         (WebCore::parseHexColorInternal): Ditto.
524         (WebCore::parseNumericColor): Added, logic moved from fastParseColorInternal.
525         (WebCore::parseColor): Turned into a non-member function since it's private
526         to this file. Use auto a bit more, and removed unneeded value pool argument.
527         (WebCore::finishParsingNamedColor): Added, logic moved from Color constructor.
528         (WebCore::parseNamedColorInternal): Ditto.
529         (WebCore::parseSimpleColorInternal): Ditto.
530         (WebCore::CSSParserFastPaths::parseSimpleColor): Ditto.
531         (WebCore::CSSParserFastPaths::parseHexColor): Ditto.
532         (WebCore::CSSParserFastPaths::parseNamedColor): Ditto.
533         (WebCore::isUniversalKeyword): Take a StringView.
534         (WebCore::parseKeywordValue): Ditto.
535         (WebCore::parseSimpleTransform): Ditto.
536         (WebCore::parseCaretColor): Ditto. Also take a parser context rather than
537         a parser mode.
538         (WebCore::CSSParserFastPaths::maybeParseValue): Take a StringView.
539
540         * css/parser/CSSParserFastPaths.h: Cut down includes. Use StringView.
541         Added parseSimpleColor, parseHexColor, and parseNamedColor.
542
543         * css/parser/CSSPropertyParserHelpers.cpp:
544         (WebCore::CSSPropertyParserHelpers::parseHexColor): Return an
545         Optional<SimpleColor> instead of a Color.
546         (WebCore::CSSPropertyParserHelpers::consumeColor): Refactor a bit for clarity.
547
548         * html/HTMLElement.cpp:
549         (WebCore::parseLegacyColorValue): Renamed from parseColorStringWithCrazyLegacyRules
550         and refactored a bit. Made this match the HTML specification more closely.
551         (WebCore::HTMLElement::addHTMLColorToStyle): Simplify now that more of the logic
552         was moved into parseLegacyColorValue.
553
554         * html/canvas/CanvasStyle.cpp:
555         (WebCore::parseColor): Removed unneeded arguments for parseColorWorkerSafe
556         and for parseSystemColor.
557
558         * platform/graphics/Color.cpp:
559         (WebCore::findNamedColor): Deleted.
560         (WebCore::Color::Color): Deleted overloadds that take strings.
561         * platform/graphics/Color.h: Updated for the above.
562
563         * platform/graphics/SimpleColor.cpp:
564         (WebCore::parseHexColorInternal): Deleted.
565         (WebCore::SimpleColor::parseHexColor): Deleted.
566         * platform/graphics/SimpleColor.h: Removed parseHexColor functions.
567
568 2020-05-26  Antoine Quint  <graouts@apple.com>
569
570         Hardware fill-forwards animation and transitions don't interact correctly
571         https://bugs.webkit.org/show_bug.cgi?id=187839
572         <rdar://problem/42410412>
573
574         Reviewed by Simon Fraser.
575
576         Test: webanimations/updating-property-targeted-by-css-transition-during-css-animation.html
577
578         We didn't follow the CSS Transitions spec closely enough when it came to defining the correct before and after
579         change styles during a style change event.
580
581         We now correctly set the before-change style as one of three possible values:
582         
583             1. if there are running CSS-originated animations, we ensure those are updated to the current time and
584                resolve them to get the style,
585             2. otherwise we use the RenderStyle recorded in Style::TreeResolver::createAnimatedElementUpdate() prior
586                to applying animations during the last style change event,
587             3. otherwise we use the previous computed style, which should not have any animated values.
588         
589         As for the after-change style, we also need to ensure any running CSS Animations are update to the current time
590         and resolve them to get the style. Otherwise, we just use the current computed style prior to applying animations.
591
592         Finally, we can exit from AnimationTimeline::updateCSSTransitionsForElementAndProperty() early if we find that
593         we have a JS-originated animation running for the given property on the given element since we know that that
594         animation will yield an overriding value for both the before and after change styles since JS-originated animations
595         have the hightest composite order.
596
597         This means we no longer need to track the unanimated style on KeyframeEffect.
598
599         * animation/AnimationTimeline.cpp:
600         (WebCore::AnimationTimeline::updateCSSAnimationsForElement):
601         (WebCore::AnimationTimeline::updateCSSTransitionsForElementAndProperty):
602         (WebCore::AnimationTimeline::updateCSSTransitionsForElement):
603         * animation/AnimationTimeline.h:
604         * animation/ElementAnimationRareData.h:
605         (WebCore::ElementAnimationRareData::lastStyleChangeEventStyle const):
606         (WebCore::ElementAnimationRareData::setLastStyleChangeEventStyle):
607         * animation/KeyframeEffect.cpp:
608         (WebCore::KeyframeEffect::clearBlendingKeyframes):
609         (WebCore::KeyframeEffect::apply):
610         (WebCore::KeyframeEffect::applyPendingAcceleratedActions):
611         * animation/KeyframeEffect.h:
612         (WebCore::KeyframeEffect::unanimatedStyle const): Deleted.
613         * dom/Element.cpp:
614         (WebCore::Element::lastStyleChangeEventStyle const):
615         (WebCore::Element::setLastStyleChangeEventStyle):
616         * dom/Element.h:
617         * style/StyleTreeResolver.cpp:
618         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
619
620 2020-05-26  Sam Weinig  <weinig@apple.com>
621
622         Extended Color Cleanup: Remove red()/green()/blue() accessors from ExtendedColor in preperation for supporting non-RGB based ColorSpaces
623         https://bugs.webkit.org/show_bug.cgi?id=212366
624
625         Reviewed by Simon Fraser.
626
627         * platform/graphics/Color.cpp:
628         (WebCore::differenceSquared):
629         Switch to using toSRGBASimpleColorLossy() rather than poking at the ExtendedColor
630         components directly. The old code was already incorrect if the two colors had 
631         differing color spaces so this at least now gives reasonable results.
632
633         (WebCore::Color::colorWithAlpha const):
634         (WebCore::Color::colorWithAlphaUsingAlternativeRounding const):
635         Delegate to ExtendedColor completely for colorWithAlpha() to allow for more
636         control over how the components might be stored in the future.
637         
638         * platform/graphics/Color.h:
639         (WebCore::Color::isBlackColor):
640         (WebCore::Color::isWhiteColor):
641         Delegate to ExtendedColor for isBlack()/isWhite() to allow per-color space
642         interpretations of the predicate.
643
644         (WebCore::Color::encode const):
645         (WebCore::Color::decode):
646         Use c1, c2, c3 rather than red/green/blue. This should be acceptable for the
647         forseeable future, as all expected colorspaces only have 3 channels, but at 
648         some point, it may make sense to delegate coding to ExtendedColor completely.
649
650         * platform/graphics/ExtendedColor.cpp:
651         * platform/graphics/ExtendedColor.h:
652         (WebCore::ExtendedColor::channels const):
653         (WebCore::ExtendedColor::red const): Deleted.
654         (WebCore::ExtendedColor::green const): Deleted.
655         (WebCore::ExtendedColor::blue const): Deleted.
656         (WebCore::ExtendedColor::colorWithAlpha const): Added.
657         (WebCore::ExtendedColor::isWhite const): Added.
658         (WebCore::ExtendedColor::isBlack const): Added.
659         Use channels() with structured bindings rather than the red()/green()/blue() accessors
660         everywhere.
661
662 2020-05-26  Peng Liu  <peng.liu6@apple.com>
663
664         ASSERTION FAILED: m_clientCounts.contains(contextId) - WebKit::VideoFullscreenManagerProxy::removeClientForContext()
665         https://bugs.webkit.org/show_bug.cgi?id=212308
666
667         Reviewed by Jer Noble.
668
669         Call m_videoFullscreenModel->didExitPictureInPicture() after the video player
670         completes the process to exit Picture-in-Picture.
671
672         Covered by existing tests.
673
674         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
675         (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
676         (VideoFullscreenInterfaceAVKit::didStopPictureInPicture):
677
678 2020-05-26  Zalan Bujtas  <zalan@apple.com>
679
680         [LFC][TFC] Use padding to space out sections
681         https://bugs.webkit.org/show_bug.cgi?id=212377
682
683         Reviewed by Antti Koivisto.
684
685         Use fake padding before/after to space out sections.
686
687         Test: fast/layoutformattingcontext/table-simple-multiple-sections-with-border-spacing-and-collapse.html
688
689         * layout/tableformatting/TableFormattingContext.cpp:
690         (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
691
692 2020-05-26  Keith Rollin  <krollin@apple.com>
693
694         Enable the use of XCBuild by default in Apple builds
695         https://bugs.webkit.org/show_bug.cgi?id=209890
696         <rdar://problem/44182078>
697
698         Reviewed by Darin Adler.
699
700         Switch from the "legacy" Xcode build system to the "new" build system
701         (also known as "XCBuild"). Switching to the new system speeds up
702         builds by a small percentage, better validates projects for
703         build-related issues (such as dependency cycles), lets WebKit benefit
704         from future improvements in XCBuild such as those coming from the
705         underlying llbuild open source project, and prepares us for any other
706         tools built for this new ecosystem.
707
708         Specific changes:
709
710         - Remove Xcode project and workspace settings that selected the Build
711           system, allowing the default to take hold (which is currently the
712           New build system).
713         - Updated webkitdirs.pm with a terser check for Xcode version.
714         - Update build-webkit and Makefile.shared to be explicit when using
715           the old build system (no longer treat it as a default or fall-back
716           configuration).
717         - Update various xcconfig files similarly to treat the default as
718           using the new build system.
719         - Update various post-processing build steps to check for Xcode 11.4
720           and to no longer treat the default as using the old build system.
721
722         No new tests -- no changed functionality.
723
724         * WebCore.xcodeproj/project.pbxproj:
725
726 2020-05-26  Zalan Bujtas  <zalan@apple.com>
727
728         [LFC][TFC] Add support for multiple sections
729         https://bugs.webkit.org/show_bug.cgi?id=212354
730
731         Reviewed by Antti Koivisto.
732
733         Let's keep the grid about rows and columns and about distributing available space.
734         Use the layout tree to find sections. 
735
736         Test: fast/layoutformattingcontext/table-simple-multiple-sections.html
737
738         * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
739         (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox):
740         * layout/tableformatting/TableFormattingContext.cpp:
741         (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells):
742         (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows):
743         (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
744         * layout/tableformatting/TableGrid.cpp:
745         (WebCore::Layout::TableGrid::appendCell):
746         (WebCore::Layout::TableGrid::Section::Section): Deleted.
747         * layout/tableformatting/TableGrid.h:
748         (WebCore::Layout::TableGrid::Section::box const): Deleted.
749         (WebCore::Layout::TableGrid::sections const): Deleted.
750         (WebCore::Layout::TableGrid::sections): Deleted.
751
752 2020-05-26  Carlos Garcia Campos  <cgarcia@igalia.com>
753
754         [GTK4] Use screen font options as default
755         https://bugs.webkit.org/show_bug.cgi?id=212332
756
757         Reviewed by Adrian Perez de Castro.
758
759         There's no gdk_screen_get_font_options() in GTK4, so we need to get the individual properties from the settings
760         and build a cairo_font_options_t. We can just do the same in GTK3 to avoid ifdefs. Add a helper
761         SystemFontOptions singleton class to monitor and parse the font settings.
762
763         * platform/graphics/gtk/GdkCairoUtilities.cpp:
764         (WebCore::SystemFontOptions::singleton):
765         (WebCore::SystemFontOptions::SystemFontOptions):
766         (WebCore::SystemFontOptions::fontOptions const):
767         (WebCore::SystemFontOptions::updateFontOptions):
768         (WebCore::getDefaultCairoFontOptions):
769
770 2020-05-25  Simon Fraser  <simon.fraser@apple.com>
771
772         Use an Optional<> for LayerFragment::boundingBox
773         https://bugs.webkit.org/show_bug.cgi?id=212358
774
775         Reviewed by Zalan Bujtas.
776
777         Replace a bool + LayoutRect with Optional<LayoutRect>.
778
779         * rendering/LayerFragment.h:
780         (WebCore::LayerFragment::setRects):
781         (WebCore::LayerFragment::moveBy):
782         (WebCore::LayerFragment::intersect):
783         * rendering/RenderLayer.cpp:
784         (WebCore::RenderLayer::collectFragments):
785         (WebCore::RenderLayer::updatePaintingInfoForFragments):
786         (WebCore::RenderLayer::calculateClipRects const):
787         * rendering/RenderLayer.h:
788
789 2020-05-25  Simon Fraser  <simon.fraser@apple.com>
790
791         Make isTableRow() an inline function
792         https://bugs.webkit.org/show_bug.cgi?id=212360
793
794         Reviewed by Darin Adler.
795
796         isTableCell() is a virtual function that's called in some hot code paths, like RenderLayer::localBoundingBox(),
797         so make it inline by using a spare bit on RenderObject.
798
799         * rendering/RenderObject.h:
800         (WebCore::RenderObject::isTableCaption const):
801         (WebCore::RenderObject::isTableRow const):
802         (WebCore::RenderObject::setIsTableRow):
803         (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
804         * rendering/RenderTableRow.cpp:
805         (WebCore::RenderTableRow::RenderTableRow):
806         * rendering/RenderTableRow.h:
807
808 2020-05-25  Alex Christensen  <achristensen@webkit.org>
809
810         Expose more network metrics to WebCoreNSURLSession
811         https://bugs.webkit.org/show_bug.cgi?id=212359
812         <rdar://problem/62909440>
813
814         Reviewed by Darin Adler.
815
816         * platform/network/NetworkLoadMetrics.h:
817         (WebCore::NetworkLoadMetrics::isolatedCopy const):
818         (WebCore::NetworkLoadMetrics::operator== const):
819         (WebCore::NetworkLoadMetrics::encode const):
820         (WebCore::NetworkLoadMetrics::decode):
821         * platform/network/cocoa/WebCoreNSURLSession.mm:
822         (-[WebCoreNSURLSessionTaskTransactionMetrics networkProtocolName]):
823         (-[WebCoreNSURLSessionTaskTransactionMetrics isReusedConnection]):
824         (-[WebCoreNSURLSessionTaskTransactionMetrics cellular]):
825         (-[WebCoreNSURLSessionTaskTransactionMetrics expensive]):
826         (-[WebCoreNSURLSessionTaskTransactionMetrics constrained]):
827         (-[WebCoreNSURLSessionTaskTransactionMetrics multipath]):
828
829 2020-05-25  Oriol Brufau  <obrufau@igalia.com>
830
831         [css-grid] Prevent grid-template-rows from serializing adjacent <line-names>
832         https://bugs.webkit.org/show_bug.cgi?id=212345
833
834         Reviewed by Manuel Rego Casasnovas.
835
836         The parser for the grid-template shorthand has this code:
837
838             // Persists between loop iterations so we can use the same value for
839             // consecutive <line-names> values
840             RefPtr<CSSGridLineNamesValue> lineNames;
841
842         However, this wasn't working because of a lineNames.releaseNonNull() at
843         the end of the loop. So each iteration started with a null lineNames, and
844         consecutive <line-names> values were not merged together.
845
846         Tests: fast/css-grid-layout/grid-template-shorthand-get-set.html
847                imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand.html
848                imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand-valid.html
849                imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-shorthand.html
850                imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-shorthand-valid.html
851
852         * css/parser/CSSPropertyParser.cpp:
853         (WebCore::CSSPropertyParser::consumeGridTemplateRowsAndAreasAndColumns):
854
855 2020-05-25  Sam Weinig  <weinig@apple.com>
856
857         Extended Color Cleanup: Assert !isExtended() in Color::asSimpleColor()...finally
858         https://bugs.webkit.org/show_bug.cgi?id=212357
859
860         Reviewed by Simon Fraser.
861
862         Reap the reward of the cleanup, and add the ASSERT(!isExtended()) to Color::asSimpleColor()
863         as was the original goal of this effort. Only tree non-checked places remained and were 
864         trivial to add isExtended() checks for.
865
866         * platform/graphics/Color.cpp:
867         (WebCore::Color::nameForRenderTreeAsText const):
868         Use ExtenedColor::cssText() for the RenderTree representation. It is stable 
869         and as good as any, no need to re-invent the wheel here.
870
871         (WebCore::Color::light const):
872         (WebCore::Color::dark const):
873         Add isExtended() checks before doing white/black checks,
874
875         * platform/graphics/Color.h:
876         (WebCore::Color::asSimpleColor const):
877         Add ASSERT.
878
879 2020-05-24  Sam Weinig  <weinig@apple.com>
880
881         Extended Color Cleanup: Use the name SimpleColor consistently
882         https://bugs.webkit.org/show_bug.cgi?id=212337
883
884         Reviewed by Anders Carlsson.
885         
886         - Removes RGBA32 type alias, updating all remaining users of it.
887         - Renames functions that take/return SimpleColor to use the name
888           SimpleColor rather than RGB (e.g. makeRGBA -> makeSimpleColor)
889         - Moves hex color parsing from Color to SimpleColor, as that is
890           the type it returns. Also took the opportunity to make it return
891           an Optional<SimpleColor> instead of using a bool/out parameter.
892         - Move Color::compositionFill to editing/CompositionHighlight.h
893           It makes no real sense to keep it in Color.h
894         - Replaces rgb() function in Color with asSimpleColor() for 
895           symmetry with asExtended().
896         - Replaced std::max(a, std::min(value, b)) with std::clamp(value, a, b)
897           for clarity.
898
899         * css/parser/CSSParserFastPaths.cpp:
900         (WebCore::fastParseColorInternal):
901         (WebCore::CSSParserFastPaths::parseColor):
902         * css/parser/CSSPropertyParserHelpers.cpp:
903         (WebCore::CSSPropertyParserHelpers::parseRGBParameters):
904         (WebCore::CSSPropertyParserHelpers::parseHSLParameters):
905         (WebCore::CSSPropertyParserHelpers::parseHexColor):
906         * editing/CompositionHighlight.h:
907         * editing/cocoa/DataDetection.mm:
908         (WebCore::DataDetection::detectContentInRange):
909         * html/ColorInputType.cpp:
910         (WebCore::parseSimpleColorValue):
911         * html/HTMLElement.cpp:
912         (WebCore::parseColorStringWithCrazyLegacyRules):
913         * platform/adwaita/ScrollbarThemeAdwaita.cpp:
914         * platform/adwaita/ThemeAdwaita.cpp:
915         (WebCore::ThemeAdwaita::activeSelectionForegroundColor const):
916         (WebCore::ThemeAdwaita::activeSelectionBackgroundColor const):
917         (WebCore::ThemeAdwaita::inactiveSelectionForegroundColor const):
918         * platform/graphics/Color.cpp:
919         (WebCore::differenceSquared):
920         (WebCore::Color::Color):
921         (WebCore::Color::operator=):
922         (WebCore::Color::serialized const):
923         (WebCore::Color::cssText const):
924         (WebCore::Color::nameForRenderTreeAsText const):
925         (WebCore::Color::light const):
926         (WebCore::Color::dark const):
927         (WebCore::Color::blend const):
928         (WebCore::Color::blendWithWhite const):
929         (WebCore::Color::colorWithAlpha const):
930         (WebCore::Color::colorWithAlphaUsingAlternativeRounding const):
931         (WebCore::Color::invertedColorWithAlpha const):
932         (WebCore::Color::colorSpaceAndComponents const):
933         (WebCore::Color::toSRGBASimpleColorLossy const):
934         (WebCore::blend):
935         (WebCore::Color::tagAsValid):
936         (WebCore::parseHexColorInternal): Deleted.
937         (WebCore::Color::parseHexColor): Deleted.
938         (WebCore::Color::asExtended const): Deleted.
939         * platform/graphics/Color.h:
940         (WebCore::Color::Color):
941         (WebCore::Color::isHashTableDeletedValue const):
942         (WebCore::Color::isValid const):
943         (WebCore::Color::isOpaque const):
944         (WebCore::Color::isVisible const):
945         (WebCore::Color::alpha const):
946         (WebCore::Color::alphaAsFloat const):
947         (WebCore::Color::isSemantic const):
948         (WebCore::Color::isExtended const):
949         (WebCore::Color::setIsSemantic):
950         (WebCore::operator==):
951         (WebCore::equalIgnoringSemanticColor):
952         (WebCore::Color::hash const):
953         (WebCore::Color::asExtended const):
954         (WebCore::Color::asSimpleColor const):
955         (WebCore::Color::setSimpleColor):
956         (WebCore::Color::isBlackColor):
957         (WebCore::Color::isWhiteColor):
958         (WebCore::Color::encode const):
959         (WebCore::Color::decode):
960         (WebCore::Color::setRGB): Deleted.
961         (WebCore::Color::rgb const): Deleted.
962         * platform/graphics/ColorUtilities.h:
963         (WebCore::clampedColorComponent):
964         * platform/graphics/ImageBackingStore.h:
965         (WebCore::ImageBackingStore::blendPixel):
966         (WebCore::ImageBackingStore::pixelValue const):
967         * platform/graphics/SimpleColor.cpp:
968         (WebCore::makePremultipliedSimpleColor):
969         (WebCore::makeUnpremultipliedSimpleColor):
970         (WebCore::makeSimpleColorFromFloats):
971         (WebCore::makeSimpleColorFromHSLA):
972         (WebCore::makeSimpleColorFromCMYKA):
973         (WebCore::parseHexColorInternal):
974         (WebCore::SimpleColor::parseHexColor):
975         (WebCore::makePremultipliedRGBA): Deleted.
976         (WebCore::makeUnPremultipliedRGBA): Deleted.
977         (WebCore::makeRGBA32FromFloats): Deleted.
978         (WebCore::makeRGBAFromHSLA): Deleted.
979         (WebCore::makeRGBAFromCMYKA): Deleted.
980         * platform/graphics/SimpleColor.h:
981         (WebCore::roundAndClampColorChannel):
982         (WebCore::colorFloatToSimpleColorByte):
983         (WebCore::makeSimpleColor):
984         (WebCore::colorFloatToRGBAByte): Deleted.
985         (WebCore::makeRGB): Deleted.
986         (WebCore::makeRGBA): Deleted.
987         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
988         (WebCore::makeSimpleColorFromARGBCFArray):
989         (WebCore::InbandTextTrackPrivateAVF::processCueAttributes):
990         (WebCore::makeRGBA32FromARGBCFArray): Deleted.
991         * platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp:
992         (WebCore::ImageBufferCairoImageSurfaceBackend::platformTransformColorSpace):
993         * platform/graphics/cairo/NativeImageCairo.cpp:
994         (WebCore::nativeImageSinglePixelSolidColor):
995         * platform/graphics/cg/ColorCG.cpp:
996         (WebCore::makeSimpleColorFromCGColor):
997         (WebCore::Color::Color):
998         (WebCore::cachedCGColor):
999         (WebCore::makeRGBAFromCGColor): Deleted.
1000         * platform/graphics/gtk/ColorGtk.cpp:
1001         (WebCore::Color::Color):
1002         * platform/graphics/mac/ColorMac.mm:
1003         (WebCore::makeSimpleColorFromNSColor):
1004         (WebCore::colorFromNSColor):
1005         (WebCore::semanticColorFromNSColor):
1006         (WebCore::makeRGBAFromNSColor): Deleted.
1007         * platform/graphics/win/ColorDirect2D.cpp:
1008         (WebCore::Color::Color):
1009         * platform/graphics/win/GraphicsContextCGWin.cpp:
1010         (WebCore::GraphicsContext::drawDotsForDocumentMarker):
1011         * platform/graphics/win/PlatformContextDirect2D.cpp:
1012         (WebCore::PlatformContextDirect2D::brushWithColor):
1013         * platform/ios/ColorIOS.mm:
1014         (WebCore::colorFromUIColor):
1015         * rendering/InlineTextBox.cpp:
1016         (WebCore::InlineTextBox::paintCompositionBackground):
1017         * rendering/RenderLayer.cpp:
1018         (WebCore::RenderLayer::paintResizer):
1019         * rendering/RenderLayerBacking.cpp:
1020         (WebCore::patternForTouchAction):
1021         (WebCore::patternForEventListenerRegionType):
1022         * rendering/RenderThemeAdwaita.cpp:
1023         * rendering/RenderThemeMac.mm:
1024         (WebCore::menuBackgroundColor):
1025
1026 2020-05-25  Zalan Bujtas  <zalan@apple.com>
1027
1028         [Subpixel layout] Bad scrolling on mercurynews.com article
1029         https://bugs.webkit.org/show_bug.cgi?id=201038
1030         <rdar://problem/28489812>
1031
1032         Reviewed by Dean Jackson.
1033
1034         The scrolling is caused by the mismatching subpixel handling between block and inline content.
1035         Inline content (and in this particular case ascent/descent handling) is still integral based while block content supports fractional pixel values.
1036         When the (inline)line height relies on the (block)inline-block height, we need to make sure that the computed line height encloses the inline-block.
1037         This patch changes the rounding behavior of computed the line height from floor to round.
1038
1039         Test: fast/inline/hidpi-inline-block-is-subpixel-while-line-is-not.html
1040
1041         * rendering/RenderBox.cpp:
1042         (WebCore::RenderBox::baselinePosition const):
1043         * rendering/RootInlineBox.cpp:
1044         (WebCore::RootInlineBox::ascentAndDescentForBox const):
1045
1046 2020-05-25  Rob Buis  <rbuis@igalia.com>
1047
1048         Use child text content when determining whether to bail early in running a script
1049         https://bugs.webkit.org/show_bug.cgi?id=182695
1050
1051         Reviewed by Youenn Fablet.
1052
1053         Check that the text content is not empty instead of just checking
1054         for the first child [1].
1055
1056         Behavior matches Chrome and Firefox.
1057
1058         [1] https://html.spec.whatwg.org/#prepare-a-script step 5 and 6
1059
1060         Test: web-platform-tests/html/semantics/scripting-1/the-script-element/emptyish-script-elements.html
1061
1062         * dom/ScriptElement.cpp:
1063         (WebCore::ScriptElement::prepareScript):
1064
1065 2020-05-22  Sergio Villar Senin  <svillar@igalia.com>
1066
1067         [css-flex] Allow indefinite size flex items to be definite wrt resolving percentages inside them
1068         https://bugs.webkit.org/show_bug.cgi?id=212264
1069
1070         Reviewed by Manuel Rego Casasnovas.
1071
1072         Implement https://github.com/w3c/csswg-drafts/commit/5b5db39d21f3658ae2f4d7992daaf822aca178d8 which modified
1073         the way percentages were resolved in flexible items with indefinite sizes. From now on we can pretend that
1074         they're really definite.
1075
1076         This allows us to mark 3 tests which were testing percentages in flex items as correct.
1077
1078         Based on Blink's crrev.com/1247184 by <cbiesinger@chromium.org>
1079
1080         * rendering/RenderFlexibleBox.cpp:
1081         (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution): Do only check flex container main size
1082         definiteness when computing the main size for percentage resolution, no need to check flex basis at all.
1083
1084 2020-05-25  Youenn Fablet  <youenn@apple.com>
1085
1086         AVVideoCaptureSource should notify of video samples in a background thread
1087         https://bugs.webkit.org/show_bug.cgi?id=212072
1088
1089         Reviewed by Eric Carlson.
1090
1091         Do not hop to the main thread to send samples.
1092         Instead, directly call the observer callback.
1093         Manually tested.
1094
1095         * platform/mediastream/mac/AVVideoCaptureSource.h:
1096         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1097         (WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
1098
1099 2020-05-25  Adrian Perez de Castro  <aperez@igalia.com>
1100
1101         Non-unified build fixes, late May 2020 edition
1102         https://bugs.webkit.org/show_bug.cgi?id=212342
1103
1104         Unreviewed build fix.
1105
1106         No new tests needed.
1107
1108         * loader/ImageLoader.h: Add missing inclusion of Element.h and remove forward declaration.
1109         * page/PageConfiguration.h: Add missing inclusion of ShouldRelaxThirdPartyCookieBlocking.h
1110
1111 2020-05-25  Youenn Fablet  <youenn@apple.com>
1112
1113         MediaPlayerPrivateMediaStreamAVFObjC::m_activeVideoTrack should be a VideoTrackPrivateMediaStream
1114         https://bugs.webkit.org/show_bug.cgi?id=212129
1115
1116         Reviewed by Eric Carlson.
1117
1118         Instead of looking in the map when wanting to get the VideoTrackPrivateMediaStream corresponding to the active video track,
1119         store directly the VideoTrackPrivateMediaStream as the active video track and use streamTrack() to get the corresponding MediaStreamTrack.
1120         Small refactoring to use more Ref<>.
1121         Covered by existing tests.
1122
1123         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1124         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1125         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC):
1126         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable):
1127         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferDisplayLayerStatusDidChange):
1128         (WebCore::updateTracksOfType):
1129         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack):
1130         * platform/mediastream/AudioTrackPrivateMediaStream.h:
1131         * platform/mediastream/VideoTrackPrivateMediaStream.h:
1132
1133 2020-05-24  Youenn Fablet  <youenn@apple.com>
1134
1135         Do not allocate a WebAudioBufferList in the AudioContext rendering thread
1136         https://bugs.webkit.org/show_bug.cgi?id=212132
1137
1138         Reviewed by Eric Carlson.
1139
1140         Instead of allocating the buffer in the rendering thread, we do that in the audio sample producer thread.
1141         Also, we do it only once versus one for each rendering call previously.
1142         Covered by existing tests.
1143
1144         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
1145         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
1146         (WebCore::WebAudioSourceProviderAVFObjC::provideInput):
1147         (WebCore::WebAudioSourceProviderAVFObjC::prepare):
1148         (WebCore::WebAudioSourceProviderAVFObjC::unprepare):
1149
1150 2020-05-24  Wenson Hsieh  <wenson_hsieh@apple.com>
1151
1152         Add some missing includes due to unified sources
1153         https://bugs.webkit.org/show_bug.cgi?id=212306
1154
1155         Reviewed by Anders Carlsson.
1156
1157         * Modules/pictureinpicture/HTMLVideoElementPictureInPicture.cpp: Include EnterPictureInPictureEvent.h.
1158
1159         * platform/PictureInPictureObserver.h: Include WeakPtr and forward declare the IntSize class.
1160
1161 2020-05-24  Sam Weinig  <weinig@apple.com>
1162
1163         Extended Color Cleanup: Move SimpleColor into its own files
1164         https://bugs.webkit.org/show_bug.cgi?id=212309
1165
1166         Reviewed by Simon Fraser.
1167
1168         Move SimpleColor into its own files. It's about time.
1169
1170         * Headers.cmake:
1171         * Sources.txt:
1172         * WebCore.xcodeproj/project.pbxproj:
1173         * platform/graphics/Color.cpp:
1174         (WebCore::premultipliedChannel): Deleted.
1175         (WebCore::unpremultipliedChannel): Deleted.
1176         (WebCore::makePremultipliedRGBA): Deleted.
1177         (WebCore::makeUnPremultipliedRGBA): Deleted.
1178         (WebCore::colorFloatToRGBAByte): Deleted.
1179         (WebCore::makeRGBA32FromFloats): Deleted.
1180         (WebCore::makeRGBAFromHSLA): Deleted.
1181         (WebCore::makeRGBAFromCMYKA): Deleted.
1182         (WebCore::SimpleColor::serializationForHTML const): Deleted.
1183         (WebCore::decimalDigit): Deleted.
1184         (WebCore::fractionDigitsForFractionalAlphaValue): Deleted.
1185         (WebCore::SimpleColor::serializationForCSS const): Deleted.
1186         (WebCore::RGBA32::serializationForRenderTreeAsText const): Deleted.
1187         * platform/graphics/Color.h:
1188         (WebCore::SimpleColor::SimpleColor): Deleted.
1189         (WebCore::SimpleColor::value const): Deleted.
1190         (WebCore::SimpleColor::redComponent const): Deleted.
1191         (WebCore::SimpleColor::greenComponent const): Deleted.
1192         (WebCore::SimpleColor::blueComponent const): Deleted.
1193         (WebCore::SimpleColor::alphaComponent const): Deleted.
1194         (WebCore::SimpleColor::alphaComponentAsFloat const): Deleted.
1195         (WebCore::SimpleColor::isOpaque const): Deleted.
1196         (WebCore::SimpleColor::isVisible const): Deleted.
1197         (WebCore::SimpleColor::colorWithAlpha const): Deleted.
1198         (WebCore::SimpleColor::get const): Deleted.
1199         (WebCore::roundAndClampColorChannel): Deleted.
1200         (WebCore::fastMultiplyBy255): Deleted.
1201         (WebCore::fastDivideBy255): Deleted.
1202         (WebCore::makeRGB): Deleted.
1203         (WebCore::makeRGBA): Deleted.
1204         * platform/graphics/SimpleColor.cpp: Copied from platform/graphics/Color.cpp.
1205         (WebCore::SimpleColor::serializationForRenderTreeAsText const):
1206         (): Deleted.
1207         (WebCore::colorFloatToRGBAByte): Deleted.
1208         (WebCore::parseHexColorInternal): Deleted.
1209         (WebCore::Color::parseHexColor): Deleted.
1210         (WebCore::differenceSquared): Deleted.
1211         (WebCore::findNamedColor): Deleted.
1212         (WebCore::Color::Color): Deleted.
1213         (WebCore::Color::operator=): Deleted.
1214         (WebCore::Color::serialized const): Deleted.
1215         (WebCore::Color::cssText const): Deleted.
1216         (WebCore::RGBA32::serializationForRenderTreeAsText const): Deleted.
1217         (WebCore::Color::nameForRenderTreeAsText const): Deleted.
1218         (WebCore::Color::light const): Deleted.
1219         (WebCore::Color::dark const): Deleted.
1220         (WebCore::Color::isDark const): Deleted.
1221         (WebCore::Color::lightness const): Deleted.
1222         (WebCore::blendComponent): Deleted.
1223         (WebCore::Color::blend const): Deleted.
1224         (WebCore::Color::blendWithWhite const): Deleted.
1225         (WebCore::Color::colorWithAlphaMultipliedBy const): Deleted.
1226         (WebCore::Color::colorWithAlphaMultipliedByUsingAlternativeRounding const): Deleted.
1227         (WebCore::Color::colorWithAlpha const): Deleted.
1228         (WebCore::Color::colorWithAlphaUsingAlternativeRounding const): Deleted.
1229         (WebCore::Color::colorSpaceAndComponents const): Deleted.
1230         (WebCore::Color::toSRGBASimpleColorLossy const): Deleted.
1231         (WebCore::Color::toSRGBAComponentsLossy const): Deleted.
1232         (WebCore::extendedColorsEqual): Deleted.
1233         (WebCore::blend): Deleted.
1234         (WebCore::blendWithoutPremultiply): Deleted.
1235         (WebCore::Color::tagAsValid): Deleted.
1236         (WebCore::Color::asExtended const): Deleted.
1237         (WebCore::operator<<): Deleted.
1238         * platform/graphics/SimpleColor.h: Copied from platform/graphics/Color.h.
1239         (WebCore::SimpleColor::alphaComponentAsFloat const):
1240         (WebCore::SimpleColor::colorWithAlpha const):
1241         (WebCore::SimpleColor::get const):
1242         (WebCore::colorFloatToRGBAByte):
1243         (WebCore::Color::Color): Deleted.
1244         (WebCore::Color::isHashTableDeletedValue const): Deleted.
1245         (WebCore::Color::~Color): Deleted.
1246         (WebCore::Color::isValid const): Deleted.
1247         (WebCore::Color::isOpaque const): Deleted.
1248         (WebCore::Color::isVisible const): Deleted.
1249         (WebCore::Color::red const): Deleted.
1250         (WebCore::Color::green const): Deleted.
1251         (WebCore::Color::blue const): Deleted.
1252         (WebCore::Color::alpha const): Deleted.
1253         (WebCore::Color::alphaAsFloat const): Deleted.
1254         (WebCore::Color::opaqueColor const): Deleted.
1255         (WebCore::Color::isSemantic const): Deleted.
1256         (WebCore::Color::isExtended const): Deleted.
1257         (WebCore::Color::setRGB): Deleted.
1258         (WebCore::Color::setIsSemantic): Deleted.
1259         (WebCore::equalIgnoringSemanticColor): Deleted.
1260         (WebCore::Color::hash const): Deleted.
1261         (WebCore::Color::colorWithAlphaMultipliedByUsingAlternativeRounding const): Deleted.
1262         (WebCore::Color::colorWithAlphaUsingAlternativeRounding const): Deleted.
1263         (WebCore::Color::rgb const): Deleted.
1264         (WebCore::Color::isBlackColor): Deleted.
1265         (WebCore::Color::isWhiteColor): Deleted.
1266         (WebCore::Color::encode const): Deleted.
1267         (WebCore::Color::decode): Deleted.
1268
1269 2020-05-24  Zalan Bujtas  <zalan@apple.com>
1270
1271         [LFC][TFC] Ignore section borders even when border collapse is off.
1272         https://bugs.webkit.org/show_bug.cgi?id=212336
1273
1274         Reviewed by Antti Koivisto.
1275
1276         Test: fast/layoutformattingcontext/table-simple-thead-border-ignore.html
1277
1278         * layout/Verification.cpp:
1279         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
1280         * layout/tableformatting/TableFormattingContext.cpp:
1281         (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
1282
1283 2020-05-24  Sam Weinig  <weinig@apple.com>
1284
1285         Extended Color Cleanup: Stop allowing direct access to the underlying SimpleColor (it is almost always incorrect with respect to extended colors)
1286         https://bugs.webkit.org/show_bug.cgi?id=212184
1287
1288         Reviewed by Dean Jackson.
1289
1290         - Makes Color::rgb() private, removing a class of extended color bugs from users 
1291           of the Color class. To get the equivilent functionality, users of the class must
1292           now use toSRGBASimpleColorLossy() which does actually does the conversion to sRGB
1293           if necessary and makes it clear to the caller that precision is being lost. 
1294         - Removes Color::red()/green()/blue() entirely. They were just calling down to 
1295           Color::rgb(), and going forward, it won't make sense to think about rgb components
1296           of Colors in general, since some extended color spaces don't deal in them (e.g. Lab)
1297           Color::alpha() was kept (and fixed to work even with ExtendedColor) since all
1298           ExtendedColors do need to have alpha.
1299
1300         * accessibility/AccessibilityNodeObject.cpp:
1301         (WebCore::AccessibilityNodeObject::colorValue const):
1302         Use toSRGBASimpleColorLossy() to get access to color components.
1303
1304         * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
1305         (getAttributeSetForAccessibilityObject):
1306         Use toSRGBASimpleColorLossy() to get access to color components.
1307
1308         * accessibility/isolatedtree/AXIsolatedObject.cpp:
1309         (WebCore::AXIsolatedObject::colorValue const):
1310         Use toSRGBASimpleColorLossy() to get access to color components.
1311
1312         * css/DeprecatedCSSOMRGBColor.h:
1313         Use toSRGBASimpleColorLossy() to get access to color components.
1314
1315         * page/CaptionUserPreferencesMediaAF.cpp:
1316         (WebCore::CaptionUserPreferencesMediaAF::captionsWindowCSS const):
1317         (WebCore::CaptionUserPreferencesMediaAF::captionsBackgroundCSS const):
1318         (WebCore::CaptionUserPreferencesMediaAF::captionsTextColor const):
1319         User Color::colorWithAlpha() to avoid the need to muck with components directly.
1320
1321         * platform/graphics/Color.cpp:
1322         (WebCore::differenceSquared):
1323         Use rgb() directly, which is ok, since this is explicitly checking isExtended().
1324         This code is still wrong (there is a FIXME) as it assumes the two colors are in
1325         the same color space.
1326
1327         (WebCore::Color::Color):
1328         Add constructor which takes an ExtendedColor to allow functions like 
1329         Color::invertedColorWithAlpha to delegate their functionality to ExtendedColor.
1330         
1331         (WebCore::Color::light const):
1332         Use new SimpleColor::colorWithAlpha() to avoid hardcoding constants here.
1333
1334         (WebCore::Color::blend const):
1335         (WebCore::Color::blendWithWhite const):
1336         Use toSRGBASimpleColorLossy() to get access to color components. These
1337         are still not ideal implementations, as they don't preserve extended colors
1338         as well as they could, but now they don't return bogus values for extended
1339         colors. Minor cleanup bringing constants and lambda inside the function they
1340         are used in.
1341         
1342         (WebCore::Color::colorWithAlpha const):
1343         (WebCore::Color::colorWithAlphaUsingAlternativeRounding const):
1344         Minor cleanups to use a more consistent style and make use of the new
1345         SimpleColor::colorWithAlpha.
1346         
1347         (WebCore::Color::invertedColorWithAlpha const):
1348         Added. Used to avoid direct component usage in line box code.
1349
1350         (WebCore::Color::semanticColor const):
1351         Added. Hopefully temporary. Used by RenderThemeIOS.mm to convert
1352         a Color from a map into a Color with the semantic bit set. This 
1353         should not be necessary as every color in the map should already
1354         have it set, but to avoid uncessary possible behavior changes this
1355         preserves that functionality until it can be researched further.
1356         Fixing coders to preserve the semantic bit may be required to 
1357         elliminate the need.
1358         
1359         (WebCore::Color::colorSpaceAndComponents const):
1360         Use rgb() rather than the individual components which have been removed.
1361         
1362         * platform/graphics/Color.h:
1363         (WebCore::SimpleColor::alphaComponentAsFloat const):
1364         Added. Needed by DeprecatedCSSOMRGBColor and useful to Color.
1365
1366         (WebCore::SimpleColor::colorWithAlpha const):
1367         Useful to simplify Color::colorWithAlpha implementations and
1368         in Color::dark().
1369
1370         (WebCore::SimpleColor::get const):
1371         Added tuple interface to SimpleColor to support structure bindings.
1372         NOTE: Unlike the storage of SimpleColor (ARGB), this produces the
1373         bindings in the more familiar [r,g,b,a] to match FloatComponents.
1374         
1375         (WebCore::Color::alpha const):
1376         Made work with ExtendedColor as well.
1377         
1378         (WebCore::Color::red const): Deleted.
1379         (WebCore::Color::green const): Deleted.
1380         (WebCore::Color::blue const): Deleted.
1381         Removed.
1382
1383         (CGColorRef cachedCGColor): 
1384         (int differenceSquared): 
1385         Made friends so they could use Color::rgb().
1386
1387         (WebCore::Color::rgb const): 
1388         Made private.
1389
1390         * platform/graphics/ExtendedColor.cpp:
1391         (WebCore::ExtendedColor::invertedColorWithAlpha const):
1392         * platform/graphics/ExtendedColor.h:
1393         Added invertedColorWithAlpha to allow inversion to be encapsulated.
1394         When future color spaces are added, we may need to choose per-colorspace
1395         algorithms for this instead of the trivial one used today.
1396
1397         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
1398         (WebCore::PlatformCAAnimationCocoa::setFromValue):
1399         (WebCore::PlatformCAAnimationCocoa::setToValue):
1400         (WebCore::PlatformCAAnimationCocoa::setValues):
1401         Use toSRGBASimpleColorLossy() to get access to color components.
1402
1403         * platform/graphics/ca/win/PlatformCAAnimationWin.cpp:
1404         (PlatformCAAnimationWin::setFromValue):
1405         (PlatformCAAnimationWin::setToValue):
1406         (PlatformCAAnimationWin::setValues):
1407         Use toSRGBASimpleColorLossy() to get access to color components.
1408
1409         * platform/graphics/cairo/CairoOperations.cpp:
1410         (WebCore::Cairo::drawFocusRing):
1411         Use Color::colorWithAlpha() to avoid needing access to components.
1412
1413         * platform/graphics/cpu/arm/filters/FELightingNEON.h:
1414         (WebCore::FELighting::platformApplyNeon):
1415         Use toSRGBASimpleColorLossy() to get access to color components.
1416
1417         * platform/graphics/texmap/TextureMapperGL.cpp:
1418         (WebCore::TextureMapperGL::clearColor):
1419         Use toSRGBASimpleColorLossy() to get access to color components.
1420
1421         * platform/graphics/win/Direct2DOperations.cpp:
1422         (WebCore::Direct2D::drawGlyphs):
1423         Use colorWithAlphaMultipliedBy() to avoid needing access to components.
1424
1425         * platform/graphics/win/FontCGWin.cpp:
1426         (WebCore::FontCascade::drawGlyphs):
1427         Use colorWithAlphaMultipliedBy() to avoid needing access to components.
1428
1429         * platform/graphics/win/FontCascadeDirect2D.cpp:
1430         (WebCore::FontCascade::drawGlyphs):
1431         Use colorWithAlphaMultipliedBy() to avoid needing access to components.
1432
1433         * rendering/EllipsisBox.cpp:
1434         (WebCore::EllipsisBox::paintSelection):
1435         Use invertedColorWithAlpha() to avoid needing access to components.
1436
1437         * rendering/InlineTextBox.cpp:
1438         (WebCore::InlineTextBox::resolveStyleForMarkedText):
1439         Use invertedColorWithAlpha() to avoid needing access to components.
1440
1441         * rendering/RenderBoxModelObject.cpp:
1442         (WebCore::RenderBoxModelObject::paintBoxShadow):
1443         Use opaqueColor() to avoid needing access to components.
1444
1445         * rendering/RenderThemeIOS.mm:
1446         (WebCore::RenderThemeIOS::systemColor const):
1447         Use opaqueColor() to avoid needing access to components.
1448
1449         * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
1450         (WebCore::SVGAnimationColorFunction::animate):
1451         Use toSRGBASimpleColorLossy() to get access to color components.
1452
1453 2020-05-24  Zalan Bujtas  <zalan@apple.com>
1454
1455         [LFC][TFC] Take sections into account when computing collapsed border.
1456         https://bugs.webkit.org/show_bug.cgi?id=212311
1457
1458         Reviewed by Antti Koivisto.
1459
1460         Test: fast/layoutformattingcontext/table-simple-collapsed-tbody-border.html
1461
1462         * layout/Verification.cpp:
1463         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree):
1464         * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
1465         (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox):
1466         * layout/tableformatting/TableFormattingContext.cpp:
1467         (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
1468         * layout/tableformatting/TableGrid.cpp:
1469         (WebCore::Layout::TableGrid::Section::Section):
1470         (WebCore::Layout::TableGrid::appendCell):
1471         * layout/tableformatting/TableGrid.h:
1472         (WebCore::Layout::TableGrid::Section::box const):
1473         (WebCore::Layout::TableGrid::sections const):
1474         (WebCore::Layout::TableGrid::sections):
1475
1476 2020-05-24  Zalan Bujtas  <zalan@apple.com>
1477
1478         [LFC][TFC] Take collapsed in-between row border into account when computing cell height
1479         https://bugs.webkit.org/show_bug.cgi?id=212307
1480
1481         Reviewed by Antti Koivisto.
1482
1483         Test: fast/layoutformattingcontext/table-simple-collapsed-row-border2.html
1484
1485         * layout/tableformatting/TableFormattingContextGeometry.cpp:
1486         (WebCore::Layout::TableFormattingContext::Geometry::computedCellBorder const):
1487
1488 2020-05-23  Zalan Bujtas  <zalan@apple.com>
1489
1490         [LFC][TFC] Take row border into account when computing collapsed borders.
1491         https://bugs.webkit.org/show_bug.cgi?id=212305
1492
1493         Reviewed by Antti Koivisto.
1494
1495         Test: fast/layoutformattingcontext/table-simple-collapsed-row-border.html
1496
1497         * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
1498         (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox):
1499
1500 2020-05-23  Jack Lee  <shihchieh_lee@apple.com>
1501
1502         ASSERTION FAILED: (!s_current || &m_view != &s_current->m_view) in RenderTreeBuilder::RenderTreeBuilder
1503         https://bugs.webkit.org/show_bug.cgi?id=212163
1504
1505         Unreviewed. Improve readability. Replace comments with curly brackets for scoping.
1506
1507         * dom/Document.cpp:
1508         (WebCore::Document::updateRenderTree):
1509
1510 2020-05-23  Zalan Bujtas  <zalan@apple.com>
1511
1512         [LFC][TFC] Maximum constraint of a cell should never be smaller than the minimum width
1513         https://bugs.webkit.org/show_bug.cgi?id=212304
1514
1515         Reviewed by Antti Koivisto.
1516
1517         Test: fast/layoutformattingcontext/table-simple-fixed-width-with-wide-content.html
1518
1519         * layout/tableformatting/TableFormattingContextGeometry.cpp:
1520         (WebCore::Layout::TableFormattingContext::Geometry::intrinsicWidthConstraintsForCell):
1521
1522 2020-05-23  Zalan Bujtas  <zalan@apple.com>
1523
1524         [LFC][TFC] Used height of a cell is the maximum of the computed and the content height.
1525         https://bugs.webkit.org/show_bug.cgi?id=212302
1526
1527         Reviewed by Antti Koivisto.
1528
1529         Test: fast/layoutformattingcontext/table-simple-tall-cell-content-with-fixed-height.html
1530
1531         * layout/FormattingContextGeometry.cpp:
1532         (WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const):
1533         * layout/tableformatting/TableFormattingContextGeometry.cpp:
1534         (WebCore::Layout::TableFormattingContext::Geometry::cellHeigh const):
1535
1536 2020-05-23  Zalan Bujtas  <zalan@apple.com>
1537
1538         [LFC][TFC] Non-collapsing row border should not make the table wider/taller
1539         https://bugs.webkit.org/show_bug.cgi?id=212263
1540
1541         Reviewed by Antti Koivisto.
1542
1543         Non-collapsing row border eats into the content box but oddly it does not
1544         constraint the cell boxes, so we can end up with smaller row content box than
1545         the cell box it contains.
1546
1547         Test: fast/layoutformattingcontext/table-simple-row-border.html
1548
1549         * layout/LayoutUnits.h:
1550         (WebCore::Layout::Edges::width const):
1551         (WebCore::Layout::Edges::height const):
1552         (WebCore::Layout::HorizontalEdges::width const): Deleted.
1553         (WebCore::Layout::VerticalEdges::height const): Deleted.
1554         * layout/tableformatting/TableFormattingContext.cpp:
1555         (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows):
1556         * layout/tableformatting/TableFormattingContextGeometry.cpp:
1557         (WebCore::Layout::TableFormattingContext::Geometry::intrinsicWidthConstraintsForCell):
1558
1559 2020-05-22  Jack Lee  <shihchieh_lee@apple.com>
1560
1561         ASSERTION FAILED: (!s_current || &m_view != &s_current->m_view) in RenderTreeBuilder::RenderTreeBuilder
1562         https://bugs.webkit.org/show_bug.cgi?id=212163
1563         <rdar://problem/57028096>
1564
1565         Reviewed by Geoffrey Garen.
1566
1567         Calling ~PostResolutionCallbackDisabler() before completing render tree updating and releasing RenderTreeBuilder 
1568         triggers this assertion. Therefore we added a utility function "updateRenderTree" in which PostResolutionCallback
1569         is delayed until RenderTreeUpdater is released and m_inRenderTreeUpdate is cleared.
1570
1571         Test: fast/rendering/nested-render-tree-update-crash.html
1572
1573         * Headers.cmake:
1574         * WebCore.xcodeproj/project.pbxproj:
1575         * dom/Document.cpp:
1576         (WebCore::Document::updateRenderTree):
1577         (WebCore::Document::resolveStyle):
1578         (WebCore::Document::updateTextRenderer):
1579         * dom/Document.h:
1580         * rendering/updating/RenderTreeUpdater.cpp:
1581         (WebCore::RenderTreeUpdater::RenderTreeUpdater):
1582         (WebCore::RenderTreeUpdater::commit):
1583         * rendering/updating/RenderTreeUpdater.h:
1584
1585 2020-05-22  Simon Fraser  <simon.fraser@apple.com>
1586
1587         Stuttery overflow scrolling in slow-scrolling regions (facebook messenger, feedly.com)
1588         https://bugs.webkit.org/show_bug.cgi?id=212291
1589         <rdar://problem/61940624>
1590
1591         Reviewed by Tim Horton.
1592
1593         Now that we do scrolling tree commits on the main thread, ThreadedScrollingTree::scrollingTreeNodeDidScroll()
1594         can be called on the main thread. In this case, don't do an RunLoop::main().dispatch() which introduces
1595         asynchrony; just call into the ScrollingCoordinator synchronously.
1596
1597         Do some minor refactoring to move noteScrollingThreadSyncCompleteForNode() into updateScrollPositionAfterAsyncScroll().
1598
1599         Hard to test because it involves scrolling thread/main thread interactions.
1600
1601         * page/scrolling/AsyncScrollingCoordinator.cpp:
1602         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
1603         (WebCore::AsyncScrollingCoordinator::synchronizeStateFromScrollingTree):
1604         (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll):
1605         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired):
1606         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
1607         * page/scrolling/AsyncScrollingCoordinator.h:
1608         * page/scrolling/ThreadedScrollingTree.cpp:
1609         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
1610
1611 2020-05-22  Zalan Bujtas  <zalan@apple.com>
1612
1613         Nullptr deref in WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation when parent and beforeChild are siblings
1614         https://bugs.webkit.org/show_bug.cgi?id=212116
1615         <rdar://problem/62993844>
1616
1617         Reviewed by Simon Fraser.
1618
1619         This patch fixes the case when a nested fragmented context has a spanner and we try to form a continuation while this nested fragmented context is being destroyed.
1620
1621         1. The continuation is triggered by a style change that turns a previously out-of-flow block container into an inflow box
1622         (and the parent inline level container can't have the box as a direct child anymore).
1623         2. An unrelated style change nukes the nested fragmented context. We need to "re-assign" the spanner to the parent fragment.
1624
1625         These 2 changes are split into 2 phases; first we take care of the tree mutation triggered by the continuation (updateRendererStyle), while
1626         we do the fragmented context cleanup (updateAfterDescendants) in a separate step.
1627         This 2 phase setup confuses the "where to put this spanner" logic.
1628
1629         This patch addresses the issue by keeping the spanner inside the about-to-be-destroyed fragmented context while forming the continuation (phase #1) and let the second phase (updateAfterDescendants)
1630         deal with the spanner moving.
1631
1632         Test: fast/multicol/nested-multicol-with-spanner-and-continuation.html
1633
1634         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
1635         (WebCore::isValidColumnSpanner):
1636
1637 2020-05-22  Chris Dumez  <cdumez@apple.com>
1638
1639         Revoking an object URL immediately after triggering navigation causes navigation to fail
1640         https://bugs.webkit.org/show_bug.cgi?id=212279
1641         <rdar://problem/63553090>
1642
1643         Reviewed by Geoffrey Garen.
1644
1645         When doing a policy check for a Blob URL, we clone the blob and create a new temporary Blob URL
1646         that stays alive for the duration of the policy check. We made sure to update the ResourceRequest
1647         URL with the new Blob URL, however, we were failing to update the DocumentLoader's request.
1648         As a result, if the client responded with Policy USE, the DocumentLoader would still attempt to
1649         navigate to the old Blob URL.
1650
1651         Test: fast/loader/revoke-blob-url-after-navigation.html
1652
1653         * loader/PolicyChecker.cpp:
1654         (WebCore::FrameLoader::PolicyChecker::extendBlobURLLifetimeIfNecessary const):
1655         (WebCore::FrameLoader::PolicyChecker::checkNavigationPolicy):
1656         (WebCore::FrameLoader::PolicyChecker::checkNewWindowPolicy):
1657         * loader/PolicyChecker.h:
1658
1659 2020-05-22  Simon Fraser  <simon.fraser@apple.com>
1660
1661         Make sure we clean up CFTimerRefs when destroying scrolling tree nodes
1662         https://bugs.webkit.org/show_bug.cgi?id=212278
1663         <rdar://problem/63548212>
1664
1665         Reviewed by Tim Horton.
1666
1667         When destroying scrolling tree nodes, make sure we explicitly stop the RunLoop::Timers,
1668         and do this for all nodes when clearing the m_nodeMap, not just for orphaned nodes as
1669         was done in r262042.
1670
1671         * page/scrolling/ScrollingTree.cpp:
1672         (WebCore::ScrollingTree::commitTreeState):
1673         (WebCore::ScrollingTree::updateTreeFromStateNodeRecursive):
1674         (WebCore::ScrollingTree::removeAllNodes):
1675         * page/scrolling/ScrollingTree.h:
1676         * page/scrolling/ScrollingTreeNode.h:
1677         (WebCore::ScrollingTreeNode::willBeDestroyed):
1678         (WebCore::ScrollingTreeNode::wasRemovedFromTree): Deleted.
1679         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1680         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1681         (WebCore::ScrollingTreeFrameScrollingNodeMac::willBeDestroyed):
1682         (WebCore::ScrollingTreeFrameScrollingNodeMac::wasRemovedFromTree): Deleted.
1683         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
1684         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
1685         (WebCore::ScrollingTreeOverflowScrollingNodeMac::willBeDestroyed):
1686         (WebCore::ScrollingTreeOverflowScrollingNodeMac::wasRemovedFromTree): Deleted.
1687
1688 2020-05-22  Andres Gonzalez  <andresg_22@apple.com>
1689
1690         Updates to the isolated tree must happen before posting notifications to clients.
1691         https://bugs.webkit.org/show_bug.cgi?id=212266
1692
1693         Reviewed by Chris Fleizach.
1694
1695         Multiple tests.
1696
1697         In AXObjectCache::notificationPostTimerFired we were updating the
1698         isolated tree after the notifications were posted to the platform
1699         clients. This caused that in some cases when the client requested info
1700         as the result of those notifications, the isolated tree was out-of-date.
1701         In this patch updateIsolatedTree is called before notifying platform clients.
1702
1703         * accessibility/AXObjectCache.cpp:
1704         (WebCore::AXObjectCache::notificationPostTimerFired):
1705         (WebCore::AXObjectCache::postNotification):
1706         (WebCore::AXObjectCache::postTextStateChangeNotification):
1707         (WebCore::AXObjectCache::updateIsolatedTree):
1708
1709 2020-05-22  Sam Weinig  <weinig@apple.com>
1710
1711         Extended Color Cleanup: Make alpha premultiplication code more consistent and clear regarding what works with extended colors
1712         https://bugs.webkit.org/show_bug.cgi?id=212265
1713
1714         Reviewed by Simon Fraser.
1715
1716         - Adds premultiplied(const FloatComponents&) to do premutiplication directly on FloatComponents
1717           rather than doing it on the ints and losing precision.
1718         - Makes non-FloatComponent alpha premultiplication all take place only for SimpleColors as that
1719           is what callers need. The existing premulitplication for ExtendedColors in blend() was incorrect
1720           as it never did a conversion to sRGB.
1721         - Adds new toSRGBASimpleColorLossy() (to complement toSRGBAComponentsLossy()). Will make it easy
1722           to find all the conversions in the future.
1723         - Broke non-premultiplying blend() out of blend() (removing parameter) and made a new blendWithoutPremultiply()
1724           function for it (no callers needed to make this decision dynamically).
1725
1726         * css/CSSGradientValue.cpp:
1727         (WebCore::CSSGradientValue::computeStops):
1728         Use blendWithoutPremultiply() explicitly.
1729
1730         * platform/graphics/Color.h:
1731         * platform/graphics/Color.cpp:
1732         (WebCore::makePremultipliedRGBA): Renamed from premultipliedARGBFromColor and now only operates on SimpleColors.
1733         (WebCore::makeUnPremultipliedRGBA): Renamed from colorFromPremultipliedARGB and now only operates on SimpleColors.
1734         (WebCore::colorFromPremultipliedARGB): Deleted.
1735         (WebCore::premultipliedARGBFromColor): Deleted.
1736
1737         (WebCore::Color::toSRGBASimpleColorLossy const):
1738         Added. Useful for finding all non-colorspace preserving users of the color channels. 
1739
1740         (WebCore::blend):
1741         (WebCore::blendWithoutPremultiply):
1742         Split these out from each other. Made blend() use toSRGBASimpleColorLossy() and do all
1743         operations on SimpleColors directly. The old code that preported to work with extended
1744         colors was nonsense as it didn't actually take the colorspaces into account, just grabbed
1745         the channels regardless of space.  
1746         
1747         * platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp:
1748         (WebCore::ImageBufferCairoImageSurfaceBackend::platformTransformColorSpace):
1749         Adopt update premulitiplication names and stay in SimpleColor for entire conversion.
1750
1751         * platform/graphics/cairo/NativeImageCairo.cpp:
1752         (WebCore::nativeImageSinglePixelSolidColor):
1753         Adopt update premulitiplication names.
1754
1755         * platform/graphics/ColorUtilities.cpp:
1756         (WebCore::premultiplied):
1757         * platform/graphics/ColorUtilities.h:
1758         * platform/graphics/texmap/TextureMapperGL.cpp:
1759         (WebCore::TextureMapperGL::drawBorder):
1760         (WebCore::prepareFilterProgram):
1761         (WebCore::TextureMapperGL::drawSolidColor):
1762         Add and adopt premultiplied(const FloatComponents&).
1763
1764 2020-05-22  Andy Estes  <aestes@apple.com>
1765
1766         [Apple Pay] Add new ApplePayInstallmentConfiguration members
1767         https://bugs.webkit.org/show_bug.cgi?id=212160
1768         <rdar://problem/60703650>
1769
1770         Reviewed by Alex Christensen.
1771
1772         Test: http/tests/ssl/applepay/ApplePayInstallmentItems.https.html
1773
1774         * DerivedSources-input.xcfilelist:
1775         * DerivedSources-output.xcfilelist:
1776         * DerivedSources.make:
1777         * SourcesCocoa.txt:
1778         * WebCore.xcodeproj/project.pbxproj: Added IDLs, headers, and derived sources for
1779         ApplePayInstallment{Item,ItemType,RetailChannel}.
1780
1781         * Modules/applepay/ApplePayInstallmentConfiguration.idl:
1782         * Modules/applepay/ApplePayInstallmentConfigurationWebCore.h: Added items,
1783         applicationMetadata, and retailChannel members. Added missing conditionals to
1784         merchantIdentifier and referrerIdentifier.
1785
1786         * Modules/applepay/ApplePayInstallmentItem.h:
1787         * Modules/applepay/ApplePayInstallmentItem.idl:
1788         * Modules/applepay/ApplePayInstallmentItemType.h:
1789         * Modules/applepay/ApplePayInstallmentItemType.idl:
1790         * Modules/applepay/ApplePayInstallmentRetailChannel.h:
1791         * Modules/applepay/ApplePayInstallmentRetailChannel.idl: Added.
1792
1793         * Modules/applepay/ApplePayRequestBase.cpp:
1794         (WebCore::convertAndValidate): Changed to call PaymentInstallmentConfiguration::create,
1795         returning an exception if present.
1796
1797         * Modules/applepay/PaymentInstallmentConfiguration.mm:
1798         (WebCore::fromDecimalNumber): Allowed for a large maximum number of fractional digits to
1799         support formatting high-precision currency and APRs (note that this formatter is only used
1800         for test support).
1801
1802         (WebCore::applePayItemType):
1803         (WebCore::platformItemType): Added to convert between PKInstallmentItemType and
1804         ApplePayInstallmentItemType.
1805
1806         (WebCore::applePayRetailChannel):
1807         (WebCore::platformRetailChannel): Added to convert between PKInstallmentRetailChannel and
1808         ApplePayInstallmentRetailChannel.
1809
1810         (WebCore::makeNSArrayElement):
1811         (WebCore::makeVectorElement): Added to convert between NSArray<PKPaymentInstallmentItem *>
1812         and Vector<ApplePayInstallmentItem>.
1813
1814         (WebCore::createPlatformConfiguration): Added a parameter for passing in applicationMetadata
1815         as an NSDictionary. Set properties on PKPaymentInstallmentConfiguration for new
1816         ApplePayInstallmentConfiguration members.
1817         (WebCore::PaymentInstallmentConfiguration::create): Added; converts the applicationMetadata
1818         JSON string (if present) to an NSDictionary, returning a TypeError if the JSON string does
1819         not deserialize to an NSDictionary (as PassKit requires).
1820         (WebCore::PaymentInstallmentConfiguration::PaymentInstallmentConfiguration): Added a
1821         parameter for passing in applicationMetadata as an NSDictionary. Made private.
1822         (WebCore::PaymentInstallmentConfiguration::applePayInstallmentConfiguration const): Set
1823         members on ApplePayInstallmentConfiguration for new PKPaymentInstallmentConfiguration
1824         properties.
1825
1826         * Modules/applepay/PaymentInstallmentConfigurationWebCore.h:
1827
1828 2020-05-22  Alex Christensen  <achristensen@webkit.org>
1829
1830         Add SPI to unblock third party cookies from WKWebViews with ResourceLoadStatistics turned on
1831         https://bugs.webkit.org/show_bug.cgi?id=212058
1832         <rdar://problem/60595539>
1833
1834         Reviewed by John Wilander.
1835
1836         * WebCore.xcodeproj/project.pbxproj:
1837         * loader/CookieJar.cpp:
1838         (WebCore::shouldRelaxThirdPartyCookieBlocking):
1839         (WebCore::CookieJar::cookies const):
1840         (WebCore::CookieJar::setCookies):
1841         (WebCore::CookieJar::cookieRequestHeaderFieldValue const):
1842         (WebCore::CookieJar::getRawCookies const):
1843         * page/Page.cpp:
1844         (WebCore::m_shouldRelaxThirdPartyCookieBlocking):
1845         * page/Page.h:
1846         (WebCore::Page::shouldRelaxThirdPartyCookieBlocking const):
1847         * page/PageConfiguration.h:
1848         * platform/network/CacheValidation.cpp:
1849         (WebCore::cookieRequestHeaderFieldValue):
1850         * platform/network/NetworkStorageSession.cpp:
1851         (WebCore::NetworkStorageSession::shouldBlockCookies const):
1852         (WebCore::NetworkStorageSession::maxAgeCacheCap):
1853         * platform/network/NetworkStorageSession.h:
1854         * platform/network/ShouldRelaxThirdPartyCookieBlocking.h: Added.
1855         * platform/network/cf/NetworkStorageSessionCFNetWin.cpp:
1856         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
1857         (WebCore::NetworkStorageSession::cookiesForDOM const):
1858         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
1859         (WebCore::NetworkStorageSession::getRawCookies const):
1860         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1861         (WebCore::NetworkStorageSession::cookiesForURL const):
1862         (WebCore::NetworkStorageSession::cookiesForSession const):
1863         (WebCore::NetworkStorageSession::cookiesForDOM const):
1864         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
1865         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
1866         (WebCore::NetworkStorageSession::getRawCookies const):
1867         * platform/network/curl/NetworkStorageSessionCurl.cpp:
1868         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
1869         (WebCore::NetworkStorageSession::cookiesForDOM const):
1870         (WebCore::NetworkStorageSession::getRawCookies const):
1871         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
1872         * platform/network/curl/ResourceHandleCurl.cpp:
1873         (WebCore::ResourceHandle::createCurlRequest):
1874         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1875         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
1876         (WebCore::NetworkStorageSession::getRawCookies const):
1877         (WebCore::cookiesForSession):
1878         (WebCore::NetworkStorageSession::cookiesForDOM const):
1879         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
1880
1881 2020-05-22  Oriol Brufau  <obrufau@igalia.com>
1882
1883         Don't put out-of-flow boxes in anonymous flex/grid items
1884         https://bugs.webkit.org/show_bug.cgi?id=205386
1885
1886         Reviewed by Manuel Rego Casasnovas.
1887
1888         A single anonymous flex/grid item should just contain a contiguous
1889         sequence of text runs.
1890
1891         This patch is based on https://crrev.com/533825 from Chromium.
1892
1893         Tests: imported/w3c/web-platform-tests/css/css-flexbox/anonymous-flex-item-004.html
1894                imported/w3c/web-platform-tests/css/css-grid/grid-items/anonymous-grid-item-001.html
1895
1896         * rendering/updating/RenderTreeBuilderBlock.cpp:
1897         (WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation):
1898
1899 2020-05-22  Tim Horton  <timothy_horton@apple.com>
1900
1901         iOS: Pressing tab in the Mail subject field moves focus to the body, but pressing shift tab doesn't move it back
1902         https://bugs.webkit.org/show_bug.cgi?id=212243
1903         <rdar://problem/59127764>
1904
1905         Reviewed by Wenson Hsieh.
1906
1907         New API Tests: WebKit.ShiftTabTakesFocusFromEditableWebView and WebKit.TabDoesNotTakeFocusFromEditableWebView
1908
1909         * page/FocusController.cpp:
1910         (WebCore::FocusController::relinquishFocusToChrome):
1911         (WebCore::FocusController::advanceFocusInDocumentOrder):
1912         * page/FocusController.h:
1913         Factor out the code that decides whether the Chrome might accept focus,
1914         and transfers focus out to the Chrome, for use in EventHandler.
1915
1916         * page/EventHandler.cpp:
1917         (WebCore::EventHandler::defaultTabEventHandler):
1918         In the case where we are shift-tabbing out of an editable web view,
1919         allow focus to pass to the Chrome. Previously, we would not allow this,
1920         because tabKeyCyclesThroughElements is false in editable web views.
1921         However, focus exiting the web view entirely needn't be covered by
1922         "cycles through elements" behavior.
1923         We can't do this for plain "tab", because that needs to be allowed to
1924         insert a tab character instead.
1925
1926 2020-05-22  Tyler Wilcock  <twilco.o@protonmail.com>
1927
1928         Cannot style ::selection for a flex container
1929         https://bugs.webkit.org/show_bug.cgi?id=209822
1930
1931         Reviewed by Antti Koivisto.
1932
1933         When needing to query for pseudostyles, RenderText used to unconditionally check the parent's pseudostyles.  The parent of
1934         RenderText objects is often an anonymous box, depending on the presence of siblings, `display` type, etc.  This is problematic
1935         as pseudostyles are associated with an element of the DOM, meaning RenderText elements would often fail to find any pseudostyle
1936         thanks to their anonymous parent.
1937
1938         This patch changes RenderText to traverse its tree of ancestry upwards until it finds a non-anonymous ancestor and gets those pseudostyles,
1939         rather than unconditionally trying to get pseudostyles from its direct parent.
1940
1941         Blink does something similar when retrieving pseudostyles:
1942
1943         https://github.com/chromium/chromium/blob/793cb59c18334f8b506863192bf630776da0f4d2/third_party/blink/renderer/core/paint/selection_painting_utils.cc#L54
1944
1945         Tests: editing/selection/selection-display-block-sibling.html
1946                editing/selection/selection-display-flex.html
1947
1948         * rendering/RenderObject.cpp:
1949         (WebCore::RenderObject::firstNonAnonymousAncestor const):
1950         * rendering/RenderObject.h:
1951         * rendering/RenderText.h:
1952         (WebCore::RenderText::getCachedPseudoStyle const): getCachedPseudoStyle from first non-anonymous ancestor, rather than only checking the direct parent.
1953         (WebCore::RenderText::selectionBackgroundColor const): Retrieve selectionBackgroundColor from first non-anonymous ancestor rather than only checking the direct parent.
1954         (WebCore::RenderText::selectionForegroundColor const): Retrieve selectionForegroundColor from first non-anonymous ancestor rather than only checking the direct parent.
1955         (WebCore::RenderText::selectionEmphasisMarkColor const): Retrieve selectionEmphasisMarkColor from first non-anonymous ancestor rather than only checking the direct parent.
1956         (WebCore::RenderText::selectionPseudoStyle const): Retrieve selectionPseudoStyle from first non-anonymous ancestor rather than only checking the direct parent.
1957
1958 2020-05-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1959
1960         DataTransfer.files contains multiple files when pasting a single image with multiple representations
1961         https://bugs.webkit.org/show_bug.cgi?id=212245
1962         <rdar://problem/60240436>
1963
1964         Reviewed by Tim Horton.
1965
1966         When pasting or dropping a single image that is backed by multiple representations in NSPasteboard (or
1967         UIPasteboard), we currently report more than one `File` to the page via `DataTransfer.files`. This is because
1968         `Pasteboard::read(PasteboardFileReader&)`, which is responsible for converting the contents of the pasteboard
1969         into a list of files, currently iterates over every pasteboard type and adds each of them as a file. This is
1970         wrong when an item has multiple type representations.
1971
1972         To differentiate the case where a single item has multiple representations from the case where it has multiple
1973         pasteboard items, we use `allPasteboardItemInfo()` instead to grab a per-item list of types from the pasteboard
1974         on Cocoa platforms, and only create at most 1 file per item using the highest fidelity type that contains data.
1975
1976         Test: PasteImage.PasteImageWithMultipleRepresentations
1977
1978         * platform/cocoa/PasteboardCocoa.mm:
1979         (WebCore::Pasteboard::read):
1980
1981 2020-05-21  Simon Fraser  <simon.fraser@apple.com>
1982
1983         Fix rare scrolling thread crash firing the m_delayedRenderingUpdateDetectionTimer timer
1984         https://bugs.webkit.org/show_bug.cgi?id=212250
1985
1986         Reviewed by Tim Horton.
1987
1988         It seems that we can fire the m_delayedRenderingUpdateDetectionTimer timer after the
1989         ScrollingTree has been destroyed (possibly because it's destroyed on another thread
1990         and CFRunLoopTimerRef isn't threadsafe), so explicitly clear the timer in invalidate()
1991         while holding m_treeMutex.
1992
1993         * page/scrolling/ThreadedScrollingTree.cpp:
1994         (WebCore::ThreadedScrollingTree::invalidate):
1995
1996 2020-05-21  Sam Weinig  <weinig@apple.com>
1997
1998         Extended Color Cleanup: Move Color coder definitions to Color to allow for future encaspulation improvements
1999         https://bugs.webkit.org/show_bug.cgi?id=212247
2000
2001         Reviewed by Simon Fraser.
2002
2003         Move IPC encoder/decoder definitions from WebKit down into Color itself to move closer
2004         to making Color::rgb() private.
2005
2006         * platform/graphics/Color.h:
2007         (WebCore::Color::encode const):
2008         (WebCore::Color::decode):
2009
2010 2020-05-21  Simon Fraser  <simon.fraser@apple.com>
2011
2012         Scrolling thread scrolls on sync-scrolling scrollers don't get to the main thread
2013         https://bugs.webkit.org/show_bug.cgi?id=212225
2014
2015         Fix builds that use Nicosia after r262041.
2016
2017         * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp:
2018         (WebCore::ScrollingTreeFrameScrollingNodeNicosia::currentScrollPositionChanged):
2019         * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h:
2020
2021 2020-05-21  Simon Fraser  <simon.fraser@apple.com>
2022
2023         Fix some thread safety issues with ScrollController timers
2024         https://bugs.webkit.org/show_bug.cgi?id=212238
2025
2026         Reviewed by Wenson Hsieh.
2027
2028         There were some problems with the timers fired by ScrollController, used for rubber-banding
2029         and scroll snap.
2030
2031         First, they could fire on the main thread when we intended them to fire on the scrolling thread.
2032         This happened because in r260716 I made the scrolling tree commit on the main thread, so we'd
2033         construct the ScrollingTreeScrollingNodeDelegateMac and its ScrollController there and its
2034         timers would grab the main thread runloop. Fix by creating the timers on demand.
2035
2036         Secondly, the timer callbacks called into scrolling tree code, but without taking
2037         the scrolling tree lock,
2038         and without any guarantee that the node would stay alive for the duration of the callback.
2039         Fix by having the ScrollControllerClient create the timers, allowing the client to have
2040         a callback wrapper that locks, and to ensure object lifetime (or make a weak ref). Now
2041         that scrolling tree nodes could be extended by a pending timer, we need to explicitly
2042         clear the timers when nodes are removed from the tree.
2043
2044         Finally, rename some confusingly named ScrollControllerClient functions.
2045
2046         * page/scrolling/ScrollingTree.cpp:
2047         (WebCore::ScrollingTree::commitTreeState):
2048         * page/scrolling/ScrollingTree.h:
2049         (WebCore::ScrollingTree::treeMutex):
2050         * page/scrolling/ScrollingTreeNode.h:
2051         (WebCore::ScrollingTreeNode::wasBeRemovedFromTree):
2052         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
2053         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2054         (WebCore::ScrollingTreeFrameScrollingNodeMac::wasBeRemovedFromTree):
2055         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
2056         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
2057         (WebCore::ScrollingTreeOverflowScrollingNodeMac::wasBeRemovedFromTree):
2058         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
2059         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
2060         (WebCore::ScrollingTreeScrollingNodeDelegateMac::nodeWillBeDestroyed):
2061         (WebCore::ScrollingTreeScrollingNodeDelegateMac::createTimer):
2062         (WebCore::ScrollingTreeScrollingNodeDelegateMac::didStopRubberbandSnapAnimation):
2063         (WebCore::ScrollingTreeScrollingNodeDelegateMac::willStartScrollSnapAnimation):
2064         (WebCore::ScrollingTreeScrollingNodeDelegateMac::didStopScrollSnapAnimation):
2065         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stopSnapRubberbandTimer): Deleted.
2066         (WebCore::ScrollingTreeScrollingNodeDelegateMac::startScrollSnapTimer): Deleted.
2067         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stopScrollSnapTimer): Deleted.
2068         * platform/ScrollAnimator.cpp:
2069         (WebCore::ScrollAnimator::createTimer):
2070         * platform/ScrollAnimator.h:
2071         * platform/cocoa/ScrollController.h:
2072         (WebCore::ScrollControllerTimer::ScrollControllerTimer):
2073         (WebCore::ScrollControllerClient::willStartRubberBandSnapAnimation):
2074         (WebCore::ScrollControllerClient::didStopRubberbandSnapAnimation):
2075         (WebCore::ScrollControllerClient::willStartScrollSnapAnimation):
2076         (WebCore::ScrollControllerClient::didStopScrollSnapAnimation):
2077         (WebCore::ScrollControllerClient::startSnapRubberbandTimer): Deleted.
2078         (WebCore::ScrollControllerClient::stopSnapRubberbandTimer): Deleted.
2079         (WebCore::ScrollControllerClient::startScrollSnapTimer): Deleted.
2080         (WebCore::ScrollControllerClient::stopScrollSnapTimer): Deleted.
2081         * platform/cocoa/ScrollController.mm:
2082         (WebCore::ScrollController::ScrollController):
2083         (WebCore::ScrollController::stopAllTimers):
2084         (WebCore::ScrollController::handleWheelEvent):
2085         (WebCore::ScrollController::snapRubberBandTimerFired):
2086         (WebCore::ScrollController::isRubberBandInProgress const):
2087         (WebCore::ScrollController::isScrollSnapInProgress const):
2088         (WebCore::ScrollController::startSnapRubberbandTimer):
2089         (WebCore::ScrollController::stopSnapRubberbandTimer):
2090         (WebCore::ScrollController::snapRubberBand):
2091         (WebCore::ScrollController::scheduleStatelessScrollSnap):
2092         (WebCore::ScrollController::statelessSnapTransitionTimerFired):
2093         (WebCore::ScrollController::startScrollSnapTimer):
2094         (WebCore::ScrollController::stopScrollSnapTimer):
2095         * platform/mac/ScrollAnimatorMac.h:
2096
2097 2020-05-21  Simon Fraser  <simon.fraser@apple.com>
2098
2099         Scrolling thread scrolls on sync-scrolling scrollers don't get to the main thread
2100         https://bugs.webkit.org/show_bug.cgi?id=212225
2101
2102         Reviewed by Tim Horton.
2103
2104         Some scrolls on nodes with synchronousScrollingReasons failed to set the m_scrolledSinceLastCommit bit,
2105         because ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged() bypassed a call to the superclass.
2106
2107         Fix by passing ScrollingLayerPositionAction so that it can just call super.
2108
2109         This will be tested by existing tests after some upcoming scroll snap changes.
2110
2111         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2112         (WebCore::ScrollingTreeScrollingNode::currentScrollPositionChanged):
2113         * page/scrolling/ScrollingTreeScrollingNode.h:
2114         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
2115         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2116         (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged):
2117
2118 2020-05-21  Peng Liu  <peng.liu6@apple.com>
2119
2120         Fix issues of the Picture-in-Picture API under stress tests
2121         https://bugs.webkit.org/show_bug.cgi?id=212191
2122
2123         Reviewed by Eric Carlson.
2124
2125         The current implementation of the Picture-in-Picture API is not robust under stress tests.
2126         Changing the video presentation mode of a video element between inline and picture-in-picture
2127         continuously may corrupt the internal states of the video element.
2128
2129         This patch refactors the approach to tracking the progress of video presentation mode changes
2130         and make sure no new requestPictureInPicture() or exitPictureInPicture() will trigger
2131         a presentation mode change unless the previous operations are completed.
2132
2133         This patch also removes the code for testing purposes in the HTMLVideoElement class.
2134
2135         Covered by existing tests.
2136
2137         * html/HTMLMediaElement.h:
2138         * html/HTMLVideoElement.cpp:
2139         (WebCore::toPresentationMode):
2140         (WebCore::HTMLVideoElement::setFullscreenMode):
2141         (WebCore::HTMLVideoElement::fullscreenModeChanged):
2142         (WebCore::HTMLVideoElement::didEnterFullscreen):
2143         (WebCore::HTMLVideoElement::didExitFullscreen):
2144         (WebCore::HTMLVideoElement::setPictureInPictureObserver):
2145         (WebCore::HTMLVideoElement::setVideoFullscreenFrame):
2146         (WebCore::HTMLVideoElement::didBecomeFullscreenElement): Deleted.
2147         (WebCore::HTMLVideoElement::setPictureInPictureAPITestEnabled): Deleted.
2148         * html/HTMLVideoElement.h:
2149
2150         * testing/Internals.cpp:
2151         (WebCore::Internals::setPictureInPictureAPITestEnabled): Deleted.
2152         * testing/Internals.h:
2153         * testing/Internals.idl:
2154         Remove setPictureInPictureAPITestEnabled().
2155
2156 2020-05-21  Sam Weinig  <weinig@apple.com>
2157
2158         Extended Color Cleanup: Remove trivial uses of Color::rgb()
2159         https://bugs.webkit.org/show_bug.cgi?id=212231
2160
2161         Reviewed by Darin Adler
2162
2163         Replaces a few unnecessary uses of Color::rgb():
2164         - Uses of an idiom where code round-tripped a Color via Color(myColor.rgb()). This is
2165           not compatible with extended colors and seems to be unnecessary.
2166         - Uses of colorWithOverrideAlpha(). This function requires a SimpleColor, so required
2167           using color.rgb(). We can't transition to Color::colorWithAlpha due to a slightly 
2168           different rounding of the alpha, so a new function Color::colorWithAlphaUsingAlternativeRounding
2169           was added to which implements the alternative rounding. A later change can reconcile
2170           the two versions.
2171         - Creation of D2D1::ColorF. D2D1::ColorF has a constructor that takes a four floats that
2172           is used instead.
2173         - Comparing two colors using rgb() for each to avoid comparing the semantic bit. equalIgnoringSemanticColor
2174           exists for just this use.
2175
2176         * editing/cocoa/HTMLConverter.mm:
2177         (HTMLConverterCaches::colorPropertyValueForNode):
2178         * html/HTMLElement.cpp:
2179         (WebCore::HTMLElement::addHTMLColorToStyle):
2180         * html/canvas/CanvasRenderingContext2DBase.cpp:
2181         (WebCore::CanvasRenderingContext2DBase::setStrokeStyle):
2182         (WebCore::CanvasRenderingContext2DBase::setFillStyle):
2183         (WebCore::CanvasRenderingContext2DBase::setShadow):
2184         * html/canvas/CanvasStyle.cpp:
2185         (WebCore::CanvasStyle::createFromStringWithOverrideAlpha):
2186         * html/track/InbandGenericTextTrack.cpp:
2187         (WebCore::InbandGenericTextTrack::updateCueFromCueData):
2188         * platform/graphics/Color.cpp:
2189         (WebCore::Color::colorWithAlphaMultipliedByUsingAlternativeRounding const):
2190         (WebCore::Color::colorWithAlpha const):
2191         (WebCore::Color::colorWithAlphaUsingAlternativeRounding const):
2192         (WebCore::colorWithOverrideAlpha): Deleted.
2193         * platform/graphics/Color.h:
2194         (WebCore::colorWithOverrideAlpha): Deleted.
2195         * platform/graphics/cairo/CairoOperations.cpp:
2196         (WebCore::Cairo::prepareCairoContextSource):
2197         * platform/graphics/filters/FEFlood.cpp:
2198         (WebCore::FEFlood::platformApplySoftware):
2199         * platform/graphics/win/ColorDirect2D.cpp:
2200         (WebCore::Color::operator D2D1_COLOR_F const):
2201         (WebCore::Color::operator D2D1_VECTOR_4F const):
2202         * platform/graphics/win/GraphicsContextDirect2D.cpp:
2203         (WebCore::GraphicsContext::colorWithGlobalAlpha const):
2204         * platform/mac/ThemeMac.mm:
2205         (WebCore::drawCellFocusRingWithFrameAtTime):
2206         * rendering/RenderThemeIOS.mm:
2207         (WebCore::RenderThemeIOS::paintFileUploadIconDecorations):
2208         * rendering/RenderThemeMac.mm:
2209         (WebCore::RenderThemeMac::platformFocusRingColor const):
2210         * rendering/RenderTreeAsText.cpp:
2211         (WebCore::RenderTreeAsText::writeRenderObject):
2212         * svg/SVGStopElement.cpp:
2213         (WebCore::SVGStopElement::stopColorIncludingOpacity const):
2214
2215 2020-05-21  Oriol Brufau  <obrufau@igalia.com>
2216
2217         [css-grid] Don't create renderers for whitespace nodes
2218         https://bugs.webkit.org/show_bug.cgi?id=212220
2219
2220         Reviewed by Manuel Rego Casasnovas.
2221
2222         Even with 'white-space: pre' we shouldn't create RenderTexts
2223         for whitespace-only nodes in grid layout, according to
2224         https://drafts.csswg.org/css-grid/#grid-items
2225
2226         This patch is based on https://codereview.chromium.org/16888008
2227
2228         Tests: fast/text/simple-line-layout-with-zero-sized-font.html
2229                imported/w3c/web-platform-tests/css/css-grid/grid-items/whitespace-in-grid-item-001.html
2230
2231         * rendering/updating/RenderTreeUpdater.cpp:
2232         (WebCore::RenderTreeUpdater::textRendererIsNeeded):
2233
2234 2020-05-21  Simon Fraser  <simon.fraser@apple.com>
2235
2236         Fix rare crash in TileGrid::platformCALayerShowRepaintCounter()
2237         https://bugs.webkit.org/show_bug.cgi?id=212182
2238         <rdar://problem/55618414>
2239
2240         Reviewed by Darin Adler.
2241
2242         Crash data suggest that owner() can be null in platformCALayerShowRepaintCounter(),
2243         so null-check in these functions.
2244
2245         * platform/graphics/ca/TileGrid.cpp:
2246         (WebCore::TileGrid::platformCALayerDeviceScaleFactor const):
2247         (WebCore::TileGrid::platformCALayerShowDebugBorders const):
2248         (WebCore::TileGrid::platformCALayerShowRepaintCounter const):
2249         (WebCore::TileGrid::isUsingDisplayListDrawing const):
2250
2251 2020-05-21  Youenn Fablet  <youenn@apple.com>
2252
2253         Incorrect location.origin in blob workers
2254         https://bugs.webkit.org/show_bug.cgi?id=211876
2255         <rdar://problem/63284717>
2256
2257         Reviewed by Sihui Liu.
2258
2259         Instead of computing the origin from the location URL in worker, get it directly from the WorkerGlobalScope origin.
2260         This ensures we unwrap properly blob URLs.
2261
2262         Test: http/tests/security/contentSecurityPolicy/worker-blob-location.html
2263
2264         * workers/WorkerGlobalScope.cpp:
2265         (WebCore::WorkerGlobalScope::location const):
2266         * workers/WorkerLocation.cpp:
2267         (WebCore::WorkerLocation::origin const):
2268         * workers/WorkerLocation.h:
2269         (WebCore::WorkerLocation::create):
2270         (WebCore::WorkerLocation::url const):
2271         (WebCore::WorkerLocation::WorkerLocation):
2272
2273 2020-05-21  John Wilander  <wilander@apple.com>
2274
2275         Storage Access API: Allow configurable storage access scope
2276         https://bugs.webkit.org/show_bug.cgi?id=212114
2277         <rdar://problem/63423063>
2278
2279         Reviewed by Alex Christensen.
2280
2281         The scope of storage access as per-frame or per-page was discussed in the
2282         standards process here: https://github.com/privacycg/storage-access/issues/3
2283
2284         The decision was to have per-page storage access by default. Recent feedback
2285         from Google and conversation with Mozilla suggest that we might want to
2286         support the caller choosing the scope.
2287
2288         This patch adds support for different scope configurations while keeping the
2289         existing default as per-frame. A later patch will switch the default and add
2290         test cases for per-page scope.
2291
2292         A new struct is added WebCore::RequestStorageAccessResult which carries full
2293         information about the storage access request result.
2294
2295         A new enum is added WebCore::StorageAccessScope to encode per-frame and
2296         per-page access.
2297
2298         No new tests. No changed functionality. Tests already exist.
2299
2300         * dom/DocumentStorageAccess.cpp:
2301         (WebCore::DocumentStorageAccess::requestStorageAccess):
2302         * dom/DocumentStorageAccess.h:
2303         (WebCore::RequestStorageAccessResult::encode const):
2304         (WebCore::RequestStorageAccessResult::decode):
2305         * page/ChromeClient.h:
2306         (WebCore::ChromeClient::requestStorageAccess):
2307
2308 2020-05-21  Yoshiaki Jitsukawa  <yoshiaki.jitsukawa@sony.com>
2309
2310         [PlayStation] Add minimal WKView API to enable TestWebKitAPI
2311         https://bugs.webkit.org/show_bug.cgi?id=211868
2312
2313         Reviewed by Alex Christensen.
2314
2315         Enable TestWebKitAPI
2316
2317         * PlatformPlayStation.cmake:
2318         Add WebKitRequirements library to WebCore_CopySharedLibs.
2319
2320 2020-05-21  Chris Dumez  <cdumez@apple.com>
2321
2322         ASSERTION FAILED: m_wrapper on fast/events/scoped/editing-commands.html
2323         https://bugs.webkit.org/show_bug.cgi?id=209862
2324         <rdar://problem/61164607>
2325
2326         Reviewed by Darin Adler.
2327
2328         Make sure ScopedEventQueue keeps its event targets alive using a GCReachableRef<Node>
2329         so that it keeps alive both the target and its JS wrapper.
2330
2331         No new tests, covered by existing test.
2332
2333         * dom/ScopedEventQueue.cpp:
2334         (WebCore::ScopedEventQueue::enqueueEvent):
2335         (WebCore::ScopedEventQueue::dispatchEvent const):
2336         (WebCore::ScopedEventQueue::dispatchAllEvents):
2337         * dom/ScopedEventQueue.h:
2338
2339 2020-05-21  Sihui Liu  <sihui_liu@apple.com>
2340
2341         SQLite database fails to close in SQLiteIDBBackingStore::databaseNameFromFile
2342         https://bugs.webkit.org/show_bug.cgi?id=212090
2343
2344         Reviewed by Darin Adler.
2345
2346         We should finish SQLite statement before closing database.
2347
2348         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2349         (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameFromFile):
2350
2351 2020-05-21  Doug Kelly  <dougk@apple.com>
2352
2353         Dispatch pending events only for current page
2354         https://bugs.webkit.org/show_bug.cgi?id=211975
2355         <rdar://problem/58942759>
2356
2357         Reviewed by Chris Dumez.
2358
2359         Document::implicitClose() should not dispatch events globally. The EventSender class operates as a singleton pattern
2360         for each event queue, so to add some means to restrict which documents are handling events, we can send the current
2361         page pointer and only dispatch the event if the event is for the same page. Other events are simply re-enqueued
2362         to be triggered at a later time.
2363
2364         * dom/Document.cpp:
2365         (WebCore::Document::implicitClose):
2366         * dom/EventSender.h:
2367         (WebCore::EventSender::timerFired):
2368         (WebCore::EventSender<T>::dispatchPendingEvents):
2369         * html/HTMLLinkElement.cpp:
2370         (WebCore::HTMLLinkElement::dispatchPendingLoadEvents):
2371         * html/HTMLLinkElement.h:
2372         * html/HTMLStyleElement.cpp:
2373         (WebCore::HTMLStyleElement::dispatchPendingLoadEvents):
2374         * html/HTMLStyleElement.h:
2375         * loader/ImageLoader.cpp:
2376         (WebCore::ImageLoader::dispatchPendingBeforeLoadEvents):
2377         (WebCore::ImageLoader::dispatchPendingLoadEvents):
2378         (WebCore::ImageLoader::dispatchPendingErrorEvents):
2379         * loader/ImageLoader.h:
2380         (WebCore::ImageLoader::document):
2381         * xml/parser/XMLDocumentParser.cpp:
2382         (WebCore::XMLDocumentParser::append):
2383
2384 2020-05-21  Simon Fraser  <simon.fraser@apple.com>
2385
2386         [macOS] Scrolling synchronization part 2: Have the scrolling thread detect when the main thread is slow to respond to start a rendering update
2387         https://bugs.webkit.org/show_bug.cgi?id=212175
2388
2389         Reviewed by Tim Horton.
2390
2391         The scrolling thread now detects when a main thread rendering update is taking too long, going into
2392         desynchronized mode when that happens.
2393
2394         However, there's another state that needs to be handled, which is the main thread being busy and
2395         taking too long to start the rendering update. The scrolling thread gets a "displayDidRefresh" ping
2396         and expects that the main thread will get the same ping, and use it to start the rendering update,
2397         but a busy main thread won't respond to this ping promptly.
2398
2399         Detect this with a short-duration (1ms) timer that fires on the scrolling thread; if the timer fires
2400         we go into desynchronized mode until the next update. The timer is canceled if the scrolling thread
2401         receives the willStartRenderingUpdate(). 
2402
2403         * page/scrolling/ThreadedScrollingTree.cpp:
2404         (WebCore::ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout):
2405         (WebCore::ThreadedScrollingTree::scheduleDelayedRenderingUpdateDetectionTimer):
2406         (WebCore::ThreadedScrollingTree::delayedRenderingUpdateDetectionTimerFired):
2407         (WebCore::ThreadedScrollingTree::displayDidRefreshOnScrollingThread):
2408         * page/scrolling/ThreadedScrollingTree.h:
2409
2410 2020-05-21  Sergio Villar Senin  <svillar@igalia.com>
2411
2412         [css-grid] [css-flex] Width of table as grid/flex item is infinite when the sum of columns' width exceed 100%
2413         https://bugs.webkit.org/show_bug.cgi?id=191365
2414
2415         Reviewed by Manuel Rego Casasnovas.
2416
2417         Automatic table layout algorithm generates infinite width tables
2418         (tableMaxWidth to be more exact) when the sum of the columns percentages
2419         exceed the 100% value and there is at least one non-percentage based
2420         column with positive width as in those cases it's impossible to fulfill
2421         the table constrains. That should not be done in the case of the table
2422         being a flex or a grid item because they both define new formatting
2423         contexts.
2424
2425         Based on Blink's crrev.com/1095220 by <mstensho@chromium.org>
2426
2427         * rendering/AutoTableLayout.cpp:
2428         (WebCore::shouldScaleColumnsForParent): return false when the table is
2429         either a grid or a flex item.
2430
2431 2020-05-21  Zalan Bujtas  <zalan@apple.com>
2432
2433         [ macOS debug ] REGRESSION: fast/layoutformattingcontext/table-basic-row-baseline-with-nested-table.html is a flaky crash
2434         https://bugs.webkit.org/show_bug.cgi?id=212139
2435         <rdar://problem/63447683>
2436
2437         Reviewed by Antti Koivisto.
2438
2439         Uninitialized row baseline value caused unexpected cell height in nested tables.
2440
2441         * layout/tableformatting/TableFormattingContext.cpp:
2442         (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows):
2443         * layout/tableformatting/TableGrid.h:
2444
2445 2020-05-21  Zalan Bujtas  <zalan@apple.com>
2446
2447         [LFC][TFC] Collapse in-between cell borders
2448         https://bugs.webkit.org/show_bug.cgi?id=212183
2449
2450         Reviewed by Antti Koivisto.
2451
2452         This patch expands border collapsing to in-between cell borders.
2453
2454         Test: fast/layoutformattingcontext/table-simple-border-collapse3.html
2455
2456         * layout/tableformatting/TableFormattingContext.cpp:
2457         (WebCore::Layout::TableFormattingContext::layoutCell):
2458         * layout/tableformatting/TableFormattingContext.h:
2459         * layout/tableformatting/TableFormattingContextGeometry.cpp:
2460         (WebCore::Layout::TableFormattingContext::Geometry::computedCellBorder const):
2461         (WebCore::Layout::TableFormattingContext::Geometry::intrinsicWidthConstraintsForCell):
2462
2463 2020-05-21  Enrique Ocaña González  <eocanha@igalia.com>
2464
2465         [GStreamer][GTK][WPE] Expose and honor the media content types requiring hardware support setting
2466         https://bugs.webkit.org/show_bug.cgi?id=211950
2467
2468         Reviewed by Adrian Perez de Castro.
2469
2470         Provide the needed information about media content types requiring hardware support
2471         when asking the MediaPlayer about what types are supported. This was already being done
2472         from HTMLMediaElement for player selection, but not in MediaSource nor in
2473         MediaSource::addSourceBuffer() when the webpage used the MSE API to check type support.
2474         In order to ask for the mediaContentTypesRequiringHardwareSupport setting we need a
2475         reference to the current Document in all the places where we need to check type support.
2476
2477         * Modules/mediasource/MediaSource.cpp:
2478         (WebCore::MediaSource::addSourceBuffer): Provide hardware content types extra info.
2479         (WebCore::MediaSource::isTypeSupported): Get hardware content types extra info from
2480         ScriptExecutionContext and provide it to a new refactored private version of
2481         isTypeSupported() which can also be reused from addSourceBuffer().
2482         * Modules/mediasource/MediaSource.h: Changed isTypeSupported() prototype to take
2483         ScriptExecutionContext and added a new overloaded version of the method.
2484         * Modules/mediasource/MediaSource.idl: isTypeSupported() now provides a reference to
2485         ScriptExecutionContext. It's the only way to access the required document settings from a
2486         static method.
2487         * platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
2488         (WebCore::GStreamerRegistryScanner::isContentTypeSupported const): Factor ContentType
2489         discrimination logic common to MediaPlayerPrivateGStreamer and
2490         MediaPlayerPrivateGStreamerMSE.
2491         * platform/graphics/gstreamer/GStreamerRegistryScanner.h: Added new method.
2492         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2493         (WebCore::MediaPlayerPrivateGStreamer::supportsType): Provide hardware content types extra
2494         info when asking for type support.
2495         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2496         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType): Ditto.
2497
2498 2020-05-20  Simon Fraser  <simon.fraser@apple.com>
2499
2500         [macOS] Scrolling synchronization part 1: Have the scrolling thread wait half a frame for the main thread to complete the rendering update
2501         https://bugs.webkit.org/show_bug.cgi?id=212168
2502
2503         Reviewed by Tim Horton.
2504
2505         Currently the scrolling thread is a free-running thread that moves layers around in response
2506         to wheel events, and asynchronously posts data about scrolled layers back to the main thread.
2507         That results in an almost guaranteed lack of synchronization between the displayed layer
2508         positions, and the web-exposed values for scroll position (element.scrollTop, window.pageYOffset etc).
2509         This is a frequent source of stuttering or jumpy web content when scrolling.
2510
2511         The first step to fixing this is to synchronize the scrolling thread layer positions
2512         and the main thread state for the case where the main thread is responsive enough to
2513         render once per frame. This is achieved as follow:
2514             - When the main thread is starting a rendering update, Page::updateRendering() informs
2515               the scrolling tree via ScrollingCoordinatorMac::willStartRenderingUpdate(). This
2516               atomically waits for the scrolling thread to take the m_treeMutex (via a BinarySemaphore)
2517               and starts waiting on the m_stateCondition Condition. Now the main thread pulls the
2518               state of the scrolling tree via synchronizeStateFromScrollingTree() and uses it for
2519               the rendering update.
2520             - If the rendering update finishes within half a frame (8ms), then m_stateCondition
2521               is released, and the scrolling thread assumes that the main thread is going to
2522               commit layers rapidly enough to preserve 60fps scrolling.
2523             - If the rendering update takes too long, m_stateCondition times out, and the scrolling
2524               thread applies layer positions, triggering a CA commit on that thread.
2525
2526         We no longer apply layer positions directly when handling wheel events.
2527
2528         synchronizeStateFromScrollingTree() has to only pull state from nodes that have moved on the scrolling thread,
2529         so track that via ScrollingTreeScrollingNode::scrolledSinceLastCommit() and adjust the visitor function to
2530         make it available during scrolling tree traversal.
2531
2532         * page/Page.cpp:
2533         (WebCore::Page::updateRendering):
2534         (WebCore::Page::finalizeRenderingUpdate):
2535         * page/scrolling/AsyncScrollingCoordinator.cpp:
2536         (WebCore::AsyncScrollingCoordinator::synchronizeStateFromScrollingTree):
2537         * page/scrolling/AsyncScrollingCoordinator.h:
2538         * page/scrolling/ScrollingCoordinator.h:
2539         (WebCore::ScrollingCoordinator::willStartRenderingUpdate):
2540         (WebCore::ScrollingCoordinator::didCompleteRenderingUpdate):
2541         (WebCore::ScrollingCoordinator::synchronizeStateFromScrollingTree): Deleted.
2542         * page/scrolling/ScrollingTree.cpp:
2543         (WebCore::ScrollingTree::handleWheelEvent):
2544         (WebCore::ScrollingTree::traverseScrollingTreeRecursive):
2545         (WebCore::ScrollingTree::commitTreeState):
2546         (WebCore::ScrollingTree::updateTreeFromStateNodeRecursive):
2547         (WebCore::ScrollingTree::applyLayerPositionsInternal):
2548         (WebCore::ScrollingTree::nominalFramesPerSecond):
2549         * page/scrolling/ScrollingTree.h:
2550         * page/scrolling/ScrollingTreeNode.h:
2551         (WebCore::ScrollingTreeNode::didCompleteCommitForNode):
2552         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2553         (WebCore::ScrollingTreeScrollingNode::didCompleteCommitForNode):
2554         (WebCore::ScrollingTreeScrollingNode::currentScrollPositionChanged):
2555         * page/scrolling/ScrollingTreeScrollingNode.h:
2556         * page/scrolling/ThreadedScrollingTree.cpp:
2557         (WebCore::ThreadedScrollingTree::willStartRenderingUpdate):
2558         (WebCore::ThreadedScrollingTree::maxAllowableRenderingUpdateDurationForSynchronization):
2559         (WebCore::ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout):
2560         (WebCore::ThreadedScrollingTree::didCompleteRenderingUpdate):
2561         (WebCore::ThreadedScrollingTree::displayDidRefreshOnScrollingThread):
2562         * page/scrolling/ThreadedScrollingTree.h:
2563         (WebCore::ThreadedScrollingTree::treeMutex):
2564         * page/scrolling/mac/ScrollingCoordinatorMac.h:
2565         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
2566         (WebCore::ScrollingCoordinatorMac::willStartRenderingUpdate):
2567         (WebCore::ScrollingCoordinatorMac::didCompleteRenderingUpdate):
2568
2569 2020-05-20  Chris Fleizach  <cfleizach@apple.com>
2570
2571         REGRESSION (iOS 13.4.1): SpeechSynthesisUtterance.onend event won't fire on cancel().
2572         https://bugs.webkit.org/show_bug.cgi?id=211776
2573         <rdar://problem/63130249>
2574
2575         Reviewed by Per Arne Vollan.
2576
2577         With the move to having speech synthesis happen in the client, the cancel case hits a snag.
2578         We cancel the speech job and clear out the current utterance. By the time the cancel callback comes back,
2579         the current utterance is gone and nothing happens.
2580
2581         The fix is to process the speechError event immediately and not wait on the speech synthesizer -- which seems sane,
2582         since we're just cancelling a speech job.
2583
2584         * Modules/speech/SpeechSynthesis.cpp:
2585         (WebCore::SpeechSynthesis::cancel):
2586
2587 2020-05-20  Darin Adler  <darin@apple.com>
2588
2589         Dictation context should be an object identifier, not a type-punned pointer
2590         https://bugs.webkit.org/show_bug.cgi?id=212174
2591
2592         Reviewed by Anders Carlsson.
2593
2594         * Headers.cmake: Added DictationContext.h.
2595         * Sources.txt: Removed DictationAlternative.cpp.
2596         * WebCore.xcodeproj/project.pbxproj: Added DictationContext.h, removed DictationAlternative.cpp.
2597
2598         * dom/DocumentMarker.h: Use DictationContext instead of uint64_t.
2599         * editing/AlternativeTextController.cpp:
2600         (WebCore::AlternativeTextController::timerFired): Ditto.
2601         * editing/AlternativeTextController.h: Ditto.
2602
2603         * editing/DictationAlternative.h: Use DictationContext instead of uint64_t, but also
2604         use CharacterRange rather than two "unsigned" values. Also convert into a simple
2605         struct without constructors; don't really need those.
2606
2607         * editing/DictationAlternative.cpp: Removed.
2608
2609         * editing/DictationCommand.cpp:
2610         (WebCore::DictationCommand::collectDictationAlternativesInRange): Updated for
2611         changes to DictationAlternative.
2612
2613         * editing/DictationContext.h: Added.
2614
2615         * editing/Editor.h: Forward declare DictationAlternative rather than including
2616         its header.
2617
2618         * editing/cocoa/AlternativeTextContextController.h: Use a pair of maps to bind NSTextAlternatives
2619         objects to object identifiers. Remove unnecessary explicit constructor and destructor. Also removed
2620         unnecessary use of WTF_MAKE_FAST_ALLOCATED, since this is only used as a data member of another
2621         class. Removed unused invalidContext constant.
2622         * editing/cocoa/AlternativeTextContextController.mm: Removed the unneeded includes.
2623         This file treats NSTextAlternatives as an opaque Objective-C type and so doesn't need
2624         any details of that class.
2625         (WebCore::AlternativeTextContextController::addAlternatives): Changed to return a
2626         DictationContext and use two maps, using HashMap::ensure to avoid double hashing.
2627         (WebCore::AlternativeTextContextController::alternativesForContext): Added a null check.
2628         (WebCore::AlternativeTextContextController::removeAlternativesForContext): Ditto. Also
2629         updated to remove from both maps.
2630         (WebCore::AlternativeTextContextController::clear): Clear both maps.
2631
2632         * editing/cocoa/AlternativeTextUIController.h: Since this header is used only from Objective-C,
2633         removed use of OBJC_CLASS. Put showAlternatives inside a macOS-specific block. Use DictationContext
2634         instead of uint64_t.
2635         * editing/cocoa/AlternativeTextUIController.mm:
2636         (WebCore::AlternativeTextUIController::addAlternatives): Use DictationContext instead of uint64_t.
2637         (WebCore::AlternativeTextUIController::alternativesForContext): Ditto.
2638         (WebCore::AlternativeTextUIController::showAlternatives): Ditto.
2639         (WebCore::AlternativeTextUIController::handleAcceptedAlternative): Ditto.
2640         (WebCore::AlternativeTextUIController::removeAlternatives): Ditto.
2641
2642         * page/AlternativeTextClient.h: Use DictationContext instead of uint64_t.
2643
2644 2020-05-20  Zalan Bujtas  <zalan@apple.com>
2645
2646         [LFC][TFC] Preferred width computation should take border collapsing into account
2647         https://bugs.webkit.org/show_bug.cgi?id=212141
2648
2649         Reviewed by Antti Koivisto.
2650
2651         Test: fast/layoutformattingcontext/table-simple-border-collapse2.html
2652
2653         * layout/tableformatting/TableFormattingContext.cpp:
2654         (WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns):
2655         * layout/tableformatting/TableFormattingContext.h:
2656         (WebCore::Layout::TableFormattingContext::Geometry::Geometry):
2657         * layout/tableformatting/TableFormattingContextGeometry.cpp:
2658         (WebCore::Layout::TableFormattingContext::Geometry::intrinsicWidthConstraintsForCell):
2659
2660 2020-05-20  Zalan Bujtas  <zalan@apple.com>
2661
2662         Repaint issues when the login field collapses on music.apple.com
2663         https://bugs.webkit.org/show_bug.cgi?id=212101
2664         <rdar://problem/62874369>
2665
2666         Reviewed by Simon Fraser.
2667
2668         RenderWidgets (e.g iframe) are painted on integral pixel boundaries. When we issue the repaints on such renderers, we need to
2669         make sure that the repaint rectangles are also snapped to integral pixel values.
2670         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).
2671         This patch ensures that we repaint the RenderWidgets properly when a non-direct ancestor puts the renderer on a subpixel position.
2672
2673         Test: fast/repaint/iframe-on-subpixel-position.html
2674
2675         * page/FrameView.h:
2676         * rendering/RenderBox.cpp:
2677         (WebCore::RenderBox::computeVisibleRectInContainer const):
2678         * rendering/RenderLayerBacking.cpp:
2679         (WebCore::RenderLayerBacking::setContentsNeedDisplay):
2680         (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
2681         * rendering/RenderObject.h:
2682         * testing/Internals.cpp:
2683         (WebCore::Internals::enableSubframeRepaintTracking): add subframe repaint tracking 
2684         (WebCore::Internals::disableSubframeRepaintTracking):
2685         * testing/Internals.h:
2686         * testing/Internals.idl:
2687
2688 2020-05-20  Oriol Brufau  <obrufau@igalia.com>
2689
2690         Computed min-width/height for auto depends on box
2691         https://bugs.webkit.org/show_bug.cgi?id=209651
2692
2693         Reviewed by Manuel Rego Casasnovas.
2694
2695         Resolved value of min-width and min-height for auto min sizing of flex
2696         and grid items may be 'auto'. We based this on the computed style of the
2697         shadow including parent. Instead we should rely on whether the element
2698         will actually be a rendered flex/grid item.
2699
2700         The difference matters e.g. when the parent has 'display: contents' and
2701         thus is not a flex nor grid container, but the element can still be a
2702         flex or grid item, depending on the grand-parent.
2703
2704         This patch is based on https://crrev.com/540901 from Chromium.
2705
2706         Tests: imported/w3c/web-platform-tests/css/css-flexbox/getcomputedstyle/flexbox_computedstyle_min-auto-size.html
2707                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-item-min-auto-size-001.html
2708
2709         * css/CSSComputedStyleDeclaration.cpp:
2710         (WebCore::isFlexOrGridItem):
2711         (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
2712
2713 2020-05-20  Alex Christensen  <achristensen@webkit.org>
2714
2715         Remove implicit URL->String conversion operators
2716         https://bugs.webkit.org/show_bug.cgi?id=211033
2717
2718         Reviewed by Darin Adler.
2719
2720         * accessibility/AccessibilityRenderObject.cpp:
2721         (WebCore::AccessibilityRenderObject::stringValueForMSAA const):
2722         * html/DOMURL.cpp:
2723         (WebCore::DOMURL::create):
2724         * html/HTMLPlugInElement.cpp:
2725         (WebCore::pluginReplacementForType):
2726         * html/URLUtils.h:
2727         (WebCore::URLUtils<T>::protocol const):
2728         (WebCore::URLUtils<T>::setUsername):
2729         (WebCore::URLUtils<T>::setPassword):
2730         * page/Location.cpp:
2731         (WebCore::Location::setProtocol):
2732         (WebCore::Location::setHost):
2733         (WebCore::Location::setHostname):
2734         (WebCore::Location::setPort):
2735         (WebCore::Location::setPathname):
2736         (WebCore::Location::setSearch):
2737         (WebCore::Location::setHash):
2738         * platform/graphics/MediaPlayer.cpp:
2739         (WebCore::MediaPlayer::load):
2740
2741 2020-05-20  Sam Weinig  <weinig@apple.com>
2742
2743         Replace Color::getHSL() with sRGBToHSL to ensure it at least gives somewhat sensible results for ExtendedColors and reduce code duplication
2744         https://bugs.webkit.org/show_bug.cgi?id=212143
2745
2746         Reviewed by Simon Fraser.
2747
2748         - Updated API tests to test sRGBToHSL() rather than Color::getHSL() and extended the tests
2749           to include lightness tests and round tripping tests.
2750         - Update editing/pasteboard/paste-dark-mode-color-filtered.html with extended color test cases.
2751
2752         Replaces Color::getHSL() with sRGBToHSL(color.toSRGBAComponentsLossy()) and adds
2753         an optimized variant, lightness(...) that just extracts the lightness component for 
2754         callers that only needed that.
2755         
2756         It is now required to explicitly use color.toSRGBAComponentsLossy() to indicate that
2757         for non-SRGB colors, this will be a lossy transformation and give us an easy way to
2758         find all these sites in the future, if we want to make a better conversion for other
2759         color spaces. 
2760
2761         * editing/ReplaceSelectionCommand.cpp:
2762         (WebCore::fragmentNeedsColorTransformed):
2763         Switch to using lightness(). This was previously broken for extended colors but now works (though 
2764         in a lossy way through sRGB). Update editing/pasteboard/paste-dark-mode-color-filtered.html with extended colors.
2765
2766         * editing/cocoa/DataDetection.mm:
2767         (WebCore::DataDetection::detectContentInRange):
2768         Switch to using sRGBToHSL(color.toSRGBAComponentsLossy()).
2769         
2770         * page/FrameView.cpp:
2771         (WebCore::FrameView::recalculateScrollbarOverlayStyle):
2772         Switch to using lightness().
2773         
2774         * platform/graphics/Color.cpp:
2775         (WebCore::Color::getHSL const): Deleted.
2776         * platform/graphics/Color.h:
2777         Remove Color::getHSL().
2778         
2779         * platform/graphics/ColorUtilities.cpp:
2780         (WebCore::lightness):
2781         Added optimized subset of sRGBToHSL which just computes the lightness component for callers
2782         that only need that.
2783
2784         (WebCore::sRGBToHSL):
2785         Simplify/cleanup code a little using initialize-list based std::max/std::min and structured bindings.
2786
2787         * platform/graphics/ColorUtilities.h:
2788         Export functions to allow testing them directly.
2789
2790 2020-05-20  Megan Gardner  <megan_gardner@apple.com>
2791
2792         Hide password echo when screen is being captured.
2793         https://bugs.webkit.org/show_bug.cgi?id=212060
2794         <rdar://problem/47653578>
2795
2796         Reviewed by Wenson Hsieh.
2797
2798         When the screen is being captured, turn off the password echo. 
2799
2800         * editing/InsertIntoTextNodeCommand.cpp:
2801         (WebCore::InsertIntoTextNodeCommand::doApply):
2802         * page/EditorClient.h:
2803         (WebCore::EditorClient::isScreenCaptured const):
2804
2805 2020-05-20  ChangSeok Oh  <changseok@webkit.org>
2806
2807         [GTK] Implement connected and disconnected events of GAMEPAD API with libmanette
2808         https://bugs.webkit.org/show_bug.cgi?id=133854
2809
2810         Reviewed by Carlos Garcia Campos.
2811
2812         This patch brings initial GAMEPAD API support to the gtk port. We use libmanette,
2813         a simple GObject game controller library to handle gamepad connection and input.
2814         This change aims to implement two GAMEPAD API events: 'gamepadconnected' and 'gamepaddisconnected'
2815         on top of libmanette. Rest of API will be implemented by following patches.
2816
2817         No new tests since existing tests can cover this change.
2818
2819         * PlatformGTK.cmake: Add header & library paths for libmanette.
2820         * SourcesGTK.txt:
2821         * platform/gamepad/manette/GUniquePtrManette.h: Added to define a smart pointer for ManetteMonitor.
2822         * platform/gamepad/manette/ManetteGamepad.cpp: Added. A wrapper class for ManetteDevice.
2823           A ManetteGamepad instance is created per a physically connected gamepad. Currently,
2824           it is empty but input handling login will be placed in this class.
2825         (WebCore::ManetteGamepad::ManetteGamepad):
2826         * platform/gamepad/manette/ManetteGamepad.h: Added.
2827         * platform/gamepad/manette/ManetteGamepadProvider.cpp: Added. A manager class
2828           for ManetteGamepad instances. This class represents ManetteMonitor that
2829           handles connection and disconnection of gamepads. Many parts of this class implementation
2830           is brought from HIDGamepad.cpp
2831         (WebCore::ManetteGamepadProvider::singleton):
2832         (WebCore::onDeviceConnected):
2833         (WebCore::onDeviceDisconnected):
2834         (WebCore::ManetteGamepadProvider::ManetteGamepadProvider):
2835         (WebCore::ManetteGamepadProvider::startMonitoringGamepads):
2836         (WebCore::ManetteGamepadProvider::stopMonitoringGamepads):
2837         (WebCore::ManetteGamepadProvider::deviceConnected):
2838         (WebCore::ManetteGamepadProvider::deviceDisconnected):
2839         (WebCore::ManetteGamepadProvider::indexForNewlyConnectedDevice):
2840         (WebCore::ManetteGamepadProvider::connectionDelayTimerFired):
2841         (WebCore::ManetteGamepadProvider::removeGamepadForDevice):
2842         * platform/gamepad/manette/ManetteGamepadProvider.h: Added.
2843
2844 2020-05-20  Antoine Quint  <graouts@apple.com>
2845
2846         Potential crash in PointerCaptureController::cancelPointer()
2847         https://bugs.webkit.org/show_bug.cgi?id=208347
2848         <rdar://problem/59866247>
2849
2850         Reviewed by David Kilzer and Daniel Bates.
2851
2852         * page/PointerCaptureController.cpp:
2853         (WebCore::PointerCaptureController::cancelPointer):
2854
2855 2020-05-20  Oriol Brufau  <obrufau@igalia.com>
2856
2857         [css-grid] Fix auto repeat with multiple tracks and gutters
2858         https://bugs.webkit.org/show_bug.cgi?id=182922
2859
2860         Reviewed by Manuel Rego Casasnovas.
2861
2862         The code that computes the number of auto repeat tracks wrongly assumes
2863         that the second argument of the repeat() notation is a single track
2864         function. That was true in the beginning, however specs were later on
2865         modified to allow a <track-list>. We support a <track-list> as a second
2866         argument since long ago but the code that computes the number of
2867         auto-repeat tracks was never updated.
2868
2869         This patch modifies two places that relate to the gaps between the
2870         auto-repeat tracks, which ensures the proper total length.
2871
2872         This is a port of https://crrev.com/620278 from Chromium.
2873
2874         Tests: fast/css-grid-layout/grid-auto-repeat-huge-grid.html
2875                imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-multiple-values-001.html
2876
2877         * rendering/RenderGrid.cpp:
2878         (WebCore::RenderGrid::computeAutoRepeatTracksCount const):
2879
2880 2020-05-20  Simon Fraser  <simon.fraser@apple.com>
2881
2882         Plumb the display's nominal refresh rate down to ScrollingTree for use in scroll synchronization
2883         https://bugs.webkit.org/show_bug.cgi?id=212159
2884
2885         Reviewed by Tim Horton.
2886
2887         Plumb an Optional<unsigned> down windowScreenDidChange, which contains the nominal
2888         display refresh rate (as frames per second) if available. On macOS, we get this
2889         from CVDisplayLinkGetNominalOutputVideoRefreshPeriod().
2890
2891         To read it, WebProcessPool::nominalFramesPerSecondForDisplay() makes a DisplayLink
2892         that doesn't get any observers, but that DisplayLink will very likely get used
2893         as soon as we schedule a rendering update.
2894
2895         * page/Chrome.cpp:
2896         (WebCore::Chrome::windowScreenDidChange):
2897         * page/Chrome.h:
2898         * page/Page.cpp:
2899         (WebCore::Page::scrollingCoordinator):
2900         (WebCore::Page::windowScreenDidChange):
2901         * page/Page.h:
2902         (WebCore::Page::displayNominalFramesPerSecond const):
2903         * page/scrolling/AsyncScrollingCoordinator.cpp:
2904         (WebCore::AsyncScrollingCoordinator::windowScreenDidChange):
2905         * page/scrolling/AsyncScrollingCoordinator.h:
2906         * page/scrolling/ScrollingCoordinator.h:
2907         (WebCore::ScrollingCoordinator::windowScreenDidChange):
2908         * page/scrolling/ScrollingTree.cpp:
2909         (WebCore::ScrollingTree::windowScreenDidChange):
2910         * page/scrolling/ScrollingTree.h:
2911         * platform/HostWindow.h:
2912
2913 2020-05-20  Chris Dumez  <cdumez@apple.com>
2914
2915         Disable support for BeforeLoadEvent
2916         https://bugs.webkit.org/show_bug.cgi?id=212140
2917         <rdar://problem/62847577>
2918
2919         Reviewed by Antti Koivisto.
2920
2921         Disable support for BeforeLoadEvent. Other browsers do not support it and
2922         Chrome dropped it shortly after the fork:
2923         - https://bugs.chromium.org/p/chromium/issues/detail?id=333318
2924
2925         This is a synchronous event and therefore very dangerous.
2926
2927         Test: fast/frames/didBecomeCurrentDocumentInFrame-crash.html
2928
2929         * bindings/js/WebCoreBuiltinNames.h:
2930         * dom/BeforeLoadEvent.idl:
2931         * dom/Node.cpp:
2932         (WebCore::Node::dispatchBeforeLoadEvent):
2933         * page/RuntimeEnabledFeatures.h:
2934         (WebCore::RuntimeEnabledFeatures::setLegacyBeforeLoadEventEnabled):
2935         (WebCore::RuntimeEnabledFeatures::legacyBeforeLoadEventEnabled const):
2936
2937 2020-05-20  Zalan Bujtas  <zalan@apple.com>
2938
2939         RenderObject::VisibleRectContext members should not be prefixed with m_
2940         https://bugs.webkit.org/show_bug.cgi?id=212154
2941
2942         Reviewed by Simon Fraser.
2943
2944         * rendering/RenderBox.cpp:
2945         (WebCore::RenderBox::applyCachedClipAndScrollPosition const):
2946         (WebCore::RenderBox::computeVisibleRectInContainer const):
2947         * rendering/RenderInline.cpp:
2948         (WebCore::RenderInline::computeVisibleRectInContainer const):
2949         * rendering/RenderObject.cpp:
2950         (WebCore::RenderObject::computeVisibleRectInContainer const):
2951         * rendering/RenderObject.h:
2952         * rendering/RenderTableCell.cpp:
2953         (WebCore::RenderTableCell::computeVisibleRectInContainer const):
2954         * rendering/RenderView.cpp:
2955         (WebCore::RenderView::computeVisibleRectInContainer const):
2956         * rendering/svg/RenderSVGRoot.cpp:
2957         (WebCore::RenderSVGRoot::computeFloatVisibleRectInContainer const):
2958
2959 2020-05-20  Myles C. Maxfield  <mmaxfield@apple.com>
2960
2961         [iPadOS] -webkit-text-size-adjust:percentage doesn't work
2962         https://bugs.webkit.org/show_bug.cgi?id=212122
2963         <rdar://problem/54560875>
2964
2965         Reviewed by Wenson Hsieh.
2966
2967         We've gotten many bug reports that -webkit-text-size-adjust:X% no longer works in
2968         WebKit on iPads. We don't want to just start honoring the value, because our
2969         testing indicates that, with desktop-class browsing on iPad, more sites work better
2970         when we don't honor percentages. However, if Safari is using the mobile content mode,
2971         or if a native app has local content, it should be possible to get the old behavior
2972         of honoring percentages.
2973
2974         This patch adds a new Setting, idempotentModeAutosizingOnlyHonorsPercentages, which
2975         is hooked up to the desktop-class browsing feature. When
2976         WebPageProxy::effectiveContentModeAfterAdjustingPolicies() determines that the
2977         WebContentMode::Mobile mode should be used, it sets the new setting, which
2978         causes idempotent text autosizing mode to have the same behavior that WKWebViews
2979         on iPadOS used to have: -w-t-s-a:auto and -w-t-s-a:none have no effect, but
2980         -w-t-s-a:X% is honored. This affects both Safari and WKWebView apps.
2981
2982         If a native app wants the old behavior, they can set
2983         WKWebpagePreferences.preferredContentMode = WKContentModeMobile to force the old
2984         iPad behavior. It's expected that apps with legacy content would be doing this
2985         anyway.
2986
2987         Tests: fast/text-autosizing/ios/idempotentmode/idempotent-percentage.html
2988                TestWebKitAPI.PreferredContentMode.IdempotentModeAutosizingOnlyHonorsPercentages
2989
2990         * loader/DocumentLoader.cpp:
2991         (WebCore::DocumentLoader::applyPoliciesToSettings):
2992         * loader/DocumentLoader.h:
2993         (WebCore::DocumentLoader::setIdempotentModeAutosizingOnlyHonorsPercentages):
2994         (WebCore::DocumentLoader::idempotentModeAutosizingOnlyHonorsPercentages const):
2995         * page/Settings.yaml:
2996         * style/StyleAdjuster.cpp:
2997         (WebCore::Style::Adjuster::adjustmentForTextAutosizing):
2998         * style/StyleBuilderCustom.h:
2999         (WebCore::Style::computeBaseSpecifiedFontSize):
3000         * style/StyleBuilderState.cpp:
3001         (WebCore::Style::BuilderState::updateFontForTextSizeAdjust):
3002
3003 2020-05-20  ChangSeok Oh  <changseok@webkit.org>
3004
3005         Move the TextStream logging definition in VisibleSelection.cpp to the outside of the TREE_DEBUGGING guard
3006         https://bugs.webkit.org/show_bug.cgi?id=212127
3007
3008         Reviewed by Simon Fraser.
3009
3010         A linking failure occurs after r261819 where ENABLE_TREE_DEBUGGING is disabled.
3011         The TextStream logging defining is placed inside the guard while its declaration is not since r218976.
3012
3013         Build fix, no functionality changed.
3014
3015         * editing/VisibleSelection.cpp:
3016         (WebCore::operator<<):
3017
3018 2020-05-20  Andres Gonzalez  <andresg_22@apple.com>
3019
3020         Fix for accessibility-node-memory-management.html in isolated tree mode.
3021         https://bugs.webkit.org/show_bug.cgi?id=212142
3022
3023         Reviewed by Chris Fleizach.
3024
3025         LayoutTests/accessibility/accessibility-node-memory-management.html.
3026
3027         - Fix in applyPendingChanges that was not removing removed nodes from
3028         the nodes map. This was causing that some detached AXIsolatedObjects
3029         were being returned.
3030         - Also handle the case where pending changes can come from a detached
3031         AXObject with invalid ID and no platform wrapper.
3032         - updateChildren better handles the case when the notification target
3033         is not in the isolated tree by walking up the object hierarchy until it
3034         finds an associated object that does have a corresponding isolated object.
3035
3036         * accessibility/isolatedtree/AXIsolatedTree.cpp:
3037         (WebCore::AXIsolatedTree::treeForPageID):
3038         (WebCore::AXIsolatedTree::updateChildren):
3039         (WebCore::AXIsolatedTree::applyPendingChanges):
3040
3041 2020-05-20  Antoine Quint  <graouts@apple.com>
3042
3043         [Web Animations] Animation engine should not wake up every tick for steps timing functions
3044         https://bugs.webkit.org/show_bug.cgi?id=212103
3045         <rdar://problem/62737868>
3046
3047         Unreviewed. Clean up some stray FIXMEs mistakenly commited in the previous commit.
3048
3049         * animation/AnimationTimeline.cpp:
3050         (WebCore::AnimationTimeline::updateCSSTransitionsForElementAndProperty):
3051         * style/StyleTreeResolver.cpp:
3052         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
3053
3054 2020-05-20  Antoine Quint  <graouts@apple.com>
3055
3056         [Web Animations] Animation engine should not wake up every tick for steps timing functions
3057         https://bugs.webkit.org/show_bug.cgi?id=212103
3058         <rdar://problem/62737868>
3059
3060         Reviewed by Simon Fraser.
3061
3062         Tests: webanimations/scheduling-of-animation-with-steps-timing-function-on-effect.html
3063                webanimations/scheduling-of-animation-with-steps-timing-function-on-keyframe.html
3064                webanimations/scheduling-of-css-animation-with-explicit-steps-timing-function-on-some-keyframes.html
3065                webanimations/scheduling-of-css-animation-with-implicit-steps-timing-function.html
3066
3067         When an animation uses a steps() timing function, it will appear to animate discretely between values such
3068         that there is only n visual changes, where n is the number of steps provided. This gives us an opportunity
3069         to be more efficient when scheduling animations using steps() timing functions.
3070
3071         In WebAnimation::timeToNextTick() we now ask the associated effect for the amount of progress until the next
3072         step. For an effect-wide steps() timing function, we can use the provided iteration progress. For animations
3073         with a linear effect-wide timing function (the default), we have to map the provided iteration progress to
3074         a keyframe interval, provided that interval uses a steps() timing function.
3075
3076         The new {Animation|Keyframe}Effect::progressUntilNextStep() method returns WTF::nullopt for any other case.
3077
3078         In order to test this, we add a new internals.timeToNextAnimationTick(animation) method which we use in the
3079         two new tests.
3080
3081         * animation/AnimationEffect.cpp:
3082         (WebCore::AnimationEffect::progressUntilNextStep const):
3083         * animation/AnimationEffect.h:
3084         * animation/KeyframeEffect.cpp:
3085         (WebCore::KeyframeEffect::setBlendingKeyframes):
3086         (WebCore::KeyframeEffect::computeSomeKeyframesUseStepsTimingFunction):
3087         (WebCore::KeyframeEffect::timingFunctionForKeyframeAtIndex const): Avoid any out-of-bounds use of the underlying data
3088         structures by returning nullptr for cases where we don't have an explicit keyframe. We also make the function const
3089         such that it may be called from progressUntilNextStep(), it always was const but wasn't marked as such.
3090         (WebCore::KeyframeEffect::progressUntilNextStep const):
3091         * animation/KeyframeEffect.h:
3092         * animation/WebAnimation.cpp:
3093         (WebCore::WebAnimation::timeToNextTick const):
3094         * animation/WebAnimation.h:
3095         * animation/WebAnimation.idl:
3096         * testing/Internals.cpp:
3097         (WebCore::Internals::timeToNextAnimationTick const):
3098         * testing/Internals.h:
3099         * testing/Internals.idl:
3100
3101 2020-05-20  Noam Rosenthal  <noam@webkit.org>
3102
3103         Fix table sizing when 'max-width' is used
3104         https://bugs.webkit.org/show_bug.cgi?id=115156
3105
3106         Reviewed by Zalan Bujtas.
3107
3108         Based on previous patch by László Langó  <lango@inf.u-szeged.hu>
3109
3110         Test: fast/table/html-table-width-max-width-constrained.html
3111
3112         A table should always be wide enough to contain its content (preferred logical width).
3113         This constraint should be stronger than the table style's specified min-width/width.
3114
3115         The behavior matches the spec, and behavior on Firefox/Chrome.
3116
3117         * rendering/RenderTable.cpp:
3118         (WebCore::RenderTable::updateLogicalWidth):
3119                 Max-width should only affect the table's max preferred width.
3120
3121         (WebCore::RenderTable::computePreferredLogicalWidths):
3122                 Change the order of constraints so that content constraint is stronger than style width/max-width constraint.
3123
3124 2020-05-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3125
3126         REGRESSION(r261554): [GTK] Version 2.29.1 crashes using drag-n-drop API
3127         https://bugs.webkit.org/show_bug.cgi?id=212136
3128
3129         Reviewed by Adrian Perez de Castro.
3130
3131         * platform/gtk/PasteboardGtk.cpp:
3132         (WebCore::Pasteboard::read): Use m_selectionData if present.
3133
3134 2020-05-20  Philippe Normand  <pnormand@igalia.com>
3135
3136         [GStreamer] <img> tag needs to support video formats
3137         https://bugs.webkit.org/show_bug.cgi?id=180370
3138
3139         Reviewed by Xabier Rodriguez-Calvar.
3140
3141         GStreamer implementation of the ImageDecoder. It currently doesn't support zero-copy
3142         rendering though due to the the NativeImagePtr requirement.
3143
3144         * platform/GStreamer.cmake:
3145         * platform/MIMETypeRegistry.cpp:
3146         (WebCore::MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType):
3147         * platform/graphics/ImageDecoder.cpp:
3148         (WebCore::ImageDecoder::create):
3149         (WebCore::ImageDecoder::supportsMediaType):
3150         * platform/graphics/gstreamer/ImageDecoderGStreamer.cpp: Added.
3151         (WebCore::toSample):
3152         (WebCore::ImageDecoderGStreamer::create):
3153         (WebCore::ImageDecoderGStreamer::ImageDecoderGStreamer):
3154         (WebCore::ImageDecoderGStreamer::supportsContainerType):
3155         (WebCore::ImageDecoderGStreamer::canDecodeType):
3156         (WebCore::ImageDecoderGStreamer::encodedDataStatus const):
3157         (WebCore::ImageDecoderGStreamer::size const):
3158         (WebCore::ImageDecoderGStreamer::repetitionCount const):
3159         (WebCore::ImageDecoderGStreamer::uti const):
3160         (WebCore::ImageDecoderGStreamer::frameOrientationAtIndex const):
3161         (WebCore::ImageDecoderGStreamer::frameDurationAtIndex const):
3162         (WebCore::ImageDecoderGStreamer::frameHasAlphaAtIndex const):
3163         (WebCore::ImageDecoderGStreamer::frameBytesAtIndex const):
3164         (WebCore::ImageDecoderGStreamer::createFrameImageAtIndex):
3165         (WebCore::ImageDecoderGStreamer::setData):
3166         (WebCore::ImageDecoderGStreamer::clearFrameBufferCache):
3167         (WebCore::ImageDecoderGStreamer::sampleAtIndex const):
3168         (WebCore::ImageDecoderGStreamer::InnerDecoder::decodebinPadAddedCallback):
3169         (WebCore::ImageDecoderGStreamer::InnerDecoder::connectDecoderPad):
3170         (WebCore::ImageDecoderGStreamer::handleSample):
3171         (WebCore::ImageDecoderGStreamer::InnerDecoder::handleMessage):
3172         (WebCore::ImageDecoderGStreamer::InnerDecoder::preparePipeline):
3173         (WebCore::ImageDecoderGStreamer::InnerDecoder::run):
3174         (WebCore::ImageDecoderGStreamer::InnerDecoder::encodedDataStatus const):
3175         (WebCore::ImageDecoderGStreamer::pushEncodedData):
3176         * platform/graphics/gstreamer/ImageDecoderGStreamer.h: Added.
3177         * platform/graphics/gstreamer/ImageGStreamer.h:
3178         (WebCore::ImageGStreamer::createImage):
3179         (WebCore::ImageGStreamer::image):
3180         (WebCore::ImageGStreamer::setCropRect):
3181         (WebCore::ImageGStreamer::rect):
3182         (WebCore::ImageGStreamer::hasAlpha const):
3183         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
3184         (WebCore::ImageGStreamer::ImageGStreamer):
3185         * platform/graphics/gstreamer/MediaSampleGStreamer.h:
3186
3187 2020-05-20  Andy Estes  <aestes@apple.com>
3188
3189         [Mac] UI processes spin when creating the "Share" context menu item
3190         https://bugs.webkit.org/show_bug.cgi?id=212137
3191         <rdar://problem/54498394>
3192
3193         Reviewed by Wenson Hsieh.
3194
3195         Ran update-webkit-localizable-strings.
3196
3197         * en.lproj/Localizable.strings:
3198
3199 2020-05-20  Zalan Bujtas  <zalan@apple.com>
3200
3201         [LFC][TFC] Internal table boxes should take collapsed border into account
3202         https://bugs.webkit.org/show_bug.cgi?id=212135
3203
3204         Reviewed by Antti Koivisto.
3205
3206         Use the collapsed border value to compute the borders for sections, rows and cells.
3207         The collapsed border is propagated to the table box and the adjacent cell boxes.  
3208
3209         Test: fast/layoutformattingcontext/table-simple-border-collapse.html
3210
3211         * layout/LayoutUnits.h:
3212         (WebCore::Layout::operator/):
3213         * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
3214         (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox):
3215         * layout/tableformatting/TableFormattingContext.cpp:
3216         (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows):
3217         (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
3218         (WebCore::Layout::TableFormattingContext::layoutCell):
3219         * layout/tableformatting/TableGrid.h:
3220         (WebCore::Layout::TableGrid::setCollapsedBorder):
3221         (WebCore::Layout::TableGrid::collapsedBorder const):
3222
3223 2020-05-20  Youenn Fablet  <youenn@apple.com>
3224
3225         [Mac] Use preferedPixelBufferFormat for AVVideoCaptureSource
3226         https://bugs.webkit.org/show_bug.cgi?id=212071
3227
3228         Reviewed by Eric Carlson.
3229
3230         Manually tested.
3231
3232         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3233         (WebCore::avVideoCapturePixelBufferFormat):
3234
3235 2020-05-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3236
3237         Unreviewed. Fix GTK4 build with GTK 3.98.4
3238
3239         * platform/gtk/GtkUtilities.cpp:
3240         (WebCore::convertWidgetPointToScreenPoint):
3241         * platform/gtk/GtkVersioning.h:
3242         (gtk_widget_destroy):
3243         * platform/gtk/PlatformScreenGtk.cpp:
3244         (WebCore::screenDPI):
3245
3246 2020-05-12  Carlos Garcia Campos  <cgarcia@igalia.com>
3247
3248         [GTK4] Add support for drag and drop operations
3249         https://bugs.webkit.org/show_bug.cgi?id=211779
3250
3251         Reviewed by Adrian Perez de Castro.
3252
3253         Move the code to create a GdkTexture from an Image from CursorGtk to ImageGtk and add Image::gdkTexture().
3254
3255         * platform/graphics/BitmapImage.h:
3256         * platform/graphics/Image.h:
3257         (WebCore::Image::gdkTexture):
3258         * platform/graphics/gtk/ImageGtk.cpp:
3259         (WebCore::BitmapImage::gdkTexture):
3260         * platform/gtk/CursorGtk.cpp:
3261         (WebCore::createCustomCursor):
3262
3263 2020-05-20  Sam Weinig  <weinig@apple.com>
3264
3265         Remove unused Color::getHSV function
3266         https://bugs.webkit.org/show_bug.cgi?id=212119
3267
3268         Reviewed by Simon Fraser.
3269
3270         * platform/graphics/Color.cpp:
3271         (WebCore::Color::getHSV const): Deleted.
3272         * platform/graphics/Color.h:
3273         Remove Color::getHSV(). It was unused outside of the API test for it.    
3274
3275 2020-05-20  Youenn Fablet  <youenn@apple.com>
3276
3277         Allow calling VideoSampleObserver::videoSampleAvailable from a background thread
3278         https://bugs.webkit.org/show_bug.cgi?id=212024
3279
3280         Reviewed by Eric Carlson.
3281
3282         Allow RealtimeMediaSource::videoSampleAvailable to be called on a background thread, typically the capture thread.
3283         Make WebRTC remote sources and mock capture sources do that.
3284
3285         RealtimeMediaSource is then updating its intrinsic size from the generation thread while updating its size in the main thread.
3286         The size() getter can be called from both threads.
3287
3288         Existing consumers do the following:
3289         - media player will hop to the main thread.
3290         - media recorder will do processing from the background thread.
3291         - WebRTC sender will do processing from the background thread, except when sending black frames where this will still be done on the main thread.
3292         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.
3293
3294         Follow-ups will migrate the real capture sources as well as migrating media player processing out of the main thread.
3295         Covered by existing tests.
3296
3297         * platform/MediaSample.h:
3298         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3299         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
3300         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable):
3301         * platform/mediastream/RealtimeMediaSource.cpp:
3302         (WebCore::RealtimeMediaSource::videoSampleAvailable):
3303         (WebCore::RealtimeMediaSource::setIntrinsicSize):
3304         * platform/mediastream/RealtimeMediaSource.h:
3305         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
3306         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
3307         (WebCore::MockRealtimeVideoSourceMac::MockRealtimeVideoSourceMac):
3308         (WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer):
3309         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h:
3310         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
3311         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
3312         (WebCore::RealtimeIncomingVideoSourceCocoa::processNewSample): Deleted.
3313
3314 2020-05-20  Oriol Brufau  <obrufau@igalia.com>
3315
3316         Fix computeMarginLogicalSizeForChild to check auto margins in the right axis
3317         https://bugs.webkit.org/show_bug.cgi?id=212113
3318
3319         Reviewed by Manuel Rego Casasnovas.
3320
3321         GridLayoutFunctions::computeMarginLogicalSizeForChild checks for 'auto'
3322         margins before retrieving the margin size, since these should be treated
3323         as 0. However, for orthogonal grid items, it used to check the wrong axis.
3324         So if an item had 'margin-top: auto' and 'margin-left: 5px', when asking
3325         for the horizontal margin we could get 0px instead of 5px due to the
3326         auto margin in the vertical axis.
3327
3328         Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-minimum-width-orthogonal-001.html
3329
3330         * rendering/GridLayoutFunctions.cpp:
3331         (WebCore::GridLayoutFunctions::computeMarginLogicalSizeForChild):
3332         (WebCore::GridLayoutFunctions::marginLogicalSizeForChild):
3333
3334 2020-05-19  Fujii Hironori  <Hironori.Fujii@sony.com>
3335
3336         [WinCairo] ASSERT(m_eglDisplay == EGL_NO_DISPLAY) fails in ~PlatformDisplay()
3337         https://bugs.webkit.org/show_bug.cgi?id=212065
3338
3339         Reviewed by Don Olmstead.
3340
3341         PlatformDisplay destoys m_eglDisplay by using std::atexit to
3342         ensure they are destructed before EGL's atexit handler (Bug 157973).
3343         However, calling eglTerminate in atexit handler causes a
3344         crash on Windows (Bug 145832, Bug 170331).
3345
3346         Then, r214688 added shutDownEglDisplays() and explicitly call it
3347         in shutDownWebKit() to destory m_eglDisplay in Windows WebKit1.
3348         However, Windows WebKit2 may call _exit() in IPC::Connection's
3349         WorkQueue thread. It doesn't seem a good idea that explicitly
3350         destructing m_eglDisplay by calling shutDownEglDisplays().
3351
3352         Remove shutDownEglDisplays() and the assertion for Windows.
3353
3354         * platform/graphics/PlatformDisplay.cpp:
3355         (WebCore::PlatformDisplay::~PlatformDisplay): Conditioned out the
3356         assertion for PLATFORM(WIN).
3357         (WebCore::PlatformDisplay::initializeEGLDisplay): Restored the
3358         original atexit handler of r201595.
3359         (WebCore::PlatformDisplay::shutDownEglDisplays): Deleted.
3360         * platform/graphics/PlatformDisplay.h:
3361
3362 2020-05-19  Darin Adler  <darin@apple.com>
3363
3364         REGRESSION (r259930): Dictation marker at start of text is removed when added trailing whitespace is collapsed
3365         https://bugs.webkit.org/show_bug.cgi?id=212093
3366
3367         Reviewed by Daniel Bates.
3368
3369         * dom/DocumentMarkerController.cpp:
3370         (WebCore::DocumentMarkerController::shiftMarkers): Use int to do the math before clamping to
3371         unsigned. This protects against underflow.
3372
3373 2020-05-19  Sam Weinig  <weinig@apple.com>
3374
3375         Remove almost always incorrect Color::getRGBA
3376