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