Unreviewed, mark imported/w3c/web-platform-tests/websockets/cookies/third-party-cooki...
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2020-07-11  Zalan Bujtas  <zalan@apple.com>
2
3         [LFC][BFC][Min-Max width] Add support for float avoiders
4         https://bugs.webkit.org/show_bug.cgi?id=214220
5
6         Reviewed by Antti Koivisto.
7
8         Test: fast/layoutformattingcontext/min-max-content-width-with-floats-simple.html
9
10         Float avoiders (including the float boxes) with infinite constraint form a horizontal float stack.
11         (This does not yet support clear property/non-direct children.)
12
13         * layout/blockformatting/BlockFormattingContext.cpp:
14         (WebCore::Layout::BlockFormattingContext::computedIntrinsicWidthConstraints):
15         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
16         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
17
18 2020-07-10  Chris Dumez  <cdumez@apple.com>
19
20         Unreviewed, reverting r264242.
21
22         Caused many crashes on iOS bots
23
24         Reverted changeset:
25
26         "JSRunLoopTimer should use WTF::RunLoop rather than custom CF
27         code"
28         https://bugs.webkit.org/show_bug.cgi?id=214102
29         https://trac.webkit.org/changeset/264242
30
31 2020-07-10  Brady Eidson  <beidson@apple.com>
32
33         Cleanup GameController framework button binding with some constants
34         https://bugs.webkit.org/show_bug.cgi?id=214210
35
36         Reviewed by Darin Adler.
37
38         No new tests (No behavior change)
39
40         * platform/gamepad/cocoa/GameControllerGamepad.mm:
41         (WebCore::GameControllerGamepad::setupAsExtendedGamepad): Use named constants instead of magic numbers.
42
43 2020-07-10  Darin Adler  <darin@apple.com>
44
45         Fix build for PLATFORM(IOS_FAMILY) && !ENABLE(REVEAL), for example, tvOS
46
47         * editing/cocoa/DictionaryLookup.mm: Added include of "SimpleRange.h".
48
49 2020-07-10  Darin Adler  <darin@apple.com>
50
51         Fix build for PLATFORM(IOS_FAMILY) && !ENABLE(REVEAL), for example, tvOS
52
53         * editing/cocoa/DictionaryLookup.mm:
54         (WebCore::DictionaryLookup::rangeForSelection): Update to return SimpleRange.
55         (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto.
56
57 2020-07-08  Darin Adler  <darin@apple.com>
58
59         Remove live ranges from Document.h, AlternativeTextController.h, DictionaryLookup.h, and WebPage.h
60         https://bugs.webkit.org/show_bug.cgi?id=214109
61
62         Reviewed by Sam Weinig.
63
64         * accessibility/AXObjectCache.cpp:
65         (WebCore::AXObjectCache::characterOffsetForPoint): Updated to call
66         caretPositionFromPoint, internal function, instead of caretRangeFromPoint,
67         public DOM function.
68
69         * dom/Document.cpp:
70         (WebCore::Document::Document): Changed documentClasses argument to DocumentClassFlags.
71         (WebCore::Document::caretRangeFromPoint): Refactored so this calls createLiveRange,
72         since it's a DOM function that returns a live range.
73         (WebCore::Document::caretPositionFromPoint): Renamed so this is not just an overload
74         and changed to return a BoundaryPoint rather than a live range.
75
76         * dom/Document.h: Simplified forward declarations by getting rid of all the conditionals.
77         Tweaked a few typedef things. Updated for the changes above.
78
79         * editing/AlternativeTextController.cpp:
80         (WebCore::AlternativeTextController::startAlternativeTextUITimer): Updated since
81         m_rangeWithAlternative is an Optional<SimpleRange>.
82         (WebCore::AlternativeTextController::stopAlternativeTextUITimer): Ditto.
83         (WebCore::AlternativeTextController::applyPendingCorrection): Ditto.
84         (WebCore::AlternativeTextController::hasPendingCorrection const): Ditto.
85         (WebCore::AlternativeTextController::isSpellingMarkerAllowed const): Take SimpleRange.
86         (WebCore::AlternativeTextController::show): Ditto.
87         (WebCore::AlternativeTextController::applyAutocorrectionBeforeTypingIfAppropriate):
88         Updated since m_rangeWithAlternative is an Optional<SimpleRange>.
89         (WebCore::AlternativeTextController::timerFired): Ditto.
90         (WebCore::AlternativeTextController::handleAlternativeTextUIResult): Ditto.
91         (WebCore::AlternativeTextController::markReversed): Take SimpleRange.
92         (WebCore::AlternativeTextController::markCorrection): Ditto.
93         (WebCore::AlternativeTextController::recordSpellcheckerResponseForModifiedCorrection): Ditto.
94         (WebCore::AlternativeTextController::processMarkersOnTextToBeReplacedByResult): Ditto.
95         (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord): Use SimpleRange
96         instead of a live range.
97         (WebCore::AlternativeTextController::applyAlternativeTextToRange): Take SimpleRange.
98         * editing/AlternativeTextController.h: Use SimpleRange instead of live ranges.
99
100         * editing/cocoa/DictionaryLookup.mm:
101         (WebCore::DictionaryLookup::rangeForSelection): Return SimpleRange.
102         (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto.
103         (WebCore::showPopupOrCreateAnimationController): Renamed type from RevealView to CocoaView.
104         (WebCore::DictionaryLookup::showPopup): Ditto.
105         * editing/mac/DictionaryLookup.h: Simplified header since it is included only from
106         Objective-C files. Use SimpleRange instead of live ranges.
107
108         * editing/mac/DictionaryLookupLegacy.mm:
109         (WebCore::DictionaryLookup::rangeForSelection): Return SimpleRange.
110         (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto.
111
112         * page/mac/EventHandlerMac.mm:
113         (WebCore::EventHandler::selectClosestWordFromHitTestResultBasedOnLookup): Updated
114         since DictionaryLookup::rangeAtHitTestResult returns SimpleRange.
115         (WebCore::autoscrollAdjustmentFactorForScreenBoundaries): Use constexpr instead of
116         macros for constants.
117
118         * testing/Internals.mm:
119         (WebCore::Internals::rangeForDictionaryLookupAtLocation): Updated
120         since DictionaryLookup::rangeAtHitTestResult returns SimpleRange.
121         (WebCore::Internals::encodedPreferenceValue): Removed unneeded error local, and
122         fixed formatting.
123
124 2020-07-10  Brady Eidson  <beidson@apple.com>
125
126         GameController.framework gamepads should support Home buttons.
127         <rdar://problem/63500696> and https://bugs.webkit.org/show_bug.cgi?id=212933
128
129         Reviewed by Tim Horton.
130
131         No new tests (Cannot yet drive GameController framework directly in tests)
132
133         * platform/gamepad/cocoa/GameControllerGamepad.mm:
134         (WebCore::homeButtonFromExtendedGamepad): Try a few different techniques of extracting the home button
135           from a GCExtendedGamepad.
136         (WebCore::GameControllerGamepad::setupAsExtendedGamepad): If there's a home button, put it at button index 16,
137           defined by the spec as "Center button in center cluster"
138         * platform/gamepad/cocoa/GameControllerSoftLink.h:
139         * platform/gamepad/cocoa/GameControllerSoftLink.mm:
140
141 2020-07-10  Chris Fleizach  <cfleizach@apple.com>
142
143         AX: Build failure for catalyst
144         https://bugs.webkit.org/show_bug.cgi?id=214202
145         <rdar://problem/65366125>
146
147         Reviewed by Zalan Bujtas.
148
149         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
150         (-[WebAccessibilityObjectWrapper accessibilityIsInDescriptionListTerm]):
151         (-[WebAccessibilityObjectWrapper accessibilityIsInDescriptionListDefinition]):
152
153 2020-07-10  Geoffrey Garen  <ggaren@apple.com>
154
155         JSRunLoopTimer should use WTF::RunLoop rather than custom CF code
156         https://bugs.webkit.org/show_bug.cgi?id=214102
157
158         Reviewed by Darin Adler.
159
160         * bindings/js/CommonVM.cpp:
161         (WebCore::commonVMSlow): Supply a RunLoop at construction time since
162         JSC requires that now.
163
164 2020-07-10  Guowei Yang  <guowei_yang@apple.com>
165
166         Removing usage of "using namespace WebCore" from TextTrackRepresentationCocoa.mm
167         https://bugs.webkit.org/show_bug.cgi?id=214196
168
169         Reviewed by Tim Horton.
170
171         The line "using namespace WebCore" will cause problems 
172         when compiling unified source. Removing this line and 
173         replace it with WebCore::prefix and namespace WebCore{ }
174         to enclose C++ calls.
175
176         No new tests are requied as this is a code style fix
177
178         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm: removed usage 
179           of "using namespace WebCore" to avoid future errors while compiling
180         (-[WebCoreTextTrackRepresentationCocoaHelper initWithParent:]): added "WebCore::" prefix
181         (-[WebCoreTextTrackRepresentationCocoaHelper setParent:]): ditto
182         (-[WebCoreTextTrackRepresentationCocoaHelper parent]): ditto
183         (TextTrackRepresentation::create): enclosed inside namespace WebCore{ }
184         (TextTrackRepresentationCocoa::TextTrackRepresentationCocoa): Deleted. 
185           enclosed inside namespace WebCore{ }
186         (TextTrackRepresentationCocoa::~TextTrackRepresentationCocoa): ditto
187         (TextTrackRepresentationCocoa::update): ditto
188         (TextTrackRepresentationCocoa::setContentScale): ditto
189         (TextTrackRepresentationCocoa::setHidden const): ditto
190         (TextTrackRepresentationCocoa::bounds const): ditto
191         (TextTrackRepresentationCocoa::boundsChanged): ditto
192
193 2020-07-10  Peng Liu  <peng.liu6@apple.com>
194
195         MobileSafari rotates its scene to portrait upside down if it has a PiP on screen
196         https://bugs.webkit.org/show_bug.cgi?id=214169
197
198         Reviewed by Jer Noble.
199
200         The UIViewController for video fullscreen/picture-in-picture should not ignore
201         the App's supported orientations when the video element is in picture-in-picture.
202
203         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
204         (VideoFullscreenInterfaceAVKit::doSetup):
205
206 2020-07-10  Don Olmstead  <don.olmstead@sony.com> and Fujii Hironori  <Hironori.Fujii@sony.com>
207
208         [WinCairo] WOFF2 font support
209         https://bugs.webkit.org/show_bug.cgi?id=214174
210
211         Reviewed by Per Arne Vollan.
212
213         * PlatformWinCairo.cmake: Added additional libraries for static WOFF2 library to WebCore_LIBRARIES.
214         * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
215         (WebCore::FontCustomPlatformData::supportsFormat): Added woff2.
216
217 2020-07-10  Chris Fleizach  <cfleizach@apple.com>
218
219         AX: iOS VoiceOver should support definition lists
220         https://bugs.webkit.org/show_bug.cgi?id=210214
221         <rdar://problem/61478299>
222
223         Reviewed by Darin Adler.
224
225         Expose bits to make definition lists accessibility on iOS.
226
227         Test: accessibility/ios-simulator/definition-list.html
228
229         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
230         (-[WebAccessibilityObjectWrapper _accessibilityDescriptionListAncestor]):
231         (-[WebAccessibilityObjectWrapper accessibilityIsInDescriptionListTerm]):
232         (-[WebAccessibilityObjectWrapper accessibilityIsInDescriptionListDefinition]):
233
234 2020-07-10  Brady Eidson  <beidson@apple.com>
235
236         Limit MultiGamepadProvider to Catalina and Big Sur.
237         https://bugs.webkit.org/show_bug.cgi?id=214190
238
239         Unreviewed build fix.
240
241         * platform/gamepad/cocoa/GameControllerSPI.h:
242         * platform/gamepad/cocoa/GameControllerSoftLink.h:
243         * platform/gamepad/cocoa/GameControllerSoftLink.mm:
244         * platform/gamepad/mac/HIDGamepadProvider.mm:
245         (WebCore::HIDGamepadProvider::deviceAdded):
246         * platform/gamepad/mac/MultiGamepadProvider.h:
247         * platform/gamepad/mac/MultiGamepadProvider.mm:
248
249 2020-07-10  Sam Weinig  <weinig@apple.com>
250
251         Part 4 of SimpleColor and SRGBA<uint8_t> are essentially the same - let's converge them
252         https://bugs.webkit.org/show_bug.cgi?id=214158
253
254         Reviewed by Darin Adler.
255
256         Removes SimpleColor!
257         
258         Alas, makeSimpleColor() remains for now, seeking a new name in a follow up.
259
260         * platform/graphics/SimpleColor.h:
261         (WebCore::SimpleColor::SimpleColor): Deleted.
262         (WebCore::SimpleColor::alphaComponent const): Deleted.
263         (WebCore::SimpleColor::alphaComponentAsFloat const): Deleted.
264         (WebCore::SimpleColor::isOpaque const): Deleted.
265         (WebCore::SimpleColor::isVisible const): Deleted.
266         (WebCore::SimpleColor::colorWithAlpha const): Deleted.
267         (WebCore::SimpleColor::invertedColorWithAlpha const): Deleted.
268         (WebCore::SimpleColor::asSRGBA const): Deleted.
269         (WebCore::SimpleColor::get const): Deleted.
270         (): Deleted.
271         (WebCore::operator==): Deleted.
272         (WebCore::operator!=): Deleted.
273         Remove the SimpleColor class.  
274
275         * platform/graphics/Color.cpp:
276         (WebCore::Color::operator=):
277         (WebCore::Color::lightened const):
278         (WebCore::Color::darkened const):
279         (WebCore::Color::colorWithAlpha const):
280         (WebCore::Color::invertedColorWithAlpha const):
281         (WebCore::Color::colorSpaceAndComponents const):
282         * platform/graphics/Color.h:
283         (WebCore::Color::isHashTableDeletedValue const):
284         (WebCore::Color::isValid const):
285         (WebCore::Color::isSemantic const):
286         (WebCore::Color::isOpaque const):
287         (WebCore::Color::isVisible const):
288         (WebCore::Color::alpha const):
289         (WebCore::Color::alphaAsFloat const):
290         (WebCore::Color::isExtended const):
291         (WebCore::Color::isInline const):
292         (WebCore::Color::tagAsSemantic):
293         (WebCore::Color::tagAsValid):
294         (WebCore::operator==):
295         (WebCore::equalIgnoringSemanticColor):
296         (WebCore::Color::Color):
297         (WebCore::Color::~Color):
298         (WebCore::Color::hash const):
299         (WebCore::Color::toSRGBALossy const):
300         (WebCore::Color::asInline const):
301         (WebCore::Color::setInlineColor):
302         (WebCore::Color::setExtendedColor):
303         (WebCore::Color::isBlackColor):
304         (WebCore::Color::isWhiteColor):
305         (WebCore::Color::encode const):
306         (WebCore::Color::isSimple const): Deleted.
307         (WebCore::Color::asSimple const): Deleted.
308         (WebCore::Color::setSimpleColor): Deleted.
309         - Rename existing uses of Simple with Inline, denoting the inline SRGBA<uint8_t>.
310         - Move multiline functions out of line in the header.
311         - Adds new constructor functions taking Optional<SRGBA<uint8_t>> to make Color(CGColorRef)
312           constructors more straightforward.
313         - Replaces uses of SimpleColor's interface with use of ColorUtilities.h helpers. e.g.
314           Color::invertedColorWithAlpha() now uses the new invertedColorWithOverridenAlpha()
315           helper function. Use of these utilities will be expanded to ExtendedColor in a follow
316           up, allowing us to have just one implementation of these algorithms.
317         
318         * platform/graphics/ColorSerialization.cpp:
319         (WebCore::serializationForCSS):
320         (WebCore::serializationForHTML):
321         (WebCore::serializationForRenderTreeAsText):
322         * platform/graphics/ColorSerialization.h:
323         Replace serialization of SimpleColor with serialization of SRGBA<uint8_t>.
324         
325         * platform/graphics/ColorTypes.h:
326         (WebCore::forEachNonAlphaComponent): Deleted.
327         Removed forEachNonAlphaComponent. Uses replaced by new colorByModifingEachNonAlphaComponent
328         function in ColorUtilities.h
329
330         * platform/graphics/ColorUtilities.h:
331         (WebCore::colorByModifingEachNonAlphaComponent):
332         (WebCore::convertComponentByteTo<uint8_t>):
333         (WebCore::convertComponentByteTo<float>):
334         (WebCore::convertComponentFloatTo<uint8_t>):
335         (WebCore::convertComponentFloatTo<float>):
336         (WebCore::colorWithOverridenAlpha):
337         (WebCore::invertComponent):
338         (WebCore::invertedColorWithOverridenAlpha):
339         Added heplers to implement color mutation behaviors.
340
341         * platform/graphics/cg/ColorCG.cpp:
342         (WebCore::makeSimpleColorFromCGColor):
343         (WebCore::Color::Color):
344         (WebCore::cachedCGColor):
345         Switch makeSimpleColorFromCGColor to return an Optional<SRGBA<uint8_t>> to streamline
346         the constructors. Update to use is/asInline functions.
347
348         * platform/graphics/mac/ColorMac.mm:
349         (WebCore::nsColor):
350         Update to use is/asInline functions.
351         
352         * platform/graphics/filters/FilterOperation.cpp:
353         (WebCore::BasicComponentTransferFilterOperation::transformColor const):
354         Switch to using colorByModifingEachNonAlphaComponent().
355
356 2020-07-10  Philippe Normand  <pnormand@igalia.com>
357
358         [GStreamer] Unreviewed, prospective API test bot fix...
359
360         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
361         (WebCore::MediaPlayerPrivateGStreamer::setVolume): I suppose changing the audio volume to 0 wasn't intended :)
362
363 2020-07-10  Philippe Normand  <pnormand@igalia.com>
364
365         Unreviewed, remove debug printf after r264219.
366
367         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
368         (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
369
370 2020-07-10  Zalan Bujtas  <zalan@apple.com>
371
372         [LFC][Floats] Normal flow element that establishes a new block formatting context must not overlap the margin box of any floats
373         https://bugs.webkit.org/show_bug.cgi?id=214185
374
375         Reviewed by Antti Koivisto.
376
377         BFCs in general should avoid floats. This code was confusing the cases where the block container box (not necessarily a BFC) establishes an IFC.
378           <div>The div establishes an IFC only. It should not avoid floats.</div> 
379           <div style="overflow: hidden">The div establishes both a new BFC and an IFC. It should avoid floats.</div>
380
381         Test: fast/layoutformattingcontext/float-avoider-with-inline-content.html
382
383         * layout/layouttree/LayoutBox.cpp:
384         (WebCore::Layout::Box::isFloatAvoider const):
385
386 2020-07-10  Xabier Rodriguez Calvar  <calvaris@igalia.com>
387
388         [GStreamer][EME][OpenCDM] Implement OpenCDM support
389         https://bugs.webkit.org/show_bug.cgi?id=213550
390
391         Reviewed by Philippe Normand.
392
393         Implemented the OpenCDM support in the CDMOpenCDM and
394         CDMProxyOpenCDM related classes. CDMOpenCDM classes check for
395         Widevine support in OpenCDM and glues the JavaScript API to the
396         OpenCDM/Thunder framework. Building this is optional and --opencdm
397         parameter needs to be passed to build-webkit to get it.
398
399         CDMProxy related needed changes because of several reasons. First
400         is that Key was considering only a Vector<uint8_t> as a type and
401         OpenCDM has session objects. Key is also renamed to KeyHandle as
402         this name reflects in a better way the purpose of the class. This
403         bleeds out to all CDMProxy related classes. CDMInstanceSessionProxy
404         gets support to remove itself from the CDMSessionProxy.
405
406         Regarding ClearKey, we adapt the changes to the CDMProxy classes
407         and de-cable protection system from the decryptors as the OpenCDM
408         decryptor could handle more than one system.
409
410         No new tests. YouTube TV 2019 tests are green.
411
412         * Headers.cmake:
413         * WebCore.xcodeproj/project.pbxproj:
414         * platform/GStreamer.cmake:
415         * platform/SharedBuffer.cpp:
416         (WebCore::SharedBuffer::dataAsUInt8Ptr const):
417         * platform/SharedBuffer.h:
418         * platform/encryptedmedia/CDMInstance.h:
419         * platform/encryptedmedia/CDMOpenCDMTypes.h: Copied from Source/WebCore/platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp.
420         * platform/encryptedmedia/CDMProxy.cpp:
421         (WebCore::KeyHandle::idAsString const):
422         (WebCore::KeyHandle::takeValueIfDifferent):
423         (WebCore::KeyStore::containsKeyID const):
424         (WebCore::KeyStore::merge):
425         (WebCore::KeyStore::allKeysAs const):
426         (WebCore::KeyStore::addKeys):
427         (WebCore::KeyStore::add):
428         (WebCore::KeyStore::remove):
429         (WebCore::KeyStore::keyHandle const):
430         (WebCore::CDMProxy::keyHandle const):
431         (WebCore::CDMProxy::tryWaitForKeyHandle const):
432         (WebCore::CDMProxy::keyAvailableUnlocked const):
433         (WebCore::CDMProxy::keyAvailable const):
434         (WebCore::CDMProxy::getOrWaitForKeyHandle const):
435         (WebCore::CDMProxy::getOrWaitForKeyValue const):
436         (WebCore::CDMInstanceSessionProxy::CDMInstanceSessionProxy):
437         (WebCore::CDMInstanceSessionProxy::removeFromInstanceProxy):
438         * platform/encryptedmedia/CDMProxy.h:
439         (WebCore::KeyHandle::create):
440         (WebCore::KeyHandle::id const):
441         (WebCore::KeyHandle::value const):
442         (WebCore::KeyHandle::value):
443         (WebCore::KeyHandle::isStatusCurrentlyValid):
444         (WebCore::KeyHandle::operator==):
445         (WebCore::KeyHandle::operator<):
446         (WebCore::KeyHandle::KeyHandle):
447         (WebCore::KeyStore::isEmpty const):
448         (WebCore::CDMProxy::instance const):
449         (WebCore::CDMInstanceSessionProxy::releaseDecryptionResources):
450         (WebCore::CDMInstanceSessionProxy::cdmInstanceProxy const):
451         (WebCore::CDMInstanceProxy::proxy const):
452         (WebCore::CDMInstanceProxy::removeSession):
453         * platform/encryptedmedia/CDMUtilities.cpp: Copied from Source/WebCore/platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp.
454         (WebCore::CDMUtilities::parseJSONObject):
455         * platform/encryptedmedia/CDMUtilities.h: Copied from Source/WebCore/platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp.
456         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
457         (WebCore::parseLicenseFormat):
458         (WebCore::CDMPrivateClearKey::supportsInitData const):
459         (WebCore::CDMPrivateClearKey::sanitizeResponse const):
460         (WebCore::CDMInstanceSessionClearKey::updateLicense):
461         (WebCore::CDMInstanceSessionClearKey::removeSessionData):
462         (WebCore::CDMInstanceSessionClearKey::parentInstance const):
463         * platform/encryptedmedia/clearkey/CDMClearKey.h:
464         * platform/graphics/gstreamer/GStreamerCommon.cpp:
465         (WebCore::isOpenCDMRanked):
466         (WebCore::initializeGStreamerAndRegisterWebKitElements):
467         (WebCore::GstMappedBuffer::createVector):
468         * platform/graphics/gstreamer/GStreamerCommon.h:
469         (WebCore::GstMappedBuffer::create):
470         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
471         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
472         (WebCore::MediaPlayerPrivateGStreamer::waitForCDMAttachment):
473         * platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp:
474         (WebCore::CDMFactory::platformRegisterFactories):
475         * platform/graphics/gstreamer/eme/CDMOpenCDM.cpp: Added.
476         (openCDMLicenseType):
477         (WebCore::initDataMD5):
478         (WebCore::sessionLoadFailureFromOpenCDM):
479         (WebCore::OpenCDM::destructOpenCDMSession):
480         (WebCore::OpenCDM::createSharedOpenCDMSession):
481         (WebCore::CDMFactoryOpenCDM::singleton):
482         (WebCore::CDMFactoryOpenCDM::createCDM):
483         (WebCore::CDMFactoryOpenCDM::createCDMProxy):
484         (WebCore::CDMFactoryOpenCDM::supportedKeySystems const):
485         (WebCore::CDMFactoryOpenCDM::supportsKeySystem):
486         (WebCore::CDMPrivateOpenCDM::supportedInitDataTypes const):
487         (WebCore::CDMPrivateOpenCDM::supportsConfiguration const):
488         (WebCore::CDMPrivateOpenCDM::supportedRobustnesses const):
489         (WebCore::CDMPrivateOpenCDM::distinctiveIdentifiersRequirement const):
490         (WebCore::CDMPrivateOpenCDM::persistentStateRequirement const):
491         (WebCore::CDMPrivateOpenCDM::distinctiveIdentifiersAreUniquePerOriginAndClearable const):
492         (WebCore::CDMPrivateOpenCDM::createInstance):
493         (WebCore::CDMPrivateOpenCDM::loadAndInitialize):
494         (WebCore::CDMPrivateOpenCDM::supportsServerCertificates const):
495         (WebCore::CDMPrivateOpenCDM::supportsSessions const):
496         (WebCore::CDMPrivateOpenCDM::supportsInitData const):
497         (WebCore::CDMPrivateOpenCDM::sanitizeResponse const):
498         (WebCore::CDMPrivateOpenCDM::sanitizeSessionId const):
499         (WebCore::CDMInstanceOpenCDM::CDMInstanceOpenCDM):
500         (WebCore::CDMInstanceOpenCDM::initializeWithConfiguration):
501         (WebCore::CDMInstanceOpenCDM::setServerCertificate):
502         (WebCore::CDMInstanceOpenCDM::setStorageDirectory):
503         (WebCore::CDMInstanceSessionOpenCDM::CDMInstanceSessionOpenCDM):
504         (WebCore::CDMInstanceOpenCDM::createSession):
505         (WebCore::ParsedResponseMessage::ParsedResponseMessage):
506         (WebCore::ParsedResponseMessage::hasPayload const):
507         (WebCore::ParsedResponseMessage::payload const):
508         (WebCore::ParsedResponseMessage::payload):
509         (WebCore::ParsedResponseMessage::hasType const):
510         (WebCore::ParsedResponseMessage::type const):
511         (WebCore::ParsedResponseMessage::typeOr const):
512         (WebCore::CDMInstanceSessionOpenCDM::challengeGeneratedCallback):
513         (WebCore::toString):
514         (WebCore::CDMInstanceSessionOpenCDM::status const):
515         (WebCore::CDMInstanceSessionOpenCDM::keyUpdatedCallback):
516         (WebCore::CDMInstanceSessionOpenCDM::keysUpdateDoneCallback):
517         (WebCore::CDMInstanceSessionOpenCDM::errorCallback):
518         (WebCore::CDMInstanceSessionOpenCDM::requestLicense):
519         (WebCore::CDMInstanceSessionOpenCDM::sessionFailure):
520         (WebCore::CDMInstanceSessionOpenCDM::updateLicense):
521         (WebCore::CDMInstanceSessionOpenCDM::loadSession):
522         (WebCore::CDMInstanceSessionOpenCDM::closeSession):
523         (WebCore::CDMInstanceSessionOpenCDM::removeSessionData):
524         (WebCore::CDMInstanceSessionOpenCDM::storeRecordOfKeyUsage):
525         (WebCore:: const):
526         * platform/graphics/gstreamer/eme/CDMOpenCDM.h: Added.
527         (WebCore::OpenCDM::OpenCDMSystemDeleter::operator() const):
528         (WebCore::OpenCDM::OpenCDMSessionDeleter::operator() const):
529         * platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp:
530         (WebCore::CDMProxyClearKey::cencSetDecryptionKey):
531         * platform/graphics/gstreamer/eme/CDMProxyOpenCDM.cpp: Added.
532         (WebCore::CDMProxyOpenCDM::getDecryptionSession const):
533         (WebCore::CDMProxyOpenCDM::decrypt):
534         * platform/graphics/gstreamer/eme/CDMProxyOpenCDM.h: Copied from Source/WebCore/platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp.
535         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
536         (WebCore::InitData::InitData):
537         (WebCore::InitData::payload const):
538         (WebCore::GStreamerEMEUtilities::isWidevineKeySystem):
539         (WebCore::GStreamerEMEUtilities::keySystemToUuid):
540         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
541         (webkit_media_clear_key_decrypt_class_init):
542         (protectionSystemId):
543         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
544         (transformCaps):
545         (transformInPlace):
546         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
547         * platform/graphics/gstreamer/eme/WebKitOpenCDMDecryptorGStreamer.cpp: Added.
548         (webkit_media_opencdm_decrypt_class_init):
549         (webkit_media_opencdm_decrypt_init):
550         (finalize):
551         (protectionSystemId):
552         (cdmProxyAttached):
553         (decrypt):
554         * platform/graphics/gstreamer/eme/WebKitOpenCDMDecryptorGStreamer.h: Added.
555
556 2020-07-10  Zalan Bujtas  <zalan@apple.com>
557
558         [LFC][TreeConstruction] Create block level container for unsupported renderer
559         https://bugs.webkit.org/show_bug.cgi?id=214182
560
561         Reviewed by Antti Koivisto.
562
563         It makes full LFC rendering on random pages less crashy.
564
565         * layout/layouttree/LayoutTreeBuilder.cpp:
566         (WebCore::Layout::TreeBuilder::createLayoutBox):
567
568 2020-07-02  Sergio Villar Senin  <svillar@igalia.com>
569
570         [WebXR] Retrieve WebGL framebuffer resolution from XR devices
571         https://bugs.webkit.org/show_bug.cgi?id=213886
572
573         Reviewed by Carlos Garcia Campos.
574
575         The recommended WebGL framebuffer resolution should be retrieved from the actual XR device being used.
576         Implemented the OpenXR machinery to retrieve it from the XR system. We are also moving the methods that
577         call the platform code to the XRSession as specs define, instead of having them inside the XRWebGLLayer.
578
579         Finally this patch is also removing a unused definition in OpenXR plaform code and properly initializing
580         a OpenXR struct. The missing initialization was the source of errors when querying api layer properties.
581         The patch is also properly setting the SessionMode::Inline when XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO
582         is found. It used to set SessionMode::ImmersiveAr instead, but that's wrong, we should only care about
583         ImmersiveAr session mode once the WebXR AR module is implemented.
584
585         * Modules/webxr/WebXRRenderState.cpp:
586         (WebCore::WebXRRenderState::outputCanvas const): Return render state's canvas.
587         * Modules/webxr/WebXRRenderState.h: Added a m_outputCanvas member with its getter.
588         * Modules/webxr/WebXRSession.cpp:
589         (WebCore::WebXRSession::nativeWebGLFramebufferResolution const): Moved from WebXRWebGLLayer and reimplemented.
590         (WebCore::WebXRSession::recommendedWebGLFramebufferResolution const): Ditto.
591         * Modules/webxr/WebXRSession.h:
592         * Modules/webxr/WebXRWebGLLayer.cpp:
593         (WebCore::WebXRWebGLLayer::WebXRWebGLLayer):
594         (WebCore::WebXRWebGLLayer::getNativeFramebufferScaleFactor): Call the session to get native and recommended
595         resolutions.
596         (WebCore::WebXRWebGLLayer::computeNativeWebGLFramebufferResolution): Deleted.
597         (WebCore::WebXRWebGLLayer::computeRecommendedWebGLFramebufferResolution): Ditto.
598         * platform/xr/PlatformXR.h:
599         (PlatformXR::Device::recommendedResolution): New virtual method with default implementation.
600         * platform/xr/openxr/PlatformXROpenXR.cpp:
601         (PlatformXR::Instance::Impl::enumerateApiLayerProperties const): Added initialization of the XrApiLayerProperties
602         objects. The call to xrEnumerateApiLayerProperties succeeds now.
603         (PlatformXR::OpenXRDevice::OpenXRDevice): Call enumerateConfigurationViews().
604         (PlatformXR::OpenXRDevice::collectSupportedSessionModes): Fill in the m_viewConfigurationProperties map.
605         (PlatformXR::OpenXRDevice::enumerateConfigurationViews): New method that retrieves the XR device views for each
606         supported configuration.
607         (PlatformXR::OpenXRDevice::recommendedResolution): Return the recommended resolution for a given SessionMode.
608         * platform/xr/openxr/PlatformXROpenXR.h: Added some new methods and attributes.
609
610 2020-07-10  Zalan Bujtas  <zalan@apple.com>
611
612         [LFC][MarginCollapsing] Margins do not collapse through when the box has clearance.
613         https://bugs.webkit.org/show_bug.cgi?id=214172
614
615         Reviewed by Antti Koivisto.
616
617         https://www.w3.org/TR/CSS22/box.html#collapsing-margins
618         "Two margins are adjoining if and only if: no line boxes, no clearance, no padding and no border separate them"
619
620         Only adjoining margins can collapse through.
621
622         Test: fast/layoutformattingcontext/empty-block-level-box-with-clearance.html
623
624         * layout/blockformatting/BlockMarginCollapse.cpp:
625         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough const):
626
627 2020-07-10  Jan-Michael Brummer  <jan.brummer@tabos.org>
628
629         [GTK][WPE] Use mobile user-agent on tablet
630         https://bugs.webkit.org/show_bug.cgi?id=149496
631
632         Reviewed by Carlos Garcia Campos.
633
634         * platform/UserAgentQuirks.cpp:
635         (WebCore::urlRequiresMacintoshPlatform):
636         (WebCore::urlRequiresLinuxDesktopPlatform):
637         (WebCore::UserAgentQuirks::quirksForURL):
638         * platform/UserAgentQuirks.h:
639         * platform/glib/UserAgentGLib.cpp:
640         (WebCore::getChassisType):
641         (WebCore::platformForUAString):
642         (WebCore::platformVersionForUAString):
643         (WebCore::buildUserAgentString):
644         (WebCore::standardUserAgent):
645         (WebCore::standardUserAgentForURL):
646
647 2020-07-10  Alicia Boya García  <aboya@igalia.com>
648
649         [MSE][GStreamer] Inline MediaSourceClientGStreamerMSE away
650         https://bugs.webkit.org/show_bug.cgi?id=214140
651
652         Reviewed by Xabier Rodriguez-Calvar.
653
654         MediaSourceClientGStreamerMSE is a superfluous class that adds
655         a layer of indirection and complexity to the GStreamer MSE codebase
656         for no gain. This patch gets rid of it.
657
658         This also gets rid of the friend access layer violations that
659         MediaSourceClientGStreamerMSE relied upon.
660
661         This patch is a refactor that doesn't introduce behavior changes and
662         it's covered by existing tests.
663
664         * platform/GStreamer.cmake:
665         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
666         (WebCore::AppendPipeline::AppendPipeline):
667         * platform/graphics/gstreamer/mse/AppendPipeline.h:
668         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
669         (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):
670         (WebCore::MediaPlayerPrivateGStreamerMSE::setMediaSourceClient): Deleted.
671         (WebCore::MediaPlayerPrivateGStreamerMSE::mediaSourceClient): Deleted.
672         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
673         (WebCore::MediaPlayerPrivateGStreamerMSE::playbackPipeline const):
674         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: Removed.
675         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h: Removed.
676         * platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp:
677         (WebCore::MediaSourcePrivateGStreamer::MediaSourcePrivateGStreamer):
678         (WebCore::MediaSourcePrivateGStreamer::addSourceBuffer):
679         (WebCore::MediaSourcePrivateGStreamer::durationChanged):
680         (WebCore::MediaSourcePrivateGStreamer::markEndOfStream):
681         * platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.h:
682         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
683         (WebCore::SourceBufferPrivateGStreamer::create):
684         (WebCore::SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer):
685         (WebCore::SourceBufferPrivateGStreamer::finishCreation):
686         (WebCore::SourceBufferPrivateGStreamer::append):
687         (WebCore::SourceBufferPrivateGStreamer::abort):
688         (WebCore::SourceBufferPrivateGStreamer::resetParserState):
689         (WebCore::SourceBufferPrivateGStreamer::removedFromMediaSource):
690         (WebCore::SourceBufferPrivateGStreamer::flush):
691         (WebCore::SourceBufferPrivateGStreamer::enqueueSample):
692         (WebCore::SourceBufferPrivateGStreamer::allSamplesInTrackEnqueued):
693         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
694
695 2020-07-09  Brady Eidson  <beidson@apple.com>
696
697         Multiplex the HID and GameController gamepad providers on Mac.
698         <rdar://problem/63192532> and https://bugs.webkit.org/show_bug.cgi?id=214126
699
700         Reviewed by Tim Horton.
701         
702         Mac has already supported both the HID provider and GameController provider.
703         
704         By adding an intermediate provider to multiplex both and tweaking a few other things,
705         it can support both at the same time.
706
707         * SourcesCocoa.txt:
708         * WebCore.xcodeproj/project.pbxproj:
709
710         * platform/gamepad/PlatformGamepad.h:
711         (WebCore::PlatformGamepad::lastUpdateTime const):
712         (WebCore::PlatformGamepad::source const):
713
714         * platform/gamepad/cocoa/GameControllerGamepad.h:
715         * platform/gamepad/cocoa/GameControllerGamepadProvider.h:
716         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
717         (WebCore::GameControllerGamepadProvider::controllerDidConnect):
718         (WebCore::GameControllerGamepadProvider::gamepadHadInput):
719         (WebCore::GameControllerGamepadProvider::makeInvisibleGamepadsVisible):
720         (WebCore::GameControllerGamepadProvider::inputNotificationTimerFired):
721         (WebCore::GameControllerGamepadProvider::makeInvisibileGamepadsVisible): Deleted.
722
723         * platform/gamepad/cocoa/GameControllerSPI.h:
724         * platform/gamepad/cocoa/GameControllerSoftLink.h:
725         * platform/gamepad/cocoa/GameControllerSoftLink.mm:
726
727         * platform/gamepad/mac/HIDGamepad.h:
728         * platform/gamepad/mac/HIDGamepadProvider.h:
729         (WebCore::HIDGamepadProvider::ignoreGameControllerFrameworkDevices):
730         * platform/gamepad/mac/HIDGamepadProvider.mm: Renamed from Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.cpp.
731         (WebCore::deviceMatchingDictionary):
732         (WebCore::deviceAddedCallback):
733         (WebCore::deviceRemovedCallback):
734         (WebCore::deviceValuesChangedCallback):
735         (WebCore::HIDGamepadProvider::singleton):
736         (WebCore::HIDGamepadProvider::HIDGamepadProvider):
737         (WebCore::HIDGamepadProvider::stopMonitoringInput):
738         (WebCore::HIDGamepadProvider::startMonitoringInput):
739         (WebCore::HIDGamepadProvider::indexForNewlyConnectedDevice):
740         (WebCore::HIDGamepadProvider::initialGamepadsConnectedTimerFired):
741         (WebCore::HIDGamepadProvider::openAndScheduleManager):
742         (WebCore::HIDGamepadProvider::closeAndUnscheduleManager):
743         (WebCore::HIDGamepadProvider::startMonitoringGamepads):
744         (WebCore::HIDGamepadProvider::stopMonitoringGamepads):
745         (WebCore::gameControllerFrameworkWillHandleHIDDevice):
746         (WebCore::HIDGamepadProvider::deviceAdded):
747         (WebCore::HIDGamepadProvider::deviceRemoved):
748         (WebCore::HIDGamepadProvider::valuesChanged):
749         (WebCore::HIDGamepadProvider::inputNotificationTimerFired):
750         (WebCore::HIDGamepadProvider::removeGamepadForDevice):
751
752         * platform/gamepad/mac/MultiGamepadProvider.h: Added.
753         (WebCore::MultiGamepadProvider::isMockGamepadProvider const):
754         (WebCore::MultiGamepadProvider::PlatformGamepadWrapper::PlatformGamepadWrapper):
755         * platform/gamepad/mac/MultiGamepadProvider.mm: Added.
756         (WebCore::MultiGamepadProvider::singleton):
757         (WebCore::MultiGamepadProvider::startMonitoringGamepads):
758         (WebCore::MultiGamepadProvider::stopMonitoringGamepads):
759         (WebCore::MultiGamepadProvider::indexForNewlyConnectedDevice):
760         (WebCore::MultiGamepadProvider::platformGamepadConnected):
761         (WebCore::MultiGamepadProvider::platformGamepadDisconnected):
762         (WebCore::MultiGamepadProvider::platformGamepadInputActivity):
763
764 2020-07-09  Tim Horton  <timothy_horton@apple.com>
765
766         "ESPN Fantasy Sports" does not respond to mouse events, only touch events
767         https://bugs.webkit.org/show_bug.cgi?id=214165
768         <rdar://problem/64671543>
769
770         Reviewed by Wenson Hsieh.
771
772         * platform/RuntimeApplicationChecks.h:
773         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
774         (WebCore::IOSApplication::isESPNFantasySports):
775
776 2020-07-09  Simon Fraser  <simon.fraser@apple.com>
777
778         [macOS] Stuttery scrolling on tesla.com
779         https://bugs.webkit.org/show_bug.cgi?id=214159
780         <rdar://problem/64555500>
781
782         Reviewed by Wenson Hsieh.
783         
784         tesla.com uses scroll snapping, and also triggers layout during scrolling that could
785         cause scroll snap to yank the scroll position. This manifested as a change that affected
786         getBoundingClientRect which is used an an input to some transform math, causing the images
787         to move around.
788
789         Fix by ensuring that layout-triggered scroll snap does not happen if a user scroll is in progress,
790         when that scroll occurs via the scrolling thread. ScrollingTreeScrollingNodeDelegateMac has a 
791         ScrollController that tracks when a gesture is in progress; push this state to
792         the ScrollingTree so it can be consulted from the main thread. The two subclasses
793         of ScrollableArea, RenderLayer and FrameView, then consult the ScrollingCoordinator
794         to ask whether a user scroll is in progress for their scrolling tree node.
795
796         Test: fast/scrolling/mac/adjust-scroll-snap-during-gesture.html
797
798         * page/FrameView.cpp:
799         (WebCore::FrameView::isUserScrollInProgress const):
800         * page/scrolling/AsyncScrollingCoordinator.cpp:
801         (WebCore::AsyncScrollingCoordinator::isUserScrollInProgress const):
802         * page/scrolling/AsyncScrollingCoordinator.h:
803         * page/scrolling/ScrollingCoordinator.h:
804         (WebCore::ScrollingCoordinator::isUserScrollInProgress const):
805         * page/scrolling/ScrollingTree.cpp:
806         (WebCore::ScrollingTree::handleWheelEvent):
807         (WebCore::ScrollingTree::isUserScrollInProgressForNode):
808         (WebCore::ScrollingTree::setUserScrollInProgressForNode):
809         (WebCore::ScrollingTree::clearNodesWithUserScrollInProgress):
810         * page/scrolling/ScrollingTree.h:
811         * page/scrolling/ScrollingTreeScrollingNode.cpp:
812         (WebCore::ScrollingTreeScrollingNode::isUserScrollProgress const):
813         (WebCore::ScrollingTreeScrollingNode::setUserScrollInProgress):
814         (WebCore::ScrollingTreeScrollingNode::setScrollSnapInProgress):
815         * page/scrolling/ScrollingTreeScrollingNode.h:
816         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
817         (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent):
818         * rendering/RenderLayer.cpp:
819         (WebCore::RenderLayer::isUserScrollInProgress const):
820
821 2020-07-09  Chris Dumez  <cdumez@apple.com>
822
823         [Bindings] Add default value support for union types in dictionary members
824         https://bugs.webkit.org/show_bug.cgi?id=214160
825
826         Reviewed by Sam Weinig.
827
828         Add default value support for union types in dictionary members. This is needed for the WebAudio specification:
829         - https://www.w3.org/TR/webaudio/#AudioContextOptions
830         """
831         (AudioContextLatencyCategory or double) latencyHint = "interactive";
832         """
833
834         * bindings/scripts/CodeGeneratorJS.pm:
835         (GenerateDefaultValue):
836         * bindings/scripts/test/JS/JSTestObj.cpp:
837         (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion1Body):
838         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
839         (WebCore::convertDictionary<DictionaryImplName>):
840         (WebCore::convertDictionaryToJS):
841         * bindings/scripts/test/TestStandaloneDictionary.idl:
842
843 2020-07-09  Per Arne Vollan  <pvollan@apple.com>
844
845         Move XPCEndpoint and XPCEndpointClient classes from WebCore to WebKit
846         https://bugs.webkit.org/show_bug.cgi?id=214099
847
848         Reviewed by Alex Christensen.
849
850         These classes should not be in WebCore, but in WebKit, since they are only expected to be used there.
851
852         No new tests, since this patch is only moving source files.
853
854         * WebCore.xcodeproj/project.pbxproj:
855         * platform/cocoa/XPCEndpoint.h: Removed.
856         * platform/cocoa/XPCEndpoint.mm: Removed.
857         * platform/cocoa/XPCEndpointClient.h: Removed.
858         * platform/cocoa/XPCEndpointClient.mm: Removed.
859
860 2020-07-09  Simon Fraser  <simon.fraser@apple.com>
861
862         After a scroll gesture, content changes don't trigger re-snapping with scroll snap
863         https://bugs.webkit.org/show_bug.cgi?id=214123
864
865         Reviewed by Wenson Hsieh.
866
867         ScrollController::m_inScrollGesture could get stuck as true after a scroll gesture, because
868         ScrollAnimatorMac::handleWheelEvent() didn't reliably call m_scrollController.handleWheelEvent() for
869         the event event based on the hokey shouldForwardWheelEventsToParent() code.
870
871         Fix by explicitly calling m_scrollController.updateGestureInProgressState() which maintains
872         m_inScrollGesture.
873
874         When m_inScrollGesture was stuck as true, ScrollableArea::updateScrollSnapState() would return early
875         because isScrollSnapInProgress() would return true. In addition,
876         ScrollController::isScrollSnapInProgress() was a lie for non-scroll-snapping scrollable areas, so
877         explicitly check for snap points there, using an explicit usesScrollSnap() function.
878
879         Rename some WheelEventStatus values to use "momentum" rather than "inertia".
880
881         Test: fast/scrolling/mac/adjust-scroll-snap-after-gesture.html
882
883         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
884         (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent):
885         * platform/ScrollableArea.cpp:
886         (WebCore::ScrollableArea::usesScrollSnap const):
887         (WebCore::ScrollableArea::updateScrollSnapState):
888         * platform/ScrollableArea.h:
889         * platform/cocoa/ScrollController.h:
890         * platform/cocoa/ScrollController.mm:
891         (WebCore::ScrollController::handleWheelEvent):
892         (WebCore::ScrollController::usesScrollSnap const):
893         (WebCore::ScrollController::isScrollSnapInProgress const):
894         (WebCore::ScrollController::snapRubberBand):
895         (WebCore::toWheelEventStatus):
896         (WebCore::operator<<):
897         (WebCore::ScrollController::shouldOverrideMomentumScrolling const):
898         (WebCore::ScrollController::scheduleStatelessScrollSnap):
899         (WebCore::ScrollController::statelessSnapTransitionTimerFired):
900         (WebCore::ScrollController::processWheelEventForScrollSnap):
901         (WebCore::ScrollController::updateGestureInProgressState):
902         (WebCore::ScrollController::scrollSnapTimerFired):
903         (WebCore::ScrollController::activeScrollSnapIndexForAxis const):
904         (WebCore::ScrollController::setActiveScrollSnapIndexForAxis):
905         (WebCore::ScrollController::setNearestScrollSnapIndexForAxisAndOffset):
906         (WebCore::ScrollController::setActiveScrollSnapIndicesForOffset):
907         (WebCore::ScrollController::shouldOverrideInertialScrolling const): Deleted.
908         * platform/mac/ScrollAnimatorMac.mm:
909         (WebCore::ScrollAnimatorMac::handleWheelEvent):
910
911 2020-07-09  Fujii Hironori  <Hironori.Fujii@sony.com>
912
913         [WinCairo][MediaFoundation] Use /DELAYLOAD for mf.dll
914         https://bugs.webkit.org/show_bug.cgi?id=213330
915
916         Reviewed by Per Arne Vollan.
917
918         WinCairo failed to start up due to a missing dependency on some
919         versions of Windows in which Media Foundation is not available
920         such like Windows 10 N. Use delay load for Media Foundation. And,
921         check the availability.
922
923         * PlatformWinCairo.cmake: Link with delayimp.lib. Added /DELAYLOAD linker options.
924         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
925         (WebCore::MediaPlayerPrivateMediaFoundation::isAvailable): Check mf.dll is available.
926
927 2020-07-09  Eric Carlson  <eric.carlson@apple.com>
928
929         Reset AVSystemController_PIDToInheritApplicationStateFrom when mediaserverd dies
930         https://bugs.webkit.org/show_bug.cgi?id=214112
931         <rdar://problem/65229214>
932
933         Reviewed by Jer Noble.
934
935         Tested manually because this can only be tested by killing a system process while
936         capturing on iOS hardware.
937
938         * platform/audio/cocoa/MediaSessionManagerCocoa.h: Add task queue accessor.
939         (WebCore::MediaSessionManagerCocoa::taskQueue):
940
941         * platform/audio/ios/MediaSessionHelperIOS.h:
942         (WebCore::MediaSessionHelperClient::mediaServerConnectionDied):
943         * platform/audio/ios/MediaSessionHelperIOS.mm:
944         (MediaSessionHelperiOS::mediaServerConnectionDied): Renamed from carPlayServerDied. 
945         Inform clients if we previously set the PID proxy.
946         (-[WebMediaSessionHelper initWithCallback:]): Call mediaServerConnectionDied.
947         (-[WebMediaSessionHelper mediaServerConnectionDied:]): Ditto.
948         (MediaSessionHelperiOS::carPlayServerDied): Deleted.
949         (-[WebMediaSessionHelper carPlayServerDied:]): Deleted.
950
951         * platform/audio/ios/MediaSessionManagerIOS.h:
952         * platform/audio/ios/MediaSessionManagerIOS.mm:
953         (WebCore::MediaSessionManageriOS::mediaServerConnectionDied): Call providePresentingApplicationPID
954         if we previously set the PID proxy.
955
956         * platform/mediastream/mac/AVVideoCaptureSource.mm:
957         (WebCore::AVVideoCaptureSource::captureSessionRuntimeError): Don't try to restart the
958         session immediately since this is called directly from the notification handler.
959
960 2020-07-09  Clark Wang  <clark_wang@apple.com>
961
962         Set Restrictions for channelCount, channelCountMode for PannerNode
963         https://bugs.webkit.org/show_bug.cgi?id=213992
964
965         Reviewed by Chris Dumez.
966
967         Added setter methods to PannerNode that handle exceptions for channelCount, channelCountMode, according to spec:
968         https://www.w3.org/TR/webaudio/#dom-audionode-channelcount.
969         Moved ChannelCount, ChannelCountMode enums into their own files.
970
971         Re-baselined tests that now pass.
972
973         * CMakeLists.txt:
974         * DerivedSources-input.xcfilelist:
975         * DerivedSources-output.xcfilelist:
976         * DerivedSources.make:
977         * Modules/webaudio/AudioNode.cpp:
978         (WebCore::AudioNode::AudioNode):
979         (WebCore::AudioNode::setChannelCount):
980         (WebCore::AudioNode::setChannelCountMode):
981         (WebCore::AudioNode::setChannelInterpretation):
982         (WebCore::AudioNode::channelCount): Deleted.
983         (WebCore::AudioNode::channelCountMode): Deleted.
984         (WebCore::AudioNode::channelInterpretation): Deleted.
985         * Modules/webaudio/AudioNode.h:
986         (WebCore::AudioNode::channelCount const):
987         (WebCore::AudioNode::channelCountMode const):
988         (WebCore::AudioNode::channelInterpretation const):
989         (WebCore::AudioNode::internalChannelCountMode const): Deleted.
990         (WebCore::AudioNode::internalChannelInterpretation const): Deleted.
991         * Modules/webaudio/AudioNode.idl:
992         * Modules/webaudio/AudioNodeInput.cpp:
993         (WebCore::AudioNodeInput::numberOfChannels const):
994         (WebCore::AudioNodeInput::bus):
995         (WebCore::AudioNodeInput::sumAllConnections):
996         (WebCore::AudioNodeInput::pull):
997         * Modules/webaudio/AudioNodeOptions.h:
998         * Modules/webaudio/AudioNodeOptions.idl:
999         * Modules/webaudio/ChannelCountMode.h: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.h.
1000         * Modules/webaudio/ChannelCountMode.idl: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.idl.
1001         * Modules/webaudio/ChannelInterpretation.h: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.h.
1002         * Modules/webaudio/ChannelInterpretation.idl: Copied from Source/WebCore/Modules/webaudio/AudioNodeOptions.idl.
1003         * Modules/webaudio/ConvolverNode.cpp:
1004         (WebCore::ConvolverNode::ConvolverNode):
1005         * Modules/webaudio/DefaultAudioDestinationNode.cpp:
1006         (WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode):
1007         * Modules/webaudio/PannerNode.cpp:
1008         (WebCore::PannerNode::PannerNode):
1009         (WebCore::PannerNode::create):
1010         (WebCore::PannerNode::setChannelCount):
1011         (WebCore::PannerNode::setChannelCountMode):
1012         * Modules/webaudio/PannerNode.h:
1013         * Modules/webaudio/WebKitAudioPannerNode.cpp:
1014         (WebCore::WebKitAudioPannerNode::WebKitAudioPannerNode):
1015         * Sources.txt:
1016         * WebCore.xcodeproj/project.pbxproj:
1017         * platform/audio/AudioBus.cpp:
1018         (WebCore::AudioBus::copyFrom):
1019         (WebCore::AudioBus::sumFrom):
1020         * platform/audio/AudioBus.h:
1021
1022 2020-07-09  Alicia Boya García  <aboya@igalia.com>
1023
1024         [MSE][GStreamer] Remove m_appendPipelinesMap
1025         https://bugs.webkit.org/show_bug.cgi?id=214132
1026
1027         Reviewed by Xabier Rodriguez-Calvar.
1028
1029         m_appendPipelinesMap was owned by MediaPlayerPrivateGStreamerMSE but
1030         was only used by MediaPlayerPrivateGStreamerMSE to clear it during
1031         destruction, while the other uses were in
1032         MediaSourceClientGStreamerMSE.
1033
1034         After analysis, it was found keeping a HashMap of AppendPipelines is not
1035         necessary. An AppendPipeline only needs to be used by the SourceBuffer
1036         receiving the muxed data: making AppendPipeline a member of
1037         SourceBufferPrivateGStreamer reflects this dependency in a much
1038         clearer way. No need for a HashMap of AppendPipeline's.
1039
1040         Moreso, there are no other users of AppendPipeline, which means
1041         AppendPipeline doesn't need to be ref counted. This patch removes that
1042         feature, using std::unique_ptr<AppendPipeline> for ownership instead.
1043
1044         This patch is a refactor: it doesn't introduce behavior changes and
1045         it's covered by existing tests.
1046
1047         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1048         (WebCore::AppendPipeline::appsinkCapsChanged):
1049         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
1050         * platform/graphics/gstreamer/mse/AppendPipeline.h:
1051         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1052         (WebCore::MediaPlayerPrivateGStreamerMSE::~MediaPlayerPrivateGStreamerMSE):
1053         (WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected):
1054         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
1055         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
1056         (WebCore::MediaSourceClientGStreamerMSE::addSourceBuffer):
1057         (WebCore::MediaSourceClientGStreamerMSE::abort):
1058         (WebCore::MediaSourceClientGStreamerMSE::resetParserState):
1059         (WebCore::MediaSourceClientGStreamerMSE::append):
1060         (WebCore::MediaSourceClientGStreamerMSE::removedFromMediaSource):
1061         * platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp:
1062         (WebCore::MediaSourcePrivateGStreamer::addSourceBuffer):
1063         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
1064         (WebCore::SourceBufferPrivateGStreamer::create):
1065         (WebCore::SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer):
1066         (WebCore::SourceBufferPrivateGStreamer::finishCreation):
1067         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
1068
1069 2020-07-09  Zalan Bujtas  <zalan@apple.com>
1070
1071         [LFC][Verification] Use the table wrapper box's margin when checking the table box
1072         https://bugs.webkit.org/show_bug.cgi?id=214119
1073
1074         Reviewed by Darin Adler.
1075
1076         Table margins are propagated to the table wrapper box.
1077
1078         Test: fast/layoutformattingcontext/table-with-margin-simple.html
1079
1080         * layout/Verification.cpp:
1081         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
1082         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree):
1083
1084 2020-07-09  Alicia Boya García  <aboya@igalia.com>
1085
1086         [MSE][GStreamer] Don't cache duration in MediaSourceClientGStreamerMSE
1087         https://bugs.webkit.org/show_bug.cgi?id=214128
1088
1089         Reviewed by Xabier Rodriguez-Calvar.
1090
1091         MediaSource should be the single source of truth for the duration of
1092         the MediaSource, and querying it to MediaSource is efficient enough
1093         (trivial getter). There is no reason for MediaSourceClientGStreamerMSE
1094         to store a separate m_duration field.
1095
1096         This patch introduces no behavior changes.
1097
1098         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
1099         (WebCore::MediaSourceClientGStreamerMSE::MediaSourceClientGStreamerMSE):
1100         (WebCore::MediaSourceClientGStreamerMSE::duration):
1101         (WebCore::MediaSourceClientGStreamerMSE::durationChanged):
1102         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
1103
1104 2020-07-09  Alicia Boya García  <aboya@igalia.com>
1105
1106         [MSE][GStreamer] Make duration changes one way
1107         https://bugs.webkit.org/show_bug.cgi?id=214083
1108
1109         Reviewed by Xabier Rodriguez-Calvar.
1110
1111         Until now, AppendPipeline emitted duration changes for the
1112         MediaSource. This was done with
1113         MediaSourcePrivateClient::durationChanged(const MediaTime&), a
1114         method which was added to MediaSource in r207889 just to implement
1115         this in the GStreamer port.
1116
1117         This is not necessary though. AppendPipeline only needs to inform
1118         MediaSource of the duration of the initialization segment, and
1119         MediaSource will in turn set duration from the multi-platform code.
1120
1121         This patch removes MediaSourcePrivateClient::durationChanged(const
1122         MediaTime&) from the multi-platform API, along with its usages in the
1123         GStreamer port, giving the multi-platform code sole responsibility on
1124         duration changes.
1125
1126         This is a code cleanup and it's covered by existing tests.
1127
1128         * Modules/mediasource/MediaSource.cpp:
1129         (WebCore::MediaSource::durationChanged): Deleted.
1130         * Modules/mediasource/MediaSource.h:
1131         * platform/graphics/MediaSourcePrivateClient.h:
1132         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1133         (WebCore::AppendPipeline::didReceiveInitializationSegment):
1134         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
1135         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1136         (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):
1137
1138 2020-07-09  Philippe Normand  <pnormand@igalia.com>
1139
1140         [GStreamer][MSE] AV1 support
1141         https://bugs.webkit.org/show_bug.cgi?id=207547
1142
1143         Reviewed by Xabier Rodriguez-Calvar.
1144
1145         If only the av1dec decoder is available, consider AV1 decoding
1146         support as disabled, because this plugin performs really badly.
1147         However, if any other AV1 decoder is present, such as the
1148         dav1d-based Rust decoder for instance, consider AV1 support as
1149         enabled.
1150
1151         These checks are now performed by both RegistryScanner instances,
1152         for MSE and non-MSE players.
1153
1154         * platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
1155         (WebCore::GStreamerRegistryScanner::hasElementForMediaType const):
1156         (WebCore::GStreamerRegistryScanner::initialize):
1157         * platform/graphics/gstreamer/GStreamerRegistryScanner.h:
1158
1159 2020-07-09  Alicia Boya García  <aboya@igalia.com>
1160
1161         [MSE][GStreamer] Remove orphan code in SourceBufferPrivateGStreamer::append()
1162         https://bugs.webkit.org/show_bug.cgi?id=214086
1163
1164         Reviewed by Xabier Rodriguez-Calvar.
1165
1166         A refactor in r240784 missed this line, which was unreachable code
1167         before and should have removed.
1168
1169         Instead, it has been run every time after sending an append to the
1170         AppendPipeline, and it just happens it doesn't have visible
1171         consequences.
1172
1173         This patch cleans that up removing that line. No visible behavior
1174         changes are introduced.
1175
1176         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
1177         (WebCore::SourceBufferPrivateGStreamer::append):
1178
1179 2020-07-09  Carlos Garcia Campos  <cgarcia@igalia.com>
1180
1181         [SOUP] Initialize m_allowCookies and m_acceptEncoding in ResourceRequest::updateFromSoupMessage
1182         https://bugs.webkit.org/show_bug.cgi?id=214077
1183
1184         Reviewed by Michael Catanzaro.
1185
1186         Check if SOUP_TYPE_CONTENT_DECODER and SOUP_TYPE_COOKIE_JAR are disabled in the given message.
1187
1188         * platform/network/soup/ResourceRequestSoup.cpp:
1189         (WebCore::ResourceRequest::updateFromSoupMessage):
1190
1191 2020-07-09  Carlos Garcia Campos  <cgarcia@igalia.com>
1192
1193         [SOUP] Add support for HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain
1194         https://bugs.webkit.org/show_bug.cgi?id=213954
1195
1196         Reviewed by Michael Catanzaro.
1197
1198         Handle both OnlyFromMainDocumentDomain and ExclusivelyFromMainDocumentDomain.
1199
1200         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1201         (WebCore::NetworkStorageSession::NetworkStorageSession):
1202         (WebCore::NetworkStorageSession::setCookieAcceptPolicy):
1203         (WebCore::NetworkStorageSession::cookieAcceptPolicy const):
1204         (WebCore::NetworkStorageSession::setResourceLoadStatisticsEnabled):
1205
1206 2020-07-08  Simon Fraser  <simon.fraser@apple.com>
1207
1208         Allow ScrollableArea to ask if a user scroll is in progress
1209         https://bugs.webkit.org/show_bug.cgi?id=214121
1210
1211         Reviewed by Wenson Hsieh.
1212
1213         Work towards fixing scrolling stutters on layouting pages using scroll snap, like tesla.com.
1214
1215         ScrollableArea::updateScrollSnapState(), which happens as a result of layout, should not set a new
1216         scroll position if a user scroll is in progress. ScrollController already tracks m_inScrollGesture,
1217         so in the first instance just refactor the code to return that. Future changes will check
1218         for scrolling thread activity.
1219
1220         * page/FrameView.cpp:
1221         (WebCore::FrameView::isUserScrollInProgress const):
1222         (WebCore::FrameView::isRubberBandInProgress const):
1223         * page/FrameView.h:
1224         * platform/ScrollAnimator.h:
1225         (WebCore::ScrollAnimator::ScrollAnimator::isUserScrollInProgress const):
1226         * platform/ScrollableArea.cpp:
1227         (WebCore::ScrollableArea::updateScrollSnapState):
1228         * platform/ScrollableArea.h:
1229         (WebCore::ScrollableArea::isUserScrollInProgress const):
1230         * platform/cocoa/ScrollController.h:
1231         * platform/cocoa/ScrollController.mm:
1232         (WebCore::ScrollController::isUserScrollInProgress const):
1233         * platform/mac/ScrollAnimatorMac.h:
1234         * platform/mac/ScrollAnimatorMac.mm:
1235         (WebCore::ScrollAnimatorMac::isUserScrollInProgress const):
1236         * rendering/RenderLayer.cpp:
1237         (WebCore::RenderLayer::isUserScrollInProgress const):
1238         (WebCore::RenderLayer::isRubberBandInProgress const):
1239         * rendering/RenderLayer.h:
1240
1241 2020-07-08  Andres Gonzalez  <andresg_22@apple.com>
1242
1243         Implementation of AXIsolatedObject::setSelectedVisiblePositionRange.
1244         https://bugs.webkit.org/show_bug.cgi?id=214118
1245
1246         Reviewed by Chris Fleizach.
1247
1248         Covered by test: accessibility/mac/selected-visible-position-range.html.
1249
1250         Implemented AXIsolatedObject::setSelectedVisiblePositionRange() and
1251         selection() by forwarding the call to the associated AX object.
1252
1253         * accessibility/isolatedtree/AXIsolatedObject.cpp:
1254         (WebCore::AXIsolatedObject::selection const):
1255         (WebCore::AXIsolatedObject::setSelectedVisiblePositionRange const):
1256         * accessibility/isolatedtree/AXIsolatedObject.h:
1257         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1258         (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
1259         call to the backing object should happen on the main thread since it
1260         takes a VisiblePositionRange parameter.
1261
1262 2020-07-08  Simon Fraser  <simon.fraser@apple.com>
1263
1264         Clean up time values in ScrollController
1265         https://bugs.webkit.org/show_bug.cgi?id=214117
1266
1267         Reviewed by Wenson Hsieh.
1268
1269         ScrollController used a mixture of [NSDate timeIntervalSinceReferenceDate], [NSProcessInfo processInfo].systemUptime
1270         and wheelEvent.timestamp().secondsSinceEpoch(). Standardize on Seconds/MonotonicTime/WallTime.
1271
1272         * platform/cocoa/ScrollController.h:
1273         * platform/cocoa/ScrollController.mm:
1274         (WebCore::elasticDeltaForTimeDelta):
1275         (WebCore::ScrollController::handleWheelEvent):
1276         (WebCore::ScrollController::snapRubberBandTimerFired):
1277         (WebCore::ScrollController::snapRubberBand):
1278
1279 2020-07-08  Brady Eidson  <beidson@apple.com>
1280
1281         Aggressively prime GameController.framework gamepad provider.
1282         https://bugs.webkit.org/show_bug.cgi?id=214094
1283
1284         Reviewed by Darin Adler.
1285
1286         GameController.framework gets itself going by listening for application activation, 
1287         assuming that it is hard linked.
1288         
1289         Soft linking breaks this.
1290         
1291         There's an SPI to manually kickstart it.
1292         
1293         Also add some logging I'd added while exploring issues around this.
1294
1295         * platform/gamepad/cocoa/GameControllerGamepadProvider.h:
1296         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
1297         (WebCore::GameControllerGamepadProvider::controllerDidConnect):
1298         (WebCore::GameControllerGamepadProvider::prewarmGameControllerDevicesIfNecessary):
1299         (WebCore::GameControllerGamepadProvider::startMonitoringGamepads):
1300         * platform/gamepad/cocoa/GameControllerSPI.h:
1301
1302 2020-07-08  Sam Weinig  <weinig@apple.com>
1303
1304         Part 3 of SimpleColor and SRGBA<uint8_t> are essentially the same - let's converge them
1305         https://bugs.webkit.org/show_bug.cgi?id=214082
1306
1307         Reviewed by Darin Adler.
1308
1309         - Replaces all uses of SimpleColor that are not implementation details of Color, with SRGBA<uint8_t>.
1310         - Adds ColorBuilder<T> to allow maintaining the syntax SimpleColor for constant colors. e.g:
1311             
1312             Color color = Color::yellow.colorWithAlpha(128);
1313
1314         * Headers.cmake:
1315         * WebCore.xcodeproj/project.pbxproj:
1316         Add ColorBuilder.h
1317
1318         * platform/graphics/Color.cpp:
1319         (WebCore::Color::lightened const):
1320         (WebCore::Color::darkened const):
1321         (WebCore::Color::semanticColor const):
1322         * platform/graphics/Color.h:
1323         (WebCore::Color::Color):
1324         (WebCore::Color::asSimple const):
1325         (WebCore::Color::setSimpleColor):
1326         (WebCore::Color::isBlackColor):
1327         (WebCore::Color::isWhiteColor):
1328         (WebCore::Color::encode const):
1329         (WebCore::Color::decode):
1330         - Make constructor taking a SimpleColor private. 
1331         - Add / modifiy constructors to take SRGBA<uint8_t>.
1332         - Make setSimpleColor() take a SRGBA<uint8_t> (this will be renamed along with
1333           other aspects of Color's internals in a subsequent change).
1334         - Update calls that still need SimpleColor to use an explicit construction from
1335           SRGBA<uint8_t>.
1336     
1337         * platform/graphics/ColorBuilder.h: Added.
1338         (WebCore::ColorBuilder::ColorBuilder):
1339         (WebCore::ColorBuilder::color const):
1340         (WebCore::ColorBuilder::colorWithAlpha const):
1341         Added to help maintain current syntax why constructing colors. Currently it only
1342         supports color type with uint8_t components, but can be expanded to support more.
1343
1344         * platform/graphics/ColorUtilities.h:
1345         (WebCore::clampToComponentByte):
1346         Remove unnecessary cast.
1347
1348         * platform/graphics/SimpleColor.h:
1349         (WebCore::SimpleColor::SimpleColor):
1350         Restrict to explicit construction via a SRGBA<uint8_t>.
1351  
1352         (WebCore::makeSimpleColor):
1353         Update to return ColorBuilder<SRGBA<uint8_t>>. A future change will update
1354         the function name, but kept the same here to limit the size of the change.
1355
1356         * platform/graphics/mac/ColorMac.mm:
1357         (WebCore::makeSimpleColorFromNSColor):
1358         (WebCore::nsColor):
1359         * platform/graphics/cg/ColorCG.cpp:
1360         (WebCore::makeSimpleColorFromCGColor):
1361         (WebCore::cachedCGColor):
1362         Replace direct SimpleColor usage with SRGBA<uint8_t> and simplify Packed
1363         construction now that .asSRGBA<uint8_t>() is not needed for color constants.
1364
1365         * css/DeprecatedCSSOMRGBColor.h:
1366         * css/parser/CSSParser.cpp:
1367         (WebCore::CSSParser::parseNamedColor):
1368         (WebCore::CSSParser::parseHexColor):
1369         * css/parser/CSSParser.h:
1370         * css/parser/CSSParserFastPaths.cpp:
1371         (WebCore::finishParsingHexColor):
1372         (WebCore::parseHexColorInternal):
1373         (WebCore::parseNumericColor):
1374         (WebCore::finishParsingNamedColor):
1375         (WebCore::parseNamedColorInternal):
1376         (WebCore::parseSimpleColorInternal):
1377         (WebCore::CSSParserFastPaths::parseSimpleColor):
1378         (WebCore::CSSParserFastPaths::parseHexColor):
1379         (WebCore::CSSParserFastPaths::parseNamedColor):
1380         * css/parser/CSSParserFastPaths.h:    
1381         * css/parser/CSSPropertyParserHelpers.cpp:
1382         (WebCore::CSSPropertyParserHelpers::parseHexColor):
1383         * html/ColorInputType.cpp:
1384         (WebCore::parseSimpleColorValue):
1385         * html/HTMLElement.cpp:
1386         (WebCore::parseLegacyColorValue):
1387         * page/DebugPageOverlays.cpp:
1388         (WebCore::touchEventRegionColors):
1389         * page/cocoa/ResourceUsageOverlayCocoa.mm:
1390         (WebCore::HistoricMemoryCategoryInfo::HistoricMemoryCategoryInfo):
1391         * platform/graphics/ColorBlending.cpp:
1392         (WebCore::blendWithWhite):
1393         (WebCore::blend):
1394         (WebCore::blendWithoutPremultiply):
1395         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
1396         (WebCore::makeSimpleColorFromARGBCFArray):
1397         * platform/graphics/ca/GraphicsLayerCA.cpp:
1398         (WebCore::cloneLayerDebugBorderColor):
1399         * platform/mock/MockRealtimeVideoSource.cpp:
1400         (WebCore::MockRealtimeVideoSource::drawBoxes):
1401         * rendering/RenderLayerBacking.cpp:
1402         * rendering/RenderThemeMac.mm:
1403         (WebCore::menuBackgroundColor):
1404         Replace direct SimpleColor usage with SRGBA<uint8_t>. 
1405
1406 2020-07-08  Simon Fraser  <simon.fraser@apple.com>
1407
1408         Make a logging channel for ScrollSnap and improve its logging
1409         https://bugs.webkit.org/show_bug.cgi?id=214096
1410
1411         Reviewed by Wenson Hsieh.
1412
1413         Pull existing scroll snap logging out of the Scrolling log channel into a new ScrollSnap channel,
1414         add more logging, and make better use of TextStream-based logging.
1415
1416         * page/scrolling/AxisScrollSnapOffsets.cpp:
1417         (WebCore::operator<<):
1418         (WebCore::updateSnapOffsetsForScrollableArea):
1419         (WebCore::snapOffsetsToString): Deleted.
1420         (WebCore::snapOffsetRangesToString): Deleted.
1421         (WebCore::snapPortOrAreaToString): Deleted.
1422         * platform/Logging.h:
1423         * platform/ScrollableArea.cpp:
1424         (WebCore::ScrollableArea::updateScrollSnapState):
1425         * platform/cocoa/ScrollController.mm:
1426         (WebCore::operator<<):
1427         (WebCore::ScrollController::processWheelEventForScrollSnap):
1428         (WebCore::ScrollController::startScrollSnapTimer):
1429         (WebCore::ScrollController::stopScrollSnapTimer):
1430         (WebCore::ScrollController::scrollSnapTimerFired):
1431         (WebCore::ScrollController::updateScrollSnapState):
1432         * platform/cocoa/ScrollSnapAnimatorState.h:
1433         * platform/cocoa/ScrollSnapAnimatorState.mm:
1434         (WebCore::operator<<):
1435
1436 2020-07-08  Per Arne Vollan  <pvollan@apple.com>
1437
1438         [Cocoa] Make it possible to establish direct XPC connections between WebKit processes
1439         https://bugs.webkit.org/show_bug.cgi?id=214079
1440
1441         Reviewed by Brent Fulgham.
1442
1443         Add abstract classes XPCEndpoint and XPCEndpointClient to handle the creation of direct xpc connections between WebKit processes.
1444         In order to create a direct xpc connection between two processes, these two classes can be subclassed, and the xpc endpoint created
1445         by the XPCEndpoint object, can be sent via the UI process over the bootstrap xpc connection. The UI process can then forward this
1446         endpoint to another WebKit process by sending it over the bootstrap xpc connection. The receiving process can then initialize an
1447         XPCEndpointClient object with this endpoint, and a new direct connection will then be available, over which the two processes can
1448         communicate.
1449
1450         API test: WebKit.XPCEndpoint
1451
1452         * WebCore.xcodeproj/project.pbxproj:
1453         * platform/cocoa/XPCEndpoint.h: Added.
1454         * platform/cocoa/XPCEndpoint.mm: Added.
1455         (WebCore::XPCEndpoint::XPCEndpoint):
1456         (WebCore::XPCEndpoint::sendEndpointToConnection):
1457         (WebCore::XPCEndpoint::endpoint const):
1458         * platform/cocoa/XPCEndpointClient.h: Added.
1459         (WebCore::XPCEndpointClient::~XPCEndpointClient):
1460         * platform/cocoa/XPCEndpointClient.mm: Added.
1461         (WebCore::XPCEndpointClient::setEndpoint):
1462         (WebCore::XPCEndpointClient::connection):
1463
1464 2020-07-08  Stephan Szabo  <stephan.szabo@sony.com>
1465
1466         [PlayStation] Build fix after r264050
1467         https://bugs.webkit.org/show_bug.cgi?id=214091
1468
1469         Unreviewed build fix
1470
1471         No new tests, only build fix.
1472
1473         * platform/playstation/ScrollbarThemePlayStation.cpp:
1474
1475 2020-07-08  Sihui Liu  <sihui_liu@appe.com>
1476
1477         Text manipulation should ignore white spaces between nodes
1478         https://bugs.webkit.org/show_bug.cgi?id=213907
1479
1480         Reviewed by Wenson Hsieh.
1481
1482         Text returned by TextIterator contains white spaces (including tabs and line breaks) that do not belong to 
1483         content of nodes. Those spaces are emitted based on style of nodes. For example, line breaks can be emitted 
1484         before and after block-level element. These spaces should not be extracted as part of the content, because 
1485         they could change based on the style of nodes or range of TextIterator, and manipulation fails if content is 
1486         changed. We want to make sure TextManipulationController monitors the real content of nodes.
1487
1488         r262778 tried solving this issue by excluding text with empty node from TextIterator's result. That worked with
1489         line break, but not space and tab. See radar and new test. To solve this, now we exclude text with zero-length
1490         range. 
1491
1492         This patch does not change the behavior of line breaks, which is covered by:
1493         TextManipulation.StartTextManipulationExtractsVisibleLineBreaksInTextAsExcludedTokens
1494         TextManipulation.CompleteTextManipulationCanMergeContentAndPreserveLineBreaks
1495         TextManipulation.CompleteTextManipulationReplaceTwoSimpleParagraphs
1496
1497         New test: TextManipulation.CompleteTextManipulationIgnoreWhiteSpacesBetweenParagraphs
1498         Modified existing tests: TextManipulation.StartTextManipulationExtractsValuesByNode
1499
1500         * editing/TextManipulationController.cpp:
1501         (WebCore::ParagraphContentIterator::ParagraphContentIterator):
1502         (WebCore::ParagraphContentIterator::shouldAdvanceIteratorPastCurrentNode const):
1503         (WebCore::ParagraphContentIterator::advanceIteratorNodeAndUpdateText):
1504
1505 2020-07-08  Darin Adler  <darin@apple.com>
1506
1507         Remove use of live ranges from AXObject.h
1508         https://bugs.webkit.org/show_bug.cgi?id=214053
1509
1510         Reviewed by Sam Weinig.
1511
1512         * accessibility/AXObjectCache.cpp:
1513         (WebCore::AXObjectCache::traverseToOffsetInRange): Take SimpleRange.
1514         (WebCore::AXObjectCache::lengthForRange): Take Optional<SimpleRange>.
1515         (WebCore::AXObjectCache::rangeForNodeContents): Return SimpleRange, take reference
1516         rather than pointer.
1517         (WebCore::characterOffsetsInOrder): Use SimpleRange.
1518         (WebCore::resetNodeAndOffsetForReplacedNode): Take a reference to the node rather than
1519         a pointer.
1520         (WebCore::boundaryPoint): Added. Could be used to replace calls to
1521         setRangeStartOrEndWithCharacterOffset.
1522         (WebCore::setRangeStartOrEndWithCharacterOffset): Take SimpleRange. Also use the
1523         new boundaryPoint function above.
1524         (WebCore::AXObjectCache::rangeForUnorderedCharacterOffsets): Return Optional<SimpleRange>.
1525         (WebCore::AXObjectCache::startOrEndCharacterOffsetForRange): Take SimpleRange.
1526         (WebCore::AXObjectCache::startOrEndTextMarkerDataForRange): Take SimpleRange.
1527         (WebCore::AXObjectCache::characterOffsetForNodeAndOffset): Use SimpleRange.
1528         (WebCore::AXObjectCache::textMarkerDataForNextCharacterOffset): Ditto.
1529         (WebCore::AXObjectCache::textMarkerDataForPreviousCharacterOffset): Ditto.
1530         (WebCore::AXObjectCache::visiblePositionFromCharacterOffset):
1531         (WebCore::AXObjectCache::characterOffsetFromVisiblePosition):
1532         (WebCore::AXObjectCache::leftWordRange): Return Optional<SimpleRange>.
1533         (WebCore::AXObjectCache::rightWordRange): Ditto.
1534         (WebCore::AXObjectCache::nextBoundary): Ditto.
1535         (WebCore::AXObjectCache::previousBoundary): Ditto.
1536         (WebCore::AXObjectCache::startCharacterOffsetOfParagraph): Use SimpleRange.
1537         (WebCore::AXObjectCache::endCharacterOffsetOfParagraph): Ditto.
1538         (WebCore::AXObjectCache::paragraphForCharacterOffset): Ditto.
1539         (WebCore::AXObjectCache::sentenceForCharacterOffset): Ditto.
1540         (WebCore::AXObjectCache::localCaretRectForCharacterOffset): Ditto.
1541         (WebCore::AXObjectCache::characterOffsetForPoint): Ditto.
1542         (WebCore::AXObjectCache::characterOffsetForIndex): Ditto.
1543         (WebCore::AXObjectCache::indexForCharacterOffset): Ditto.
1544
1545         * accessibility/AXObjectCache.h: Remove uses of Range and include of "Range.h".
1546
1547         * accessibility/AccessibilityObject.cpp:
1548         (WebCore::AccessibilityObject::elementRange const): Call createLiveRange.
1549         (WebCore::AccessibilityObject::rangeForPlainTextRange const): Ditto.
1550
1551         * accessibility/AccessibilityRenderObject.cpp:
1552         (WebCore::AccessibilityRenderObject::boundsForRange const): Pass SimpleRange.
1553
1554         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1555         (+[WebAccessibilityTextMarker startOrEndTextMarkerForRange:isStart:cache:]): Pass SimpleRange.
1556         (-[WebAccessibilityObjectWrapper positionForTextMarker:]): Call createLiveRange.
1557         (-[WebAccessibilityObjectWrapper textMarkerRangeForSelection]): Pass SimpleRange.
1558         (-[WebAccessibilityObjectWrapper textMarkerForPosition:]): Ditto.
1559         (-[WebAccessibilityObjectWrapper rangeForTextMarkers:]): Call createLiveRange.
1560         (-[WebAccessibilityObjectWrapper lengthForTextMarkers:]): Pass SimpleRange.
1561
1562         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1563         (startOrEndTextmarkerForRange):
1564         (-[WebAccessibilityObjectWrapper rangeForTextMarkerRange:]): Pass SimpleRange.
1565         (-[WebAccessibilityObjectWrapper _indexForTextMarker:]): Call createLiveRange.
1566         (-[WebAccessibilityObjectWrapper textMarkerRangeAtTextMarker:forUnit:]): Ditto.
1567         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): Ditto.
1568
1569         * dom/BoundaryPoint.h: Added makeBoundaryPointBefore/AfterNode.
1570
1571         * dom/SimpleRange.cpp:
1572         (WebCore::makeBoundaryPointBeforeNode): Added.
1573         (WebCore::makeBoundaryPointAfterNode): Ditto.
1574
1575 2020-07-08  Zalan Bujtas  <zalan@apple.com>
1576
1577         [LFC][IFC] Do not use the initial strut baseline values when the text content is inside an inline container
1578         https://bugs.webkit.org/show_bug.cgi?id=214069
1579
1580         Reviewed by Antti Koivisto.
1581
1582         Test: fast/layoutformattingcontext/line-heigt-when-text-is-inside-inline-container.html
1583
1584         * layout/inlineformatting/InlineLineBuilder.cpp:
1585         (WebCore::Layout::LineBuilder::close):
1586         (WebCore::Layout::LineBuilder::adjustBaselineAndLineHeight):
1587         * layout/inlineformatting/InlineLineBuilder.h:
1588
1589 2020-07-08  Zalan Bujtas  <zalan@apple.com>
1590
1591         [LFC][TFC] Table width is computed as if box-sizing was border-box
1592         https://bugs.webkit.org/show_bug.cgi?id=214070
1593
1594         Reviewed by Antti Koivisto.
1595
1596         Apparently the width property of the <table> works as if box-sizing were set to border-box (and <div style="display: table" does not).
1597
1598         Test: fast/layoutformattingcontext/table-with-padding-and-border-simple.html
1599
1600         * layout/layouttree/LayoutTreeBuilder.cpp:
1601         (WebCore::Layout::TreeBuilder::buildTableStructure):
1602
1603 2020-07-07  Antoine Quint  <graouts@webkit.org>
1604
1605         [iOS] Sharing an <img> element with a base64-encoded URL shares the URL as raw text instead of an image
1606         https://bugs.webkit.org/show_bug.cgi?id=214042
1607         <rdar://problem/56669102>
1608
1609         Reviewed by Wenson Hsieh.
1610
1611         * en.lproj/Localizable.strings:
1612
1613 2020-07-08  Philippe Normand  <pnormand@igalia.com>
1614
1615         REGRESSION(r263836): [GStreamer] Debug ASSERT hits
1616         https://bugs.webkit.org/show_bug.cgi?id=214047
1617
1618         Reviewed by Xabier Rodriguez-Calvar.
1619
1620         Reduce the element dependency on RefPtr<MediaStreamTrackPrivate> which is not MT-safe. The
1621         data we need from it are its ID and the contents required to build a GstTagList. So we now
1622         create this tag-list upfront and keep track of the trackID as well.
1623
1624         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
1625         (webkitMediaStreamSrcAddPad):
1626         (ProbeData::ProbeData):
1627         (webkitMediaStreamSrcPadProbeCb):
1628         (webkitMediaStreamSrcSetupSrc):
1629
1630 2020-07-07  Andy Estes  <aestes@apple.com>
1631
1632         [Apple Pay] Fix the build on Catalina internal SDKs
1633         https://bugs.webkit.org/show_bug.cgi?id=214066
1634
1635         Unreviewed build fix for the 10.15.0 Internal SDK.
1636
1637         * Modules/applepay/ApplePaySetupFeature.mm:
1638         (WebCore::ApplePaySetupFeature::supportsInstallments const):
1639
1640 2020-07-07  Alex Christensen  <achristensen@webkit.org>
1641
1642         Allow WebCoreNSURLSession sendH2Ping:pongHandler: to be called from any thread like the rest of WebCoreNSURLSession methods
1643         https://bugs.webkit.org/show_bug.cgi?id=214065
1644
1645         Reviewed by Jer Noble.
1646
1647         Otherwise horrible crashes happen.
1648         The WebCore function calls and loading IPC calls need to happen on the main thread,
1649         and the callback should happen on the NSOperationQueue given when constructing the WebCoreNSURLSession.
1650
1651         * platform/network/cocoa/WebCoreNSURLSession.mm:
1652         (-[WebCoreNSURLSession sendH2Ping:pongHandler:]):
1653
1654 2020-07-07  Sam Weinig  <weinig@apple.com>
1655
1656         Part 2 of SimpleColor and SRGBA<uint8_t> are essentially the same - let's converge them
1657         https://bugs.webkit.org/show_bug.cgi?id=213981
1658
1659         Reviewed by Darin Adler.
1660
1661         - Replaces internal representation of SimpleColor based on an ARGB uint32_t with SRGBA<uint8_t>.
1662         - Removes SimpleColor constructor taking a uint32_t. Callers that still need to convert from ARGB
1663           now do makeSimpleColor(asSRGBA(Packed::ARGB { value })).
1664         - Removes value() and valueAsARGB() member functions from SimpleColor. Callers that need a packed
1665           representation now do Packed::ARGB { simpleColor.asSRGBA<uint8_t>() }.value.
1666
1667         * css/StyleColor.cpp:
1668         (WebCore::StyleColor::colorFromKeyword):
1669         Use asSRGBA(Packed::ARGB{...}) to constuct the color.
1670
1671         * css/parser/CSSParserFastPaths.cpp:
1672         (WebCore::finishParsingNamedColor):
1673         Use asSRGBA(Packed::ARGB{...}) (or in one case, Packed::RGBA) to constuct the color.
1674         These can almost certainly be simplified, but in the interest of keeping things smallish,
1675         I have left that for a subsequent change.
1676
1677         * editing/CompositionHighlight.h:
1678         Switch to using auto/makeSimpleColor.
1679
1680         * page/cocoa/ResourceUsageOverlayCocoa.mm:
1681         Switch to using makeSimpleColor.
1682
1683         (WebCore::HistoricMemoryCategoryInfo::HistoricMemoryCategoryInfo):
1684         (WebCore::HistoricResourceUsageData::HistoricResourceUsageData):
1685         Switch to using auto/makeSimpleColor.
1686
1687         * platform/adwaita/ScrollbarThemeAdwaita.cpp:
1688         Switch to using auto/makeSimpleColor.
1689
1690         * platform/graphics/Color.cpp:
1691         * platform/graphics/Color.h:
1692         - Switch to using auto/makeSimpleColor for named colors.
1693         - Switch to storing/encoding the inline SimpleColor as a Packed::RGBA value.
1694
1695         * platform/graphics/ColorBlending.cpp:
1696         (WebCore::blend):
1697         Update for new name of clampToComponentBytes.
1698
1699         * platform/graphics/ColorTypes.h:
1700         (WebCore::Packed::RGBA::RGBA):
1701         (WebCore::Packed::ARGB::ARGB):
1702         (WebCore::asSRGBA):
1703         Rename WebCore::ARGB to WebCore::Packed::ARGB. Adds companion, WebCore::Packed::RGBA. And adds constructors
1704         which make a packed type from an SRGBA<uint8_t>.
1705
1706         * platform/graphics/ColorUtilities.h:
1707         (WebCore::clampToComponentByte):
1708         (WebCore::clampToComponentFloat):
1709         Extract out helper functions which just do the clamping for the type. 
1710
1711         (WebCore::clampToComponentBytes):
1712         (WebCore::clampToComponentFloats):
1713         Rename conversion functions that just clamp to use "clamp" prefix rather than "convert". Make use
1714         of extracted helpers.
1715
1716         * platform/graphics/ImageBackingStore.h:
1717         (WebCore::ImageBackingStore::blendPixel):
1718         (WebCore::ImageBackingStore::pixelValue const):
1719         Update using new packed color types and funtions. 
1720
1721         * platform/graphics/SimpleColor.h:
1722         (WebCore::SimpleColor::SimpleColor):
1723         (WebCore::SimpleColor::alphaComponent const):
1724         (WebCore::SimpleColor::alphaComponentAsFloat const):
1725         (WebCore::SimpleColor::isOpaque const):
1726         (WebCore::SimpleColor::isVisible const):
1727         (WebCore::SimpleColor::colorWithAlpha const):
1728         (WebCore::SimpleColor::invertedColorWithAlpha const):
1729         (WebCore::SimpleColor::asSRGBA const):
1730         (WebCore::SimpleColor::get const):
1731         (WebCore::makeSimpleColor):
1732         (WebCore::SimpleColor::valueAsARGB const): Deleted.
1733         (WebCore::SimpleColor::value const): Deleted.
1734         (WebCore::SimpleColor::redComponent const): Deleted.
1735         (WebCore::SimpleColor::greenComponent const): Deleted.
1736         (WebCore::SimpleColor::blueComponent const): Deleted.
1737         - Removes constructor taking an ARGB uint32_t.
1738         - Removes valueAsARGB()/value() functions (can use Packed::ARGB directly if needed).
1739         - Switches internal representation to SRGBA<uint8_t>.
1740         - Streamline makeSimpleColor functions to use shared helpers from ColorUtilities.h
1741
1742         * platform/graphics/cg/ColorCG.cpp:
1743         (WebCore::cachedCGColor):
1744         * platform/graphics/mac/ColorMac.mm:
1745         (WebCore::nsColor):
1746         Use Packed::RGBA to extract uint32_t for quick lookup of transparent/white/black SimpleColors. Despite the
1747         length of the calls, SimpleColor is fully constexpr, so these actually collapse down to the uint32_t representation
1748         at compile time.
1749
1750         * platform/graphics/win/GraphicsContextCGWin.cpp:
1751         (WebCore::GraphicsContext::drawDotsForDocumentMarker):
1752         Switch to using auto/makeSimpleColor.
1753
1754         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1755         (WebCore::defaultDevices):
1756         Switch to using makeSimpleColor.
1757
1758         * platform/mock/MockRealtimeVideoSource.cpp:
1759         (WebCore::MockRealtimeVideoSource::drawBoxes):
1760         Switch to using auto/makeSimpleColor.
1761
1762         * platform/mock/ScrollbarThemeMock.cpp:
1763         (WebCore::ScrollbarThemeMock::paintTrackBackground):
1764         Switch to using makeSimpleColor.
1765
1766         * rendering/RenderObject.cpp:
1767         (WebCore::RenderObject::calculateBorderStyleColor):
1768         Update comment to use per-component values.
1769
1770         * rendering/RenderTheme.cpp:
1771         (WebCore::RenderTheme::systemColor const):
1772         Switch to using makeSimpleColor.
1773
1774         * rendering/RenderThemeAdwaita.cpp:
1775         Switch to using auto/makeSimpleColor.
1776
1777         * rendering/RenderThemeIOS.h:
1778         * rendering/RenderThemeIOS.mm:
1779         (WebCore::RenderThemeIOS::paintProgressBar):
1780         Switch to using auto/makeSimpleColor.
1781
1782         * rendering/RenderThemeMac.mm:
1783         (WebCore::RenderThemeMac::systemColor const):
1784         Switch to using auto/makeSimpleColor.
1785
1786 2020-07-07  Andres Gonzalez  <andresg_22@apple.com>
1787
1788         Web content process hangs in AccessibilityRenderObject::setSelectedVisiblePositionRange in some corner cases.
1789         https://bugs.webkit.org/show_bug.cgi?id=214017
1790         <rdar://problem/63000006>
1791
1792         Reviewed by Chris Fleizach.
1793
1794         Ensures that in the case of collapsed ranges, the VisiblePosition that
1795         the selection is being set to, is contained in the Element object.
1796
1797         Test: accessibility/mac/selected-visible-position-range.html
1798
1799         * accessibility/AccessibilityRenderObject.cpp:
1800         (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange const):
1801
1802 2020-07-07  Youenn Fablet  <youenn@apple.com>
1803
1804         Fix potential pixel buffer leak in ImageRotationSessionVT::rotate
1805         https://bugs.webkit.org/show_bug.cgi?id=213922
1806
1807         Reviewed by Eric Carlson.
1808
1809         Fix a potential memory leak in an error case.
1810         Add more logging to be able to see errors.
1811         Remove the kCVPixelBufferIOSurfacePropertiesKey key on iOS from the buffer pool to revert
1812         part of https://trac.webkit.org/changeset/258504/webkit that seems problematic in iOS.
1813
1814         * platform/graphics/cv/ImageRotationSessionVT.mm:
1815         (WebCore::ImageRotationSessionVT::initialize):
1816         (WebCore::ImageRotationSessionVT::rotate):
1817
1818 2020-07-07  Simon Fraser  <simon.fraser@apple.com>
1819
1820         Unable to scroll elcomerico.pe page until the page finishes loading
1821         https://bugs.webkit.org/show_bug.cgi?id=214027
1822         <rdar://problem/64646259>
1823
1824         Reviewed by Antti Koivisto.
1825         
1826         <https://elcomercio.pe/mundo/eeuu/que-visas-para-estados-unidos-fueron-suspendidas-por-orden-de-donald-trump-hasta-fin-de-ano-y-a-quien-afecta-la-medida-noticia/>
1827         had a scaleX(0) element as an ancestor of an overflow:scroll. The CALayer hit-testing code failed to take
1828         non-invertible transforms into account, causing the overflow:scroll to intercept scrolling events.
1829
1830         Fix by explicitly testing for non-invertible transforms, and, when found, bailing from the
1831         sublayer walk. A non-invertible layer transform makes all its descendants non hit-testable.
1832
1833         Tests: fast/scrolling/ios/non-invertible-transformed-scroller-ancestor.html
1834                fast/scrolling/mac/non-invertible-transform-hit-testing.html
1835
1836         * page/scrolling/mac/ScrollingTreeMac.mm:
1837         (collectDescendantLayersAtPoint):
1838         * platform/graphics/transforms/TransformationMatrix.h:
1839
1840 2020-07-07  Peng Liu  <peng.liu6@apple.com>
1841
1842         Function didCleanupFullscreencreen() should be called at the end of VideoFullscreenInterfaceAVKit::cleanupFullscreen()
1843         https://bugs.webkit.org/show_bug.cgi?id=214032
1844
1845         Reviewed by Eric Carlson.
1846
1847         VideoFullscreenManagerProxy::didCleanupFullscreen() may destroy an instance of VideoFullscreenInterfaceAVKit.
1848         So we should not access member variables of VideoFullscreenInterfaceAVKit after calling didCleanupFullscreen()
1849         in VideoFullscreenInterfaceAVKit::cleanupFullscreen().
1850
1851         Fix a flaky test crash: media/video-autoplay.html
1852
1853         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1854         (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
1855
1856 2020-07-07  Tim Horton  <timothy_horton@apple.com>
1857
1858         <attachment> layout does not scale with Dynamic Type size changes
1859         https://bugs.webkit.org/show_bug.cgi?id=214023
1860         <rdar://problem/64914762>
1861
1862         Reviewed by Sam Weinig.
1863
1864         Test: fast/attachment/attachment-dynamic-type.html
1865
1866         * rendering/RenderThemeIOS.mm:
1867         (WebCore::shortCaptionPointSizeWithContentSizeCategory):
1868         (WebCore::attachmentDynamicTypeScaleFactor):
1869         (WebCore::RenderAttachmentInfo::buildWrappedLines):
1870         (WebCore::RenderThemeIOS::attachmentIntrinsicSize const):
1871         Scale the <attachment> overall size and text line width by the Dynamic Type
1872         scaling factor, determined by dividing the resolved point size of two
1873         font descriptors created with the Large (default) category and the Current category.
1874
1875         * rendering/RenderAttachment.cpp:
1876         (WebCore::RenderAttachment::layout):
1877         * rendering/RenderTheme.h:
1878         (WebCore::RenderTheme::attachmentShouldAllowWidthToShrink const):
1879         * rendering/RenderThemeIOS.h:
1880         Add a RenderTheme bit controlling the behavior introduced in r202117.
1881         After r202117, <attachment> elements are never allowed to shrink. This 
1882         is fine for macOS, where we don't vary the Dynamic Type size, only the content,
1883         but undesirable on iOS, where the size of the <attachment> is based solely
1884         on Dynamic Type size (and thus can shrink when the size is reduced),
1885         and not the content.
1886         
1887         * Configurations/WebCoreTestSupport.xcconfig:
1888         * testing/Internals.cpp:
1889         (WebCore::Internals::resetToConsistentState):
1890         (WebCore::Internals::setContentSizeCategory):
1891         * testing/Internals.h:
1892         * testing/Internals.idl:
1893         Add a Internals method to change the current Dynamic Type category.
1894
1895 2020-07-07  Alex Christensen  <achristensen@webkit.org>
1896
1897         Add WebCoreNSURLSession SPI to send HTTP/2 ping
1898         https://bugs.webkit.org/show_bug.cgi?id=214030
1899         <rdar://problem/64495827>
1900
1901         Reviewed by Jer Noble.
1902
1903         Add lots of plumbing, move internalError from WebKit to WebCore.
1904
1905         Covered by an API test that requires some future CFNetwork behavior.
1906
1907         * Sources.txt:
1908         * WebCore.xcodeproj/project.pbxproj:
1909         * bindings/js/JSDOMPromiseDeferred.h:
1910         * loader/FrameLoaderClient.cpp: Added.
1911         (WebCore::FrameLoaderClient::sendH2Ping):
1912         * loader/FrameLoaderClient.h:
1913         * loader/MediaResourceLoader.cpp:
1914         (WebCore::MediaResourceLoader::sendH2Ping):
1915         * loader/MediaResourceLoader.h:
1916         * platform/graphics/PlatformMediaResourceLoader.cpp: Added.
1917         (WebCore::PlatformMediaResourceLoader::sendH2Ping):
1918         * platform/graphics/PlatformMediaResourceLoader.h:
1919         * platform/network/ResourceErrorBase.cpp:
1920         (WebCore::internalError):
1921         * platform/network/ResourceErrorBase.h:
1922         * platform/network/cocoa/WebCoreNSURLSession.h:
1923         * platform/network/cocoa/WebCoreNSURLSession.mm:
1924         (-[WebCoreNSURLSession sendH2Ping:pongHandler:]):
1925         * testing/Internals.cpp:
1926         (WebCore::Internals::sendH2Ping):
1927         * testing/Internals.h:
1928         * testing/Internals.idl:
1929
1930 2020-07-07  Tomoki Imai  <Tomoki.Imai@sony.com>
1931
1932         [Win] Implement Pasteboard::writeCustomData for Web Inspector Console tab
1933         https://bugs.webkit.org/show_bug.cgi?id=213986
1934
1935         Reviewed by Fujii Hironori.
1936
1937         Implement Pasteboard::writeCustomData and Pasteboard::typesSafeForBindings.
1938         This fixes the issue which we cannot copy text in WebInspector's Console tab.
1939
1940         We enable some existing testcases for pasteboard.
1941
1942         * platform/Pasteboard.h:
1943         * platform/PasteboardCustomData.cpp:
1944         (WebCore::PasteboardCustomData::fromPersistenceDecoder): Construct PasteboardCustomData from WTF::Persistence::Decoder.
1945         (WebCore::PasteboardCustomData::fromSharedBuffer): Use fromPersistenceDecoder function to implement.
1946         * platform/PasteboardCustomData.h:
1947         * platform/win/ClipboardUtilitiesWin.cpp:
1948         (WebCore::createGlobalData): Add uint8_t* variant.
1949         * platform/win/ClipboardUtilitiesWin.h:
1950         * platform/win/PasteboardWin.cpp:
1951         (WebCore::Pasteboard::finishCreatingPasteboard): Register new clipboard format CustomDataClipboardFormat.
1952         (WebCore::Pasteboard::readPasteboardCustomData): Helper function to read PasteboardCustomData from the pasteboard.
1953         (WebCore::Pasteboard::typesSafeForBindings): Implemented.
1954         (WebCore::Pasteboard::readOrigin): Implemented.
1955         (WebCore::Pasteboard::readStringInCustomData): Implemented.
1956         (WebCore::Pasteboard::writeCustomData): Implemented.
1957
1958
1959 2020-07-06  Simon Fraser  <simon.fraser@apple.com>
1960
1961         High CPU usage on Stash search results pages
1962         https://bugs.webkit.org/show_bug.cgi?id=214018
1963         <rdar://problem/64832917>
1964
1965         Reviewed by Tim Horton.
1966
1967         Stash search results pages can contain a lot of overflow:scroll areas, so scrolling thread CA commits
1968         would take a long time because ScrollingTreeScrollingNodeDelegateMac::updateScrollbarPainters() would
1969         open and close a CA commit for each scroller.
1970
1971         Fix by not explicitly starting a CA commit, and only entering this code if a gesture is active and in
1972         the momentum phase.
1973
1974         Also sprinkle BEGIN_BLOCK_OBJC_EXCEPTIONS/END_BLOCK_OBJC_EXCEPTIONS in more places that call into Core
1975         Animation.
1976
1977         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1978         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
1979         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers):
1980         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
1981         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
1982         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
1983         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
1984         (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent):
1985         (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateScrollbarPainters):
1986
1987 2020-07-06  Simon Fraser  <simon.fraser@apple.com>
1988
1989         BEGIN_BLOCK_OBJC_EXCEPTIONS/END_BLOCK_OBJC_EXCEPTIONS should not have trailing semicolons
1990         https://bugs.webkit.org/show_bug.cgi?id=214019
1991
1992         Reviewed by Tim Horton.
1993
1994         These macros are defined as:
1995         
1996         #define BEGIN_BLOCK_OBJC_EXCEPTIONS @try {
1997         #define END_BLOCK_OBJC_EXCEPTIONS } @catch(NSException *localException) { ReportBlockedObjCException(localException); }
1998         
1999         so they should not be used with trailing semicolons.
2000
2001         * editing/cocoa/DictionaryLookup.mm:
2002         (WebCore::expandSelectionByCharacters):
2003         (WebCore::showPopupOrCreateAnimationController):
2004         * editing/cocoa/EditorCocoa.mm:
2005         (WebCore::Editor::dataInRTFDFormat):
2006         (WebCore::Editor::dataInRTFFormat):
2007         * editing/mac/DictionaryLookupLegacy.mm:
2008         (WebCore::tokenRange):
2009         (WebCore::expandSelectionByCharacters):
2010         (WebCore::showPopupOrCreateAnimationController):
2011         (WebCore::DictionaryLookup::hidePopup):
2012         * page/ios/EventHandlerIOS.mm:
2013         (WebCore::EventHandler::keyEvent):
2014         (WebCore::lastEventIsMouseUp):
2015         (WebCore::EventHandler::passMouseDownEventToWidget):
2016         (WebCore::findViewInSubviews):
2017         (WebCore::EventHandler::eventLoopHandleMouseUp):
2018         (WebCore::EventHandler::passSubframeEventToSubframe):
2019         (WebCore::EventHandler::passWheelEventToWidget):
2020         (WebCore::EventHandler::mouseDown):
2021         (WebCore::EventHandler::mouseUp):
2022         (WebCore::EventHandler::mouseMoved):
2023         * page/mac/ChromeMac.mm:
2024         (WebCore::Chrome::focusNSView):
2025         * page/mac/EventHandlerMac.mm:
2026         (WebCore::EventHandler::keyEvent):
2027         (WebCore::lastEventIsMouseUp):
2028         (WebCore::EventHandler::passMouseDownEventToWidget):
2029         (WebCore::findViewInSubviews):
2030         (WebCore::EventHandler::eventLoopHandleMouseDragged):
2031         (WebCore::EventHandler::eventLoopHandleMouseUp):
2032         (WebCore::EventHandler::passSubframeEventToSubframe):
2033         (WebCore::EventHandler::passWheelEventToWidget):
2034         (WebCore::EventHandler::mouseDown):
2035         (WebCore::EventHandler::mouseDragged):
2036         (WebCore::EventHandler::mouseUp):
2037         (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
2038         (WebCore::EventHandler::mouseMoved):
2039         (WebCore::EventHandler::pressureChange):
2040         (WebCore::EventHandler::passMouseMovedEventToScrollbars):
2041         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
2042         (WebCore::ContentFilterUnblockHandler::encode const):
2043         (WebCore::ContentFilterUnblockHandler::decode):
2044         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2045         (WebCore::MediaPlayerPrivateAVFoundationObjC::paintCurrentFrameInContext):
2046         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2047         (WebCore::SourceBufferPrivateAVFObjC::willProvideContentKeyRequestInitializationDataForTrackID):
2048         * platform/graphics/gpu/cocoa/GPUBindGroupAllocatorMetal.mm:
2049         (WebCore::GPUBindGroupAllocator::allocateAndSetEncoders):
2050         (WebCore::GPUBindGroupAllocator::reallocate):
2051         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
2052         (WebCore::appendArgumentToArray):
2053         (WebCore::tryCreateMtlArgumentEncoder):
2054         (WebCore::argumentDescriptor):
2055         (WebCore::GPUBindGroupLayout::tryCreate):
2056         * platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm:
2057         (WebCore::setBufferOnEncoder):
2058         (WebCore::setSamplerOnEncoder):
2059         (WebCore::setTextureOnEncoder):
2060         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
2061         (WebCore::GPUBuffer::tryCreate):
2062         (WebCore::GPUBuffer::commandBufferCommitted):
2063         (WebCore::GPUBuffer::copyStagingBufferToGPU):
2064         * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm:
2065         (WebCore::GPUCommandBuffer::tryCreate):
2066         (WebCore::GPUCommandBuffer::endBlitEncoding):
2067         (WebCore::GPUCommandBuffer::copyBufferToBuffer):
2068         (WebCore::GPUCommandBuffer::copyBufferToTexture):
2069         (WebCore::GPUCommandBuffer::copyTextureToBuffer):
2070         (WebCore::GPUCommandBuffer::copyTextureToTexture):
2071         * platform/graphics/gpu/cocoa/GPUComputePassEncoderMetal.mm:
2072         (WebCore::GPUComputePassEncoder::tryCreate):
2073         (WebCore::GPUComputePassEncoder::setPipeline):
2074         (WebCore::GPUComputePassEncoder::dispatch):
2075         (WebCore::GPUComputePassEncoder::useResource):
2076         (WebCore::GPUComputePassEncoder::setComputeBuffer):
2077         * platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
2078         (WebCore::trySetMetalFunctions):
2079         (WebCore::trySetFunctions):
2080         (WebCore::convertComputePipelineDescriptor):
2081         (WebCore::tryCreateMTLComputePipelineState):
2082         * platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
2083         (WebCore::GPUDevice::tryCreate):
2084         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
2085         (WebCore::GPUProgrammablePassEncoder::endPass):
2086         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
2087         (WebCore::GPUQueue::tryCreate):
2088         (WebCore::GPUQueue::submit):
2089         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
2090         (WebCore::populateMtlColorAttachmentsArray):
2091         (WebCore::populateMtlDepthStencilAttachment):
2092         (WebCore::GPURenderPassEncoder::tryCreate):
2093         (WebCore::GPURenderPassEncoder::setPipeline):
2094         (WebCore::GPURenderPassEncoder::setBlendColor):
2095         (WebCore::GPURenderPassEncoder::setViewport):
2096         (WebCore::GPURenderPassEncoder::setScissorRect):
2097         (WebCore::GPURenderPassEncoder::setVertexBuffers):
2098         (WebCore::GPURenderPassEncoder::draw):
2099         (WebCore::GPURenderPassEncoder::drawIndexed):
2100         (WebCore::GPURenderPassEncoder::useResource):
2101         (WebCore::GPURenderPassEncoder::setVertexBuffer):
2102         (WebCore::GPURenderPassEncoder::setFragmentBuffer):
2103         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
2104         (WebCore::tryCreateMtlDepthStencilState):
2105         (WebCore::trySetVertexInput):
2106         (WebCore::trySetColorStates):
2107         (WebCore::trySetMetalFunctions):
2108         (WebCore::trySetFunctions):
2109         (WebCore::convertRenderPipelineDescriptor):
2110         (WebCore::tryCreateMtlRenderPipelineState):
2111         * platform/graphics/gpu/cocoa/GPUSamplerMetal.mm:
2112         (WebCore::tryCreateMtlSamplerState):
2113         * platform/graphics/gpu/cocoa/GPUShaderModuleMetal.mm:
2114         (WebCore::GPUShaderModule::tryCreate):
2115         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
2116         (WebCore::tryCreateWebGPULayer):
2117         (WebCore::GPUSwapChain::tryGetCurrentTexture):
2118         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
2119         (WebCore::tryCreateMtlTextureDescriptor):
2120         (WebCore::GPUTexture::tryCreate):
2121         (WebCore::GPUTexture::tryCreateDefaultTextureView):
2122         * platform/graphics/mac/ColorMac.mm:
2123         (WebCore::makeSimpleColorFromNSColor):
2124         * platform/ios/ScrollViewIOS.mm:
2125         (WebCore::ScrollView::documentView const):
2126         (WebCore::ScrollView::platformSetScrollbarModes):
2127         (WebCore::ScrollView::platformScrollbarModes const):
2128         (WebCore::ScrollView::platformSetCanBlitOnScroll):
2129         (WebCore::ScrollView::platformUnobscuredContentRect const):
2130         (WebCore::ScrollView::platformExposedContentRect const):
2131         (WebCore::ScrollView::setActualScrollPosition):
2132         (WebCore::ScrollView::platformVisibleContentRect const):
2133         (WebCore::ScrollView::platformVisibleContentSize const):
2134         (WebCore::ScrollView::legacyTileCache):
2135         (WebCore::ScrollView::platformSetContentsSize):
2136         (WebCore::ScrollView::platformSetScrollbarsSuppressed):
2137         (WebCore::ScrollView::platformSetScrollPosition):
2138         (WebCore::ScrollView::platformRepaintContentRectangle):
2139         (WebCore::ScrollView::platformContentsToScreen const):
2140         (WebCore::ScrollView::platformScreenToContents const):
2141         (WebCore::ScrollView::platformSetScrollOrigin):
2142         * platform/ios/WidgetIOS.mm:
2143         (WebCore::Widget::show):
2144         (WebCore::Widget::hide):
2145         (WebCore::Widget::frameRect const):
2146         (WebCore::Widget::setFrameRect):
2147         (WebCore::Widget::paint):
2148         (WebCore::Widget::addToSuperview):
2149         (WebCore::Widget::removeFromSuperview):
2150         (WebCore::Widget::convertFromRootToContainingWindow):
2151         (WebCore::Widget::convertFromContainingWindowToRoot):
2152         * platform/mac/CursorMac.mm:
2153         (WebCore::createCustomCursor):
2154         * platform/mac/ScrollAnimatorMac.mm:
2155         (-[WebScrollbarPartAnimation invalidate]):
2156         (-[WebScrollerImpDelegate cancelAnimations]):
2157         (-[WebScrollerImpDelegate invalidate]):
2158         (WebCore::ScrollAnimatorMac::~ScrollAnimatorMac):
2159         * platform/mac/ScrollViewMac.mm:
2160         (WebCore::ScrollView::documentView const):
2161         (WebCore::ScrollView::platformAddChild):
2162         (WebCore::ScrollView::platformSetScrollbarModes):
2163         (WebCore::ScrollView::platformScrollbarModes const):
2164         (WebCore::ScrollView::platformSetCanBlitOnScroll):
2165         (WebCore::ScrollView::platformTopContentInset const):
2166         (WebCore::ScrollView::platformSetTopContentInset):
2167         (WebCore::ScrollView::platformVisibleContentRect const):
2168         (WebCore::ScrollView::platformVisibleContentRectIncludingObscuredArea const):
2169         (WebCore::ScrollView::platformSetContentsSize):
2170         (WebCore::ScrollView::platformSetScrollbarsSuppressed):
2171         (WebCore::ScrollView::platformSetScrollPosition):
2172         (WebCore::ScrollView::platformRepaintContentRectangle):
2173         (WebCore::ScrollView::platformContentsToScreen const):
2174         (WebCore::ScrollView::platformScreenToContents const):
2175         (WebCore::ScrollView::platformSetScrollOrigin):
2176         * platform/mac/ScrollbarThemeMac.mm:
2177         (WebCore::ScrollbarThemeMac::scrollbarThickness):
2178         (WebCore::ScrollbarThemeMac::updateScrollbarOverlayStyle):
2179         (WebCore::ScrollbarThemeMac::minimumThumbLength):
2180         (WebCore::ScrollbarThemeMac::updateEnabledState):
2181         (WebCore::ScrollbarThemeMac::setPaintCharacteristicsForScrollbar):
2182         (WebCore::scrollerImpPaint):
2183         (WebCore::linenBackgroundColor):
2184         * platform/mac/WidgetMac.mm:
2185         (WebCore::Widget::setFocus):
2186         (WebCore::Widget::show):
2187         (WebCore::Widget::hide):
2188         (WebCore::Widget::frameRect const):
2189         (WebCore::Widget::setFrameRect):
2190         (WebCore::Widget::paint):
2191         (WebCore::Widget::setIsSelected):
2192         (WebCore::Widget::removeFromSuperview):
2193         (WebCore::Widget::convertFromRootToContainingWindow):
2194         (WebCore::Widget::convertFromContainingWindowToRoot):
2195         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
2196         (WebCore::NetworkStorageSession::setCookie):
2197         (WebCore::NetworkStorageSession::setCookies):
2198         (WebCore::NetworkStorageSession::setAllCookiesToSameSiteStrict):
2199         (WebCore::NetworkStorageSession::cookiesForSession const):
2200         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
2201         (WebCore::NetworkStorageSession::cookieAcceptPolicy const):
2202         (WebCore::NetworkStorageSession::getRawCookies const):
2203         (WebCore::NetworkStorageSession::deleteCookie const):
2204         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
2205         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
2206         * platform/network/mac/ResourceErrorMac.mm:
2207         (WebCore::ResourceError::platformLazyInit):
2208         * platform/network/mac/ResourceHandleMac.mm:
2209         (WebCore::ResourceHandle::start):
2210         * rendering/RenderThemeCocoa.mm:
2211         (WebCore::RenderThemeCocoa::mediaControlsFormattedStringForDuration):
2212
2213 2020-07-06  Chris Fleizach  <cfleizach@apple.com>
2214
2215         AX: Add ability for AX objects to output html in debug
2216         https://bugs.webkit.org/show_bug.cgi?id=214020
2217
2218         Reviewed by Darin Adler.
2219
2220         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
2221         (-[WebAccessibilityObjectWrapperBase innerHTML]):
2222         (-[WebAccessibilityObjectWrapperBase outerHTML]):
2223
2224 2020-07-06  Brady Eidson  <beidson@apple.com>
2225
2226         Get rid of concept of "initial connected gamepads"
2227         https://bugs.webkit.org/show_bug.cgi?id=214010
2228
2229         Reviewed by Tim Horton.
2230
2231         No new tests (Refactor, no behavior change)
2232
2233         When a page starts using gamepads and some were already connected, this concept
2234         was meant to manage when the already-connected gamepads could be revealed to the page.
2235         
2236         It obviously wasn't needed, as only the HID provider used them (GameController provider didn't)
2237         
2238         Instead, we should just always include a "does this event make gamepads visible?" bit.
2239         
2240         This cleans up a lot of weird code gets both providers working closer to each other.
2241         
2242         * Modules/gamepad/GamepadManager.cpp:
2243         (WebCore::GamepadManager::platformGamepadConnected):
2244         (WebCore::GamepadManager::platformGamepadInputActivity):
2245         * Modules/gamepad/GamepadManager.h:
2246         
2247         * platform/gamepad/GamepadProvider.cpp:
2248         (WebCore::GamepadProvider::dispatchPlatformGamepadInputActivity):
2249         
2250         * platform/gamepad/GamepadProviderClient.h:
2251         (WebCore::GamepadProviderClient::setInitialConnectedGamepads): Deleted.
2252         
2253         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
2254         (WebCore::GameControllerGamepadProvider::controllerDidConnect):
2255         (WebCore::GameControllerGamepadProvider::makeInvisibileGamepadsVisible):
2256         
2257         * platform/gamepad/mac/HIDGamepadProvider.cpp:
2258         (WebCore::HIDGamepadProvider::HIDGamepadProvider):
2259         (WebCore::HIDGamepadProvider::initialGamepadsConnectedTimerFired):
2260         (WebCore::HIDGamepadProvider::openAndScheduleManager):
2261         (WebCore::HIDGamepadProvider::closeAndUnscheduleManager):
2262         (WebCore::HIDGamepadProvider::deviceAdded):
2263         (WebCore::HIDGamepadProvider::deviceRemoved):
2264         (WebCore::HIDGamepadProvider::inputNotificationTimerFired):
2265         (WebCore::HIDGamepadProvider::connectionDelayTimerFired): Deleted.
2266         * platform/gamepad/mac/HIDGamepadProvider.h:
2267         
2268         * testing/MockGamepadProvider.cpp:
2269         (WebCore::MockGamepadProvider::connectMockGamepad):
2270
2271 2020-07-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2272
2273         Web process sometimes crashes when translating an article on spiegel.de
2274         https://bugs.webkit.org/show_bug.cgi?id=214014
2275         <rdar://problem/65099253>
2276
2277         Reviewed by Tim Horton.
2278
2279         The crash happens because we try to make a BoundaryPoint (using `makeBoundaryPoint`) out of an orphaned
2280         `Position` that is anchored before or after the anchor node (more specifically, either `PositionIsBeforeAnchor`
2281         or `PositionIsAfterAnchor`). In `makeBoundaryPoint`, we'll avoid the early `WTF::nullopt` return since the
2282         position is non-null, but then try to access the container node, which is null in this case because the anchor
2283         node has been unparented.
2284
2285         Fix this by not attempting to observe orphaned DOM positions when extracting content for translation.
2286
2287         Test: TextManipulation.StartTextManipulationAvoidCrashWhenExtractingOrphanedPositions
2288
2289         * editing/TextManipulationController.cpp:
2290         (WebCore::TextManipulationController::observeParagraphs):
2291
2292 2020-07-06  John Wilander  <wilander@apple.com>
2293
2294         Follow-up to r263992: Make isKinjaLoginAvatarElement() a free function
2295         https://bugs.webkit.org/show_bug.cgi?id=214015
2296         <rdar://problem/65153632>
2297
2298         Unreviewed follow-up to a quirk. Just changing
2299         isKinjaLoginAvatarElement() from member to free function.
2300
2301         As requested in https://bugs.webkit.org/show_bug.cgi?id=213910#c10.
2302
2303         * page/Quirks.cpp:
2304         (WebCore::isKinjaLoginAvatarElement):
2305         (WebCore::Quirks::isKinjaLoginAvatarElement const): Deleted.
2306         * page/Quirks.h:
2307
2308 2020-07-06  Chris Fleizach  <cfleizach@apple.com>
2309
2310         AX: Implement user action spec for Escape action
2311         https://bugs.webkit.org/show_bug.cgi?id=213875
2312         <rdar://problem/65022980>
2313
2314         Reviewed by Darin Adler.
2315
2316         Implement the Escape action for the user action events.
2317         https://github.com/WICG/aom/blob/gh-pages/explainer.md#user-action-events-from-assistive-technology
2318
2319         Test: accessibility/keyevents-posted-for-dismiss-action.html
2320
2321         * accessibility/AccessibilityNodeObject.cpp:
2322         (WebCore::AccessibilityNodeObject::performEscape):
2323         (WebCore::AccessibilityNodeObject::dispatchSimulatedKeyboardUpDownEvent):
2324         (WebCore::AccessibilityNodeObject::postKeyboardKeysForValueChange):
2325         * accessibility/AccessibilityNodeObject.h:
2326         * accessibility/AccessibilityObject.h:
2327         * accessibility/AccessibilityObjectInterface.h:
2328         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2329         (-[WebAccessibilityObjectWrapper accessibilityPerformEscape]):
2330         * accessibility/isolatedtree/AXIsolatedObject.cpp:
2331         (WebCore::AXIsolatedObject::performEscape):
2332         * accessibility/isolatedtree/AXIsolatedObject.h:
2333         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2334         (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]):
2335
2336 2020-07-06  James Darpinian  <jdarpinian@chromium.org>
2337
2338         Fix transform feedback tests
2339         https://bugs.webkit.org/show_bug.cgi?id=213906
2340
2341         Reviewed by Dean Jackson.
2342
2343         Fix transform feedback conformance tests by implementing missing functionality such as:
2344          - Transform feedback object state tracking
2345          - Validation for all GL errors that can affect state tracking before calling ANGLE
2346          - Default transform feedback object
2347          - Pause/resume
2348          - Fix vertexAttribDivisor in WebGL 2 (unrelated to transform feedback)
2349
2350         After this, all related tests pass except for a few that also fail in Chrome, and one that uses
2351         PIXEL_PACK_BUFFER which is not yet supported.
2352
2353         * html/canvas/WebGL2RenderingContext.cpp:
2354         (WebCore::WebGL2RenderingContext::~WebGL2RenderingContext):
2355         (WebCore::WebGL2RenderingContext::initializeNewContext):
2356         (WebCore::WebGL2RenderingContext::deleteTransformFeedback):
2357         (WebCore::WebGL2RenderingContext::bindTransformFeedback):
2358         (WebCore::ValidateTransformFeedbackPrimitiveMode):
2359         (WebCore::WebGL2RenderingContext::beginTransformFeedback):
2360         (WebCore::WebGL2RenderingContext::endTransformFeedback):
2361         (WebCore::WebGL2RenderingContext::transformFeedbackVaryings):
2362         (WebCore::WebGL2RenderingContext::pauseTransformFeedback):
2363         (WebCore::WebGL2RenderingContext::resumeTransformFeedback):
2364         (WebCore::WebGL2RenderingContext::setIndexedBufferBinding):
2365         (WebCore::WebGL2RenderingContext::getIndexedParameter):
2366         (WebCore::WebGL2RenderingContext::getMaxTransformFeedbackSeparateAttribs):
2367         (WebCore::WebGL2RenderingContext::getParameter):
2368         (WebCore::WebGL2RenderingContext::uncacheDeletedBuffer):
2369         * html/canvas/WebGL2RenderingContext.h:
2370         * html/canvas/WebGLProgram.cpp:
2371         (WebCore::WebGLProgram::cacheInfoIfNeeded):
2372         * html/canvas/WebGLProgram.h:
2373         * html/canvas/WebGLTransformFeedback.cpp:
2374         (WebCore::WebGLTransformFeedback::create):
2375         (WebCore::WebGLTransformFeedback::WebGLTransformFeedback):
2376         (WebCore::WebGLTransformFeedback::setProgram):
2377         (WebCore::WebGLTransformFeedback::setBoundIndexedTransformFeedbackBuffer):
2378         (WebCore::WebGLTransformFeedback::getBoundIndexedTransformFeedbackBuffer):
2379         (WebCore::WebGLTransformFeedback::hasEnoughBuffers const):
2380         (WebCore::WebGLTransformFeedback::usesBuffer):
2381         (WebCore::WebGLTransformFeedback::unbindBuffer):
2382         (WebCore::WebGLTransformFeedback::validateProgramForResume const):
2383         * html/canvas/WebGLTransformFeedback.h:
2384         * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
2385         (WebCore::GraphicsContextGLOpenGL::vertexAttribDivisor):
2386
2387 2020-07-06  Myles C. Maxfield  <mmaxfield@apple.com>
2388
2389         Locale-specific quotes infrastructure needs to compare locale strings properly
2390         https://bugs.webkit.org/show_bug.cgi?id=213827
2391
2392         Reviewed by Darin Adler.
2393
2394         Before this patch, WebKit is selecting which quotes to display on <q>
2395         elements by doing a raw strcmp() on the locale string with a big table
2396         of locale strings. strcmp() is the wrong way to compare locale strings.
2397
2398         The HTML spec has a list of locales and their associated quotes[1].
2399         It is formulated in terms of CSS using the "lang()" pseudoclass.
2400         The spec of the lang() pseudoclass[2] describes that locale comparison
2401         needs to be done according to section 3.3.2 in RFC4647[3].
2402
2403         This algorithm is a pretty general algorithm, and implementing it naively
2404         would mean turning our O(log(n)) algorithm into a O(n) algorithm, which
2405         would be unfortunate. Instead, we can use a few observations about the
2406         set of locale strings we are comparing against, in order to preserve the
2407         O(log(n)) runtime:
2408         - All the locales have either 1 or 2 subtags
2409         - None of the subtags in any of the ranges are wildcards
2410         - The list is sorted, so a locale string that is a prefix of another one
2411               is listed before it.
2412
2413         [1] https://html.spec.whatwg.org/multipage/rendering.html#quotes
2414         [2] https://drafts.csswg.org/selectors-4/#the-lang-pseudo
2415         [3] https://tools.ietf.org/html/rfc4647#page-10
2416
2417         Test: fast/css-generated-content/quotes-lang-2.html
2418
2419         * WebCore.xcodeproj/xcshareddata/xcschemes/WebCore.xcscheme:
2420         * rendering/RenderQuote.cpp:
2421         (WebCore::subtagCompare):
2422         (WebCore::quoteTableLanguageComparisonFunction):
2423         (WebCore::quotesForLanguage):
2424         (WebCore::RenderQuote::computeText const):
2425
2426 2020-07-06  Daniel Bates  <dabates@apple.com>
2427
2428         [iOS] WAKWindow should override -resignFirstResponder and clear state
2429         https://bugs.webkit.org/show_bug.cgi?id=214011
2430         <rdar://problem/65152410>
2431
2432         Reviewed by Tim Horton.
2433
2434         This is part of the fix for <rdar://problem/62615273>.
2435
2436         Override -resignFirstResponder to clear out internal state that tracks the first responder
2437         in the iOS Legacy WebKit world.
2438
2439         * platform/ios/wak/WAKWindow.mm:
2440         (-[WAKWindow resignFirstResponder]):
2441
2442 2020-07-06  Sam Weinig  <weinig@apple.com>
2443
2444         REGRESSION: (r263977): [ iOS Debug WK2 ] 36 fast form and web-platform test consistently crashing
2445         https://bugs.webkit.org/show_bug.cgi?id=214009
2446         <rdar://problem/65151752>
2447
2448         * rendering/RenderTheme.cpp:
2449         (WebCore::RenderTheme::weekInputStyleSheet const):
2450         Replace ""_s with emptyString() to fix crashing tests.
2451
2452 2020-07-06  John Wilander  <wilander@apple.com>
2453
2454         Storage Access API: Add the capability to open a popup and get user interaction so we can call the Storage Access API as a quirk, on behalf of websites that should be doing it themselves
2455         https://bugs.webkit.org/show_bug.cgi?id=213910
2456         <rdar://problem/65058017>
2457
2458         Reviewed by Darin Adler.
2459
2460         This patch not only adds the capability but also adds a site-specific quirk for
2461         the family of Kinja sites so that no previous user interaction with kinja.com
2462         results in a login popup for kinja.com.
2463
2464         No new tests. This is for site-specific quirks.
2465
2466         * dom/Element.cpp:
2467         (WebCore::Element::dispatchMouseEvent):
2468             Just a change in the call into the quirk function.
2469         * page/Quirks.cpp:
2470         (WebCore::Quirks::isKinjaLoginAvatarElement const):
2471             Convenience function for telling if the given element is the Kinja login avatar.
2472         (WebCore::Quirks::triggerOptionalStorageAccessQuirk const):
2473             Now takes the whole Element to be able to look at both classes and attributes.
2474         * page/Quirks.h:
2475
2476 2020-07-06  Peng Liu  <peng.liu6@apple.com>
2477
2478         Cleanup WebVideoFullscreenControllerAVKit.mm and PlaybackSessionInterfaceAVKit.mm
2479         https://bugs.webkit.org/show_bug.cgi?id=214005
2480
2481         Reviewed by Daniel Bates.
2482
2483         No new tests, no behavior change.
2484
2485         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
2486         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2487         (VideoFullscreenControllerContext::setUpFullscreen):
2488         Remove a redundant line.
2489
2490 2020-07-06  Clark Wang  <clark_wang@apple.com>
2491
2492         Added PannerNode constructor according to spec
2493         https://bugs.webkit.org/show_bug.cgi?id=213801
2494
2495         Reviewed by Chris Dumez.
2496
2497         Added in new PannerNode constructor to match spec: https://www.w3.org/TR/webaudio/#dom-pannernode-pannernode.
2498         Added in AudioNodeOptions and PannerOptions files. Modified some previous code in order to pass compilation.
2499
2500         Re-baselined existing tests now that new ones are passing. New ones that fail are due to accepted range
2501         of values that attributes can take on, which are to be implemented in a future patch.
2502
2503         * CMakeLists.txt:
2504         * DerivedSources-input.xcfilelist:
2505         * DerivedSources-output.xcfilelist:
2506         * DerivedSources.make:
2507         * Modules/webaudio/AudioDestinationNode.h:
2508         * Modules/webaudio/AudioNode.cpp:
2509         (WebCore::AudioNode::AudioNode):
2510         * Modules/webaudio/AudioNode.h:
2511         * Modules/webaudio/AudioNodeOptions.h: Added.
2512         * Modules/webaudio/AudioNodeOptions.idl: Added.
2513         * Modules/webaudio/PannerNode.cpp:
2514         (WebCore::PannerNode::PannerNode):
2515         (WebCore::PannerNodeBase::PannerNodeBase):
2516         (WebCore::PannerNode::create):
2517         * Modules/webaudio/PannerNode.h:
2518         * Modules/webaudio/PannerNode.idl:
2519         * Modules/webaudio/PannerOptions.h: Added.
2520         * Modules/webaudio/PannerOptions.idl: Added.
2521         * Sources.txt:
2522         * WebCore.xcodeproj/project.pbxproj:
2523
2524 2020-07-06  Simon Fraser  <simon.fraser@apple.com>
2525
2526         ASSERT_NOT_REACHED() in EventRegionContext::popClip()
2527         https://bugs.webkit.org/show_bug.cgi?id=213905
2528
2529         Reviewed by Daniel Bates.
2530
2531         Fix an assertion seen on bing.com, tesla.com etc where event region painting
2532         would have mismatched push/pop because of an obvious code error.
2533
2534         I spent too long trying to make a testcase and gave up.
2535
2536         * rendering/RenderLayer.cpp:
2537         (WebCore::RenderLayer::restoreClip):
2538
2539 2020-07-06  Sam Weinig  <weinig@apple.com>
2540
2541         Compile-time enable (but leave disabled at runtime by default) date/time input types on macOS to allow testing of cross platform (e.g. DOM) aspects of the controls
2542         https://bugs.webkit.org/show_bug.cgi?id=213949
2543
2544         Reviewed by Darin Adler.
2545
2546         Enable date/time related input element types on all Cocoa platforms, but disable them at runtime.
2547         To make runtime disabling work completely, the user agent style for these element types was
2548         extracted from html.css and is now only added when needed via UserAgentStyle::ensureDefaultStyleSheetsForElement.
2549
2550         This is the first step to allowing us to run a subset of the date/time related input element tests
2551         on more platforms. If this is successful, we should consider do this for all platforms, not just Cocoa. 
2552
2553         * css/html.css:
2554         Move to RenderTheme accessors for conditional inclusion based on Settings.
2555
2556         * html/HTMLInputElement.cpp:
2557         (WebCore::HTMLInputElement::isDateTimeField const): Deleted.
2558         * html/HTMLInputElement.h:
2559         Removed dead isDateTimeField() code. This should have been removed when datetime was removed.
2560
2561         * html/InputType.cpp:
2562         (WebCore::createInputTypeFactoryMap):
2563         (WebCore::InputType::create):
2564         Switch from using RuntimeEnabledFeatures to Settings for checking for enabling (Settings allows
2565         us to write less boilerplate code and is more versatile for testing) and switch to checking the
2566         condition on each InputType construction, rather than just on map's creation (again, this allows
2567         us to have more flexibility in testing).
2568
2569         * page/RuntimeEnabledFeatures.h:
2570         (WebCore::RuntimeEnabledFeatures::inputTypeColorEnabled const): Deleted.
2571         (WebCore::RuntimeEnabledFeatures::setInputTypeColorEnabled): Deleted.
2572         (WebCore::RuntimeEnabledFeatures::inputTypeDateEnabled const): Deleted.
2573         (WebCore::RuntimeEnabledFeatures::setInputTypeDateEnabled): Deleted.
2574         (WebCore::RuntimeEnabledFeatures::inputTypeDateTimeLocalEnabled const): Deleted.
2575         (WebCore::RuntimeEnabledFeatures::setInputTypeDateTimeLocalEnabled): Deleted.
2576         (WebCore::RuntimeEnabledFeatures::inputTypeMonthEnabled const): Deleted.
2577         (WebCore::RuntimeEnabledFeatures::setInputTypeMonthEnabled): Deleted.
2578         (WebCore::RuntimeEnabledFeatures::inputTypeTimeEnabled const): Deleted.
2579         (WebCore::RuntimeEnabledFeatures::setInputTypeTimeEnabled): Deleted.
2580         (WebCore::RuntimeEnabledFeatures::inputTypeWeekEnabled const): Deleted.
2581         (WebCore::RuntimeEnabledFeatures::setInputTypeWeekEnabled): Deleted.
2582         Remove hand written code infavor of code genreated from Settings.yaml.
2583
2584         * page/Settings.yaml:
2585         Moved from RuntimeEnabledFeatures.
2586
2587         * platform/LocalizedStrings.h:
2588         Remove weekFormatInLDML() declaration, which had not implementation.
2589
2590         * platform/text/PlatformLocale.cpp:
2591         (WebCore::Locale::formatDateTime):
2592         * platform/text/PlatformLocale.h:
2593         Simplify code by marking formatDateTime() virtual on all platforms and un-#ifdefing
2594         the base implementation. Platforms that wish to override it still can.
2595
2596         * platform/text/cocoa/LocaleCocoa.h:
2597         * platform/text/cocoa/LocaleCocoa.mm:
2598         * platform/text/ios/LocalizedDateCache.h:
2599         * platform/text/ios/LocalizedDateCache.mm:
2600         Remove iOS specific #ifdefs around code that should work on all Cocoa platforms.
2601
2602         * rendering/RenderTheme.cpp:
2603         (WebCore::RenderTheme::colorInputStyleSheet const):
2604         (WebCore::RenderTheme::dateInputStyleSheet const):
2605         (WebCore::RenderTheme::dateTimeLocalInputStyleSheet const):
2606         (WebCore::RenderTheme::monthInputStyleSheet const):
2607         (WebCore::RenderTheme::timeInputStyleSheet const):
2608         (WebCore::RenderTheme::weekInputStyleSheet const):
2609         * rendering/RenderTheme.h:
2610         Add default user agent stylesheet strings for input types. All moved from html.css. 
2611         
2612         * style/UserAgentStyle.cpp:
2613         (WebCore::Style::UserAgentStyle::ensureDefaultStyleSheetsForElement):
2614         * style/UserAgentStyle.h:
2615         Conditionally add the input type specific user agent stylesheets only if the actual
2616         input type is being passed in. Since creation of the input types is guarded by a Setting,
2617         this can only happen if the type has been enabled. 
2618
2619 2020-07-06  Rob Buis  <rbuis@igalia.com>
2620
2621         Allow setting empty host/hostname on URLs if they use file scheme
2622         https://bugs.webkit.org/show_bug.cgi?id=213983
2623
2624         Reviewed by Alex Christensen.
2625
2626         Allow setting empty host/hostname on URLs if they use file scheme [1, 2, 3].
2627
2628         Behavior matches Firefox.
2629
2630         [1] https://url.spec.whatwg.org/#dom-url-host
2631         [2] https://url.spec.whatwg.org/#dom-url-hostname
2632         [3] https://url.spec.whatwg.org/#host-state Step 1
2633
2634         Test: imported/w3c/web-platform-tests/url/url-setters.html
2635
2636         * html/URLDecomposition.cpp:
2637         (WebCore::URLDecomposition::setHost):
2638         (WebCore::URLDecomposition::setHostname):
2639
2640 2020-07-06  Matt Gilligan  <matthew_gilligan@apple.com>
2641
2642         Update the user agent on iPadOS to use 11 to match macOS Safari
2643         https://bugs.webkit.org/show_bug.cgi?id=213753
2644
2645         Reviewed by Alex Christensen.
2646
2647         Update the version number in the desktop user agent string to 11_0.
2648
2649         * platform/ios/UserAgentIOS.mm:
2650         (WebCore::standardUserAgentWithApplicationName):
2651
2652 2020-07-06  Daniel Bates  <dabates@apple.com>
2653
2654         Use RenderObject::positionForPoint instead of hit testing the entire view in closestEditablePositionInElementForAbsolutePoint
2655         https://bugs.webkit.org/show_bug.cgi?id=213975
2656
2657         Reviewed by Wenson Hsieh.
2658
2659         The target renderer is known a priori so it is more efficient to hit test this directly
2660         instead of indirectly by hit testing the entire view.
2661
2662         * editing/Editing.cpp:
2663         (WebCore::closestEditablePositionInElementForAbsolutePoint):
2664
2665 2020-07-06  Carlos Garcia Campos  <cgarcia@igalia.com>
2666
2667         [GTK][WPE] Change the cookies accept policy when ITP is enabled
2668         https://bugs.webkit.org/show_bug.cgi?id=213502
2669
2670         Reviewed by Michael Catanzaro.
2671
2672         Set the accept policy to always when ITP is enabled and no-third-party is set, otherwise cookies access granted
2673         by request storage access would still be rejected by libsoup if policy is set to no-third-party.
2674
2675         * platform/network/NetworkStorageSession.cpp:
2676         (WebCore::NetworkStorageSession::setResourceLoadStatisticsEnabled): Move here the implementation for ports not
2677         using soup.
2678         * platform/network/NetworkStorageSession.h:
2679         * platform/network/soup/NetworkStorageSessionSoup.cpp:
2680         (WebCore::NetworkStorageSession::NetworkStorageSession): Initialize cookie accept policy.
2681         (WebCore::NetworkStorageSession::setCookieStorage): Set here the accept policy of the new jar.
2682         (WebCore::NetworkStorageSession::setCookieAcceptPolicy): Set the cookie accept policy taking into account that
2683         if ITP is enabled and no-third-party is set we save the policy but use always instead.
2684         (WebCore::NetworkStorageSession::cookieAcceptPolicy const): Remove the default case of the switch.
2685         (WebCore::NetworkStorageSession::setResourceLoadStatisticsEnabled): When enabled, save current policy and set
2686         always if no-third-party is set. When disabled, restore the saved policy.
2687
2688 2020-07-06  Alicia Boya García  <aboya@igalia.com>
2689
2690         [MSE][GStreamer] Don't skip samples past media duration in AppendPipeline
2691         https://bugs.webkit.org/show_bug.cgi?id=213888
2692
2693         Reviewed by Xabier Rodriguez-Calvar.
2694
2695         appsinkNewSample() contained code to skip samples whose presentation
2696         time starts after media duration. This is paradoxical, because later
2697         sourceBufferPrivateDidReceiveSample() extends media duration whenever
2698         the presentation end time of the sample is past the original one.
2699
2700         It does not sound reasonable that samples extending the duration are
2701         okay on one case but outright rejected in the other. Also, if it was
2702         about skipping samples, sourceBufferPrivateDidReceiveSample() could do
2703         it itself, and already does in other cases.
2704
2705         For all these reasons I was very doubtful of the need for this if()
2706         and indeed removing this condition didn't cause any new test failure.
2707
2708         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2709         (WebCore::AppendPipeline::appsinkNewSample):
2710
2711 2020-07-05  Commit Queue  <commit-queue@webkit.org>
2712
2713         Unreviewed, reverting r263960.
2714         https://bugs.webkit.org/show_bug.cgi?id=213980
2715
2716         Re-land, because r263959 somehow fixed the build issue caused
2717         by r263953
2718
2719         Reverted changeset:
2720
2721         "Unreviewed, reverting r263953 and r263959."
2722         https://bugs.webkit.org/show_bug.cgi?id=213979
2723         https://trac.webkit.org/changeset/263960
2724
2725 2020-07-05  Commit Queue  <commit-queue@webkit.org>
2726
2727         Unreviewed, reverting r263953 and r263959.
2728         https://bugs.webkit.org/show_bug.cgi?id=213979
2729
2730         Broke internal build
2731
2732         Reverted changesets:
2733
2734         "[Cocoa] Move almost all features from FeatureDefines.xcconfig
2735         to PlatformEnableCocoa.h"
2736         https://bugs.webkit.org/show_bug.cgi?id=212542
2737         https://trac.webkit.org/changeset/263953
2738
2739         "[Cocoa] Remove FEATURE_DEFINES from the Cocoa/Xcode build
2740         system"
2741         https://bugs.webkit.org/show_bug.cgi?id=213976
2742         https://trac.webkit.org/changeset/263959
2743
2744 2020-07-05  Darin Adler  <darin@apple.com>
2745
2746         [Cocoa] Remove FEATURE_DEFINES from the Cocoa/Xcode build system
2747         https://bugs.webkit.org/show_bug.cgi?id=213976
2748
2749         Reviewed by Sam Weinig.
2750
2751         * Configurations/FeatureDefines.xcconfig: Removed everything except for ENABLE_WEB_RTC.
2752
2753         * Configurations/WebCore.xcconfig: Removed FEATURE_DEFINES.
2754         * DerivedSources-input.xcfilelist: Removed FeatureDefines.xcconfig.
2755         * DerivedSources.make: Removed FEATURE_DEFINES, FEATURE_DEFINE_FLAGS, and the dependency
2756         on FeatureDefines.xcconfig.
2757
2758 2020-07-05  Sihui Liu  <sihui_liu@appe.com>
2759
2760         Text manipulation: add a new heuristic to decide paragraph boundary
2761         https://bugs.webkit.org/show_bug.cgi?id=213918
2762
2763         Reviewed by Wenson Hsieh.
2764
2765         Modified test: TextManipulation.StartTextManipulationTreatsInlineBlockLinksAndButtonsAndSpansAsParagraphs.
2766
2767         * editing/TextManipulationController.cpp:
2768         (WebCore::isEnclosingItemBoundaryElement):
2769
2770 2020-07-05  Darin Adler  <darin@apple.com>
2771
2772         [Cocoa] REGRESSION (r263914): Non-Apple-Pay Cocoa builds failing
2773         https://bugs.webkit.org/show_bug.cgi?id=213977
2774
2775         * Modules/applepay/cocoa/PaymentMethodCocoa.mm: Fixed messed up #endif and
2776         unnecessary #undef at end of file.
2777
2778 2020-07-05  Andy Estes  <aestes@apple.com>
2779
2780         [iOS] La Banque Postale app does not respect safe area insets on iOS 14
2781         https://bugs.webkit.org/show_bug.cgi?id=213974
2782         <rdar://problem/65109197>
2783
2784         Reviewed by Darin Adler.
2785
2786         * platform/RuntimeApplicationChecks.h:
2787         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2788         (WebCore::IOSApplication::isLaBanquePostale): Added.
2789
2790 2020-07-05  Darin Adler  <darin@apple.com>
2791
2792         [Cocoa] Move almost all features from FeatureDefines.xcconfig to PlatformEnableCocoa.h
2793         https://bugs.webkit.org/show_bug.cgi?id=212542
2794
2795         Reviewed by Sam Weinig.
2796
2797         * Configurations/FeatureDefines.xcconfig: Delete everything except
2798         ENABLE_EXPERIMENTAL_FEATURES and ENABLE_WEBRTC.
2799
2800 2020-07-05  Wenson Hsieh  <wenson_hsieh@apple.com>
2801
2802         [macOS 11] Indeterminate progress bar animation periodically jumps
2803         https://bugs.webkit.org/show_bug.cgi?id=213967
2804
2805         Reviewed by Sam Weinig.
2806
2807         The animation for an indeterminate progress bar occasionally jumps to the starting frame on macOS 11. This is
2808         because the indeterinate progress bar animation only lasts for 120 frames on macOS 11, so our current hard-coded
2809         value of 256 frames results in 16 extra frames of animation, before abruptly looping back to the starting frame.
2810
2811         To fix this, instead of specifying the animation frame index when painting progress bars on macOS, specify the
2812         starting time and current time for the animation, and let CoreUI determine which frame to use.
2813
2814         * rendering/RenderProgress.cpp:
2815         (WebCore::RenderProgress::animationProgress):
2816
2817         Assert that this never gets called with a zero animation duration.
2818
2819         (WebCore::RenderProgress::updateAnimationState):
2820
2821         Instead of checking for the animation duration to determine whether or not we should try and animate progress
2822         bar painting, check for the animation repeat interval instead. This is because on macOS, we no longer hard-code
2823         the animation duration, but still want to be able to animate progress bars.
2824
2825         * rendering/RenderThemeIOS.h:
2826         * rendering/RenderThemeIOS.mm:
2827         (WebCore::RenderThemeIOS::animationRepeatIntervalForProgressBar const): Deleted.
2828         (WebCore::RenderThemeIOS::animationDurationForProgressBar const): Deleted.
2829
2830         Drive-by fix: remove some unnecessary overridden method implementations on RenderThemeIOS.
2831
2832         * rendering/RenderThemeMac.h:
2833         * rendering/RenderThemeMac.mm:
2834         (WebCore::RenderThemeMac::paintProgressBar):
2835         (WebCore::RenderThemeMac::animationDurationForProgressBar const): Deleted.
2836
2837         Stop overriding this method, and remove the `progressAnimationNumFrames` constant declared in this file.
2838
2839 2020-07-05  Said Abou-Hallawa  <sabouhallawa@apple.com>
2840
2841         [macOS] Allow selecting HEIF images if the 'accept' attribute includes an image MIME type that the platform can transcode the HEIF to
2842         https://bugs.webkit.org/show_bug.cgi?id=212489
2843
2844         Reviewed by Darin Adler.
2845
2846         Add some utility functions to MIMETypeRegistry. These new functions will
2847         deal with a list of MIME types combined with a list of file extensions.
2848         They are going to be used the FileChooserSettings which reflects the 
2849         'accept' attribute of the <input> file element.
2850
2851         * platform/MIMETypeRegistry.cpp:
2852         (WebCore::trimmedExtension):
2853         (WebCore::MIMETypeRegistry::preferredImageMIMETypeForEncoding):
2854         (WebCore::MIMETypeRegistry::containsImageMIMETypeForEncoding):
2855
2856         (WebCore::MIMETypeRegistry::allowedMIMETypes):
2857         It returns the set of mime types which is stated by a list of mime types
2858         and a list of file extensions.
2859
2860         (WebCore::MIMETypeRegistry::allowedFileExtensions):
2861         It returns the set of extensions which is stated by a list of mime types
2862         and a list of file extensions.
2863
2864         * platform/MIMETypeRegistry.h:
2865
2866 2020-07-04  Darin Adler  <darin@apple.com>
2867
2868         [Cocoa] Remove all features from FeatureDefines.xcconfig that are already mentioned in PlatformEnableCocoa.h
2869         https://bugs.webkit.org/show_bug.cgi?id=213962
2870
2871         Reviewed by Sam Weinig.
2872
2873         * Configurations/FeatureDefines.xcconfig: Removed all features that were mentioned
2874         in PlatformEnableCocoa.h; the rules in that file now define whether they are enabled.
2875
2876 2020-07-04  Zalan Bujtas  <zalan@apple.com>
2877
2878         [LFC][BFC] Move PositiveAndNegativeVerticalMargin to UsedVerticalMargin
2879         https://bugs.webkit.org/show_bug.cgi?id=213963
2880
2881         Reviewed by Antti Koivisto.
2882
2883         Now that UsedVerticalMargin is not used in Display::Box, we can merged these 2 layout structures.
2884
2885         * layout/MarginTypes.h:
2886         (WebCore::Layout::UsedVerticalMargin::PositiveAndNegativePair::Values::isNonZero const):
2887         (WebCore::Layout::PositiveAndNegativeVerticalMargin::Values::isNonZero const): Deleted.
2888         * layout/blockformatting/BlockFormattingContext.cpp:
2889         (WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForBoxAndAncestors):
2890         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
2891         * layout/blockformatting/BlockFormattingContext.h:
2892         * layout/blockformatting/BlockFormattingState.h:
2893         (WebCore::Layout::BlockFormattingState::hasUsedVerticalMargin const):
2894         (WebCore::Layout::BlockFormattingState::setPositiveAndNegativeVerticalMargin): Deleted.
2895         (WebCore::Layout::BlockFormattingState::hasPositiveAndNegativeVerticalMargin const): Deleted.
2896         (WebCore::Layout::BlockFormattingState::positiveAndNegativeVerticalMargin const): Deleted.
2897         * layout/blockformatting/BlockMarginCollapse.cpp:
2898         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedPositiveAndNegativeMargin const):
2899         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginValue const):
2900         (WebCore::Layout::BlockFormattingContext::MarginCollapse::updateMarginAfterForPreviousSibling):
2901         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues const):
2902         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginBefore const):
2903         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginAfter const):
2904         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedVerticalValues):
2905         * layout/blockformatting/PrecomputedBlockMarginCollapse.cpp:
2906         (WebCore::Layout::BlockFormattingContext::MarginCollapse::precomputedPositiveNegativeValues const):
2907         (WebCore::Layout::BlockFormattingContext::MarginCollapse::precomputedPositiveNegativeMarginBefore const):
2908         * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
2909         (WebCore::Layout::TableWrapperBlockFormattingContext::computeHeightAndMarginForTableBox):
2910
2911 2020-07-04  Zalan Bujtas  <zalan@apple.com>
2912
2913         [LFC][BFC] Remove redundant out-of-flow height-and-margin handling
2914         https://bugs.webkit.org/show_bug.cgi?id=213959
2915
2916         Reviewed by Antti Koivisto.
2917
2918         We will never end up here with an out-of-flow box.
2919
2920         * layout/blockformatting/BlockFormattingContext.cpp:
2921         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
2922
2923 2020-07-04  Zalan Bujtas  <zalan@apple.com>
2924
2925         [LFC][BFC] Store used vertical margin values in the formatting state
2926         https://bugs.webkit.org/show_bug.cgi?id=213958
2927
2928         Reviewed by Antti Koivisto.
2929
2930         Layout related vertical margin values (collapsed vs. non-collapsed) should all go to the FormattingState, while
2931         Display::Box should only have the final values.
2932
2933         * layout/FormattingContext.cpp:
2934         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry):
2935         * layout/FormattingContextGeometry.cpp:
2936         (WebCore::Layout::FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned const):
2937         * layout/MarginTypes.h:
2938         (WebCore::Layout::marginBefore):
2939         (WebCore::Layout::marginAfter):
2940         (WebCore::Layout::UsedVerticalMargin::before const): Deleted.
2941         (WebCore::Layout::UsedVerticalMargin::after const): Deleted.
2942         (WebCore::Layout::UsedVerticalMargin::isCollapsedThrough const): Deleted.
2943         (WebCore::Layout::UsedVerticalMargin::nonCollapsedValues const): Deleted.
2944         (WebCore::Layout::UsedVerticalMargin::collapsedValues const): Deleted.
2945         (WebCore::Layout::UsedVerticalMargin::hasCollapsedValues const): Deleted.
2946         (WebCore::Layout::UsedVerticalMargin::setCollapsedValues): Deleted.
2947         (WebCore::Layout::UsedVerticalMargin::UsedVerticalMargin): Deleted.
2948         * layout/Verification.cpp:
2949         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
2950         * layout/blockformatting/BlockFormattingContext.cpp:
2951         (WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForBoxAndAncestors):
2952         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
2953         (WebCore::Layout::BlockFormattingContext::verticalPositionWithMargin const):
2954         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2955         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2956         * layout/blockformatting/BlockFormattingState.h:
2957         (WebCore::Layout::BlockFormattingState::setUsedVerticalMargin):
2958         (WebCore::Layout::BlockFormattingState::usedVerticalMargin const):
2959         * layout/blockformatting/BlockMarginCollapse.cpp:
2960         (WebCore::Layout::BlockFormattingContext::MarginCollapse::updateMarginAfterForPreviousSibling):
2961         * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
2962         (WebCore::Layout::TableWrapperBlockFormattingContext::computeHeightAndMarginForTableBox):
2963         * layout/displaytree/DisplayBox.cpp:
2964         (WebCore::Display::Box::Box):
2965         (WebCore::Display::Box::nonCollapsedMarginBox const): Deleted.
2966         * layout/displaytree/DisplayBox.h:
2967         (WebCore::Display::Box::rectWithMargin const):
2968         (WebCore::Display::Box::setHasValidVerticalMargin):
2969         (WebCore::Display::Box::setVerticalMargin):
2970         (WebCore::Display::Box::marginBefore const):
2971         (WebCore::Display::Box::marginAfter const):
2972         (WebCore::Display::Box::VerticalMargin::before const): Deleted.
2973         (WebCore::Display::Box::VerticalMargin::after const): Deleted.
2974         (WebCore::Display::Box::VerticalMargin::isCollapsedThrough const): Deleted.
2975         (WebCore::Display::Box::VerticalMargin::nonCollapsedValues const): Deleted.
2976         (WebCore::Display::Box::VerticalMargin::collapsedValues const): Deleted.
2977         (WebCore::Display::Box::VerticalMargin::hasCollapsedValues const): Deleted.
2978         (WebCore::Display::Box::VerticalMargin::setCollapsedValues): Deleted.
2979         (WebCore::Display::Box::hasCollapsedThroughMargin const): Deleted.
2980         (WebCore::Display::Box::setHasValidVerticalNonCollapsedMargin): Deleted.
2981         (WebCore::Display::Box::VerticalMargin::VerticalMargin): Deleted.
2982         (WebCore::Display::Box::VerticalMargin::NonCollapsedValues::NonCollapsedValues): Deleted.
2983         (WebCore::Display::Box::VerticalMargin::CollapsedValues::CollapsedValues): Deleted.
2984         (WebCore::Display::Box::nonCollapsedMarginBefore const): Deleted.
2985         (WebCore::Display::Box::nonCollapsedMarginAfter const): Deleted.
2986         * layout/floats/FloatingContext.cpp:
2987         (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
2988         * layout/inlineformatting/InlineFormattingContext.cpp:
2989         (WebCore::Layout::InlineFormattingContext::layoutInFlowContent):
2990         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin):
2991         * layout/tableformatting/TableFormattingContext.cpp:
2992         (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows):
2993         (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
2994         (WebCore::Layout::TableFormattingContext::layoutCell):
2995
2996 2020-07-04  Darin Adler  <darin@apple.com>
2997
2998         [Cocoa] Remove unconditional features from FeatureDefines.xcconfig, making sure they are covered in PlatformEnableCocoa.h
2999         https://bugs.webkit.org/show_bug.cgi?id=212418
3000
3001         Reviewed by Sam Weinig.
3002
3003         * Configurations/FeatureDefines.xcconfig: Removed features that are either unconditionally not enabled,
3004         or unconditionally enabled. Double checked that all the enabled ones are either in PlatformEnable.h or
3005         PlatformEnableCocoa.h.
3006
3007 2020-07-04  Sam Weinig  <weinig@apple.com>
3008
3009         Part 1 of SimpleColor and SRGBA<uint8_t> are essentially the same - let's converge them
3010         https://bugs.webkit.org/show_bug.cgi?id=213948
3011
3012         Reviewed by Darin Adler.
3013
3014         Begin converging SimpleColor and SRGBA<uint8_t>, starting with removing usages that
3015         were getting SimpleColors to access or operate on the color's components.
3016
3017         - Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>
3018         - Replace toSRGBALossy() with toSRGBALossy<float>().
3019         - Remove direct color component accessors from SimpleColor. 
3020         - Add new ARGB type to support explicit conversion from packed ARGB bits to a color type.
3021         - Update premulitplication functions to operate on SRGBA<uint8_t> and rename them to
3022           match existing function operating on SRGBA<float>.
3023
3024         * Sources.txt:
3025         * WebCore.xcodeproj/project.pbxproj:
3026         Removes SimpleColor.cpp
3027
3028         * accessibility/AccessibilityNodeObject.cpp:
3029         (WebCore::AccessibilityNodeObject::colorValue const):
3030         Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>.
3031
3032         * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
3033         (getAttributeSetForAccessibilityObject):
3034         Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>.
3035
3036         * accessibility/isolatedtree/AXIsolatedObject.cpp:
3037         (WebCore::AXIsolatedObject::colorValue const):
3038         Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>.
3039
3040         * css/DeprecatedCSSOMRGBColor.h:
3041         Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>.
3042         
3043         * editing/cocoa/DataDetection.mm:
3044         (WebCore::DataDetection::detectContentInRange):
3045         Replace toSRGBALossy() with toSRGBALossy<float>().
3046
3047         * platform/graphics/Color.cpp:
3048         (WebCore::Color::lightened const):
3049         (WebCore::Color::darkened const):
3050         (WebCore::Color::lightness const):
3051         (WebCore::Color::luminance const):
3052         (WebCore::Color::semanticColor const):
3053         (WebCore::Color::toSRGBASimpleColorLossy const): Deleted.
3054         (WebCore::Color::toSRGBALossy const): Deleted.
3055         * platform/graphics/Color.h:
3056         Remove toSRGBASimpleColorLossy() and templatize toSRGBALossy() to support both
3057         lossy conversion to byte based components as well.
3058
3059         * platform/graphics/ColorBlending.cpp:
3060         (WebCore::blendSourceOver):
3061         (WebCore::blendWithWhite):
3062         Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>.
3063
3064         (WebCore::blend):
3065         (WebCore::blendWithoutPremultiply):
3066         Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>. Adopt new premultipliedCeiling
3067         and unpremultiplied functions that operate on SRGBA<uint8_t> (rather than SimpleColor) and 
3068         clamping conversion to SRGBA<uint8_t> via convertToComponentBytes<SRGBA>. premultipliedCeiling 
3069         now works correctly for 0 alpha, so no workaround is needed anymore.
3070
3071         * platform/graphics/ColorTypes.h:
3072         (WebCore::asARGB):
3073         (WebCore::asSRGBA):
3074         Add new type of color struct representing a format packing. The initial one is ARGB to support
3075         the few places using SimpleColor to manipulate ARGB pixel data. 
3076
3077         * platform/graphics/ColorUtilities.cpp:
3078         (WebCore::unpremultiplied):
3079         (WebCore::premultipliedFlooring):
3080         (WebCore::premultipliedCeiling):
3081         (WebCore::unpremultipliedComponentByte):
3082         * platform/graphics/ColorUtilities.h:
3083         (WebCore::convertToComponentBytes):
3084         (WebCore::convertToComponentFloats):
3085         Move remaining premultiplication functions here (from SimpleColor.h/cpp) and reimplement
3086         to operate on SRGBA<uint8_t>. Also slightly rename, premultiply -> premultiplied, to 
3087         match existing premultiplied functions. While moving them, also fix the premultiplied
3088         functions to better support 0 alpha to avoid workarounds in callers.
3089         
3090         Additional, this adds convertToComponentBytes/convertToComponentFloats helper functions
3091         which convert to/from uint8_t/float based color types, and support creating color types
3092         from values potentially outside of their supported value range. Right now, that value
3093         range is always considerer to be 0-255 for uint8_t and 0-1 for float, but that can be
3094         chnaged in the future by allowing color type structs to indicate their supported ranges.
3095
3096         * platform/graphics/ExtendedColor.cpp:
3097         (WebCore::ExtendedColor::toSRGBAFloatComponentsLossy const):
3098         (WebCore::ExtendedColor::toSRGBALossy const): Deleted.
3099         * platform/graphics/ExtendedColor.h:
3100         (WebCore::ExtendedColor::toSRGBALossy const):
3101         Rename existing toSRGBALossy() to toSRGBAFloatComponentsLossy() and replace templatize
3102         toSRGBALossy(), with the uint8_t case just down converting via new convertToComponentBytes.
3103         
3104         * platform/graphics/ImageBackingStore.h:
3105         (WebCore::ImageBackingStore::fillRect):
3106         (WebCore::ImageBackingStore::setPixel):
3107         (WebCore::ImageBackingStore::blendPixel):
3108         (WebCore::ImageBackingStore::pixelValue const):
3109         Replace usage of SimpleColor with new ARGB type for conversion from ARGB to SRGBA<uint8_t>.
3110         Update to use new premulitplication functions. Also, update the interface to take pixel 
3111         components as uint8_t, rather than unsigned, as that is what the callers are passing anyway,
3112         and it avoids us having to clamp/cast manually all over the case.
3113
3114         * platform/graphics/SimpleColor.cpp: Removed.
3115         * platform/graphics/SimpleColor.h:
3116         (WebCore::SimpleColor::alphaComponent const):
3117         (WebCore::SimpleColor::asSRGBA const):
3118         (WebCore::SimpleColor::redComponent const):
3119         (WebCore::SimpleColor::greenComponent const):
3120         (WebCore::SimpleColor::blueComponent const):
3121         (WebCore::operator==):
3122         (WebCore::makeSimpleColor):
3123         Simplify interface, making red, green and blue component accessors private and having 
3124         callers all use SRGBA directly. Remove premultiplication functions in favor of new ones  
3125         in ColorUtilities.
3126
3127         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
3128         (WebCore::PlatformCAAnimationCocoa::setFromValue):
3129         (WebCore::PlatformCAAnimationCocoa::setToValue):
3130         (WebCore::PlatformCAAnimationCocoa::setValues):
3131         Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>.
3132
3133         * platform/graphics/ca/win/PlatformCAAnimationWin.cpp:
3134         (PlatformCAAnimationWin::setFromValue):
3135         (PlatformCAAnimationWin::setToValue):
3136         (PlatformCAAnimationWin::setValues):
3137         Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>.
3138
3139         * platform/graphics/cairo/CairoUtilities.cpp:
3140         (WebCore::setSourceRGBAFromColor):
3141         Replace toSRGBALossy() with toSRGBALossy<float>().
3142
3143         * platform/graphics/cairo/GradientCairo.cpp:
3144         (WebCore::addColorStopRGBA):
3145         (WebCore::setCornerColorRGBA):
3146         (WebCore::interpolateColorStop):
3147         Replace toSRGBALossy() with toSRGBALossy<float>().
3148
3149         * platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp:
3150         (WebCore::ImageBufferCairoImageSurfaceBackend::platformTransformColorSpace):
3151         Replace usage of SimpleColor with new ARGB type for conversion from ARGB to SRGBA<uint8_t>.
3152         Update to use new premulitplication functions.
3153
3154         * platform/graphics/cairo/NativeImageCairo.cpp:
3155         (WebCore::nativeImageSinglePixelSolidColor):
3156         Replace usage of SimpleColor with new ARGB type for conversion from ARGB to SRGBA<uint8_t>.
3157         Update to use new premulitplication functions. 
3158
3159         * platform/graphics/cpu/arm/filters/FELightingNEON.h:
3160         (WebCore::FELighting::platformApplyNeon):
3161         Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>.
3162
3163         * platform/graphics/filters/FELighting.cpp:
3164         (WebCore::FELighting::drawLighting):
3165         Replace toSRGBALossy() with toSRGBALossy<float>().
3166
3167         * platform/graphics/filters/FilterOperations.cpp:
3168         (WebCore::FilterOperations::transformColor const):
3169         (WebCore::FilterOperations::inverseTransformColor const):
3170         Replace toSRGBALossy() with toSRGBALossy<float>().
3171
3172         * platform/graphics/gtk/ColorGtk.cpp:
3173         (WebCore::Color::operator GdkRGBA const):
3174         Replace toSRGBALossy() with toSRGBALossy<float>().
3175
3176         * platform/graphics/texmap/TextureMapperGL.cpp:
3177         (WebCore::TextureMapperGL::drawBorder):
3178         (WebCore::TextureMapperGL::drawNumber):
3179         (WebCore::prepareFilterProgram):
3180         (WebCore::TextureMapperGL::drawSolidColor):
3181         (WebCore::TextureMapperGL::clearColor):
3182         Replace toSRGBALossy() with toSRGBALossy<float>().
3183
3184         * platform/graphics/win/ColorDirect2D.cpp:
3185         (WebCore::Color::operator D2D1_COLOR_F const):
3186         (WebCore::Color::operator D2D1_VECTOR_4F const):
3187         Replace toSRGBALossy() with toSRGBALossy<float>().
3188
3189         * platform/graphics/win/GradientDirect2D.cpp:
3190         (WebCore::Gradient::generateGradient):
3191         Replace toSRGBALossy() with toSRGBALossy<float>().
3192
3193         * platform/graphics/win/GraphicsContextCGWin.cpp:
3194         (WebCore::GraphicsContext::drawDotsForDocumentMarker):
3195         Replace direct usage component access from SimpleColor with usage of accessed SRGBA<uint8_t>.
3196
3197         * platform/graphics/win/GraphicsContextDirect2D.cpp:
3198         (WebCore::GraphicsContext::colorWithGlobalAlpha const):
3199         Replace toSRGBALossy() with toSRGBALossy<float>().
3200
3201         * rendering/RenderTheme.cpp:
3202         (WebCore::RenderTheme::disabledTextColor const):
3203         Replace toSRGBALossy() with toSRGBALossy<float>().
3204
3205         * rendering/RenderThemeIOS.mm:
3206         (WebCore::shouldUseConvexGradient):
3207         Replace toSRGBALossy() with toSRGBALossy<float>().
3208
3209         * rendering/TextPaintStyle.cpp:
3210         (WebCore::textColorIsLegibleAgainstBackgroundColor):
3211         Replace toSRGBALossy() with toSRGBALossy<float>().
3212
3213         * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
3214         (WebCore::SVGAnimationColorFunction::animate):
3215         Replace toSRGBASimpleColorLossy() with toSRGBALossy<uint8_t>.
3216
3217 2020-07-04  Zalan Bujtas  <zalan@apple.com>
3218
3219         [LFC] Remove redundant Display::Box::HorizontalMargin c'tors
3220         https://bugs.webkit.org/show_bug.cgi?id=213957
3221
3222         Reviewed by Antti Koivisto.
3223
3224         Let's just have a very simple Display::Box:HorizontalMargin struct.
3225
3226         * layout/FormattingContext.cpp:
3227         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
3228         * layout/blockformatting/BlockFormattingContext.cpp:
3229         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin):
3230         * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
3231         (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox):
3232         * layout/displaytree/DisplayBox.h:
3233         (WebCore::Display::Box::HorizontalMargin::HorizontalMargin): Deleted.
3234         * layout/inlineformatting/InlineFormattingContext.cpp:
3235         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin):
3236
3237 2020-07-04  Zalan Bujtas  <zalan@apple.com>
3238
3239         [LFC] Do not cache computed horizontal margin values
3240         https://bugs.webkit.org/show_bug.cgi?id=213956
3241
3242         Reviewed by Antti Koivisto.
3243
3244         Outside of the width + margin computation, computed horizontal margin values are only required by
3245         float positioning. Let's just re-computed them on demand (which is basically just a style.marginStart/end resolve).
3246
3247         * layout/FormattingContext.cpp:
3248         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
3249         * layout/FormattingContextGeometry.cpp:
3250         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
3251         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
3252         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
3253         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
3254         * layout/LayoutContext.cpp:
3255         (WebCore::Layout::LayoutContext::layout):
3256         * layout/LayoutUnits.h:
3257         * layout/Verification.cpp:
3258         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
3259         * layout/blockformatting/BlockFormattingContext.cpp:
3260         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats):
3261         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin):
3262         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3263         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
3264         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
3265         * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
3266         (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox):
3267         * layout/displaytree/DisplayBox.cpp:
3268         (WebCore::Display::Box::Box):
3269         * layout/displaytree/DisplayBox.h:
3270         (WebCore::Display::Box::setHasValidVerticalNonCollapsedMargin):
3271         (WebCore::Display::Box::setHasValidHorizontalComputedMargin): Deleted.
3272         (WebCore::Display::Box::ComputedHorizontalMargin::ComputedHorizontalMargin): Deleted.
3273         (WebCore::Display::Box::setHorizontalComputedMargin): Deleted.
3274         (WebCore::Display::Box::computedMarginStart const): Deleted.
3275         (WebCore::Display::Box::computedMarginEnd const): Deleted.
3276         * layout/floats/FloatingContext.cpp:
3277         (WebCore::Layout::computedHorizontalMargin):
3278         (WebCore::Layout::FloatingContext::positionForFloat const):
3279         (WebCore::Layout::FloatingContext::positionForNonFloatingFloatAvoider const):
3280         * layout/floats/FloatingContext.h:
3281         * layout/inlineformatting/InlineFormattingContext.cpp:
3282         (WebCore::Layout::InlineFormattingContext::computeHorizontalMargin):
3283         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin):
3284         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
3285         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
3286         * layout/tableformatting/TableFormattingContext.cpp:
3287         (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows):
3288         (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
3289         (WebCore::Layout::TableFormattingContext::layoutCell):
3290
3291 2020-07-04  Darin Adler  <darin@apple.com>
3292
3293         Make generate-unified-sources.sh not depend on features being listed in FEATURE_DEFINES environment variable
3294         https://bugs.webkit.org/show_bug.cgi?id=212420
3295
3296         Reviewed by Don Olmstead.
3297
3298         * Scripts/generate-unified-sources.sh: Added code to include sources from
3299         SourcesCocoaInternalSDK.txt, only if USE_INTERNAL_SDK is YES. Removed --feature-flags
3300         argument from invocation of generate-unified-source-bundles.rb. Removed many
3301         unnecessary quotes.
3302
3303         * SourcesCocoa.txt: Removed the names of the files from the internal SDK.
3304         * SourcesCocoaInternalSDK.txt: Added. Moved those names here.
3305
3306         * html/MediaElementSession.cpp: Added some includes, apparently needed because of different
3307         groupings of unified sources.
3308
3309 2020-07-04  Zalan Bujtas  <zalan@apple.com>
3310
3311         [LFC] Used dedicated paint margin structures
3312         https://bugs.webkit.org/show_bug.cgi?id=213955
3313
3314         Reviewed by Antti Koivisto.
3315
3316         This is in preparation for having only final margin values in Display::Box.
3317
3318         * layout/FormattingContext.cpp:
3319         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
3320         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry):
3321         * layout/blockformatting/BlockFormattingContext.cpp:
3322         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin):
3323         * layout/displaytree/DisplayBox.h:
3324         (WebCore::Display::Box::VerticalMargin::before const):
3325         (WebCore::Display::Box::VerticalMargin::after const):
3326         (WebCore::Display::Box::VerticalMargin::isCollapsedThrough const):
3327         (WebCore::Display::Box::VerticalMargin::nonCollapsedValues const):
3328         (WebCore::Display::Box::VerticalMargin::collapsedValues const):
3329         (WebCore::Display::Box::VerticalMargin::hasCollapsedValues const):
3330         (WebCore::Display::Box::VerticalMargin::setCollapsedValues):
3331         (WebCore::Display::Box::VerticalMargin::VerticalMargin):
3332         (WebCore::Display::Box::VerticalMargin::NonCollapsedValues::NonCollapsedValues):
3333         (WebCore::Display::Box::VerticalMargin::CollapsedValues::CollapsedValues):
3334         (WebCore::Display::Box::ComputedHorizontalMargin::ComputedHorizontalMargin):
3335         (WebCore::Display::Box::HorizontalMargin::HorizontalMargin):
3336         (WebCore::Display::Box::setHorizontalMargin):
3337         (WebCore::Display::Box::setVerticalMargin):
3338         (WebCore::Display::Box::setHorizontalComputedMargin):
3339         (WebCore::Display::Box::verticalMargin const):
3340         (WebCore::Display::Box::horizontalMargin const):
3341         * layout/floats/FloatingState.h:
3342         (WebCore::Layout::FloatingState::FloatItem::horizontalMargin const):
3343         * layout/inlineformatting/InlineFormattingContext.cpp:
3344         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin):
3345         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin):
3346
3347 2020-07-04  Darin Adler  <darin@apple.com>
3348
3349         Update comment in FeatureDefines.xcconfig since PlatformEnableCocoa.h should be used instead
3350         https://bugs.webkit.org/show_bug.cgi?id=213952
3351
3352         Reviewed by Sam Weinig.
3353
3354         * Configurations/FeatureDefines.xcconfig: Updated comment.
3355
3356 2020-07-04  Youenn Fablet  <youenn@apple.com>
3357
3358         Enable VTB required low latency code path
3359         https://bugs.webkit.org/show_bug.cgi?id=210609
3360         <rdar://problem/61890332>
3361
3362         Reviewed by Darin Adler.
3363
3364         Add new runtime flag for the low latency code path.
3365         Call webrtc newly introduced setter whenever creating a new encoder factory.
3366         Manually tested.
3367
3368         * page/RuntimeEnabledFeatures.h:
3369         (WebCore::RuntimeEnabledFeatures::webRTCH264LowLatencyEncoderEnabled const):
3370         (WebCore::RuntimeEnabledFeatures::setWebRTCH264LowLatencyEncoderEnabled):
3371         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
3372         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
3373
3374 2020-07-03  Youenn Fablet  <youenn@apple.com>
3375
3376         MediaRecorder should support peer connection remote video tracks
3377         https://bugs.webkit.org/show_bug.cgi?id=213924
3378
3379         Reviewed by Darin Adler.
3380
3381         Previsouly we were checking whether width and height are given for a video track.
3382         This is not always available, for instance for remote tracks.
3383         And this can change over time.
3384         Instead, pass a simple boolean (whether there is a video track or not).
3385         Minor simplifications to stop storing unneeded members.
3386
3387         Tests: imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-bitrate.https.html
3388                imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-creation.https.html
3389                imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-detached-context.html
3390                imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-disabled-tracks.https.html
3391                imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-events-and-exceptions.html
3392                imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-mimetype.html
3393                imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-no-sink.https.html
3394                imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-pause-resume.html
3395                imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-peerconnection.https.html
3396                imported/w3c/web-platform-tests/mediacapture-record/passthrough/MediaRecorder-passthrough.https.html
3397
3398         * platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp:
3399         (WebCore::MediaRecorderPrivateAVFImpl::create):
3400         (WebCore::MediaRecorderPrivateAVFImpl::MediaRecorderPrivateAVFImpl):
3401         * platform/mediarecorder/MediaRecorderPrivateAVFImpl.h:
3402         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
3403         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
3404         (WebCore::MediaRecorderPrivateWriter::create):
3405
3406 2020-07-03  Darin Adler  <darin@apple.com>
3407
3408         WebCore/Sources.txt: Remove all remaining #if (ENABLE_WEBGL and ENABLE_WEBXR)
3409         https://bugs.webkit.org/show_bug.cgi?id=213946
3410
3411         Reviewed by Sam Weinig.
3412
3413         * CMakeLists.txt: Move IDL-related ENABLE_WEBGL and ENABLE_WEBXR items out of if blocks.
3414         Longer term, I think our direction should be to remove most feature conditionals from
3415         CMakeLists.txt too, just like I am doing for Sources.txt. But for now, doing just enough
3416         of this to keep the build working. Someone can tidy this later as desired.
3417
3418         * Sources.txt: Remove all remaining #if, and sort files, getting rid of paragraphing
3419         per directory to just turn this into three sorted lists of filenames (separate ones for
3420         derived sources and generated bindings at the end). The source files themselves have the
3421         appropriate conditionals and soon we will not need to support #if in Sources.txt files.
3422
3423 2020-07-03  Fujii Hironori  <Hironori.Fujii@sony.com>
3424
3425         [Win] Unreviewed stack-overflow crash fix for r263890
3426         https://bugs.webkit.org/show_bug.cgi?id=213912
3427         <rdar://problem/65069686>
3428
3429         Renamed mimeTypeForExtension to mimeTypeForExtensionFromRegistry.
3430
3431         * platform/win/MIMETypeRegistryWin.cpp:
3432         (WebCore::mimeTypeForExtensionFromRegistry):
3433         (WebCore::MIMETypeRegistry::mimeTypeForExtension):
3434         (WebCore::mimeTypeForExtension): Deleted.
3435
3436 2020-07-03  Fujii Hironori  <Hironori.Fujii@sony.com>
3437
3438         [Win] Unreviewed build fix for r263913
3439         https://bugs.webkit.org/show_bug.cgi?id=213939
3440         <rdar://problem/65084185>
3441
3442         * CMakeLists.txt: Process encrypted media IDL files even if ENABLE_ENCRYPTED_MEDIA is off.
3443
3444 2020-07-03  Darin Adler  <darin@apple.com>
3445
3446         WebCore/Sources.txt: Remove #if ENABLE_WIRELESS_PLAYBACK_TARGET
3447         https://bugs.webkit.org/show_bug.cgi?id=213945
3448
3449         Reviewed by Sam Weinig.
3450
3451         * CMakeLists.txt: Moved items from the pictureinpicture and remoteplayback module here
3452         from PlatformMac.cmake. Even if these are currently only implemented on Mac, they are
3453         not intrinsically Mac-specific, so they belong here.
3454         * PlatformMac.cmake: Ditto.
3455
3456         * Sources.txt: Remove #if ENABLE_WIRELESS_PLAYBACK_TARGET and sort files in with the others.
3457         The source files themselves have conditionals, we don't need conditionals in Sources.txt,
3458         and we are moving towards removing the capability for #if ENABLE in the Sources.txt file.
3459
3460 2020-07-03  Sam Weinig  <weinig@apple.com>
3461
3462         Remove support for ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE
3463         https://bugs.webkit.org/show_bug.cgi?id=213932
3464
3465         Reviewed by Darin Adler.
3466
3467         Removes support for non-standard <input type="datetime">, currently being 
3468         guarded by the macro ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE. This macro, was
3469         added back in 2013 as a temporary measure to support some engines who shipped
3470         support for <input type="datetime">. It is currently not enabled for any
3471         ports so now seems like as good a time as any to remove it.
3472
3473         * Configurations/FeatureDefines.xcconfig:
3474         * Sources.txt:
3475         * WebCore.xcodeproj/project.pbxproj:
3476         * css/html.css:
3477         (#endif):
3478         * html/DateTimeInputType.cpp: Removed.
3479         * html/DateTimeInputType.h: Removed.
3480         * html/InputType.cpp:
3481         (WebCore::createInputTypeFactoryMap):
3482         * page/RuntimeEnabledFeatures.h:
3483         (WebCore::RuntimeEnabledFeatures::inputTypeDateTimeEnabled const): Deleted.
3484         (WebCore::RuntimeEnabledFeatures::setInputTypeDateTimeEnabled): Deleted.
3485         * platform/DateComponents.cpp:
3486         (WebCore::DateComponents::setMillisecondsSinceEpochForDateTimeLocal):
3487         (WebCore::DateComponents::millisecondsSinceEpoch const):
3488         (WebCore::DateComponents::toString const):
3489         (WebCore::DateComponents::fromParsingDateTime): Deleted.
3490         (WebCore::DateComponents::parseDateTime): Deleted.
3491         (WebCore::DateComponents::fromMillisecondsSinceEpochForDateTime): Deleted.
3492         (WebCore::DateComponents::setMillisecondsSinceEpochForDateTime): Deleted.
3493         * platform/DateComponents.h:
3494         * platform/text/PlatformLocale.cpp:
3495         (WebCore::Locale::formatDateTime):
3496         * platform/text/ios/LocalizedDateCache.mm:
3497         (WebCore::LocalizedDateCache::createFormatterForType):
3498
3499 2020-07-03  Darin Adler  <darin@apple.com>
3500
3501         WebCore/Sources.txt: Remove #if ENABLE_USER_MESSAGE_HANDLERS
3502         https://bugs.webkit.org/show_bug.cgi?id=213944
3503
3504         Reviewed by Sam Weinig.
3505
3506         * CMakeLists.txt: Move IDL-related ENABLE_USER_MESSAGE_HANDLERS items out of if blocks.
3507         Longer term, I think our direction should be to remove most feature conditionals from
3508         CMakeLists.txt too, just like I am doing for Sources.txt. But for now, doing just enough
3509         of this to keep the build working. Someone can tidy this later as desired.
3510
3511         * Sources.txt: Remove #if ENABLE_USER_MESSAGE_HANDLERS and sort files in with the others.
3512         The source files themselves have conditionals, we don't need conditionals in Sources.txt,
3513         and we are moving towards removing the capability for #if ENABLE in the Sources.txt file.
3514
3515 2020-07-03  Darin Adler  <darin@apple.com>
3516
3517         WebCore/SourcesCocoa.txt: Remove #if ENABLE_APPLE_PAY
3518         https://bugs.webkit.org/show_bug.cgi?id=213943
3519
3520         Reviewed by Sam Weinig.
3521
3522         * SourcesCocoa.txt: Remove #if ENABLE_APPLE_PAY and sort files in with the others.
3523         The source files themselves have conditionals, we don't need conditionals in Sources.txt,
3524         and we are moving towards removing the capability for #if ENABLE in the Sources.txt file.
3525         Also, sort the files and remove the separate per-directory paragraphs, making this closer
3526         to just a sorted list of filenames with less "editorial" content. Also added comments
3527         about the USE_INTERNAL_SDK part of the file.
3528
3529 2020-07-03  Darin Adler  <darin@apple.com>
3530
3531         WebCore/Sources.txt: Remove #if ENABLE_ENCRYPTED_MEDIA
3532         https://bugs.webkit.org/show_bug.cgi?id=213939
3533
3534         Reviewed by Sam Weinig.
3535
3536         * CMakeLists.txt: Move IDL-related ENABLE_ENCRYPTED_MEDIA items out of if blocks.
3537         Longer term, I think our direction should be to remove most feature conditionals from
3538         CMakeLists.txt too, just like I am doing for Sources.txt. But for now, doing just enough
3539         of this to keep the build working. Someone can tidy this later as desired.
3540
3541         * Sources.txt: Remove #if ENABLE_LEGACY_ENCRYPTED_MEDIA and sort files in with the others.
3542         The IDL files themselves have conditionals, we don't need conditionals in Sources.txt,
3543         and we are moving towards removing the capability for #if ENABLE in the Sources.txt file.
3544
3545 2020-07-03  Darin Adler  <darin@apple.com>
3546
3547         WebCore/Sources.txt: Remove #if ENABLE_LEGACY_ENCRYPTED_MEDIA
3548         https://bugs.webkit.org/show_bug.cgi?id=213937
3549
3550         Reviewed by Sam Weinig.
3551
3552         * CMakeLists.txt: Move IDL-related ENABLE_LEGACY_ENCRYPTED_MEDIA items out of if blocks.
3553         Longer term, I think our direction should be to remove most feature conditionals from
3554         CMakeLists.txt too, just like I am doing for Sources.txt. But for now, doing just enough
3555         of this to keep the build working. Someone can tidy this later as desired.
3556
3557         * Sources.txt: Remove #if ENABLE_LEGACY_ENCRYPTED_MEDIA and sort files in with the others.
3558         The IDL files themselves have conditionals, we don't need conditionals in Sources.txt,
3559         and we are moving towards removing the capability for #if ENABLE in the Sources.txt file.
3560
3561 2020-07-03  Darin Adler  <darin@apple.com>
3562
3563         WebCore/Sources.txt: Remove #if ENABLE_QUOTA
3564         https://bugs.webkit.org/show_bug.cgi?id=213941
3565
3566         Reviewed by Sam Weinig.
3567
3568         * CMakeLists.txt: Move IDL-related ENABLE_QUOTA items out of "if (ENABLE_QUOTA)".
3569         Longer term, I think our direction should be to remove most feature conditionals from
3570         CMakeLists.txt too, just like I am doing for Sources.txt. But for now, doing just enough
3571         of this to keep the build working. Someone can tidy this later as desired.
3572
3573         * Sources.txt: Remove #if ENABLE_QUOTA and sort files in with the others.
3574         The source files themselves have conditionals, we don't need conditionals in Sources.txt,
3575         and we are moving towards removing the capability for #if ENABLE in the Sources.txt file.
3576
3577 2020-07-03  Darin Adler  <darin@apple.com>
3578
3579         WebCore/Sources.txt: Remove #if ENABLE_GAMEPAD
3580         https://bugs.webkit.org/show_bug.cgi?id=213936
3581
3582         Reviewed by Sam Weinig.
3583
3584         * CMakeLists.txt: Move IDL-related ENABLE_GAMEPAD items out of "if (ENABLE_GAMEPAD)".
3585         Longer term, I think our direction should be to remove most feature conditionals from
3586         CMakeLists.txt too, just like I am doing for Sources.txt. But for now, doing just enough
3587         of this to keep the build working. Someone can tidy this later as desired.
3588
3589         * Sources.txt: Remove #if ENABLE_GAMEPAD and sort files in with the others.
3590         The IDL files themselves have conditionals, we don't need conditionals in Sources.txt,
3591         and we are moving towards removing the capability for #if ENABLE in the Sources.txt file.
3592
3593 2020-07-03  Darin Adler  <darin@apple.com>
3594
3595         WebCore/Sources.txt: Remove #if ENABLE_MEDIA_SOURCE
3596         https://bugs.webkit.org/show_bug.cgi?id=213940
3597
3598         Reviewed by Sam Weinig.
3599
3600         * Sources.txt: Remove #if ENABLE_MEDIA_SOURCE and sort files in with the others.
3601         The IDL files themselves have conditionals, we don't need conditionals in Sources.txt,
3602         and we are moving towards removing the capability for #if ENABLE in the Sources.txt file.
3603
3604 2020-07-03  Lauro Moura  <lmoura@igalia.com>
3605
3606         [WPE] Fix build with clang after r263898
3607         https://bugs.webkit.org/show_bug.cgi?id=213942
3608
3609         Unreviewed build fix.
3610
3611         * loader/appcache/ApplicationCacheManifestParser.cpp:
3612
3613 2020-07-03  Darin Adler  <darin@apple.com>
3614
3615         WebCore/Sources.txt: Remove #if ENABLE_APPLICATION_MANIFEST
3616         https://bugs.webkit.org/show_bug.cgi?id=213935
3617
3618         Reviewed by Sam Weinig.
3619
3620         * Sources.txt: Remove #if ENABLE_APPLICATION_MANIFEST and sort files in with the others.
3621         The source files themselves have conditionals, we don't need conditionals in Sources.txt,
3622         and we are moving towards removing the capability for #if ENABLE in the Sources.txt file.
3623
3624 2020-07-03  Sam Weinig  <weinig@apple.com>
3625
3626         Add "-Wliteral-conversion" warning to Xcode based builds and fix the issues it finds
3627         https://bugs.webkit.org/show_bug.cgi?id=213931
3628
3629         Reviewed by Darin Adler.
3630
3631         * Configurations/Base.xcconfig:
3632         Add -Wliteral-conversion.
3633
3634         * platform/graphics/BitmapImage.cpp:
3635         (WebCore::BitmapImage::draw):
3636         Fix error due to passing a double when a uint8_t was expected. This probably means
3637         that the debug borders looked wrong for a little bit, but should now be back to 
3638         their transparent splendor.
3639
3640 2020-07-03  Zalan Bujtas  <zalan@apple.com>
3641
3642         [LFC][TFC][Quirk] Inflow child box quirk vertical margins should collapse with table cell.
3643         https://bugs.webkit.org/show_bug.cgi?id=213926
3644
3645         Reviewed by Antti Koivisto.
3646
3647         The BFC rootd (table cell box in this case) nornally do not collapse their margins with the first/last inflow child.
3648         However in quirks mode, cell boxes collapse their (non-existing)margins with inflow quirk margins.
3649
3650         <table><tr><td><p>text content</td></tr></table> <- <p> box's top position is at 0px in quirks mode, while at 16px (1em) in strict mode.
3651
3652         This patch ensures that we collapse the quirk margins and take them into account when computing the cell's content height.
3653
3654         Test: fast/layoutformattingcontext/table-quirk-vertical-margin-simple.html
3655
3656         * Sources.txt:
3657         * WebCore.xcodeproj/project.pbxproj:
3658         * layout/blockformatting/BlockFormattingContext.cpp:
3659         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
3660         * layout/blockformatting/BlockFormattingContext.h:
3661         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
3662         (WebCore::Layout::BlockFormattingContext::Quirks::shouldCollapseMarginBeforeWithParentMarginBefore const):
3663         (WebCore::Layout::BlockFormattingContext::Quirks::shouldCollapseMarginAfterWithParentMarginAfter const):
3664         * layout/blockformatting/BlockMarginCollapse.cpp:
3665         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore const):
3666         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginAfter const):
3667         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedVerticalValues):
3668         * layout/tableformatting/TableFormattingContext.h:
3669         (WebCore::Layout::TableFormattingContext::Quirks::Quirks):
3670         * layout/tableformatting/TableFormattingContextGeometry.cpp:
3671         (WebCore::Layout::TableFormattingContext::Geometry::cellHeigh const):
3672         * layout/tableformatting/TableFormattingContextQuirks.cpp: Added.
3673         (WebCore::Layout::TableFormattingContext::Quirks::shouldIgnoreChildContentVerticalMargin const):
3674
3675 2020-07-03  Sam Weinig  <weinig@apple.com>
3676
3677         Split color conversion functions out of ColorUtilities.h/cpp into their own file.
3678         https://bugs.webkit.org/show_bug.cgi?id=213803
3679
3680         Reviewed by Simon Fraser.
3681
3682         Moves color conversion functions (both between color spaces like toDisplayP3(const SRGBA&)
3683         and between different representations like toHSLA(const SRGBA&)) to their own files.
3684
3685         * Headers.cmake:
3686         * Sources.txt:
3687         * WebCore.xcodeproj/project.pbxproj:
3688         Add new files.
3689
3690         * css/parser/CSSPropertyParserHelpers.cpp:
3691         * editing/cocoa/DataDetection.mm:
3692         * html/canvas/CanvasRenderingContext2DBase.cpp:
3693         * html/canvas/CanvasStyle.cpp:
3694         Add include of ColorConversion.h
3695
3696         * platform/graphics/ColorConversion.cpp: Added.
3697         * platform/graphics/ColorConversion.h: Added.
3698         * platform/graphics/ColorUtilities.cpp:
3699         * platform/graphics/ColorUtilities.h:
3700         Move functions to the new files.
3701
3702         * platform/graphics/ExtendedColor.cpp:
3703         * platform/graphics/cairo/ImageBufferCairoBackend.cpp:
3704         * platform/graphics/filters/FELighting.cpp:
3705         Add include of ColorConversion.h, remove unncessary include of ColorUtilities.h
3706
3707         * platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp:
3708         * platform/graphics/filters/FEDisplacementMap.cpp:
3709         * platform/graphics/filters/FEMorphology.cpp:
3710         * platform/graphics/filters/FilterOperations.cpp:
3711         Remove unncessary include of ColorUtilities.h
3712
3713         * platform/graphics/filters/FilterOperation.cpp:
3714         Add include of ColorConversion.h and ColorTypes.h, remove unncessary include of ColorUtilities.h.
3715
3716         * platform/graphics/gtk/ColorGtk.cpp:
3717         * platform/graphics/win/ColorDirect2D.cpp:
3718         Remove unncessary include of ColorUtilities.h. Update to use standard float -> SimpleColor idiom
3719         using SRGBA<float>.
3720
3721 2020-07-03  Sam Weinig  <weinig@apple.com>
3722
3723         Convert DateComponents parsing code to use Optional based return values rather than out-parameters
3724         https://bugs.webkit.org/show_bug.cgi?id=213440
3725
3726         Reviewed by Darin Adler.
3727
3728         Rework DateComponents and Date/Time related InputTypes to use Optional based programming
3729         for parsing results. Also take the opportunity to remove unicode upconversion from 
3730         DateComponent parsing and instead separate UChar and LChar variants via templates. 
3731
3732         * html/BaseDateAndTimeInputType.cpp:
3733         * html/BaseDateAndTimeInputType.h:
3734         * html/DateInputType.cpp:
3735         * html/DateInputType.h:
3736         * html/DateTimeInputType.cpp:
3737         * html/DateTimeInputType.h:
3738         * html/DateTimeLocalInputType.cpp:
3739         * html/DateTimeLocalInputType.h:
3740         * html/HTMLInputElement.cpp:
3741         * html/HTMLInputElement.h:
3742         * html/InputType.cpp:
3743         * html/InputType.h:
3744         * html/MonthInputType.cpp:
3745         * html/MonthInputType.h:
3746         * html/TimeInputType.cpp:
3747         * html/TimeInputType.h:
3748         * html/WeekInputType.cpp:
3749         * html/WeekInputType.h:
3750             - Removes parseToDateComponentsInternal. No need it and parseToDateComponents.
3751             - Makes parseToDateComponents pure virtual. The old code had a default implementations
3752               down in InputType, but it had no callers.
3753             - Remove iOS vs. non-iOS difference for dateType(). It is now available on InputType
3754               on all platforms. 
3755             - Make setMillisecondToDateComponents and parseToDateComponents return an Optional.
3756         
3757         * platform/DateComponents.cpp:
3758         * platform/DateComponents.h:
3759             - Replace member function based interfaces for parsing/setting explicit time offsets
3760               with new factory functions that return Optional<DateComponents>.
3761             - These factories are implemented using the existing member functions, which are
3762               now private.
3763             - Make max/min constants constexpr.
3764             - Make parse* member functions templates to allow factory parse functions to
3765               call them without upconverting.
3766             - Replace header guard with #pragma once.
3767 2020-07-03  Sam Weinig  <weinig@apple.com>
3768
3769         Cleanup ApplicationCacheManifestParser.h/cpp
3770         https://bugs.webkit.org/show_bug.cgi?id=213844
3771
3772         Reviewed by Alex Christensen.
3773
3774         Address some post review comments.
3775
3776         * loader/appcache/ApplicationCacheManifestParser.cpp:
3777         (WebCore::parseApplicationCacheManifest):
3778         Fix typos: manfest -> manifest. 
3779         * loader/appcache/ApplicationCacheManifestParser.h:
3780         Stop including ApplicationCache.h, and only include / declare what's needed.
3781
3782 2020-07-03  Youenn Fablet  <youenn@apple.com>
3783
3784         Support MediaRecorder.onstart
3785         https://bugs.webkit.org/show_bug.cgi?id=213720
3786
3787         Reviewed by Darin Adler.
3788
3789         Fire start event if MediaRecorder.start is successful.
3790         Do some WebIDL clean-up, in particular change timeSlice from long to unsigned long, as per spec.
3791         Covered by added test.
3792
3793         * Modules/mediarecorder/MediaRecorder.cpp:
3794         (WebCore::MediaRecorder::startRecording):
3795         * Modules/mediarecorder/MediaRecorder.h:
3796         * Modules/mediarecorder/MediaRecorder.idl:
3797
3798 2020-07-03  Youenn Fablet  <youenn@apple.com>
3799
3800         MediaRecorder.start() Method is Ignoring the "timeslice" Parameter
3801         https://bugs.webkit.org/show_bug.cgi?id=202233
3802         <rdar://problem/55720555>
3803
3804         Reviewed by Eric Carlson.
3805
3806         Use a timer to implement timeSlice parameter.
3807         Schedule timer either when start is called or as part of requestData callback.
3808         This should ensure that, if requestData is called by the application, the timer will be rescheduled appropriately.
3809
3810         Test: http/wpt/mediarecorder/MediaRecorder-start-timeSlice.html
3811
3812         * Modules/mediarecorder/MediaRecorder.cpp:
3813         (WebCore::MediaRecorder::MediaRecorder):
3814         (WebCore::MediaRecorder::startRecording):
3815         (WebCore::MediaRecorder::requestData):
3816         * Modules/mediarecorder/MediaRecorder.h:
3817
3818 2020-07-03  Youenn Fablet  <youenn@apple.com>
3819
3820         MediaRecorder stopRecorder() returns empty Blob after first use
3821         https://bugs.webkit.org/show_bug.cgi?id=212274
3822         <rdar://problem/63601298>
3823
3824         Reviewed by Eric Carlson.
3825
3826         Refactor code to create/destroy MediaRecorderPrivate on MediaRecorder start/stop.
3827         This allows reusing a MediaRecorder after a stop and restarting with a clean state.
3828
3829         We introduce MediaRecorderPrivate::startRecording to do the initialization,
3830         which allows to fix a potential ref cycle as part of the error callback handling.
3831
3832         Make some improvements to the platform implementation, in particular add default initialization to all fields.
3833         Align the code using AudioConverterRef to what is done in AudioSampleDataSource.
3834         Also call VTCompressionSessionInvalidate when destroying the VideoSampleBufferCompressor.
3835
3836         Test: http/wpt/mediarecorder/MediaRecorder-multiple-start-stop.html
3837
3838         * Modules/mediarecorder/MediaRecorder.cpp:
3839         (WebCore::MediaRecorder::create):
3840         (WebCore::MediaRecorder::MediaRecorder):
3841         (WebCore::MediaRecorder::startRecording):
3842         (WebCore::MediaRecorder::stopRecording):
3843         (WebCore::MediaRecorder::requestData):
3844         * Modules/mediarecorder/MediaRecorder.h:
3845         * platform/mediarecorder/MediaRecorderPrivateMock.cpp:
3846         (WebCore::MediaRecorderPrivateMock::fetchData):
3847         * platform/mediarecorder/MediaRecorderPrivate.h:
3848         (WebCore::MediaRecorderPrivate::startRecording):
3849         * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.h:
3850         * platform/mediarecorder/cocoa/AudioSampleBufferCompressor.mm:
3851         (WebCore::AudioSampleBufferCompressor::~AudioSampleBufferCompressor):
3852         (WebCore::AudioSampleBufferCompressor::initAudioConverterForSourceFormatDescription):
3853         (WebCore::AudioSampleBufferCompressor::attachPrimingTrimsIfNeeded):
3854         (WebCore::AudioSampleBufferCompressor::gradualDecoderRefreshCount):
3855         (WebCore::AudioSampleBufferCompressor::sampleBufferWithNumPackets):
3856         (WebCore::AudioSampleBufferCompressor::processSampleBuffersUntilLowWaterTime):
3857         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
3858         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
3859         (WebCore::MediaRecorderPrivateWriter::stopRecording):
3860         * platform/mediarecorder/cocoa/VideoSampleBufferCompressor.mm:
3861         (WebCore::VideoSampleBufferCompressor::~VideoSampleBufferCompressor):
3862
3863 2020-07-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
3864
3865         Change the names of MIMETypeRegistry methods to comply with webkit naming style
3866         https://bugs.webkit.org/show_bug.cgi?id=213912
3867
3868         Reviewed by Youenn Fablet.
3869
3870         Remove the verb 'get' from the name of some of the methods of MIMETypeRegistry.
3871
3872         * editing/cocoa/WebArchiveResourceFromNSAttributedString.mm:
3873         (WebCore::if):
3874         * fileapi/File.cpp:
3875         (WebCore::File::computeNameAndContentType):
3876         * html/HTMLPlugInElement.cpp:
3877         (WebCore::pluginReplacementForType):
3878         * loader/mac/LoaderNSURLExtras.mm:
3879         (suggestedFilenameWithMIMEType):
3880         * platform/MIMETypeRegistry.cpp:
3881         (WebCore::commonMimeTypesMap):
3882         (WebCore::MIMETypeRegistry::mediaMIMETypeForExtension):
3883         (WebCore::MIMETypeRegistry::mimeTypeForPath):
3884         (WebCore::MIMETypeRegistry::isSupportedImageMIMEType):
3885         (WebCore::MIMETypeRegistry::normalizedMIMEType):
3886         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
3887         (WebCore::MIMETypeRegistry::getMediaMIMETypeForExtension): Deleted.
3888         (WebCore::MIMETypeRegistry::getMediaMIMETypesForExtension): Deleted.
3889         Delete this function since it is not used.
3890
3891         (WebCore::MIMETypeRegistry::getMIMETypeForPath): Deleted.
3892         (WebCore::MIMETypeRegistry::getNormalizedMIMEType): Deleted.
3893         * platform/MIMETypeRegistry.h:
3894         * platform/cocoa/MIMETypeRegistryCocoa.mm:
3895         (WebCore::MIMETypeRegistry::mimeTypeForExtension):
3896         (WebCore::MIMETypeRegistry::extensionsForMIMEType):
3897         (WebCore::MIMETypeRegistry::preferredExtensionForMIMEType):
3898         (WebCore::MIMETypeRegistry::getMIMETypeForExtension): Deleted.
3899         (WebCore::MIMETypeRegistry::getExtensionsForMIMEType): Deleted.
3900         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): Deleted.
3901         * platform/graphics/MediaPlayer.cpp:
3902         (WebCore::MediaPlayer::load):
3903         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
3904         (WebCore::ImageDecoderAVFObjC::filenameExtension const):
3905         * platform/graphics/gstreamer/ImageDecoderGStreamer.h:
3906         * platform/network/curl/CurlRequest.cpp:
3907         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
3908         * platform/playstation/MIMETypeRegistryPlayStation.cpp:
3909         (WebCore::MIMETypeRegistry::mimeTypeForExtension):
3910         (WebCore::MIMETypeRegistry::preferredExtensionForMIMEType):
3911         (WebCore::MIMETypeRegistry::extensionsForMIMEType):
3912         (WebCore::MIMETypeRegistry::getMIMETypeForExtension): Deleted.
3913         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): Deleted.
3914         (WebCore::MIMETypeRegistry::getExtensionsForMIMEType): Deleted.
3915         * platform/win/MIMETypeRegistryWin.cpp:
3916         (WebCore::MIMETypeRegistry::preferredExtensionForMIMEType):
3917         (WebCore::MIMETypeRegistry::mimeTypeForExtension):
3918         (WebCore::MIMETypeRegistry::extensionsForMIMEType):
3919         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): Deleted.
3920         (WebCore::MIMETypeRegistry::getMIMETypeForExtension): Deleted.
3921         (WebCore::MIMETypeRegistry::getExtensionsForMIMEType): Deleted.
3922         * platform/xdg/MIMETypeRegistryXdg.cpp:
3923         (WebCore::MIMETypeRegistry::mimeTypeForExtension):
3924         (WebCore::MIMETypeRegistry::preferredExtensionForMIMEType):
3925         (WebCore::MIMETypeRegistry::extensionsForMIMEType):
3926         (WebCore::MIMETypeRegistry::getMIMETypeForExtension): Deleted.
3927         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): Deleted.
3928         (WebCore::MIMETypeRegistry::getExtensionsForMIMEType): Deleted.
3929
3930 2020-07-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3931
3932         [GTK4] Enable threaded rendering by default
3933         https://bugs.webkit.org/show_bug.cgi?id=213883
3934
3935         Reviewed by Adrian Perez de Castro.
3936
3937         When building with GTK4 we no longer use the cairo context to render directly, so we can always enable the
3938         threaded rendering. In WPE port threaded rendering is only enabled when env var WEBKIT_NICOSIA_PAINTING_THREADS
3939         is present. This patch changes a bit the meaning of the env var, so that when 0 is passed the feature is
3940         disabled too, instead of setting the number of threads to 4.
3941
3942         * platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
3943         (Nicosia::PaintingEngine::create):
3944
3945 2020-07-02  Mark Lam  <mark.lam@apple.com>
3946
3947         ReadableStream::create() should handle any exceptions that may be thrown during construction.
3948         https://bugs.webkit.org/show_bug.cgi?id=213819
3949
3950         Reviewed by Youenn Fablet and Yusuke Suzuki.
3951
3952         Win EWS detected that ReadableStream::create() can throw exceptions, and we were
3953         failing to handle it.  This patch fixes that.
3954
3955         * Modules/cache/DOMCache.cpp:
3956         (WebCore::DOMCache::put):
3957         * Modules/fetch/FetchBodyOwner.cpp:
3958         (WebCore::FetchBodyOwner::readableStream):
3959         (WebCore::FetchBodyOwner::createReadableStream):
3960         * Modules/fetch/FetchBodyOwner.h:
3961         * Modules/fetch/FetchResponse.cpp:
3962         (WebCore::FetchResponse::clone):
3963         * bindings/js/ReadableStream.cpp:
3964         (WebCore::ReadableStream::create):
3965         * bindings/js/ReadableStream.h:
3966
3967 2020-07-02  Alex Christensen  <achristensen@webkit.org>
3968
3969         Update Mac CMake build
3970
3971         * PlatformMac.cmake:
3972
3973 2020-07-02  Said Abou-Hallawa  <sabouhallawa@apple.com>
3974
3975         MIMETypeRegistry::getExtensionsForMIMEType() needs to handle wildcard MIME types
3976         https://bugs.webkit.org/show_bug.cgi?id=213826
3977
3978         Reviewed by Darin Adler.
3979
3980         Addressing post commit review comments for r263832.
3981
3982         * platform/cocoa/MIMETypeRegistryCocoa.mm:
3983         (WebCore::extensionsForMIMETypeMap):
3984
3985 2020-07-02  Brady Eidson  <beidson@apple.com>
3986
3987         GameController.framework soft linking refactoring
3988         https://bugs.webkit.org/show_bug.cgi?id=213909
3989
3990         Reviewed by Tim Horton.
3991
3992         No new tests (No behavior changes)
3993
3994         * WebCore.xcodeproj/project.pbxproj:
3995         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
3996         (WebCore::GameControllerGamepadProvider::startMonitoringGamepads):
3997         * platform/gamepad/cocoa/GameControllerSPI.h: Added.
3998         * platform/gamepad/cocoa/GameControllerSoftLink.h: Added.
3999         * platform/gamepad/cocoa/GameControllerSoftLink.mm: Added.
4000
4001 2020-07-02  Simon Fraser  <simon.fraser@apple.com>
4002
4003         REGRESSION(r260276): menu items in footer of https://salo.ai are invisible until you hover or resize
4004         https://bugs.webkit.org/show_bug.cgi?id=213712
4005         <rdar://problem/64893190>
4006
4007         Reviewed by Zalan Bujtas.
4008
4009         A negative z-index child triggers a foreground layer inside overflow scroll. This foreground layer
4010         gets the PaintingOverflowContents flag but not the PaintingCompositingScrollingPhase flag, but we still need
4011         to avoid the clip check that happens in RenderBlock::paint(), so change RenderLayer::paintLayerContents()
4012         to just check for isPaintingOverflowContents.
4013
4014         Test: compositing/scrolling/async-overflow-scrolling/foreground-layer-paint-phase.html
4015
4016         * rendering/RenderLayer.cpp:
4017         (WebCore::RenderLayer::paintLayerContents):
4018
4019 2020-07-02  Antoine Quint  <graouts@webkit.org>
4020
4021         visualViewport.addEventListener("scroll"*** fires permanently after zoom or orientation change
4022         https://bugs.webkit.org/show_bug.cgi?id=211522
4023         <rdar://problem/62939371>
4024
4025         Reviewed by Simon Fraser.
4026
4027         Correctly set the flag indicating that a scroll event has been dispatched on the visual viewport.
4028
4029         Test: fast/visual-viewport/scroll-event-fired-during-scroll-alone.html
4030
4031         * dom/Document.cpp:
4032         (WebCore::Document::runScrollSteps):
4033
4034 2020-07-02  Zalan Bujtas  <zalan@apple.com>
4035
4036         Overlapping content on earny.co
4037         https://bugs.webkit.org/show_bug.cgi?id=213864
4038         <rdar://problem/61011802>
4039
4040         Reviewed by Simon Fraser.
4041
4042         Do not use a 1px value for initial min/max content width.
4043
4044         * rendering/AutoTableLayout.cpp:
4045         (WebCore::AutoTableLayout::recalcColumn):
4046         (WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
4047         (WebCore::AutoTableLayout::layout): I found 2 places where we rely on the initial 1px value for min/max width. This might cause some "regression".
4048
4049 2020-07-02  Ryan Haddad  <ryanhaddad@apple.com>
4050
4051         Unreviewed, reverting r263633, r263651, and r263671.
4052
4053         Still seeing MediaRecorder test crashes after re-landing
4054         r263633
4055
4056         Reverted changesets:
4057
4058         "MediaRecorder stopRecorder() returns empty Blob after first
4059         use"
4060         https://bugs.webkit.org/show_bug.cgi?id=212274
4061         https://trac.webkit.org/changeset/263633
4062
4063         "MediaRecorder.start() Method is Ignoring the "timeslice"
4064         Parameter"
4065         https://bugs.webkit.org/show_bug.cgi?id=202233
4066         https://trac.webkit.org/changeset/263651
4067
4068         "Support MediaRecorder.onstart"
4069         https://bugs.webkit.org/show_bug.cgi?id=213720
4070         https://trac.webkit.org/changeset/263671
4071
4072 2020-07-02  Antti Koivisto  <antti@apple.com>
4073
4074         REGRESSION: Comments section at dpreview has overlapping names with comment on phone
4075         https://bugs.webkit.org/show_bug.cgi?id=213890
4076         <rdar://problem/64693599>
4077
4078         Reviewed by Simon Fraser.
4079
4080         Test: fast/text-autosizing/ios/float-miscomputed-line-height.html
4081
4082         * rendering/TextAutoSizing.cpp:
4083         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
4084
4085         Negative value is used to indicate unset line-height. We shouldn't make adjustments in this case.
4086         This matches Style::BuilderCustom code.
4087
4088 2020-07-02  Zalan Bujtas  <zalan@apple.com>
4089
4090         [LFC][BFC] Remove redundant margin-border-padding when computing the intrinsic width
4091         https://bugs.webkit.org/show_bug.cgi?id=213882
4092
4093         Reviewed by Antti Koivisto.
4094
4095         The child intrinsic width already includes the margin-border-padding values.
4096
4097         Test: fast/layoutformattingcontext/table-with-margin-content-simple.html
4098
4099         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
4100         (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
4101
4102 2020-07-02  Zalan Bujtas  <zalan@apple.com>
4103
4104         [LFC][IFC] Use <tr> computed height as minimum height for the row
4105         https://bugs.webkit.org/show_bug.cgi?id=213880
4106
4107         Reviewed by Antti Koivisto.
4108
4109         Test: fast/layoutformattingcontext/table-fixed-row-height-simple.html
4110
4111         * layout/tableformatting/TableLayout.cpp:
4112         (WebCore::Layout::TableFormattingContext::TableLayout::distributedVerticalSpace):
4113
4114 2020-07-02  Youenn Fablet  <youenn@apple.com>
4115
4116         getUserMedia returns OverConstrained on Jitsi
4117         https://bugs.webkit.org/show_bug.cgi?id=210932
4118         <rdar://problem/64403675>
4119
4120         Reviewed by Philippe Normand.
4121
4122         We compute the max width, max height and max frame rate across all presets.
4123         In case a preset for the max resolution is different from the preset for the max frame rate,
4124         we were selecting capture parameters that no preset can match.
4125
4126         To fix the issue, in case the frame rate constraint is not mandatory, and we do not find a preset
4127         when starting to capture, we remove the frame rate constraint, pick the preset and choose the max frame rate from that preset.
4128
4129         Update mock sources to have a high resolution preset with low frame rate to enable writing a test.
4130
4131         Test: fast/mediastream/get-user-media-ideal-constraints.html
4132
4133         * platform/mediastream/RealtimeMediaSource.cpp:
4134         (WebCore::RealtimeMediaSource::supportsSizeAndFrameRate):
4135         * platform/mediastream/RealtimeVideoCaptureSource.cpp:
4136         (WebCore::RealtimeVideoCaptureSource::bestSupportedSizeAndFrameRate):
4137         (WebCore::RealtimeVideoCaptureSource::setSizeAndFrameRate):
4138         * platform/mediastream/VideoPreset.h:
4139         (WebCore::VideoPreset::maxFrameRate const):
4140         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
4141         (WebCore::defaultDevices):
4142
4143 2020-07-02  Carlos Garcia Campos  <cgarcia@igalia.com>
4144
4145         Unreviewed. Fix GTK4 build
4146
4147         * platform/gtk/GtkVersioning.h:
4148         (gtk_scrolled_window_new):
4149
4150 2020-07-02  Rob Buis  <rbuis@igalia.com>
4151
4152         Fragment navigation involving fragment identifiers does not match specification
4153         https://bugs.webkit.org/show_bug.cgi?id=83930
4154
4155         Reviewed by Darin Adler.
4156
4157         Implement step 5 and 6 of [1] to allow fragment identifier lookup
4158         using percent-decoding, after normal lookup failed.
4159
4160         Behavior matches Chrome and Firefox.
4161
4162         [1] https://html.spec.whatwg.org/multipage/browsing-the-web.html#the-indicated-part-of-the-document
4163
4164         Tests: imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-anchor-name.html
4165                imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding-2.html
4166                imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding.html
4167                imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-non-utf8-encoded-document.html
4168
4169         * page/FrameView.cpp:
4170         (WebCore::FrameView::scrollToFragmentInternal):
4171
4172 2020-07-02  Alexander Mikhaylenko  <alexm@gnome.org>
4173
4174         [GTK] Kinetic scrolling is still triggered if you wait before lifting fingers
4175         https://bugs.webkit.org/show_bug.cgi?id=213789
4176
4177         Reviewed by Carlos Garcia Campos.
4178
4179         The intended behavior for kinetic scrolling is that it's possible to not trigger it by
4180         stopping moving fingers before lifting them, as opposed to doing a fling/swipe. However,
4181         right now it's broken and trying to do this triggers kinetic scrolling as well.
4182
4183         Currently, the last scroll event with (0, 0) deltas isn't added to the scroll history for
4184         kinetic scrolling. However, this is wrong, because the last event, or rather the timespan
4185         between it and the previous scroll event, actually determines the kinetic scrolling velocity:
4186         if this event follows the previous one quickly, the velocity is large, but if there was a long
4187         pause, the velocity would be close to 0.
4188
4189         See https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1902 and
4190         https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1903 for the equivalent GTK fixes.
4191
4192         * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp:
4193         (WebCore::ScrollingTreeFrameScrollingNodeNicosia::handleWheelEvent):
4194         * page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp:
4195         (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::handleWheelEvent):
4196         * platform/generic/ScrollAnimatorGeneric.cpp:
4197         (WebCore::ScrollAnimatorGeneric::handleWheelEvent):
4198
4199 2020-07-02  Philippe Normand  <pnormand@igalia.com>
4200
4201         [GStreamer] Rewrite mediastreamsrc element
4202         https://bugs.webkit.org/show_bug.cgi?id=213777
4203
4204         Reviewed by Xabier Rodriguez-Calvar.
4205
4206         The underlying functionality remains the same, design-wise. This is mostly a refactoring
4207         switching to smart pointers as much as possible and trying to comply with WebKit code style
4208         guidelines.
4209
4210         The previous version of this element was leaking pad templates and sticky stream-start
4211         events (in webkitMediaStreamSrcTrackEnded).
4212
4213         The LIBWEBRTC ifdef guards were removed as well, because there's no actual libwebrtc
4214         dependency involved in this code.
4215
4216         No new tests, existing webrtc and fast/mediastream tests cover this patch.
4217
4218         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
4219         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
4220         (mediaStreamTrackPrivateGetTags):
4221         (webkitMediaStreamNew):
4222         (WebKitMediaStreamTrackObserver::WebKitMediaStreamTrackObserver):
4223         (WebKitMediaStreamObserver::WebKitMediaStreamObserver):
4224         (InternalSource::InternalSource):
4225         (InternalSource::~InternalSource):
4226         (InternalSource::src const):
4227         (InternalSource::pushSample):
4228         (webkitMediaStreamSrcUriGetType):
4229         (webkitMediaStreamSrcUriGetProtocols):
4230         (webkitMediaStreamSrcUriGetUri):
4231         (webkitMediaStreamSrcUriSetUri):
4232         (webkitMediaStreamSrcUriHandlerInit):
4233         (webkitMediaStreamSrcSetProperty):
4234         (webkitMediaStreamSrcGetProperty):
4235         (webkitMediaStreamSrcConstructed):
4236         (stopObservingTracks):
4237         (webkitMediaStreamSrcFinalize):
4238         (webkitMediaStreamSrcChangeState):
4239         (webkit_media_stream_src_class_init):
4240         (webkitMediaStreamSrcChain):
4241         (webkitMediaStreamSrcAddPad):
4242         (ProbeData::ProbeData):
4243         (webkitMediaStreamSrcPadProbeCb):
4244         (webkitMediaStreamSrcSetupSrc):
4245         (webkitMediaStreamSrcPostStreamCollection):
4246         (webkitMediaStreamSrcAddTrack):
4247         (webkitMediaStreamSrcRemoveTrackByType):
4248         (webkitMediaStreamSrcSetStream):
4249         (webkitMediaStreamSrcPushVideoSample):
4250         (webkitMediaStreamSrcPushAudioSample):
4251         (webkitMediaStreamSrcTrackEnded):
4252         (webkitMediaStreamSrcNew):
4253         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.h:
4254
4255 2020-07-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
4256
4257         MIMETypeRegistry::getExtensionsForMIMEType() needs to handle wildcard MIME types
4258         https://bugs.webkit.org/show_bug.cgi?id=213826
4259
4260         Reviewed by Darin Adler.
4261
4262         Working towards webkit.org/b/213347, it needs to be possible for WebCore
4263         to get the file extensions for wildcard MIME types, e.g. "image/*" or "video/*".
4264
4265         For Cocoa platforms, we will enumerate the UTIs of the system. Get the
4266         MIMEType and the extensions of each UTI. Add the following pairs to a
4267         singleton HashMap:
4268
4269             { MIMEType, extension }
4270             { Type(MIMEType)/*, extension }
4271
4272         Change MIMETypeRegistry::getExtensionsForMIMEType() such that it calls
4273         extensionsForWildcardMIMEType() if the MIMEType ends with "*".
4274
4275         * platform/MIMETypeRegistry.h:
4276         * platform/cocoa/MIMETypeRegistryCocoa.mm:
4277         (WebCore::extensionsForMIMETypeMap):
4278         (WebCore::extensionsForWildcardMIMEType):
4279         (WebCore::MIMETypeRegistry::getExtensionsForMIMEType):
4280         * platform/playstation/MIMETypeRegistryPlayStation.cpp:
4281         (WebCore::MIMETypeRegistry::getExtensionsForMIMEType):
4282         * platform/win/MIMETypeRegistryWin.cpp:
4283         (WebCore::MIMETypeRegistry::getExtensionsForMIMEType):
4284         * platform/xdg/MIMETypeRegistryXdg.cpp:
4285         (WebCore::MIMETypeRegistry::getExtensionsForMIMEType):
4286
4287 2020-07-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
4288
4289         Allow the File object to be created with a replacement file
4290         https://bugs.webkit.org/show_bug.cgi?id=213825
4291
4292         Reviewed by Darin Adler.
4293
4294         Working towards webkit.org/b/213347, it needs to be possible to create 
4295         the File object with an optional replacement file. Only the registered
4296         BlobDataFileReference will be created with both the original file path
4297         and the replacement file path. So it can delete the replacement file when
4298         it is destroyed. Otherwise BlobDataFileReference will be created with the
4299         replacement file path.
4300
4301         It is important to create the File object with the replacement file because
4302         it needs to get the meta-data and the bytes of the replacement file not
4303         the original file.
4304
4305         * fileapi/File.cpp:
4306         (WebCore::File::create):
4307         * fileapi/File.h:
4308         * fileapi/ThreadableBlobRegistry.cpp:
4309         (WebCore::ThreadableBlobRegistry::registerFileBlobURL):
4310         * fileapi/ThreadableBlobRegistry.h:
4311         * html/DirectoryFileListCreator.cpp:
4312         (WebCore::createFileList):
4313         * html/FileInputType.cpp:
4314         (WebCore::FileInputType::filesFromFormControlState):
4315         When the Files are created from a FormControlState, they will be created
4316         without replacement files since they might have been deleted.
4317
4318         (WebCore::FileInputType::filesChosen):
4319         (WebCore::FileInputType::receiveDroppedFiles):
4320         * platform/FileChooser.cpp:
4321         (WebCore::FileChooser::chooseFiles):
4322         (WebCore::FileChooser::chooseMediaFiles):
4323         * platform/FileChooser.h:
4324         (WebCore::FileChooserFileInfo::isolatedCopy const):
4325         (WebCore::FileChooser::chooseFiles):
4326         (WebCore::FileChooserFileInfo::FileChooserFileInfo): Deleted.
4327         * platform/network/BlobDataFileReference.cpp:
4328         (WebCore::BlobDataFileReference::BlobDataFileReference):
4329         (WebCore::BlobDataFileReference::~BlobDataFileReference):
4330         (WebCore::BlobDataFileReference::path):
4331         (WebCore::BlobDataFileReference::startTrackingModifications):
4332         * platform/network/BlobDataFileReference.h:
4333         * platform/network/BlobRegistry.h:
4334
4335 2020-07-01  Don Olmstead  <don.olmstead@sony.com>
4336
4337         [CMake] Add WOFF2 targets
4338         https://bugs.webkit.org/show_bug.cgi?id=213865
4339
4340         Reviewed by Fujii Hironori.
4341
4342         Use the WOFF:: targets when USE_WOFF2 is set.
4343
4344         * CMakeLists.txt:
4345
4346 2020-07-01  Chris Fleizach  <cfleizach@apple.com>
4347
4348         AX: Implement relevant simulated key presses for custom ARIA widgets for increment/decrement
4349         https://bugs.webkit.org/show_bug.cgi?id=213744
4350
4351         Reviewed by Darin Adler.
4352
4353         In order to allow custom ARIA widgets to work, we can post keyboard events for specific ax actions
4354         that are not handled natively.
4355
4356         Spec: https://github.com/WICG/aom/blob/gh-pages/explainer.md#user-action-events-from-assistive-technology
4357
4358         Test: accessibility/keyevents-posted-for-increment-actions.html
4359               accessibility/keyevents-for-increment-actions-with-node-removal.html
4360
4361         * accessibility/AccessibilityNodeObject.cpp:
4362         (WebCore::AccessibilityNodeObject::postKeyboardKeysForValueChange):
4363         (WebCore::AccessibilityNodeObject::setNodeValue):
4364         (WebCore::AccessibilityNodeObject::changeValueByStep):
4365         (WebCore::AccessibilityNodeObject::changeValueByPercent):
4366         * accessibility/AccessibilityNodeObject.h:
4367         * accessibility/AccessibilityObject.h:
4368         * accessibility/AccessibilityObjectInterface.h:
4369         * accessibility/AccessibilityRenderObject.cpp:
4370         (WebCore::AccessibilityRenderObject::setValue):
4371         * accessibility/AccessibilityRenderObject.h:
4372         * accessibility/AccessibilityScrollbar.cpp:
4373         (WebCore::AccessibilityScrollbar::setValue):
4374         * accessibility/AccessibilityScrollbar.h:
4375         * accessibility/AccessibilitySlider.cpp:
4376         (WebCore::AccessibilitySlider::setValue):
4377         * accessibility/AccessibilitySlider.h:
4378         * accessibility/isolatedtree/AXIsolatedObject.cpp:
4379         (WebCore::AXIsolatedObject::setValue):
4380         * accessibility/isolatedtree/AXIsolatedObject.h:
4381
4382 2020-07-01  Wenson Hsieh  <wenson_hsieh@apple.com>
4383
4384         Fix the WebKit build after <rdar://problem/64288191>
4385         https://bugs.webkit.org/show_bug.cgi?id=213832
4386
4387         Reviewed by Tim Horton.
4388
4389         Upcoming changes to <UIKit/UIWebDocumentView.h> will cause the WebKit build to break, due to conflicting
4390         declarations of WKObject in both WebCore (WAK) code and the WebKit API. Avoid this by renaming the WAK version
4391         to WAKObject, rather than WKObject.
4392
4393         Additionally, fix some minor style issues along the way.
4394
4395         * platform/ios/wak/WKTypes.h:
4396         * platform/ios/wak/WKUtilities.c:
4397         (WKRetain):
4398         (WKRelease):
4399         (_WAKObjectDealloc):
4400         (WKGetClassInfo):
4401         (_WKObjectDealloc): Deleted.
4402         * platform/ios/wak/WKUtilities.h:
4403         * platform/ios/wak/WKView.h:
4404         * platform/ios/wak/WKView.mm:
4405         (_WKViewDealloc):
4406
4407 2020-07-01  Zalan Bujtas  <zalan@apple.com>
4408
4409         [LFC][TFC] Add support for non-baseline aligned cell height
4410         https://bugs.webkit.org/show_bug.cgi?id=213845
4411
4412         Reviewed by Antti Koivisto.
4413
4414         Adjust max ascent/descent only when the cell is basline aligned.
4415
4416         Test: fast/layoutformattingcontext/table-cell-height-middle-align-simple.html
4417
4418         * layout/tableformatting/TableLayout.cpp:
4419         (WebCore::Layout::TableFormattingContext::TableLayout::distributedVerticalSpace):
4420
4421 2020-07-01  Antoine Quint  <graouts@webkit.org>
4422
4423         [Media Controls] Tracks panel can show text tracks with mode "hidden" as selected
4424         https://bugs.webkit.org/show_bug.cgi?id=213839
4425         <rdar://problem/57989325>
4426
4427         Reviewed by Jer Noble.
4428
4429         We only considered text tracks that had their "mode" set to "disabled" as tracks that weren't selected,
4430         but there is also the "hidden" mode which should share the same UI state. We now check for "mode" to
4431         be set to "showing" to consider a text track as selected in the tracks panel.
4432
4433         Test: media/modern-media-controls/tracks-support/tracks-support-hidden-tracks.html
4434
4435         * Modules/modern-media-controls/media/tracks-support.js:
4436         (TracksSupport.prototype.tracksPanelIsTrackInSectionSelected):
4437
4438 2020-07-01  Sam Weinig  <weinig@apple.com>
4439
4440         Regression (r263788): Windows build broken: nameForRenderTreeAsText is not a member of WebCore::Color
4441         https://bugs.webkit.org/show_bug.cgi?id=213841
4442         <rdar://problem/64985276>
4443
4444         Fix Windows build.
4445
4446         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
4447         (printColor):
4448
4449 2020-07-01  Youenn Fablet  <youenn@apple.com>
4450
4451         Make NetworkSendQueue use CString instead of String for UTF-8 data
4452         https://bugs.webkit.org/show_bug.cgi?id=213714
4453
4454         Reviewed by Darin Adler.
4455
4456         Use CString instead of String in NetworkSendQueue as all data is to be encoded as UTF-8.
4457         This allows converting and allocating the UTF-8 string only once.
4458         Covered by existing tests.
4459
4460         * Modules/mediastream/RTCDataChannel.cpp:
4461         (WebCore::RTCDataChannel::createMessageQueue):
4462         (WebCore::RTCDataChannel::send):
4463         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
4464         (WebCore::LibWebRTCDataChannelHandler::sendStringData):
4465         (WebCore::LibWebRTCDataChannelHandler::sendRawData):
4466         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
4467         * fileapi/NetworkSendQueue.cpp:
4468         (WebCore::NetworkSendQueue::enqueue):
4469         (WebCore::NetworkSendQueue::processMessages):
4470         * fileapi/NetworkSendQueue.h:
4471         * platform/mediastream/RTCDataChannelHandler.h:
4472         * platform/mock/RTCDataChannelHandlerMock.cpp:
4473         (WebCore::RTCDataChannelHandlerMock::sendStringData):
4474         * platform/mock/RTCDataChannelHandlerMock.h:
4475
4476 2020-07-01  Alexey Shvayka  <shvaikalesh@gmail.com>
4477
4478         Use more efficient makeString() instead of StringBuilder
4479         https://bugs.webkit.org/show_bug.cgi?id=213708
4480
4481         Reviewed by Sam Weinig.
4482
4483         This patch refactors throwRequiredMemberTypeError() and throwArgument*Error()
4484         methods, replacing all StringBuilder usages with more efficient makeString().
4485
4486         Extracts makeArgumentTypeErrorMessage(), similiar to existing helpers,
4487         which can be reused if neccessary.
4488
4489         No new tests, no behavior change.
4490
4491         * bindings/js/JSDOMExceptionHandling.cpp:
4492         (WebCore::makeArgumentTypeErrorMessage):
4493         (WebCore::throwArgumentMustBeEnumError):
4494         (WebCore::throwArgumentMustBeFunctionError):
4495         (WebCore::throwArgumentMustBeObjectError):
4496         (WebCore::throwArgumentTypeError):
4497         (WebCore::throwRequiredMemberTypeError):
4498         (WebCore::appendArgumentMustBe): Deleted.
4499
4500 2020-06-29  Sergio Villar Senin  <svillar@igalia.com>
4501
4502         [css-flexbox] Don't include scrollbar extents when computing sizes for percentage resolution
4503         https://bugs.webkit.org/show_bug.cgi?id=213739
4504
4505         Reviewed by Javier Fernandez.
4506
4507         Content override sizes do include scrollbars so they must be substracted when using the override size
4508         to compute percentages.
4509
4510         * rendering/RenderFlexibleBox.cpp:
4511         (WebCore::RenderFlexibleBox::crossSizeForPercentageResolution): Remove scrollbars.
4512         (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution): Ditto.
4513
4514 2020-06-30  Sergio Villar Senin  <svillar@igalia.com>
4515
4516         [css-flex] Remove death code paths when evaluating percentage resolution
4517         https://bugs.webkit.org/show_bug.cgi?id=213809
4518
4519         Reviewed by Manuel Rego Casasnovas.
4520
4521         Both crossSizeForPercentageResolution() and mainSizeForPercentageResolution() are only called from
4522         childLogicalHeightForPercentageResolution(). The former is called whenever hasOrthogonalFlow(child)
4523         is false and the latter when it's true. However crossSizeForPercentageResolution() has a path for
4524         hasOrthogonalFlow(child)==true which is impossible to reach. The same happens to
4525         mainSizeForPercentageResolution() which has a path for hasOrthogonalFlow(child)==false which is
4526         also impossible to reach.
4527
4528         Remove both death code paths and replace them by assertions. We're also making both methods
4529         private since are not meant to be used from the outside.
4530
4531         * rendering/RenderFlexibleBox.cpp:
4532         (WebCore::RenderFlexibleBox::crossSizeForPercentageResolution): Remove death code path.
4533         (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution): Ditto.
4534         * rendering/RenderFlexibleBox.h: Make both calls private.
4535
4536 2020-06-30  Sam Weinig  <weinig@apple.com>
4537
4538         Split Color serialization out of Color classes
4539         https://bugs.webkit.org/show_bug.cgi?id=213820
4540
4541         Reviewed by Darin Adler.
4542
4543         Move all color serialization related functions out of the Color family
4544         of classes, and into a standalone ColorSerialization.h
4545         
4546         Now all color serialization calls one of the following three functions, depending on need:
4547
4548             - serializationForCSS(...)
4549             - serializationForHTML(...)
4550             - serializationForRenderTreeAsText(...)
4551
4552         These are overload for all three Color classes (Color, SimpleColor and ExtendedColor) to
4553         allow easy use without necessarily needing to construct another type.
4554
4555         * Headers.cmake:
4556         * Sources.txt:
4557         * WebCore.xcodeproj/project.pbxproj:
4558         Add new files.
4559     
4560         * css/CSSPrimitiveValue.cpp:
4561         (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):
4562         * editing/EditingStyle.cpp:
4563         (WebCore::EditingStyle::inverseTransformColorIfNeeded):
4564         (WebCore::StyleChange::extractTextStyles):
4565         * editing/cocoa/DataDetection.mm:
4566         (WebCore::DataDetection::detectContentInRange):
4567         * html/ColorInputType.cpp:
4568         (WebCore::ColorInputType::didChooseColor):
4569         * html/canvas/CanvasRenderingContext2DBase.cpp:
4570         (WebCore::CanvasRenderingContext2DBase::shadowColor const):
4571         * html/canvas/CanvasStyle.h:
4572         (WebCore::CanvasStyle::color const):
4573         * html/track/TextTrackCueGeneric.cpp:
4574         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
4575         (WebCore::TextTrackCueGeneric::toJSON const):
4576         * inspector/InspectorCanvas.cpp:
4577         (WebCore::InspectorCanvas::buildArrayForCanvasGradient):
4578         * page/CaptionUserPreferencesMediaAF.cpp:
4579         (WebCore::CaptionUserPreferencesMediaAF::colorPropertyCSS const):
4580         * page/DragController.cpp:
4581         (WebCore::DragController::concludeEditDrag):
4582         (WebCore::DragController::insertDroppedImagePlaceholdersAtCaret):
4583         * platform/graphics/Color.cpp:
4584         (WebCore::operator<<):
4585         (WebCore::Color::serialized const): Deleted.
4586         (WebCore::Color::cssText const): Deleted.