641af96852798e0078ac48b810305db16c341708
[WebKit.git] / Source / WebCore / ChangeLog
1 2020-04-27  Kenneth Russell  <kbr@chromium.org>
2
3         Build failure in WebGL2RenderingContext after r260588
4         https://bugs.webkit.org/show_bug.cgi?id=211057
5
6         Reviewed by Darin Adler.
7
8         Fix non-ANGLE build failure in WebGL2RenderingContext after
9         r260588.
10
11         * html/canvas/WebGL2RenderingContext.cpp:
12         (WebCore::WebGL2RenderingContext::texStorage2D):
13
14 2020-04-26  Darin Adler  <darin@apple.com>
15
16         [Cocoa] stop using out arguments for document attributes when converting to attributed strings
17         https://bugs.webkit.org/show_bug.cgi?id=211048
18
19         Reviewed by Sam Weinig.
20
21         * DerivedSources-input.xcfilelist: Building modified this file automatically. Uploading
22         the new version.
23
24         * WebCore.xcodeproj/project.pbxproj: Added AttributedString.h.
25         * editing/cocoa/AttributedString.h: Added. Moved this from WebKit, but removed a lot of
26         inessentials.
27         * editing/cocoa/DictionaryLookup.mm: Removed unneeded include.
28         * editing/cocoa/EditorCocoa.mm:
29         (WebCore::selectionAsAttributedString): Updated for change to the return value of the
30         attributedString function, and use init instead of initWithString:@"".
31
32         * editing/cocoa/HTMLConverter.h: Changed to an Objective-C-only header, omitting things
33         like #pramga once. Return the AttributedString struct from the functions instead of
34         using an out argument for document attributes.
35         * editing/cocoa/HTMLConverter.mm:
36         (HTMLConverter::convert): Return an AttributedString and drop the out argument.
37         (WebCore::attributedString): Ditto.
38         (WebCore::editingAttributedString): Ditto. Also refactor a little bit.
39
40         * editing/ios/EditorIOS.mm: Removed unneeded include.
41         * editing/mac/DictionaryLookupLegacy.mm: Removed unneeded include.
42
43         * editing/mac/EditorMac.mm:
44         (WebCore::Editor::dataSelectionForPasteboard): Updated since attributedString
45         now returns a structure.
46
47         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
48         (WebCore::policyProperties): Use init instead of initWithString:@"".
49         * platform/network/cocoa/ResourceRequestCocoa.mm:
50         (WebCore::siteForCookies): Use init instead of initWithString:@"".
51
52 2020-04-26  Yoshiaki Jitsukawa  <yoshiaki.jitsukawa@sony.com>
53
54         [PlayStation] Enable TestWTF and TestWebCore
55         https://bugs.webkit.org/show_bug.cgi?id=208849
56
57         Reviewed by Don Olmstead.
58
59         * PlatformPlayStation.cmake:
60         Add WebCore_CopySharedLibs to install dependencies.
61
62 2020-04-26  Said Abou-Hallawa  <sabouhallawa@apple.com>
63
64         Rendering update steps should use Seconds for the timestamps
65         https://bugs.webkit.org/show_bug.cgi?id=210990
66
67         Reviewed by Daniel Bates.
68
69         Make DOMWindow::nowTimestamp() return ReducedResolutionSeconds and change
70         the callers accordingly. ReducedResolutionSeconds is a new type but it's
71         just an alias of the type Seconds. It indicates that the returned value
72         is a web-safe seconds.
73
74         * Headers.cmake:
75         * WebCore.xcodeproj/project.pbxproj:
76         * animation/DocumentTimeline.cpp:
77         (WebCore::DocumentTimeline::suspendAnimations):
78         (WebCore::DocumentTimeline::liveCurrentTime const):
79         (WebCore::DocumentTimeline::cacheCurrentTime):
80         (WebCore::DocumentTimeline::documentWillUpdateAnimationsAndSendEvents):
81         * animation/DocumentTimeline.h:
82         * animation/DocumentTimelinesController.cpp:
83         (WebCore::DocumentTimelinesController::updateAnimationsAndSendEvents):
84         * animation/DocumentTimelinesController.h:
85         * dom/Document.cpp:
86         (WebCore::Document::serviceRequestAnimationFrameCallbacks):
87         (WebCore::Document::updateIntersectionObservations):
88         * dom/Document.h:
89         * dom/ScriptedAnimationController.cpp:
90         (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks):
91         (WebCore::ScriptedAnimationController::scheduleAnimation):
92         * dom/ScriptedAnimationController.h:
93         * html/HTMLMediaElement.cpp:
94         (WebCore::HTMLMediaElement::getVideoPlaybackQuality):
95         * page/DOMWindow.cpp:
96         (WebCore::DOMWindow::nowTimestamp const):
97         * page/DOMWindow.h:
98         * page/IntersectionObserver.cpp:
99         (WebCore::IntersectionObserver::nowTimestamp const):
100         (WebCore::IntersectionObserver::createTimestamp const): Deleted.
101         * page/IntersectionObserver.h:
102         * page/Page.cpp:
103         (WebCore::Page::updateRendering):
104         * page/Performance.cpp:
105         (WebCore::Performance::now const):
106         (WebCore::Performance::nowInReducedResolutionSeconds const):
107         * page/Performance.h:
108         * page/ReducedResolutionSeconds.h: Added.
109
110 2020-04-26  Alexey Shvayka  <shvaikalesh@gmail.com>
111
112         InternalFunction::createSubclassStructure should use newTarget's globalObject
113         https://bugs.webkit.org/show_bug.cgi?id=202599
114
115         Reviewed by Yusuke Suzuki.
116
117         Accounts for InternalFunction::createSubclassStructure() signature change and
118         utilizes getFunctionRealm() helper to handle cross-realm JSBoundFunction and
119         ProxyObject instances as NewTarget value.
120
121         Tests: web-platform-tests/WebIDL/ecmascript-binding/constructors.html
122                web-platform-tests/custom-elements/htmlconstructor/newtarget.html
123
124         * bindings/js/JSDOMWrapperCache.h:
125         (WebCore::setSubclassStructureIfNeeded):
126         * bindings/js/JSHTMLElementCustom.cpp:
127         (WebCore::constructJSHTMLElement):
128
129 2020-04-26  Yusuke Suzuki  <ysuzuki@apple.com>
130
131         Use `static Lock` instead of `static NeverDestroyed<Lock>`
132         https://bugs.webkit.org/show_bug.cgi?id=211036
133
134         Reviewed by Darin Adler.
135
136         * platform/GenericTaskQueue.cpp:
137         (WebCore::TaskDispatcher<Timer>::sharedLock):
138
139 2020-04-26  Peng Liu  <peng.liu6@apple.com>
140
141         Remove unused class PlaybackSessionInterface
142         https://bugs.webkit.org/show_bug.cgi?id=211031
143
144         Reviewed by Daniel Bates.
145
146         No new tests, no functional changes.
147
148         * WebCore.xcodeproj/project.pbxproj:
149         * platform/cocoa/PlaybackSessionInterface.h: Removed.
150         * platform/cocoa/PlaybackSessionModelMediaElement.h:
151         * platform/ios/PlaybackSessionInterfaceAVKit.h:
152         * platform/mac/PlaybackSessionInterfaceMac.h:
153
154 2020-04-26  Zalan Bujtas  <zalan@apple.com>
155
156         [LFC][TFC] Compute and distribute extra vertical space for rows
157         https://bugs.webkit.org/show_bug.cgi?id=211046
158
159         Reviewed by Antti Koivisto.
160
161         When the table computed height is bigger than the sum of the row heigts, we need to distribute the extra vertical
162         space among the non-fixed height rows. The distribution is based on the preferred height of those non-fixed rows.
163
164         * layout/tableformatting/TableFormattingContext.cpp:
165         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace):
166
167 2020-04-11  Darin Adler  <darin@apple.com>
168
169         Stop using live ranges in functions that return range of the selection
170         https://bugs.webkit.org/show_bug.cgi?id=210396
171
172         Reviewed by Sam Weinig.
173
174         - Added makeRangeSelectingNode, to create a range that selects a node
175           and all its descendants.
176         - Improved intersectingNodes so it can now easily be used in a while loop
177           style as well as the range-for loop style. Also made it more robust
178           against tree changes while iterating; it will now always stop at the
179           end of the document.
180         - Changed functions that work with selection to get a SimpleRange, and
181           then either do all the work without a live range, or call createLiveRange
182           right where it's needed, making it clearer when we can delete that
183           call later as we cut down live ranges even more.
184
185         * accessibility/AccessibilityObject.cpp:
186         (WebCore::AccessibilityObject::selectionRange const): Return a SimpleRange
187         instead of a live range.
188         (WebCore::AccessibilityObject::findTextRanges const): Use createLiveRange
189         on the result of selectionRange since this still mostly uses live ranges.
190         * accessibility/AccessibilityObject.h: Updated for the above.
191
192         * accessibility/AccessibilityRenderObject.cpp:
193         (WebCore::AccessibilityRenderObject::documentBasedSelectedTextRange const):
194         Updated to create a live range only in the one place we need to call a
195         Range class member function.
196
197         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
198         (-[WebAccessibilityObjectWrapper textMarkerRangeForSelection]):
199         Use createLiveRange here.
200
201         * dom/SimpleRange.cpp:
202         (WebCore::makeRangeSelectingNode): Added. For use when we need to make
203         a range that selects a node, not just the node's contents.
204         (WebCore::firstIntersectingNode): Renamed from IntersectingNodeRange::first
205         since this is now used in the iterator class, not the range class. Also
206         letting it be a non-member function so we can tweak it without touching
207         the haeder file.
208         (WebCore::nodePastLastIntersectingNode): Ditto.
209         (WebCore::IntersectingNodeIterator::IntersectingNodeIterator): Changed
210         this constructor to take a SimpleRange. To add the advanceSkippingChildren
211         feature, had to build the termination condition into the iterator rather
212         than basing it on the value of the sentinel.
213         (WebCore::IntersectingNodeIterator::advance): Added. Contains the logic
214         from the ++ operator, so it can be called in a more straightforward way
215         when this is being used with a while loop rather than a range-for loop.
216         (WebCore::IntersectingNodeIterator::advanceSkippingChildren): Added.
217         * dom/SimpleRange.h: Updated for the changes to IntersectingNodeIterator
218         and IntersectingNodeRange.
219
220         * editing/AlternativeTextController.cpp:
221         (WebCore::AlternativeTextController::timerFired): Use createLiveRange.
222
223         * editing/CompositeEditCommand.cpp:
224         (WebCore::CompositeEditCommand::targetRanges const): Use WTFMove in
225         a place where the old code was copying instead.
226
227         * editing/DeleteSelectionCommand.cpp:
228         (WebCore::DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss):
229         Use intersectingNodes to make the function's logic easier to understand.
230
231         * editing/Editing.cpp:
232         (WebCore::visibleImageElementsInRangeWithNonLoadedImages): Changed
233         the argument type to SimpleRange.
234         * editing/Editing.h: Updated for the change above.
235
236         * editing/EditingStyle.cpp:
237         (WebCore::EditingStyle::styleAtSelectionStart): Use createLiveRange.
238
239         * editing/Editor.cpp:
240         (WebCore::Editor::selectedRange): Use createLiveRange.
241         (WebCore::Editor::applyStyleToSelection): Ditto.
242         (WebCore::Editor::applyParagraphStyleToSelection): Ditto.
243         (WebCore::Editor::insertTextWithoutSendingTextEvent): Ditto.
244         (WebCore::Editor::insertLineBreak): Ditto.
245         (WebCore::Editor::insertParagraphSeparator): Ditto.
246         (WebCore::Editor::ignoreSpelling): Remove use of live range.
247         (WebCore::Editor::learnSpelling): Ditto.
248         (WebCore::Editor::misspelledWordAtCaretOrRange const): Ditto.
249         (WebCore::Editor::isSelectionUngrammatical): Ditto.
250         (WebCore::Editor::guessesForMisspelledOrUngrammatical): Ditto.
251         (WebCore::Editor::markMisspellingsAfterTypingToWord): Use createLiveRange.
252         (WebCore::Editor::markMisspellingsOrBadGrammar): Ditto.
253         (WebCore::Editor::markMisspellingsAndBadGrammar): Ditto.
254         (WebCore::Editor::rangeForPoint): Ditto.
255         (WebCore::Editor::insertTextPlaceholder): Ditto.
256         (WebCore::Editor::shouldChangeSelection const): Ditto.
257         (WebCore::Editor::findString): Ditto.
258         (WebCore::Editor::rangeOfString): Ditto.
259         (WebCore::Editor::scanSelectionForTelephoneNumbers): Ditto.
260         (WebCore::Editor::editorUIUpdateTimerFired): Remove use of live range.
261         (WebCore::candidateRangeForSelection): Deleted.
262         (WebCore::Editor::stringForCandidateRequest const): Use createLiveRange
263         and merged in the logic from candidateRangeForSelection.
264         (WebCore::Editor::fontForSelection const): Remove use of live range.
265
266         * editing/EditorCommand.cpp:
267         (WebCore::expandSelectionToGranularity): Use createLiveRange.
268         (WebCore::executeDeleteToMark): Ditto.
269         (WebCore::executeSelectToMark): Ditto.
270         (WebCore::valueFormatBlock): Ditto.
271
272         * editing/FrameSelection.cpp:
273         (WebCore::FrameSelection::respondToNodeModification): Use createLiveRange.
274         (WebCore::FrameSelection::shouldDeleteSelection const): Ditto.
275         (WebCore::FrameSelection::getClippedVisibleTextRectangles const): Do the work
276         without a live range.
277         (WebCore::FrameSelection::expandSelectionToElementContainingCaretSelection): Ditto.
278         (WebCore::FrameSelection::elementRangeContainingCaretSelection const): Changed
279         to return a SimpleRange rather than a live range. Also removed redundant checks
280         and renamed locals to streamline the function.
281         (WebCore::FrameSelection::wordRangeContainingCaretSelection): Return a
282         SimpleRange instead of a live range.
283         (WebCore::FrameSelection::rangeByMovingCurrentSelection const): Ditto.
284         (WebCore::FrameSelection::rangeByExtendingCurrentSelection const): Ditto.
285         (WebCore::FrameSelection::rangeByAlteringCurrentSelection const): Ditto.
286         * editing/FrameSelection.h: Removed the toNormalizedRange function, since the
287         VisibleSelection class has a comment claiming most callers should not call it.
288         Updated forthe other changes above.
289
290         * editing/InsertListCommand.cpp:
291         (WebCore::InsertListCommand::doApply): Use createLiveRange.
292         * editing/ReplaceSelectionCommand.cpp:
293         (WebCore::ReplacementFragment::ReplacementFragment): Ditto.
294
295         * editing/TextCheckingHelper.cpp:
296         (WebCore::TextCheckingHelper::TextCheckingHelper): Remove use of live range,
297         changing the type of m_range to SimpleRange.
298         (WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar): Reduce use
299         of live range.
300         (WebCore::TextCheckingHelper::findFirstGrammarDetail const): Use createLiveRange.
301         (WebCore::TextCheckingHelper::findFirstBadGrammar const): Ditto.
302         (WebCore::TextCheckingHelper::isUngrammatical const): Remove use of live range.
303         (WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange const):
304         Use createLiveRange.
305         (WebCore::TextCheckingHelper::unifiedTextCheckerEnabled const): Updated for
306         different interface to get the document for a SimpleRange.
307         * editing/TextCheckingHelper.h: Change constructor to take a SimpleRange.
308
309         * editing/TypingCommand.cpp:
310         (WebCore::TypingCommand::deleteKeyPressed): Use createLiveRange.
311         (WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto.
312
313         * editing/VisibleSelection.cpp:
314         (WebCore::VisibleSelection::firstRange const): Return a SimpleRange.
315         (WebCore::VisibleSelection::toNormalizedRange const): Ditto.
316         * editing/VisibleSelection.h: Updated for the above.
317
318         * editing/cocoa/DictionaryLookup.mm: Removed an uneeded check of the
319         selection range against null. Code already guards against null endpoints.
320
321         * editing/cocoa/EditorCocoa.mm:
322         (WebCore::selectionAsAttributedString): Added. Uses the attributedString
323         function with it's new argument and return value types. There's no longer
324         a special function for the selection in the HTMLConverter header, so we
325         put it here instead.
326         (WebCore::Editor::writeSelectionToPasteboard): Updated to use the function
327         above and to deal with RetainPtr.
328         (WebCore::Editor::writeSelection): Ditto.
329
330         * editing/cocoa/HTMLConverter.h: Removed attributedStringFromSelection and
331         attributedStringBetweenStartAndEnd. Renamed attributedStringFromRange to
332         just attributedString and renamed editingAttributedStringFromRange to
333         just editingAttributedString. Also renamed IncludeImagesInAttributedString
334         to just IncludeImages.
335         * editing/cocoa/HTMLConverter.mm:
336         (HTMLConverter::HTMLConverter): Use a SimpleRange rther than two Position
337         arguments to the constructor.
338         (HTMLConverter::convert): Use RetainPtr for the return value and the
339         optional out argument.
340         (WebCore::attributedStringFromSelection): Deleted.
341         (WebCore::attributedStringBetweenStartAndEnd): Deleted.
342         (WebCore::attributedString): Renamed the version that takes a range and
343         made it take a SimpleRange, not a live range.
344         (WebCore::editingAttributedString): Ditto.
345
346         * editing/mac/EditorMac.mm:
347         (WebCore::Editor::dataSelectionForPasteboard): Updated for changes to
348         attributedString.
349
350         * html/HTMLTextAreaElement.cpp:
351         (WebCore::HTMLTextAreaElement::handleBeforeTextInsertedEvent const):
352         Changed to not use live ranges any more.
353
354         * page/ContextMenuController.cpp:
355         (WebCore::ContextMenuController::contextMenuItemSelected):
356         Use createLiveRange.
357
358         * page/DOMSelection.cpp:
359         (WebCore::DOMSelection::getRangeAt): Use createLiveRange.
360         (WebCore::DOMSelection::addRange): Use Ditto.
361         (WebCore::DOMSelection::deleteFromDocument): Ditto.
362
363         * page/DragController.cpp:
364         (WebCore::setSelectionToDragCaret): Removed in/out argument that was
365         used to update a range that was never looked at afterward.
366         (WebCore::DragController::concludeEditDrag): Use createLiveRange.
367         (WebCore::DragController::draggableElement const): Ditto.
368         (WebCore::DragController::startDrag): Ditto.
369
370         * page/EventHandler.cpp:
371         (WebCore::EventHandler::dispatchMouseEvent): Use createLiveRange.
372         (WebCore::EventHandler::sendContextMenuEventForKey): Ditto.
373         (WebCore::EventHandler::didStartDrag): Remove use of live range.
374
375         * page/Page.cpp:
376         (WebCore::Page::findStringMatchingRanges): Use createLiveRange.
377         * page/TextIndicator.cpp:
378         (WebCore::TextIndicator::createWithRange): Ditto.
379         (WebCore::TextIndicator::createWithSelectionInFrame): Ditto.
380
381         * page/mac/ServicesOverlayController.mm:
382         (WebCore::ServicesOverlayController::buildSelectionHighlight):
383         Use createLiveRange.
384         (WebCore::ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight):
385         Use createLiveRange.
386
387         * rendering/HitTestResult.cpp:
388         (WebCore::HitTestResult::selectedText const): Remove use of
389         live range.
390
391 2020-04-26  Darin Adler  <darin@apple.com>
392
393         Remove unnecessary inlining and templates for URL decomposition DOM functions
394         https://bugs.webkit.org/show_bug.cgi?id=211025
395
396         Reviewed by Alex Christensen.
397
398         * Headers.cmake: Renamed URLUtils.h to URLDecomposition.h.
399         * Modules/cache/DOMCacheStorage.cpp: Updated include and using namespace.
400         * Sources.txt: Added URLDecomposition.cpp.
401         * WebCore.xcodeproj/project.pbxproj: Added URLDecomposition.cpp and
402         renamed URLUtils.h to URLDecomposition.h.
403
404         * html/DOMURL.h: Removed the WEBCORE_EXPORT on this class. Added final.
405         Derive from URLDecomposition instead of URLUtils. Changed return type of
406         href to const&. Moved toJSON here from URLUtils. Added overrides of the
407         fullURL and setFullURL functions for URLDecomposition.
408
409         * html/DOMURL.idl: Removed ImplementationLacksVTable.
410
411         * html/HTMLAnchorElement.cpp:
412         (WebCore::HTMLAnchorElement::HTMLAnchorElement): Moved initialization of
413         boolean data members to the class definition.
414
415         * html/HTMLAnchorElement.h: Derive from URLDecomposition instead of
416         URLUtils. Added overrides of the fullURL and setFullURL functions for
417         URLDecomposition. Initialize data members here in the class definition.
418
419         * html/HTMLMediaElement.cpp: Removed unnecessary include of DOMURL.h.
420
421         * html/URLDecomposition.cpp: Added. Contains most of the code from
422         the URLUtils class template, which no longer needs to be in a header.
423
424         * html/URLDecomposition.h: Renamed URLUtils.h to this. It's now an
425         abstract base class rather than a class template using the curiously
426         recurring template pattern.
427
428         * html/URLSearchParams.h: Forward-declare DOMURL rather than including
429         the DOMURL.h header.
430
431         * html/URLUtils.h: Removed. Renamed to URLDecompostion.h.
432
433         * page/DOMWindow.cpp: Removed unneeded include of DOMURL.h.
434         * testing/Internals.cpp: Added include of DOMURL.h.
435
436 2020-04-26  Cathie Chen  <cathiechen@igalia.com>
437
438         fast/scrolling/scroll-behavior-invalidate-if-disabled.html is a flaky failure
439         https://bugs.webkit.org/show_bug.cgi?id=210917
440
441         Reviewed by Darin Adler.
442
443         The flaky failure is caused by reusing the CSSPropertyInfo value cached propertyInfoCache
444         after experimental flags changed. Add propertyInfoFromJavaScriptCSSPropertyName 
445         to perform disabled checking after parsing. If the property is disabled, it will return
446         an invalid CSSPropertyInfo instead.
447
448         * css/CSSStyleDeclaration.cpp:
449         (WebCore::CSSStyleDeclaration::getCSSPropertyIDFromJavaScriptPropertyName):
450         (WebCore::CSSStyleDeclaration::namedItem):
451         (WebCore::CSSStyleDeclaration::setNamedItem):
452
453 2020-04-25  Ross Kirsling  <ross.kirsling@sony.com>
454
455         [JSC] isCallable is redundant with isFunction
456         https://bugs.webkit.org/show_bug.cgi?id=211037
457
458         Reviewed by Yusuke Suzuki.
459
460         * bindings/js/JSDOMConvertScheduledAction.h:
461         (WebCore::Converter<IDLScheduledAction>::convert):
462         * worklets/PaintWorkletGlobalScope.cpp:
463         (WebCore::PaintWorkletGlobalScope::registerPaint):
464         Don't use getCallData if you don't need CallData. 
465
466 2020-04-25  Alex Christensen  <achristensen@webkit.org>
467
468         Build fix.
469         https://bugs.webkit.org/show_bug.cgi?id=210521
470
471         * Modules/applepay/ApplePaySetupFeature.mm:
472
473 2020-04-25  Alex Christensen  <achristensen@webkit.org>
474
475         Move ApplePay code from WebKitAdditions to WebCore and WebKit
476         https://bugs.webkit.org/show_bug.cgi?id=210521
477
478         I accidentally committed an older version of the patch.
479         This is the diff between the two to fix the internal build.
480
481 2020-04-25  Alex Christensen  <achristensen@webkit.org>
482
483         Move ApplePay code from WebKitAdditions to WebCore and WebKit
484         https://bugs.webkit.org/show_bug.cgi?id=210521
485
486         Reviewed by Andy Estes.
487
488         Only 4 minor modifications were necessary, as follows:
489
490         1. PaymentSetupFeatures's RetainPtr<NSArray<PKPaymentSetupFeature *>> was changed to RetainPtr<NSArray> to work with C++.
491         2. WebPaymentCoordinatorProxyAdditions messages were moved to WebPaymentCoordinatorProxy, removing the need for
492            the extra message receiver, the Optional<WebPaymentCoordinatorProxyAdditions>, and the finishConstruction.
493         3. WebMediaSessionManager.cpp's macros that collided with other macros were renamed.  This was necessary because of different source unification.
494         4. PaymentSetupFeatures.h was renamed to ApplePayPaymentSetupFeatures.h to be able to build with PaymentSetupFeatures.h in the SDK.
495
496         The rest is just copy and paste.
497
498         There isn't a good way to land this without breaking the build without removing the files from WebKitAdditions at the same time,
499         so I'll do the two at the same time late at night to not cause disruption.
500
501         * DerivedSources.make:
502         * Modules/applepay/ApplePayInstallmentConfiguration.h: Added.
503         * Modules/applepay/ApplePayInstallmentConfiguration.idl: Added.
504         * Modules/applepay/ApplePayPayment.h:
505         * Modules/applepay/ApplePayPayment.idl:
506         * Modules/applepay/ApplePayPaymentMethod.h:
507         * Modules/applepay/ApplePayPaymentMethod.idl:
508         * Modules/applepay/ApplePayPaymentMethodUpdate.h:
509         * Modules/applepay/ApplePayPaymentMethodUpdate.idl:
510         * Modules/applepay/ApplePayRequestBase.cpp:
511         (WebCore::finishConverting):
512         (WebCore::requiresSupportedNetworks):
513         * Modules/applepay/ApplePayRequestBase.h:
514         * Modules/applepay/ApplePaySession.cpp:
515         (WebCore::finishConverting):
516         * Modules/applepay/ApplePaySessionPaymentRequest.h:
517         (WebCore::ApplePaySessionPaymentRequest::installmentConfiguration const):
518         (WebCore::ApplePaySessionPaymentRequest::setInstallmentConfiguration):
519         * Modules/applepay/ApplePaySetup.cpp: Added.
520         (WebCore::shouldDiscloseFeatures):
521         (WebCore::ApplePaySetup::getSetupFeatures):
522         (WebCore::ApplePaySetup::begin):
523         (WebCore::ApplePaySetup::ApplePaySetup):
524         (WebCore::ApplePaySetup::stop):
525         (WebCore::ApplePaySetup::suspend):
526         * Modules/applepay/ApplePaySetup.h: Added.
527         (WebCore::ApplePaySetup::create):
528         * Modules/applepay/ApplePaySetup.idl: Added.
529         * Modules/applepay/ApplePaySetupFeature.h: Added.
530         (WebCore::ApplePaySetupFeature::create):
531         (WebCore::ApplePaySetupFeature::platformFeature const):
532         * Modules/applepay/ApplePaySetupFeature.idl: Added.
533         * Modules/applepay/ApplePaySetupFeature.mm: Added.
534         (WebCore::ApplePaySetupFeature::type const):
535         (WebCore::ApplePaySetupFeature::state const):
536         (WebCore::ApplePaySetupFeature::supportsInstallments const):
537         (WebCore::ApplePaySetupFeature::ApplePaySetupFeature):
538         * Modules/applepay/ApplePaySetupFeatureType.h: Added.
539         * Modules/applepay/ApplePaySetupFeatureType.idl: Added.
540         * Modules/applepay/PaymentCoordinatorClient.h:
541         (WebCore::PaymentCoordinatorClient::getSetupFeatures):
542         (WebCore::PaymentCoordinatorClient::beginApplePaySetup):
543         (WebCore::PaymentCoordinatorClient::endApplePaySetup):
544         * Modules/applepay/PaymentInstallmentConfiguration.h: Added.
545         * Modules/applepay/PaymentInstallmentConfiguration.mm: Added.
546         (WebCore::toDecimalNumber):
547         (WebCore::platformFeatureType):
548         (WebCore::createPlatformConfiguration):
549         (WebCore::PaymentInstallmentConfiguration::PaymentInstallmentConfiguration):
550         (WebCore::PaymentInstallmentConfiguration::platformConfiguration const):
551         * Modules/applepay/PaymentMethodUpdate.h:
552         * Modules/applepay/cocoa/PaymentCocoa.mm:
553         (WebCore::finishConverting):
554         * Modules/applepay/cocoa/PaymentMethodCocoa.mm:
555         (WebCore::finishConverting):
556         * Modules/applepay/cocoa/PaymentMethodUpdateCocoa.mm:
557         (WebCore::PaymentMethodUpdate::setInstallmentGroupIdentifier):
558         * Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm:
559         (WebCore::additionalError):
560         * Modules/applepay/paymentrequest/ApplePayRequest.idl:
561         * Modules/mediasession/WebMediaSessionManager.cpp:
562         (WebCore::WebMediaSessionManager::setMockMediaPlaybackTargetPickerEnabled):
563         (WebCore::WebMediaSessionManager::setMockMediaPlaybackTargetPickerState):
564         (WebCore::WebMediaSessionManager::mockMediaPlaybackTargetPickerDismissPopup):
565         (WebCore::WebMediaSessionManager::addPlaybackTargetPickerClient):
566         (WebCore::WebMediaSessionManager::removePlaybackTargetPickerClient):
567         (WebCore::WebMediaSessionManager::removeAllPlaybackTargetPickerClients):
568         (WebCore::WebMediaSessionManager::showPlaybackTargetPicker):
569         (WebCore::WebMediaSessionManager::clientStateDidChange):
570         (WebCore::WebMediaSessionManager::setPlaybackTarget):
571         (WebCore::WebMediaSessionManager::externalOutputDeviceAvailableDidChange):
572         (WebCore::WebMediaSessionManager::playbackTargetPickerWasDismissed):
573         (WebCore::WebMediaSessionManager::configurePlaybackTargetClients):
574         (WebCore::WebMediaSessionManager::configurePlaybackTargetMonitoring):
575         (WebCore::WebMediaSessionManager::configureWatchdogTimer):
576         (WebCore::WebMediaSessionManager::watchdogTimerFired):
577         * SourcesCocoa.txt:
578         * WebCore.xcodeproj/project.pbxproj:
579         * platform/cocoa/WebCoreAdditions.mm:
580
581 2020-04-25  Simon Fraser  <simon.fraser@apple.com>
582
583         Commit the scrolling tree from the main thread
584         https://bugs.webkit.org/show_bug.cgi?id=211026
585         <rdar://problem/62374855>
586
587         Reviewed by Darin Adler.
588
589         ScrollingCoordinatorMac::commitTreeStateIfNeeded() passed the new state tree to
590         the scrolling thread which then did the commit (which updates the scrolling tree
591         from the state tree). However, applyLayerPositions() immediately waited for that
592         commit to complete, blocking the main thread anyway.
593
594         We might as well just commit the scrolling tree on the main thread. ScrollingTree::commitTreeState()
595         locks m_treeMutex, so this is still safe. Lock contention with the scrolling or event dispatcher
596         threads should be rare; those threads are both mostly responsive.
597
598         * page/scrolling/AsyncScrollingCoordinator.cpp:
599         (WebCore::AsyncScrollingCoordinator::scrollingTreeAsText const):
600         * page/scrolling/ScrollingTree.cpp:
601         (WebCore::ScrollingTree::commitTreeState):
602         * page/scrolling/ScrollingTree.h:
603         (WebCore::ScrollingTree::waitForScrollingTreeCommit): Deleted.
604         * page/scrolling/ThreadedScrollingTree.cpp:
605         (WebCore::ThreadedScrollingTree::commitTreeState): Deleted.
606         (WebCore::ThreadedScrollingTree::incrementPendingCommitCount): Deleted.
607         (WebCore::ThreadedScrollingTree::decrementPendingCommitCount): Deleted.
608         (WebCore::ThreadedScrollingTree::waitForPendingCommits): Deleted.
609         (WebCore::ThreadedScrollingTree::waitForScrollingTreeCommit): Deleted.
610         (WebCore::ThreadedScrollingTree::applyLayerPositions): Deleted.
611         * page/scrolling/ThreadedScrollingTree.h:
612         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
613         (WebCore::ScrollingCoordinatorMac::commitTreeStateIfNeeded):
614         * page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp:
615         (WebCore::ScrollingCoordinatorNicosia::commitTreeState):
616
617 2020-04-25  Yusuke Suzuki  <ysuzuki@apple.com>
618
619         Use static initialized Lock instead of LazyNeverDestroyed<Lock>
620         https://bugs.webkit.org/show_bug.cgi?id=211010
621
622         Reviewed by Mark Lam.
623
624         WTF::Lock can be static-initialized, so no need to use LazyNeverDestroyed<Lock>.
625
626         * Modules/webgpu/WebGPUDevice.cpp:
627         (WebCore::WebGPUDevice::instancesMutex):
628         * Modules/webgpu/WebGPUPipeline.cpp:
629         (WebCore::WebGPUPipeline::instancesMutex):
630         * html/canvas/CanvasRenderingContext.cpp:
631         (WebCore::CanvasRenderingContext::instancesMutex):
632         * html/canvas/WebGLProgram.cpp:
633         (WebCore::WebGLProgram::instancesMutex):
634
635 2020-04-25  Darin Adler  <darin@apple.com>
636
637         [Cocoa] Deal with another round of Xcode upgrade checks
638         https://bugs.webkit.org/show_bug.cgi?id=211027
639
640         Reviewed by Alexey Proskuryakov.
641
642         * WebCore.xcodeproj/project.pbxproj: Bump the upgrade check version.
643
644 2020-04-25  Alex Christensen  <achristensen@webkit.org>
645
646         Prepare to remove automatic URL->String conversion operators
647         https://bugs.webkit.org/show_bug.cgi?id=211007
648
649         Reviewed by Darin Adler.
650
651         * Modules/cache/DOMCache.cpp:
652         (WebCore::DOMCache::requestFromInfo):
653         * Modules/fetch/FetchRequest.cpp:
654         (WebCore::FetchRequest::urlString const):
655         * Modules/fetch/FetchResponse.cpp:
656         (WebCore::FetchResponse::fetch):
657         * Modules/websockets/WebSocket.cpp:
658         (WebCore::WebSocket::create):
659         * accessibility/AccessibilityImageMapLink.cpp:
660         (WebCore::AccessibilityImageMapLink::stringValueForMSAA const):
661         * bindings/IDLTypes.h:
662         (WebCore::IDLString::isNullValue):
663         * bindings/js/CachedScriptSourceProvider.h:
664         (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
665         * bindings/js/JSDOMConvertStrings.h:
666         (WebCore::JSConverter<IDLDOMString>::convert):
667         (WebCore::Converter<IDLUSVString>::convert):
668         (WebCore::JSConverter<IDLUSVString>::convert):
669         * bindings/js/ScriptController.cpp:
670         (WebCore::ScriptController::evaluateInWorld):
671         (WebCore::ScriptController::evaluateModule):
672         (WebCore::ScriptController::callInWorld):
673         (WebCore::ScriptController::executeIfJavaScriptURL):
674         * bindings/js/SerializedScriptValue.cpp:
675         (WebCore::CloneSerializer::dumpIfTerminal):
676         (WebCore::CloneSerializer::write):
677         * css/CSSCursorImageValue.cpp:
678         (WebCore::CSSCursorImageValue::updateCursorElement):
679         * css/CSSImageValue.cpp:
680         (WebCore::CSSImageValue::customCSSText const):
681         (WebCore::CSSImageValue::createDeprecatedCSSOMWrapper const):
682         * css/parser/CSSPropertyParser.cpp:
683         (WebCore::consumeFontFaceSrcURI):
684         * dom/Document.cpp:
685         (WebCore::Document::processHttpEquiv):
686         * dom/ExtensionStyleSheets.cpp:
687         (WebCore::createExtensionsStyleSheet):
688         * dom/InlineStyleSheetOwner.cpp:
689         (WebCore::InlineStyleSheetOwner::createSheet):
690         * dom/ScriptElement.cpp:
691         (WebCore::ScriptElement::requestModuleScript):
692         (WebCore::ScriptElement::executeClassicScript):
693         * dom/StyledElement.cpp:
694         (WebCore::StyledElement::styleAttributeChanged):
695         * editing/cocoa/WebContentReaderCocoa.mm:
696         (WebCore::sanitizeMarkupWithArchive):
697         (WebCore::WebContentReader::readWebArchive):
698         * html/HTMLFormControlElement.cpp:
699         (WebCore::HTMLFormControlElement::formAction const):
700         * html/HTMLFrameElementBase.cpp:
701         (WebCore::HTMLFrameElementBase::canLoadURL const):
702         * html/HTMLLinkElement.cpp:
703         (WebCore::HTMLLinkElement::shouldLoadLink):
704         * html/HTMLMediaElement.cpp:
705         (WebCore::HTMLMediaElement::selectNextSourceChild):
706         * html/HTMLPlugInImageElement.cpp:
707         (WebCore::HTMLPlugInImageElement::canLoadURL const):
708         * html/parser/XSSAuditor.cpp:
709         (WebCore::XSSAuditor::filterToken):
710         * inspector/InspectorAuditResourcesObject.cpp:
711         (WebCore::InspectorAuditResourcesObject::getResources):
712         * inspector/InspectorStyleSheet.cpp:
713         (WebCore::buildArrayForGroupings):
714         * inspector/NetworkResourcesData.cpp:
715         (WebCore::NetworkResourcesData::responseReceived):
716         * inspector/agents/InspectorNetworkAgent.cpp:
717         (WebCore::InspectorNetworkAgent::buildObjectForCachedResource):
718         (WebCore::InspectorNetworkAgent::willSendRequest):
719         * inspector/agents/InspectorPageAgent.cpp:
720         (WebCore::InspectorPageAgent::getCookies):
721         (WebCore::InspectorPageAgent::searchInResources):
722         (WebCore::InspectorPageAgent::buildObjectForFrameTree):
723         * inspector/agents/InspectorWorkerAgent.cpp:
724         (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy):
725         * inspector/agents/WebConsoleAgent.cpp:
726         (WebCore::WebConsoleAgent::didFailLoading):
727         * inspector/agents/worker/ServiceWorkerAgent.cpp:
728         (WebCore::ServiceWorkerAgent::getInitializationInfo):
729         * loader/DocumentLoader.cpp:
730         (WebCore::DocumentLoader::subresources const):
731         * loader/DocumentLoader.h:
732         (WebCore::DocumentLoader::clientRedirectDestinationForHistory const):
733         (WebCore::DocumentLoader::serverRedirectDestinationForHistory const):
734         * loader/FrameLoader.cpp:
735         (WebCore::FrameLoader::submitForm):
736         (WebCore::FrameLoader::receivedFirstData):
737         (WebCore::FrameLoader::loadInSameDocument):
738         (WebCore::FrameLoader::loadedResourceFromMemoryCache):
739         (WebCore::createWindow):
740         * loader/HistoryController.cpp:
741         (WebCore::HistoryController::currentItemShouldBeReplaced const):
742         * loader/ImageLoader.cpp:
743         (WebCore::ImageLoader::updateFromElement):
744         (WebCore::ImageLoader::dispatchPendingBeforeLoadEvent):
745         * loader/LinkLoader.cpp:
746         (WebCore::LinkLoader::preloadIfNeeded):
747         (WebCore::LinkLoader::prefetchIfNeeded):
748         * loader/MixedContentChecker.cpp:
749         (WebCore::MixedContentChecker::checkFormForMixedContent const):
750         * loader/NavigationScheduler.cpp:
751         (WebCore::NavigationScheduler::shouldScheduleNavigation const):
752         (WebCore::NavigationScheduler::scheduleLocationChange):
753         * loader/PingLoader.cpp:
754         (WebCore::PingLoader::loadImage):
755         (WebCore::PingLoader::sendPing):
756         * loader/ResourceLoadNotifier.cpp:
757         (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
758         * loader/SubframeLoader.cpp:
759         (WebCore::SubframeLoader::requestObject):
760         * loader/TextTrackLoader.cpp:
761         (WebCore::TextTrackLoader::load):
762         * loader/appcache/ApplicationCache.cpp:
763         (WebCore::ApplicationCache::addResource):
764         (WebCore::ApplicationCache::resourceForRequest):
765         * loader/appcache/ApplicationCacheGroup.cpp:
766         (WebCore::ApplicationCacheGroup::selectCache):
767         (WebCore::ApplicationCacheGroup::finishedLoadingMainResource):
768         (WebCore::ApplicationCacheGroup::didFinishLoadingEntry):
769         (WebCore::ApplicationCacheGroup::didFailLoadingEntry):
770         (WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
771         * loader/appcache/ApplicationCacheHost.cpp:
772         (WebCore::ApplicationCacheHost::shouldLoadResourceFromApplicationCache):
773         (WebCore::ApplicationCacheHost::getApplicationCacheFallbackResource):
774         * loader/appcache/ApplicationCacheStorage.cpp:
775         (WebCore::ApplicationCacheStorage::loadCacheGroup):
776         (WebCore::ApplicationCacheStorage::findOrCreateCacheGroup):
777         (WebCore::ApplicationCacheStorage::findInMemoryCacheGroup const):
778         (WebCore::ApplicationCacheStorage::cacheGroupForURL):
779         (WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL):
780         (WebCore::ApplicationCacheStorage::cacheGroupDestroyed):
781         (WebCore::ApplicationCacheStorage::cacheGroupMadeObsolete):
782         (WebCore::ApplicationCacheStorage::store):
783         (WebCore::ApplicationCacheStorage::deleteCacheForOrigin):
784         * loader/archive/ArchiveResourceCollection.cpp:
785         (WebCore::ArchiveResourceCollection::addAllResources):
786         (WebCore::ArchiveResourceCollection::addResource):
787         (WebCore::ArchiveResourceCollection::archiveResourceForURL):
788         * loader/cache/CachedCSSStyleSheet.cpp:
789         (WebCore::CachedCSSStyleSheet::didAddClient):
790         (WebCore::CachedCSSStyleSheet::checkNotify):
791         * loader/cache/CachedResourceLoader.cpp:
792         (WebCore::CachedResourceLoader::cachedResource const):
793         (WebCore::CachedResourceLoader::requestResource):
794         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
795         (WebCore::CachedResourceLoader::notifyFinished):
796         * loader/cache/CachedXSLStyleSheet.cpp:
797         (WebCore::CachedXSLStyleSheet::didAddClient):
798         (WebCore::CachedXSLStyleSheet::checkNotify):
799         * page/ContextMenuController.cpp:
800         (WebCore::ContextMenuController::checkOrEnableIfNeeded const):
801         * page/DOMWindow.cpp:
802         (WebCore::DOMWindow::setLocation):
803         (WebCore::DOMWindow::createWindow):
804         (WebCore::DOMWindow::open):
805         * page/Location.cpp:
806         (WebCore::Location::reload):
807         * page/PageSerializer.cpp:
808         (WebCore::PageSerializer::retrieveResourcesForProperties):
809         * page/SecurityOrigin.cpp:
810         (WebCore::SecurityOrigin::shouldIgnoreHost):
811         * page/SecurityPolicy.cpp:
812         (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner):
813         (WebCore::SecurityPolicy::isBaseURLSchemeAllowed):
814         * page/csp/ContentSecurityPolicy.cpp:
815         (WebCore::ContentSecurityPolicy::reportViolation const):
816         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
817         (WebCore::MediaPlayerPrivateAVFoundation::assetURL const):
818         * platform/network/BlobRegistryImpl.cpp:
819         (WebCore::BlobRegistryImpl::writeBlobToFilePath):
820         * platform/network/mac/ResourceErrorMac.mm:
821         (WebCore::ResourceError::platformLazyInit):
822         * storage/StorageEventDispatcher.cpp:
823         (WebCore::StorageEventDispatcher::dispatchSessionStorageEvents):
824         (WebCore::StorageEventDispatcher::dispatchLocalStorageEvents):
825         * svg/SVGImageLoader.cpp:
826         (WebCore::SVGImageLoader::sourceURI const):
827         * workers/WorkerScriptLoader.cpp:
828         (WebCore::WorkerScriptLoader::loadSynchronously):
829         * workers/service/ServiceWorkerRegistration.cpp:
830         (WebCore::ServiceWorkerRegistration::scope const):
831         * workers/service/ServiceWorkerRegistrationKey.cpp:
832         (WebCore::ServiceWorkerRegistrationKey::hash const):
833         (WebCore::ServiceWorkerRegistrationKey::isMatching const):
834         * workers/service/context/ServiceWorkerDebuggable.cpp:
835         (WebCore::ServiceWorkerDebuggable::ServiceWorkerDebuggable):
836         * workers/service/server/SWServer.cpp:
837         (WebCore::SWServer::startScriptFetch):
838         * xml/XMLHttpRequest.cpp:
839         (WebCore::XMLHttpRequest::send):
840
841 2020-04-25  Zalan Bujtas  <zalan@apple.com>
842
843         [LFC][TFC] Add vertical-align: baseline support
844         https://bugs.webkit.org/show_bug.cgi?id=211024
845
846         Reviewed by Antti Koivisto.
847
848         Adjust the padding with the baseline offset when the cell is baseline aligned (as opposed to the initial value of 'middle').
849
850         Test: fast/layoutformattingcontext/table-basic-row-vertical-align-baseline.html
851
852         * layout/tableformatting/TableFormattingContext.cpp:
853         (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells):
854         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace):
855         * layout/tableformatting/TableGrid.h:
856         (WebCore::Layout::TableGrid::Cell::setBaselineOffset):
857         (WebCore::Layout::TableGrid::Cell::baselineOffset const):
858
859 2020-04-25  Darin Adler  <darin@apple.com>
860
861         Move URL to use StringView when returning substrings of the URL
862         https://bugs.webkit.org/show_bug.cgi?id=210431
863
864         Reviewed by Anders Carlsson.
865
866         * Modules/cache/DOMCacheEngine.cpp:
867         (WebCore::DOMCacheEngine::matchURLs): Removed unneeded calls to hasQuery.
868
869         * Modules/fetch/FetchRequest.cpp:
870         (WebCore::FetchRequest::initializeWith): Use hasCredentials.
871         * Modules/fetch/FetchResponse.cpp:
872         (WebCore::FetchResponse::redirect): Use hasCredentials.
873         * Modules/paymentrequest/PaymentRequest.cpp:
874         (WebCore::isValidURLBasedPaymentMethodIdentifier): Use hasCredentials.
875
876         * Modules/plugins/YouTubePluginReplacement.cpp:
877         (WebCore::createYouTubeURL): Take StringView.
878         (WebCore::queryKeysAndValues): Take StringView.
879         (WebCore::processAndCreateYouTubeURL): Use auto since URL pieces are
880         now returned as StringView.
881         (WebCore::YouTubePluginReplacement::youTubeURLFromAbsoluteURL):
882         Use StringView and makeString rather than StringBuilder.
883
884         * Modules/websockets/WebSocketHandshake.cpp:
885         (WebCore::resourceName): Use queryWithLeadingQuestionMark.
886
887         * accessibility/AccessibilityRenderObject.cpp:
888         (WebCore::AccessibilityRenderObject::internalLinkElement const):
889         Use StringView.
890
891         * dom/Document.cpp:
892         (WebCore::Document::setURL): Use setHostAndPort.
893
894         * dom/Element.cpp:
895         (WebCore::Element::findAnchorElementForLink): Update since
896         fragmentIdentifier returns StringView.
897
898         * dom/TreeScope.cpp: Added a comment.
899
900         * editing/cocoa/WebContentReaderCocoa.mm:
901         (WebCore::replaceRichContentWithAttachments): Update since
902         lastPathComponent returns a StringView. Also got rid of some strange
903         use of AtomString that was not necessary and used WTFMove more.
904
905         * editing/ios/EditorIOS.mm:
906         (WebCore::Editor::writeImageToPasteboard): Update since
907         lastPathComponent returns a StringView.
908
909         * html/HTMLAttachmentElement.cpp:
910         (WebCore::HTMLAttachmentElement::attachmentTitleForDisplay const):
911         Use makeString instead of StringBuilder, and StringView instead of
912         String for name and extension values.
913
914         * html/HTMLPlugInElement.cpp:
915         (WebCore::pluginReplacementForType): Update since lastPathComponent
916         returns a StringView.
917
918         * html/MediaFragmentURIParser.cpp:
919         (WebCore::MediaFragmentURIParser::parseFragments): Update since
920         fragmentIdentifier returns a StringView.
921
922         * html/URLUtils.h: Changed many functions to take a StringView, changed
923         various other functions to call toString, since the underlying URL
924         function now returns a StringView. Updated names since "pass" is now
925         "password".
926         (WebCore::countASCIIDigits): Added. Replaces unusual function
927         named parsePortFromStringPosition because we can use StringView now
928         and so don't need such an unusual function.
929
930         * loader/AdClickAttribution.cpp:
931         (WebCore::AdClickAttribution::parseConversionRequest): Use hasCredentials.
932         Also removed unnecessary use of ASCIILiteral that hurts performance
933         a tiny bit.
934         (WebCore::AdClickAttribution::urlForTesting const): Use makeString
935         instead of StringBuilder.
936
937         * loader/CrossOriginAccessControl.cpp:
938         (WebCore::validateCrossOriginRedirectionURL): Use hasCredentials.
939         * loader/DocumentThreadableLoader.cpp:
940         (WebCore::DocumentThreadableLoader::loadRequest): Use hasCredentials.
941
942         * loader/FormSubmission.cpp:
943         (WebCore::appendMailtoPostFormDataToURL): Update since query returns
944         StringView.
945
946         * loader/FrameLoader.cpp:
947         (WebCore::FrameLoader::loadInSameDocument): Use equalRespectingNullity on
948         fragment identifiers to preserve behavior, since at this time
949         StringView == StringView does not respect nullity, but String == String does.
950
951         * loader/appcache/ApplicationCacheHost.cpp:
952         (WebCore::ApplicationCacheHost::createFileURL): Use fileURLWithFileSystemPath.
953
954         * loader/appcache/ManifestParser.cpp:
955         (WebCore::manifestPath): Return a StringView.
956         (WebCore::parseManifest): Use StringView.
957
958         * loader/cache/CachedFont.cpp:
959         (WebCore::CachedFont::calculateItemInCollection const): Update since
960         fragmentIdentifer returns a StringView.
961         * loader/cache/CachedResourceRequest.cpp:
962         (WebCore::CachedResourceRequest::splitFragmentIdentifierFromRequestURL): Ditto.
963         * page/FrameView.cpp:
964         (WebCore::FrameView::scrollToFragment): Ditto.
965         (WebCore::FrameView::scrollToFragmentInternal): Updated log message.
966
967         * page/History.cpp:
968         (WebCore::History::stateObjectAdded): Updated for URL::password name change
969         and to use the new stringWithoutQueryOrFragmentIdentifier rather than the
970         old equalIgnoringQueryAndFragment.
971
972         * page/Location.cpp:
973         (WebCore::Location::href const): Use removeCredentials.
974         (WebCore::Location::port const): Streamlined.
975         (WebCore::Location::pathname const): Use an ASCIILiteral.
976         (WebCore::Location::search const): Use queryWithLeadingQuestionMark.
977         (WebCore::Location::hash const): Use fragmentIdentifierWithLeadingNumberSign.
978         (WebCore::Location::setPort): Use parseUInt16.
979
980         * page/UserContentURLPattern.cpp: Coding style tweaks.
981
982         * platform/MIMETypeRegistry.cpp:
983         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
984         Use contains instead of reverseFind to check for a period in the filename.
985
986         * platform/graphics/MediaPlayer.cpp:
987         (WebCore::MediaPlayer::load): Updated since lastPathComponent is a StringView.
988
989         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
990         (WebCore::convertToInternalProtocol): Updated to use makeString since
991         setProtocol takes a StringView.
992
993         * platform/network/ResourceHandleInternal.h: Renamed m_pass to m_password
994         and call password instead of pass.
995
996         * platform/network/ResourceRequestBase.cpp:
997         (WebCore::ResourceRequestBase::removeCredentials): Use removeCredentials.
998
999         * platform/network/cf/ResourceHandleCFNet.cpp:
1000         (WebCore::ResourceHandle::createCFURLConnection): Updated for m_password
1001         name change.
1002         (WebCore::ResourceHandle::willSendRequest): Updated for m_password and
1003         password name changes.
1004         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication): Ditto.
1005
1006         * platform/network/curl/CurlProxySettings.cpp:
1007         (WebCore::CurlProxySettings::setUserPass): Updated for setPassword name change.
1008         (WebCore::createProxyUrl): Use hasCredentials, updated for password name change.
1009         * platform/network/curl/CurlProxySettings.h:
1010         (WebCore::CurlProxySettings::password const): Updated for password name change.
1011
1012         * platform/network/curl/ResourceHandleCurl.cpp:
1013         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): Updated for
1014         m_password name change.
1015         (WebCore::ResourceHandle::getCredential): Ditto.
1016         (WebCore::ResourceHandle::willSendRequest): Updated for m_password and
1017         password name changes.
1018
1019         * platform/network/mac/ResourceHandleMac.mm:
1020         (WebCore::ResourceHandle::createNSURLConnection): Updated for m_password
1021         and setPassword name changes.
1022         (WebCore::ResourceHandle::willSendRequest): Ditto.
1023         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication): Ditto.
1024
1025         * platform/network/soup/ResourceRequestSoup.cpp:
1026         (WebCore::ResourceRequest::createSoupURI const): Updated for password name change.
1027         * platform/network/soup/URLSoup.cpp:
1028         (WebCore::soupURIToURL): Updated for setPassword name change.
1029
1030         * platform/win/PasteboardWin.cpp:
1031         (WebCore::writeURL): Updated since lastPathComponent returns a StringView.
1032         (WebCore::filesystemPathFromUrlOrTitle): Ditto.
1033         (WebCore::Pasteboard::write): Ditto.
1034
1035         * style/StyleBuilderState.cpp:
1036         (WebCore::Style::BuilderState::createFilterOperations): Updated since
1037         fragmentIdentifier returns a StringView.
1038
1039         * workers/WorkerLocation.cpp:
1040         (WebCore::WorkerLocation::port const): Streamlined.
1041         (WebCore::WorkerLocation::pathname const): Use an ASCIILiteral.
1042         (WebCore::WorkerLocation::search const): Use queryWithLeadingQuestionMark.
1043         (WebCore::WorkerLocation::hash const): Use fragmentIdentifierWithLeadingNumberSign.
1044
1045         * workers/service/ServiceWorkerRegistrationKey.cpp:
1046         (WebCore::ServiceWorkerRegistrationKey::ServiceWorkerRegistrationKey):
1047         Updated for hasFragmentIdentifier name change.
1048
1049         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1050         (WebCore::topOriginURL): Simplified code to set port.
1051         * workers/service/server/SWServer.cpp:
1052         (WebCore::originURL): Ditto.
1053
1054         * xml/XMLHttpRequest.cpp:
1055         (WebCore::XMLHttpRequest::open): Updated for setPassword name change.
1056
1057 2020-04-25  Chris Fleizach  <cfleizach@apple.com>
1058
1059         AX: Improve tracking of Element* pointers in AXObjectCache with WeakHashSet
1060         https://bugs.webkit.org/show_bug.cgi?id=210879
1061
1062         Reviewed by Daniel Bates.
1063
1064         * accessibility/AXObjectCache.cpp:
1065         (WebCore::AXObjectCache::remove):
1066         (WebCore::AXObjectCache::handleFocusedUIElementChanged):
1067         (WebCore::filterListForRemoval):
1068         (WebCore::AXObjectCache::performDeferredCacheUpdate):
1069         * accessibility/AXObjectCache.h:
1070
1071 2020-04-25  Antoine Quint  <graouts@apple.com>
1072
1073         [Web Animations] KeyframeEffect should ensure its target remains alive
1074         https://bugs.webkit.org/show_bug.cgi?id=211019
1075
1076         Reviewed by Daniel Bates.
1077
1078         Test: webanimations/keyframe-effect-target-kept-alive.html
1079
1080         Make KeyframeEffect::m_target a RefPtr so that assigning an element to effect.target guarantees that element
1081         is kept alive even if there are no other references to that element.
1082
1083         * animation/KeyframeEffect.cpp:
1084         (WebCore::KeyframeEffect::KeyframeEffect):
1085         (WebCore::KeyframeEffect::setTarget):
1086         * animation/KeyframeEffect.h:
1087
1088 2020-04-25  Zalan Bujtas  <zalan@apple.com>
1089
1090         [LFC][TFC] Cleanup TableFormattingContext::layoutInFlowContent
1091         https://bugs.webkit.org/show_bug.cgi?id=211023
1092
1093         Reviewed by Sam Weinig.
1094
1095         Move some code to dedicated functions.
1096
1097         * layout/tableformatting/TableFormattingContext.cpp:
1098         (WebCore::Layout::TableFormattingContext::layoutInFlowContent):
1099         (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells):
1100         (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows):
1101         (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
1102         (WebCore::Layout::TableFormattingContext::layoutCell):
1103         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace):
1104         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace):
1105         (WebCore::Layout::TableFormattingContext::initializeDisplayBoxToBlank const): Deleted.
1106         (WebCore::Layout::TableFormattingContext::setComputedGeometryForRows): Deleted.
1107         (WebCore::Layout::TableFormattingContext::setComputedGeometryForSections): Deleted.
1108         * layout/tableformatting/TableFormattingContext.h:
1109         * layout/tableformatting/TableFormattingContextGeometry.cpp:
1110         (WebCore::Layout::TableFormattingContext::Geometry::cellHeigh const):
1111         (WebCore::Layout::TableFormattingContext::Geometry::computedColumnWidth const):
1112         (WebCore::Layout::TableFormattingContext::Geometry::tableCellHeightAndMargin const): Deleted.
1113
1114 2020-04-25  Joonghun Park  <jh718.park@samsung.com>
1115
1116         Unreviewed. Remove the build warning below since r260247.
1117         warning: unused parameter ‘foo’ [-Wunused-parameter]
1118
1119         No new tests, no new behaviors.
1120
1121         * testing/Internals.cpp:
1122         (WebCore::Internals::hasSandboxIOKitOpenAccessToClass):
1123
1124 2020-04-24  Chris Dumez  <cdumez@apple.com>
1125
1126         [iOS] Unable to sign up on twitter.com
1127         https://bugs.webkit.org/show_bug.cgi?id=211003
1128         <rdar://problem/58804852>
1129
1130         Reviewed by Darin Adler.
1131
1132         This is similar to the bug we had on nytimes.com and that was fixed in
1133         r258767. However, instead of a 'resize' event, it is a 'change' event
1134         on a MediaQueryList that is getting twitter.com in a bad state.
1135
1136         The issue is that when we home out of Safari, SpringBoard takes does
1137         a snapshot sequence at various sizes / orientations and this causes
1138         many JS events to get fired (e.g. 'resize', 'orientationchange',
1139         'change', ...), which can get some sites in a bad state. To address
1140         the issue, we now prevent firing of ALL JS events during the
1141         SpringBoard snapshot, instead of merely preventing the 'resize' ones.
1142
1143         * dom/EventTarget.cpp:
1144         (WebCore::EventTarget::fireEventListeners):
1145         * page/FrameView.cpp:
1146         (WebCore::FrameView::sendResizeEventIfNeeded):
1147         * page/Page.h:
1148         (WebCore::Page::shouldFireEvents const):
1149         (WebCore::Page::setShouldFireEvents):
1150         (WebCore::Page::shouldFireResizeEvents const): Deleted.
1151         (WebCore::Page::setShouldFireResizeEvents): Deleted.
1152
1153 2020-04-24  Saam Barati  <sbarati@apple.com>
1154
1155         Return BigInt32 whenever we can
1156         https://bugs.webkit.org/show_bug.cgi?id=210922
1157
1158         Reviewed by Yusuke Suzuki.
1159
1160         * bindings/js/SerializedScriptValue.cpp:
1161         (WebCore::CloneDeserializer::readBigInt):
1162
1163 2020-04-24  Yusuke Suzuki  <ysuzuki@apple.com>
1164
1165         [WTF] allThreads registration is racy with allThreads unregistration
1166         https://bugs.webkit.org/show_bug.cgi?id=210995
1167         <rdar://problem/61609690>
1168
1169         Reviewed by Keith Miller.
1170
1171         * page/cocoa/ResourceUsageThreadCocoa.mm:
1172         (WebCore::ResourceUsageThread::platformCollectCPUData):
1173
1174 2020-04-24  Wenson Hsieh  <wenson_hsieh@apple.com>
1175
1176         Make some more adjustments to TextManipulationController's paragraph boundary heuristic
1177         https://bugs.webkit.org/show_bug.cgi?id=210993
1178         <rdar://problem/61571299>
1179
1180         Reviewed by Tim Horton.
1181
1182         Adjust the heuristic added in r260583 to account for a few more common scenarios where we currently consider
1183         text as a part of the same paragraph. This can lead to many issues during text manipulation where text is moved
1184         between these elements, when it should not be.
1185
1186         The new scenarios include block and inline-block links, as well as button elements.
1187
1188         Test: TextManipulation.StartTextManipulationTreatsInlineBlockLinksAndButtonsAsParagraphs
1189
1190         * editing/TextManipulationController.cpp:
1191         (WebCore::TextManipulationController::observeParagraphs):
1192
1193         Additionally rename "paragraph boundary element" to "item boundary element", to avoid colliding with the
1194         existing notion of paragraph boundaries in editing code.
1195
1196 2020-04-24  Christopher Reid  <chris.reid@sony.com>
1197
1198         [Win] Bundle Inspector Resources in Release builds
1199         https://bugs.webkit.org/show_bug.cgi?id=210942
1200
1201         Reviewed by Fujii Hironori.
1202
1203         * CMakeLists.txt:
1204
1205 2020-04-24  Antoine Quint  <graouts@apple.com>
1206
1207         [Web Animations] Ensure calling Web Animations APIs override future CSS Animations style properties
1208         https://bugs.webkit.org/show_bug.cgi?id=210988
1209
1210         Reviewed by Dean Jackson.
1211
1212         The CSS Animations Level 2 spec specifies how the Web Animations APIs and the CSS Animations style
1213         properties should interact in https://drafts.csswg.org/css-animations-2/#animations. This patch
1214         implements the specified behavior and this is reflected by progress on the relevant WPT tests.
1215
1216         The gist of this change is that once a Web Animations API is called on an animation created using
1217         CSS Animations, any changes made to related CSS Animations style properties on the target element
1218         will be ignored so that the overrides applied via the Web Animations API remain in effect.
1219
1220         For instance, calling pause() or play() in a way that changes the playback state of the CSS Animation
1221         will mean that future changes to the CSS animation-play-state property are ignored.
1222
1223         To do this we make more IDL properties and methods use dedicated methods to distinguish between the
1224         bindings entry-point and internal usage of the same methods to integrate the behavior only when the
1225         API itself is being used.
1226
1227         * animation/AnimationEffect.cpp:
1228         (WebCore::AnimationEffect::getBindingsTiming const): Ensure we flush styles when animation.effect.getTiming()
1229         is called.
1230         (WebCore::AnimationEffect::getBindingsComputedTiming const): Ensure we flush styles when
1231         animation.effect.getComputedTiming() is called.
1232         (WebCore::AnimationEffect::bindingsUpdateTiming): Notify the associated CSSAnimation object, if any, when
1233         animation.effect.updateTiming() is called such that the CSSAnimation may apply the relevant overrides.
1234         * animation/AnimationEffect.h:
1235         * animation/AnimationEffect.idl:
1236         * animation/CSSAnimation.cpp:
1237         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Only apply new values of CSS Animations style
1238         properties if there are no overrides for them resulting from calling related Web Animations APIs.
1239         (WebCore::CSSAnimation::bindingsPlay): Mark animation-play-state as overridden if play() is called.
1240         (WebCore::CSSAnimation::bindingsPause): Mark animation-play-state as overridden if pause() is called.
1241         (WebCore::CSSAnimation::setBindingsEffect): Mark all animation style properties, except for animation-name
1242         and animation-play-state as overridden if animation.effect is set.
1243         (WebCore::CSSAnimation::setBindingsStartTime): Mark animation-play-state as overridden if animation.startTime
1244         is set.
1245         (WebCore::CSSAnimation::bindingsReverse): Mark animation-play-state as overridden if reverse() is called.
1246         (WebCore::CSSAnimation::effectTimingWasUpdatedUsingBindings): Mark each CSS property associated with a key
1247         found on the timing object passed to animation.effect.updateTiming() as overridden.
1248         (WebCore::CSSAnimation::effectKeyframesWereSetUsingBindings): Mark animation-timing-function as overridden
1249         if animation.effect.setKeyframes() is called.
1250         * animation/CSSAnimation.h:
1251         * animation/DeclarativeAnimation.cpp:
1252         (WebCore::DeclarativeAnimation::bindingsStartTime const):
1253         (WebCore::DeclarativeAnimation::setBindingsStartTime):
1254         (WebCore::DeclarativeAnimation::startTime const): Deleted.
1255         (WebCore::DeclarativeAnimation::setStartTime): Deleted.
1256         * animation/DeclarativeAnimation.h:
1257         * animation/KeyframeEffect.cpp:
1258         (WebCore::KeyframeEffect::getBindingsKeyframes): Ensure we flush styles when animation.effect.getKeyframes()
1259         is called.
1260         (WebCore::KeyframeEffect::getKeyframes): Only use the CSS-originated animation path if we don't have JS-originated
1261         keyframes.
1262         (WebCore::KeyframeEffect::setBindingsKeyframes): Notify the associated CSSAnimation object, if any, when
1263         animation.effect.setKeyframes() is called such that the CSSAnimation may apply the relevant overrides.
1264         (WebCore::KeyframeEffect::processKeyframes): Correctly return early if part of the processing yields an exception.
1265         * animation/KeyframeEffect.h:
1266         * animation/KeyframeEffect.idl:
1267         * animation/WebAnimation.cpp:
1268         (WebCore::WebAnimation::setBindingsEffect):
1269         (WebCore::WebAnimation::setBindingsStartTime):
1270         (WebCore::WebAnimation::bindingsReverse):
1271         * animation/WebAnimation.h:
1272         (WebCore::WebAnimation::bindingsEffect const):
1273         (WebCore::WebAnimation::bindingsStartTime const):
1274         * animation/WebAnimation.idl:
1275
1276 2020-04-24  Chris Dumez  <cdumez@apple.com>
1277
1278         ASSERTION FAILED: m_wrapper under HTMLMediaElement::setIsPlayingToWirelessTarget
1279         https://bugs.webkit.org/show_bug.cgi?id=210983
1280         <rdar://problem/61611994>
1281
1282         Reviewed by Eric Carlson.
1283
1284         The issue was that we were trying to fire a JS event as a result of ActiveDOMObject::stop()
1285         getting called, which is not allowed. To address the issue, we avoid firing the event if
1286         the context is already stopped.
1287
1288         No new tests, already covered by:
1289         media/modern-media-controls/placard-support/placard-support-airplay-fullscreen.html
1290
1291         * html/HTMLMediaElement.cpp:
1292         (WebCore::HTMLMediaElement::setIsPlayingToWirelessTarget):
1293
1294 2020-04-24  Tim Horton  <timothy_horton@apple.com>
1295
1296         iPad: "Pocket City" interaction does not work with trackpad
1297         https://bugs.webkit.org/show_bug.cgi?id=210985
1298         <rdar://problem/62273077>
1299
1300         Reviewed by Wenson Hsieh.
1301
1302         * platform/RuntimeApplicationChecks.h:
1303         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
1304         (WebCore::IOSApplication::isPocketCity):
1305
1306 2020-04-24  Tomoki Imai  <Tomoki.Imai@sony.com>
1307
1308         [OpenSSL] Implement WebCrypto APIs for HMAC
1309         https://bugs.webkit.org/show_bug.cgi?id=210902
1310
1311         Reviewed by Don Olmstead.
1312
1313         Support WebCrypto HMAC sign/verify with OpenSSL.
1314         The design and some functions are inherited from the other ports.
1315
1316         * crypto/openssl/CryptoAlgorithmHMACOpenSSL.cpp:
1317         (WebCore::HMACAlgorithm): Added. Helper function to map CryptoAlgorithmIdentifier to OpenSSL EVP_MD type.
1318         (WebCore::calculateSignature): Added. Helper function to calculate the signature for sign/verify.
1319         (WebCore::CryptoAlgorithmHMAC::platformSign): Implemented, mostly same as the other ports.
1320         (WebCore::CryptoAlgorithmHMAC::platformVerify): Implemented, mostly same as the other ports.
1321         * crypto/openssl/CryptoAlgorithmRegistryOpenSSL.cpp:
1322         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Added CryptoAlgorithmHMAC support.
1323         * crypto/openssl/OpenSSLCryptoUniquePtr.h: Added specialized unique_ptrs for EVP_MD_CTX and EVP_PKEY.
1324         (WebCore::OpenSSLCryptoPtrDeleter<EVP_MD_CTX>::operator() const):
1325         (WebCore::OpenSSLCryptoPtrDeleter<EVP_PKEY>::operator() const):
1326
1327 2020-04-24  Brian Burg  <bburg@apple.com>
1328
1329         Web Automation: timeout underneath Automation.evaluateJavaScriptFunction in Selenium test frame_switching_tests.py::testShouldNotBeAbleToDoAnythingTheFrameIsDeletedFromUnderUs[Safari]
1330         https://bugs.webkit.org/show_bug.cgi?id=210162
1331         <rdar://problem/60561009>
1332
1333         Reviewed by Devin Rousso.
1334
1335         * page/DOMWindow.h: Expose DOMWindow::{register, unregister}Observer.
1336
1337 2020-04-24  Zalan Bujtas  <zalan@apple.com>
1338
1339         [LFC][TFC] Take first in-flow table-row baseline into account when computing cell baseline
1340         https://bugs.webkit.org/show_bug.cgi?id=210972
1341
1342         Reviewed by Antti Koivisto.
1343
1344         Check if the cell has a nested table and use its first row as the baseline for the cell (unless there's an IFC before).
1345
1346         Test: fast/layoutformattingcontext/table-basic-row-baseline-with-nested-table.html
1347
1348         * layout/tableformatting/TableFormattingContext.cpp:
1349         (WebCore::Layout::TableFormattingContext::layoutCell):
1350         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace):
1351         * layout/tableformatting/TableFormattingContext.h:
1352         * layout/tableformatting/TableFormattingContextGeometry.cpp:
1353         (WebCore::Layout::TableFormattingContext::Geometry::usedBaselineForCell):
1354         * layout/tableformatting/TableGrid.h:
1355         (WebCore::Layout::TableGrid::Row::setBaselineOffset):
1356         (WebCore::Layout::TableGrid::Row::baselineOffset const):
1357
1358 2020-04-24  Antti Koivisto  <antti@apple.com>
1359
1360         Nullptr crash in objc_msgSend under WebCore::genericFamily
1361         https://bugs.webkit.org/show_bug.cgi?id=210911
1362         <rdar://problem/61510208>
1363
1364         Reviewed by Geoffrey Garen.
1365
1366         Speculative fix.
1367
1368         * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
1369         (WebCore::genericFamily):
1370
1371         Test that CTFontDescriptorCopyAttribute is really returning CFStringRef.
1372         Also explicitly return String from lambda to clarify lifetimes.
1373
1374 2020-04-24  Simon Fraser  <simon.fraser@apple.com>
1375
1376         Move some post-renderingUpdate code into WebCore
1377         https://bugs.webkit.org/show_bug.cgi?id=210952
1378
1379         Reviewed by Antti Koivisto.
1380
1381         Factor some code called by the various DrawingArea subclasses into Page::finalizeRenderingUpdate(),
1382         with some flags to control behavior that differs between drawing areas.
1383
1384         ScrollingCoordinator::commitTreeStateIfNeeded() is a no-op for RemoteScrollingCoordinator so
1385         it's fine to always call it.
1386
1387         * page/Page.cpp:
1388         (WebCore::Page::passiveTouchEventListenerRectsForTesting):
1389         (WebCore::Page::finalizeRenderingUpdate):
1390         * page/Page.h:
1391
1392 2020-04-24  Adrian Perez de Castro  <aperez@igalia.com>
1393
1394         Add missing HTMLNames:: namespace prefix to usage of liTag object
1395
1396         Unreviewed build fix.
1397
1398         No new tests needed.
1399
1400         * editing/TextManipulationController.cpp:
1401         (WebCore::TextManipulationController::observeParagraphs):
1402
1403 2020-04-23  Rob Buis  <rbuis@igalia.com>
1404
1405         Make CachedResourceLoader more conforming to Fetch specification
1406         https://bugs.webkit.org/show_bug.cgi?id=210925
1407
1408         Reviewed by Alex Christensen.
1409
1410         Make CachedResourceLoader more conforming to Fetch specification
1411         by fixing links, re-ordering steps to match main fetch [1] and do
1412         early exit code paths earlier.
1413
1414         * loader/cache/CachedResourceLoader.cpp:
1415         (WebCore::CachedResourceLoader::requestImage): adjust to parameter change.
1416         (WebCore::CachedResourceLoader::canRequest): replace CachedResourceRequest param with ResourceLoaderOptions.
1417         (WebCore::CachedResourceLoader::prepareFetch): fix comment.
1418         (WebCore::CachedResourceLoader::requestResource): re-order.
1419         * loader/cache/CachedResourceLoader.h:
1420
1421 2020-04-23  Simon Fraser  <simon.fraser@apple.com>
1422
1423         Move the storage of DisplayID from Chrome to Page
1424         https://bugs.webkit.org/show_bug.cgi?id=210943
1425
1426         Reviewed by Tim Horton.
1427
1428         The less Chrome knows about Frames and Documents the better. At some point Page is going
1429         to talk to ScrollingCoordinator in this callback too.
1430
1431         * page/Chrome.cpp:
1432         (WebCore::Chrome::displayID const):
1433         (WebCore::Chrome::windowScreenDidChange):
1434         * page/Chrome.h:
1435         * page/Page.cpp:
1436         (WebCore::Page::windowScreenDidChange):
1437         * page/Page.h:
1438         (WebCore::Page::displayID const):
1439
1440 2020-04-23  Simon Fraser  <simon.fraser@apple.com>
1441
1442         EventHandler::selectCursor() has broken resize over coordinate conversion code
1443         https://bugs.webkit.org/show_bug.cgi?id=210778
1444
1445         Reviewed by Zalan Bujtas.
1446
1447         EventHandler::selectCursor() appeared to make a local hit-test point from window
1448         to content coordinates, which made no sense, but this happened to work because 
1449         RenderLayer::hitTestLayer() set the HitTestResult localPoint to a global point
1450         if you hit the resizer.
1451
1452         Clean up this mess by having all resizer-related geometry queries be in local coordinates.
1453
1454         As a bonus, actually set the cursor to a resize cursor when over the resizer.
1455
1456         Test: fast/events/cursors/mouse-cursor-over-resizer.html
1457
1458         * page/EventHandler.cpp:
1459         (WebCore::EventHandler::selectCursor):
1460         (WebCore::EventHandler::handleMousePressEvent):
1461         * rendering/RenderLayer.cpp:
1462         (WebCore::RenderLayer::resize):
1463         (WebCore::RenderLayer::offsetFromResizeCorner const):
1464         (WebCore::RenderLayer::isPointInResizeControl const):
1465         (WebCore::RenderLayer::hitTestLayer):
1466         (WebCore::RenderLayer::hitTestResizerInFragments const):
1467         * rendering/RenderLayer.h:
1468
1469 2020-04-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1470
1471         Text manipulation does not account for text in fully clipped containers
1472         https://bugs.webkit.org/show_bug.cgi?id=210940
1473         <rdar://problem/61137648>
1474
1475         Reviewed by Tim Horton.
1476
1477         Allow text manipulation to find both text in `visibility: hidden;` containers, as well as text in fully clipped
1478         overflow containers. In both cases, renderers exist for these nodes, but TextIterator ignores them by default.
1479         If these containers become visible in the future, we don't want to skip out on performing text manipulation on
1480         them.
1481
1482         An alternative would be to detect when any element that has not undergone text manipulation has become visible
1483         (i.e. no longer clipped by an ancestor), but this is likely more complicated (and possibly less performant) than
1484         just eagerly extracting text from hidden containers, once they gain renderers.
1485
1486         TextManipulation.StartTextManipulationIncludesFullyClippedText
1487
1488         * editing/TextManipulationController.cpp:
1489         (WebCore::ParagraphContentIterator::ParagraphContentIterator):
1490         (WebCore::TextManipulationController::didCreateRendererForElement):
1491         (WebCore::TextManipulationController::scheduleObservationUpdate):
1492         (WebCore::TextManipulationController::scheduleObservartionUpdate): Deleted.
1493
1494         While I'm here, also rename scheduleObservartionUpdate to scheduleObservationUpdate.
1495
1496         * editing/TextManipulationController.h:
1497
1498 2020-04-23  Alex Christensen  <achristensen@webkit.org>
1499
1500         Allow credentials for same-origin css mask images
1501         https://bugs.webkit.org/show_bug.cgi?id=210895
1502         <rdar://problem/60093888>
1503
1504         Reviewed by Brent Fulgham.
1505
1506         Test: http/tests/security/css-mask-image-credentials.html
1507
1508         r230006 went a step too far in restricting what is allowed with css mask images.
1509         Basic authentication credentials should be allowed with such requests as they are in Chrome and Firefox.
1510         This can be seen by doing run-webkit-httpd then opening http://127.0.0.1:8000/security/css-mask-image-credentials.html
1511         In Chrome and Firefox you'll see it forward to a page that has a blue square.
1512         In Safari before this change you'll see a yellow square and a basic authentication prompt.
1513         In Safari after this change you'll see the same blue square you see in Chrome and Firefox.
1514
1515         * style/StylePendingResources.cpp:
1516         (WebCore::Style::loadPendingImage):
1517
1518 2020-04-23  Alex Christensen  <achristensen@webkit.org>
1519
1520         Jesus Calling app needs more WebSQL
1521         https://bugs.webkit.org/show_bug.cgi?id=210889
1522         <rdar://problem/61795507>
1523
1524         Reviewed by Chris Dumez.
1525
1526         Manually verified this fixes the issue in the radar.
1527
1528         * bindings/js/JSDOMWindowCustom.cpp:
1529         (WebCore::jsDOMWindowInstanceFunctionOpenDatabaseBody):
1530
1531 2020-04-23  Rob Buis  <rbuis@igalia.com>
1532
1533         Move applyUserAgentIfNeeded calls to a more central place
1534         https://bugs.webkit.org/show_bug.cgi?id=209587
1535
1536         Reviewed by Darin Adler.
1537
1538         Make main resource loads stop calling applyUserAgentIfNeeded
1539         and instead do it in the CachedResourceLoader.
1540
1541         * loader/FrameLoader.cpp:
1542         (WebCore::FrameLoader::addExtraFieldsToRequest):
1543         (WebCore::FrameLoader::loadResourceSynchronously):
1544         * loader/appcache/ApplicationCacheGroup.cpp:
1545         (WebCore::ApplicationCacheGroup::createRequest):
1546         * loader/cache/CachedResourceLoader.cpp:
1547         (WebCore::CachedResourceLoader::updateHTTPRequestHeaders):
1548         (WebCore::CachedResourceLoader::requestResource):
1549         * loader/cache/CachedResourceLoader.h:
1550         * loader/cache/CachedResourceRequest.cpp:
1551         (WebCore::CachedResourceRequest::updateReferrerAndOriginHeaders):
1552         (WebCore::CachedResourceRequest::updateUserAgentHeader):
1553         (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders): Deleted.
1554         * loader/cache/CachedResourceRequest.h:
1555
1556 2020-04-23  Kenneth Russell  <kbr@chromium.org>
1557
1558         [WebGL2] Update texture packing code for software uploads from DOM
1559         https://bugs.webkit.org/show_bug.cgi?id=209515
1560
1561         Reviewed by Dean Jackson.
1562
1563         Update the bottommost DOM-to-texture packing code in
1564         GraphicsContextGLOpenGL and FormatConverter to full WebGL 2.0
1565         capability. Reorganize some code to make side-by-side comparisons
1566         easier with other WebGL 2.0 implementations.
1567
1568         Added NEEDS_PORT comments to areas in the calling code which need
1569         particular attention in subsequent patches. Roughly two more
1570         patches will be needed on top of this one in order to fully pass
1571         the associated conformance tests.
1572
1573         Fix a bug in the non-ANGLE ENABLE(WEBGL2) code path which
1574         accidentally disabled WebGL entirely in this configuration.
1575
1576         Covered by the WebGL 2.0 conformance tests.
1577
1578         * html/canvas/WebGLRenderingContextBase.cpp:
1579         (WebCore::WebGLRenderingContextBase::create):
1580         (WebCore::WebGLRenderingContextBase::copyTexSubImage2D):
1581         (WebCore::WebGLRenderingContextBase::readPixels):
1582         (WebCore::WebGLRenderingContextBase::texImageSource2D):
1583         (WebCore::WebGLRenderingContextBase::texImage2DImpl):
1584         (WebCore::WebGLRenderingContextBase::texImage2D):
1585         (WebCore::WebGLRenderingContextBase::texSubImage2DImpl):
1586         (WebCore::WebGLRenderingContextBase::texSubImage2D):
1587         (WebCore::WebGLRenderingContextBase::validateTexFuncData):
1588         (WebCore::WebGLRenderingContextBase::getPackPixelStoreParams const):
1589         (WebCore::WebGLRenderingContextBase::getUnpackPixelStoreParams const):
1590         * html/canvas/WebGLRenderingContextBase.h:
1591         * platform/graphics/FormatConverter.cpp:
1592         (WebCore::convertFloatToHalfFloat):
1593         (WebCore::float>):
1594         (WebCore::uint8_t>):
1595         (WebCore::uint16_t>):
1596         (WebCore::int8_t>):
1597         (WebCore::int16_t>):
1598         (WebCore::uint32_t>):
1599         (WebCore::int32_t>):
1600         (WebCore::FormatConverter::convert):
1601         * platform/graphics/FormatConverter.h:
1602         (WebCore::FormatConverter::FormatConverter):
1603         * platform/graphics/GraphicsContextGL.h:
1604         (WebCore::GraphicsContextGL::hasAlpha):
1605         (WebCore::GraphicsContextGL::hasColor):
1606         * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
1607         (WebCore::GraphicsContextGLOpenGL::texImage2DResourceSafe):
1608         (WebCore::GraphicsContextGLOpenGL::computeFormatAndTypeParameters):
1609         (WebCore::GraphicsContextGLOpenGL::computeImageSizeInBytes):
1610         (WebCore::GraphicsContextGLOpenGL::PixelStoreParams::PixelStoreParams):
1611         (WebCore::GraphicsContextGLOpenGL::packImageData):
1612         (WebCore::GraphicsContextGLOpenGL::extractImageData):
1613         (WebCore::GraphicsContextGLOpenGL::extractTextureData):
1614         (WebCore::TexelBytesForFormat):
1615         (WebCore::GraphicsContextGLOpenGL::packPixels):
1616         * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
1617
1618 2020-04-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1619
1620         Add a heuristic for text manipulation to treat some list items as paragraph boundaries
1621         https://bugs.webkit.org/show_bug.cgi?id=210915
1622         <rdar://problem/61907080>
1623
1624         Reviewed by Megan Gardner.
1625
1626         Adds a mechanism to allow text manipulation to emit an item containing the current list of text manipulation
1627         tokens early, in the case where the paragraph content iterator crosses the boundary of an element that encloses
1628         a paragraph. Currently, the only enclosing paragraph element will be list items that have `display: block;`,
1629         which we can take as a hint that the text in these list items should be vended as separate items, rather than as
1630         tokens in a single item.
1631
1632         This may be extended in the future to other situations by adjusting logic in `isEnclosingParagraphElement`.
1633
1634         Test: TextManipulation.StartTextManipulationBreaksParagraphInBetweenListItems
1635
1636         * editing/TextManipulationController.cpp:
1637         (WebCore::TextManipulationController::observeParagraphs):
1638
1639 2020-04-23  Zalan Bujtas  <zalan@apple.com>
1640
1641         [LFC][TFC] Add support for basic baseline align inside a table row
1642         https://bugs.webkit.org/show_bug.cgi?id=210918
1643
1644         Reviewed by Antti Koivisto.
1645
1646         Test: fast/layoutformattingcontext/table-basic-row-baseline-align.html
1647
1648         The minimum height of a row is defined as the height of an hypothetical linebox containing
1649         the cells originating in the row. In this hypothetical linebox, we use baseline alignment to
1650         align the cells vertically.
1651         Use these vertically aligned cells to compute the final row height.  
1652
1653         * layout/displaytree/DisplayBox.h:
1654         (WebCore::Display::Box::verticalMarginBorderAndPadding const):
1655         (WebCore::Display::Box::setVerticalPadding):
1656         * layout/tableformatting/TableFormattingContext.cpp:
1657         (WebCore::Layout::TableFormattingContext::layoutInFlowContent):
1658         (WebCore::Layout::TableFormattingContext::layoutCell):
1659         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace):
1660         * layout/tableformatting/TableFormattingContext.h:
1661
1662 2020-04-23  Sihui Liu  <sihui_liu@apple.com>
1663
1664         TextManipulationController should set range of paragraph using token's positions
1665         https://bugs.webkit.org/show_bug.cgi?id=210866
1666         <rdar://problem/60646283>
1667
1668         Reviewed by Wenson Hsieh.
1669
1670         Set the range of paragraph using positions of first token and last token in the paragraph because:
1671         1. Accurate range makes token matching in TextManipulationController::replace() easier, as TextIterator could 
1672         visit different positions with different ranges or different conditions. For example, in our previous 
1673         implementation, start of a paragraph can be set as the first visible position of document, while position of 
1674         first token is after that. Then in replace(), TextManipulationController may extract a word before the position 
1675         of first token and return error. See added test TextManipulation.CompleteTextManipulationCorrectParagraphRange.
1676         2. TextManipulationController can handle fewer content and this is less error-prone. For example, svg elements 
1677         before/after the paragraph text will not be identified as tokens [] in a paragraph now. See updated API tests 
1678         for example.
1679
1680         New test: TextManipulation.CompleteTextManipulationCorrectParagraphRange
1681
1682         * editing/TextManipulationController.cpp:
1683         (WebCore::ParagraphContentIterator::moveCurrentNodeForward): m_currentNodeForFindingInvisibleContent should not 
1684         be advanced if it is already at the end.
1685         (WebCore::containsOnlyHTMLSpaces):
1686         (WebCore::TextManipulationController::observeParagraphs):Set the paragraph start as the position of the first 
1687         token and end as the position of last token. If the paragraph is split with <br>, the end will be extended to 
1688         position of <br> so that we can add this node back later; otherwise, <br> can be removed after original 
1689         text of paragraph is removed in TextManipulationController::replace(). Also, stop identifying spaces as tokens 
1690         because non-text Node can emit spaces.
1691         (WebCore::TextManipulationController::replace): Only identify tokens from content with meaningful text.
1692
1693 2020-04-23  Chris Dumez  <cdumez@apple.com>
1694
1695         [ Mac wk2 ] imported/w3c/web-platform-tests/notifications/event-onclose.html is flaky failing.
1696         https://bugs.webkit.org/show_bug.cgi?id=209483
1697         <rdar://problem/60830377>
1698
1699         Reviewed by Geoff Garen.
1700
1701         Align garbage collection of Notification JS wrapper with the specification:
1702         - https://notifications.spec.whatwg.org/#garbage-collection [1]
1703
1704         In particular, the following changes were made:
1705         1. Instead of using the legacy setPendingActivity() / unsetPendingActivity(), override
1706            ActiveDOMObject::virtualHasPendingActivity() to implement the behavior documented
1707            in the specification.
1708         2. Keep the wrapper alive as long as the notification is showing and as long as there
1709            are relevant event listeners, as per [1]. Previously, we failed to check for event
1710            listeners, which was suboptimal.
1711         3. Update the constructor to queue a task on the event loop in order to show the
1712            notification asynchronously, instead of relying on a SuspendableTimer for this
1713            purpose. Previously, the JS wrapper could get collected between construction and
1714            the notification getting shown, which was leading to the test flakiness.
1715
1716         No new tests, unskipped existing test.
1717
1718         * Modules/notifications/Notification.cpp:
1719         (WebCore::Notification::Notification):
1720         (WebCore::Notification::show):
1721         (WebCore::Notification::finalize):
1722         (WebCore::Notification::dispatchShowEvent):
1723         (WebCore::Notification::dispatchClickEvent):
1724         (WebCore::Notification::dispatchCloseEvent):
1725         (WebCore::Notification::dispatchErrorEvent):
1726         (WebCore::Notification::eventListenersDidChange):
1727         (WebCore::Notification::virtualHasPendingActivity const):
1728         * Modules/notifications/Notification.h:
1729
1730 2020-04-23  Andres Gonzalez  <andresg_22@apple.com>
1731
1732         Correction for patch 397001.
1733         https://bugs.webkit.org/show_bug.cgi?id=210914
1734
1735         Reviewed by Chris Fleizach.
1736
1737         - No need to check for isEmpty when retrieving the primary screen size,
1738         as pointed out by Darin Adler in bug 210760, patch 397001.
1739         - Added some helpful AXLOGing.
1740
1741         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1742         (-[WebAccessibilityObjectWrapper primaryScreenHeight]):
1743         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1744         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
1745         (-[WebAccessibilityObjectWrapper accessibilityArrayAttributeValues:index:maxCount:]):
1746
1747 2020-04-23  Don Olmstead  <don.olmstead@sony.com>
1748
1749         [CMake] Add WebKit::WebCoreTestSupport target
1750         https://bugs.webkit.org/show_bug.cgi?id=210867
1751
1752         Unreviewed build fix.
1753
1754         Make the dependencies explicit.
1755
1756         * CMakeLists.txt:
1757
1758 2020-04-22  Simon Fraser  <simon.fraser@apple.com>
1759
1760         In the scrolling tree, separate wheel event handling from layer updating
1761         https://bugs.webkit.org/show_bug.cgi?id=210899
1762
1763         Reviewed by Antti Koivisto.
1764
1765         Working towards webkit.org/b/210884, it needs to be possible to have the scrolling
1766         tree handle a wheelEvent and update its internal state about scroll positions, but not
1767         immediately map those scroll positions onto CALayers.
1768
1769         To achieve this, have ScrollingTreeScrollingNode::currentScrollPositionChanged()
1770         not call applyLayerPositions(), or notifyRelatedNodesAfterScrollPositionChange() which
1771         just applies layer positions on related nodes.
1772
1773         Instead, at the end of wheel event handling, do a full scrolling tree traversal and update
1774         all the layer positions there.
1775
1776         Delegated scrolling (iOS) still needs notifyRelatedNodesAfterScrollPositionChange() so it
1777         can't be removed.
1778
1779         * page/scrolling/ScrollingTree.cpp:
1780         (WebCore::ScrollingTree::handleWheelEvent):
1781         (WebCore::ScrollingTree::applyLayerPositions):
1782         (WebCore::ScrollingTree::applyLayerPositionsInternal):
1783         * page/scrolling/ScrollingTree.h:
1784         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1785         (WebCore::ScrollingTreeScrollingNode::currentScrollPositionChanged):
1786
1787 2020-04-23  Charlie Turner  <cturner@igalia.com>
1788
1789         [EME][CDMProxy] Sort key status array lexicographically by key IDs
1790         https://bugs.webkit.org/show_bug.cgi?id=210659
1791
1792         Reviewed by Xabier Rodriguez-Calvar.
1793
1794         This is required by section 6.1 of
1795         https://www.w3.org/TR/encrypted-media/.
1796
1797         Test: encrypted-media/clearkey-keystatuses.https.html
1798
1799         * platform/encryptedmedia/CDMProxy.cpp:
1800         (WebCore::KeyStore::add): We could use a set here and keep it
1801         sorted by design, but this is more complexity than needed. The
1802         store has for practical purposes an upper limit of 2
1803         items. Sorting such a vector lowers to either a noop or a swap. So
1804         the simple approach here wins over using some kind of self-sorting
1805         set structure. I also considered only sorting on-demand, since it
1806         only has to appear sorted from the perspective of JS, we could
1807         sort the array in convertToJSKeyStatusVector. However, that is
1808         semantically a const method, so sorting here felt too surprising.
1809         * platform/encryptedmedia/CDMProxy.h:
1810         (WebCore::Key::operator<): Add a lexicographic comparator to
1811         Key.
1812
1813 2020-04-23  Carlos Garcia Campos  <cgarcia@igalia.com>
1814
1815         [GTK] excessive wakeups/polling due to gdk_frame_clock_begin_updating
1816         https://bugs.webkit.org/show_bug.cgi?id=210561
1817
1818         Reviewed by Žan Doberšek.
1819
1820         The problem is that we are destroying the display refresh monitor from the frame clock update callback, and GTK
1821         schedules another update from the callback itself in some cases, which ends up happening forever. We were
1822         assuming that destroying the window of immediately destroy the frame clock as well, but the paint source idle
1823         keeps a reference of the frame clock. At the end of the source idle callback the source is scheduled again,
1824         taking a new reference. We need to call gdk_frame_clock_end_updating() to ensure the idle is not scheduled
1825         again.
1826
1827         * platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp:
1828         (WebCore::DisplayRefreshMonitorGtk::~DisplayRefreshMonitorGtk): Disconnect the update signal and call
1829         gdk_frame_clock_end_updating().
1830         (WebCore::DisplayRefreshMonitorGtk::requestRefreshCallback): Toplevel window should always have a frame clock,
1831         so remove the early return and add an assert instead.
1832
1833 2020-04-23  Youenn Fablet  <youenn@apple.com>
1834
1835         getDisplayMedia is not respecting aspect ratio with max constraints
1836         https://bugs.webkit.org/show_bug.cgi?id=210858
1837
1838         Reviewed by Eric Carlson.
1839
1840         Add computation of exact frame size to respect aspect ratio in DisplayCaptureSourceCocoa::updateFrameSize.
1841         Refactor code to have one source class DisplayCaptureSourceCocoa and specific capturer for screen and window.
1842         This simplifies code and allows reusing DisplayCaptureSourceCocoa with a mock capturer.
1843         Update mock code to use DisplayCaptureSourceCocoa.
1844
1845         Tests: fast/mediastream/getDisplayMedia-max-constraints.html
1846                fast/mediastream/getDisplayMedia-max-constraints1.html
1847                fast/mediastream/getDisplayMedia-max-constraints2.html
1848                fast/mediastream/getDisplayMedia-max-constraints3.html
1849
1850         * SourcesCocoa.txt:
1851         * WebCore.xcodeproj/project.pbxproj:
1852         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
1853         (WebCore::DisplayCaptureManagerCocoa::updateDisplayCaptureDevices):
1854         (WebCore::DisplayCaptureManagerCocoa::updateWindowCaptureDevices):
1855         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID):
1856         (WebCore::DisplayCaptureManagerCocoa::windowCaptureDeviceWithPersistentID):
1857         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
1858         (WebCore::DisplayCaptureSourceCocoa::create):
1859         (WebCore::DisplayCaptureSourceCocoa::DisplayCaptureSourceCocoa):
1860         (WebCore::DisplayCaptureSourceCocoa::~DisplayCaptureSourceCocoa):
1861         (WebCore::DisplayCaptureSourceCocoa::capabilities):
1862         (WebCore::DisplayCaptureSourceCocoa::settings):
1863         (WebCore::DisplayCaptureSourceCocoa::startProducingData):
1864         (WebCore::DisplayCaptureSourceCocoa::stopProducingData):
1865         (WebCore::DisplayCaptureSourceCocoa::updateFrameSize):
1866         (WebCore::DisplayCaptureSourceCocoa::emitFrame):
1867         (WebCore::DisplayCaptureSourceCocoa::Capturer::setLogger):
1868         (WebCore::DisplayCaptureSourceCocoa::Capturer::logChannel const):
1869         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
1870         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
1871         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
1872         (WebCore::MockRealtimeVideoSourceMac::createForMockDisplayCapturer):
1873         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1874         * platform/mediastream/mac/ScreenDisplayCapturerMac.h: Added.
1875         * platform/mediastream/mac/ScreenDisplayCapturerMac.mm: Added.
1876         (WebCore::ScreenDisplayCapturerMac::create):
1877         (WebCore::ScreenDisplayCapturerMac::ScreenDisplayCapturerMac):
1878         (WebCore::ScreenDisplayCapturerMac::~ScreenDisplayCapturerMac):
1879         (WebCore::ScreenDisplayCapturerMac::createDisplayStream):
1880         (WebCore::ScreenDisplayCapturerMac::start):
1881         (WebCore::ScreenDisplayCapturerMac::stop):
1882         (WebCore::ScreenDisplayCapturerMac::generateFrame):
1883         (WebCore::ScreenDisplayCapturerMac::startDisplayStream):
1884         (WebCore::ScreenDisplayCapturerMac::commitConfiguration):
1885         (WebCore::ScreenDisplayCapturerMac::displayWasReconfigured):
1886         (WebCore::ScreenDisplayCapturerMac::displayReconfigurationCallBack):
1887         (WebCore::ScreenDisplayCapturerMac::newFrame):
1888         (WebCore::ScreenDisplayCapturerMac::screenCaptureDeviceWithPersistentID):
1889         (WebCore::ScreenDisplayCapturerMac::screenCaptureDevices):
1890         * platform/mediastream/mac/WindowDisplayCapturerMac.h: Added.
1891         * platform/mediastream/mac/WindowDisplayCapturerMac.mm: ddedAdded.
1892         (WebCore::WindowDisplayCapturerMac::create):
1893         (WebCore::WindowDisplayCapturerMac::WindowDisplayCapturerMac):
1894         (WebCore::WindowDisplayCapturerMac::windowImage):
1895         (WebCore::WindowDisplayCapturerMac::generateFrame):
1896         (WebCore::WindowDisplayCapturerMac::windowCaptureDeviceWithPersistentID):
1897         (WebCore::WindowDisplayCapturerMac::windowCaptureDevices):
1898         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1899         (WebCore::MockDisplayCapturer::MockDisplayCapturer):
1900         (WebCore::MockDisplayCapturer::start):
1901         (WebCore::MockDisplayCapturer::generateFrame):
1902         * platform/mock/MockRealtimeVideoSource.h:
1903         (isType):
1904
1905 2020-04-22  Simon Fraser  <simon.fraser@apple.com>
1906
1907         Make it possible to eagerly apply scrolling tree state from the main thread
1908         https://bugs.webkit.org/show_bug.cgi?id=210883
1909
1910         Reviewed by Tim Horton.
1911
1912         Work towards fixing webkit.org/b/210884: at the beginning of Page::updateRendering(),
1913         we are going to need to pull the current state of the scrolling tree back to the
1914         main thread, so that JS-exposed scroll offsets match scrolling tree state.
1915
1916         To this end, expose a scrolling tree traversal function from ScrollingTree, which
1917         takes the lock and then calls a visitor function for each node. For scrolling nodes,
1918         the visitor gets the scroll position and optional layout viewport origin. These
1919         match the data passed back currently via AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll().
1920
1921         The new code is not called yet.
1922
1923         * page/scrolling/AsyncScrollingCoordinator.cpp:
1924         (WebCore::AsyncScrollingCoordinator::synchronizeStateFromScrollingTree):
1925         * page/scrolling/AsyncScrollingCoordinator.h:
1926         * page/scrolling/ScrollingCoordinator.h:
1927         (WebCore::ScrollingCoordinator::synchronizeStateFromScrollingTree):
1928         * page/scrolling/ScrollingTree.cpp:
1929         (WebCore::ScrollingTree::traverseScrollingTree):
1930         (WebCore::ScrollingTree::traverseScrollingTreeRecursive):
1931         * page/scrolling/ScrollingTree.h:
1932         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1933         (WebCore::ScrollingTreeScrollingNode::currentScrollPositionChanged): applyLayerPositions() calls these two
1934         functions, so just call it instead.
1935
1936 2020-04-22  Commit Queue  <commit-queue@webkit.org>
1937
1938         Unreviewed, reverting r260535.
1939         https://bugs.webkit.org/show_bug.cgi?id=210897
1940
1941         Causes crashes in WK1 (Requested by smfr on #webkit).
1942
1943         Reverted changeset:
1944
1945         "[ Mac wk2 ] imported/w3c/web-platform-tests/notifications
1946         /event-onclose.html is flaky failing."
1947         https://bugs.webkit.org/show_bug.cgi?id=209483
1948         https://trac.webkit.org/changeset/260535
1949
1950 2020-04-22  Darin Adler  <darin@apple.com>
1951
1952         [Cocoa] Build with UChar as char16_t even in builds that use Apple's internal SDK
1953         https://bugs.webkit.org/show_bug.cgi?id=210845
1954
1955         Reviewed by Anders Carlsson.
1956
1957         * Configurations/WebCore.xcconfig: Move ICU-configuring macros to Platform.h.
1958
1959         * Modules/websockets/WebSocket.cpp:
1960         (WebCore::WebSocket::connect): Get rid of an obsolete cast to unsigned to work
1961         around uint16_t not being treated as a number by makeString.
1962
1963         * rendering/svg/SVGTextLayoutEngineBaseline.cpp:
1964         (WebCore::SVGTextLayoutEngineBaseline::calculateGlyphOrientationAngle const):
1965         Remove deprecated U_EA_COUNT.
1966
1967 2020-04-22  Andres Gonzalez  <andresg_22@apple.com>
1968
1969         Add logging to core accessibility.
1970         https://bugs.webkit.org/show_bug.cgi?id=210564
1971         <rdar://problem/61863477>
1972
1973         Reviewed by Simon Fraser and Chris Fleizach.
1974
1975         - Use LOG and LOG_WITH_STREAM macros instead of WTF::Logger directly.
1976         - Added logging of AXCoreObjects.
1977
1978         * accessibility/AXLogger.cpp:
1979         (WebCore::AXLogger::AXLogger):
1980         (WebCore::AXLogger::~AXLogger):
1981         (WebCore::AXLogger::log):
1982         (WebCore::operator<<):
1983         * accessibility/AXLogger.h:
1984         * accessibility/AccessibilityObjectInterface.h:
1985
1986 2020-04-22  Daniel Bates  <dabates@apple.com>
1987
1988         Support toggling debug overlay for touch action region and editable element region independent from non-fast scrollable region
1989         https://bugs.webkit.org/show_bug.cgi?id=210774
1990
1991         Reviewed by Dean Jackson.
1992
1993         Break out the touch action region and editable element region debug overlays into their own
1994         flags that can be passed to Settings::setVisibleDebugOverlayRegions() to toggle these overlays,
1995         respectively. Currently both of these overlays piggyback on whether the engine will paint the
1996         non-fast scrollable region.
1997
1998         * page/SettingsBase.h: Add two more enumerators.
1999         * rendering/RenderLayer.cpp:
2000         (WebCore::RenderLayer::invalidateEventRegion const): Update the code to be more precise now that
2001         we can target the update paint overlay hack to when we are painting touch-action or editable
2002         element regions.
2003         * rendering/RenderLayerBacking.cpp:
2004         (WebCore::RenderLayerBacking::paintDebugOverlays): Condition the painting of touch action region
2005         on one enumerator and the painting of editable element region on another.
2006         (WebCore::RenderLayerBacking::paintContents): Update the code to be more precise.
2007
2008 2020-04-22  Chris Dumez  <cdumez@apple.com>
2009
2010         [ Mac wk2 ] imported/w3c/web-platform-tests/notifications/event-onclose.html is flaky failing.
2011         https://bugs.webkit.org/show_bug.cgi?id=209483
2012         <rdar://problem/60830377>
2013
2014         Reviewed by Geoffrey Garen.
2015
2016         Align garbage collection of Notification JS wrapper with the specification:
2017         - https://notifications.spec.whatwg.org/#garbage-collection [1]
2018
2019         In particular, the following changes were made:
2020         1. Instead of using the legacy setPendingActivity() / unsetPendingActivity(), override
2021            ActiveDOMObject::virtualHasPendingActivity() to implement the behavior documented
2022            in the specification.
2023         2. Keep the wrapper alive as long as the notification is showing and as long as there
2024            are relevant event listeners, as per [1]. Previously, we failed to check for event
2025            listeners, which was suboptimal.
2026         3. Update the constructor to queue a task on the event loop in order to show the
2027            notification asynchronously, instead of relying on a SuspendableTimer for this
2028            purpose. Previously, the JS wrapper could get collected between construction and
2029            the notification getting shown, which was leading to the test flakiness.
2030
2031         No new tests, unskipped existing test.
2032
2033         * Modules/notifications/Notification.cpp:
2034         (WebCore::Notification::Notification):
2035         (WebCore::Notification::show):
2036         (WebCore::Notification::finalize):
2037         (WebCore::Notification::dispatchShowEvent):
2038         (WebCore::Notification::dispatchClickEvent):
2039         (WebCore::Notification::dispatchCloseEvent):
2040         (WebCore::Notification::dispatchErrorEvent):
2041         (WebCore::Notification::eventListenersDidChange):
2042         (WebCore::Notification::virtualHasPendingActivity const):
2043         * Modules/notifications/Notification.h:
2044
2045 2020-04-22  Don Olmstead  <don.olmstead@sony.com>
2046
2047         [CMake] Add WebKit::WebCoreTestSupport target
2048         https://bugs.webkit.org/show_bug.cgi?id=210867
2049
2050         Reviewed by Michael Catanzaro.
2051
2052         Add the WebKit::WebCoreTestSupport target. Modify WebCoreTestSupport to only
2053         have a dependency on WebCore if WebCore is built as a shared library.
2054
2055         * CMakeLists.txt:
2056
2057 2020-04-22  Eric Carlson  <eric.carlson@apple.com>
2058
2059         fast/events/event-handler-detached-document-dispatchEvent.html is crashing
2060         https://bugs.webkit.org/show_bug.cgi?id=210859
2061         <rdar://problem/62072269>
2062
2063         Reviewed by Jer Noble.
2064
2065         A media session may not have a Page when it is created, so register with the MediaUsageManager
2066         in inActiveDocumentChanged if necessary.
2067
2068         No new tests, fixes an existing test.
2069
2070         * html/MediaElementSession.cpp:
2071         (WebCore::MediaElementSession::MediaElementSession):
2072         (WebCore::MediaElementSession::~MediaElementSession):
2073         (WebCore::MediaElementSession::addedMediaUsageManagerSessionIfNecessary):
2074         (WebCore::MediaElementSession::inActiveDocumentChanged):
2075         (WebCore::MediaElementSession::updateMediaUsageIfChanged):
2076         * html/MediaElementSession.h:
2077
2078 2020-04-22  Antti Koivisto  <antti@apple.com>
2079
2080         REGRESSION (r249160): Deleting newline after pasting text ending in a newline results in a discontinuity
2081         https://bugs.webkit.org/show_bug.cgi?id=210677
2082         <rdar://problem/61954169>
2083
2084         Reviewed by Zalan Bujtas.
2085
2086         Test: fast/text/delete-line-break-in-pre.html
2087
2088         * rendering/RenderTextLineBoxes.cpp:
2089         (WebCore::RenderTextLineBoxes::dirtyRange):
2090
2091         r249160 changed InlineTextBox end offset to be consistently first-past-end.
2092         The code here that updates lineBreakPos needs to take this into account too.
2093
2094 2020-04-22  Antoine Quint  <graouts@apple.com>
2095
2096         [Web Animations] Coordinate "update animations and send events" procedure across multiple timelines
2097         https://bugs.webkit.org/show_bug.cgi?id=202109
2098         <rdar://problem/59470821>
2099
2100         Reviewed by Dean Jackson.
2101
2102         So far, although we did manage multiple animation timelines per document, we mostly operated
2103         under the assumption that there really was a single timeline. In this patch we make the
2104         "update animations and send events" procedure, which is central to the lifecycle of animations,
2105         work with multiple timelines such that a single microtask checkpoint is performed even with multiple
2106         timelines, whereas we would perform one per timeline before. To do this, we move much of the logic
2107         DocumentTimeline::updateAnimationsAndSendEvents() to DocumentTimelinesController where each step is
2108         run across each timeline, rather than running all steps for each timeline one after the other,
2109         respecting the single microtask checkpoint in the middle of the process.
2110
2111         To minimize code churn at this stage, we still keep a fair bit of logic in DocumentTimeline and,
2112         while we remove updateAnimationsAndSendEvents(), internalUpdateAnimationsAndSendEvents() and
2113         updateCurrentTime(), we expose three methods that allow to run the pre-flight sequence in
2114         documentWillUpdateAnimationsAndSendEvents(), collect pending events in
2115         prepareForPendingAnimationEventsDispatch() and run the post-flight sequence
2116         in documentDidUpdateAnimationsAndSendEvents().
2117
2118         None of the logic changes, this is just moving code around. In the future, more patches will move
2119         code from DocumentTimeline up to DocumentTimelinesController such that events are enqueued there,
2120         and animation scheduling as well. But this already lets us pass a new test that used to flakily
2121         reject promises in the WPT test web-animations/timing-model/timelines/update-and-send-events.html.
2122
2123         * animation/AnimationTimeline.h:
2124         (WebCore::AnimationTimeline::relevantAnimations const):
2125         (WebCore::AnimationTimeline::allAnimations const):
2126         * animation/DocumentTimeline.cpp:
2127         (WebCore::DocumentTimeline::documentWillUpdateAnimationsAndSendEvents):
2128         (WebCore::DocumentTimeline::documentDidUpdateAnimationsAndSendEvents):
2129         (WebCore::DocumentTimeline::prepareForPendingAnimationEventsDispatch):
2130         (WebCore::DocumentTimeline::updateCurrentTime): Deleted.
2131         (WebCore::DocumentTimeline::updateAnimationsAndSendEvents): Deleted.
2132         (WebCore::DocumentTimeline::internalUpdateAnimationsAndSendEvents): Deleted.
2133         * animation/DocumentTimeline.h:
2134         * animation/DocumentTimelinesController.cpp:
2135         (WebCore::DocumentTimelinesController::DocumentTimelinesController):
2136         (WebCore::DocumentTimelinesController::updateAnimationsAndSendEvents):
2137         * animation/DocumentTimelinesController.h:
2138         * animation/WebAnimationTypes.h:
2139         * dom/Document.cpp:
2140         (WebCore::Document::ensureTimelinesController):
2141
2142 2020-04-22  Eric Carlson  <eric.carlson@apple.com>
2143
2144         [iOS] Add a quirk to keep gizmodo videos visible when playing in fullscreen.
2145         https://bugs.webkit.org/show_bug.cgi?id=210857
2146         <rdar://problem/58875327>
2147
2148         Reviewed by Jer Noble.
2149
2150         * page/Quirks.cpp:
2151         (WebCore::Quirks::needsFullscreenDisplayNoneQuirk const):
2152         * page/Quirks.h:
2153
2154         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2155         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Drive-by fix: always
2156         set the layer name to make debugging in release builds easier.
2157
2158         * platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm:
2159         (WebCore::VideoLayerManagerObjC::setVideoLayer): Ditto.
2160
2161         * style/StyleAdjuster.cpp:
2162         (WebCore::Style::Adjuster::adjustForSiteSpecificQuirks const): Change `display:none` into
2163         `display:block` on div with class "instream-native-video--mobile" when child video
2164         element with id "vjs_video_3_html5_api" is in fullscreen.
2165
2166 2020-04-22  Chris Dumez  <cdumez@apple.com>
2167
2168         Unreviewed, commit updated xcfilelist files.
2169
2170         * DerivedSources-input.xcfilelist:
2171         * DerivedSources-output.xcfilelist:
2172
2173 2020-04-22  Chris Dumez  <cdumez@apple.com>
2174
2175         Unreviewed, reverting r259116.
2176
2177         Broke login flow on some apple-internal sites
2178         (rdar://problem/61905262)
2179
2180         Reverted changeset:
2181
2182         "Move applyUserAgentIfNeeded calls to a more central place"
2183         https://bugs.webkit.org/show_bug.cgi?id=209587
2184         https://trac.webkit.org/changeset/259116
2185
2186 2020-04-22  Zalan Bujtas  <zalan@apple.com>
2187
2188         [LFC][TFC] Introduce TableFormattingContext::computeAndDistributeExtraVerticalSpace
2189         https://bugs.webkit.org/show_bug.cgi?id=210830
2190
2191         Reviewed by Antti Koivisto.
2192
2193         Add a dedicated function to compute preferred heights for the table rows.
2194         This is in preparation for the 2 pass layout required to finalize row height. 
2195
2196         * layout/FormattingContext.cpp:
2197         (WebCore::Layout::FormattingContext::computeBorderAndPadding):
2198         * layout/FormattingContext.h:
2199         * layout/FormattingContextGeometry.cpp:
2200         (WebCore::Layout::FormattingContext::Geometry::computedPadding const):
2201         * layout/tableformatting/TableFormattingContext.cpp:
2202         (WebCore::Layout::TableFormattingContext::layoutInFlowContent):
2203         (WebCore::Layout::TableFormattingContext::layoutCell):
2204         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace):
2205         (WebCore::Layout::TableFormattingContext::setComputedGeometryForRows):
2206         (WebCore::Layout::TableFormattingContext::setComputedGeometryForSections):
2207         (WebCore::Layout::TableFormattingContext::positionTableCells): Deleted.
2208         * layout/tableformatting/TableFormattingContext.h:
2209
2210 2020-04-22  Claudio Saavedra  <csaavedra@igalia.com>
2211
2212         [GTK4] Several fixes to GdkEvent APIs for GTK4
2213         https://bugs.webkit.org/show_bug.cgi?id=210856
2214
2215         Reviewed by Carlos Garcia Campos.
2216
2217         No tests needed.
2218
2219         Several fixes to GdkEvent API changes for GTK4. This is far from
2220         complete but it allows the GTK4 build to move forward. When
2221         possible, add GTK3-API replacements to GtkVersioning.h to avoid
2222         #ifdef blocks, where the API changes are too complex, just #ifdef.
2223
2224         * platform/gtk/GtkUtilities.cpp:
2225         (WebCore::wallTimeForEvent):
2226         * platform/gtk/GtkVersioning.h:
2227         (gdk_event_get_state):
2228         (gdk_event_get_coords):
2229         (gdk_event_get_root_coords):
2230         (gdk_event_is_scroll_stop_event):
2231         (gdk_event_get_scroll_direction):
2232         (gdk_event_get_scroll_deltas):
2233         (gdk_event_get_button):
2234         (gdk_keymap_get_for_display): Deleted as it was wrong and
2235         it's not needed.
2236         * platform/gtk/PlatformKeyboardEventGtk.cpp:
2237         (WebCore::PlatformKeyboardEvent::currentCapsLockState):
2238         (WebCore::PlatformKeyboardEvent::getCurrentModifierState):
2239         (WebCore::PlatformKeyboardEvent::modifiersContainCapsLock):
2240         * platform/gtk/PlatformWheelEventGtk.cpp:
2241         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
2242
2243 2020-04-22  Youenn Fablet  <youenn@apple.com>
2244
2245         Simplify SWServerWorker::whenActivated logic
2246         https://bugs.webkit.org/show_bug.cgi?id=210795
2247
2248         Reviewed by Alex Christensen.
2249
2250         Improve logging and ensure whenActivated can be called whatever the worker state is.
2251         No change of behavior.
2252
2253         * workers/service/server/SWServer.cpp:
2254         (WebCore::SWServer::didFinishInstall):
2255         (WebCore::SWServer::fireInstallEvent):
2256         (WebCore::SWServer::fireActivateEvent):
2257         * workers/service/server/SWServerWorker.cpp:
2258         (WebCore::SWServerWorker::whenActivated):
2259
2260 2020-04-22  Enrique Ocaña González  <eocanha@igalia.com>
2261
2262         [GStreamer][MSE] Youtube 'live stream'/H264 URLs fail to play, VP8/9 URLs play OK
2263         https://bugs.webkit.org/show_bug.cgi?id=209119
2264
2265         Reviewed by Xabier Rodriguez-Calvar.
2266
2267         The fix consists of removing the initial avoiding of seeking and just
2268         issuing the proper segment instead of seeking (seeks in GStreamer can't
2269         be done before prerolling anyway). Appsrc doesn't make easy to emit our
2270         own custom segment, so what I did was to use a segment fixer probe to
2271         modify the original [0, infinity] segment issued by appsrc and use
2272         a [startTime, stopTime] with proper values depending on the seek target
2273         and rate.
2274
2275         Covered by existing tests.
2276
2277         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2278         (WebCore::checkShouldDelaySeek): Don't hold seeks on startup, when changing from READY to PAUSED.
2279         (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek): Refactored seek delay condition. Also, don't do a regular
2280         gst_element_seek() for initial seeks, just proceed with a special case in that situation.
2281         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
2282         (initialSeekSegmentFixerProbe): Probe that fixes the segment.
2283         (webKitMediaSrcPrepareInitialSeek): Behave much like a regular seek, but also compute the right GstSegment, install
2284         the segment fixer probe and setReadyForMoreSamples() on the SourceBufferPrivates.
2285         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h:
2286
2287 2020-04-21  Sergio Villar Senin  <svillar@igalia.com>
2288
2289         [WebXR] Test IDLs and stubs
2290         https://bugs.webkit.org/show_bug.cgi?id=209859
2291
2292         Reviewed by Dean Jackson and Youenn Fablet.
2293
2294         WebXR testing is hard as it might involve interaction with actual
2295         devices. That's why the WebXR testing
2296         API (https://immersive-web.github.io/webxr-test-api/) was
2297         proposed. In fact, all the current WebXR tests from
2298         web-platform-tests are using that testing API. This new testing
2299         API supplements navigator.xr and is accessed through
2300         navigator.xr.test.
2301
2302         In order not to expose the API to the web we're adding the XRTest
2303         interface to Internals instead. The mapping from internals.xrTest to
2304         navigator.xr.test happens in the WPT code.
2305
2306         We're adding the required IDLs and very basic (mostly empty)
2307         implementations for testing methods. We're adding testing
2308         infrastructure, adding tests make no sense for this change.
2309
2310         * CMakeLists.txt: Added new files.
2311         * DerivedSources.make: Ditto.
2312         * Modules/webxr/NavigatorWebXR.h: Export API to be used in testing code.
2313         * Modules/webxr/WebXRSystem.h: Export ::from and ::xr methods.
2314         * WebCore.xcodeproj/project.pbxproj: Ditto.
2315         * bindings/js/WebCoreBuiltinNames.h: Added some new macros.
2316         * testing/FakeXRBoundsPoint.h: Added.
2317         * testing/FakeXRBoundsPoint.idl: Added.
2318         * testing/FakeXRButtonStateInit.h: Added.
2319         * testing/FakeXRButtonStateInit.idl: Added.
2320         * testing/FakeXRInputSourceInit.h: Added.
2321         * testing/FakeXRInputSourceInit.idl: Added.
2322         * testing/FakeXRRigidTransformInit.h: Added.
2323         * testing/FakeXRRigidTransformInit.idl: Added.
2324         * testing/FakeXRViewInit.h: Added.
2325         * testing/FakeXRViewInit.idl: Added.
2326         * testing/Internals.cpp:
2327         (WebCore::Internals::xrTest): Added WebXRTest to Internals.
2328         * testing/Internals.h: Added xrTest() accessor.
2329         * testing/Internals.idl: Added xrTest attribute.
2330         * testing/WebFakeXRDevice.cpp: Added.
2331         (WebCore::WebFakeXRDevice::setViews):
2332         (WebCore::WebFakeXRDevice::disconnect):
2333         (WebCore::WebFakeXRDevice::setViewerOrigin):
2334         (WebCore::WebFakeXRDevice::clearViewerOrigin):
2335         (WebCore::WebFakeXRDevice::simulateVisibilityChange):
2336         (WebCore::WebFakeXRDevice::setBoundsGeometry):
2337         (WebCore::WebFakeXRDevice::setFloorOrigin):
2338         (WebCore::WebFakeXRDevice::clearFloorOrigin):
2339         (WebCore::WebFakeXRDevice::simulateResetPose):
2340         (WebCore::WebFakeXRDevice::simulateInputSourceConnection):
2341         * testing/WebFakeXRDevice.h: Added.
2342         * testing/WebFakeXRDevice.idl: Added.
2343         * testing/WebFakeXRInputController.cpp: Added.
2344         (WebCore::WebFakeXRInputController::setHandedness):
2345         (WebCore::WebFakeXRInputController::setTargetRayMode):
2346         (WebCore::WebFakeXRInputController::setProfiles):
2347         (WebCore::WebFakeXRInputController::setGripOrigin):
2348         (WebCore::WebFakeXRInputController::clearGripOrigin):
2349         (WebCore::WebFakeXRInputController::setPointerOrigin):
2350         (WebCore::WebFakeXRInputController::disconnect):
2351         (WebCore::WebFakeXRInputController::reconnect):
2352         (WebCore::WebFakeXRInputController::startSelection):
2353         (WebCore::WebFakeXRInputController::endSelection):
2354         (WebCore::WebFakeXRInputController::simulateSelect):
2355         (WebCore::WebFakeXRInputController::setSupportedButtons):
2356         (WebCore::WebFakeXRInputController::updateButtonState):
2357         * testing/WebFakeXRInputController.h: Added.
2358         * testing/WebFakeXRInputController.idl: Added.
2359         * testing/WebXRTest.cpp: Added.
2360         (WebCore::WebXRTest::simulateDeviceConnection const):
2361         (WebCore::WebXRTest::simulateUserActivation):
2362         (WebCore::WebXRTest::disconnectAllDevices):
2363         * testing/WebXRTest.h: Added.
2364         (WebCore::WebXRTest::create):
2365         * testing/WebXRTest.idl: Added.
2366         * testing/XRSimulateUserActivationFunction.h: Added.
2367         * testing/XRSimulateUserActivationFunction.idl: Ditto.
2368
2369 2020-04-21  Antoine Quint  <graouts@apple.com>
2370
2371         [Web Animations] Add a supporting object for Document to manage timelines
2372         https://bugs.webkit.org/show_bug.cgi?id=210817
2373
2374         Reviewed by Dean Jackson.
2375
2376         Add a new DocumentTimelinesController object owned by Document to manage DocumentTimelines created for it. This simple piece of refactoring is the first
2377         step towards a coordinated "update animations and send events" procedure where all timelines are updated at once with a single microtask checkpoint instead
2378         of each timeline running one.
2379
2380         No change in behavior, so no new tests.
2381
2382         * Headers.cmake:
2383         * Sources.txt:
2384         * WebCore.xcodeproj/project.pbxproj:
2385         * animation/DocumentTimeline.cpp:
2386         (WebCore::DocumentTimeline::DocumentTimeline):
2387         (WebCore::DocumentTimeline::~DocumentTimeline):
2388         (WebCore::DocumentTimeline::controller const):
2389         (WebCore::DocumentTimeline::detachFromDocument):
2390         * animation/DocumentTimeline.h:
2391         * animation/DocumentTimelinesController.cpp: Added.
2392         (WebCore::DocumentTimelinesController::DocumentTimelinesController):
2393         (WebCore::DocumentTimelinesController::~DocumentTimelinesController):
2394         (WebCore::DocumentTimelinesController::addTimeline):
2395         (WebCore::DocumentTimelinesController::removeTimeline):
2396         (WebCore::DocumentTimelinesController::detachFromDocument):
2397         (WebCore::DocumentTimelinesController::updateAnimationsAndSendEvents):
2398         * animation/DocumentTimelinesController.h: Added.
2399         * dom/Document.cpp:
2400         (WebCore::Document::commonTeardown):
2401         (WebCore::Document::ensureTimelinesController):
2402         (WebCore::Document::updateAnimationsAndSendEvents): Deleted.
2403         (WebCore::Document::addTimeline): Deleted.
2404         (WebCore::Document::removeTimeline): Deleted.
2405         * dom/Document.h:
2406         (WebCore::Document::timelinesController const):
2407         * page/Page.cpp:
2408         (WebCore::Page::updateRendering):
2409
2410 2020-04-21  Cathie Chen  <cathiechen@igalia.com>
2411
2412         REGRESSION (r254790): No longer get smooth scrolling on music.apple.com
2413         https://bugs.webkit.org/show_bug.cgi?id=210634
2414
2415         Reviewed by Darin Adler.
2416
2417         The page uses the access of "scrollBehavior" in CSSStyleDeclaration as the support of scroll-behavior.
2418         If supported, it will use scroll-behavior. Otherwise, it will perform a JS smooth scroll.
2419         Currently, "scrollBehavior" is still available when CSSOMViewSmoothScrolling is off, only the value
2420         "smooth" is invalidated.
2421         In order to fix this, CSSStyleDeclaration will take account of CSSOMViewSmoothScrolling in Settings.
2422         This patch also tries to provide an interface which let flags in Settings can enable/disable a property.
2423         However, it is not complete, for there are some scenarios that Settings isn't accessible. By adding
2424         "settings-flag" to CSSProperties.json, it would be effective to control the property access in CSSStyleDeclaration.
2425
2426         Tests: fast/scrolling/scroll-behavior-invalidate-if-disabled.html
2427                fast/scrolling/scroll-behavior-validate-if-enabled.html
2428
2429         * css/CSSProperties.json:
2430         * css/CSSStyleDeclaration.cpp:
2431         (WebCore::CSSStyleDeclaration::getCSSPropertyIDFromJavaScriptPropertyName):
2432         (WebCore::CSSStyleDeclaration::namedItem):
2433         (WebCore::CSSStyleDeclaration::setNamedItem):
2434         (WebCore::CSSStyleDeclaration::supportedPropertyNames const):
2435         * css/makeprop.pl:
2436         (addProperty):
2437         * css/parser/CSSPropertyParser.cpp:
2438         (WebCore::cssPropertyID):
2439         * inspector/InspectorStyleSheet.cpp:
2440         (WebCore::InspectorStyle::collectProperties const):
2441         * inspector/agents/InspectorCSSAgent.cpp:
2442         (WebCore::InspectorCSSAgent::getSupportedCSSProperties):
2443
2444 2020-04-21  Yusuke Suzuki  <ysuzuki@apple.com>
2445
2446         Canonicalize JSBigInt generated by structured-cloning by calling rightTrim
2447         https://bugs.webkit.org/show_bug.cgi?id=210816
2448
2449         Reviewed by Keith Miller and Darin Adler.
2450
2451         Let's assume that the serialized data is slightly different. JSBigInt's internal representation has various invariants. For example, if JSBigInt is zero, it should have zero length,
2452         and its sign should be false. But there are various ways of representing zero JSBigInt in serialization format. For example, we can set sign = true, length = 0. Current code strongly
2453         assumes that dumped data meets this JSBigInt's internal invariant. This is not good: for example, if we add a new invariant into JSBigInt, already serialized data would not meet this
2454         invariant.
2455         In this patch, we call `JSBigInt::rightTrim(VM&)` when finishing JSBigInt deserialization. This means that we canonicalize JSBigInt when finishing creation, and this makes this serialization
2456         format free from JSBigInt's internal invariants. This makes JSBigInt serialization/deserialization robust. And we also add lengthInUint64 == 0 path not to call rightTrim when it is zero.
2457         This makes deserialization robust for zero-length & signed corrupted JSBigInt zero.
2458
2459         * bindings/js/SerializedScriptValue.cpp:
2460         (WebCore::CloneSerializer::dumpBigInt32Data):
2461         (WebCore::CloneDeserializer::readBigInt):
2462
2463 2020-04-21  Peng Liu  <peng.liu6@apple.com>
2464
2465         platform/mac/media/audio-session-category-audio-autoplay.html is timing out
2466         https://bugs.webkit.org/show_bug.cgi?id=210826
2467
2468         Reviewed by Jer Noble.
2469
2470         For WebKitLegacy, AudioSession::setCategory() needs to set the category when
2471         m_routingArbitrationClient is nullptr. This patch also fixes an error regarding
2472         setupArbitrationOngoing.
2473
2474         * platform/audio/mac/AudioSessionMac.mm:
2475         (WebCore::AudioSession::setCategory):
2476
2477 2020-04-21  Peng Liu  <peng.liu6@apple.com>
2478
2479         Fix MACCATALYST build failures
2480         https://bugs.webkit.org/show_bug.cgi?id=210815
2481
2482         Reviewed by Tim Horton.
2483
2484         No new tests, no functional change.
2485
2486         * Configurations/FeatureDefines.xcconfig:
2487         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2488
2489 2020-04-19  Darin Adler  <darin@apple.com>
2490
2491         [Cocoa] Use createNSArray in many more places that build NSArray objects from C++ collections
2492         https://bugs.webkit.org/show_bug.cgi?id=210702
2493
2494         Reviewed by Alex Christensen.
2495
2496         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2497         (-[WebAccessibilityObjectWrapper accessibilityFlowToElements]): Use createNSArray.
2498         (-[WebAccessibilityObjectWrapper textRectsFromMarkers:withText:]): Ditto.
2499         (-[WebAccessibilityObjectWrapper rectsForSelectionRects:]): Deleted. Merged into
2500         the method above.
2501
2502         * accessibility/mac/WebAccessibilityObjectWrapperBase.h: Take const references
2503         instead of references when passing Path and FloatRect.
2504         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
2505         (convertMathPairsToNSArray): Use createNSArray. Also use arrays on the stack
2506         to create NSDictionary rather than using NSMutableDictionary.
2507         (addChildToArray): Deleted.
2508         (convertToNSArray): Uses createNSArray. Rolled addChildToArray in.
2509         (-[WebAccessibilityObjectWrapperBase convertPathToScreenSpace:]): Take const
2510         reference instead of reference.
2511         (-[WebAccessibilityObjectWrapperBase convertRectToSpace:space:]): Ditto.
2512
2513         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2514         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
2515         Use createNSArray.
2516         * editing/cocoa/FontAttributesCocoa.mm:
2517         (WebCore::FontAttributes::createDictionary const): Ditto.
2518         * page/ios/FrameIOS.mm:
2519         (WebCore::Frame::interpretationsForCurrentRoot const): Ditto.
2520         * platform/cocoa/SearchPopupMenuCocoa.mm:
2521         (WebCore::saveRecentSearches): Ditto.
2522         * platform/cocoa/SharedBufferCocoa.mm:
2523         (WebCore::SharedBuffer::createNSDataArray const): Ditto.
2524         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2525         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense): Ditto.
2526         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
2527         (WebCore::CDMSessionAVContentKeySession::update): Ditto.
2528         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
2529         (WebCore::CDMSessionAVStreamSession::update): Ditto.
2530         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2531         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Ditto.
2532         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
2533         (WebCore::PlatformCAAnimationCocoa::setValues): Ditto.
2534         (WebCore::PlatformCAAnimationCocoa::setKeyTimes): Ditto.
2535         (WebCore::PlatformCAAnimationCocoa::setTimingFunctions): Ditto.
2536
2537         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
2538         (WebCore::PlatformCAFilters::setFiltersOnLayer): Moved almost the whole
2539         function into a call to createNSArray. Removed the default case from
2540         the switch so we get a warning if we miss any filter operation types.
2541
2542         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2543         (WebCore::PlatformCALayerCocoa::setSublayers): Use createNSArray.
2544         * platform/ios/PlatformPasteboardIOS.mm:
2545         (WebCore::PlatformPasteboard::write): Ditto.
2546         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
2547         (WebCore::mediaSelectionOptions): Ditto.
2548         * platform/mac/PlatformPasteboardMac.mm:
2549         (WebCore::PlatformPasteboard::write): Ditto.
2550         * platform/mac/WebPlaybackControlsManager.mm:
2551         (mediaSelectionOptions): Ditto.
2552         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
2553         (WebCore::NetworkStorageSession::setCookies): Ditto.
2554         * platform/network/cocoa/ResourceRequestCocoa.mm:
2555         (WebCore::ResourceRequest::doUpdatePlatformRequest): Ditto.
2556
2557         * platform/network/cocoa/WebCoreNSURLSession.h:
2558         Use the Objective-C type WebCoreNSURLSessionDataTask in the _dataTasks
2559         set rather than using CFTypeRef.
2560
2561         * platform/network/cocoa/WebCoreNSURLSession.mm:
2562         (-[WebCoreNSURLSession dealloc]): Remove now-unneeded typecast.
2563         (-[WebCoreNSURLSession taskCompleted:]): Ditto.
2564         (-[WebCoreNSURLSession finishTasksAndInvalidate]): Use a more idiomatic
2565         form of capturing strongSelf in a lambda.
2566         (-[WebCoreNSURLSession invalidateAndCancel]): Updated the type on a
2567         local variable and removed now-unneeded typecast.
2568         (-[WebCoreNSURLSession getTasksWithCompletionHandler:]): Use RetainPtr
2569         to cut down on autorelease. Use createNSArray, taking advantage of the
2570         fact that it works on HashSet. Removed now-unneeded typecast.
2571         (-[WebCoreNSURLSession getAllTasksWithCompletionHandler:]): Ditto.
2572         (-[WebCoreNSURLSession dataTaskWithRequest:]): Remove now-unneeded typecast.
2573         (-[WebCoreNSURLSession dataTaskWithURL:]): Ditto.
2574
2575 2020-04-21  Alexey Shvayka  <shvaikalesh@gmail.com>
2576
2577         The visibilitychange event should bubble
2578         https://bugs.webkit.org/show_bug.cgi?id=210829
2579
2580         Reviewed by Darin Adler.
2581
2582         This change makes `visibilitychange` event bubble as per spec [1], aligning WebKit
2583         with Blink and Gecko. Also fixes broken spec link to `visibilityState` attribute.
2584
2585         [1] https://w3c.github.io/page-visibility/#dfn-now-visible-algorithm (step 2)
2586
2587         Test: fast/events/page-visibility-transition-test.html
2588
2589         * dom/Document.cpp:
2590         (WebCore::Document::visibilityStateChanged):
2591         (WebCore::Document::visibilityState const):
2592
2593 2020-04-21  Simon Fraser  <simon.fraser@apple.com>
2594
2595         Composited layers are misplaced inside RTL overflow scroller with visible scrollbar
2596         https://bugs.webkit.org/show_bug.cgi?id=210820
2597
2598         Reviewed by Zalan Bujtas.
2599
2600         RenderLayerBacking::computeParentGraphicsLayerRect() used renderBox.paddingBoxRectIncludingScrollbar()
2601         to position layers inside composited overflow scroll, but this is wrong if the RTL left-side
2602         scrollbar takes space.
2603
2604         Fix by making some static functions that we can call from the various places that ask
2605         about box geometry, and using them.
2606
2607         Test: compositing/scrolling/async-overflow-scrolling/position-inside-rtl-overflow.html
2608
2609         * rendering/RenderBox.cpp:
2610         (WebCore::RenderBox::overflowClipRect const):
2611         (WebCore::RenderBox::clipRect const):
2612         (WebCore::RenderBox::overflowClipRect): Deleted.
2613         (WebCore::RenderBox::clipRect): Deleted.
2614         * rendering/RenderBox.h:
2615         (WebCore::RenderBox::overflowClipRectForChildLayers const):
2616         (WebCore::RenderBox::overflowClipRectForChildLayers): Deleted.
2617         * rendering/RenderLayerBacking.cpp:
2618         (WebCore::scrollContainerLayerBox):
2619         (WebCore::clippingLayerBox):
2620         (WebCore::overflowControlsHostLayerBox):
2621         (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect const):
2622         (WebCore::RenderLayerBacking::updateGeometry):
2623         (WebCore::clipBox): Deleted.
2624         * rendering/RenderTable.cpp:
2625         (WebCore::RenderTable::overflowClipRect const):
2626         (WebCore::RenderTable::overflowClipRect): Deleted.
2627         * rendering/RenderTable.h:
2628
2629 2020-04-21  Simon Fraser  <simon.fraser@apple.com>
2630
2631         [Async overflow scroll] Overflow that's hidden on one axis is scrollable on that axis
2632         https://bugs.webkit.org/show_bug.cgi?id=210771
2633         <rdar://problem/62080331>
2634
2635         Reviewed by Tim Horton.
2636
2637         eventCanScrollContents() should check the presence of enabled scrollbars, like 
2638         ScrollAnimator::handleWheelEvent() does.
2639
2640         Test: fast/scrolling/mac/async-scroll-overflow-hidden-on-one-axis.html
2641
2642         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2643         (WebCore::ScrollingTreeScrollingNode::eventCanScrollContents const):
2644
2645 2020-04-21  Daniel Bates  <dabates@apple.com>
2646
2647         [iOS] -_didFinishTextInteractionInTextInputContext should only zoom to reveal focused element if it changed
2648         https://bugs.webkit.org/show_bug.cgi?id=210697
2649         <rdar://problem/60997530>
2650
2651         Reviewed by Wenson Hsieh.
2652
2653         For now, add a comment about the return value of setFocusedElement: it returns
2654         whether focus was blocked. If focused wasn't blocked then it will return true
2655         even if the element wasn't actually focused. For example, it will return true
2656         for non-focusable elements: <input disabled>.
2657
2658         I was tempted to fix setFocusedElement() to return true when it actually focused
2659         the element or if the element was already focused, but I decided to defer this
2660         until I audit the callers and run some tests.
2661
2662         * dom/Document.h:
2663
2664 2020-04-21  Andres Gonzalez  <andresg_22@apple.com>
2665
2666         Fix for remoteParentObject and platformWidget not being stored properly in the AXIsolatedObject attributes variant.
2667         https://bugs.webkit.org/show_bug.cgi?id=210809
2668
2669         Reviewed by Chris Fleizach.
2670
2671         Adding these properties to the AXIsolatedObject attributes variant as
2672         WeakPtr<void*> fails. So they are now cached as member variables.
2673
2674         * accessibility/isolatedtree/AXIsolatedObject.cpp:
2675         (WebCore::AXIsolatedObject::initializeAttributeData):
2676         (WebCore::AXIsolatedObject::platformWidget const):
2677         * accessibility/isolatedtree/AXIsolatedObject.h:
2678         (WebCore::AXIsolatedObject::propertyValue const): Deleted.
2679         * accessibility/isolatedtree/mac/AXIsolatedObjectMac.mm:
2680         (WebCore::AXIsolatedObject::initializePlatformProperties):
2681         (WebCore::AXIsolatedObject::remoteParentObject const):
2682
2683 2020-04-20  Simon Fraser  <simon.fraser@apple.com>
2684
2685         Horizontal overflow overlay scrollbar is misplaced in RTL
2686         https://bugs.webkit.org/show_bug.cgi?id=210673
2687         <rdar://problem/61950751>
2688
2689         Reviewed by Antti Koivisto.
2690         
2691         Code for positioning RenderLayer overflow controls (scrollbars and scroll corner)
2692         was scattered across lots of different functions, making it hard to follow,
2693         and prone to bugs.
2694
2695         Fix by making one source of truth, overflowControlsRects(), which computes
2696         rects for the two scrollbars, the "scroll corner" (the square in the corner which
2697         shows, only for non-overlay scrollbars, when both scrollbars or the resize control
2698         is visible), and the resize control which shows when style specifies the "resize" property.
2699         
2700         Call this function in all the places that need to know about overflow control
2701         geometry. RenderLayer::hitTestResizerInFragments() is a little tricky because it wants
2702         the resize control relative to the fragment rect; achieve this by computing the position
2703         of the resizer rect relative to the border box, then shifting it into position relative
2704         to the fragment bounds (which include border).
2705
2706         Test: compositing/overflow/rtl-scrollbar-layer-positioning.html
2707
2708         * page/EventHandler.cpp:
2709         (WebCore::EventHandler::selectCursor):
2710         * rendering/RenderLayer.cpp:
2711         (WebCore::RenderLayer::scrollCornerRect const):
2712         (WebCore::RenderLayer::overflowControlsRects const):
2713         (WebCore::RenderLayer::scrollbarOffset const):
2714         (WebCore::RenderLayer::invalidateScrollbarRect):
2715         (WebCore::RenderLayer::positionOverflowControls):
2716         (WebCore::RenderLayer::overflowControlsIntersectRect const):
2717         (WebCore::RenderLayer::paintResizer):
2718         (WebCore::RenderLayer::isPointInResizeControl const):
2719         (WebCore::RenderLayer::hitTestOverflowControls):
2720         (WebCore::RenderLayer::hitTestResizerInFragments const):
2721         (WebCore::cornerStart): Deleted.
2722         (WebCore::cornerRect): Deleted.
2723         (WebCore::resizerCornerRect): Deleted.
2724         (WebCore::RenderLayer::scrollCornerAndResizerRect const): Deleted.
2725         (WebCore::RenderLayer::rectForHorizontalScrollbar const): Deleted.
2726         (WebCore::RenderLayer::rectForVerticalScrollbar const): Deleted.
2727         (WebCore::RenderLayer::verticalScrollbarStart const): Deleted.
2728         (WebCore::RenderLayer::horizontalScrollbarStart const): Deleted.
2729         * rendering/RenderLayer.h:
2730         * rendering/RenderLayerBacking.cpp:
2731         (WebCore::RenderLayerBacking::requiresScrollCornerLayer const):
2732         (WebCore::RenderLayerBacking::positionOverflowControlsLayers):
2733         (WebCore::RenderLayerBacking::paintContents):
2734
2735 2020-04-21  Sergio Villar Senin  <svillar@igalia.com>
2736
2737         Unreviewed, reverting r260432.
2738
2739         Broke WPE build
2740
2741         Reverted changeset:
2742
2743         "[WebXR] Test IDLs and stubs"
2744         https://bugs.webkit.org/show_bug.cgi?id=209859
2745         https://trac.webkit.org/changeset/260432
2746
2747 2020-04-21  Chris Dumez  <cdumez@apple.com>
2748
2749         REGRESSION (r256808): “A problem repeatedly occurred” when attempting to load https://bungalow.com/listings/bay-area
2750         https://bugs.webkit.org/show_bug.cgi?id=210801
2751         <rdar://problem/61658940>
2752
2753         Reviewed by Antti Koivisto.
2754
2755         Even though the page uses the 'async' attribute on the mapbox-gl.js script, deferring the execution of this
2756         script gets the page into a bad state, causing it to use a lot of CPU & memory until the process crashes.
2757         Since we don't have any other evidence of breakage from r256808 yet and since r256808 was a massive PLT
2758         progression, I am opting to add a quirk to disable the async script optimization on bungalow.com for now.
2759
2760         * dom/Document.cpp:
2761         (WebCore::Document::shouldDeferAsynchronousScriptsUntilParsingFinishes const):
2762         * page/Quirks.cpp:
2763         (WebCore::Quirks::shouldBypassAsyncScriptDeferring const):
2764         * page/Quirks.h:
2765         * platform/RegistrableDomain.h:
2766         (WebCore::RegistrableDomain::operator== const):
2767
2768 2020-04-16  Sergio Villar Senin  <svillar@igalia.com>
2769
2770         [WebXR] Test IDLs and stubs
2771         https://bugs.webkit.org/show_bug.cgi?id=209859
2772
2773         Reviewed by Dean Jackson and Youenn Fablet.
2774
2775         WebXR testing is hard as it might involve interaction with actual
2776         devices. That's why the WebXR testing
2777         API (https://immersive-web.github.io/webxr-test-api/) was
2778         proposed. In fact, all the current WebXR tests from
2779         web-platform-tests are using that testing API. This new testing
2780         API supplements navigator.xr and is accessed through
2781         navigator.xr.test.
2782
2783         In order not to expose the API to the web we're adding the XRTest
2784         interface to Internals instead. The mapping from internals.xrTest to
2785         navigator.xr.test happens in the WPT code.
2786
2787         We're adding the required IDLs and very basic (mostly empty)
2788         implementations for testing methods. We're adding testing
2789         infrastructure, adding tests make no sense for this change.
2790
2791         * CMakeLists.txt: Added new files.
2792         * DerivedSources.make: Ditto.
2793         * Modules/webxr/NavigatorWebXR.h: Export API to be used in testing code.
2794         * Modules/webxr/WebXRSystem.h: Export ::from and ::xr methods.
2795         * Sources.txt: Added new files.
2796         * WebCore.xcodeproj/project.pbxproj: Ditto.
2797         * bindings/js/WebCoreBuiltinNames.h: Added some new macros.
2798         * testing/FakeXRBoundsPoint.h: Added.
2799         * testing/FakeXRBoundsPoint.idl: Added.
2800         * testing/FakeXRButtonStateInit.h: Added.
2801         * testing/FakeXRButtonStateInit.idl: Added.
2802         * testing/FakeXRInputSourceInit.h: Added.
2803         * testing/FakeXRInputSourceInit.idl: Added.
2804         * testing/FakeXRRigidTransformInit.h: Added.
2805         * testing/FakeXRRigidTransformInit.idl: Added.
2806         * testing/FakeXRViewInit.h: Added.
2807         * testing/FakeXRViewInit.idl: Added.
2808         * testing/Internals.cpp:
2809         (WebCore::Internals::xrTest): Added WebXRTest to Internals.
2810         * testing/Internals.h: Added xrTest() accessor.
2811         * testing/Internals.idl: Added xrTest attribute.
2812         * testing/WebFakeXRDevice.cpp: Added.
2813         (WebCore::WebFakeXRDevice::setViews):
2814         (WebCore::WebFakeXRDevice::disconnect):
2815         (WebCore::WebFakeXRDevice::setViewerOrigin):
2816         (WebCore::WebFakeXRDevice::clearViewerOrigin):
2817         (WebCore::WebFakeXRDevice::simulateVisibilityChange):
2818         (WebCore::WebFakeXRDevice::setBoundsGeometry):
2819         (WebCore::WebFakeXRDevice::setFloorOrigin):
2820         (WebCore::WebFakeXRDevice::clearFloorOrigin):
2821         (WebCore::WebFakeXRDevice::simulateResetPose):
2822         (WebCore::WebFakeXRDevice::simulateInputSourceConnection):
2823         * testing/WebFakeXRDevice.h: Added.
2824         * testing/WebFakeXRDevice.idl: Added.
2825         * testing/WebFakeXRInputController.cpp: Added.
2826         (WebCore::WebFakeXRInputController::setHandedness):
2827         (WebCore::WebFakeXRInputController::setTargetRayMode):
2828         (WebCore::WebFakeXRInputController::setProfiles):
2829         (WebCore::WebFakeXRInputController::setGripOrigin):
2830         (WebCore::WebFakeXRInputController::clearGripOrigin):
2831         (WebCore::WebFakeXRInputController::setPointerOrigin):
2832         (WebCore::WebFakeXRInputController::disconnect):
2833         (WebCore::WebFakeXRInputController::reconnect):
2834         (WebCore::WebFakeXRInputController::startSelection):
2835         (WebCore::WebFakeXRInputController::endSelection):
2836         (WebCore::WebFakeXRInputController::simulateSelect):
2837         (WebCore::WebFakeXRInputController::setSupportedButtons):
2838         (WebCore::WebFakeXRInputController::updateButtonState):
2839         * testing/WebFakeXRInputController.h: Added.
2840         * testing/WebFakeXRInputController.idl: Added.
2841         * testing/WebXRTest.cpp: Added.
2842         (WebCore::WebXRTest::simulateDeviceConnection const):
2843         (WebCore::WebXRTest::simulateUserActivation):
2844         (WebCore::WebXRTest::disconnectAllDevices):
2845         * testing/WebXRTest.h: Added.
2846         (WebCore::WebXRTest::create):
2847         * testing/WebXRTest.idl: Added.
2848         * testing/XRSimulateUserActivationFunction.h: Added.
2849         * testing/XRSimulateUserActivationFunction.idl: Ditto.
2850
2851 2020-04-21  Claudio Saavedra  <csaavedra@igalia.com>
2852
2853         [GTK4] Adapt to GtkIconTheme API changes
2854         https://bugs.webkit.org/show_bug.cgi?id=210745
2855
2856         Reviewed by Adrian Perez de Castro.
2857
2858         No new tests needed.
2859
2860         GtkIconTheme changes in GTK and since we're no longer following
2861         the theme we can drop the missing image from the icon theme, so remove
2862         now unnecessary code.
2863
2864         * platform/graphics/gtk/ImageGtk.cpp:
2865         (WebCore::Image::loadPlatformResource): Directly load image from compiled
2866         GResource.
2867         (WebCore::loadResourceSharedBuffer): Deleted.
2868         (WebCore::loadMissingImageIconFromTheme): Deleted.
2869
2870 2020-04-21  Rob Buis  <rbuis@igalia.com>
2871
2872         Exit early in FrameLoader::loadURL when redirecting to another frame
2873         https://bugs.webkit.org/show_bug.cgi?id=210751
2874
2875         Reviewed by Geoffrey Garen.
2876
2877         Exit early in FrameLoader::loadURL when redirecting to another frame, previously we were preparing
2878         request needlessly, doing it twice in case of frame redirecting. Also move some variables to
2879         where they are actually used.
2880
2881         * loader/FrameLoader.cpp:
2882         (WebCore::FrameLoader::loadURL):
2883         * loader/FrameLoader.h:
2884
2885 2020-04-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2886
2887         [GTK] Remove PlatformMouseEventGtk
2888         https://bugs.webkit.org/show_bug.cgi?id=210743
2889
2890         Reviewed by Adrian Perez de Castro.
2891
2892         It's unused, we no longer create PlatformMouseEvent from a GdkEvent since WebKit2.
2893
2894         * SourcesGTK.txt:
2895         * platform/PlatformMouseEvent.h:
2896         * platform/gtk/PlatformMouseEventGtk.cpp: Removed.
2897
2898 2020-04-21  Claudio Saavedra  <csaavedra@igalia.com>
2899
2900         [GTK4] Fix platform GDK includes
2901         https://bugs.webkit.org/show_bug.cgi?id=210746
2902
2903         Reviewed by Carlos Garcia Campos.
2904
2905         * platform/graphics/PlatformDisplay.cpp: Wayland, X11, etc.
2906         platform includes changed path, so update accordingly.
2907
2908 2020-04-21  Adrian Perez de Castro  <aperez@igalia.com>
2909
2910         Non-unified build fixes late February 2020 edition
2911         https://bugs.webkit.org/show_bug.cgi?id=210767
2912
2913         Unreviewed build fix.
2914
2915         No new tests needed.
2916
2917         * css/MediaQueryListEvent.cpp: Add missing wtf/IsoMallocInlines.h header.
2918         * css/MediaQueryMatcher.cpp: Add missing MediaQueryListEvent.h header.
2919         * platform/graphics/FloatQuad.cpp: Add missing wtf/text/TextStream.h header.
2920
2921 2020-04-20  Ross Kirsling  <ross.kirsling@sony.com>
2922
2923         Classes marked final should not use protected access specifier
2924         https://bugs.webkit.org/show_bug.cgi?id=210775
2925
2926         Reviewed by Daniel Bates.
2927
2928         * Modules/applepay/ApplePayPaymentMethodSelectedEvent.h:
2929         * Modules/applepay/ApplePayValidateMerchantEvent.h:
2930         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.h:
2931         * Modules/webaudio/BiquadDSPKernel.h:
2932         * Modules/webaudio/WaveShaperDSPKernel.h:
2933         * Modules/websockets/WebSocketChannel.h:
2934         * Modules/websockets/WorkerThreadableWebSocketChannel.h:
2935         * Modules/webxr/WebXRSession.h:
2936         * Modules/webxr/WebXRSystem.h:
2937         * accessibility/AccessibilityARIAGridCell.h:
2938         * accessibility/AccessibleSetValueEvent.h:
2939         * animation/CSSAnimation.h:
2940         * bindings/js/ReadableStream.h:
2941         * bridge/objc/objc_runtime.h:
2942         * bridge/runtime_array.h:
2943         * css/CSSImageSetValue.h:
2944         * html/HTMLKeygenElement.cpp:
2945         * html/canvas/WebGLBuffer.h:
2946         * html/canvas/WebGLFramebuffer.h:
2947         * html/canvas/WebGLProgram.h:
2948         * html/canvas/WebGLQuery.h:
2949         * html/canvas/WebGLRenderbuffer.h:
2950         * html/canvas/WebGLSampler.h:
2951         * html/canvas/WebGLSync.h:
2952         * html/canvas/WebGLTransformFeedback.h:
2953         * html/canvas/WebGLUniformLocation.h:
2954         * html/shadow/TextControlInnerElements.h:
2955         * inspector/InspectorStyleSheet.h:
2956         * inspector/WebInjectedScriptManager.h:
2957         * loader/cache/CachedCSSStyleSheet.h:
2958         * page/Frame.h:
2959         * page/FrameView.h:
2960         * page/PageConsoleClient.h:
2961         * page/animation/KeyframeAnimation.h:
2962         * page/scrolling/nicosia/ScrollingTreeOverflowScrollProxyNode.h:
2963         * platform/audio/AudioBus.h:
2964         * platform/cocoa/PlaybackSessionModelMediaElement.h:
2965         * platform/graphics/BitmapImage.h:
2966         * platform/graphics/CrossfadeGeneratedImage.h:
2967         * platform/graphics/NamedImageGeneratedImage.h:
2968         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
2969         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2970         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.h:
2971         * platform/graphics/ca/win/PlatformCAAnimationWin.h:
2972         * platform/graphics/cg/ImageDecoderCG.h:
2973         * platform/graphics/iso/ISOOriginalFormatBox.h:
2974         * platform/graphics/iso/ISOProtectionSchemeInfoBox.h:
2975         * platform/graphics/iso/ISOSchemeInformationBox.h:
2976         * platform/graphics/iso/ISOSchemeTypeBox.h:
2977         * platform/graphics/iso/ISOTrackEncryptionBox.h:
2978         * platform/graphics/iso/ISOVTTCue.cpp:
2979         * platform/graphics/iso/ISOVTTCue.h:
2980         * platform/graphics/win/ImageDecoderDirect2D.h:
2981         * platform/mediastream/mac/AVCaptureDeviceManager.h:
2982         * platform/mock/mediasource/MockBox.h:
2983         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
2984         * rendering/RenderFullScreen.h:
2985         * rendering/RenderGrid.h:
2986         * rendering/RenderMultiColumnSet.h:
2987         * rendering/RenderRuby.h:
2988         * rendering/RenderScrollbarPart.h:
2989         * rendering/RenderScrollbarTheme.h:
2990         * rendering/RenderTableCell.h:
2991         * rendering/RenderTableSection.h:
2992         * rendering/RenderThemeIOS.h:
2993         * rendering/RenderView.h:
2994         * rendering/svg/RenderSVGResourceClipper.h:
2995         * svg/SVGTextPathElement.h:
2996         * workers/WorkerConsoleClient.h:
2997         * worklets/Worklet.h:
2998
2999 2020-04-20  Peng Liu  <peng.liu6@apple.com>
3000
3001         Fix build failures when video fullscreen and picture-in-picture is disabled
3002         https://bugs.webkit.org/show_bug.cgi?id=210777
3003
3004         Reviewed by Eric Carlson.
3005
3006         Wrap video fullscreen and picture-in-picture related code with "#if ENABLE(VIDEO_PRESENTATION_MODE)".
3007
3008         * Configurations/FeatureDefines.xcconfig:
3009         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3010         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity):
3011         * platform/graphics/avfoundation/objc/VideoLayerManagerObjC.h:
3012         * platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm:
3013         (WebCore::VideoLayerManagerObjC::setVideoLayer):
3014         (WebCore::VideoLayerManagerObjC::requiresTextTrackRepresentation const):
3015         (WebCore::VideoLayerManagerObjC::syncTextTrackBounds):
3016         (WebCore::VideoLayerManagerObjC::setTextTrackRepresentation):
3017
3018 2020-04-20  Nikos Mouchtaris  <nmouchtaris@apple.com>
3019
3020         WK2 Quicklook for attachments
3021         https://bugs.webkit.org/show_bug.cgi?id=208891
3022
3023         Reviewed by Darin Adler.
3024
3025         Added to HTMLAttachmentElement to have member image representing
3026         QuickLook thumbnail. Added code to render this image on both iOS and Mac.
3027
3028         No new tests. Test will be added after additions to test infrastructure.
3029
3030         * html/HTMLAttachmentElement.cpp:
3031         (WebCore::HTMLAttachmentElement::updateThumbnailRepresentation):
3032         Allow setting of thumbnail member.
3033         * html/HTMLAttachmentElement.h:
3034         * rendering/RenderThemeIOS.mm:
3035         Added rendering of image member of attachment element.
3036         (WebCore::RenderAttachmentInfo::RenderAttachmentInfo):
3037         (WebCore::paintAttachmentIcon):
3038         (WebCore::RenderThemeIOS::paintAttachment):
3039         * rendering/RenderThemeMac.mm:
3040         (WebCore::paintAttachmentIcon):
3041
3042 2020-04-20  Yusuke Suzuki  <ysuzuki@apple.com>
3043
3044         Add more structure-cloning tests for BigInt
3045         https://bugs.webkit.org/show_bug.cgi?id=210765
3046
3047         Reviewed by Mark Lam.
3048
3049         This patch adds safe-guard for future JSC primitive extension for structure-cloning.
3050         We throw DataCloneError if we see unknown primitive value, which can happen if JSC
3051         extends primitive value.
3052
3053         * bindings/js/SerializedScriptValue.cpp:
3054         (WebCore::CloneSerializer::dumpImmediate):
3055         (WebCore::CloneSerializer::dumpIfTerminal):
3056
3057 2020-04-20  Simon Fraser  <simon.fraser@apple.com>
3058
3059         Scrolling with background-attachment: fixed needs to trigger repaints
3060         https://bugs.webkit.org/show_bug.cgi?id=193893
3061         <rdar://problem/47587017>
3062
3063         Reviewed by Dean Jackson.
3064
3065         When scrolling an overflow scroll which has "background-atttachment:fixed" in the content,
3066         the node will have non-empty synchronous scrolling reasons. In this case we need to
3067         send the scroll to the main thread, and trigger a repaint on scroll.
3068
3069         If handling the wheel event on the scrolling thread determines that the scroll must be sent
3070         to the main thread, EventDispatcher::wheelEvent() does so in the callback function.
3071
3072         To trigger the repaint, RenderLayer::scrollTo() asks the composited layers backing whether
3073         the node has synchronous scrolling reasons; this is implemented by asking the scrolling
3074         coordinator.
3075
3076         Test: scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-overflow-repaint.html
3077
3078         * page/scrolling/AsyncScrollingCoordinator.cpp:
3079         (WebCore::AsyncScrollingCoordinator::hasSynchronousScrollingReasons const):
3080         * page/scrolling/AsyncScrollingCoordinator.h:
3081         * page/scrolling/ScrollingCoordinator.h:
3082         (WebCore::ScrollingCoordinator::hasSynchronousScrollingReasons const):
3083         * page/scrolling/ScrollingStateScrollingNode.h:
3084         (WebCore::ScrollingStateScrollingNode::hasSynchronousScrollingReasons const):
3085         * page/scrolling/ScrollingTree.cpp:
3086         (WebCore::ScrollingTree::handleWheelEvent):
3087         * page/scrolling/ScrollingTreeScrollingNode.h:
3088         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3089         (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged):
3090         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
3091         (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent): Return SendToMainThread if this node
3092         needs to do synchronous scrolling.
3093         * rendering/RenderLayer.cpp:
3094         (WebCore::RenderLayer::scrollTo):
3095         * rendering/RenderLayerBacking.cpp:
3096         (WebCore::RenderLayerBacking::needsRepaintOnCompositedScroll const):
3097         (WebCore::RenderLayerBacking::setRequiresOwnBackingStore):
3098         (WebCore::RenderLayerBacking::setContentsNeedDisplay):
3099         * rendering/RenderLayerBacking.h:
3100
3101 2020-04-20  Fujii Hironori  <Hironori.Fujii@sony.com>
3102
3103         MSVC: LayoutUnits.h(248): warning C4245: 'argument': conversion from 'const int' to 'size_t', signed/unsigned mismatch
3104         https://bugs.webkit.org/show_bug.cgi?id=210592
3105
3106         Reviewed by Zalan Bujtas.
3107
3108         * layout/LayoutUnits.h:
3109         (WTF::HashTraits<WebCore::Layout::SlotPosition>::emptyValue):
3110         (WTF::HashTraits<WebCore::Layout::SlotPosition>::constructDeletedValue):
3111         (WTF::HashTraits<WebCore::Layout::SlotPosition>::isDeletedValue):
3112         Use std::numeric_limits<size_t>::max() for empty and deleted
3113         values instead of WebCore::intMinForLayoutUnit.
3114
3115 2020-04-20  Wenson Hsieh  <wenson_hsieh@apple.com>
3116
3117         Text manipulation sometimes fails to replace text in title elements
3118         https://bugs.webkit.org/show_bug.cgi?id=210750
3119         <rdar://problem/61066103>
3120
3121         Reviewed by Tim Horton and Darin Adler.
3122
3123         Internal clients using WebKit text manipulation APIs currently fail to replace text in title and option elements
3124         in the case where text manipulation has been completed with more than one token. These are elements for which we
3125         want to replace the entire text as a single token, even if the text manipulation client ends up breaking the
3126         token into multiple chunks.
3127
3128         To handle this case, pull the `title || option` check out into a helper function, and consult it when completing
3129         text manipulation in the case where the manipulation data lacks either start or end positions. If
3130         `canPerformTextManipulationByReplacingEntireTextContent` is true and there are multiple replacement tokens,
3131         allow ourselves to process the replacement by combining the replacement tokens into a space-separated string.
3132
3133         Test: TextManipulation.CompleteTextManipulationShouldReplaceTextContentWithMultipleTokens
3134
3135         * editing/TextManipulationController.cpp:
3136         (WebCore::canPerformTextManipulationByReplacingEntireTextContent):
3137         (WebCore::TextManipulationController::observeParagraphs):
3138         (WebCore::TextManipulationController::replace):
3139
3140 2020-04-20  Andres Gonzalez  <andresg_22@apple.com>
3141
3142         The rect for the primary screen should be retrieved on the main thread.
3143         https://bugs.webkit.org/show_bug.cgi?id=210760
3144
3145         Reviewed by Chris Fleizach.
3146
3147         - Call to screenRectForPrimaryScreen is dispatched to main thread.
3148         - This value is cached since it is very unlikely to change in normal
3149         usage and this would avoid hitting the main thread repeatedly.
3150
3151         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3152         (-[WebAccessibilityObjectWrapper primaryScreenHeight]):
3153
3154 2020-04-15  Sergio Villar Senin  <svillar@igalia.com>
3155
3156         [WebXR] Update WebXRSession and WebXRSystem interfaces
3157         https://bugs.webkit.org/show_bug.cgi?id=210553
3158
3159         Reviewed by Žan Doberšek.
3160
3161         Update WebXRSession and WebXRSystem to the latest changes in the specs.
3162
3163         * Modules/webxr/WebXRSession.idl: Added 3 new events.
3164         * Modules/webxr/WebXRSystem.idl: Interface name is XR not XRSystem.
3165         * bindings/js/WebCoreBuiltinNames.h: Renamed macro.
3166         * dom/EventNames.h: Added 3 new events.
3167
3168 2020-04-20  Chris Dumez  <cdumez@apple.com>
3169
3170         Sending beacons when Fetch KeepAlive feature is disabled crashes the WebProcess
3171         https://bugs.webkit.org/show_bug.cgi?id=210753
3172         <rdar://problem/61896221>
3173
3174         Reviewed by Geoffrey Garen.
3175
3176         Test: http/wpt/beacon/beacon-legacy-code-path.html
3177
3178         * testing/InternalSettings.cpp:
3179         (WebCore::InternalSettings::Backup::Backup):
3180         (WebCore::InternalSettings::Backup::restoreTo):
3181         (WebCore::InternalSettings::setFetchAPIKeepAliveEnabled):
3182         * testing/InternalSettings.h:
3183         * testing/InternalSettings.idl:
3184         Add internal settings to disable Fetch Keep Alive for layout testing.
3185
3186 2020-04-20  Youenn Fablet  <youenn@apple.com>
3187
3188         MediaPlayerPrivateMediaStreamAVFObjC should start play a newly added audio track if it is playing
3189         https://bugs.webkit.org/show_bug.cgi?id=210740
3190
3191         Reviewed by Eric Carlson.
3192
3193         Before the patch, MediaPlayerPrivateMediaStreamAVFObjC was not calling play on the audio renderer when the audio renderer
3194         was added after the MediaPlayerPrivateMediaStreamAVFObjC was asked to play.
3195         This patch makes it so that, on configuration of an audio track, it will be asked to play if its MediaPlayerPrivateMediaStreamAVFObjC is playing.
3196         Add internals API to be able to write a test.
3197
3198         Test: fast/mediastream/play-newly-added-audio-track.html
3199
3200         * html/track/AudioTrack.h:
3201         * html/track/AudioTrack.idl:
3202         * platform/graphics/AudioTrackPrivate.h:
3203         (WebCore::AudioTrackPrivate::isBackedByMediaStreamTrack const):
3204         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3205         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
3206         * platform/mediastream/AudioTrackPrivateMediaStream.cpp:
3207         (WebCore::AudioTrackPrivateMediaStream::play):
3208         * platform/mediastream/AudioTrackPrivateMediaStream.h:
3209         (isType):
3210         * testing/Internals.cpp:
3211         (WebCore::Internals::isMockRealtimeMediaSourceCenterEnabled):
3212         (WebCore::Internals::shouldAudioTrackPlay):
3213         * testing/Internals.h:
3214         * testing/Internals.idl:
3215
3216 2020-04-20  Youenn Fablet  <youenn@apple.com>
3217
3218         Use a WeakHashSet to store MediaStreamPrivate observers
3219         https://bugs.webkit.org/show_bug.cgi?id=210494
3220
3221         Reviewed by Eric Carlson.
3222
3223         Remove observers from the MediaStream and migrate existing client (MediaRecorder) to MediaStreamPrivate::Observer.
3224         Make use of WeakHashSet in MediaStreamPrivate to improve robustness of the code.
3225         Any time the MediaStreamPrivate tracks are modified, observers will be notified.
3226         MediaStream needs now to decide when to send an event when its MediaStreamPrivate notifies of new/deleted tracks,
3227         Modernize a bit the code to use more references.
3228         Covered by existing tests.
3229
3230         * Modules/mediarecorder/MediaRecorder.cpp:
3231         (WebCore::MediaRecorder::MediaRecorder):
3232         (WebCore::MediaRecorder::~MediaRecorder):
3233         (WebCore::MediaRecorder::handleTrackChange):
3234         * Modules/mediarecorder/MediaRecorder.h:
3235         * Modules/mediastream/MediaStream.cpp:
3236         (WebCore::createTrackPrivateVector):
3237         (WebCore::MediaStream::MediaStream):
3238         (WebCore::MediaStream::~MediaStream):
3239         (WebCore::MediaStream::addTrack):
3240         (WebCore::MediaStream::removeTrack):
3241         (WebCore::MediaStream::getTrackById):
3242         (WebCore::MediaStream::didAddTrack):
3243         (WebCore::MediaStream::didRemoveTrack):
3244         (WebCore::MediaStream::addTrackFromPlatform):
3245         (WebCore::MediaStream::internalAddTrack):
3246         (WebCore::MediaStream::internalTakeTrack):
3247         * Modules/mediastream/MediaStream.h:
3248         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3249         (WebCore::LibWebRTCMediaEndpoint::removeRemoteTrack):
3250         * platform/mediastream/MediaStreamPrivate.cpp:
3251         (WebCore::MediaStreamPrivate::MediaStreamPrivate):
3252         (WebCore::MediaStreamPrivate::addObserver):
3253         (WebCore::MediaStreamPrivate::removeObserver):
3254         (WebCore::MediaStreamPrivate::forEachObserver):
3255         (WebCore::MediaStreamPrivate::computeActiveState):
3256         (WebCore::MediaStreamPrivate::updateActiveState):
3257         (WebCore::MediaStreamPrivate::addTrack):
3258         (WebCore::MediaStreamPrivate::removeTrack):
3259         (WebCore::MediaStreamPrivate::trackEnded):
3260         * platform/mediastream/MediaStreamPrivate.h:
3261         * testing/Internals.cpp:
3262         (WebCore::Internals::removeMediaStreamTrack):
3263
3264 2020-04-19  Simon Fraser  <simon.fraser@apple.com>
3265
3266         Content disappears on CSS parallax example
3267         https://bugs.webkit.org/show_bug.cgi?id=210732
3268         <rdar://problem/61997636>
3269
3270         Reviewed by Darin Adler.
3271
3272         If scrolling affects the computation of coverage rect of a TiledBacking, we plumb
3273         that expanded coverage back into TransformState which is maintained during GraphicsLayer flushing,
3274         and it's used to compute coverage rect for descendants.
3275
3276         It's passed into TransformState::setLastPlanarSecondaryQuad(), which has to map it back into
3277         the coordinate system of the last flattening ancestor. However, TransformState::mapQuad()
3278         had a missing return and the quad mapping was wrong. The new code is now the same as
3279         TransformState::mappedPoint() (you can see where the copy/paste error came from).
3280
3281         Test: compositing/tiling/coverage-adjustment-secondary-quad-mapping.html
3282
3283         * platform/graphics/transforms/TransformState.cpp:
3284         (WebCore::TransformState::mapQuad const):
3285         (WebCore::TransformState::flattenWithTransform):
3286
3287 2020-04-20  Zalan Bujtas  <zalan@apple.com>
3288
3289         [LFC][TFC] Add support for border-collapse: collapse.
3290         https://bugs.webkit.org/show_bug.cgi?id=210747
3291
3292         Reviewed by Antti Koivisto.
3293
3294         Test: fast/layoutformattingcontext/table-flex-width-border-collapse.html
3295
3296         * layout/tableformatting/TableFormattingContext.cpp:
3297         (WebCore::Layout::TableFormattingContext::ensureTableGrid):
3298
3299 2020-04-20  Wenson Hsieh  <wenson_hsieh@apple.com>
3300
3301         Oversized caret and selection rects in text fields on ganji.com and netflix.com/login
3302         https://bugs.webkit.org/show_bug.cgi?id=210622
3303         <rdar://problem/45945636>
3304
3305         Reviewed by Darin Adler.
3306
3307         Currently, selection and caret rects in text fields on some web pages can be excessively tall. This patch makes
3308         a small adjustment to allow the top of the caret or selection rect to snap to the top of the inline box instead
3309         of being at the end of the previous line, in the case where there is no previous inline box.
3310
3311         In the case where we compute the caret rect for an empty renderer (i.e. no children), we make an additional
3312         tweak so that the caret rect's height is based on the computed font height instead of line height, and then we
3313         ensure that the caret is (logically) vertically centered.
3314
3315         See below for more details.
3316
3317         Test: editing/selection/selection-and-caret-do-not-extend-to-line-height.html
3318
3319         * rendering/RenderBlockFlow.cpp:
3320         (WebCore::RenderBlockFlow::positionForPointWithInlineChildren):
3321
3322         Specify ForHitTesting::Yes when asking for selectionTop().
3323
3324         * rendering/RenderBoxModelObject.cpp:
3325         (WebCore::RenderBoxModelObject::localCaretRectForEmptyElement):
3326
3327         Use FontMetric's height when computing the height of the caret rect, and then center it vertically in the
3328         renderer.
3329
3330         * rendering/RenderReplaced.cpp:
3331         (WebCore::RenderReplaced::positionForPoint):
3332
3333         Specify ForHitTesting::Yes when asking for selectionTop(). See below for more information.
3334
3335         * rendering/RenderTextLineBoxes.cpp:
3336         (WebCore::RenderTextLineBoxes::positionForPoint const):
3337         * rendering/RootInlineBox.cpp:
3338         (WebCore::RootInlineBox::selectionTop const):
3339
3340         When computing selectionTop(), we currently fall back to using the top of the containing RenderBlockFlow
3341         (`blockFlow().borderAndPaddingBefore()`) in the case where there is no previous root box. However, this can lead
3342         to selection and caret rects being taller than expected; instead, we can use the max of the `selectionTop`
3343         (that is, the top of the line box, adjusted for annotations) and the top of the RenderBlockFlow. This has the
3344         effect of allowing the caret and selection to visually snap to the top of a run of text, provided there is not
3345         already a line of text that precedes it. Taking the maximum of the two values ensures that we don't
3346         unintentionally make the selection or caret rects even larger, if the line top is above the top of the block.
3347
3348         Note that we also avoid shrinking the selection and caret rects when hit-testing renderers for positions and
3349         ranges. This allows users to still click and drag to select text in the extra line-height area above a piece of
3350         text, even if the selection is only painted over the text (and not in the region containing the line-height).
3351         This behavior was established in the fix for webkit.org/b/14911, and is covered by the layout test
3352         `editing/selection/inline-closest-leaf-child.html`.
3353
3354         * rendering/RootInlineBox.h:
3355
3356 2020-04-20  Darin Adler  <darin@apple.com>
3357
3358         Use #import instead of #include in Objective-C and don't use #pragma once
3359         https://bugs.webkit.org/show_bug.cgi?id=210724
3360
3361         Reviewed by David Kilzer.
3362
3363         * page/cocoa/SettingsBaseCocoa.mm:
3364         (WebCore::sansSerifTraditionalHanFontFamily): Deleted.
3365         (WebCore::sansSerifSimplifiedHanFontFamily): Deleted.
3366         (WebCore::SettingsBase::initializeDefaultFontFamilies): Just use font name
3367         strings directly since there are no conditionals any more.
3368
3369         * Modules/applepay/PaymentRequestValidator.mm:
3370         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
3371         * accessibility/ios/WebAccessibilityObjectWrapperIOS.h:
3372         * accessibility/mac/AXObjectCacheMac.mm:
3373         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
3374         * accessibility/mac/WebAccessibilityObjectWrapperMac.h:
3375         * bridge/objc/WebScriptObjectPrivate.h:
3376         * bridge/objc/objc_class.mm:
3377         * bridge/testbindings.mm:
3378         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
3379         * editing/cocoa/WebArchiveResourceFromNSAttributedString.h:
3380         * editing/cocoa/WebArchiveResourceWebResourceHandler.h:
3381         * editing/cocoa/WebContentReaderCocoa.mm:
3382         * history/mac/HistoryItemMac.mm:
3383         * loader/cocoa/DiskCacheMonitorCocoa.mm:
3384         * loader/cocoa/SubresourceLoaderCocoa.mm:
3385         * loader/mac/ResourceLoaderMac.mm:
3386         * page/cocoa/MemoryReleaseCocoa.mm:
3387         * page/cocoa/ResourceUsageOverlayCocoa.mm:
3388         * page/cocoa/ResourceUsageThreadCocoa.mm:
3389         * page/ios/WebEventRegion.h:
3390         * page/mac/ChromeMac.mm:
3391         * page/mac/EventHandlerMac.mm:
3392         * page/mac/WheelEventDeltaFilterMac.mm:
3393         * page/scrolling/cocoa/ScrollingStateNode.mm:
3394         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
3395         * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm:
3396         * page/scrolling/mac/ScrollingStateScrollingNodeMac.mm:
3397         * page/scrolling/mac/ScrollingThreadMac.mm:
3398         * page/scrolling/mac/ScrollingTreeMac.mm:
3399         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
3400         * platform/audio/mac/AudioSampleDataSource.mm:
3401         * platform/cocoa/DataDetectorsCoreSoftLink.mm:
3402         * platform/cocoa/PasteboardCocoa.mm:
3403         * platform/cocoa/ScrollSnapAnimatorState.mm:
3404         * platform/cocoa/SystemVersion.mm:
3405         * platform/gamepad/cocoa/GameControllerGamepad.mm:
3406         * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
3407         * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm:
3408         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3409         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
3410         * platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm:
3411         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
3412         * platform/graphics/ca/cocoa/WebSystemBackdropLayer.h:
3413         * platform/graphics/ca/cocoa/WebTiledBackingLayer.h:
3414         * platform/graphics/ca/cocoa/WebVideoContainerLayer.h:
3415         * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
3416         * platform/graphics/cocoa/IOSurfacePoolCocoa.mm:
3417         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
3418         * platform/graphics/cocoa/WebGLLayer.h:
3419         * platform/graphics/cocoa/WebGLLayer.mm:
3420         * platform/graphics/cocoa/WebGPULayer.h:
3421         * platform/graphics/cocoa/WebGPULayer.mm:
3422         * platform/graphics/cv/ImageRotationSessionVT.mm:
3423         * platform/graphics/cv/ImageTransferSessionVT.mm:
3424         * platform/graphics/cv/TextureCacheCV.mm:
3425         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
3426         * platform/graphics/gpu/cocoa/GPUComputePassEncoderMetal.mm:
3427         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
3428         * platform/graphics/mac/FloatPointMac.mm:
3429         * platform/graphics/mac/FloatSizeMac.mm:
3430         * platform/graphics/mac/IntPointMac.mm:
3431         * platform/graphics/mac/IntSizeMac.mm:
3432         * platform/graphics/mac/WebLayer.h:
3433         * platform/graphics/mac/WebLayer.mm:
3434         * platform/ios/LegacyTileCache.mm:
3435         * platform/ios/LegacyTileGrid.mm:
3436         * platform/ios/LegacyTileGridTile.mm:
3437         * platform/ios/LegacyTileLayer.h:
3438         * platform/ios/LegacyTileLayer.mm:
3439         * platform/ios/LegacyTileLayerPool.mm:
3440         * platform/ios/LocalCurrentTraitCollection.mm:
3441         * platform/ios/LocalizedDeviceModel.mm:
3442         * platform/ios/ScrollbarThemeIOS.mm:
3443         * platform/ios/WebCoreMotionManager.h:
3444         * platform/ios/WebItemProviderPasteboard.mm:
3445         * platform/ios/WebVideoFullscreenControllerAVKit.h:
3446         * platform/mac/LocalCurrentGraphicsContext.mm:
3447         * platform/mac/LocalDefaultSystemAppearance.mm:
3448         * platform/mac/LoggingMac.mm:
3449         * platform/mac/PlatformEventFactoryMac.mm:
3450         * platform/mac/RemoteCommandListenerMac.mm:
3451         * platform/mac/ScrollAnimatorMac.mm:
3452         * platform/mac/SerializedPlatformDataCueMac.mm:
3453         * platform/mac/WebCoreFullScreenPlaceholderView.mm:
3454         * platform/mac/WebCoreFullScreenWarningView.h:
3455         * platform/mac/WebCoreFullScreenWarningView.mm:
3456         * platform/mac/WebCoreFullScreenWindow.h:
3457         * platform/mac/WebCoreObjCExtras.mm:
3458         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
3459         * platform/mediasession/mac/MediaSessionInterruptionProviderMac.mm:
3460         * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
3461         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:
3462         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
3463         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.mm:
3464         * platform/mediastream/mac/RealtimeVideoUtilities.mm:
3465         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
3466         * platform/network/cocoa/CertificateInfoCocoa.mm:
3467         * platform/network/cocoa/WebCoreNSURLSession.h:
3468         * platform/network/mac/BlobDataFileReferenceMac.mm:
3469         * platform/network/mac/CredentialStorageMac.mm:
3470         * platform/network/mac/SynchronousLoaderClient.mm:
3471         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
3472         * platform/text/cocoa/LocaleCocoa.mm:
3473         * testing/ServiceWorkerInternals.mm:
3474         * testing/cocoa/WebViewVisualIdentificationOverlay.h:
3475         More #import, less #pragma once.
3476
3477 2020-04-20  Youenn Fablet  <youenn@apple.com>
3478
3479         Safari doesn't apply frameRate limit when request stream from Camera
3480         https://bugs.webkit.org/show_bug.cgi?id=210186
3481         <rdar://problem/61452794>
3482
3483         Reviewed by Eric Carlson.
3484
3485         Add support to RealtimeVideoSource to decimate the video samples based on the observed frame rate of its capture source.
3486         This allows supporting two tracks using the same capture device, one track being low frame rate and the other one high frame rate.
3487
3488         Clean-up refactoring to make RealtimeVideoSource directly inherit from RealtimeVideoCaptureSource.
3489         Migrate size and format of frame adaptation from RealtimeVideoCaptureSource to RealtimeVideoSource.
3490         Fix mock capture source to update its frame rate when asked by applyConstraints.
3491
3492         Tests: fast/mediastream/mediastreamtrack-video-frameRate-clone-decreasing.html
3493                fast/mediastream/mediastreamtrack-video-frameRate-clone-increasing.html
3494                fast/mediastream/mediastreamtrack-video-frameRate-decreasing.html
3495                fast/mediastream/mediastreamtrack-video-frameRate-increasing.html
3496
3497         * platform/mediastream/RealtimeVideoCaptureSource.cpp:
3498         (WebCore::RealtimeVideoCaptureSource::dispatchMediaSampleToObservers):
3499         (WebCore::RealtimeVideoCaptureSource::clientUpdatedSizeAndFrameRate):
3500         * platform/mediastream/RealtimeVideoCaptureSource.h:
3501         (WebCore::RealtimeVideoCaptureSource::observedFrameRate const):
3502         * platform/mediastream/RealtimeVideoSource.cpp:
3503         (WebCore::RealtimeVideoSource::RealtimeVideoSource):
3504         (WebCore::m_source):
3505         (WebCore::RealtimeVideoSource::adaptVideoSample):
3506         (WebCore::RealtimeVideoSource::videoSampleAvailable):
3507         * platform/mediastream/RealtimeVideoSource.h:
3508         * platform/mock/MockRealtimeVideoSource.cpp:
3509         (WebCore::MockRealtimeVideoSource::setFrameRateWithPreset):
3510         * testing/Internals.cpp:
3511         (WebCore::Internals::observeMediaStreamTrack):
3512
3513 2020-04-20  Antoine Quint  <graouts@apple.com>
3514
3515         WebAnimations API doesn't properly apply keyframe easings to transforms
3516         https://bugs.webkit.org/show_bug.cgi?id=210526
3517         <rdar://problem/61800424>
3518
3519         Reviewed by Antti Koivisto.
3520
3521         GraphicsLayerCA has code that determines whether an animation can be accelerated looking at the timing function of its keyframes and excluding
3522         animations that use a steps timing function as one of its values. However, we we would fail to set the timing function on the KeyframeValue for
3523         each keyframe in the KeyframeList we create for a JS-originated animation. We now do this correctly.
3524
3525         Test: webanimations/transform-animation-with-steps-timing-function-not-accelerated.html
3526
3527         * animation/KeyframeEffect.cpp:
3528         (WebCore::KeyframeEffect::updateBlendingKeyframes):
3529
3530 2020-04-20  Yusuke Suzuki  <ysuzuki@apple.com>
3531
3532         StructuredClone algorithm should be aware of BigInt
3533         https://bugs.webkit.org/show_bug.cgi?id=210728
3534
3535         Reviewed by Mark Lam.
3536
3537         This patch adds structured-cloning for BigInt and BigIntObject.
3538         The logic is adding BigIntTag & BigIntObjectTag. And then we put content of BigInt with length.
3539         And deserialization reads them to reconstruct BigInt or BigIntObject.
3540
3541         * bindings/js/SerializedScriptValue.cpp:
3542         (WebCore::CloneSerializer::dumpImmediate):
3543         (WebCore::CloneSerializer::dumpBigIntData):
3544         (WebCore::CloneSerializer::dumpBigInt32Data):
3545         (WebCore::CloneSerializer::dumpHeapBigIntData):
3546         (WebCore::CloneSerializer::dumpIfTerminal):
3547         (WebCore::CloneDeserializer::readBigInt):
3548         (WebCore::CloneDeserializer::readTerminal):
3549
3550 2020-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3551
3552         [GTK][WPE] Enable resource load statistics
3553         https://bugs.webkit.org/show_bug.cgi?id=210184
3554
3555         Reviewed by Žan Doberšek.
3556
3557         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3558         (WebCore::NetworkStorageSession::setCookiesFromDOM const): Return early if cookies are blocked and update the
3559         persistent cookies expiration if needed.
3560         (WebCore::NetworkStorageSession::deleteCookiesForHostnames): Implement this when receiving
3561         IncludeHttpOnlyCookies parameter.
3562         (WebCore::NetworkStorageSession::hasCookies const): Implement this.
3563         (WebCore::NetworkStorageSession::getRawCookies const): Honor shouldAskITP parameter.
3564         (WebCore::cookiesForSession): Ditto.
3565         (WebCore::NetworkStorageSession::cookiesForDOM const): Ditto.
3566         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const): Ditto.
3567
3568 2020-04-19  Simon Fraser  <simon.fraser@apple.com>
3569
3570         Use Optional<FloatQuad> in TransformState
3571         https://bugs.webkit.org/show_bug.cgi?id=144226
3572
3573         Reviewed by Sam Weinig.
3574
3575         Use Optional<> instead of pointers in TransformState, make it loggable, make FloatQuad loggable.
3576
3577         * platform/graphics/FloatQuad.cpp:
3578         (WebCore::operator<<):
3579         * platform/graphics/FloatQuad.h:
3580         * platform/graphics/ca/GraphicsLayerCA.cpp:
3581         (WebCore::GraphicsLayerCA::flushCompositingState):
3582         (WebCore::GraphicsLayerCA::computeVisibleAndCoverageRect const):
3583         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
3584         * platform/graphics/transforms/TransformState.cpp:
3585         (WebCore::TransformState::operator=):
3586         (WebCore::TransformState::mappedSecondaryQuad const):
3587         (WebCore::TransformState::setLastPlanarSecondaryQuad):
3588         (WebCore::TransformState::flattenWithTransform):
3589         (WebCore::operator<<):
3590         * platform/graphics/transforms/TransformState.h:
3591         (WebCore::TransformState::setSecondaryQuad):
3592         (WebCore::TransformState::lastPlanarSecondaryQuad const):
3593         (WebCore::TransformState::isMappingSecondaryQuad const):
3594         (WebCore::TransformState::accumulatedTransform const):
3595
3596 2020-04-19  Rob Buis  <rbuis@igalia.com>
3597
3598         Remove unneeded code from FrameLoader::loadURL
3599         https://bugs.webkit.org/show_bug.cgi?id=210696
3600
3601         Reviewed by Darin Adler.
3602
3603         Remove unneeded code from FrameLoader::loadURL, since the only way the load type can be Reload
3604         is if loadFrameRequest set it, and the only way loadFrameRequest can set it is if cachePolicy
3605         is ReloadIgnoringCacheData, so no need to set it again in FrameLoader::loadURL.
3606
3607         * loader/FrameLoader.cpp:
3608         (WebCore::FrameLoader::loadURL):
3609
3610 2020-04-19  Brady Eidson  <beidson@apple.com>
3611
3612         Add WKScriptMessageHandler API that asynchronously responds with a promise.
3613         rdar://problem/57243492 and https://bugs.webkit.org/show_bug.cgi?id=206398
3614
3615         Reviewed by Andy Estes.
3616
3617         Covered by new API tests.
3618
3619         Updated for moving an #include into implementation files:
3620         * bindings/js/JSDOMPromiseDeferred.cpp:
3621         * bindings/js/JSDOMPromiseDeferred.h:    
3622         * html/HTMLMediaElement.cpp:
3623         * page/DOMWindow.cpp:
3624         * workers/service/ServiceWorkerGlobalScope.cpp:
3625         
3626         * page/UserMessageHandler.cpp:
3627         (WebCore::UserMessageHandler::postMessage): Return a promise to be fulfilled by the API client.
3628         * page/UserMessageHandler.h:
3629         * page/UserMessageHandler.idl:
3630         * page/UserMessageHandlerDescriptor.h:
3631
3632 2020-04-19  Zalan Bujtas  <zalan@apple.com>
3633
3634         [LFC][TFC] Add column spanning support for flexible table width
3635         https://bugs.webkit.org/show_bug.cgi?id=210713
3636
3637         Reviewed by Antti Koivisto.
3638
3639         Test: fast/layoutformattingcontext/table-flex-width-colspans.html
3640
3641         This patch slightly changes the extra space distribution logic by using either the minimum or
3642         the maximum width as the base initial width for the columns.
3643
3644         * layout/tableformatting/TableFormattingContext.cpp:
3645         (WebCore::Layout::TableFormattingContext::layoutInFlowContent):
3646         (WebCore::Layout::TableFormattingContext::computeColumnWidths):
3647         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace): Deleted.
3648         * layout/tableformatting/TableFormattingContext.h:
3649
3650 2020-04-19  Emilio Cobos Álvarez  <emilio@crisal.io>
3651
3652         Don't use the inherited custom properties to store environment variables.
3653         https://bugs.webkit.org/show_bug.cgi?id=210707
3654
3655         Reviewed by Antti Koivisto.
3656
3657         It leaks this implementation detail when enumerating the computed style.
3658
3659         Tests: imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml.xhtml
3660                imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration.html
3661
3662         * css/CSSVariableReferenceValue.cpp:
3663         (WebCore::resolveVariableReference):
3664         (WebCore::resolveTokenRange):
3665         * style/StyleResolveForDocument.cpp:
3666         (WebCore::Style::resolveForDocument):
3667
3668 2020-04-19  Antti Koivisto  <antti@apple.com>
3669
3670         [CSS selectors] :is() / :where() should not allow pseudo-elements at parse-time
3671         https://bugs.webkit.org/show_bug.cgi?id=210701
3672
3673         Reviewed by Anders Carlsson.
3674
3675         https://drafts.csswg.org/selectors/#matches:
3676
3677         "Pseudo-elements cannot be represented by the matches-any pseudo-class; they are not valid within :is()."
3678
3679         Test: fast/selectors/pseudo-element-in-is-where.html
3680
3681         * css/parser/CSSSelectorParser.cpp:
3682         (WebCore::CSSSelectorParser::consumePseudo):
3683
3684 2020-04-19  Zalan Bujtas  <zalan@apple.com>
3685
3686         [LFC][TFC] Take border spacing into account when distributing column spanners width.
3687         https://bugs.webkit.org/show_bug.cgi?id=210712
3688
3689         Reviewed by Antti Koivisto.
3690
3691         While distributing the column spanner extra space among individual columns,
3692         the spacing between these columns (set by border-spacing) should be taken into
3693         account and subtract it from the width to distribute.
3694
3695         <table style="border-spacing: 50px"><tr><td colspan=2>long long text</td></tr><tr><td>lo</td><td>xt</td><tr></table>
3696         [long long text]
3697         [lo]        [xt]
3698         The individual columns don't require any extra space from the spanner.
3699  
3700         * layout/FormattingContext.h:
3701         (WebCore::Layout::FormattingContext::IntrinsicWidthConstraints::operator+=):
3702         (WebCore::Layout::FormattingContext::IntrinsicWidthConstraints::operator-=):
3703         * layout/tableformatting/TableFormattingContext.cpp:
3704         (WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints):
3705         (WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns):
3706         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace):
3707         * layout/tableformatting/TableGrid.h:
3708         (WebCore::Layout::TableGrid::horizontalSpacing const):
3709         (WebCore::Layout::TableGrid::totalHorizontalSpacing const): Deleted.
3710
3711 2020-04-19  Emilio Cobos Álvarez  <emilio@crisal.io>
3712
3713         Fix the logic to decide whether a property is enumerated in a computed style declaration.
3714         https://bugs.webkit.org/show_bug.cgi?id=210695
3715
3716         Reviewed by Antti Koivisto.
3717
3718         Fix the logic to decide whether a property is enumerated in a computed
3719         style declaration.
3720
3721         Logical properties don't need stylebuilder code, but still should be
3722         generated. Using the specification->category for this seems a bit
3723         hacky, but unclear if it's worse than adding a new flag.
3724
3725         Tests: fast/css/getComputedStyle/computed-style-enumeration.html
3726                imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration.html
3727
3728         * css/makeprop.pl:
3729         (skippedFromComputedStyle):
3730         (isLogical):
3731         (sortWithPrefixedPropertiesLast):
3732
3733 2020-04-18  Antti Koivisto  <antti@apple.com>
3734
3735         [CSS selectors] Support :where() pseudo class
3736         https://bugs.webkit.org/show_bug.cgi?id=210690
3737
3738         Reviewed by Sam Weinig.
3739
3740         "The Specificity-adjustment pseudo-class, :where(), is a functional pseudo-class with the same
3741         syntax and functionality as :is(). Unlike :is(), neither the :where pseudo-class, nor any of
3742         its arguments contribute to the specificity of the selector—its specificity is always zero.
3743
3744         This is useful for introducing filters in a selector while keeping the associated style
3745         declarations easy to override."
3746
3747         https://drafts.csswg.org/selectors-4/#zero-matches
3748
3749         In terms of implementation this is just another alias for :is() with different (always 0) specificity.
3750
3751         Test: fast/selectors/where-specificity.html
3752
3753         * css/CSSSelector.cpp:
3754         (WebCore::simpleSelectorSpecificityInternal):
3755
3756         Here is where it differs from PseudoClassIs.
3757
3758         (WebCore::CSSSelector::selectorText const):
3759         * css/CSSSelector.h:
3760         * css/SelectorChecker.cpp:
3761         (WebCore::SelectorChecker::checkOne const):
3762         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
3763         * css/parser/CSSSelectorParser.cpp:
3764         (WebCore::isOnlyPseudoClassFunction):
3765         (WebCore::CSSSelectorParser::consumePseudo):
3766         * cssjit/SelectorCompiler.cpp:
3767         (WebCore::SelectorCompiler::addPseudoClassType):
3768
3769 2020-04-18  Rob Buis  <rbuis@igalia.com>
3770
3771         Reduce parameter list of the FrameLoadRequest constructor
3772         https://bugs.webkit.org/show_bug.cgi?id=210668
3773
3774         Reviewed by Darin Adler.
3775
3776         Reduce parameter list of the FrameLoadRequest constructor by
3777         instead using various setters. By choosing the most common
3778         defaults the actual number of setters to call are minimized.
3779
3780         * inspector/InspectorFrontendClientLocal.cpp:
3781         (WebCore::InspectorFrontendClientLocal::openInNewTab):
3782         * inspector/agents/InspectorPageAgent.cpp:
3783         (WebCore::InspectorPageAgent::navigate):
3784         * loader/DocumentLoader.cpp:
3785         (WebCore::DocumentLoader::handleProvisionalLoadFailureFromContentFilter):
3786         * loader/FrameLoadRequest.cpp:
3787         (WebCore::FrameLoadRequest::FrameLoadRequest):
3788         * loader/FrameLoadRequest.h:
3789         (WebCore::FrameLoadRequest::FrameLoadRequest):
3790         (WebCore::FrameLoadRequest::disableShouldReplaceDocumentIfJavaScriptURL):
3791         * loader/FrameLoader.cpp:
3792         (WebCore::FrameLoader::changeLocation):
3793         (WebCore::FrameLoader::loadURLIntoChildFrame):
3794         * loader/NavigationScheduler.cpp:
3795         (WebCore::NavigationScheduler::scheduleLocationChange):
3796         * page/ContextMenuController.cpp:
3797         (WebCore::openNewWindow):
3798         (WebCore::ContextMenuController::contextMenuItemSelected):
3799         * page/DOMWindow.cpp:
3800         (WebCore::DOMWindow::createWindow):
3801         * page/DragController.cpp:
3802         (WebCore::DragController::performDragOperation):
3803
3804 2020-04-18  David Kilzer  <ddkilzer@apple.com>
3805
3806         Attempt #3 to fix tvOS build
3807
3808         Unreviewed.
3809
3810         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3811         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
3812         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateDisableExternalPlayback):
3813         - Use !PLATFORM(APPLETV) to comment out functions declared within
3814           ENABLE(VIDEO_PRESENTATION_MODE) from r260307 and r260308.
3815
3816 2020-04-18  Yusuke Suzuki  <ysuzuki@apple.com>
3817
3818         [WTF] Move DataRef.h from WebCore to WTF to utilize it in JSC
3819         https://bugs.webkit.org/show_bug.cgi?id=210689
3820
3821         Reviewed by Anders Carlsson.
3822
3823         No behavior change, just moving header from WebCore to WTF.
3824
3825         * Headers.cmake:
3826         * WebCore.xcodeproj/project.pbxproj:
3827         * rendering/style/NinePieceImage.h:
3828         * rendering/style/RenderStyle.h:
3829         * rendering/style/SVGRenderStyle.h:
3830         * rendering/style/StyleRareInheritedData.cpp:
3831         * rendering/style/StyleRareInheritedData.h:
3832         * rendering/style/StyleRareNonInheritedData.h:
3833
3834 2020-04-18  David Kilzer  <ddkilzer@apple.com>
3835
3836         Attempt #2 to fix tvOS build
3837
3838         Unreviewed.
3839
3840         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3841         - Add #if ENABLE(VIDEO_PRESENTATION_MODE)/#endif to protect
3842           methods defined in MediaPlayerPrivate.h.
3843         - The previous commit was (r260307) also to fix tvOS, not watchOS.
3844
3845 2020-04-18  David Kilzer  <ddkilzer@apple.com>
3846
3847         Attempt to fix watchOS build
3848
3849         Unreviewed.
3850
3851         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3852         - Add #if ENABLE(VIDEO_PRESENTATION_MODE)/#endif to protect
3853           methods defined in MediaPlayerPrivate.h.
3854
3855 2020-04-17  Simon Fraser  <simon.fraser@apple.com>
3856
3857         Group overflow controls layers into a single container layer
3858         https://bugs.webkit.org/show_bug.cgi?id=210675
3859
3860         Reviewed by Zalan Bujtas.
3861
3862         Overflow control layers are going to change z-order in a future change. To make this
3863         easier, group the overflow controls layer into their own container layer.
3864
3865         * rendering/RenderLayerBacking.cpp:
3866         (WebCore::RenderLayerBacking::updateDebugIndicators):
3867         (WebCore::RenderLayerBacking::updateGeometry): Size the overflow controls layer using paddingBoxRectIncludingScrollbar().
3868         (WebCore::RenderLayerBacking::updateInternalHierarchy): New parenting.
3869         (WebCore::RenderLayerBacking::updateOverflowControlsLayers): Some refactoring with a nice lambda.
3870         (WebCore::RenderLayerBacking::positionOverflowControlsLayers): Lovely lambda here. Nice.
3871         * rendering/RenderLayerBacking.h:
3872
3873 2020-04-17  Kate Cheney  <katherine_cheney@apple.com>
3874
3875         Enable service workers for app-bound domains
3876         https://bugs.webkit.org/show_bug.cgi?id=210451
3877         <rdar://problem/61479474>
3878
3879         Reviewed by Brent Fulgham.
3880
3881         SWServer now retrieves the app-bound domains from the UI Process and
3882         only continues with the load if the proper entitlement is present
3883         or the load is coming from an app-bound domain.
3884
3885         * workers/service/server/SWServer.cpp:
3886         (WebCore::SWServer::addRegistrationFromStore):
3887         (WebCore::SWServer::SWServer):
3888         (WebCore::SWServer::validateRegistrationDomain):
3889         (WebCore::SWServer::scheduleJob):
3890         * workers/service/server/SWServer.h:
3891
3892 2020-04-17  Dean Jackson  <dino@apple.com>
3893
3894         [WebGL] Confirm there are no errors when setting up framebuffers
3895         https://bugs.webkit.org/show_bug.cgi?id=210632
3896         <rdar://problem/61916680>
3897
3898         Reviewed by Simon Fraser.
3899
3900         We're seeing crashes on macOS inside GraphicsContextGL::reshape().
3901         Specifically when we submit work at the end of the function via
3902         glFlush.
3903
3904         At the moment the cause is a mystery, because we should bail out
3905         before then if the multisample renderbuffer was not complete. In
3906         the hope that it helps somewhat, add a call to glGetError to double
3907         check that there isn't anything horribly wrong before we talk to
3908         the GPU.
3909
3910         * html/canvas/WebGL2RenderingContext.cpp:
3911         (WebCore::WebGL2RenderingContext::WebGL2RenderingContext): If the underlying
3912         GCGL context was marked as "LOST" during initialization, skip the rest of our
3913         initialization.
3914         * html/canvas/WebGLRenderingContext.cpp: Ditto.
3915         (WebCore::WebGLRenderingContext::WebGLRenderingContext):
3916         * html/canvas/WebGLRenderingContextBase.cpp: Ditto.
3917         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
3918
3919         * platform/graphics/angle/GraphicsContextGLANGLE.cpp: Check for a GL error during
3920         setup and, if there is one, skip directly into a LOST state.
3921         (WebCore::GraphicsContextGLOpenGL::reshape):
3922         * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp:
3923         (WebCore::GraphicsContextGLOpenGL::reshape):
3924
3925 2020-04-17  Peng Liu  <peng.liu6@apple.com>
3926
3927         Cleanup the macros for video fullscreen and picture-in-picture
3928         https://bugs.webkit.org/show_bug.cgi?id=210638
3929
3930         Reviewed by Eric Carlson.
3931
3932         A follow-up patch to fix build failures of r260259.
3933
3934         * platform/ios/VideoFullscreenInterfaceAVKit.h:
3935         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
3936         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3937
3938 2020-04-17  David Kilzer  <ddkilzer@apple.com>
3939
3940         REGRESSION (r234105): [iOS] WKColorButton leaks a UIColor
3941         <https://webkit.org/b/210658>
3942         <rdar://problem/61938137>
3943
3944         Reviewed by Darin Adler.
3945
3946         * html/ColorInputType.cpp:
3947         (WebCore::ColorInputType::isKeyboardFocusable const):
3948         * page/Chrome.cpp:
3949         (WebCore::Chrome::createColorChooser):
3950         - Drive-by fix of unreachable code on PLATFORM(IOS_FAMILY).
3951
3952 2020-04-17  Don Olmstead  <don.olmstead@sony.com>
3953
3954         [CMake] Add WebKit::WebCore target
3955         https://bugs.webkit.org/show_bug.cgi?id=210445
3956
3957         Reviewed by Michael Catanzaro.
3958
3959         Add a WebKit::WebCore target. Remove the WebCoreHeaderInterface target since
3960         the WebKit::WebCore target is functionaly the same.
3961
3962         * CMakeLists.txt:
3963
3964 2020-04-17  Ryan Haddad  <ryanhaddad@apple.com>
3965
3966         Unreviewed, reverting r260245.
3967
3968         The tests added with this change are frequently failing on
3969         macOS bots.
3970
3971         Reverted changeset:
3972
3973         "Safari doesn't apply frameRate limit when request stream from
3974         Camera"
3975         https://bugs.webkit.org/show_bug.cgi?id=210186
3976         https://trac.webkit.org/changeset/260245
3977
3978 2020-04-17  Per Arne Vollan  <pvollan@apple.com>
3979
3980         Unreviewed build fix.
3981
3982         * platform/cocoa/AGXCompilerService.cpp:
3983
3984 2020-04-17  Antoine Quint  <graouts@apple.com>
3985
3986         Stop including style rules related to media controls in the UA style sheet when Modern Media Controls are enabled
3987         https://bugs.webkit.org/show_bug.cgi?id=210606
3988
3989         Reviewed by Antti Koivisto and Daniel Bates.
3990
3991         There is no need to insert style rules related to media controls in the UA stylesheet when Modern Media Controls are enabled.
3992         There is one rule from mediaControlsApple.css for the default sizing of <audio> that makes sense broadly for content on the Web
3993         so we move that to html.css. We also set the background-color property for media documents in html.css.
3994
3995         * Modules/mediacontrols/mediaControlsApple.css:
3996         (audio): Deleted.
3997         (body:-webkit-full-page-media): Deleted.
3998         * Modules/mediacontrols/mediaControlsiOS.css:
3999         (body:-webkit-full-page-media): Deleted.
4000         * Modules/modern-media-controls/controls/media-document.css:
4001         (:host(.media-document)):
4002         * css/html.css:
4003         (body:-webkit-full-page-media):
4004         (audio):
4005         * css/mediaControls.css:
4006         (body:-webkit-full-page-media): Deleted.
4007         * style/UserAgentStyle.cpp:
4008         (WebCore::Style::UserAgentStyle::ensureDefaultStyleSheetsForElement):
4009
4010 2020-04-17  Peng Liu  <peng.liu6@apple.com>
4011
4012         Cleanup the macros for video fullscreen and picture-in-picture
4013         https://bugs.webkit.org/show_bug.cgi?id=210638
4014
4015         Reviewed by Eric Carlson.
4016
4017         Replace some "#if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))"
4018         and all "#if (PLATFORM(IOS_FAMILY) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))"
4019         with "#if ENABLE(VIDEO_PRESENTATION_MODE)".
4020
4021         No new tests, no functional change.
4022
4023         * html/HTMLMediaElement.cpp:
4024         (WebCore::HTMLMediaElement::mediaEngineWasUpdated):
4025         (WebCore::HTMLMediaElement::setVideoFullscreenStandby):
4026         * html/HTMLMediaElement.h:
4027         * html/HTMLVideoElement.cpp:
4028         * html/HTMLVideoElement.h:
4029         * platform/PictureInPictureSupport.h:
4030         * platform/cocoa/VideoFullscreenChangeObserver.h:
4031         * platform/cocoa/VideoFullscreenModel.h:
4032         * platform/cocoa/VideoFullscreenModelVideoElement.h:
4033         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
4034         * platform/graphics/MediaPlayer.cpp:
4035         * platform/graphics/MediaPlayer.h:
4036         * platform/graphics/MediaPlayerPrivate.h:
4037         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
4038         (WebCore::supportsPictureInPicture):
4039
4040 2020-04-17  Zalan Bujtas  <zalan@apple.com>
4041
4042         [LFC][TFC] Resolve the minimum width for overlapping spanner columns
4043         https://bugs.webkit.org/show_bug.cgi?id=210654
4044
4045         Reviewed by Antti Koivisto.
4046
4047         The extra horizontal space distribution is based on the columns' minimum widths.
4048         In case of column spanners, first we need to distribute the spanner's minimum
4049         width across the columns using the non-spanning minimum widths as the distribution ratio.
4050         When there's no non-spanning minimum width for a column (all rows have column spanners for tbis particular column)
4051         the minimum width gets distributed equally across the spanned columns. This distribution starts with the shortest columns spans
4052         so that we can use these resolved column widths to compute the wider ones. 
4053
4054         * layout/tableformatting/TableFormattingContext.cpp:
4055         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace):
4056
4057 2020-04-17  Claudio Saavedra  <csaavedra@igalia.com>
4058
4059         [GTK] Update for GdkKeymap API changes
4060         https://bugs.webkit.org/show_bug.cgi?id=210642
4061
406