7336e6731330aec327b8df2d8e4dabf4e725b5dd
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2020-06-05  Peng Liu  <peng.liu6@apple.com>
2
3         HTMLMediaElement::m_waitingToEnterFullscreen is not initialized in the constructor
4         https://bugs.webkit.org/show_bug.cgi?id=212861
5
6         Reviewed by Jer Noble.
7
8         Covered by existing tests.
9
10         * html/HTMLMediaElement.cpp:
11         (WebCore::HTMLMediaElement::HTMLMediaElement):
12
13 2020-06-05  David Kilzer  <ddkilzer@apple.com>
14
15         [IPC] Adopt enum class for AutocapitalizeType
16         <https://webkit.org/b/212846>
17         <rdar://problem/64042825>
18
19         Reviewed by Darin Adler.
20
21         Summary:
22         - Move AutocapitalizeType into WebCore namespace.
23         - Convert AutocapitalizeType to an enum class.
24         - Add WTF::EnumTraits<AutocapitalizeType> for IPC.
25
26         * html/Autocapitalize.cpp:
27         (WebCore::autocapitalizeTypeForAttributeValue):
28         (WebCore::stringForAutocapitalizeType):
29         * html/AutocapitalizeTypes.h:
30         * html/HTMLFormControlElement.cpp:
31         (WebCore::HTMLFormControlElement::autocapitalizeType const):
32
33 2020-06-05  Ryan Haddad  <ryanhaddad@apple.com>
34
35         Unreviewed, reverting r262619, r262625, and r262641.
36
37         Caused mediarecorder layout test crashes.
38
39         Reverted changesets:
40
41         "[Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder"
42         https://bugs.webkit.org/show_bug.cgi?id=206582
43         https://trac.webkit.org/changeset/262619
44
45         "[Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder"
46         https://bugs.webkit.org/show_bug.cgi?id=206582
47         https://trac.webkit.org/changeset/262625
48
49         "Unreviewed, silence deprecation warning to fix build with
50         latest SDK."
51         https://trac.webkit.org/changeset/262641
52
53 2020-06-05  Kate Cheney  <katherine_cheney@apple.com>
54
55         ITP SQLite Database should only vacuum once per day
56         https://bugs.webkit.org/show_bug.cgi?id=212712
57         <rdar://problem/63939711>
58
59         Reviewed by Brent Fulgham.
60
61         Add WEBCORE_EXPORT macro to function needed in WebKit.
62
63         * platform/sql/SQLiteDatabase.h:
64
65 2020-06-05  Sam Weinig  <weinig@apple.com>
66
67         Some tests in css/css-color/parsing/system-color-valid.html are failing
68         https://bugs.webkit.org/show_bug.cgi?id=212703
69
70         Reviewed by Darin Adler.
71
72         Add support for the following system color keywords, added in CSS Color 4 (https://www.w3.org/TR/css-color-4/#css-system-colors):
73             ActiveText (Text in active links)
74                  Implemented identically to -webkit-activelink
75             Canvas (Background of application content or documents)
76                  [NSColor textBackgroundColor] on macOS, Color::white by default.
77             CanvasText (Text in application content or documents)
78                  [NSColor textBackgroundColor] on macOS, Color::black by default.
79             Field
80                  [NSColor controlColor] on macOS, Color::white by default.
81             FieldText
82                  [NSColor controlTextColor] on macOS, Color::black by default.
83             LinkText
84                  [NSColor linkColor] on macOS (when UseSystemAppearance is true), same as -webkit-link (non-visited) by default.
85             VisitedText
86                  [NSColor systemPurpleColor] on macOS (when UseSystemAppearance is true), same as -webkit-link (visited) by default.
87
88         * css/CSSValueKeywords.in:
89         * platform/ThemeTypes.cpp:
90         (WebCore::operator<<):
91         * platform/ThemeTypes.h:
92         * rendering/RenderTheme.cpp:
93         (WebCore::RenderTheme::systemColor const):
94         * rendering/RenderThemeMac.mm:
95         (WebCore::RenderThemeMac::systemColor const):
96
97 2020-06-05  Jason Lawrence  <lawrence.j@apple.com>
98
99         Unreviewed, reverting r262524.
100
101         Reverting because this commit may have caused issues with
102         other tests.
103
104         Reverted changeset:
105
106         "Release Assert @
107         WebCore::RenderTreeBuilder::RenderTreeBuilder"
108         https://bugs.webkit.org/show_bug.cgi?id=212714
109         https://trac.webkit.org/changeset/262524
110
111 2020-06-05  Jonathan Bedard  <jbedard@apple.com>
112
113         WebCore: Link to framework stubs for watchOS and tvOS
114         https://bugs.webkit.org/show_bug.cgi?id=212834
115         <rdar://problem/64033712>
116
117         Reviewed by Tim Horton.
118
119         No new tests, no behavior changed.
120
121         * Configurations/Base.xcconfig: Ignore 64 to 32 bit conversion errors for watchOS
122         simulators, add tvOS and watchOS major version macros.
123         * Configurations/WebCore.xcconfig: Link to framework stubs for watchOS and tvOS.
124
125 2020-06-05  David Kilzer  <ddkilzer@apple.com>
126
127         [IPC] Adopt enum class for PluginLoadClientPolicy
128         <https://webkit.org/b/212827>
129         <rdar://problem/64030431>
130
131         Reviewed by Alex Christensen.
132
133         * plugins/PluginData.h:
134         (WebCore::PluginLoadClientPolicy):
135         - Make this an enum class.
136         (WTF::EnumTraits<WebCore::PluginLoadClientPolicy>):
137         - Add for use with strongly-typed IPC parameters.
138
139 2020-06-05  Wenson Hsieh  <wenson_hsieh@apple.com>
140
141         Text manipulation should exclude characters outside of the unicode private use area
142         https://bugs.webkit.org/show_bug.cgi?id=212800
143         <rdar://problem/63736417>
144
145         Reviewed by Sihui Liu.
146
147         Consider characters that fall outside of unicode PUA (in addition to line breaks) as excluded when extracting
148         tokens during text manipulation. In doing this, we also rename a few member variables in `ManipulationUnit` to
149         refer to "token delimiters" rather than line breaks.
150
151         Test: TextManipulation.StartTextManipulationExtractsPrivateUseCharactersAsExcludedTokens
152
153         * editing/TextManipulationController.cpp:
154         (WebCore::isInPrivateUseArea):
155         (WebCore::isTokenDelimiter):
156         (WebCore::TextManipulationController::parse):
157         (WebCore::TextManipulationController::observeParagraphs):
158         * editing/TextManipulationController.h:
159
160 2020-06-05  Dean Jackson  <dino@apple.com>
161
162         REGRESSION (r262366): [ Mac wk1 ] webgl/webgl-backing-store-size-update.html is failing
163         https://bugs.webkit.org/show_bug.cgi?id=212647
164         <rdar://problem/63882960>
165
166         Reviewed by Eric Carlson.
167
168         In some unusual cases, specifically WebKit 1, a WebGLLayer could prepareForDisplay
169         but never get told to actually display, producing incorrect results. Fix this by
170         simply calling setNeedsDisplay.
171
172         While here, address some comments from Simon Fraser that were made
173         after r262366.
174
175         * dom/Document.cpp:
176         (WebCore::Document::prepareCanvasesForDisplayIfNeeded):
177         * platform/graphics/cocoa/WebGLLayer.h: Move the instance variables into the implementation file
178         since they are not exposed as an interface.
179         * platform/graphics/cocoa/WebGLLayer.mm:
180         (-[WebGLLayer initWithGraphicsContextGL:]):
181         (-[WebGLLayer prepareForDisplay]):
182         (-[WebGLLayer display]):
183
184 2020-06-05  Chris Dumez  <cdumez@apple.com>
185
186         Unreviewed, silence deprecation warning to fix build with latest SDK.
187
188         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
189         (WebCore::MediaRecorderPrivateWriter::stopRecording):
190
191 2020-06-05  Andres Gonzalez  <andresg_22@apple.com>
192
193         Accessibility isolated tree mode: crashes when navigating websites, com.apple.AppKit: ConvertOutgoingValueForAttribute.
194         https://bugs.webkit.org/show_bug.cgi?id=212829
195         <rdar://problem/63756267>
196
197         Reviewed by Chris Fleizach.
198
199         - [WebAccessibilityObjectWrapper textMarkerRangeFromVisiblePositions] must
200         retrieve an autoreleased id from the main thread.
201         - [WebAccessibilityObjectWrapper textMarkerRangeForSelection] must also
202         retrieve an autoreleased id from the main thread.
203
204         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
205         (-[WebAccessibilityObjectWrapper textMarkerRangeFromVisiblePositions:endPosition:]):
206         (-[WebAccessibilityObjectWrapper textMarkerRangeForSelection]):
207         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
208         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
209
210 2020-06-05  Jonathan Bedard  <jbedard@apple.com>
211
212         WebCore: Guard variable declarations on ENABLE(VIDEO_PRESENTATION_MODE)
213         https://bugs.webkit.org/show_bug.cgi?id=212831
214         <rdar://problem/64033028>
215
216         Reviewed by Tim Horton.
217
218         No new tests, no behavior changed.
219
220         * html/HTMLVideoElement.h:
221
222 2020-06-05  Peng Liu  <peng.liu6@apple.com>
223
224         Fix a tvOS build failure
225         https://bugs.webkit.org/show_bug.cgi?id=212833
226
227         Reviewed by Jer Noble.
228
229         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
230         (WebCore::PlaybackSessionModelMediaElement::togglePictureInPicture):
231
232 2020-06-05  Yusuke Suzuki  <ysuzuki@apple.com>
233
234         DOM constructor should only accept Ref<> / ExceptionOr<Ref<>> for creation to ensure toJSNewlyCreated is always returning object
235         https://bugs.webkit.org/show_bug.cgi?id=212767
236
237         Reviewed by Darin Adler.
238
239         When using toJSNewlyCreated in DOM constructor, we should ensure that this only returns JSObject* (if exception is not happening) to
240         avoid `isObject()` check after that. However AudioContext and ImageData is not following this and can return nullptr from `create` factory
241         function. We should not allow this.
242
243         In this patch,
244
245         1. AudioContext should throw an error instead of returning null. AudioContext had a limit derived from OS, but this limit is reasonable only
246            in Windows. We should insert `OS(WINDOWS)` around this check, and throw an error instead of returning null.
247
248         2. ImageData::create can return nullptr potentially, and it can be converted to null. This is not acceptable for DOM constructor. We should throw
249            an error if we failed to create ImageData.
250
251         3. We inserted static_asserts in CodeGeneratorJS.pm to ensure that XXX::create only returns Ref<> or ExceptionOr<Ref<>>. This ensures that toJSNewlyCreated
252            will return JSObject*.
253
254         This patch is relanding of the completely same patch since internal build is fixed.
255
256         * Modules/webaudio/AudioContext.cpp:
257         (WebCore::AudioContext::create):
258         * Modules/webaudio/AudioContext.h:
259         * Modules/webaudio/AudioContext.idl:
260         * bindings/scripts/CodeGeneratorJS.pm:
261         (GenerateConstructorDefinition):
262         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
263         (WebCore::JSTestEventConstructorConstructor::construct):
264         * bindings/scripts/test/JS/JSTestInterface.cpp:
265         (WebCore::JSTestInterfaceConstructor::construct):
266         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
267         (WebCore::JSTestNamedConstructorNamedConstructor::construct):
268         * bindings/scripts/test/JS/JSTestNode.cpp:
269         (WebCore::JSTestNodeConstructor::construct):
270         * bindings/scripts/test/JS/JSTestObj.cpp:
271         (WebCore::JSTestObjConstructor::construct):
272         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
273         (WebCore::constructJSTestOverloadedConstructors1):
274         (WebCore::constructJSTestOverloadedConstructors2):
275         (WebCore::constructJSTestOverloadedConstructors3):
276         (WebCore::constructJSTestOverloadedConstructors4):
277         (WebCore::constructJSTestOverloadedConstructors5):
278         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
279         (WebCore::constructJSTestOverloadedConstructorsWithSequence1):
280         (WebCore::constructJSTestOverloadedConstructorsWithSequence2):
281         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
282         (WebCore::JSTestPromiseRejectionEventConstructor::construct):
283         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
284         (WebCore::JSTestTypedefsConstructor::construct):
285         * dom/ExceptionOr.h:
286         * html/ImageData.cpp:
287         (WebCore::ImageData::create):
288         * html/ImageData.h:
289         * testing/Internals.cpp:
290         (WebCore::Internals::videoSampleAvailable):
291
292 2020-06-05  Tyler Wilcock  <twilco.o@protonmail.com>
293
294         CSS Variables: Color on specific `border` properties does not work.
295         https://bugs.webkit.org/show_bug.cgi?id=211672
296
297         Reviewed by Antti Koivisto.
298
299         Properly mark CSSPropertyBorderBlockStart, CSSPropertyBorderBlockEnd, CSSPropertyBorderInlineStart, and CSSPropertyBorderInlineEnd as
300         direction-aware properties in CSSProperty::isDirectionAwareProperty.  Also reordered a few properties in this switch so it's more
301         alphabetically ordered.  Prior to this change, CSS variables were not able to be resolved when used in these properties.
302
303         Test: fast/borders/logical-border-props-with-variables.html
304
305         * css/CSSProperty.cpp:
306         (WebCore::CSSProperty::isDirectionAwareProperty):
307         Add CSSPropertyBorderBlockStart, CSSPropertyBorderBlockEnd, CSSPropertyBorderInlineStart, CSSPropertyBorderInlineEnd.
308
309 2020-06-05  Andres Gonzalez  <andresg_22@apple.com>
310
311         AXIsolatedTree::updateChildren should not call nodeForID.
312         https://bugs.webkit.org/show_bug.cgi?id=212794
313
314         Reviewed by Chris Fleizach.
315
316         AXIsolatedTree::updateChildren is executed on the main thread and
317         therfore should not call nodeForID. Since it requires the children IDs
318         for the isolated object whose children are being updated, we need to
319         store those children IDs outside the isolated object. For this reason
320         we added the m_nodeMap member variable which will maintain a map between
321         object ID and its children IDs.
322         In addition, since retrieving the root node happens very often and
323         required also a call to nodeForID, we now store a pointer to the root node instead of its ID, so there is no need to look it up in the reading map.
324
325         * accessibility/AXLogger.cpp:
326         (WebCore::operator<<):
327         * accessibility/isolatedtree/AXIsolatedObject.cpp:
328         (WebCore::AXIsolatedObject::setChildrenIDs):
329         (WebCore::AXIsolatedObject::appendChild): Renamed setChildrenIDs.
330         * accessibility/isolatedtree/AXIsolatedObject.h:
331         * accessibility/isolatedtree/AXIsolatedTree.cpp:
332         (WebCore::AXIsolatedTree::clear):
333         (WebCore::AXIsolatedTree::create):
334         (WebCore::AXIsolatedTree::removeTreeForPageID):
335         (WebCore::AXIsolatedTree::nodeForID const):
336         (WebCore::AXIsolatedTree::generateSubtree):
337         (WebCore::AXIsolatedTree::createSubtree):
338         (WebCore::AXIsolatedTree::updateChildren):
339         (WebCore::AXIsolatedTree::rootNode):
340         (WebCore::AXIsolatedTree::setRootNode):
341         (WebCore::AXIsolatedTree::removeSubtree):
342         (WebCore::AXIsolatedTree::applyPendingChanges):
343         (WebCore::AXIsolatedTree::nodeInTreeForID): Deleted, not used.
344         (WebCore::AXIsolatedTree::setRootNodeID): Renamed setRootNode.
345         * accessibility/isolatedtree/AXIsolatedTree.h:
346         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
347         (-[WebAccessibilityObjectWrapperBase attachIsolatedObject:]):
348
349 2020-06-05  Youenn Fablet  <youenn@apple.com>
350
351         [Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder
352         https://bugs.webkit.org/show_bug.cgi?id=206582
353         <rdar://problem/58985368>
354
355         Unreviewed.
356
357         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
358         (WebCore::MediaRecorderPrivateWriter::initialize):
359         Allow deprecation warnings.
360
361 2020-06-05  Michael Catanzaro  <mcatanzaro@gnome.org>
362
363         Unreviewed, fix unused parameter warnings in EventRegion.cpp and RenderLayerBacking.cpp
364         https://bugs.webkit.org/show_bug.cgi?id=212823
365
366         * rendering/EventRegion.cpp:
367         (WebCore::EventRegion::unite):
368         * rendering/RenderLayerBacking.cpp:
369         (WebCore::RenderLayerBacking::paintDebugOverlays):
370
371 2020-06-05  Adrian Perez de Castro  <aperez@igalia.com>
372
373         Non-unified build fixes, early summer 2020 edition
374         https://bugs.webkit.org/show_bug.cgi?id=212819
375
376         Unreviewed build fix.
377
378         No new tests needed.
379
380         * animation/ElementAnimationRareData.cpp: Add missing RenderStyle.h header.
381         * animation/ElementAnimationRareData.h: Add forward declaration for RenderStyle.
382         * editing/TextManipulationController.cpp: Sprinkle missing HTMLNames:: prefixes.
383         (WebCore::shouldExtractValueForTextManipulation):
384         (WebCore::TextManipulationController::observeParagraphs):
385         (WebCore::makePositionTuple):
386         (WebCore::TextManipulationController::replace):
387         * platform/graphics/SimpleColor.h: Add missing ColorComponents.h and wtf/text/WTFString.h
388         headers.
389         * workers/service/context/ServiceWorkerThread.cpp: Add missing Logging.h header.
390
391 2020-06-05  Andy Estes  <aestes@apple.com>
392
393         [Apple Pay] Remove conditionals for ENABLE_APPLE_PAY_SESSION_V(3|4)
394         https://bugs.webkit.org/show_bug.cgi?id=212541
395         <rdar://problem/63781452>
396
397         Reviewed by Darin Adler.
398
399         APPLE_PAY_SESSION_V(3|4) is now enabled whenever APPLE_PAY itself is enabled.
400
401         * Configurations/FeatureDefines.xcconfig:
402         * Modules/applepay/ApplePayError.idl:
403         * Modules/applepay/ApplePayPaymentAuthorizationResult.idl:
404         * Modules/applepay/ApplePayPaymentContact.idl:
405         * Modules/applepay/ApplePayPaymentMethodUpdate.idl:
406         * Modules/applepay/ApplePayRequestBase.idl:
407         * Modules/applepay/ApplePaySession.idl:
408         * Modules/applepay/ApplePayShippingContactUpdate.idl:
409         * Modules/applepay/ApplePayShippingMethodUpdate.idl:
410         * Modules/applepay/PaymentCoordinatorClient.cpp:
411         (WebCore::PaymentCoordinatorClient::supportsVersion):
412         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
413         (WebCore::ApplePayPaymentHandler::computePaymentMethodErrors const):
414         * accessibility/AccessibilityRenderObject.cpp:
415         (WebCore::AccessibilityRenderObject::applePayButtonDescription const):
416         * css/CSSPrimitiveValueMappings.h:
417         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
418         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const):
419         * css/CSSValueKeywords.in:
420         * css/parser/CSSParserFastPaths.cpp:
421         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
422         * rendering/RenderThemeCocoa.mm:
423         (WebCore::toPKPaymentButtonType):
424         * rendering/style/RenderStyleConstants.cpp:
425         (WebCore::operator<<):
426         * rendering/style/RenderStyleConstants.h:
427
428 2020-06-05  youenn fablet  <youenn@apple.com>
429
430         [Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder
431         https://bugs.webkit.org/show_bug.cgi?id=206582
432         <rdar://problem/58985368>
433
434         Reviewed by Eric Carlson.
435
436         AVAssetWriterDelegate allows to grab recorded data whenever wanted.
437         This delegate requires passing compressed samples to AVAssetWriter.
438         Implement video encoding and audio encoding in dedicated classes and use these classes before adding buffers to AVAssetWriter.
439         These classes are AudioSampleBufferCompressor and VideoSampleBufferCompressor.
440         They support AAC and H264 so far and should be further improved to support more encoding options.
441
442         Instantiate real writer only for platforms supporting AVAssetWriterDelegate, since it is not supported everywhere.
443         The writer, doing the pacakging, is receiving compressed buffer from the audio/video compressors.
444         It then sends data when being request to flush to its delegate, which will send data to the MediaRecorderPrivateWriter.
445         The MediaRecorderPrivateWriter stores the data in a SharedBuffer until MediaRecorder asks for data.
446
447         Note that, whenever we request data, we flush the writer and insert an end of video sample to make sure video data gets flushed.
448         Therefore data should not be requested too fast to get adequate video compression.
449
450         Covered by existing tests.
451
452         * Modules/mediarecorder/MediaRecorderProvider.cpp:
453         (WebCore::MediaRecorderProvider::createMediaRecorderPrivate):
454         * WebCore.xcodeproj/project.pbxproj:
455         * platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp:
456         (WebCore::MediaRecorderPrivateAVFImpl::create):
457         * platform/mediarecorder/MediaRecorderPrivateAVFImpl.h:
458         * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.h: Added.
459         * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm: Added.
460         (WebCore::AudioSampleBufferCompressor::create):
461         (WebCore::AudioSampleBufferCompressor::AudioSampleBufferCompressor):
462         (WebCore::AudioSampleBufferCompressor::~AudioSampleBufferCompressor):
463         (WebCore::AudioSampleBufferCompressor::initialize):
464         (WebCore::AudioSampleBufferCompressor::finish):
465         (WebCore::AudioSampleBufferCompressor::initAudioConverterForSourceFormatDescription):
466         (WebCore::AudioSampleBufferCompressor::computeBufferSizeForAudioFormat):
467         (WebCore::AudioSampleBufferCompressor::attachPrimingTrimsIfNeeded):
468         (WebCore::AudioSampleBufferCompressor::gradualDecoderRefreshCount):
469         (WebCore::AudioSampleBufferCompressor::sampleBufferWithNumPackets):
470         (WebCore::AudioSampleBufferCompressor::audioConverterComplexInputDataProc):
471         (WebCore::AudioSampleBufferCompressor::provideSourceDataNumOutputPackets):
472         (WebCore::AudioSampleBufferCompressor::processSampleBuffersUntilLowWaterTime):
473         (WebCore::AudioSampleBufferCompressor::processSampleBuffer):
474         (WebCore::AudioSampleBufferCompressor::addSampleBuffer):
475         (WebCore::AudioSampleBufferCompressor::getOutputSampleBuffer):
476         (WebCore::AudioSampleBufferCompressor::takeOutputSampleBuffer):
477         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
478         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
479         (-[WebAVAssetWriterDelegate initWithWriter:]):
480         (-[WebAVAssetWriterDelegate assetWriter:didProduceFragmentedHeaderData:]):
481         (-[WebAVAssetWriterDelegate assetWriter:didProduceFragmentedMediaData:fragmentedMediaDataReport:]):
482         (-[WebAVAssetWriterDelegate close]):
483         (WebCore::MediaRecorderPrivateWriter::create):
484         (WebCore::MediaRecorderPrivateWriter::compressedVideoOutputBufferCallback):
485         (WebCore::MediaRecorderPrivateWriter::compressedAudioOutputBufferCallback):
486         (WebCore::MediaRecorderPrivateWriter::MediaRecorderPrivateWriter):
487         (WebCore::MediaRecorderPrivateWriter::~MediaRecorderPrivateWriter):
488         (WebCore::MediaRecorderPrivateWriter::initialize):
489         (WebCore::MediaRecorderPrivateWriter::processNewCompressedVideoSampleBuffers):
490         (WebCore::MediaRecorderPrivateWriter::processNewCompressedAudioSampleBuffers):
491         (WebCore::MediaRecorderPrivateWriter::startAssetWriter):
492         (WebCore::MediaRecorderPrivateWriter::appendCompressedAudioSampleBuffer):
493         (WebCore::MediaRecorderPrivateWriter::appendCompressedVideoSampleBuffer):
494         (WebCore::MediaRecorderPrivateWriter::appendCompressedSampleBuffers):
495         (WebCore::appendEndsPreviousSampleDurationMarker):
496         (WebCore::MediaRecorderPrivateWriter::appendEndOfVideoSampleDurationIfNeeded):
497         (WebCore::MediaRecorderPrivateWriter::flushCompressedSampleBuffers):
498         (WebCore::MediaRecorderPrivateWriter::clear):
499         (WebCore::copySampleBufferWithCurrentTimeStamp):
500         (WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer):
501         (WebCore::createAudioFormatDescription):
502         (WebCore::createAudioSampleBuffer):
503         (WebCore::MediaRecorderPrivateWriter::appendAudioSampleBuffer):
504         (WebCore::MediaRecorderPrivateWriter::stopRecording):
505         (WebCore::MediaRecorderPrivateWriter::appendData):
506         * platform/mediarecorder/cocoa/VideoSampleBufferCompressor.h: Copied from Source/WebCore/platform/mediarecorder/MediaRecorderPrivateAVFImpl.h.
507         * platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm: Added.
508         (WebCore::VideoSampleBufferCompressor::create):
509         (WebCore::VideoSampleBufferCompressor::VideoSampleBufferCompressor):
510         (WebCore::VideoSampleBufferCompressor::~VideoSampleBufferCompressor):
511         (WebCore::VideoSampleBufferCompressor::initialize):
512         (WebCore::VideoSampleBufferCompressor::finish):
513         (WebCore::VideoSampleBufferCompressor::videoCompressionCallback):
514         (WebCore::VideoSampleBufferCompressor::initCompressionSession):
515         (WebCore::VideoSampleBufferCompressor::processSampleBuffer):
516         (WebCore::VideoSampleBufferCompressor::addSampleBuffer):
517         (WebCore::VideoSampleBufferCompressor::getOutputSampleBuffer):
518         (WebCore::VideoSampleBufferCompressor::takeOutputSampleBuffer):
519
520 2020-06-05  Antti Koivisto  <antti@apple.com>
521
522         REGRESSION (r253875?): Element styles incorrect after media query evaluation changes
523         https://bugs.webkit.org/show_bug.cgi?id=211505
524         <rdar://problem/62983242>
525
526         Reviewed by Zalan Bujtas.
527
528         If there are keyframe rules in media queries we fall back to wiping the style resolver when
529         something changes. This fallback code didn't work correctly when a rule flipped from matching
530         to non-matching because MediaQueryCollector bailed out and didn't create DynamicMediaQueryRules
531         structure needed to detect something has changed.
532
533         Test: fast/media/media-query-dynamic-with-keyframes.html
534
535         * style/RuleSet.cpp:
536         (WebCore::Style::RuleSet::addChildRules):
537         (WebCore::Style::RuleSet::addRulesFromSheet):
538
539         Call both push and pop even when the rule doesn't match.
540
541         (WebCore::Style::RuleSet::MediaQueryCollector::pushAndEvaluate):
542
543         Collect the MediaQuerySet in non-matching case too.
544
545         (WebCore::Style::RuleSet::MediaQueryCollector::pop):
546
547         Record the DynamicMediaQueryRules when resolving all rules statically.
548
549 2020-06-05  Youenn Fablet  <youenn@apple.com>
550
551         Ad support for media-source stats
552         https://bugs.webkit.org/show_bug.cgi?id=212702
553
554         Reviewed by Eric Carlson.
555
556         Expose 'media-source' stats which come in audio and video flavours.
557         Covered by updated test.
558
559         * Modules/mediastream/RTCStatsReport.h:
560         (WebCore::RTCStatsReport::AudioSourceStats::AudioSourceStats):
561         (WebCore::RTCStatsReport::VideoSourceStats::VideoSourceStats):
562         * Modules/mediastream/RTCStatsReport.idl:
563         * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp:
564         (WebCore::fillRTCRTPStreamStats):
565         (WebCore::fillRTCMediaSourceStats):
566         (WebCore::fillRTCAudioSourceStats):
567         (WebCore::fillRTCVideoSourceStats):
568         (WebCore::initializeRTCStatsReportBackingMap):
569
570 2020-06-04  Sihui Liu  <sihui_liu@apple.com>
571
572         Text manipulation: first and last unit in a paragraph should not contain only excluded tokens
573         https://bugs.webkit.org/show_bug.cgi?id=212759
574
575         Reviewed by Wenson Hsieh.
576
577         In r262398, we literally made text of one Node as the minimum unit for text manipulation. This patches introduce
578         a struct ManipulationUnit for that. Now a paragraph can be represented as multiple ManipulationUnits. When all 
579         tokens in a ManipulationUnit are excluded, it means the ManipulationUnit is excluded and should not be 
580         manipulated. To record ManipulationUnits in a paragraph based on our current implementation, we need to keep the
581         excluded ManipulationUnits surrounded by non-excluded ManipulationUnits, but we can safely remove the leading 
582         and trailing excluded ManipulationUnits. In this case, we can limit the range of paragraph further and thus less
583         text replacement work.
584
585         Covered by existing test.
586
587         * editing/TextManipulationController.cpp:
588         (WebCore::TextManipulationController::parse):
589         (WebCore::TextManipulationController::addItemIfPossible):
590         (WebCore::TextManipulationController::observeParagraphs):
591         * editing/TextManipulationController.h:
592
593 2020-06-04  Peng Liu  <peng.liu6@apple.com>
594
595         A YouTube video gets stuck after rapidly tapping on touchbar’s PIP button
596         https://bugs.webkit.org/show_bug.cgi?id=212729
597
598         Reviewed by Darin Adler.
599
600         Call HTMLVideoElement::setFullscreenMode() instead of HTMLMediaElement::enterFullscreen()
601         and HTMLMediaElement::exitFullscreen() to toggle picture-in-picture mode.
602         HTMLVideoElement::setFullscreenMode() is robust under stress test after r262456.
603
604         Manually tested.
605
606         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
607         (WebCore::PlaybackSessionModelMediaElement::togglePictureInPicture):
608
609 2020-06-04  Commit Queue  <commit-queue@webkit.org>
610
611         Unreviewed, reverting r262583.
612         https://bugs.webkit.org/show_bug.cgi?id=212799
613
614         Internal source code has the same bug, needs to be landed
615         after fixing internal source
616
617         Reverted changeset:
618
619         "DOM constructor should only accept Ref<> / ExceptionOr<Ref<>>
620         for creation to ensure toJSNewlyCreated is always returning
621         object"
622         https://bugs.webkit.org/show_bug.cgi?id=212767
623         https://trac.webkit.org/changeset/262583
624
625 2020-06-04  Zalan Bujtas  <zalan@apple.com>
626
627         HTMLAppletElement::updateWidget should check for renderer after the overlapping test.
628         https://bugs.webkit.org/show_bug.cgi?id=212789
629         <rdar://problem/61854614>
630
631         Reviewed by Simon Fraser.
632
633         createJavaAppletWidget needs to check if the plugin(replacement) is obscured.
634         Since the overlapping test requires up-to-date geometry, it initiates a top level style recalc/layout.
635         We need to check if the apple element still has a renderer after the style recalc.
636
637         * html/HTMLAppletElement.cpp:
638         (WebCore::HTMLAppletElement::updateWidget):
639
640 2020-06-04  Jack Lee  <shihchieh_lee@apple.com>
641
642         Nullptr crash in DeleteSelectionCommand::doApply() when ending position is disconnected.
643         https://bugs.webkit.org/show_bug.cgi?id=212723
644         <rdar://problem/63866653>
645
646         Reviewed by Geoffrey Garen.
647
648         In this test case, while merging paragraphs after deleting a text element, we need call removeNodeAndPruneAncestors()
649         to remove a BR node. However, the ancestor of BR is also removed. Later we try to insert a node at the parent of the
650         removed ancestor in function DeleteSelectionCommand::doApply().
651
652         For now we just check the parentless inserting position and bail out. The proper fix should be re-designing 
653         removeNodeAndPruneAncestors() or select a different inserting position after removeNodeAndPruneAncestors() is called.
654
655         Test: editing/deleting/delete-txt-in-dl-crash.html
656
657         * editing/DeleteSelectionCommand.cpp:
658         (WebCore::DeleteSelectionCommand::doApply):
659
660 2020-06-04  Ross Kirsling  <ross.kirsling@sony.com>
661
662         [PlayStation] Unreviewed revert of build fix. Missing include was not the cause.
663
664         * platform/graphics/ColorUtilities.cpp:
665
666 2020-06-04  Sihui Liu  <sihui_liu@apple.com>
667
668         REGRESSION:(r262398) Text manipulation crashes when content is added
669         https://bugs.webkit.org/show_bug.cgi?id=212785
670
671         Reviewed by Ryosuke Niwa.
672
673         r262398 accidentally removed the bound check on array index and was not caught by existing tests.
674
675         Test: TextManipulation.CompleteTextManipulationFailWhenContentIsAdded
676
677         * editing/TextManipulationController.cpp:
678         (WebCore::TextManipulationController::replace):
679
680 2020-06-04  Ross Kirsling  <ross.kirsling@sony.com>
681
682         [PlayStation] Unreviewed build fix following r262352.
683
684         * platform/graphics/ColorUtilities.cpp:
685
686 2020-06-04  Yusuke Suzuki  <ysuzuki@apple.com>
687
688         DOM constructor should only accept Ref<> / ExceptionOr<Ref<>> for creation to ensure toJSNewlyCreated is always returning object
689         https://bugs.webkit.org/show_bug.cgi?id=212767
690
691         Reviewed by Darin Adler.
692
693         When using toJSNewlyCreated in DOM constructor, we should ensure that this only returns JSObject* (if exception is not happening) to
694         avoid `isObject()` check after that. However AudioContext and ImageData is not following this and can return nullptr from `create` factory
695         function. We should not allow this.
696
697         In this patch,
698
699         1. AudioContext should throw an error instead of returning null. AudioContext had a limit derived from OS, but this limit is reasonable only
700            in Windows. We should insert `OS(WINDOWS)` around this check, and throw an error instead of returning null.
701
702         2. ImageData::create can return nullptr potentially, and it can be converted to null. This is not acceptable for DOM constructor. We should throw
703            an error if we failed to create ImageData.
704
705         3. We inserted static_asserts in CodeGeneratorJS.pm to ensure that XXX::create only returns Ref<> or ExceptionOr<Ref<>>. This ensures that toJSNewlyCreated
706            will return JSObject*.
707
708         * Modules/webaudio/AudioContext.cpp:
709         (WebCore::AudioContext::create):
710         * Modules/webaudio/AudioContext.h:
711         * Modules/webaudio/AudioContext.idl:
712         * bindings/scripts/CodeGeneratorJS.pm:
713         (GenerateConstructorDefinition):
714         * dom/ExceptionOr.h:
715         * html/ImageData.cpp:
716         (WebCore::ImageData::create):
717         * html/ImageData.h:
718         * testing/Internals.cpp:
719         (WebCore::Internals::videoSampleAvailable):
720
721 2020-06-04  Kate Cheney  <katherine_cheney@apple.com>
722
723         REGRESSION (r262212): [ iOS Debug wk2 ] ASSERTION FAILED: !isSynchronous() || !m_synchronousLoadData->delayedReply in WebKit::NetworkResourceLoader
724         https://bugs.webkit.org/show_bug.cgi?id=212678
725         <rdar://problem/63797758>
726
727         Reviewed by Chris Dumez.
728
729         No new tests, this will fix http/tests/xmlhttprequest/access-control-preflight-credential-sync.html.
730
731         Refactor the bundle identifier setters and getters in
732         RuntimeApplicationChecksCocoa.mm so that a separate function sets
733         an override bundle identifier, and clearing the override identifier
734         does not clear the UI process bundle identifier as well. 
735
736         * platform/RuntimeApplicationChecks.h:
737         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
738         (WebCore::bundleIdentifierOverride):
739         (WebCore::bundleIdentifier):
740         (WebCore::applicationBundleIdentifier):
741         (WebCore::setApplicationBundleIdentifier):
742         (WebCore::setApplicationBundleIdentifierOverride):
743         (WebCore::clearApplicationBundleIdentifierTestingOverride):
744         (WebCore::applicationBundleIdentifierOverride): Deleted.
745
746 2020-06-04  Yusuke Suzuki  <ysuzuki@apple.com>
747
748         MessageEvent should tell its memory cost to GC
749         https://bugs.webkit.org/show_bug.cgi?id=203990
750
751         Reviewed by Mark Lam.
752
753         This patch fixes two issues to make MessageEvent's memoryCost working.
754
755         1. MessageEvent does not have memoryCost function. So even if ArrayBuffer etc. is held as a SerializedScriptValue,
756            it does not communicate memory pressure to GC. This patch adds ReportExtraMemoryCost to MessageEvent.idl and memoryCost
757            function to MessageEvent. And we implement SerializedScriptValue::memoryCost function to obtain rough memory cost
758            for SerializedScriptValue.
759
760         2. IDL code generator puts `reportExtraMemoryAllocated` function call in `toJSNewlyCreated`. However, `toJSNewlyCreated`
761            is not always used when creating JS wrapper. For example, JSMessageEvent can be created from toJSNewlyCreated for MessageEvent.
762            But it can be also be created from toJSNewlyCreated for Event through EventFactory. If the latter path is taken, we won't properly
763            report memory cost even if IDL has ReportExtraMemoryCost. In JSC, we put `reportExtraMemoryAllocated` at the end of JSXXX::finishCreation.
764            IDL code should follow this convention.
765
766         * bindings/js/SerializedScriptValue.cpp:
767         (WebCore::SerializedScriptValue::SerializedScriptValue):
768         (WebCore::SerializedScriptValue::computeMemoryCost const):
769         * bindings/js/SerializedScriptValue.h:
770         (WebCore::SerializedScriptValue::memoryCost const):
771         * bindings/scripts/CodeGeneratorJS.pm:
772         (GenerateImplementation):
773         * bindings/scripts/test/JS/JSInterfaceName.cpp:
774         (WebCore::JSInterfaceName::finishCreation):
775         (WebCore::toJSNewlyCreated):
776         * dom/MessageEvent.cpp:
777         (WebCore::MessageEvent::memoryCost const):
778         * dom/MessageEvent.h:
779         * dom/MessageEvent.idl:
780         * html/OffscreenCanvas.h:
781         (WebCore::DetachedOffscreenCanvas::memoryCost const):
782
783 2020-06-04  Wenson Hsieh  <wenson_hsieh@apple.com>
784
785         [macOS] Add a way to override the contact AutoFill button image
786         https://bugs.webkit.org/show_bug.cgi?id=212775
787         <rdar://problem/60381452>
788
789         Reviewed by Tim Horton.
790
791         Rename `SYSTEM_ATTACHMENT_PLACEHOLDER_ICON` to `ALTERNATE_ICONS`, and use it to additionally guard an alternate
792         appearance for the contact AutoFill button icon.
793
794         * css/html.css:
795         (input::-webkit-contacts-auto-fill-button):
796         * rendering/RenderThemeMac.h:
797         * rendering/RenderThemeMac.mm:
798         (WebCore::RenderThemeMac::extraDefaultStyleSheet):
799
800 2020-06-04  Tetsuharu Ohzeki  <tetsuharu.ohzeki@gmail.com>
801
802         Rename BlobLineEndings to EndingType to match the latest spec
803         https://bugs.webkit.org/show_bug.cgi?id=212644
804
805         Reviewed by Sam Weinig.
806
807         By the latest File API spec, the role of `BlobLineEndings` is named as `EndingType`.
808         https://w3c.github.io/FileAPI/#enumdef-endingtype
809
810         * CMakeLists.txt:
811         * DerivedSources-input.xcfilelist:
812         * DerivedSources-output.xcfilelist:
813         * DerivedSources.make:
814         * Headers.cmake:
815         * Sources.txt:
816         * WebCore.xcodeproj/project.pbxproj:
817         * fileapi/BlobBuilder.cpp:
818         (WebCore::BlobBuilder::BlobBuilder):
819         (WebCore::BlobBuilder::append):
820         * fileapi/BlobBuilder.h:
821         * fileapi/BlobPropertyBag.h:
822         * fileapi/BlobPropertyBag.idl:
823         * fileapi/EndingType.h: Renamed from Source/WebCore/fileapi/BlobLineEndings.h.
824         * fileapi/EndingType.idl: Renamed from Source/WebCore/fileapi/BlobLineEndings.idl.
825
826 2020-06-04  Chris Dumez  <cdumez@apple.com>
827
828         [iOS] Validate index parameter in PlatformPasteboard
829         https://bugs.webkit.org/show_bug.cgi?id=212713
830         <rdar://problem/60068765>
831
832         Reviewed by Alex Christensen.
833
834         Follow-up to r262529 to also make sure that the index is not negative after
835         casting to NSInteger.
836
837         * platform/ios/PlatformPasteboardIOS.mm:
838         (WebCore::PlatformPasteboard::readBuffer const):
839         (WebCore::PlatformPasteboard::readString const):
840         (WebCore::PlatformPasteboard::readURL const):
841
842 2020-06-04  Xabier Rodriguez Calvar  <calvaris@igalia.com>
843
844         [EME][GStreamer] cdmProxyAttached does not need to force a bump ref in the signature
845         https://bugs.webkit.org/show_bug.cgi?id=212754
846
847         Reviewed by Philippe Normand.
848
849         cdmProxyAttached is currently receiving a RefPtr<CDMProxy> in the
850         signature, what causes a ref bump when the function is called. A
851         const RefPtr<CDMProxy>& is more suitable cause the reference is
852         already bumped when the CDMProxy assigned in the decryptor
853         attribute.
854
855         No new tests, just a rework.
856
857         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
858         (cdmProxyAttached):
859         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
860
861 2020-06-04  Tim Horton  <timothy_horton@apple.com>
862
863         Work around broken system version macro
864         https://bugs.webkit.org/show_bug.cgi?id=212726
865
866         Reviewed by Dan Bernstein.
867
868         * Configurations/DebugRelease.xcconfig:
869
870 2020-06-04  Andy Estes  <aestes@apple.com>
871
872         [watchOS] Re-enable content filtering in the simulator build
873         https://bugs.webkit.org/show_bug.cgi?id=212711
874         <rdar://problem/63938350>
875
876         Reviewed by Wenson Hsieh.
877
878         * Configurations/FeatureDefines.xcconfig:
879
880 2020-06-04  Zalan Bujtas  <zalan@apple.com>
881
882         Reset fragment line info when the relatively positioned inline box becomes static with block child.
883         https://bugs.webkit.org/show_bug.cgi?id=212724
884         <rdar://problem/62847534>
885
886         Reviewed by Simon Fraser.
887
888         adjustFragmentedFlowStateOnContainingBlockChangeIfNeeded was missing the case when the
889         block container was inside an inline box. It happens when the inline box is relatively positioned while the
890         child block box is absolutely positioned.
891         RenderFragmentedFlow keeps track of the associated root lineboxes in m_lineToFragmentMap.
892         In adjustFragmentedFlowStateOnContainingBlockChangeIfNeeded, when the block is no longer part of the fragment
893         we remove these cached lineboxes from the m_lineToFragmentMap.
894         This patch fixes the case when the cached lineboxes are generated by a child block box.
895
896         * rendering/RenderElement.cpp:
897         (WebCore::RenderElement::adjustFragmentedFlowStateOnContainingBlockChangeIfNeeded):
898
899 2020-06-04  Youenn Fablet  <youenn@apple.com>
900
901         Read MediaPlayerPrivateMediaStreamAVFObjC::m_canEnqueueDisplayLayer after the lock
902         https://bugs.webkit.org/show_bug.cgi?id=212693
903
904         Reviewed by Eric Carlson.
905
906         In case destroyLayers is called and shortly after ensureLayers is also called, the m_canEnqueueDisplayLayer check in enqueueVideoSample
907         might be bypassed. Make sure to lock before checking m_canEnqueueDisplayLayer in enqueueVideoSample.
908         For good measure, set m_canEnqueueDisplayLayer to false after locking in destroyLayers.
909
910         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
911         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
912         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
913
914 2020-06-03  Chris Dumez  <cdumez@apple.com>
915
916         [iOS] Validate index parameter in PlatformPasteboard
917         https://bugs.webkit.org/show_bug.cgi?id=212713
918         <rdar://problem/60068765>
919
920         Reviewed by Wenson Hsieh.
921
922         Validate index parameter in PlatformPasteboard, before calling [NSIndexSet indexSetWithIndex:].
923         Per documentation, index needs to be in the range [0 .. NSNotFound-1].
924
925         * platform/ios/PlatformPasteboardIOS.mm:
926         (WebCore::PlatformPasteboard::readBuffer const):
927         (WebCore::PlatformPasteboard::readString const):
928         (WebCore::PlatformPasteboard::readURL const):
929
930 2020-06-03  Andy Estes  <aestes@apple.com>
931
932         [Apple Pay] Add new values for -apple-pay-button-type
933         https://bugs.webkit.org/show_bug.cgi?id=212684
934         <rdar://problem/63908535>
935
936         Reviewed by Anders Carlsson.
937
938         Where available, added new values for -apple-pay-button-type and introduced ApplePaySession v10.
939
940         New test: http/tests/ssl/applepay/ApplePayButton.html
941
942         * Modules/applepay/PaymentCoordinatorClient.cpp:
943         (WebCore::PaymentCoordinatorClient::supportsVersion):
944         * accessibility/AccessibilityRenderObject.cpp:
945         (WebCore::AccessibilityRenderObject::applePayButtonDescription const):
946         * css/CSSPrimitiveValueMappings.h:
947         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
948         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const):
949         * css/CSSValueKeywords.in:
950         * css/parser/CSSParserFastPaths.cpp:
951         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
952         * en.lproj/Localizable.strings:
953         * platform/LocalizedStrings.cpp:
954         (WebCore::AXApplePayReloadLabel):
955         (WebCore::AXApplePayAddMoneyLabel):
956         (WebCore::AXApplePayTopUpLabel):
957         (WebCore::AXApplePayOrderLabel):
958         (WebCore::AXApplePayRentLabel):
959         (WebCore::AXApplePaySupportLabel):
960         (WebCore::AXApplePayContributeLabel):
961         (WebCore::AXApplePayTipLabel):
962         * platform/LocalizedStrings.h:
963         * rendering/RenderThemeCocoa.mm:
964         (WebCore::toPKPaymentButtonType):
965         * rendering/style/RenderStyleConstants.cpp:
966         (WebCore::operator<<):
967         * rendering/style/RenderStyleConstants.h:
968         * rendering/style/StyleRareNonInheritedData.h:
969
970 2020-06-03  Daniel Bates  <dabates@apple.com>
971
972         Inserted text placeholder should vertically align to top and behave like block-level element when it has 0 width
973         https://bugs.webkit.org/show_bug.cgi?id=212716
974         <rdar://problem/62672479>
975
976         Reviewed by Darin Adler.
977
978         Refine the appearance of a text placeholder based on feedback:
979             1. If the width of the placeholder is 0 then put it on its own line. This is accomplished by making it
980                CSS "display: block".
981             2. Vertically align the placeholder with the top of the line.
982
983         Both of these refinements are to make the rendering more like TextKit's rendering.
984
985         Tests: editing/text-placeholder/insert-into-content-editable-non-zero-width-and-height.html
986                editing/text-placeholder/insert-into-content-editable-zero-width.html
987
988         * html/shadow/TextPlaceholderElement.cpp:
989
990 2020-06-03  Pinki Gyanchandani  <pgyanchandani@apple.com>
991
992         Release Assert @ WebCore::RenderTreeBuilder::RenderTreeBuilder
993         https://bugs.webkit.org/show_bug.cgi?id=212714
994
995         Reviewed by Geoffrey Garen.
996
997         Widget removal in the middle of building a Render Tree causes side effects, leading to Release Assert. Moved the scope for suspension of widgets
998         update to RenderTreeBuilder instead of having it in RenderTreeUpdater.
999
1000         Also made sure that the WidgetHierarchyUpdatesSuspensionScope::moveWidgets() should handle all widgets scheduled to move, including new widgets
1001         scheduled during moveWidgets().
1002
1003         Test: fast/rendering/widget-removal-in-render-tree-builder-crash.html
1004
1005         * rendering/RenderWidget.cpp:
1006         (WebCore::WidgetHierarchyUpdatesSuspensionScope::moveWidgets):
1007         * rendering/updating/RenderTreeBuilder.h:
1008         * rendering/updating/RenderTreeUpdater.cpp:
1009         (WebCore::RenderTreeUpdater::tearDownRenderers):
1010
1011 2020-06-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1012
1013         [Text manipulation] Extract the value attribute in inputs of type "text" and "search"
1014         https://bugs.webkit.org/show_bug.cgi?id=212706
1015         <rdar://problem/63876969>
1016
1017         Reviewed by Tim Horton.
1018
1019         Allow text manipulation to extract text for the value of text fields that were not last modified by user input.
1020         Aside from button types, it generally doesn't make sense to perform text manipulation over arbitrary input
1021         element values, especially for text field types such as passwords, URLs, emails, and numbers. However, some
1022         webpages set the `value` of inputs to implement `placeholder`-like behavior in text fields, and we need to be
1023         compatible with this.
1024
1025         Tests:  TextManipulation.StartTextManipulationExtractsValuesFromTextInputs
1026                 TextManipulation.CompleteTextManipulationInButtonsAndTextFields
1027
1028         * editing/TextManipulationController.cpp:
1029         (WebCore::shouldExtractValueForTextManipulation):
1030
1031         Unfortunately, we need to check the type attribute here against "text", since inputs of type "date" and "time"
1032         fall back to text fields on macOS, and we still want to avoid extracting values for these.
1033
1034         (WebCore::isAttributeForTextManipulation):
1035
1036         Pull the `value` attribute of this out into a separate method, above.
1037
1038         (WebCore::TextManipulationController::observeParagraphs):
1039         (WebCore::TextManipulationController::replace):
1040
1041         Treat the text field value separately from other attributes by calling `HTMLInputElement::value()` upon
1042         extraction, and `HTMLInputElement::setValue()` upon replacement.
1043
1044 2020-06-03  Rob Buis  <rbuis@igalia.com>
1045
1046         Disallow responses when a response contains invalid header values
1047         https://bugs.webkit.org/show_bug.cgi?id=184493
1048
1049         Reviewed by Darin Adler.
1050
1051         From the Fetch specification [1]:
1052         "A value is a byte sequence that matches the following conditions:
1053         "- Contains no 0x00 (NUL) or HTTP newline bytes."
1054
1055         [1] https://fetch.spec.whatwg.org/#concept-header-value
1056
1057         Tests: imported/w3c/web-platform-tests/fetch/h1-parsing/resources-with-0x00-in-header.window.html
1058                imported/web-platform-tests/fetch/api/basic/header-value-combining.any.html
1059                imported/web-platform-tests/fetch/api/basic/header-value-combining.any.worker.html
1060                imported/web-platform-tests/fetch/api/basic/header-value-null-byte.any.html
1061                imported/web-platform-tests/fetch/api/basic/header-value-null-byte.any.worker.html
1062                imported/web-platform-tests/xhr/headers-normalize-response.htm
1063
1064         * Modules/fetch/FetchHeaders.cpp:
1065         (WebCore::canWriteHeader):
1066         (WebCore::appendToHeaderMap):
1067         (WebCore::FetchHeaders::filterAndFill):
1068         * loader/DocumentThreadableLoader.cpp:
1069         (WebCore::DocumentThreadableLoader::loadRequest):
1070         * loader/SubresourceLoader.cpp:
1071         (WebCore::SubresourceLoader::didReceiveResponse):
1072         * platform/network/HTTPParsers.cpp:
1073         (WebCore::isValidHTTPHeaderValue):
1074         * platform/network/ResourceResponseBase.cpp:
1075         (WebCore::ResourceResponseBase::containsInvalidHTTPHeaders const):
1076         * platform/network/ResourceResponseBase.h:
1077
1078 2020-06-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1079
1080         dataTransfer.types is empty when handling the "dragstart" event
1081         https://bugs.webkit.org/show_bug.cgi?id=212685
1082         <rdar://problem/61368402>
1083
1084         Reviewed by Andy Estes.
1085
1086         Implements several currently stubbed methods on StaticPasteboard, so that the DataTransfer provided to the page
1087         on the "dragstart" event contains the DOM-exposed data types that will be written to the system pasteboard. This
1088         includes "text/html", "text/plain", and "text/uri-list".
1089
1090         Tests:  DragAndDropTests.DataTransferTypesOnDragStartForTextSelection
1091                 DragAndDropTests.DataTransferTypesOnDragStartForImage
1092                 DragAndDropTests.DataTransferTypesOnDragStartForLink
1093
1094         ...as well as several existing tests in DragAndDropTestsIOS.mm that attempt to set pasteboard data during the
1095         dragstart event:
1096
1097                 DragAndDropTests.DataTransferSanitizeHTML
1098                 DragAndDropTests.DataTransferSetDataCannotWritePlatformTypes
1099                 DragAndDropTests.DataTransferSetDataInvalidURL
1100                 DragAndDropTests.DataTransferSetDataUnescapedURL
1101                 DragAndDropTests.DataTransferSetDataValidURL
1102
1103         * dom/DataTransfer.cpp:
1104         (WebCore::DataTransfer::commitToPasteboard):
1105
1106         Only commit data to the native pasteboard if the page actually tried to write or modify the data. This allows us
1107         to preserve existing behavior by allowing DragController to write dragged data to the pasteboard normally in the
1108         case where the page didn't specify any custom data. In the case where the page does specify custom data, we will
1109         write this custom data *in addition* to any default data that was written to the static pasteboard. While this
1110         is a departure from our current behavior (which is to treat the pasteboard as a blank slate that contains only
1111         whatever custom data was provided by the page), it matches behavior in both Chrome and Firefox, and is likely
1112         more compatible with webpages that don't have UA-specific logic targeting WebKit.
1113
1114         * editing/cocoa/EditorCocoa.mm:
1115         (WebCore::Editor::writeSelectionToPasteboard):
1116
1117         Avoid calling into the injected bundle (as well as writing a few particular non-web-exposed types, such as web
1118         archive data) in the case where we're writing to a static pasteboard (there's no point in doing this for the
1119         static pasteboard, and in the worst case, it could confuse some internal clients).
1120
1121         * editing/ios/EditorIOS.mm:
1122         (WebCore::Editor::writeImageToPasteboard): Ditto.
1123         * editing/mac/EditorMac.mm:
1124         (WebCore::Editor::writeImageToPasteboard):
1125
1126         Ditto. But additionally, introduce a markup string to PasteboardImage, so that we will expose the "text/html"
1127         type when starting a drag on an image element.
1128
1129         * page/DragController.cpp:
1130         (WebCore::DragController::startDrag):
1131
1132         Only attempt to call into `Pasteboard::writeTrustworthyWebURLsPboardType` in the case where the pasteboard
1133         supports this type (i.e. on macOS). This fixes an existing assertion that was hit by my new API test, which
1134         attempts to override the contents of the pasteboard with custom data while starting a drag on a link.
1135
1136         * page/EventHandler.cpp:
1137         (WebCore::EventHandler::handleDrag):
1138
1139         Since the StaticPasteboard contains data before the page has written anything, don't use `Pasteboard::hasData()`
1140         to determine whether there's custom data; instead, use the new `hasNonDefaultData()` method on
1141         `StaticPasteboard` (see below).
1142
1143         * platform/Pasteboard.cpp:
1144         (WebCore::Pasteboard::canWriteTrustworthyWebURLsPboardType):
1145
1146         On non-macOS ports, return false.
1147
1148         * platform/Pasteboard.h:
1149         * platform/StaticPasteboard.cpp:
1150         (WebCore::StaticPasteboard::hasNonDefaultData const):
1151
1152         Keep track of whether the page attempted to stage any custom data during "dragstart" by maintaining the set of
1153         types written by the page, via calls to `writeString()` and similar. I'm using a set of types here instead of a
1154         simple `bool` flag to ensure correctness in the case where the page adds a type, and then later removes that
1155         same custom type, such that there is no longer non-default data.
1156
1157         (WebCore::StaticPasteboard::writeString):
1158         (WebCore::StaticPasteboard::writeData):
1159         (WebCore::StaticPasteboard::writeStringInCustomData):
1160         (WebCore::StaticPasteboard::clear):
1161
1162         See above.
1163
1164         (WebCore::StaticPasteboard::writeMarkup):
1165         (WebCore::StaticPasteboard::writePlainText):
1166         (WebCore::StaticPasteboard::write):
1167
1168         Implement these methods by writing to the `PasteboardCustomData`. These methods are invoked by our own code
1169         rather than the bindings, and should only be used to stage default data types when starting a drag.
1170
1171         * platform/StaticPasteboard.h:
1172         * platform/mac/PasteboardMac.mm:
1173         (WebCore::Pasteboard::write):
1174         (WebCore::Pasteboard::canWriteTrustworthyWebURLsPboardType):
1175
1176 2020-06-03  Jer Noble  <jer.noble@apple.com>
1177
1178         Crash with uncaught exception: *** -[AVSampleBufferAudioRenderer enqueueSampleBuffer:] Sample buffer has media type 'vide' instead of 'soun'
1179         https://bugs.webkit.org/show_bug.cgi?id=212646
1180         <rdar://problem/63040834>
1181
1182         Reviewed by Eric Carlson.
1183
1184         Protect against the possibility of AVStreamDataParser generating non-video or -audio samples in an otherwise
1185         video- or audio-track. Check the format description attached to the sample before appending, and ASSERT in
1186         debug builds and ERROR_LOG in release builds, as this is an exceptional condition.
1187
1188         * platform/graphics/FourCC.h:
1189         (WTF::LogArgument<WebCore::FourCC>::toString):
1190         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1191         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
1192
1193 2020-06-03  Kate Cheney  <katherine_cheney@apple.com>
1194
1195         Any active sqlite transactions for the ITP database should be aborted when the network process suspends.
1196         https://bugs.webkit.org/show_bug.cgi?id=212608
1197         <rdar://problem/60540768>
1198
1199         Reviewed by Chris Dumez.
1200
1201         Add WEBCORE_EXPORT macro to use interrupt() function in
1202         ResourceLoadStatisticsDatabaseStore.
1203
1204         * platform/sql/SQLiteDatabase.h:
1205
1206 2020-06-03  Andres Gonzalez  <andresg_22@apple.com>
1207
1208         AX: SVG text node with content is described as "empty group" even if it's not empty
1209         https://bugs.webkit.org/show_bug.cgi?id=210315
1210
1211         Reviewed by Darin Adler.
1212
1213         Test: accessibility/svg-text.html
1214
1215         SVGText elements are conveyed as AXGroups and cannot have a description
1216         or help property, but instead the content of the element is exposed as
1217         static text.
1218
1219         * accessibility/AccessibilitySVGElement.cpp:
1220         (WebCore::AccessibilitySVGElement::accessibilityDescription const):
1221         (WebCore::AccessibilitySVGElement::helpText const):
1222         * accessibility/AccessibilitySVGElement.h:
1223
1224 2020-06-03  Sihui Liu  <sihui_liu@apple.com>
1225
1226         Text manipulation sometimes fails to replace text in attributes
1227         https://bugs.webkit.org/show_bug.cgi?id=212701
1228
1229         Reviewed by Wenson Hsieh.
1230
1231         Concatenate replacement tokens of same identifier for attribute like we do for title and option element in 
1232         r260393.
1233
1234         Covered by test: TextManipulation.CompleteTextManipulationShouldReplaceTextContentWithMultipleTokens
1235
1236         * editing/TextManipulationController.cpp:
1237         (WebCore::TextManipulationController::replace):
1238
1239 2020-06-02  Dean Jackson  <dino@apple.com>
1240
1241         [ macOS ] REGRESSION(r262366): webgl/1.0.3/conformance/canvas/buffer-offscreen-test.html & webgl/2.0.0/conformance/canvas/buffer-offscreen-test.html are constant failures
1242         https://bugs.webkit.org/show_bug.cgi?id=212594
1243         <rdar://problem/63828783>
1244
1245         Reviewed by Eric Carlson.
1246
1247         The change in r262366 split the OpenGL work to prepare a canvas for rendering from the actual painting
1248         (or compositing in this case). Canvas elements were being "prepared" at the end of the HTML run loop
1249         if they'd done anything that would change pixels. The problem is that canvas elements that are not in
1250         the document body are never composited, and thus should never be prepared, otherwise they will clear
1251         their drawing buffer. In other words, a canvas in this state must keep the same buffer through
1252         each rendering frame.
1253
1254         The solution is to check if the canvas is in the tree scope at the time we consider preparing
1255         it for display.
1256
1257         * dom/Document.cpp:
1258         (WebCore::Document::prepareCanvasesForDisplayIfNeeded):
1259
1260 2020-06-03  John Wilander  <wilander@apple.com>
1261
1262         Storage Access API: Add setting for per-page storage access scope
1263         https://bugs.webkit.org/show_bug.cgi?id=212682
1264         <rdar://problem/63904824>
1265
1266         Reviewed by Brent Fulgham.
1267
1268         This is a follow-up patch to https://bugs.webkit.org/show_bug.cgi?id=212114,
1269         adding an off-by-default setting and a test case for per-page storage access.
1270
1271         Test: http/tests/storageAccess/request-and-grant-access-with-per-page-scope-access-from-another-frame.html
1272
1273         * dom/DocumentStorageAccess.cpp:
1274         (WebCore::DocumentStorageAccess::requestStorageAccess):
1275         * page/Settings.yaml:
1276         * testing/InternalSettings.cpp:
1277         (WebCore::InternalSettings::setStorageAccessAPIPerPageScopeEnabled):
1278         * testing/InternalSettings.h:
1279         * testing/InternalSettings.idl:
1280
1281 2020-06-03  Rob Buis  <rbuis@igalia.com>
1282
1283         Make generated C++ code use modern C++
1284         https://bugs.webkit.org/show_bug.cgi?id=190714
1285
1286         Reviewed by Jonathan Bedard.
1287
1288         Replace typedef usage by alias-declaration.
1289
1290         No new tests. No change in behavior.
1291
1292         * css/makeprop.pl:
1293         * dom/make_names.pl:
1294         (printHeaderHead):
1295         (printInit):
1296         (printTypeHelpersHeaderFile):
1297         (printFactoryCppFile):
1298         (printFactoryHeaderFile):
1299         (printWrapperFactoryCppFile):
1300         (printWrapperFactoryHeaderFile):
1301
1302 2020-06-03  Javier Fernandez  <jfernandez@igalia.com>
1303
1304         [css-grid] Dynamically setting "position: absolute" in a grid item doesn't trigger a relayout of that element
1305         https://bugs.webkit.org/show_bug.cgi?id=191465
1306
1307         Reviewed by Manuel Rego Casasnovas.
1308
1309         From Blink r484620 by Sergio Villar <svillar@igalia.com>
1310
1311         Containing block overrides not cleared for position:absolute
1312
1313         Whenever a position:absolute block gets a new containing block the
1314         previously set containing block overrides are not cleared. This causes the
1315         block not to be properly layout for its new containing block (for example
1316         when using relative sizes).
1317
1318         In particular this affects grid items which always get a containing block
1319         override size (which represent the grid areas) in case their
1320         containing block switches from the grid container to a grid ancestor.
1321
1322         No new tests, as this change is covered by current web platform tests.
1323
1324         * rendering/RenderBlock.cpp:
1325         (WebCore::RenderBlock::insertPositionedObject): Clear the containing block's override width and height.
1326
1327 2020-06-03  Youenn Fablet  <youenn@apple.com>
1328
1329         Add more logging related to service worker fetch event handling
1330         https://bugs.webkit.org/show_bug.cgi?id=212632
1331
1332         Reviewed by Chris Dumez.
1333
1334         Add logging related to creating/canceling/deleting fetch event handler related client.
1335         No change of behavior.
1336
1337         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1338         (WebCore::ServiceWorkerThreadProxy::startFetch):
1339         (WebCore::ServiceWorkerThreadProxy::cancelFetch):
1340         (WebCore::ServiceWorkerThreadProxy::removeFetch):
1341
1342 2020-06-02  Yusuke Suzuki  <ysuzuki@apple.com>
1343
1344         ASSERTION FAILED: isCell() under WebCore::JSDOMConstructor seen with webaudio/the-audio-api/the-audiocontext-interface/audiocontextoptions.html
1345         https://bugs.webkit.org/show_bug.cgi?id=212650
1346
1347         Reviewed by Mark Lam.
1348
1349         Some DOM constructor can return jsNull. For example, AudioContext constructor can return jsNull when it exceeds # of hardware audio contexts.
1350         However CodeGeneratorJS assumes that DOM constructor always returns an object, or throws an exception.
1351         This patch adds object check after DOM constructor call to handle the jsNull case while it does not change the existing semantics.
1352
1353         * bindings/scripts/CodeGeneratorJS.pm:
1354         (GenerateConstructorDefinition):
1355
1356 2020-06-02  Simon Fraser  <simon.fraser@apple.com>
1357
1358         EventRegion::translate() needs to offset the wheel event regions
1359         https://bugs.webkit.org/show_bug.cgi?id=212683
1360
1361         Reviewed by Zalan Bujtas.
1362
1363         EventRegion::translate() failed to offset the wheel event regions, which resulted 
1364         in wrong reasons for GraphicsLayers with a non-zero offsetFromRenderer.
1365
1366         Test: fast/scrolling/mac/wheel-event-listener-region-layer-offset.html
1367
1368         * rendering/EventRegion.cpp:
1369         (WebCore::EventRegion::translate):
1370
1371 2020-06-02  Wenson Hsieh  <wenson_hsieh@apple.com>
1372
1373         Add a helper method to populate a DataTransfer before dispatching a "dragstart" event
1374         https://bugs.webkit.org/show_bug.cgi?id=212614
1375         Work towards <rdar://problem/61368402>
1376
1377         Reviewed by Tim Horton.
1378
1379         Add a helper method in DragController to pre-populate the StaticPasteboard-backed DataTransfer before
1380         dispatching the "dragstart" event. There should be no change in behavior yet, since StaticPasteboard doesn't
1381         implement methods for writing data to the pasteboard, which this new method uses.
1382
1383         * page/DragController.cpp:
1384         (WebCore::DragController::prepareForDragStart const):
1385         (WebCore::DragController::hitTestResultForDragStart const):
1386         (WebCore::DragController::startDrag):
1387         * page/DragController.h:
1388         * page/EventHandler.cpp:
1389         (WebCore::EventHandler::dispatchDragStartEventOnSourceElement):
1390
1391 2020-06-02  Andres Gonzalez  <andresg_22@apple.com>
1392
1393         AXIsolatedTree::updateNode should not call nodeForID.
1394         https://bugs.webkit.org/show_bug.cgi?id=212662
1395
1396         Reviewed by Chris Fleizach.
1397
1398         In isolated tree mode AXIsolatedTree::nodeForID should be called only
1399         on the secondary AX thread. So removing the need to call nodeForID in
1400         updateNode by using AXCoreObject::childrenIDs() instead of retrieving
1401         the isolated node to access its children IDs.
1402
1403         * accessibility/isolatedtree/AXIsolatedTree.cpp:
1404         (WebCore::AXIsolatedTree::updateNode):
1405
1406 2020-06-02  Keith Rollin  <krollin@apple.com>
1407
1408         Revert FEATURES_DEFINES related changes
1409         https://bugs.webkit.org/show_bug.cgi?id=212664
1410         <rdar://problem/63893033>
1411
1412         Reviewed by Andy Estes.
1413
1414         Bug 262310, Bug 262311, Bug 262318, and Bug 262331 involve changes to
1415         FEATURE_DEFINES and how the values there relate to those found in the
1416         Platform*.h files. Those changes break XCBuild (by removing the
1417         .xcfilelist related to UnifiedSources and the process for generating
1418         them), and so are being reverted.
1419
1420         No new tests -- build changes.
1421
1422         * Configurations/FeatureDefines.xcconfig:
1423         * Configurations/GenerateUnifiedSources.xcconfig: Added.
1424         * DerivedSources-input.xcfilelist:
1425         * DerivedSources-output.xcfilelist:
1426         * DerivedSources.make:
1427         * Modules/applepay/ApplePayError.idl:
1428         * Modules/applepay/ApplePayPaymentAuthorizationResult.idl:
1429         * Modules/applepay/ApplePayPaymentContact.idl:
1430         * Modules/applepay/ApplePayPaymentMethodUpdate.idl:
1431         * Modules/applepay/ApplePayRequestBase.idl:
1432         * Modules/applepay/ApplePaySession.idl:
1433         * Modules/applepay/ApplePayShippingContactUpdate.idl:
1434         * Modules/applepay/ApplePayShippingMethodUpdate.idl:
1435         * Modules/applepay/PaymentCoordinatorClient.cpp:
1436         (WebCore::PaymentCoordinatorClient::supportsVersion):
1437         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1438         (WebCore::ApplePayPaymentHandler::computePaymentMethodErrors const):
1439         * Scripts/generate-unified-sources.sh:
1440         * UnifiedSources-output.xcfilelist: Added.
1441         * WebCore.xcodeproj/project.pbxproj:
1442         * accessibility/AccessibilityRenderObject.cpp:
1443         (WebCore::AccessibilityRenderObject::applePayButtonDescription const):
1444         * css/CSSPrimitiveValueMappings.h:
1445         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1446         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const):
1447         * css/CSSValueKeywords.in:
1448         * css/parser/CSSParserFastPaths.cpp:
1449         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
1450         * rendering/RenderThemeCocoa.mm:
1451         (WebCore::toPKPaymentButtonType):
1452         * rendering/style/RenderStyleConstants.cpp:
1453         (WebCore::operator<<):
1454         * rendering/style/RenderStyleConstants.h:
1455
1456 2020-06-02  Ryan Haddad  <ryanhaddad@apple.com>
1457
1458         Unreviewed, reverting r262424.
1459
1460         Caused webkitpy test failure
1461
1462         Reverted changeset:
1463
1464         "Make generated C++ code use modern C++"
1465         https://bugs.webkit.org/show_bug.cgi?id=190714
1466         https://trac.webkit.org/changeset/262424
1467
1468 2020-06-02  Peng Liu  <peng.liu6@apple.com>
1469
1470         Stressing webkitSetPresentationMode leads to wrong inline video dimensions
1471         https://bugs.webkit.org/show_bug.cgi?id=202425
1472
1473         Reviewed by Eric Carlson.
1474
1475         Make the HTMLVideoElement::setFullscreenMode() robust under stress tests
1476         by ignoring a request when the video element is not ready yet.
1477
1478         Manually tested.
1479
1480         * dom/Element.h:
1481         (WebCore::Element::didStopBeingFullscreenElement):
1482         Add a callback to indicate that the element has exited fullscreen.
1483         * dom/FullscreenManager.cpp:
1484         (WebCore::FullscreenManager::didExitFullscreen):
1485         Call Element::didStopBeingFullscreenElement() when the element has exited fullscreen.
1486
1487         * html/HTMLMediaElement.cpp:
1488         (WebCore::HTMLMediaElement::enterFullscreen):
1489         * html/HTMLMediaElement.h:
1490
1491         * html/HTMLVideoElement.cpp:
1492         (WebCore::HTMLVideoElement::webkitDisplayingFullscreen):
1493         This function will return true when a video element is in the process to exit
1494         fullscreen/picture-in-picture until it has completed the process. Therefore, a page
1495         can safely request the video element to enter fullscreen/picture-in-picture when
1496         this function returns false.
1497
1498         (WebCore::HTMLVideoElement::setFullscreenMode):
1499         (WebCore::HTMLVideoElement::didBecomeFullscreenElement):
1500         (WebCore::HTMLVideoElement::didStopBeingFullscreenElement):
1501         (WebCore::HTMLVideoElement::didEnterFullscreen): Deleted.
1502         (WebCore::HTMLVideoElement::didExitFullscreen): Deleted.
1503         * html/HTMLVideoElement.h:
1504         Add a flag m_isChangingPresentationMode. webkitSetPresentationMode() will only
1505         change the presentation mode when the flag is false.
1506
1507 2020-06-01  Simon Fraser  <simon.fraser@apple.com>
1508
1509         Add ENABLE(WHEEL_EVENT_REGIONS), enabled on macOS which is the only platform that needs wheel event regions for scrolling thread hit-testing
1510         https://bugs.webkit.org/show_bug.cgi?id=212620
1511
1512         Reviewed by Tim Horton.
1513
1514         Surround code related to wheel event regions with ENABLE(WHEEL_EVENT_REGIONS).
1515
1516         Eventually we'll use this same code for touch event regions, and when we do, we
1517         can rejigger the #ifdefs.
1518
1519         * rendering/EventRegion.cpp:
1520         (WebCore::EventRegion::operator== const):
1521         (WebCore::EventRegion::unite):
1522         (WebCore::EventRegion::containsEditableElementsInRect const):
1523         (WebCore::EventRegion::dump const):
1524         * rendering/EventRegion.h:
1525         * rendering/RenderLayerBacking.cpp:
1526         (WebCore::RenderLayerBacking::paintDebugOverlays):
1527
1528 2020-06-02  Andres Gonzalez  <andresg_22@apple.com>
1529
1530         Avoid calling axBackingObject multiple times in [WebAccessibilityObjectWrapper roleDescription].
1531         https://bugs.webkit.org/show_bug.cgi?id=212643
1532
1533         Reviewed by Chris Fleizach.
1534
1535         No new functionality.
1536
1537         Avoid unnecessary overhead of calling axBackingObject multiple times in
1538         roleDescription. axBackingObject is not just a getter but involves
1539         checking whether isolated tree mode is enabled.
1540
1541         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1542         (-[WebAccessibilityObjectWrapper subrole]):
1543         (-[WebAccessibilityObjectWrapper roleDescription]):
1544
1545 2020-06-02  Tetsuharu Ohzeki  <tetsuharu.ohzeki@gmail.com>
1546
1547         Pass nullptr for the 2nd argument of FileReaderLoader 
1548         https://bugs.webkit.org/show_bug.cgi?id=212642
1549
1550         Reviewed by Darin Adler.
1551
1552         Instead of passing `0`, `nullptr` is better
1553         because `FileReaderLoader` takes a pointer.
1554
1555         * fileapi/FileReaderSync.cpp:
1556         (WebCore::FileReaderSync::readAsArrayBuffer):
1557         (WebCore::FileReaderSync::readAsBinaryString):
1558         (WebCore::FileReaderSync::readAsText):
1559         (WebCore::FileReaderSync::readAsDataURL):
1560
1561 2020-06-02  Tim Horton  <timothy_horton@apple.com>
1562
1563         UIColor and NSColor WebCore::Color factories should return invalid colors for nil input colors
1564         https://bugs.webkit.org/show_bug.cgi?id=212631
1565
1566         Reviewed by Anders Carlsson.
1567
1568         * platform/graphics/mac/ColorMac.mm:
1569         (WebCore::colorFromNSColor):
1570         (WebCore::semanticColorFromNSColor):
1571         * platform/ios/ColorIOS.mm:
1572         (WebCore::colorFromUIColor):
1573         This doesn't affect any code currently in WebKit, but it is very, very surprising
1574         that these functions happily accept a null color, assert in debug, but in release
1575         do crazy things like try to paint the null color into a small bitmap to figure out
1576         what it really is.
1577
1578         Also, this matches the behavior of the Color constructors that take CGColorRef.
1579
1580 2020-06-02  Rob Buis  <rbuis@igalia.com>
1581
1582         Make generated C++ code use modern C++
1583         https://bugs.webkit.org/show_bug.cgi?id=190714
1584
1585         Reviewed by Sam Weinig.
1586
1587         Replace typedef usage by alias-declaration.
1588
1589         No new tests. No change in behavior.
1590
1591         * css/makeprop.pl:
1592         * dom/make_names.pl:
1593         (printHeaderHead):
1594         (printInit):
1595         (printTypeHelpersHeaderFile):
1596         (printFactoryCppFile):
1597         (printFactoryHeaderFile):
1598         (printWrapperFactoryCppFile):
1599         (printWrapperFactoryHeaderFile):
1600
1601 2020-06-02  Tetsuharu Ohzeki  <tetsuharu.ohzeki@gmail.com>
1602
1603         Remove unused BlobURL::getIdentifier
1604         https://bugs.webkit.org/show_bug.cgi?id=212635
1605
1606         Reviewed by Youenn Fablet.
1607
1608         * fileapi/BlobURL.cpp:
1609         * fileapi/BlobURL.h:
1610
1611 2020-06-02  Mark Lam  <mark.lam@apple.com>
1612
1613         Fix broken Windows build.
1614         https://bugs.webkit.org/show_bug.cgi?id=212633
1615
1616         Reviewed by Yusuke Suzuki.
1617
1618         * html/HTMLCanvasElement.cpp:
1619         (WebCore::HTMLCanvasElement::needsPreparationForDisplay):
1620         (WebCore::HTMLCanvasElement::prepareForDisplay):
1621
1622 2020-06-02  Youenn Fablet  <youenn@apple.com>
1623
1624         Add some logging to ServiceWorkerThread to track install/activate event handling
1625         https://bugs.webkit.org/show_bug.cgi?id=212523
1626
1627         Reviewed by Chris Dumez.
1628
1629         Add some logging for firing install/activate events and when these events are handled.
1630         No change of behavior.
1631
1632         * workers/service/context/ServiceWorkerThread.cpp:
1633         (WebCore::ServiceWorkerThread::queueTaskToFireInstallEvent):
1634         (WebCore::ServiceWorkerThread::queueTaskToFireActivateEvent):
1635
1636 2020-06-02  Carlos Garcia Campos  <cgarcia@igalia.com>
1637
1638         [GTK4] Make popup menus work
1639         https://bugs.webkit.org/show_bug.cgi?id=211178
1640
1641         Reviewed by Adrian Perez de Castro.
1642
1643         * platform/gtk/GtkVersioning.h:
1644         (gtk_tree_view_column_cell_get_size):
1645
1646 2020-06-01  Sergio Villar Senin  <svillar@igalia.com>
1647
1648         [css-flexbox] ChildIntrinsicLogicalWidth should use fit-content, not max-content
1649         https://bugs.webkit.org/show_bug.cgi?id=210465
1650
1651         Reviewed by Javier Fernandez.
1652
1653         When computing the hypothetical cross size of each item in the flexbox algorithm
1654         the current code was using the max-size. However the specs state clearly that we
1655         should use fit-content instead, i.e., the shrink-to-fit size.
1656         See https://drafts.csswg.org/css-flexbox/#algo-cross-item.
1657
1658         Based on Blink's crrev.com/1327746 by <cbiesinger@chromium.org>
1659
1660         * rendering/RenderFlexibleBox.cpp:
1661         (WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth const): Use the shrink-to-fit
1662         size instead just the max-size.
1663
1664 2020-06-02  Youenn Fablet  <youenn@apple.com>
1665
1666         MediaPlayerPrivateMediaStreamAVFObjC should enqueue samples in a background thread
1667         https://bugs.webkit.org/show_bug.cgi?id=212073
1668
1669         Reviewed by Eric Carlson.
1670
1671         Do not hop to the main thread when rendering video samples anymore.
1672         Instead, we enqueue to the display layer in the background thread but still hop to the main thread for two things:
1673         - Update of various states of the player
1674         - keep a ref to the video sample if canvas rendering is needed.
1675
1676         Most display layer operations stay in the main thread (creation, flushing...).
1677         Deletion of the display layer and access from a background are covered by a lock.
1678         The m_canEnqueueDisplayLayer boolean ensures we do not enqueue too early when the display layer is not yet properly initialized.
1679
1680         LocalSampleBufferDisplayLayer needs to handle the fact that enqueueing might be done in a background thread.
1681         Instead of introducing a lock, we introduce a work queue and we hop to this queue whenever we need to enqueue/mutate the pending samples.
1682
1683         Covered by existing tests and manual testing.
1684
1685         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h:
1686         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:
1687         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
1688         (WebCore::LocalSampleBufferDisplayLayer::enqueueSample):
1689         (WebCore::LocalSampleBufferDisplayLayer::enqueueSampleBuffer):
1690         (WebCore::LocalSampleBufferDisplayLayer::requestNotificationWhenReadyForVideoData):
1691         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1692         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1693         (WebCore::videoTransformationMatrix):
1694         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::processNewVideoSampleAvailable):
1695         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable):
1696         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive):
1697         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::flushRenderers):
1698         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
1699         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
1700         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateRenderingMode):
1701         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack):
1702         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paintCurrentFrameInContext):
1703         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setBufferingPolicy):
1704         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rootLayerBoundsDidChange):
1705         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoTransformationMatrix): Deleted.
1706         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueCorrectedVideoSample): Deleted.
1707         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayLayer): Deleted.
1708
1709 2020-06-02  Youenn Fablet  <youenn@apple.com>
1710
1711         [ Mac wk2 ] http/wpt/service-workers/service-worker-spinning-fetch.https.html is flaky failing.
1712         https://bugs.webkit.org/show_bug.cgi?id=207515
1713         <rdar://problem/59329307>
1714
1715         Reviewed by Chris Dumez.
1716
1717         When a service worker is terminated, we remove it from the map in SWContextManager.
1718         Shortly after a new service worker may be added to the map.
1719         In that case, previously, we were potentially trying to decrement the message count of the old service worker thread, which is confusing the new service worker thread.
1720         Instead, use WeakPtr to decrement if the service worker thread is still valid.
1721         Covered by existing tests.
1722
1723         * workers/service/context/ServiceWorkerThread.cpp:
1724         (WebCore::ServiceWorkerThread::queueTaskToPostMessage):
1725         (WebCore::ServiceWorkerThread::queueTaskToFireInstallEvent):
1726         (WebCore::ServiceWorkerThread::queueTaskToFireActivateEvent):
1727         (WebCore::ServiceWorkerThread::start):
1728         * workers/service/context/ServiceWorkerThread.h:
1729
1730 2020-06-01  Myles C. Maxfield  <mmaxfield@apple.com>
1731
1732         [WebGPU] Update texture creation validation according to the discussion at https://github.com/gpuweb/gpuweb/pull/799/files
1733         https://bugs.webkit.org/show_bug.cgi?id=212390
1734
1735         Reviewed by Dean Jackson.
1736
1737         Two new rules: Multisampled textures can't have the STORAGE flag, and sampleCount must be either 1 or 4.
1738
1739         Test: webgpu/texture-creation.html
1740
1741         * platform/graphics/gpu/GPUDevice.cpp:
1742         (WebCore::GPUDevice::tryCreateTexture const):
1743
1744 2020-06-01  Noam Rosenthal  <noam@webkit.org>
1745
1746         Make unicode-bidi:isolate the default for an element with a dir attribute (instead of unicode-bidi:embed)
1747         https://bugs.webkit.org/show_bug.cgi?id=134630
1748
1749         Reviewed by Simon Fraser.
1750
1751         Unskipped 11 dir-isolation w3c tests.
1752
1753         * html/HTMLElement.cpp:
1754         (WebCore::HTMLElement::collectStyleForPresentationAttribute):
1755                 Use isolate instead of embed for unicode-bidi when dir attribute is present.
1756
1757 2020-06-01  Devin Rousso  <drousso@apple.com>
1758
1759         Web Inspector: Graphics: should use the `id` (name) of the animation if it exists
1760         https://bugs.webkit.org/show_bug.cgi?id=212618
1761
1762         Reviewed by Timothy Hatcher.
1763
1764         Test: inspector/animation/lifecycle-css-animation.html:
1765               inspector/animation/lifecycle-css-transition.html:
1766               inspector/animation/lifecycle-web-animation.html:
1767               inspector/animation/nameChanged.html
1768
1769         * animation/WebAnimation.h:
1770         (WebCore::WebAnimation::setId): Deleted.
1771         * animation/WebAnimation.cpp:
1772         (WebCore::WebAnimation::setId): Added.
1773
1774         * inspector/InspectorInstrumentation.h:
1775         (WebCore::InspectorInstrumentation::didChangeWebAnimationName): Added.
1776         * inspector/InspectorInstrumentation.cpp:
1777         (WebCore::InspectorInstrumentation::didChangeWebAnimationNameImpl): Added.
1778
1779         * inspector/agents/InspectorAnimationAgent.h:
1780         * inspector/agents/InspectorAnimationAgent.cpp:
1781         (WebCore::InspectorAnimationAgent::didChangeWebAnimationName): Added.
1782         (WebCore::InspectorAnimationAgent::bindAnimation):
1783
1784 2020-06-01  Andres Gonzalez  <andresg_22@apple.com>
1785
1786         [WebAccessibilityObjectWrapper subrole] should check for the nullity of the underlying AXCoreObject before dereferencing.
1787         https://bugs.webkit.org/show_bug.cgi?id=212607
1788
1789         Reviewed by Chris Fleizach.
1790
1791         Covered by existing tests.
1792
1793         - Check for nullity of the backingObject before dereferencing.
1794         - self.axBackingObject is now called only once, instead of many times unnecessarily.
1795
1796         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1797         (-[WebAccessibilityObjectWrapper subrole]):
1798
1799 2020-06-01  Sihui Liu  <sihui_liu@apple.com>
1800
1801         TextManipulationController should put one Node in only one paragraph
1802         https://bugs.webkit.org/show_bug.cgi?id=212548
1803
1804         Reviewed by Wenson Hsieh.
1805
1806         TextManipulationController mainly uses line break as delimiter to split paragraphs. In our current 
1807         implementation, if text of a Node has line break, the part before the line break is in one paragraph and the
1808         part after the line break is in another paragraph, which means the Node is in the ranges of two paragraphs.
1809         In this case, when TextManipulationController manipulates the first paragraph, it replaces all the Nodes in the 
1810         range of first paragraph with new Nodes. Then when it manipulates the second paragraph, if will find Node in the
1811         range of second paragraph does not exist and fail (because the Node is removed when handling the first 
1812         paragraph.). Also, TextManipulationController currently does not preserve line breaks in text, which can be an
1813         issue if these line breaks are visible. 
1814
1815         This patch makes the ParagraphContentIterator iterate over Nodes instead of text, so a Node can only be in the 
1816         range of one paragraph. To do this, it makes line break and spaces around it as a special excluded token.
1817         Here are the rules for splitting paragraphs by line break now:
1818         1. If the special token is the first token in a Node, text in Nodes before the Node will make a paragraph. 
1819         2. If the special token is the last token in a Node, text in Nodes before the Node and in the Node will make a 
1820         paragraph.
1821         3. If the special token in the middle of tokens in a Node, then we don't make a new paragraph until next special
1822         token meets condition 1 or 2.
1823
1824         This patch also fixes the issue that Nodes out of the paragraph range can be removed due to the preorder Node
1825         traversal, by finding and adding those Nodes back.
1826
1827         * editing/TextManipulationController.cpp:
1828         (WebCore::ParagraphContentIterator::m_pastEndNode):
1829         (WebCore::ParagraphContentIterator::advance):
1830         (WebCore::ParagraphContentIterator::currentContent):
1831         (WebCore::ParagraphContentIterator::atEnd const):
1832         (WebCore::ParagraphContentIterator::advanceNode):
1833         (WebCore::ParagraphContentIterator::advanceIteratorNodeAndUpdateText):
1834         (WebCore::isEnclosingItemBoundaryElement):
1835         (WebCore::TextManipulationController::parse):
1836         (WebCore::TextManipulationController::observeParagraphs):
1837         (WebCore::TextManipulationController::addItem):
1838         (WebCore::TextManipulationController::getPath):
1839         (WebCore::TextManipulationController::updateInsertions):
1840         (WebCore::TextManipulationController::replace):
1841         (WebCore::ParagraphContentIterator::startPosition): Deleted.
1842         (WebCore::ParagraphContentIterator::endPosition): Deleted.
1843         (WebCore::ParagraphContentIterator::moveCurrentNodeForward): Deleted.
1844         (WebCore::containsOnlyHTMLSpaces): Deleted.
1845         * editing/TextManipulationController.h:
1846
1847 2020-06-01  David Kilzer  <ddkilzer@apple.com>
1848
1849         Don't use casts to convert between WebCore::DragDestinationAction and {Web,WK}DragDestinationAction types
1850         <https://webkit.org/b/212507>
1851
1852         Reviewed by Darin Adler.
1853
1854         * page/DragActions.h:
1855         (WebCore::anyDragDestinationAction): Add.
1856         (WebCore::DragDestinationActionAny): Delete.
1857         - Rename DragDestinationActionAny() to
1858           anyDragDestinationAction() to match WebKit style.
1859         * platform/DragData.h:
1860         - Update to use anyDragDestinationAction().
1861
1862 2020-06-01  Simon Fraser  <simon.fraser@apple.com>
1863
1864         Add ENABLE(TOUCH_ACTION_REGIONS) to wrap code that's only relevant for platforms that consult touch-action for event handling
1865         https://bugs.webkit.org/show_bug.cgi?id=212572
1866
1867         Reviewed by Andy Estes.
1868
1869         This will allow for optimizations in event region painting without ambiguity.
1870
1871         * dom/Document.h:
1872         * page/Frame.cpp:
1873         (WebCore::Frame::invalidateContentEventRegionsIfNeeded):
1874         * page/scrolling/ScrollingTreeNode.h:
1875         * rendering/EventRegion.cpp:
1876         (WebCore::EventRegion::operator== const):
1877         (WebCore::EventRegion::unite):
1878         (WebCore::EventRegion::translate):
1879         (WebCore::EventRegion::dump const):
1880         * rendering/EventRegion.h:
1881         (WebCore::EventRegion::encode const):
1882         (WebCore::EventRegion::decode):
1883         * rendering/RenderBlock.cpp:
1884         (WebCore::RenderBlock::paintObject):
1885         * rendering/RenderElement.cpp:
1886         (WebCore::RenderElement::styleWillChange):
1887         * rendering/RenderLayerBacking.cpp:
1888         (WebCore::RenderLayerBacking::maintainsEventRegion const):
1889         (WebCore::RenderLayerBacking::paintDebugOverlays):
1890         * style/StyleTreeResolver.cpp:
1891         (WebCore::Style::TreeResolver::resolveElement):
1892
1893 2020-06-01  Tetsuharu Ohzeki  <tetsuharu.ohzeki@gmail.com>
1894
1895         Implement ParentNode.prototype.replaceChildren
1896         https://bugs.webkit.org/show_bug.cgi?id=198578
1897
1898         Reviewed by Darin Adler.
1899
1900         Ideally, we can use `ContainerNode::replaceAllChildren` to implement
1901         this simply but the current of it does not have a path to support
1902         `DocumentFragment`.
1903
1904         Hence, we call related methods from `ParentNode.prototype.replaceChildren` directly.
1905
1906         * dom/ContainerNode.cpp:
1907         (WebCore::ContainerNode::replaceChildren):
1908         * dom/ContainerNode.h:
1909         * dom/ParentNode.idl:
1910
1911 2020-05-25  Sergio Villar Senin  <svillar@igalia.com>
1912
1913         [css-flexbox] Tables as flex items should obey the flex container sizing
1914         https://bugs.webkit.org/show_bug.cgi?id=212355
1915
1916         Reviewed by Manuel Rego Casasnovas.
1917
1918         For most of the boxes, "width:auto" means use all the available space from your container in the inline
1919         direction. This means that a flex container does not need to do anything in particular to stretch them
1920         in the inline axis. However that is not true for tables because their width mostly depend on the sum of
1921         the sizes of their columns (whichever algorithm is used). That's why the layout code of tables should
1922         check whether or not it has an override for the content logical width which is the way flexbox uses to
1923         stretch flex items (and use that override width).
1924
1925         * rendering/RenderTable.cpp:
1926         (WebCore::RenderTable::updateLogicalWidth): Stretch till overrideContentLogicalWidth() if needed.
1927
1928 2020-06-01  Sam Weinig  <weinig@apple.com>
1929
1930         Extended Color: Replace Color constructors taking numeric values with type specific factory functions
1931         https://bugs.webkit.org/show_bug.cgi?id=212576
1932
1933         Reviewed by Tim Horton.
1934
1935         Replaces all remaining implicit and explicit uses of the Color constructors taking numeric
1936         values with explicit calls to makeSimpleColor/makeSimpleColorFromFloats/makeExtendedColor,
1937         giving us a consistent way to create colors. Also addes use constexpr SimpleColors where possible.
1938
1939         * accessibility/isolatedtree/AXIsolatedObject.cpp:
1940         (WebCore::AXIsolatedObject::initializeAttributeData):
1941         * css/CSSValuePool.cpp:
1942         (WebCore::StaticCSSValuePool::StaticCSSValuePool):
1943         * css/parser/CSSPropertyParserHelpers.cpp:
1944         (WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
1945         * html/HTMLInputElement.cpp:
1946         (WebCore::HTMLInputElement::createInnerTextStyle):
1947         * html/canvas/CanvasRenderingContext2DBase.cpp:
1948         (WebCore::CanvasRenderingContext2DBase::shadowColor const):
1949         (WebCore::CanvasRenderingContext2DBase::setShadow):
1950         * html/canvas/CanvasStyle.cpp:
1951         (WebCore::CanvasStyle::CanvasStyle):
1952         (WebCore::CanvasStyle::isEquivalentRGBA const):
1953         * inspector/InspectorOverlay.cpp:
1954         (WebCore::drawOutlinedQuadWithClip):
1955         (WebCore::drawShapeHighlight):
1956         (WebCore::InspectorOverlay::paint):
1957         (WebCore::InspectorOverlay::drawPaintRects):
1958         (WebCore::InspectorOverlay::drawBounds):
1959         (WebCore::InspectorOverlay::drawRulers):
1960         (WebCore::InspectorOverlay::drawElementTitle):
1961         * inspector/agents/InspectorDOMAgent.cpp:
1962         (WebCore::parseColor):
1963         * layout/integration/LayoutIntegrationLineLayout.cpp:
1964         (WebCore::LayoutIntegration::LineLayout::debugTextShadow):
1965         * page/CaptionUserPreferencesMediaAF.cpp:
1966         (WebCore::CaptionUserPreferencesMediaAF::captionsBackgroundCSS const):
1967         * page/DebugPageOverlays.cpp:
1968         (WebCore::touchEventRegionColors):
1969         (WebCore::NonFastScrollableRegionOverlay::drawRect):
1970         * page/FrameView.cpp:
1971         (WebCore::FrameView::paintContents):
1972         * page/PrintContext.cpp:
1973         (WebCore::PrintContext::spoolAllPagesWithBoundaries):
1974         * page/linux/ResourceUsageOverlayLinux.cpp:
1975         (WebCore::ResourceUsageOverlay::platformInitialize):
1976         * platform/graphics/BitmapImage.cpp:
1977         (WebCore::BitmapImage::draw):
1978         * platform/graphics/Color.cpp:
1979         (WebCore::Color::light const):
1980         (WebCore::Color::dark const):
1981         (WebCore::Color::blendWithWhite const):
1982         (WebCore::Color::colorWithAlphaMultipliedBy const):
1983         (WebCore::Color::colorWithAlphaMultipliedByUsingAlternativeRounding const):
1984         (WebCore::Color::colorWithAlpha const):
1985         (WebCore::Color::colorWithAlphaUsingAlternativeRounding const):
1986         (WebCore::blendWithoutPremultiply):
1987         (WebCore::extendedColorsEqual): Deleted.
1988         (WebCore::Color::tagAsValid): Deleted.
1989         * platform/graphics/Color.h:
1990         (WebCore::Color::Color):
1991         (WebCore::Color::tagAsSemantic):
1992         (WebCore::Color::tagAsValid):
1993         (WebCore::extendedColorsEqual):
1994         (WebCore::Color::decode):
1995         (WebCore::Color::setIsSemantic): Deleted.
1996         * platform/graphics/ExtendedColor.cpp:
1997         (WebCore::makeExtendedColor):
1998         * platform/graphics/ExtendedColor.h:
1999         (WebCore::ExtendedColor::ExtendedColor):
2000         (): Deleted.
2001         * platform/graphics/GraphicsLayer.cpp:
2002         (WebCore::GraphicsLayer::getDebugBorderInfo const):
2003         * platform/graphics/ca/GraphicsLayerCA.cpp:
2004         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
2005         (WebCore::contentsLayerDebugBorderColor):
2006         (WebCore::cloneLayerDebugBorderColor):
2007         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
2008         * platform/graphics/ca/PlatformCALayer.cpp:
2009         (WebCore::PlatformCALayer::drawRepaintIndicator):
2010         * platform/graphics/ca/TileCoverageMap.cpp:
2011         (WebCore::TileCoverageMap::TileCoverageMap):
2012         (WebCore::TileCoverageMap::update):
2013         * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
2014         (PlatformCALayerWinInternal::drawRepaintCounters):
2015         * platform/graphics/cairo/GradientCairo.cpp:
2016         (WebCore::interpolateColorStop):
2017         * platform/graphics/cg/ColorCG.cpp:
2018         (WebCore::Color::Color):
2019         * platform/graphics/cg/NativeImageCG.cpp:
2020         (WebCore::nativeImageSinglePixelSolidColor):
2021         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
2022         (WebCore::colorForMarkerLineStyle):
2023         * platform/graphics/filters/FilterOperation.cpp:
2024         (WebCore::DropShadowFilterOperation::blend):
2025         * platform/graphics/mac/ColorMac.mm:
2026         (WebCore::colorFromNSColor):
2027         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
2028         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
2029         * platform/ios/DragImageIOS.mm:
2030         (WebCore::createDragImageForLink):
2031         * platform/ios/LegacyTileCache.mm:
2032         (WebCore::LegacyTileCache::colorForGridTileBorder const):
2033         * platform/win/DragImageWin.cpp:
2034         (WebCore::createDragImageForLink):
2035         * rendering/PaintInfo.h:
2036         (WebCore::PaintInfo::forcedTextColor const):
2037         * rendering/RenderEmbeddedObject.cpp:
2038         (WebCore::RenderEmbeddedObject::paintReplaced):
2039         (WebCore::replacementTextRoundedRectPressedColor): Deleted.
2040         (WebCore::replacementTextRoundedRectColor): Deleted.
2041         (WebCore::replacementTextColor): Deleted.
2042         (WebCore::unavailablePluginBorderColor): Deleted.
2043         * rendering/RenderFrameSet.cpp:
2044         (WebCore::RenderFrameSet::paintColumnBorder):
2045         (WebCore::RenderFrameSet::paintRowBorder):
2046         (WebCore::borderStartEdgeColor): Deleted.
2047         (WebCore::borderEndEdgeColor): Deleted.
2048         (WebCore::borderFillColor): Deleted.
2049         * rendering/RenderLayer.cpp:
2050         (WebCore::RenderLayer::beginTransparencyLayers):
2051         * rendering/RenderLayerBacking.cpp:
2052         (WebCore::RenderLayerBacking::paintDebugOverlays):
2053         * rendering/RenderTheme.cpp:
2054         (WebCore::RenderTheme::platformActiveSelectionBackgroundColor const):
2055         (WebCore::RenderTheme::platformInactiveSelectionBackgroundColor const):
2056         (WebCore::RenderTheme::platformTextSearchHighlightColor const):
2057         (WebCore::RenderTheme::paintSystemPreviewBadge):
2058         (WebCore::RenderTheme::platformTapHighlightColor const):
2059         * rendering/RenderTheme.h:
2060         (WebCore::RenderTheme::platformFocusRingColor const):
2061         * rendering/RenderThemeIOS.h:
2062         * rendering/RenderThemeIOS.mm:
2063         (WebCore::RenderThemeIOS::paintCheckboxDecorations):
2064         (WebCore::RenderThemeIOS::paintRadioDecorations):
2065         (WebCore::RenderThemeIOS::paintMenuListButtonDecorations):
2066         (WebCore::RenderThemeIOS::paintSliderTrack):
2067         (WebCore::RenderThemeIOS::paintProgressBar):
2068         (WebCore::paintAttachmentProgress):
2069         (WebCore::paintAttachmentBorder):
2070         (WebCore::RenderThemeIOS::paintSystemPreviewBadge):
2071         (WebCore::RenderThemeIOS::shadowColor const): Deleted.
2072         (WebCore::attachmentBorderColor): Deleted.
2073         (WebCore::attachmentProgressColor): Deleted.
2074         * rendering/RenderThemeMac.mm:
2075         (WebCore::RenderThemeMac::paintMenuListButtonDecorations):
2076         (WebCore::titleTextColorForAttachment):
2077         (WebCore::AttachmentLayout::layOutSubtitle):
2078         (WebCore::paintAttachmentIconBackground):
2079         (WebCore::paintAttachmentTitleBackground):
2080         (WebCore::paintAttachmentProgress):
2081         (WebCore::paintAttachmentPlaceholderBorder):
2082         (WebCore::attachmentIconBackgroundColor): Deleted.
2083         (WebCore::attachmentIconBorderColor): Deleted.
2084         (WebCore::attachmentTitleInactiveBackgroundColor): Deleted.
2085         (WebCore::attachmentTitleInactiveTextColor): Deleted.
2086         (WebCore::attachmentSubtitleTextColor): Deleted.
2087         (WebCore::attachmentProgressBarBackgroundColor): Deleted.
2088         (WebCore::attachmentProgressBarFillColor): Deleted.
2089         (WebCore::attachmentProgressBarBorderColor): Deleted.
2090         (WebCore::attachmentPlaceholderBorderColor): Deleted.
2091         * rendering/RenderThemeWin.cpp:
2092         (WebCore::RenderThemeWin::platformActiveSelectionBackgroundColor const):
2093         (WebCore::RenderThemeWin::platformInactiveSelectionBackgroundColor const):
2094         (WebCore::RenderThemeWin::platformActiveSelectionForegroundColor const):
2095         (WebCore::RenderThemeWin::systemColor const):
2096         * rendering/SimpleLineLayoutFunctions.cpp:
2097         (WebCore::SimpleLineLayout::paintFlow):
2098         * rendering/mathml/RenderMathMLBlock.cpp:
2099         (WebCore::RenderMathMLBlock::paint):
2100         * rendering/style/RenderStyle.cpp:
2101         (WebCore::RenderStyle::colorResolvingCurrentColor const):
2102         * rendering/style/RenderStyle.h:
2103         (WebCore::RenderStyle::initialStrokeColor):
2104         * rendering/style/SVGRenderStyle.h:
2105         (WebCore::SVGRenderStyle::initialStopColor):
2106         (WebCore::SVGRenderStyle::initialFloodColor):
2107         (WebCore::SVGRenderStyle::initialLightingColor):
2108         * svg/SVGStopElement.cpp:
2109         (WebCore::SVGStopElement::stopColorIncludingOpacity const):
2110         * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
2111         (WebCore::SVGAnimationColorFunction::animate):
2112         * testing/MockPageOverlayClient.cpp:
2113         (WebCore::MockPageOverlayClient::drawRect):
2114         * testing/cocoa/WebViewVisualIdentificationOverlay.mm:
2115         (-[WebViewVisualIdentificationOverlay initWithWebView:kind:deprecated:]):
2116
2117 2020-06-01  Per Arne Vollan  <pvollan@apple.com>
2118
2119         [Win] When GraphicsLayerCA::m_uncommittedChanges is initialized with a non-zero value, nothing is painted.
2120         https://bugs.webkit.org/show_bug.cgi?id=168666
2121
2122         Reviewed by Maciej Stachowiak.
2123
2124         When m_uncommittedChanges is initialized with a non-zero value, client().notifyFlushRequired() will not be
2125         called in the first call to noteLayerPropertyChanged(), see https://bugs.webkit.org/show_bug.cgi?id=64808.
2126
2127         Covered by existing tests.
2128
2129         * platform/graphics/ca/GraphicsLayerCA.cpp:
2130         (WebCore::GraphicsLayerCA::initialize):
2131         * platform/graphics/ca/GraphicsLayerCA.h:
2132
2133 2020-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
2134
2135         [GTK4] Add printing support
2136         https://bugs.webkit.org/show_bug.cgi?id=212320
2137
2138         Reviewed by Adrian Perez de Castro.
2139
2140         Add gtk_dialog_run() to GTK4.
2141
2142         * platform/gtk/GtkVersioning.h:
2143         (gtk_dialog_run):
2144
2145 2020-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
2146
2147         [GTK4] Make inspector work
2148         https://bugs.webkit.org/show_bug.cgi?id=212321
2149
2150         Reviewed by Adrian Perez de Castro.
2151
2152         Add gtk_native_dialog_run() for GTK4.
2153
2154         * platform/gtk/GtkVersioning.h:
2155         (gtk_native_dialog_run):
2156
2157 2020-06-01  Rob Buis  <rbuis@igalia.com>
2158
2159         Rename ResourceResponseBase::isHTTP to isInHTTPFamily
2160         https://bugs.webkit.org/show_bug.cgi?id=208782
2161
2162         Reviewed by Sam Weinig.
2163
2164         As the comment says, the method name is misleading and the method
2165         is inconsistent with the API of ResourceRequestBase, so rename it
2166         to make it clear the method can be used for both http and https
2167         protocols.
2168
2169         No tests since no change in behavior.
2170
2171         * loader/DocumentLoader.cpp:
2172         (WebCore::DocumentLoader::continueAfterContentPolicy):
2173         * loader/NetscapePlugInStreamLoader.cpp:
2174         (WebCore::NetscapePlugInStreamLoader::didReceiveResponse):
2175         * platform/network/ResourceResponseBase.cpp:
2176         (WebCore::ResourceResponseBase::isInHTTPFamily const):
2177         (WebCore::ResourceResponseBase::isHTTP const): Deleted.
2178         * platform/network/ResourceResponseBase.h:
2179         * xml/XMLHttpRequest.cpp:
2180         (WebCore::XMLHttpRequest::responseMIMEType const):
2181         * xml/parser/XMLDocumentParserLibxml2.cpp:
2182         (WebCore::externalEntityMimeTypeAllowed):
2183
2184 2020-05-31  Wenson Hsieh  <wenson_hsieh@apple.com>
2185
2186         Tidy up Source/WebCore/page/DragController.h
2187         https://bugs.webkit.org/show_bug.cgi?id=212584
2188
2189         Reviewed by Anders Carlsson.
2190
2191         Unindent the `DragController` class by 1 indentation level, to adhere with
2192         <https://webkit.org/code-style-guidelines/#indentation-namespace>. Also, remove
2193         some stray trailing whitespace.
2194
2195         No change in behavior.
2196
2197         * page/DragController.h:
2198         (WebCore::DragController::mouseIsOverFileInput const):
2199         (WebCore::DragController::numberOfItemsToBeAccepted const):
2200         (WebCore::DragController::setDidInitiateDrag):
2201         (WebCore::DragController::didInitiateDrag const):
2202         (WebCore::DragController::sourceDragOperation const):
2203         (WebCore::DragController::draggingImageURL const):
2204         (WebCore::DragController::setDragOffset):
2205         (WebCore::DragController::dragOffset const):
2206         (WebCore::DragController::dragSourceAction const):
2207         (WebCore::DragController::dragHandlingMethod const):
2208         (WebCore::DragController::documentUnderMouse const):
2209         (WebCore::DragController::dragDestinationActionMask const):
2210         (WebCore::DragController::droppedImagePlaceholders const):
2211         (WebCore::DragController::droppedImagePlaceholderRange const):
2212         (WebCore::DragController::canLoadDataFromDraggingPasteboard const):
2213         (WebCore::DragController::client const):
2214
2215 2020-05-31  Dean Jackson  <dino@apple.com>
2216
2217         AutoTrader crashed while browsing search results
2218         https://bugs.webkit.org/show_bug.cgi?id=212461
2219         rdar://60733185
2220
2221         Reviewed by Sam Weinig.
2222
2223         On iOS, when using WebKit1 (UIWebView), CoreAnimation would
2224         call WebGLLayer's display method from a thread that is not
2225         the Web Thread. That method was performing some GL work using
2226         ANGLE, causing a crash.
2227
2228         Since all the WebGLLayer's display method really needs to do
2229         is swap buffers for compositing, the fix is to separate all
2230         the GL operations into a method that can be called after
2231         painting but before compositing. This should also have the added
2232         benefit that by the time CoreAnimation comes to call display
2233         on all the dirty layers, we will have already executed our
2234         expensive GPU work. The total amount of work done on the GPU
2235         is the same, but hopefully it is now all done in WebKit's
2236         paint cycle, rather than when the Window Server is trying
2237         to get CA to composite things.
2238
2239         Covered by a new API test: WebGLPrepareDisplayOnWebThread
2240
2241         * html/HTMLCanvasElement.h:
2242         * html/HTMLCanvasElement.cpp:
2243         (WebCore::HTMLCanvasElement::HTMLCanvasElement):
2244         (WebCore::HTMLCanvasElement::~HTMLCanvasElement):
2245         (WebCore::HTMLCanvasElement::didMoveToNewDocument):
2246         (WebCore::HTMLCanvasElement::removedFromAncestor):
2247             Add or remove the document as a CanvasObserver.
2248         (WebCore::HTMLCanvasElement::needsPreparationForDisplay):
2249             Signals whether this element is the type that needs preparation.
2250         (WebCore::HTMLCanvasElement::prepareForDisplay):
2251             Tell the WebGLRenderingContext it must prepare.
2252
2253         * html/canvas/WebGLRenderingContextBase.h:
2254         * html/canvas/WebGLRenderingContextBase.cpp:
2255         (WebCore::WebGLRenderingContextBase::prepareForDisplay):
2256             The WebGLRenderingContext must forward the call
2257             to prepare down to the GraphicsContextGLOpenGL.
2258
2259         * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
2260         * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
2261         * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
2262         (WebCore::GraphicsContextGLOpenGL::prepareForDisplay):
2263             And the GraphicsContextGLOpenGL forwards the call
2264             into the WebGLLayer.
2265
2266         * platform/graphics/cocoa/WebGLLayer.h:
2267         * platform/graphics/cocoa/WebGLLayer.mm:
2268         (-[WebGLLayer prepareForDisplay]):
2269         (-[WebGLLayer display]):
2270             Split the parts of the `display` method that deal
2271             with flushing the GL commands, preparing the framebuffer texture,
2272             and swapping the IOSurfaces into a new `prepareForDisplay`. This
2273             method is invoked at the end of the rendering/layout tasks, leaving
2274             the `display` method to only tell CoreAnimation about a new buffer
2275             to composite.
2276
2277         * dom/Document.cpp:
2278         * dom/Document.h:
2279         (WebCore::Document::prepareCanvasesForDisplayIfNeeded):
2280         (WebCore::Document::canvasChanged):
2281         (WebCore::Document::canvasDestroyed):
2282             Keep a set of HTMLCanvasElements that need to
2283             be prepared so we can tell them when they need to prepare.
2284             Do this by becoming a CanvasObserver, thus getting
2285             notified when a canvas has done something that
2286             would cause painting.
2287
2288         * page/Page.cpp:
2289         (WebCore::Page::doAfterUpdateRendering):
2290             Add a new task that asks the Document to notify
2291             all relevant canvas objects that they should prepare
2292             for display.
2293
2294 2020-05-31  Jer Noble  <jer.noble@apple.com>
2295
2296         [Cocoa] EME should return more helpful error code during key exchange
2297         https://bugs.webkit.org/show_bug.cgi?id=212535
2298         <rdar://problem/60439979>
2299
2300         Reviewed by Eric Carlson.
2301
2302         Clients have requested that the EME API provide more helpful information when the FairPlay CDM is unable
2303         to provide the requested level of key security. Currently, we reject the update() promise with a generic
2304         "failed" error code. Instead, resolve the promise, but mark the key as "output-restricted" in the key
2305         status map, indicating that the key cannot be used with required level of security.
2306
2307         Drive-by fix: We currently ASSERT() that the callback from removeSessionData() isn't called if the session
2308         is not a PUR session. When calling removeSessionData() on a non-PUR session, call the callback with a generic
2309         "failed" error.
2310
2311         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2312         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData):
2313         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didFailToProvideRequest):
2314         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const):
2315
2316 2020-05-31  Jer Noble  <jer.noble@apple.com>
2317
2318         [Cocoa] Transition between encrypted and clear codecs throws error from SourceBuffer.appendBuffer()
2319         https://bugs.webkit.org/show_bug.cgi?id=212550
2320         <rdar://problem/62207260>
2321
2322         Reviewed by Eric Carlson.
2323
2324         CoreMedia returns a different codec 4CC code for "encrypted AVC" than it does for "clear AVC", though
2325         the underlying codec used for both is the same. While CoreMedia does use different codec implementations
2326         for each, it is capable of freely switching between the two, and the codec string used by web developers
2327         for encrypted vs. clear content is identical. So we will treat these two codecs as "the same" as it pertains
2328         to the MSE requirement that codecs contained in new initialization segments are "the same" as previous
2329         ones. Adopt kCMFormatDescriptionExtension_ProtectedContentOriginalFormat, which can query the "original"
2330         codec used for encrypted codec playback.
2331
2332         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2333
2334 2020-05-31  Zalan Bujtas  <zalan@apple.com>
2335
2336         [iBooks] Empty pages appear in book
2337         https://bugs.webkit.org/show_bug.cgi?id=212573
2338         <rdar://problem/62912623>
2339
2340         Reviewed by Antti Koivisto.
2341
2342         Do not add a page break for orphan content unless the line does not fit anymore.
2343
2344         Test: fast/multicol/orphans-ignored.html
2345
2346         * rendering/SimpleLineLayoutPagination.cpp:
2347         (WebCore::SimpleLineLayout::setPageBreakForLine):
2348         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
2349
2350 2020-05-31  Rob Buis  <rbuis@igalia.com>
2351
2352         Implement named item condition for images
2353         https://bugs.webkit.org/show_bug.cgi?id=212473
2354
2355         Reviewed by Maciej Stachowiak.
2356
2357         Implement named item condition for images, not only should we
2358         check there are both an id and a name attribute, but also that
2359         the name attribute is non-empty [1].
2360
2361         Behavior matches Chrome and Firefox.
2362
2363         [1] https://html.spec.whatwg.org/multipage/dom.html#dom-document-nameditem-filter
2364
2365         Test: imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/nameditem-06.html
2366
2367         * html/HTMLNameCollection.cpp:
2368         (WebCore::DocumentNameCollection::elementMatchesIfIdAttributeMatch):
2369
2370 2020-05-31  Rob Buis  <rbuis@igalia.com>
2371
2372         <area> needs to be connected in order to navigate
2373         https://bugs.webkit.org/show_bug.cgi?id=177357
2374
2375         Reviewed by Maciej Stachowiak.
2376
2377         Implement second step of cannot navigate algorithm:
2378         https://html.spec.whatwg.org/#cannot-navigate
2379
2380         Test: web-platform-tests/html/semantics/links/following-hyperlinks/activation-behavior.window.html
2381
2382         * html/HTMLAnchorElement.cpp:
2383         (WebCore::HTMLAnchorElement::handleClick):
2384
2385 2020-05-30  Sam Weinig  <weinig@apple.com>
2386
2387         Extended Color: Additional color cleanups
2388         https://bugs.webkit.org/show_bug.cgi?id=212567
2389
2390         Reviewed by Simon Fraser.
2391
2392         A few unrelated quality-of-life cleanups to Color and related classes:
2393         - Rename Color::asSimpleColor() to Color::asSimple() for parity with Color::asExtended().
2394         - Move SimpleColor implementations of invertedColorWithAlpha() and asSRGBFloatComponents()
2395           to SimpleColor for parity with ExtenedColor.
2396         - Rename ExtendedColor::channels() to ExtendedColor::components() to consistency.
2397         - Adds operator[] to ColorComponents to allow direct access to components rather than
2398           requiring and additional .components[]
2399         - Using std::minmax() where possible.
2400         - Renaming colorFloatToSimpleColorByte to scaleRoundAndClampColorChannel to have a consistent 
2401           naming and location of conversion to 8-bit color channels.
2402
2403         * platform/graphics/Color.cpp:
2404         (WebCore::Color::serialized const):
2405         (WebCore::Color::cssText const):
2406         (WebCore::Color::nameForRenderTreeAsText const):
2407         (WebCore::Color::light const):
2408         (WebCore::Color::dark const):
2409         (WebCore::Color::colorWithAlpha const):
2410         (WebCore::Color::colorWithAlphaUsingAlternativeRounding const):
2411         (WebCore::Color::invertedColorWithAlpha const):
2412         (WebCore::Color::colorSpaceAndComponents const):
2413         (WebCore::Color::toSRGBASimpleColorLossy const):
2414         (WebCore::Color::toSRGBAComponentsLossy const):
2415         * platform/graphics/Color.h:
2416         (WebCore::Color::isOpaque const):
2417         (WebCore::Color::isVisible const):
2418         (WebCore::Color::alpha const):
2419         (WebCore::Color::alphaAsFloat const):
2420         (WebCore::Color::asSimple const):
2421         (WebCore::Color::isBlackColor):
2422         (WebCore::Color::isWhiteColor):
2423         (WebCore::Color::encode const):
2424         (WebCore::Color::asSimpleColor const): Deleted.
2425         * platform/graphics/ColorComponents.h:
2426         (WebCore::ColorComponents::operator[]):
2427         (WebCore::ColorComponents::operator[] const):
2428         (WebCore::=):
2429         (WebCore::perComponentMax):
2430         (WebCore::perComponentMin):
2431         * platform/graphics/ColorMatrix.h:
2432         (WebCore::Rows>::transformedColorComponents const):
2433         * platform/graphics/ColorUtilities.cpp:
2434         (WebCore::areEssentiallyEqual):
2435         (WebCore::rgbToLinearComponents):
2436         (WebCore::linearToRGBComponents):
2437         (WebCore::lightness):
2438         (WebCore::luminance):
2439         (WebCore::sRGBToHSL):
2440         (WebCore::hslToSRGB):
2441         * platform/graphics/ColorUtilities.h:
2442         (WebCore::scaleRoundAndClampColorChannel):
2443         (WebCore::scaleRoundAndClampColorChannelUsingAlternativeRounding):
2444         (WebCore::colorFloatToSimpleColorByte): Deleted.
2445         * platform/graphics/ExtendedColor.cpp:
2446         (WebCore::ExtendedColor::hash const):
2447         (WebCore::ExtendedColor::cssText const):
2448         (WebCore::ExtendedColor::colorWithAlpha const):
2449         (WebCore::ExtendedColor::invertedColorWithAlpha const):
2450         (WebCore::ExtendedColor::toSRGBAComponentsLossy const):
2451         (WebCore::ExtendedColor::isWhite const):
2452         (WebCore::ExtendedColor::isBlack const):
2453         * platform/graphics/ExtendedColor.h:
2454         (WebCore::ExtendedColor::alpha const):
2455         (WebCore::ExtendedColor::components const):
2456         (WebCore::ExtendedColor::ExtendedColor):
2457         (WebCore::operator==):
2458         (WebCore::ExtendedColor::channels const): Deleted.
2459         * platform/graphics/SimpleColor.cpp:
2460         (WebCore::makeSimpleColorFromFloats):
2461         (WebCore::makeSimpleColorFromHSLA):
2462         * platform/graphics/SimpleColor.h:
2463         (WebCore::SimpleColor::SimpleColor):
2464         (WebCore::SimpleColor::valueAsARGB const):
2465         (WebCore::SimpleColor::colorWithAlpha const):
2466         (WebCore::SimpleColor::invertedColorWithAlpha const):
2467         (WebCore::SimpleColor::asSRGBFloatComponents const):
2468         (WebCore::makeSimpleColor):
2469         * platform/graphics/cg/ColorCG.cpp:
2470         (WebCore::cachedCGColor):
2471         * platform/graphics/filters/FELighting.cpp:
2472         (WebCore::FELighting::drawLighting):
2473         * platform/graphics/filters/FETurbulence.cpp:
2474         (WebCore::toIntBasedColorComponents):
2475         * platform/graphics/filters/FilterOperation.cpp:
2476         (WebCore::BasicComponentTransferFilterOperation::transformColor const):
2477         (WebCore::InvertLightnessFilterOperation::transformColor const):
2478         (WebCore::InvertLightnessFilterOperation::inverseTransformColor const):
2479         * platform/graphics/filters/FilterOperations.cpp:
2480         (WebCore::FilterOperations::transformColor const):
2481         (WebCore::FilterOperations::inverseTransformColor const):
2482
2483 2020-05-30  Commit Queue  <commit-queue@webkit.org>
2484
2485         Unreviewed, reverting r262335.
2486         https://bugs.webkit.org/show_bug.cgi?id=212571
2487
2488         Triggered assertions in WebKit1
2489
2490         Reverted changeset:
2491
2492         "Disallow responses when a response contains invalid header
2493         values"
2494         https://bugs.webkit.org/show_bug.cgi?id=184493
2495         https://trac.webkit.org/changeset/262335
2496
2497 2020-05-30  Simon Fraser  <simon.fraser@apple.com>
2498
2499         For scroll container and scrolled contents layers, use the renderer style to set up the event regions
2500         https://bugs.webkit.org/show_bug.cgi?id=212570
2501
2502         Reviewed by Antti Koivisto.
2503
2504         RenderLayerBacking::updateEventRegion() sets up event regions on the scroll container and scrolled contents
2505         layer using the default style, in order to fill up the m_region part of EventRegion, but we might as well
2506         pass the renderer style so that it fills up the touch-action and wheel event regions as well.
2507
2508         Also re-use the existing event region trace points for region building.
2509
2510         * rendering/RenderLayerBacking.cpp:
2511         (WebCore::RenderLayerBacking::updateEventRegion):
2512
2513 2020-05-30  Andy Estes  <aestes@apple.com>
2514
2515         [Apple Pay] Support percentage border-radius values in -apple-pay-button
2516         https://bugs.webkit.org/show_bug.cgi?id=212559
2517         <rdar://problem/63781881>
2518
2519         Reviewed by Antti Koivisto.
2520
2521         Added test cases to fast/css/appearance-apple-pay-button-border-radius.html.
2522
2523         * rendering/RenderThemeCocoa.mm:
2524         (WebCore::RenderThemeCocoa::paintApplePayButton): Used floatValueForLength() to ensure
2525         percentage lengths are resolved before passing a corner radius to PassKit.
2526
2527 2020-05-29  Yusuke Suzuki  <ysuzuki@apple.com>
2528
2529         [JSC] JSBigInt allocation should be graceful for OOM
2530         https://bugs.webkit.org/show_bug.cgi?id=212512
2531
2532         Reviewed by Mark Lam.
2533
2534         * bindings/js/SerializedScriptValue.cpp:
2535         (WebCore::CloneDeserializer::readBigInt):
2536
2537 2020-05-29  Simon Fraser  <simon.fraser@apple.com>
2538
2539         Event region painting should use the same paint flags as normal painting
2540         https://bugs.webkit.org/show_bug.cgi?id=212547
2541
2542         Reviewed by Sam Weinig.
2543
2544         There are cases (see r260118) where we need to send down the correct paint flags when
2545         painting the scrolled contents layer to avoid unwanted clipping. We need to send down
2546         the one paint flag relevant for event region paints, CompositedOverflowScrollContent,
2547         for the same reasons.
2548
2549         I could not make a testcase that shows a behavior change, but I did copy the testcase
2550         from r260118 and adapt it for event-region generation to detect future behavior changes.
2551
2552         Test: fast/scrolling/mac/wheel-event-listener-region-inside-overflow-scroll-clipped-out.html
2553
2554         * rendering/RenderLayer.cpp:
2555         (WebCore::RenderLayer::paintLayerContents):
2556         (WebCore::RenderLayer::collectEventRegionForFragments):
2557         * rendering/RenderLayer.h:
2558
2559 2020-05-29  Simon Fraser  <simon.fraser@apple.com>
2560
2561         Elements with wheel event handlers inside overflow:scroll are missing from the event region
2562         https://bugs.webkit.org/show_bug.cgi?id=212545
2563
2564         Reviewed by Zalan Bujtas.
2565
2566         RenderBlock::paintObject() needs to traverse into descendants if there are are
2567         wheel event handlers on the document, just as it does for elements with touch-action.
2568
2569         Test: fast/scrolling/mac/wheel-event-listener-region-inside-overflow-scroll.html
2570
2571         * dom/Document.h:
2572         (WebCore::Document::hasTouchEventHandlers const):
2573         (WebCore::Document::hasWheelEventHandlers const):
2574         * rendering/RenderBlock.cpp:
2575         (WebCore::RenderBlock::paintObject):
2576
2577 2020-05-29  Rob Buis  <rbuis@igalia.com>
2578
2579         Disallow responses when a response contains invalid header values
2580         https://bugs.webkit.org/show_bug.cgi?id=184493
2581
2582         Reviewed by Youenn Fablet.
2583
2584         From the Fetch specification [1]:
2585         "A value is a byte sequence that matches the following conditions:
2586         "- Contains no 0x00 (NUL) or HTTP newline bytes."
2587
2588         [1] https://fetch.spec.whatwg.org/#concept-header-value
2589
2590         Tests: imported/w3c/web-platform-tests/fetch/h1-parsing/resources-with-0x00-in-header.window.html
2591                imported/web-platform-tests/fetch/api/basic/header-value-combining.any.html
2592                imported/web-platform-tests/fetch/api/basic/header-value-combining.any.worker.html
2593                imported/web-platform-tests/fetch/api/basic/header-value-null-byte.any.html
2594                imported/web-platform-tests/fetch/api/basic/header-value-null-byte.any.worker.html
2595                imported/web-platform-tests/xhr/headers-normalize-response.htm
2596
2597         * Modules/fetch/FetchHeaders.cpp:
2598         (WebCore::canWriteHeader):
2599         (WebCore::appendToHeaderMap):
2600         (WebCore::FetchHeaders::filterAndFill):
2601         * loader/DocumentThreadableLoader.cpp:
2602         (WebCore::DocumentThreadableLoader::loadRequest):
2603         * loader/SubresourceLoader.cpp:
2604         (WebCore::SubresourceLoader::didReceiveResponse):
2605         * platform/network/ResourceResponseBase.cpp:
2606         (WebCore::ResourceResponseBase::containsInvalidHTTPHeaders const):
2607         * platform/network/ResourceResponseBase.h:
2608
2609 2020-05-29  Andy Estes  <aestes@apple.com>
2610
2611         [Apple Pay] Remove conditionals for ENABLE_APPLE_PAY_SESSION_V(3|4)
2612         https://bugs.webkit.org/show_bug.cgi?id=212541
2613
2614         Reviewed by Darin Adler.
2615
2616         APPLE_PAY_SESSION_V(3|4) is now enabled whenever APPLE_PAY itself is enabled.
2617
2618         * Configurations/FeatureDefines.xcconfig:
2619         * Modules/applepay/ApplePayError.idl:
2620         * Modules/applepay/ApplePayPaymentAuthorizationResult.idl:
2621         * Modules/applepay/ApplePayPaymentContact.idl:
2622         * Modules/applepay/ApplePayPaymentMethodUpdate.idl:
2623         * Modules/applepay/ApplePayRequestBase.idl:
2624         * Modules/applepay/ApplePaySession.idl:
2625         * Modules/applepay/ApplePayShippingContactUpdate.idl:
2626         * Modules/applepay/ApplePayShippingMethodUpdate.idl:
2627         * Modules/applepay/PaymentCoordinatorClient.cpp:
2628         (WebCore::PaymentCoordinatorClient::supportsVersion):
2629         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
2630         (WebCore::ApplePayPaymentHandler::computePaymentMethodErrors const):
2631         * accessibility/AccessibilityRenderObject.cpp:
2632         (WebCore::AccessibilityRenderObject::applePayButtonDescription const):
2633         * css/CSSPrimitiveValueMappings.h:
2634         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2635         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const):
2636         * css/CSSValueKeywords.in:
2637         * css/parser/CSSParserFastPaths.cpp:
2638         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2639         * rendering/RenderThemeCocoa.mm:
2640         (WebCore::toPKPaymentButtonType):
2641         * rendering/style/RenderStyleConstants.cpp:
2642         (WebCore::operator<<):
2643         * rendering/style/RenderStyleConstants.h:
2644
2645 2020-05-29  Jer Noble  <jer.noble@apple.com>
2646
2647         [EME] navigator.requestMediaKeySystemAccess() should reject PUR sessionTypes in private browsing mode.
2648         https://bugs.webkit.org/show_bug.cgi?id=212540
2649         <rdar://problem/61125757>
2650
2651         Reviewed by Eric Carlson.
2652
2653         A MediaKeySystemAccess with a PUR session type will never be able to create media keys when created in
2654         private browsing mode. Allow clients to fail over to non-PUR session by rejecting the promise returned by
2655         requestMediaKeySystemAccess() when in private browsing mode.
2656
2657         Test: platform/mac/media/encrypted-media/fps-ephemeral-requestMediaKeySystemAccess.html
2658
2659         * Modules/encryptedmedia/CDM.cpp:
2660         (WebCore::CDM::getSupportedConfiguration):
2661
2662 2020-05-29  Wenson Hsieh  <wenson_hsieh@apple.com>
2663
2664         [iOS] Unable to paste images when composing mail at yahoo.com
2665         https://bugs.webkit.org/show_bug.cgi?id=212544
2666         <rdar://problem/63511613>
2667
2668         Reviewed by Megan Gardner and Andy Estes.
2669
2670         When pasting images in the mobile version of the mail compose editor on mail.yahoo.com, mail.yahoo.com's script
2671         handles the paste by allowing images to be inserted into the DOM (i.e. by not preventing the "paste" event), and
2672         then stripping away the `src` attribute of the pasted image afterwards. This leaves behind a blank space in the
2673         email.
2674
2675         Work around this by avoiding images when converting the contents of the pasteboard into web content on iOS.
2676         Instead, we fall back to inserting (sanitized) text, or nothing at all if there is no other representation
2677         suitable for converting into web content.
2678
2679         Unfortunately, the mobile version of the website is loaded on iPad as well, even when the desktop website has
2680         been requested (through sending the macOS user agent and "MacIntel" navigator platform).
2681
2682         * editing/cocoa/WebContentReaderCocoa.mm:
2683         (WebCore::WebContentReader::readImage):
2684         * page/Quirks.cpp:
2685         (WebCore::Quirks::shouldAvoidPastingImagesAsWebContent const):
2686         * page/Quirks.h:
2687
2688 2020-05-29  Darin Adler  <darin@apple.com>
2689
2690         Remove things from FeatureDefines.xcconfig that are covered by PlatformEnableCocoa.h
2691         https://bugs.webkit.org/show_bug.cgi?id=212418
2692
2693         Rubber-stamped by Simon Fraser.
2694
2695         * Configurations/FeatureDefines.xcconfig: Add back ENABLE_CSS_CONIC_GRADIENTS, removed
2696         by accident.
2697
2698 2020-05-29  Jacob Uphoff  <jacob_uphoff@apple.com>
2699
2700         Unreviewed, reverting r262289.
2701
2702         This commit caused a test to crash internally
2703
2704         Reverted changeset:
2705
2706         "MediaPlayerPrivateMediaStreamAVFObjC should enqueue samples
2707         in a background thread"
2708         https://bugs.webkit.org/show_bug.cgi?id=212073
2709         https://trac.webkit.org/changeset/262289
2710
2711 2020-05-27  Darin Adler  <darin@apple.com>
2712
2713         Remove things from FeatureDefines.xcconfig that are covered by PlatformEnableCocoa.h
2714         https://bugs.webkit.org/show_bug.cgi?id=212418
2715
2716         Reviewed by Andy Estes.
2717
2718         * Configurations/FeatureDefines.xcconfig: Removed 83 of the 119 things defined in
2719         this file. There are 36 more that are slightly more complex that we can remove
2720         carefully later.
2721
2722 2020-05-29  Darin Adler  <darin@apple.com>
2723
2724         Make generate-unified-sources.sh not depend on features being listed in FEATURE_DEFINES environment variable
2725         https://bugs.webkit.org/show_bug.cgi?id=212420
2726
2727         Currently any #if in the Sources.txt and SourcesCocoa.txt files can check only features
2728         defined in the FeatureDefines.xcconfig file, which sets up the FEATURE_DEFINES environment
2729         variable. Instead, we'd like to pass in all the things defined in the Platform.h headers
2730         as well. We accomplish that using the FEATURE_AND_PLATFORM_DEFINES variable from the
2731         DerivedSources.make file. This was the last place using FEATURE_DEFINES directly, so it
2732         frees us up to reduce FeatureDefines.xcconfig and move feature definitions to
2733         PlatformEnableCocoa.h instead, which will be less repetitive.
2734
2735         Reviewed by Andy Estes.
2736
2737         * Configurations/GenerateUnifiedSources.xcconfig: Deleted.
2738         * DerivedSources-input.xcfilelist: Updated.
2739         * DerivedSources-output.xcfilelist: Updated.
2740         * DerivedSources.make: Added a rule to invoke generate-unified-sources.sh, passing
2741         FEATURE_AND_PLATFORM_DEFINES.
2742         * Scripts/generate-unified-sources.sh: Removed hard-coded use of FEATURE_DEFINES.
2743         * UnifiedSources-output.xcfilelist: Deleted.
2744         * WebCore.xcodeproj/project.pbxproj: Removed Generate Unified Sources build step,
2745         since it's now part of Generate Derived Sources.
2746
2747 2020-05-29  Darin Adler  <darin@apple.com>
2748
2749         [Cocoa] Pass all defines from Platform.h to various scripts, not just the ones from .xcconfig
2750         https://bugs.webkit.org/show_bug.cgi?id=212451
2751
2752         Reviewed by Sam Weinig.
2753
2754         * DerivedSources.make: Run the preprocessor on Platform.h and parse the output into
2755         FEATURE_AND_PLATFORM_DEFINES. Use that and FEATURE_AND_PLATFORM_DEFINE_DEPENDENCIES
2756         whenever we need a list of defines. Also took out some Windows-specific stuff since
2757         this is now only used on Mac platforms. Use ":=" when calling $(shell) to make sure
2758         the same shell command is not invoked over and over again.
2759
2760 2020-05-29  Keith Rollin  <krollin@apple.com>
2761
2762         Revert switch to XCBuild
2763         https://bugs.webkit.org/show_bug.cgi?id=212530
2764         <rdar://problem/63764632>
2765
2766         Unreviewed build fix.
2767
2768         Bug 209890 enabled the use of XCBuild by default. Since then, some
2769         build issues have shown up. While addressing them, temporarily turn
2770         off the use of XCBuild by default.
2771
2772         No new tests -- build fix.
2773
2774         * WebCore.xcodeproj/project.pbxproj:
2775
2776 2020-05-29  Myles C. Maxfield  <mmaxfield@apple.com>
2777
2778         REGRESSION(r261940): PLT5 is 2% regressed
2779         https://bugs.webkit.org/show_bug.cgi?id=212504
2780         <rdar://problem/63685637>
2781
2782         Reviewed by Wenson Hsieh.
2783
2784         We were causing spurious style recalcs on every main frame load.
2785
2786         No new tests because there is no behavior change.
2787
2788         * page/Settings.yaml:
2789
2790 2020-05-29  Sam Weinig  <weinig@apple.com>
2791
2792         Extended Color: ColorMatrix should support smaller matrices and be constexpr
2793         https://bugs.webkit.org/show_bug.cgi?id=212477
2794
2795         Reviewed by Simon Fraser.
2796
2797         - Adds the ability to specify a ColorMatrix with any number of rows or columns,
2798           useful as most of the uses ColorMatrix did not need the full 5x4. Transformation
2799           act as-if the the ColorMatrix is the identify matrix for any rows or columns
2800           not present. For example, when transforming a ColorComponents, which is 4x1, a 
2801           3x3 ColorMatrix of the form:
2802
2803               [ a, b, c ]
2804               [ d, e, f ]
2805               [ g, h, i ]
2806               
2807           will behave as-if it looks like:
2808           
2809               [ a, b, c, 0 ]
2810               [ d, e, f, 0 ]
2811               [ g, h, i, 0 ]
2812               [ 0, 0, 0, 1 ]
2813         
2814           In practice, this means that the last component of the input vector is left
2815           unmodified.
2816
2817         - Adds ability to use ColorMatrix in constexpr statements, which will be useful
2818           for compile time concatenation of colorspace conversion matrices in a future
2819           change but is also useful for improved space efficiency of constant matrices
2820           already used.
2821
2822         * Sources.txt:
2823         * WebCore.xcodeproj/project.pbxproj:
2824         Remove ColorMatrix.cpp
2825
2826         * platform/graphics/ColorComponents.h:
2827         (WebCore::ColorComponents::ColorComponents):
2828         (WebCore::ColorComponents::operator+=):
2829         (WebCore::ColorComponents::operator+ const):
2830         (WebCore::ColorComponents::operator/ const):
2831         (WebCore::ColorComponents::operator* const):
2832         (WebCore::ColorComponents::abs const):
2833         (WebCore::ColorComponents::get const):
2834         (WebCore::perComponentMax):
2835         (WebCore::perComponentMin):
2836         (WebCore::operator==):
2837         (WebCore::operator!=):
2838         Make everything constexpr and move implementations out of the declarations for clarity.
2839
2840         * platform/graphics/ColorMatrix.cpp: Removed.
2841         * platform/graphics/ColorMatrix.h:
2842         (WebCore::ColorMatrix::ColorMatrix):
2843         (WebCore::ColorMatrix::at const):
2844         (WebCore::grayscaleColorMatrix):
2845         (WebCore::sepiaColorMatrix):
2846         (WebCore::saturationColorMatrix):
2847         (WebCore::hueRotateColorMatrix):
2848         (WebCore::ColorMatrix::transformColorComponents):
2849         (WebCore::ColorMatrix::transformedColorComponents):
2850         Re-write as a class templatized on the number of rows and columns. Moves factory functions
2851         out of the class to avoid awkwardness of having to specify a dummy size when calling them 
2852         (e.g. we wouldn't want you to have to write ColorMatrix<3, 3>::grayscaleMatrix(), instead
2853         just grayscaleColorMatrix() is much nicer).
2854
2855         * platform/graphics/ColorUtilities.cpp:
2856         (WebCore::xyzToLinearSRGB):
2857         (WebCore::linearSRGBToXYZ):
2858         (WebCore::XYZToLinearP3):
2859         (WebCore::linearP3ToXYZ):
2860         * platform/graphics/filters/FilterOperation.cpp:
2861         (WebCore::BasicColorMatrixFilterOperation::transformColor const):
2862         (WebCore::InvertLightnessFilterOperation::transformColor const):
2863         (WebCore::InvertLightnessFilterOperation::inverseTransformColor const):
2864         Adopt new ColorMatrix interface.
2865
2866         * platform/graphics/filters/FilterOperation.h:
2867         Remove unnecessary T in forward declaration.
2868
2869         * platform/graphics/ColorUtilities.h:
2870         (WebCore::fastMultiplyBy255):
2871         (WebCore::fastDivideBy255):
2872         Add some missing constexprs.
2873
2874 2020-05-29  Commit Queue  <commit-queue@webkit.org>
2875
2876         Unreviewed, reverting r262245.
2877         https://bugs.webkit.org/show_bug.cgi?id=212531
2878
2879         "Caused WebCore's 'Check .xcfilelists' build phase to be ~100x
2880         slower"
2881
2882         Reverted changeset:
2883
2884         "[Cocoa] Pass all defines from Platform.h to various scripts,
2885         not just the ones from .xcconfig"
2886         https://bugs.webkit.org/show_bug.cgi?id=212451
2887         https://trac.webkit.org/changeset/262245
2888
2889 2020-05-29  Sergio Villar Senin  <svillar@igalia.com>
2890
2891         Unreviewed build fix after r262299
2892
2893         We replaced ScriptExecutionContext* by Document& in WebXRSpace hierarchy, so the
2894         failing ASSERT() was:
2895         1. Invalid, there is no "context" parameter but "document"
2896         2. Not needed anymore, as we're passing a reference
2897
2898         * Modules/webxr/WebXRSpace.cpp:
2899         (WebCore::WebXRSpace::WebXRSpace): Removed invalid ASSERT().
2900
2901 2020-05-27  Sergio Villar Senin  <svillar@igalia.com>
2902
2903         [WebXR] Implement XRSession::requestReferenceSpace()
2904         https://bugs.webkit.org/show_bug.cgi?id=212407
2905
2906         Reviewed by Youenn Fablet.
2907
2908         This patch implements the requestReferenceSpace() method of the XRSession which is used to
2909         create reference spaces. A reference space establishes a space where pose data will be defined
2910         and thus is mandatory to retrieve that pose information.
2911
2912         There are still some bits that have to implementated in follow up patches using platform code.
2913
2914         * Modules/webxr/WebXRBoundedReferenceSpace.cpp:
2915         (WebCore::WebXRBoundedReferenceSpace::create): Added.
2916         (WebCore::WebXRBoundedReferenceSpace::WebXRBoundedReferenceSpace): Ditto.
2917         * Modules/webxr/WebXRBoundedReferenceSpace.h:
2918         * Modules/webxr/WebXRReferenceSpace.cpp:
2919         (WebCore::WebXRReferenceSpace::create): Added.
2920         (WebCore::WebXRReferenceSpace::WebXRReferenceSpace): Ditto.
2921         (WebCore::WebXRReferenceSpace::getOffsetReferenceSpace): Use the create() method.
2922         * Modules/webxr/WebXRReferenceSpace.h:
2923         * Modules/webxr/WebXRSession.cpp:
2924         (WebCore::WebXRSession::referenceSpaceIsSupported const): New method to check whether a reference.
2925         space is supported by session and device.
2926         (WebCore::WebXRSession::requestReferenceSpace): New method that creates reference spaces for pose data.
2927         * Modules/webxr/WebXRSession.h:
2928         * Modules/webxr/WebXRSpace.cpp:
2929         (WebCore::WebXRSpace::WebXRSpace): Store a reference to the session creating the space.
2930         * Modules/webxr/WebXRSpace.h:
2931
2932 2020-05-29  Simon Fraser  <simon.fraser@apple.com>
2933
2934         Update debug overlays at rendering update time
2935         https://bugs.webkit.org/show_bug.cgi?id=212510
2936
2937         Reviewed by Antoine Quint.
2938
2939         Don't eagerly update the regions in debug overlays when things change; this triggers
2940         assertions for touch event overlays.
2941
2942         Instead, just mark them dirty and update the regions at "update the rendering" time.
2943
2944         * page/DebugPageOverlays.cpp:
2945         (WebCore::RegionOverlay::setRegionChanged):
2946         (WebCore::RegionOverlay::didMoveToPage):
2947         (WebCore::RegionOverlay::recomputeRegion):
2948         (WebCore::DebugPageOverlays::regionChanged):
2949         (WebCore::DebugPageOverlays::updateRegionIfNecessary):
2950         * page/DebugPageOverlays.h:
2951         (WebCore::DebugPageOverlays::doAfterUpdateRendering):
2952         * page/Page.cpp:
2953         (WebCore::Page::doAfterUpdateRendering):
2954
2955 2020-05-29  Simon Fraser  <simon.fraser@apple.com>
2956
2957         Prepare for async scrolling in passive wheel event handler regions
2958         https://bugs.webkit.org/show_bug.cgi?id=212455
2959
2960         Reviewed by Tim Horton.
2961
2962         Clarify the processing for wheel events by adding OptionSet<WheelEventProcessingSteps>,
2963         which will, in future, allow us to describe the processing for an event in the passive
2964         event handler region which does scrolling on the scrolling thread, and is then sent
2965         to the main thread for DOM event dispatch.
2966         
2967         Removed ScrollingEventResult, which conflated "handled" with "send to another thread".
2968         The thread sending behavior is now encoded in the WheelEventProcessingSteps, and we can just
2969         use a bool for handled.
2970         
2971         Scrolling tree and node handleWheelEvent() functions return a WheelEventHandlingResult, which
2972         is a tuple of OptionSet<WheelEventProcessingSteps> and 'handled', allowing for a node with
2973         background-attachment:fixed to add the "send to main thread" processing step.
2974
2975         * page/FrameView.cpp:
2976         (WebCore::FrameView::wheelEvent):
2977         * page/scrolling/ScrollingCoordinator.h:
2978         (WebCore::ScrollingCoordinator::handleWheelEvent):
2979         * page/scrolling/ScrollingCoordinatorTypes.h:
2980         * page/scrolling/ScrollingTree.cpp:
2981         (WebCore::ScrollingTree::determineWheelEventProcessing):
2982         (WebCore::ScrollingTree::handleWheelEvent):
2983         (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously): Deleted.
2984         * page/scrolling/ScrollingTree.h:
2985         (WebCore::WheelEventHandlingResult::needsMainThreadProcessing const):
2986         (WebCore::WheelEventHandlingResult::handled):
2987         (WebCore::WheelEventHandlingResult::unhandled):
2988         (WebCore::WheelEventHandlingResult::result):
2989         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2990         (WebCore::ScrollingTreeScrollingNode::handleWheelEvent):
2991         * page/scrolling/ScrollingTreeScrollingNode.h:
2992         * page/scrolling/ThreadedScrollingTree.cpp:
2993         (WebCore::ThreadedScrollingTree::handleWheelEvent):
2994         (WebCore::ThreadedScrollingTree::handleWheelEventAfterMainThread):
2995         * page/scrolling/ThreadedScrollingTree.h:
2996         * page/scrolling/mac/ScrollingCoordinatorMac.h:
2997         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
2998         (WebCore::ScrollingCoordinatorMac::handleWheelEvent):
2999         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
3000         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3001         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
3002         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
3003         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
3004         (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent):
3005         * platform/PlatformWheelEvent.cpp:
3006         (WebCore::operator<<):
3007         * platform/PlatformWheelEvent.h:
3008
3009 2020-05-29  Sergio Villar Senin  <svillar@igalia.com>
3010
3011         [WebXR] ActiveDOMObjects must call suspendIfNeeded() upon creation
3012         https://bugs.webkit.org/show_bug.cgi?id=212517
3013
3014         Reviewed by Žan Doberšek.
3015
3016         We weren't calling suspendIfNeeded() upon ActiveDOMObjects creation (XRSession and XRSystem)
3017         and that was triggering ASSERTION FAILED: m_suspendIfNeededWasCalled.
3018
3019         No new tests required as this was already detected by existing tests.
3020
3021         * Modules/webxr/WebXRSession.cpp:
3022         (WebCore::WebXRSession::WebXRSession): Call suspendIfNeeded().
3023         * Modules/webxr/WebXRSystem.cpp:
3024         (WebCore::WebXRSystem::WebXRSystem): Call suspendIfNeeded().
3025
3026 2020-05-29  Sergio Villar Senin  <svillar@igalia.com>
3027
3028         [WebXR] WebXRSystem::unregisterSimulatedXRDeviceForTesting() ASSERTs in m_immersiveDevices.contains(device)
3029         https://bugs.webkit.org/show_bug.cgi?id=212516
3030
3031         Reviewed by Žan Doberšek.
3032
3033         The ASSERT that was failing was wrong. It was assuming that every simulated device should be part of the list
3034         of immersive devices. That's wrong, as devices only supporting inline sessions are not in that list.
3035
3036         Apart from that, fake devices were not removed from the list of available devices in WebXRTest after
3037         disconnecting them all. That could potentially cause flakiness in the tests.
3038
3039         No new test required as the current tests were properly detecting the issue.
3040
3041         * Modules/webxr/WebXRSystem.cpp:
3042         (WebCore::WebXRSystem::registerSimulatedXRDeviceForTesting): Use XRSessionMode directly.
3043         (WebCore::WebXRSystem::unregisterSimulatedXRDeviceForTesting): Fixed the ASSERT. A simulated device
3044         might not be in the list of immersive devices if only supports inline sessions.
3045         * testing/WebXRTest.cpp:
3046         (WebCore::WebXRTest::disconnectAllDevices): Clear the list of devices after disconnecting.
3047
3048 2020-05-29  Youenn Fablet  <youenn@apple.com>
3049
3050         MediaPlayerPrivateMediaStreamAVFObjC should enqueue samples in a background thread
3051         https://bugs.webkit.org/show_bug.cgi?id=212073
3052
3053         Reviewed by Eric Carlson.
3054
3055         Do not hop to the main thread when rendering video samples anymore.
3056         Instead, we enqueue to the display layer in the background thread but still hop to the main thread for two things:
3057         - Update of various states of the player
3058         - keep a ref to the video sample if canvas rendering is needed.
3059
3060         Most display layer operations stay in the main thread (creation, flushing...).
3061         Deletion of the display layer and access from a background are covered by a lock.
3062         The m_canEnqueueDisplayLayer boolean ensures we do not enqueue too early when the display layer is not yet properly initialized.
3063
3064         LocalSampleBufferDisplayLayer needs to handle the fact that enqueueing might be done in a background thread.
3065         Instead of introducing a lock, we introduce a work queue and we hop to this queue whenever we need to enqueue/mutate the pending samples.
3066
3067         Covered by existing tests and manual testing.
3068
3069         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h:
3070         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:
3071         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
3072         (WebCore::LocalSampleBufferDisplayLayer::enqueueSample):
3073         (WebCore::LocalSampleBufferDisplayLayer::enqueueSampleBuffer):
3074         (WebCore::LocalSampleBufferDisplayLayer::requestNotificationWhenReadyForVideoData):
3075         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3076         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3077         (WebCore::videoTransformationMatrix):
3078         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::processNewVideoSampleAvailable):
3079         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable):
3080         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive):
3081         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::flushRenderers):
3082         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
3083         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
3084         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateRenderingMode):
3085         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack):
3086         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paintCurrentFrameInContext):
3087         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setBufferingPolicy):
3088         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rootLayerBoundsDidChange):
3089         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoTransformationMatrix): Deleted.
3090         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueCorrectedVideoSample): Deleted.
3091         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayLayer): Deleted.
3092
3093 2020-05-29  Carlos Garcia Campos  <cgarcia@igalia.com>
3094
3095         [GTK4] Implement script dialogs
3096         https://bugs.webkit.org/show_bug.cgi?id=212318
3097
3098         Reviewed by Adrian Perez de Castro.
3099
3100         Add more definitions to avoid ifdefs.
3101
3102         * platform/gtk/GtkVersioning.h:
3103         (gtk_entry_set_text):
3104         (gtk_entry_get_text):
3105         (gtk_label_set_line_wrap):
3106         (gtk_window_set_default):
3107         (gtk_widget_add_css_class):
3108
3109 2020-05-28  Andy Estes  <aestes@apple.com>
3110
3111         [Apple Pay] Buttons render with a corner radius of PKApplePayButtonDefaultCornerRadius even when explicitly specifying "border-radius: 0px"
3112         https://bugs.webkit.org/show_bug.cgi?id=212476
3113         <rdar://problem/63401433>
3114
3115         Reviewed by Antti Koivisto.
3116
3117         r256648 added support for customizing the corner radius of Apple Pay buttons using the
3118         border-radius CSS property. PassKit buttons have a default corner radius of 4, but
3119         border-radius has an initial value of 0, so to maintain web compatibility with existing
3120         buttons we only want to customize the corner radius when a border-radius value has been
3121         explicitly specified (otherwise, previously rounded buttons would all become squared off due
3122         to border-radius's initial value).
3123
3124         r256648 checked for a non-initial border-radius by calling RenderStyle::hasBorderRadius, but
3125         this check does not distinguish between an initial value and an explicit declaration of
3126         "border-radius: 0px". As a result, authors are unable to create Apple Pay buttons with
3127         square corners.
3128
3129         This patch adds a flag to RenderStyle::NonInheritedFlags that tracks whether any
3130         border-radius longhand has been explicitly set (or has explicitly inherited an explicitly set
3131         value), and uses that flag to adjust the computed border radius for Apple Pay buttons.
3132
3133         The addition of RenderStyle::NonInheritedFlags::hasExplicitlySetBorderRadius did not change
3134         the size of RenderStyle.
3135
3136         Tests: fast/css/appearance-apple-pay-button-border-radius.html
3137                fast/css/getComputedStyle/computed-style-apple-pay-button.html
3138
3139         * css/CSSProperties.json:
3140         * rendering/RenderThemeCocoa.mm:
3141         (WebCore::RenderThemeCocoa::adjustApplePayButtonStyle const):
3142         (WebCore::RenderThemeCocoa::paintApplePayButton):
3143         (WebCore::largestCornerRadius): Deleted.
3144         * rendering/style/RenderStyle.cpp:
3145         (WebCore::RenderStyle::RenderStyle):
3146         * rendering/style/RenderStyle.h:
3147         (WebCore::RenderStyle::hasExplicitlySetBorderRadius const):
3148         (WebCore::RenderStyle::setHasExplicitlySetBorderRadius):
3149         (WebCore::RenderStyle::NonInheritedFlags::operator== const):
3150         (WebCore::RenderStyle::NonInheritedFlags::copyNonInheritedFrom):
3151         * style/StyleBuilderCustom.h:
3152         (WebCore::Style::BuilderCustom::applyInheritBorderBottomLeftRadius):
3153         (WebCore::Style::BuilderCustom::applyValueBorderBottomLeftRadius):
3154         (WebCore::Style::BuilderCustom::applyInheritBorderBottomRightRadius):
3155         (WebCore::Style::BuilderCustom::applyValueBorderBottomRightRadius):
3156         (WebCore::Style::BuilderCustom::applyInheritBorderTopLeftRadius):
3157         (WebCore::Style::BuilderCustom::applyValueBorderTopLeftRadius):
3158         (WebCore::Style::BuilderCustom::applyInheritBorderTopRightRadius):
3159         (WebCore::Style::BuilderCustom::applyValueBorderTopRightRadius):
3160
3161 2020-05-28  Andy Estes  <aestes@apple.com>
3162
3163         Shrink StyleRareNonInheritedData by 8 bytes (on 64-bit platforms)
3164         https://bugs.webkit.org/show_bug.cgi?id=212484
3165
3166         Reviewed by Tim Horton.
3167
3168         There were 4 bytes of padding after shapeImageThreshold, enough to fit order and shrink the
3169         overall size of StyleRareNonInheritedData by 8 bytes on 64-bit platforms.
3170
3171         Before:
3172         Total byte size: 480
3173         Total pad bytes: 50
3174         Padding percentage: 10.42 %
3175
3176         After:
3177         Total byte size: 472
3178         Total pad bytes: 42
3179         Padding percentage: 8.90 %
3180
3181         * rendering/style/StyleRareNonInheritedData.cpp:
3182         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
3183         (WebCore::StyleRareNonInheritedData::operator== const):
3184         * rendering/style/StyleRareNonInheritedData.h:
3185
3186 2020-05-28  Megan Gardner  <megan_gardner@apple.com>
3187
3188         Responding to post commit review comments for https://bugs.webkit.org/show_bug.cgi?id=212060
3189
3190         * editing/InsertIntoTextNodeCommand.cpp:
3191         (WebCore::InsertIntoTextNodeCommand::doApply):
3192
3193 2020-05-28  Simon Fraser  <simon.fraser@apple.com>
3194
3195         Simplify EventDispatcher wheel event dispatch
3196         https://bugs.webkit.org/show_bug.cgi?id=212490
3197
3198         Reviewed by Tim Horton.
3199
3200         The various cross-thread bounces and completion lambdas in EventDispatcher::wheelEvent()
3201         and ScrollingTree code made the logic very hard to follow.
3202
3203         Moving the ScrollingThread::dispatch() into EventHandler code simplifies things a little,
3204         and allows for removal of the hokey "try to handle" ScrollingTree function, as well
3205         as the clunky completion function.
3206
3207         Now, EventHandler call shouldHandleWheelEventSynchronously(), then does the
3208         ScrollingThread::dispatch() which allows the lambda to easily call back into
3209         EventHandler for the main thread dispatch.
3210
3211         * page/scrolling/ScrollingTree.h:
3212         * page/scrolling/ThreadedScrollingTree.cpp:
3213         (WebCore::ThreadedScrollingTree::tryToHandleWheelEvent): Deleted.
3214         * page/scrolling/ThreadedScrollingTree.h:
3215
3216 2020-05-28  Oriol Brufau  <obrufau@igalia.com>
3217
3218         [css-grid] Fix referencing grid line names with auto repeat()
3219         https://bugs.webkit.org/show_bug.cgi?id=209572
3220
3221         Reviewed by Darin Adler.
3222
3223         This patch fixes multiple problems when referencing named grid lines with the presence of
3224         the auto repeat() syntax:
3225
3226           - If the 1st track was defined with auto repeat(), then the code used to assume that the
3227             referenced line appeared after the repeated tracks. But it may actually precede them.
3228
3229           - If the referenced line appeared both inside and outside the auto repeat(), then it
3230             could resolve to the outside raw index, without expanding the auto repeat().
3231
3232           - The logic for placing a placement property set to both an integer and an identifier
3233             was wrong with auto repeat().
3234             This patch fixes it by using the same proper logic that was already implemented in
3235             OrderedNamedLinesCollectorInGridLayout::collectLineNamesForIndex
3236
3237           - The indices of both implicit grid lines defined with grid-template-areas and explicit
3238             ones defined with grid-template-rows/columns used to be stored together in
3239             NamedGridColumnLines and NamedGridRowLines. This was problematic because the former
3240             indices already refer to the final explicit grid so they don't have to be increased when
3241             expanding an auto repeat(), but the latter ones should.
3242             Therefore, this patch stores the indices in separate fields and uses the correct logic
3243             for each one. This also fixes 'grid-template-areas: inherit'.
3244
3245         This patch is a port of these Chromium patches:
3246           - https://crrev.com/744426
3247           - https://crrev.com/745925
3248           - https://crrev.com/747631
3249           - https://crrev.com/747669
3250           - https://crrev.com/771984
3251
3252         Tests: imported/w3c/web-platform-tests/css/css-grid/placement/grid-placement-using-named-grid-lines-002.html
3253                imported/w3c/web-platform-tests/css/css-grid/placement/grid-placement-using-named-grid-lines-004.html
3254                imported/w3c/web-platform-tests/css/css-grid/placement/grid-placement-using-named-grid-lines-005.html
3255                imported/w3c/web-platform-tests/css/css-grid/placement/grid-placement-using-named-grid-lines-008.html
3256                imported/w3c/web-platform-tests/css/css-grid/placement/grid-placement-using-named-grid-lines-009.html
3257
3258         * rendering/style/GridPositionsResolver.cpp:
3259         (WebCore::NamedLineCollection::NamedLineCollection):
3260         (WebCore::NamedLineCollection::hasExplicitNamedLines const):
3261         (WebCore::NamedLineCollection::hasNamedLines const):
3262         (WebCore::NamedLineCollection::contains const):
3263         (WebCore::NamedLineCollection::firstExplicitPosition const):
3264         (WebCore::NamedLineCollection::firstPosition const):
3265         * rendering/style/GridPositionsResolver.h:
3266         * rendering/style/RenderStyle.h:
3267         (WebCore::RenderStyle::implicitNamedGridColumnLines const):
3268         (WebCore::RenderStyle::implicitNamedGridRowLines const):
3269         (WebCore::RenderStyle::setImplicitNamedGridColumnLines):
3270         (WebCore::RenderStyle::setImplicitNamedGridRowLines):
3271         * rendering/style/StyleGridData.cpp:
3272         (WebCore::StyleGridData::StyleGridData):
3273         * rendering/style/StyleGridData.h:
3274         (WebCore::StyleGridData::operator== const):
3275         * style/StyleBuilderCustom.h:
3276         (WebCore::Style::BuilderCustom::applyInitialGridTemplateAreas):
3277         (WebCore::Style::BuilderCustom::applyInheritGridTemplateAreas):
3278         (WebCore::Style::BuilderCustom::applyValueGridTemplateAreas):
3279
3280 2020-05-28  Andres Gonzalez  <andresg_22@apple.com>
3281
3282         [ macOS Debug ] accessibility/roles-exposed.html is a flaky timeout
3283         https://bugs.webkit.org/show_bug.cgi?id=212478
3284         <rdar://problem/63411656>
3285
3286         Reviewed by Chris Fleizach.
3287
3288         Logging the backingObject in every call to accessibilityAttributeValue
3289         seems to be causing this long test to take too long and timeout in slow
3290         systems.
3291
3292         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3293         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3294
3295 2020-05-27  Keith Miller  <keith_miller@apple.com>
3296
3297         for-of should check the iterable is a JSArray for FastArray in DFG iterator_open
3298         https://bugs.webkit.org/show_bug.cgi?id=212383
3299
3300         Reviewed by Saam Barati.
3301
3302         Update various InheritsTraits specializations to contain a typeRange member.
3303         Also, change the inherits function to use inheritsJSTypeImpl like the JSC
3304         variants.
3305
3306         * bindings/js/JSDocumentCustom.h:
3307         (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSDocument>::inherits):
3308         * bindings/js/JSElementCustom.h:
3309         (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSElement>::inherits):
3310         * bindings/js/JSEventCustom.h:
3311         (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSEvent>::inherits):
3312         * bindings/js/JSNodeCustom.h:
3313         (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSNode>::inherits):
3314         * bindings/scripts/CodeGeneratorJS.pm:
3315         (GenerateHeader):
3316
3317 2020-05-27  Darin Adler  <darin@apple.com>
3318
3319         [Cocoa] Pass all defines from Platform.h to various scripts, not just the ones from .xcconfig
3320         https://bugs.webkit.org/show_bug.cgi?id=212451
3321
3322         Reviewed by Sam Weinig.
3323
3324         * DerivedSources.make: Run the preprocessor on Platform.h and parse the output into
3325         FEATURE_AND_PLATFORM_DEFINES. Use that and FEATURE_AND_PLATFORM_DEFINE_DEPENDENCIES
3326         whenever we need a list of defines. Also took out some Windows-specific stuff since
3327         this is now only used on Mac platforms.
3328
3329 2020-05-27  Simon Fraser  <simon.fraser@apple.com>
3330
3331         ScrollingTreeMac::eventListenerRegionTypesForPoint() needs to convert the point to local coordinates
3332         https://bugs.webkit.org/show_bug.cgi?id=212440
3333
3334         Reviewed by Tim Horton.
3335
3336         ScrollingTreeMac::eventListenerRegionTypesForPoint() needs to convert the point to local coordinates
3337         before consulting the event region.
3338
3339         Also made EventListenerRegionType loggabale.
3340
3341         Will be tested by wheel event tests once we switch to using these kinds of regions.
3342
3343         * page/scrolling/mac/ScrollingTreeMac.mm:
3344         (collectDescendantLayersAtPoint):
3345         (ScrollingTreeMac::scrollingNodeForPoint):
3346         (ScrollingTreeMac::eventListenerRegionTypesForPoint const):
3347         * rendering/style/RenderStyleConstants.cpp:
3348         (WebCore::operator<<):
3349         * rendering/style/RenderStyleConstants.h:
3350
3351 2020-05-28  Youenn Fablet  <youenn@apple.com>
3352
3353         RealtimeIncomingVideoSourceCocoa::OnFrame should use video frame timestamp
3354         https://bugs.webkit.org/show_bug.cgi?id=212402
3355
3356         Reviewed by Eric Carlson.
3357
3358         Use timestamp provided from the libwebrtc backend instread of marking the frames as display immediately.
3359         Update LocalSampleBufferDisplayLayer to mark the frame as display immediately if their presentation time is in the past since we guarantee the frames are in order.
3360
3361         Remove the offset correction in MediaPlayerPrivateMediaStreamAVFObjC.
3362         This does not work well when the display layer is in GPU process and it is simpler to use the system clock which is what AVSampleBufferDisplayLayser is using if controlTimebase is not set.
3363
3364         Manually tested.
3365
3366         * platform/graphics/avfoundation/SampleBufferDisplayLayer.h:
3367         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:
3368         (WebCore::LocalSampleBufferDisplayLayer::enqueueSample):
3369         (WebCore::LocalSampleBufferDisplayLayer::removeOldSamplesFromPendingQueue):
3370         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3371         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3372         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
3373         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoSampleAvailable):
3374         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferDisplayLayerStatusDidChange):
3375         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive):
3376         * platform/mediastream/VideoTrackPrivateMediaStream.h:
3377         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
3378         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
3379
3380 2020-05-28  Antti Koivisto  <antti@apple.com>
3381
3382         Incorrect clipping of absolute and fixed elements inside stacking-context composited overflow:hidden
3383         https://bugs.webkit.org/show_bug.cgi?id=212419
3384         <rdar://problem/55856170>
3385
3386         Reviewed by Simon Fraser.
3387
3388         We incorrectly clip descendants that are not in containing block chain.
3389         There is already code to do the correct clipping, it just needs be enabled in this case.
3390
3391         Tests: compositing/overflow/non-contained-descendant-clipping-absolute.html
3392                compositing/overflow/non-contained-descendant-clipping-fixed.html
3393
3394         * rendering/RenderLayer.cpp:
3395         (WebCore::RenderLayer::RenderLayer):
3396         * rendering/RenderLayer.h:
3397
3398         Add hasCompositedNonContainedDescendants bit.
3399
3400         * rendering/RenderLayerCompositor.cpp:
3401         (WebCore::RenderLayerCompositor::CompositingState::stateForPaintOrderChildren const):
3402         (WebCore::RenderLayerCompositor::CompositingState::updateWithDescendantStateAndLayer):
3403
3404         Check if the parent layer is for a containing block of this layer.
3405
3406         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
3407
3408         Update the bit.
3409
3410         (WebCore::RenderLayerCompositor::traverseUnchangedSubtree):
3411         (WebCore::RenderLayerCompositor::clipsCompositingDescendants):
3412
3413         Pick the clipping path where descendants are not clipped.
3414
3415 2020-05-27  Noam Rosenthal  <noam@webkit.org>
3416
3417         Implement AccessKeyLabel attribute.
3418         https://bugs.webkit.org/show_bug.cgi?id=72715
3419
3420         Spec: https://html.spec.whatwg.org/multipage/interaction.html#dom-accesskeylabel
3421
3422         As per spec, return the modifiers+accessKey when requesting the element accessKeyLabel.
3423
3424         Equivalent to the existing Firefox implementation and (pending) Chrome implementation.
3425
3426         Alt is the hardcoded modifier for any non-cocoa platform, so hardcode it also for the label.
3427         Use modifier text for Mac/iOS as it can change (e.g. for voice-over).
3428
3429         Reviewed by Darin Adler.
3430
3431         Test: fast/forms/access-key-label.html
3432
3433         * html/HTMLElement.cpp:
3434         (WebCore::HTMLElement::accessKeyLabel const):
3435         * html/HTMLElement.h:
3436         * html/HTMLElement.idl:
3437
3438 2020-05-27  Sam Weinig  <weinig@apple.com>
3439
3440         Extended Color: Refactor FloatComponents and ColorComponents into a single templatized ColorComponents class
3441         https://bugs.webkit.org/show_bug.cgi?id=212446
3442
3443         Reviewed by Simon Fraser.
3444
3445         Merge FloatComponents and ColorComponents into ColorComponents<T> and move them to their own
3446         header. This avoids duplicate code and paves the way for further generalization down the line.
3447         
3448         Also moves some utility functions to ColorUtilities.h from SimpleColor.h as they make more sense
3449         in the former.
3450
3451         * Headers.cmake:
3452         * WebCore.xcodeproj/project.pbxproj:
3453         Add ColorComponents.h
3454
3455         * platform/graphics/ColorComponents.h: Copied from Source/WebCore/platform/graphics/ColorUtilities.h.
3456         Moved ColorComponents to its own header and templatized it to allow it to serve the
3457         needs of both the old ColorComponents and old FloatComponents classes.
3458         
3459         * platform/graphics/ColorUtilities.cpp:
3460         * platform/graphics/ColorUtilities.h:
3461         Removed ColorComponents/FloatComponents and update existing usages to their new names.
3462         Also moved roundAndClampColorChannel, fastMultiplyBy255, fastDivideBy255 
3463         and colorFloatToSimpleColorByte here from SimpleColor to make it clear where
3464         general helper functions can go.
3465         
3466         * platform/graphics/Color.h:
3467         * platform/graphics/Color.cpp:
3468         (WebCore::Color::colorSpaceAndComponents const):
3469         (WebCore::Color::toSRGBAComponentsLossy const):
3470         * platform/graphics/ExtendedColor.h:
3471         (WebCore::ExtendedColor::channels const):
3472         Update for rename of FloatComponents to ColorComponents<float>.
3473
3474         * platform/graphics/SimpleColor.cpp:
3475         (WebCore::makeSimpleColorFromHSLA):
3476         Use structured bindings and simplify code. 
3477
3478         * platform/graphics/SimpleColor.h:
3479         (WebCore::roundAndClampColorChannel): Deleted.
3480         (WebCore::fastMultiplyBy255): Deleted.
3481         (WebCore::fastDivideBy255): Deleted.
3482         (WebCore::colorFloatToSimpleColorByte): Deleted.
3483         As noted above, moved roundAndClampColorChannel, fastMultiplyBy255, fastDivideBy255 
3484         and colorFloatToSimpleColorByte to ColorUtilities.h
3485
3486         * platform/graphics/filters/FEColorMatrix.cpp:
3487         Update for rename of FloatComponents to ColorComponents<float>.
3488
3489         * platform/graphics/filters/FEDisplacementMap.cpp:
3490         (WebCore::byteOffsetOfPixel):
3491         Moved byteOffsetOfPixel here from ColorUtilities. This file is the only user
3492         and it wasn't general in a way that was clear for other users.
3493
3494         * platform/graphics/filters/FELighting.cpp:
3495         (WebCore::FELighting::drawLighting):
3496         Update for rename of FloatComponents to ColorComponents<float>.
3497
3498         * platform/graphics/filters/FEMorphology.cpp:
3499         (WebCore::makeColorComponentsfromPixelValue):
3500         Added. Used to be ColorComponents::fromRGBA(), but was only used here
3501         and didn't seem generally useful.
3502
3503         (WebCore::makePixelValueFromColorComponents):
3504         Added. Used to be ColorComponents::toRGBA(), but was only used here
3505         and didn't seem generally useful.
3506         
3507         (WebCore::minOrMax):
3508         (WebCore::columnExtremum):
3509         (WebCore::kernelExtremum):
3510         (WebCore::FEMorphology::platformApplyGeneric):
3511         Update for rename of FloatComponents to ColorComponents<float> and ColorComponents
3512         to ColorComponents<uint8_t>.
3513
3514         * platform/graphics/filters/FETurbulence.cpp:
3515         (WebCore::FETurbulence::noise2D const):
3516         (WebCore::toIntBasedColorComponents):
3517         (WebCore::FETurbulence::calculateTurbulenceValueForPoint const):
3518         (WebCore::FETurbulence::fillRegion const):
3519         * platform/graphics/filters/FETurbulence.h:
3520         Update for rename of FloatComponents to ColorComponents<float> and ColorComponents
3521         to ColorComponents<uint8_t>. Also renames toColorComponents to toIntBasedColorComponents
3522         as the former was no longer specific enough. Updated to use std::clamp.
3523
3524         * platform/graphics/filters/FilterOperation.cpp:
3525         (WebCore::BasicColorMatrixFilterOperation::transformColor const):
3526         (WebCore::BasicComponentTransferFilterOperation::transformColor const):
3527         (WebCore::InvertLightnessFilterOperation::transformColor const):
3528         (WebCore::InvertLightnessFilterOperation::inverseTransformColor const):
3529         * platform/graphics/filters/FilterOperation.h:
3530         (WebCore::FilterOperation::transformColor const):
3531         (WebCore::FilterOperation::inverseTransformColor const):
3532         * platform/graphics/filters/FilterOperations.cpp:
3533         (WebCore::FilterOperations::transformColor const):
3534         (WebCore::FilterOperations::inverseTransformColor const):
3535         Update for rename of FloatComponents to ColorComponents<float>.
3536
3537 2020-05-27  David Kilzer  <ddkilzer@apple.com>
3538
3539         REGRESSION (r260023): ITP sparse plist decoding.
3540         <https://bugs.webkit.org/show_bug.cgi?id=212424>
3541         <rdar://problem/63683055>
3542
3543         Reviewed by John Wilander.
3544
3545         Reverted changeset:
3546
3547         "KeyedDecoder functions in ResourceLoadStatistics.{cpp,h} should return bool and use WARN_UNUSED_RETURN"
3548         https://bugs.webkit.org/show_bug.cgi?id=210414
3549         https://trac.webkit.org/changeset/260023
3550
3551         The revert did not compile due to changes in the KeyedDecoder
3552         class that require checking the return value of its methods, so
3553         additional changes were made below.
3554
3555         * loader/ResourceLoadStatistics.cpp:
3556         (WebCore::decodeHashCountedSet):
3557         (WebCore::decodeHashSet):
3558         - Use IGNORE_WARNINGS_BEGIN("unused-result")/IGNORE_WARNINGS_END
3559           to suppress warning about ignoring the return value from
3560           KeyeDecoder::decodeObjects() since decoding these objects is
3561           optional.
3562         (WebCore::decodeOptionSet):
3563         - Check return value of KeyedDecoder::decodeUInt64() before
3564           setting `optionSet` parameter.
3565
3566 2020-05-27  Andres Gonzalez  <andresg_22@apple.com>
3567
3568         Empty alt attribute does not ignore the image for accessibility clients in Safari.
3569         https://bugs.webkit.org/show_bug.cgi?id=212432
3570
3571         Reviewed by Chris Fleizach.
3572
3573         Test: accessibility/img-alt-attribute-unassigned-empty.html
3574
3575         - AccessibilityRenderObject::computeAccessibilityIsIgnored was handling
3576         the case of images too late, after checking for ariaRoleAttribute(). So
3577         if an image had a role attribute, it was exposed regardless whether its
3578         alt attribute was an empty string. This change moves the handling of
3579         images above the check for ariaroleAttribute and hence honors the empty
3580         alt attribute rule.
3581         - Also images that have an aria-label attribute are now exposed.
3582         - Added logging of AccessibilityObjectInclusion.
3583         - Changed signature of log(RefPtr<AXCoreObject>) as pointed out by Darin Adler in a separate review.
3584
3585         * accessibility/AXLogger.cpp:
3586         (WebCore::AXLogger::log):
3587         (WebCore::operator<<):
3588         * accessibility/AXLogger.h:
3589         * accessibility/AccessibilityNodeObject.cpp:
3590         (WebCore::AccessibilityNodeObject::determineAccessibilityRole):
3591         (WebCore::AccessibilityNodeObject::isImage const): Moved to base class.
3592         * accessibility/AccessibilityNodeObject.h:
3593         * accessibility/AccessibilityObject.h:
3594         * accessibility/AccessibilityObjectInterface.h:
3595         (WebCore::AXCoreObject::isImage const):
3596         * accessibility/AccessibilityRenderObject.cpp:
3597         (WebCore::objectInclusionFromAltText):
3598         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
3599         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
3600         (WebCore::AccessibilityRenderObject::updateRoleAfterChildrenCreation):
3601         * accessibility/isolatedtree/AXIsolatedObject.cpp:
3602         (WebCore::AXIsolatedObject::initializeAttributeData):
3603         * accessibility/isolatedtree/AXIsolatedObject.h:
3604
3605 2020-05-27  Chris Dumez  <cdumez@apple.com>
3606
3607         pageshow only fires the first time the back button is pressed
3608         https://bugs.webkit.org/show_bug.cgi?id=156356
3609         <rdar://problem/29256489>
3610
3611         Reviewed by Alexey Proskuryakov.
3612
3613         When FrameLoader::commitProvisionalLoad() would restore a page from the back/forward
3614         cache, it would only call FrameLoader::checkCompleted() in the main frame and fail
3615         to do so in subframes. Calling checkCompleted() is important, not only because it
3616         sets m_isComplete to true but also because it calls checkCallImplicitClose(), which
3617         resets m_didCallImplicitClose to true and m_wasUnloadEventEmitted to false.
3618
3619         Because checkCompleted() was not called, FrameLoader::dispatchUnloadEvents() would then
3620         fail to fire the pagehide event because the `m_didCallImplicitClose && !m_wasUnloadEventEmitted`
3621         was not met. Also, even though checkCompleted() was called for the main frame, if there
3622         are subframes, it would just return early because allChildrenAreComplete() returned false.
3623         Later on, when trying to fire the pageshow event, it would fail to because we have logic
3624         in DOMWindow::dispatchEvent() to avoid firing a pageshow event if we did not previously
3625         send a pagehide event.
3626
3627         To address the issue, I now call checkCompleted() in FrameLoader::open() for subframes, as
3628         this gets called for every frame during restoration from the back/forward cache. For the main
3629         frame, we keep calling checkCompleted(), after we've called sendRemainingDelegateMessages().
3630
3631         Test: fast/history/multiple-back-forward-navigations.html
3632
3633         * loader/FrameLoader.cpp:
3634         (WebCore::FrameLoader::open):
3635
3636 2020-05-27  Sam Weinig  <weinig@apple.com>
3637
3638         Extended Color: Move ColorMatrix to its own files
3639         https://bugs.webkit.org/show_bug.cgi?id=212431
3640
3641         Reviewed by Dean Jackson.
3642
3643         Move ColorMatrix to its own files from ColorUtilities.h/cpp
3644
3645         * Headers.cmake:
3646         * Sources.txt:
3647         * WebCore.xcodeproj/project.pbxproj:
3648         * platform/graphics/ColorMatrix.cpp: Copied from Source/WebCore/platform/graphics/ColorUtilities.cpp.
3649         * platform/graphics/ColorMatrix.h: Copied from Source/WebCore/platform/graphics/ColorUtilities.h.
3650         * platform/graphics/ColorUtilities.cpp:
3651         * platform/graphics/ColorUtilities.h:
3652         * platform/graphics/filters/FilterOperation.cpp:
3653
3654 2020-05-27  David Kilzer  <ddkilzer@apple.com>
3655
3656         Add OptionSetTraits<> and use with WebCore::DragDestinationAction
3657         <https://webkit.org/b/212397>
3658
3659         Reviewed by Alex Christensen.
3660
3661         * page/DragActions.h:
3662         (WTF::OptionSetTraits<WebCore::DragDestinationAction>):
3663         - Add for use with OptionSet<>.
3664
3665 2020-05-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3666
3667         [Clipboard API] Support reading "image/png" on ClipboardItem
3668         https://bugs.webkit.org/show_bug.cgi?id=212339
3669         <rdar://problem/63588957>
3670
3671         Reviewed by Tim Horton.
3672
3673         Adds support for reading "image/png" data via ClipboardItem.getType(). See below for more details.
3674
3675         Tests:  ClipboardTests.ConvertTIFFToPNGWhenPasting
3676                 editing/async-clipboard/clipboard-read-write-images.html
3677
3678         * Modules/async-clipboard/Clipboard.cpp:
3679         (WebCore::Clipboard::getType):
3680         (WebCore::Clipboard::updateSessionValidity):
3681
3682         Factor out logic for invalidating the `Clipboard`'s active `Pasteboard` object into a helper method. This is
3683         invoked after reading data from the clipboard, and verifies that the changeCount of the pasteboard is still the
3684         same as it was upon initially reading the contents of the clipboard. If the clipboard contents changed, we
3685         invalidate the session, and `Clipboard` is subsequently denied pasteboard access (until the next time the user
3686         explicitly grants programmatic pasteboard access).
3687
3688         Note that this step is here for correctness rather than security. While it is true that a compromised web
3689         process could fake the changeCount at any given moment, other fairly recent changes around WebPasteboardProxy in
3690         the UI process makes it impossible to take advantage of this fact to arbitrarily read content from the system
3691         pasteboard. Instead of simply reading the empty string, this invalidation ensures that we actually reject the
3692         promise returned by the async clipboard API.
3693
3694         * Modules/async-clipboard/Clipboard.h:
3695         * Modules/async-clipboard/ClipboardImageReader.cpp: Added.
3696
3697         Add a PasteboardFileReader subclass that is responsible for sanitizing image data from the pasteboard into
3698         data that may be exposed to the page via clipboard API. On both macOS and iOS, this ensures that potentially
3699         sensitive EXIF data is stripped via conversion to the platform image type and back. On macOS, this additionally
3700         allows us to handle transcoding TIFF data on the pasteboard to PNG (this is covered by the new API test).
3701
3702         (WebCore::ClipboardImageReader::readBuffer):
3703
3704         Add a stub implementation for non-Cocoa platforms for now, which don't implement this part of the API.
3705
3706         (WebCore::ClipboardImageReader::shouldReadBuffer const):
3707
3708         Add a new hook to skip over certain types when reading pasteboard data into Files. In particular,
3709         `ClipboardImageReader` skips over any MIME type that does not match the MIME type specified (for now, this is
3710         limited to "image/png", but may be extended to include more image types in the future after we implement more
3711         transcoding logic).
3712
3713         * Modules/async-clipboard/ClipboardImageReader.h: Added.
3714         (WebCore::ClipboardImageReader::ClipboardImageReader):
3715         (WebCore::ClipboardImageReader::takeResult):
3716         * Modules/async-clipboard/ios/ClipboardImageReaderIOS.mm: Added.
3717         (WebCore::ClipboardImageReader::readBuffer):
3718
3719         Add iOS-specific `(PNG) => PNG` transcoding logic.
3720
3721         * Modules/async-clipboard/mac/ClipboardImageReaderMac.mm: Added.
3722         (WebCore::ClipboardImageReader::readBuffer):
3723
3724         Add macOS-specific `(PNG, TIFF) => PNG` transcoding logic.
3725
3726         * Sources.txt:
3727         * SourcesCocoa.txt:
3728         * WebCore.xcodeproj/project.pbxproj:
3729         * platform/Pasteboard.h:
3730         (WebCore::PasteboardFileReader::shouldReadBuffer const):
3731         * platform/cocoa/PasteboardCocoa.mm:
3732         (WebCore::Pasteboard::read):
3733
3734         Add support for targeting a given pasteboard item index when reading files on Cocoa platforms.
3735
3736         * platform/gtk/PasteboardGtk.cpp:
3737         (WebCore::Pasteboard::read):
3738         * platform/ios/PlatformPasteboardIOS.mm:
3739         (WebCore::safeTypeForDOMToReadAndWriteForPlatformType):
3740         (WebCore::webSafeTypes):
3741         (WebCore::PlatformPasteboard::informationForItemAtIndex):
3742
3743         Expose "image/png" as one of the readable pasteboard types on iOS when using the async clipboard API. For some
3744         reason, this adjustment was made on macOS, but wasn't done on iOS, which led to a missing "image/png" type when
3745         asking for `ClipboardItem.types`.
3746
3747         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
3748
3749         Add support for writing "image/png "data to the system pasteboard (note that this data has been sanitized
3750         already, as it has been processed through `ClipboardItemTypeLoader::sanitizeDataIfNeeded()`). We simply needed
3751         to use `forEachPlatformStringOrBuffer` instead of just `forEachPlatformString` when writing the custom
3752         pasteboard data.
3753
3754         (WebCore::createItemProviderRegistrationList):
3755         * platform/libwpe/PasteboardLibWPE.cpp:
3756         (WebCore::Pasteboard::read):
3757         * platform/win/PasteboardWin.cpp:
3758         (WebCore::Pasteboard::read):
3759
3760 2020-05-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
3761
3762         REGRESSION (r254541): Valid mime types can only be added to the HashSet of the supported types for encoding
3763         https://bugs.webkit.org/show_bug.cgi?id=212427
3764
3765         Reviewed by Darin Adler.
3766
3767         Add back a check for the mime type validity which was removed in r254541.
3768
3769         * platform/MIMETypeRegistry.cpp:
3770         (WebCore::MIMETypeRegistry::createMIMETypeRegistryThreadGlobalData):
3771
3772 2020-05-27  Devin Rousso  <drousso@apple.com>
3773
3774         Web Inspector: replace `featureGuard` and `availability` with a combined `condition` that accepts any macro
3775         https://bugs.webkit.org/show_bug.cgi?id=210014
3776
3777         Reviewed by Brian Burg.
3778
3779         Previously, the generated InspectorBackendCommands.js would include code for things that the
3780         backend doesn't actually support. By using actual macros and preprocessing that file, we can
3781         ensure that the frontend doesn't incorrectly think that something is supported by the page
3782         being inspected:
3783          - the `Canvas` commands and events related to shader programs/pipelines should only exist
3784            when the corresponding context type exists, namely `ENABLE(WEBGL)` and `ENABLE(WEBGPU)`.
3785          - iOS doesn't support showing rulers, so create a variant of `DOM.setInspectModeEnabled`
3786            that only exists for `PLATFORM(IOS_FAMILY)` that doesn't have the `showRulers` optional
3787            parameter, as well as removing `Page.setShowRulers` entirely.
3788          - setting the forced appearance should only be possible if dark mode is supported.
3789          - web archives only exist if CF is used.
3790
3791         * inspector/InspectorInstrumentation.h:
3792         * inspector/InspectorInstrumentation.cpp:
3793         * inspector/agents/InspectorCanvasAgent.h:
3794         * inspector/agents/InspectorCanvasAgent.cpp:
3795         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
3796         (WebCore::InspectorCanvasAgent::enable):
3797         (WebCore::InspectorCanvasAgent::startRecording):
3798         (WebCore::InspectorCanvasAgent::reset):
3799         (WebCore::InspectorCanvasAgent::unbindCanvas):
3800         * inspector/InspectorShaderProgram.h:
3801         * inspector/InspectorShaderProgram.cpp:
3802         (WebCore::InspectorShaderProgram::requestShaderSource):
3803         (WebCore::InspectorShaderProgram::updateShader):
3804         * inspector/agents/InspectorDOMAgent.h:
3805         * inspector/agents/InspectorDOMAgent.cpp:
3806         (WebCore::InspectorDOMAgent::setInspectModeEnabled):
3807         * inspector/agents/InspectorPageAgent.h:
3808         * inspector/agents/InspectorPageAgent.cpp:
3809         (WebCore::InspectorPageAgent::enable):
3810         (WebCore::InspectorPageAgent::disable):
3811         (WebCore::InspectorPageAgent::setForcedAppearance):
3812         (WebCore::InspectorPageAgent::archive):
3813
3814         * Configurations/FeatureDefines.xcconfig:
3815         Add `ENABLE_WEB_ARCHIVE` since it's always enabled in wtf/PlatformEnableCocoa.h.
3816
3817         * inspector/InspectorFrontendHost.idl:
3818         Drive-by: replace the `#if` with the IDL `[Conditional=]`.
3819
3820 2020-05-27  Miguel Gomez  <magomez@igalia.com>
3821
3822         [WPE] REGRESSION(r253675) Crash when using threaded rendering
3823         https://bugs.webkit.org/show_bug.cgi?id=212404
3824
3825         Reviewed by Carlos Garcia Campos.
3826
3827         Check whether the GraphicsContext has a PlatformGraphicsContext before trying to paint with
3828         it. If there's no PlatformGraphicsContext, paint using the GraphicsContext methods instead.
3829
3830         * platform/graphics/cairo/ImageBufferCairoBackend.cpp:
3831         (WebCore::ImageBufferCairoBackend::draw):
3832         (WebCore::ImageBufferCairoBackend::drawPattern):
3833
3834 2020-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
3835
3836         Unreviewed. Fix build warning with GTK4
3837
3838         * platform/gtk/GtkUtilities.cpp:
3839         (WebCore::widgetRootCoords):
3840
3841 2020-05-27  David Kilzer  <ddkilzer@apple.com>
3842
3843         Use OptionSet<DragDestinationAction> for mask values
3844         <https://webkit.org/b/212115>
3845         <rdar://problem/63423380>
3846
3847         Reviewed by Alex Christensen.
3848
3849         DragDestinationAction is used as both individual values and as a
3850         bit mask. This changes bit mask uses to OptionSet<> and renames
3851         variables to denote masks.
3852
3853         * page/DragActions.h:
3854         (WebCore::DragDestinationAction):
3855         - Convert to enum class and remove *None and *Any values.
3856         (WebCore::DragDestinationActionAny):
3857         - Add helper function to return OptionSet<DragDestinationAction>
3858           with all values set.
3859         * page/DragController.cpp:
3860         (WebCore::DragController::performDragOperation):
3861         (WebCore::DragController::dragEnteredOrUpdated):
3862         (WebCore::DragController::tryDocumentDrag):
3863         (WebCore::DragController::concludeEditDrag):
3864         * page/DragController.h:
3865         (WebCore::DragController::dragDestinationAction const): Rename.
3866         (WebCore::DragController::dragDestinationActionMask const):
3867         - Rename dragDestinationAction() to dragDestinationActionMask().
3868         * platform/DragData.cpp:
3869         (WebCore::DragData::DragData):
3870         * platform/DragData.h:
3871         (WebCore::DragData::DragData):
3872         - Use DragDestinationActionAny() in place of removed
3873           DragDestinationActionAny.
3874         (WebCore::DragData::dragDestinationAction const): Rename.
3875         (WebCore::DragData::dragDestinationActionMask const):
3876         - Rename dragDestinationAction() to dragDestinationActionMask().
3877         (WebCore::DragData::operator =):
3878         * platform/cocoa/DragDataCocoa.mm:
3879         (WebCore::DragData::DragData):
3880
3881 2020-05-27  Youenn Fablet  <youenn@apple.com>
3882
3883         Video freezes when attaching a local MediaStream to multiple elements
3884         https://bugs.webkit.org/show_bug.cgi?id=194802
3885         <rdar://problem/63613107>
3886
3887         Reviewed by Eric Carlson.
3888
3889         AVSampleBufferDisplayLayer sometimes does not update the rendering when the same local source is rendered several times.
3890         To workaround this, we set kCMSampleAttachmentKey_DisplayImmediately to true, which fixes the issue as per my testing.
3891         We clone the sample buffer before setting this property as it might not be thread safe to modify the attachments of a sample
3892         that might also be encoded.
3893         We implement this at LocalSampleBufferDisplayLayer level and enable this for local capture sources only.
3894
3895         Manually tested.
3896
3897         * platform/graphics/avfoundation/SampleBufferDisplayLayer.h:
3898         (WebCore::SampleBufferDisplayLayer::setRenderPolicy):
3899         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.h:
3900         (WebCore::LocalSampleBufferDisplayLayer::setRenderPolicy):
3901         * platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:
3902         (WebCore::LocalSampleBufferDisplayLayer::enqueueSample):
3903         (WebCore::LocalSampleBufferDisplayLayer::removeOldSamplesFromPendingQueue):
3904         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3905         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
3906         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack):
3907         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h:
3908         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
3909         (WebCore::setSampleBufferAsDisplayImmediately):
3910         (WebCore::MediaSampleAVFObjC::setAsDisplayImmediately):
3911         (WebCore::MediaSampleAVFObjC::cloneSampleBuffer):
3912
3913 2020-05-19  Sergio Villar Senin  <svillar@igalia.com>
3914
3915         [WebXR] Implement XRSession::requestAnimationFrame()
3916         https://bugs.webkit.org/show_bug.cgi?id=212099
3917
3918         Reviewed by Youenn Fablet.
3919
3920         The WebXR spec defines a requestAnimationFrame() mechanism to provide information about XR tracking devices
3921         using callbacks. It's pretty similar to the requestAnimationFrame() exposed by Window but only used
3922         to update WebXR content. We're adding a basic implementation of this mechanism as long as cancellation
3923         support. It requires some platform code that will be added in follow up patches. That platform code will
3924         provide information like devices' refresh rates, pose (position & orientation), display resolution, etc...
3925
3926         This patch also replaces the type of the callback id from int to unsigned int as per the following change
3927         in specs https://github.com/immersive-web/webxr/pull/1062.
3928
3929         Apart from that we're adding a missing adoptRef() in the testing code that was causing assertions in some
3930         of the tests that are being unskipped as part of this change.
3931
3932         * Modules/webxr/WebXRSession.cpp:
3933         (WebCore::WebXRSession::WebXRSession):
3934         (WebCore::WebXRSession::animationTimerFired): Added.
3935         (WebCore::WebXRSession::scheduleAnimation): Ditto.
3936         (WebCore::WebXRSession::requestAnimationFrame): Ditto.
3937         (WebCore::WebXRSession::cancelAnimationFrame):
3938         * Modules/webxr/WebXRSession.h:
3939         * Modules/webxr/XRFrameRequestCallback.h:
3940         (WebCore::XRFrameRequestCallback::callbackId):
3941         (WebCore::XRFrameRequestCallback::setCallbackId):
3942         (WebCore::XRFrameRequestCallback::cancel):
3943         (WebCore::XRFrameRequestCallback::isCancelled const):
3944         * testing/WebFakeXRDevice.cpp:
3945         (WebCore::WebFakeXRDevice::simulateInputSourceConnection):
3946         * testing/WebFakeXRDevice.h:
3947         * testing/WebFakeXRInputController.h:
3948
3949 2020-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
3950
3951         [GTK4] Make PointerLock work
3952         https://bugs.webkit.org/show_bug.cgi?id=212314
3953
3954         Reviewed by Adrian Perez de Castro.
3955
3956         * platform/gtk/GtkUtilities.cpp:
3957         (WebCore::widgetDevicePosition): Helper function to avoid #ifdefs due to GTK version differences.
3958         * platform/gtk/GtkUtilities.h:
3959
3960 2020-05-27  Peng Liu  <peng.liu6@apple.com>
3961
3962         VideoFullscreenInterfaceAVKit is leaking when a video element enters and exits fullscreen/picture-in-picture
3963         https://bugs.webkit.org/show_bug.cgi?id=212293
3964
3965         Reviewed by Youenn Fablet.
3966
3967         WebAVPlayerViewControllerDelegate is created and retained by VideoFullscreenInterfaceAVKit,
3968         but it has a RefPtr to VideoFullscreenInterfaceAVKit. This leads to a memory leak
3969         when a video element enters and exit fullscreen or Picture-in-Picture. This patch
3970         replaces the RefPtr with a WeakPtr to fix the leak.
3971
3972         With this patch, we config playerController in VideoFullscreenInterfaceAVKit::setupFullscreen()
3973         and VideoFullscreenInterfaceAVKit::cleanupFullscreen(), so that we can avoid relying on
3974         VideoFullscreenManagerProxy::setHasVideo() and VideoFullscreenManagerProxy::setVideoDimensions().
3975         Those two functions are driven by IPC messages from the Web process, which may come before
3976         VideoFullscreenInterfaceAVKit is constructed or after VideoFullscreenInterfaceAVKit
3977         is destroyed.
3978