Add a way to mark a rejected promise as handled
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2020-03-18  Yusuke Suzuki  <ysuzuki@apple.com>
2
3         Add a way to mark a rejected promise as handled
4         https://bugs.webkit.org/show_bug.cgi?id=209241
5
6         Reviewed by Michael Saboff.
7
8         This adds an interface using JSPromise::rejectAsHandled to DOMPromise classes.
9
10         * bindings/js/DOMPromiseProxy.h:
11         (WebCore::DOMPromiseProxy<IDLType>::reject):
12         (WebCore::DOMPromiseProxy<IDLVoid>::reject):
13         (WebCore::DOMPromiseProxyWithResolveCallback<IDLType>::reject):
14         * bindings/js/JSDOMPromiseDeferred.cpp:
15         (WebCore::DeferredPromise::callFunction):
16         (WebCore::DeferredPromise::reject):
17         * bindings/js/JSDOMPromiseDeferred.h:
18         (WebCore::DeferredPromise::reject):
19         (WebCore::DeferredPromise::rejectWithCallback):
20         (WebCore::DOMPromiseDeferredBase::reject):
21         (WebCore::DOMPromiseDeferredBase::rejectType):
22
23 2020-03-18  youenn fablet  <youenn@apple.com>
24
25         WebPage should own a Ref<WebFrame>
26         https://bugs.webkit.org/show_bug.cgi?id=209235
27
28         Reviewed by Geoffrey Garen.
29
30         * loader/FrameLoaderStateMachine.h:
31         Export committedFirstRealDocumentLoad/
32
33 2020-03-18  Eugene But  <eugenebut@chromium.org>
34
35         Fix ReplaceSelectionCommand::InsertedNodes::willRemoveNodePreservingChildren crash
36         https://bugs.webkit.org/show_bug.cgi?id=208312
37         
38         Reviewed by Ryosuke Niwa
39
40         ReplaceSelectionCommand::InsertedNodes::willRemoveNodePreservingChildren
41         was crashing on dereferencing m_firstNodeInserted pointer. Before the crash
42         ReplaceSelectionCommand::InsertedNodes object received the following calls:
43
44         respondToNodeInsertion() with node A, which set m_firstNodeInserted and m_lastNodeInserted to A
45         willRemoveNode() with node B, which left m_firstNodeInserted and m_lastNodeInserted unchanged (A)
46         (node A was destroyed setting m_firstNodeInserted and m_lastNodeInserted to null)
47         respondToNodeInsertion() with node C, which set m_firstNodeInserted and m_lastNodeInserted to C
48         willRemoveNodePreservingChildren() with node C, which set m_firstNodeInserted to null and crashed
49
50         This patch checks m_firstNodeInserted before dereferencing and sets m_lastNodeInserted to null if
51         m_firstNodeInserted became null. It seems like having non-null value for m_lastNodeInserted would
52         be an invalid state.
53
54         Test: editing/pasteboard/insert-apple-style-span-after-timeout.html
55
56         * editing/ReplaceSelectionCommand.cpp:
57         (WebCore::ReplaceSelectionCommand::InsertedNodes::willRemoveNodePreservingChildren):
58
59 2020-03-18  Youenn Fablet  <youenn@apple.com>
60
61         CrossOriginPreflightResultCacheItem::allows methods should not use out parameters
62         https://bugs.webkit.org/show_bug.cgi?id=209224
63
64         Reviewed by Alex Christensen.
65
66         Instead of having an out parameter for the error description, either return whether there is an error or not.
67         Covered by existing tests.
68
69         * loader/CrossOriginPreflightResultCache.cpp:
70         (WebCore::CrossOriginPreflightResultCacheItem::validateMethodAndHeaders const):
71         (WebCore::CrossOriginPreflightResultCacheItem::allowsCrossOriginMethod const):
72         (WebCore::CrossOriginPreflightResultCacheItem::validateCrossOriginHeaders const):
73         (WebCore::CrossOriginPreflightResultCacheItem::allowsRequest const):
74         (WebCore::CrossOriginPreflightResultCacheItem::allowsCrossOriginHeaders const): Deleted.
75         * loader/CrossOriginPreflightResultCache.h:
76
77 2020-03-18  Peng Liu  <peng.liu6@apple.com>
78
79         The value of [AVPlayerViewController isPictureInPicturePossible] is NO in the first attempt to enter PiP
80         https://bugs.webkit.org/show_bug.cgi?id=204979
81
82         Reviewed by Jer Noble.
83
84         Since [AVPlayerViewControl isPictureInPicturePossible] can be NO initially, we may fail to enter
85         the Picture-in-Picture mode.
86
87         This patch implements the mechanism to observe [AVPlayerViewControl isPictureInPicturePossible] after
88         a user requests to enter the Picture-in-Picture mode, and call [AVPlayerViewController startPictureInPicture]
89         when [AVPlayerViewController isPictureInPicturePossible] changes to YES.
90         A timer is added to monitor the status. If [AVPlayerViewController isPictureInPicturePossible] does not
91         change to YES in 0.5 second, we will give up the attempt.
92
93         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
94         (-[WebAVPlayerViewController initWithFullscreenInterface:]):
95         (-[WebAVPlayerViewController dealloc]):
96         (-[WebAVPlayerViewController MY_NO_RETURN]):
97         (VideoFullscreenInterfaceAVKit::doEnterFullscreen):
98
99 2020-03-18  Frederic Wang  <fwang@igalia.com>
100
101         frame/iframe scrolling attribute does to recognize value "noscroll" or "off"
102         https://bugs.webkit.org/show_bug.cgi?id=208570
103
104         Reviewed by Rob Buis.
105
106         Tests: imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/the-page/iframe-scrolling-attribute.html
107                imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/the-page/iframe-scrolling-attribute-values.html
108
109         * html/HTMLFrameElementBase.cpp:
110         (WebCore::HTMLFrameElementBase::scrollingMode const): Treat "noscroll" and "off" the same as "no".
111
112 2020-03-18  Chris Dumez  <cdumez@apple.com>
113
114         [ Mac wk2 ] http/wpt/beacon/beacon-quota.html is flaky failing
115         https://bugs.webkit.org/show_bug.cgi?id=207894
116         <rdar://problem/59551688>
117
118         Reviewed by Geoffrey Garen.
119
120         Add internals API exposing the number of inflight beacon loads for a given navigator object
121         so that the test can rely on it.
122
123         * Modules/beacon/NavigatorBeacon.h:
124         * testing/Internals.cpp:
125         (WebCore::Internals::inflightBeaconsCount const):
126         * testing/Internals.h:
127         * testing/Internals.idl:
128
129 2020-03-18  Frederic Wang  <fwang@igalia.com>
130
131         [intersection-observer] Accept a Document as an explicit root
132         https://bugs.webkit.org/show_bug.cgi?id=208047
133
134         Reviewed by Rob Buis.
135
136         No new tests, no behavior change.
137
138         * page/IntersectionObserver.cpp:
139         (WebCore::IntersectionObserver::create):
140         (WebCore::IntersectionObserver::IntersectionObserver):
141         * page/IntersectionObserver.h:
142         (WebCore::IntersectionObserver::root const):
143
144 2020-03-18  Joonghun Park  <jh718.park@samsung.com>
145
146         Unreviewed. Remove the build warnings below since r256756
147         warning: unused parameter ‘foo’ [-Wunused-parameter]
148
149         no new tests, no new behaviours.
150
151         * testing/Internals.cpp:
152         (WebCore::Internals::readPreferenceInteger):
153         (WebCore::Internals::encodedPreferenceValue):
154         (WebCore::Internals::getUTIFromMIMEType):
155         (WebCore::Internals::getUTIFromTag):
156
157 2020-03-18  Joonghun Park  <jh718.park@samsung.com>
158
159         Unreviewed. Remove the build warning below since r256196
160         warning: variable ‘highlightEnd’ set but not used [-Wunused-but-set-variable]
161
162         no new tests, no new behaviours.
163
164         * rendering/HighlightData.cpp:
165         (WebCore::HighlightData::highlightStateForRenderer):
166
167 2020-03-18  youenn fablet  <youenn@apple.com>
168
169         Make sure a preflight fails if response headers are invalid
170         https://bugs.webkit.org/show_bug.cgi?id=208924
171
172         Reviewed by Alex Christensen.
173
174         Implement https://fetch.spec.whatwg.org/#cors-preflight-fetch-0 step 7.3.
175         In case header parsing is wrong, fail the preflight with a meaningful message.
176         Update parsing of headers to return an Optional so that parsing error is handled as a nullopt.
177         Minor refactoring to return Expected/Optional for error handlng instead of passing an out parameter.
178         Also, adding preflight cache entry if it is valid, no matter whether preflight succeeds or not.
179
180         Tests: imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-response-validation.any.html
181                imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-response-validation.any.worker.html
182
183         * loader/CrossOriginAccessControl.cpp:
184         (WebCore::validatePreflightResponse):
185         * loader/CrossOriginPreflightResultCache.cpp:
186         (WebCore::CrossOriginPreflightResultCacheItem::create):
187         (WebCore::CrossOriginPreflightResultCacheItem::validateMethodAndHeaders const):
188         * loader/CrossOriginPreflightResultCache.h:
189         (WebCore::CrossOriginPreflightResultCacheItem::CrossOriginPreflightResultCacheItem):
190         * platform/network/HTTPParsers.h:
191         (WebCore::parseAccessControlAllowList):
192         * platform/network/ResourceResponseBase.cpp:
193         (WebCore::ResourceResponseBase::filter):
194         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting):
195
196 2020-03-18  Joonghun Park  <jh718.park@samsung.com>
197
198         Unreviewed. Remove the build warning below since r258458
199         warning: unused variable ‘frame’ [-Wunused-variable]
200
201         No new tests, no new behaviors.
202
203         * loader/ResourceLoader.cpp:
204         (WebCore::ResourceLoader::didReceiveResponse):
205
206 2020-03-18  youenn fablet  <youenn@apple.com>
207
208         FrameLoader should own its FrameLoaderClient
209         https://bugs.webkit.org/show_bug.cgi?id=208918
210
211         Reviewed by Geoff Garen.
212
213         Update Frame/FrameLoader constructors to get a UniqueRef<FrameLoaderClient>.
214         This makes the lifetime management much clearer and allows some WebKit1/WebKit2 clean-up.
215
216         Covered by existing tests.
217
218         * loader/EmptyClients.cpp:
219         (WebCore::pageConfigurationWithEmptyClients):
220         * loader/EmptyFrameLoaderClient.h:
221         * loader/FrameLoader.cpp:
222         (WebCore::FrameLoader::FrameLoader):
223         (WebCore::FrameLoader::~FrameLoader):
224         (WebCore::FrameLoader::init):
225         (WebCore::FrameLoader::initForSynthesizedDocument):
226         (WebCore::FrameLoader::didExplicitOpen):
227         (WebCore::FrameLoader::receivedFirstData):
228         (WebCore::FrameLoader::finishedParsing):
229         (WebCore::FrameLoader::loadArchive):
230         (WebCore::FrameLoader::setOpener):
231         (WebCore::FrameLoader::provisionalLoadStarted):
232         (WebCore::FrameLoader::loadInSameDocument):
233         (WebCore::FrameLoader::prepareForLoadStart):
234         (WebCore::FrameLoader::setupForReplace):
235         (WebCore::FrameLoader::load):
236         (WebCore::FrameLoader::loadWithNavigationAction):
237         (WebCore::FrameLoader::loadWithDocumentLoader):
238         (WebCore::FrameLoader::willLoadMediaElementURL):
239         (WebCore::FrameLoader::reloadWithOverrideEncoding):
240         (WebCore::FrameLoader::reload):
241         (WebCore::FrameLoader::setDocumentLoader):
242         (WebCore::FrameLoader::commitProvisionalLoad):
243         (WebCore::FrameLoader::transitionToCommitted):
244         (WebCore::FrameLoader::clientRedirectCancelledOrFinished):
245         (WebCore::FrameLoader::clientRedirected):
246         (WebCore::FrameLoader::closeOldDataSources):
247         (WebCore::FrameLoader::willChangeTitle):
248         (WebCore::FrameLoader::dispatchDidFailProvisionalLoad):
249         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
250         (WebCore::FrameLoader::didReachLayoutMilestone):
251         (WebCore::FrameLoader::didReachVisuallyNonEmptyState):
252         (WebCore::FrameLoader::frameLoadCompleted):
253         (WebCore::FrameLoader::checkLoadComplete):
254         (WebCore::FrameLoader::userAgent const):
255         (WebCore::FrameLoader::dispatchOnloadEvents):
256         (WebCore::FrameLoader::detachViewsAndDocumentLoader):
257         (WebCore::FrameLoader::receivedMainResourceError):
258         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
259         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
260         (WebCore::FrameLoader::loadedResourceFromMemoryCache):
261         (WebCore::FrameLoader::loadDifferentDocumentItem):
262         (WebCore::FrameLoader::cancelledError const):
263         (WebCore::FrameLoader::blockedByContentBlockerError const):
264         (WebCore::FrameLoader::blockedError const):
265         (WebCore::FrameLoader::blockedByContentFilterError const):
266         (WebCore::FrameLoader::connectionProperties):
267         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
268         (WebCore::FrameLoader::dispatchGlobalObjectAvailableInAllWorlds):
269         (WebCore::FrameLoader::didChangeTitle):
270         (WebCore::FrameLoader::dispatchDidCommitLoad):
271         (WebCore::FrameLoader::tellClientAboutPastMemoryCacheLoads):
272         (WebCore::FrameLoader::completePageTransitionIfNeeded):
273         * loader/FrameLoader.h:
274         * loader/FrameLoaderClient.h:
275         * page/Frame.cpp:
276         (WebCore::Frame::Frame):
277         (WebCore::Frame::create):
278         * page/Frame.h:
279         * page/Page.cpp:
280         (WebCore::Page::Page):
281         * page/PageConfiguration.cpp:
282         (WebCore::PageConfiguration::PageConfiguration):
283         * page/PageConfiguration.h:
284         * workers/service/context/SWContextManager.cpp:
285         * workers/service/context/SWContextManager.h:
286
287 2020-03-18  Philippe Normand  <pnormand@igalia.com>
288
289         [GTK][WPE] Migrate to Flatpak-based dev SDK
290         https://bugs.webkit.org/show_bug.cgi?id=205658
291
292         Reviewed by Carlos Alberto Lopez Perez.
293
294         * platform/text/hyphen/HyphenationLibHyphen.cpp:
295         (WebCore::scanTestDictionariesDirectoryIfNecessary): Check for flatpak-installed dictionaries.
296
297 2020-03-17  Pinki Gyanchandani  <pgyanchandani@apple.com>
298
299         Crash in CSSPrimitiveValue::cleanup
300         https://bugs.webkit.org/show_bug.cgi?id=208316
301
302         Reviewed by Ryosuke Niwa.
303
304         Added a NULL check before calling deref() for CSSUnitType :: CSS_CALC.
305
306         During initialization of CSSCalcValue, createCSS returns nullptr when processing min() operator
307         and there is a category mismatch between length and percent for min() operator
308         as seen in this newly added test case.
309
310         Test: editing/execCommand/primitive-value-cleanup-minimal.html
311
312         * css/CSSPrimitiveValue.cpp:
313         (WebCore::CSSPrimitiveValue::cleanup):
314
315 2020-03-17  Fujii Hironori  <Hironori.Fujii@sony.com>
316
317         SerializedScriptValue::decode should check bufferIsLargeEnoughToContain before allocating a buffer
318         https://bugs.webkit.org/show_bug.cgi?id=209132
319
320         Reviewed by Darin Adler.
321
322         * bindings/js/SerializedScriptValue.h:
323         (WebCore::SerializedScriptValue::decode): Added bufferIsLargeEnoughToContain check.
324         Added a null check for Gigacage::tryMalloc.
325
326 2020-03-17  Chris Fleizach  <cfleizach@apple.com>
327
328         AX: WebKit crashes with VO and keyboard support fails on encapsulated radio button components.
329         https://bugs.webkit.org/show_bug.cgi?id=208844
330         <rdar://problem/60252659>
331
332         Reviewed by Darin Adler.
333
334         Test: accessibility/mac/crash-bounds-for-range.html
335
336         Don't access renderer if nil in getInlineBoxAndOffset.
337
338         * dom/Position.cpp:
339         (WebCore::Position::getInlineBoxAndOffset const):
340
341 2020-03-17  Eric Carlson  <eric.carlson@apple.com>
342
343         TextTrackBase should validate language before setting m_validBCP47Language
344         https://bugs.webkit.org/show_bug.cgi?id=209094
345         <rdar://problem/60439603>
346
347         Unreviewed, address post-commit review comments.
348
349         * html/track/TrackBase.cpp:
350         (WebCore::TrackBase::setLanguage): Use makeString instead of StringBuilder.
351
352 2020-03-17  Eric Carlson  <eric.carlson@apple.com>
353
354         TextTrackBase should validate language before setting m_validBCP47Language
355         https://bugs.webkit.org/show_bug.cgi?id=209094
356         <rdar://problem/60439603>
357
358         Reviewed by Jer Noble.
359         
360         Test: media/track/track-bcp-language.html
361
362         * html/track/TextTrack.idl:
363         * html/track/TrackBase.cpp:
364         (WebCore::TrackBase::TrackBase): Don't set m_validBCP47Language unless the language is valid.
365         (WebCore::TrackBase::setLanguage): Clear m_validBCP47Language if the language is invalid. 
366         Restructure the code to use early returns.
367         (WebCore::TrackBase::validBCP47Language const): Deleted.
368         * html/track/TrackBase.h:
369         (WebCore::TrackBase::validBCP47Language const):
370         * testing/Internals.cpp:
371         (WebCore::Internals::textTrackBCP47Language):
372         * testing/Internals.h:
373         * testing/Internals.idl:
374
375 2020-03-17  Alex Christensen  <achristensen@webkit.org>
376
377         REGRESSION(r254856) Add exception for window.openDatabase to not masquerade as undefined in currently shipping Jesus Calling Devotional app
378         https://bugs.webkit.org/show_bug.cgi?id=209160
379         <rdar://problem/60297073>
380
381         Reviewed by Geoff Garen.
382
383         Manually verified this fixes the app, which compares typeof openDatabase with 'undefined'
384         Going forward, we intend to completely remove WebSQL, so this is a temporary exception to our removal strategy.
385
386         * bindings/js/JSDOMWindowCustom.cpp:
387         (WebCore::JSDOMWindow::openDatabase const):
388         * platform/RuntimeApplicationChecks.h:
389         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
390         (WebCore::IOSApplication::isJesusCalling):
391
392 2020-03-17  Andres Gonzalez  <andresg_22@apple.com>
393
394         AXIsolatedTree removal should set all nodes to be removed on AX secondary thread.
395         https://bugs.webkit.org/show_bug.cgi?id=209169
396
397         Reviewed by Chris Fleizach.
398
399         - AXIsolatedTree::removeTreeForPageID is called on the main thread but
400         it should not remove the nodes in the main thread, but instead add them
401         to the pending changes to be removed on the secondary thread. This was
402         causing the problem of empty new trees when the old tree would go away
403         but the client was holding a reference to an object that has been
404         disconnected and thus had no children.
405         - In addition, this change fixes an isolated tree mode crash in AccessibilityMenuList.
406
407         * accessibility/AXObjectCache.cpp:
408         (WebCore::AXObjectCache::~AXObjectCache):
409         * accessibility/AccessibilityMenuList.cpp:
410         (WebCore::AccessibilityMenuList::isCollapsed const):
411         * accessibility/isolatedtree/AXIsolatedTree.cpp:
412         (WebCore::AXIsolatedTree::removeTreeForPageID):
413
414 2020-03-17  Jacob Uphoff  <jacob_uphoff@apple.com>
415
416         Unreviewed, reverting r257844.
417
418         this revision caused a test to start timing out
419
420         Reverted changeset:
421
422         "(r256513) [ Mac ] fast/scrolling/programmatic-scroll-to-zero-
423         zero.html is a flaky failure"
424         https://bugs.webkit.org/show_bug.cgi?id=207948
425         https://trac.webkit.org/changeset/257844
426
427 2020-03-17  Commit Queue  <commit-queue@webkit.org>
428
429         Unreviewed, reverting r258339.
430         https://bugs.webkit.org/show_bug.cgi?id=209179
431
432         "Is it sometimes breaking rendering" (Requested by youenn on
433         #webkit).
434
435         Reverted changeset:
436
437         "FrameLoader should own its FrameLoaderClient"
438         https://bugs.webkit.org/show_bug.cgi?id=208918
439         https://trac.webkit.org/changeset/258339
440
441 2020-03-17  Philippe Normand  <pnormand@igalia.com>
442
443         RELEASE_LOG should not be Cocoa specific
444         https://bugs.webkit.org/show_bug.cgi?id=195182
445
446         Reviewed by Konstantin Tokarev.
447
448         WPE/GTK build fixes related with Release logging support.
449
450         * bridge/npruntime_internal.h:
451         * dom/ScriptedAnimationController.cpp:
452         (WebCore::throttlingReasonToString):
453         * page/PerformanceLogging.cpp:
454         (WebCore::toString):
455         * page/PerformanceMonitor.cpp:
456         (WebCore::stringForCPUSamplingActivityState):
457         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
458         (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
459         (WebCore::MediaPlayerPrivateGStreamer::logChannel const):
460         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
461         (WebCore::MediaPlayerPrivateGStreamer::mediaPlayerLogIdentifier):
462         (WebCore::MediaPlayerPrivateGStreamer::mediaPlayerLogger):
463         * platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp:
464         (WebCore::CDMProxyClearKey::cencDecryptSubsampled):
465         (WebCore::CDMProxyClearKey::initializeGcrypt):
466         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
467         * platform/graphics/gstreamer/mse/MediaSourceGStreamer.cpp:
468         (WebCore::MediaSourceGStreamer::MediaSourceGStreamer):
469         (WebCore::MediaSourceGStreamer::~MediaSourceGStreamer):
470         (WebCore::MediaSourceGStreamer::addSourceBuffer):
471         (WebCore::MediaSourceGStreamer::logChannel const):
472         * platform/graphics/gstreamer/mse/MediaSourceGStreamer.h:
473         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
474         (WebCore::SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer):
475         (WebCore::SourceBufferPrivateGStreamer::logChannel const):
476         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
477         * platform/mediastream/AudioMediaStreamTrackRenderer.cpp:
478         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
479         (WebCore::computeLogLevel):
480         * platform/network/soup/NetworkStorageSessionSoup.cpp:
481         (WebCore::NetworkStorageSession::getRawCookies const):
482
483 2020-03-17  youenn fablet  <youenn@apple.com>
484
485         Safari doesn't insert mDNS candidates to SDP
486         https://bugs.webkit.org/show_bug.cgi?id=209050
487         <rdar://problem/60419936>
488
489         Reviewed by Eric Carlson.
490
491         Instead of removing host candidate lines in SDP, replace the host IP address by the corresponding mDNS name.
492         Covered by updated test.
493
494         * Modules/mediastream/PeerConnectionBackend.cpp:
495         (WebCore::extractIPAddress):
496         (WebCore::PeerConnectionBackend::filterSDP const):
497         (WebCore::PeerConnectionBackend::finishedRegisteringMDNSName):
498         * Modules/mediastream/PeerConnectionBackend.h:
499
500 2020-03-17  Philippe Normand  <pnormand@igalia.com>
501
502         [GStreamer][MSE] Playback rate update support
503         https://bugs.webkit.org/show_bug.cgi?id=208454
504
505         Reviewed by Xabier Rodriguez-Calvar.
506
507         Implement playback rate update support for the MSE player. Also
508         includes drive-by logging cleanups.
509
510         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
511         (WebCore::MediaPlayerPrivateGStreamer::updatePlaybackRate):
512         (WebCore::MediaPlayerPrivateGStreamer::setRate):
513         (WebCore::MediaPlayerPrivateGStreamer::setPreservesPitch):
514         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
515         (WebCore::MediaPlayerPrivateGStreamer::pipeline const):
516         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
517         (WebCore::MediaPlayerPrivateGStreamerMSE::seek):
518         (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek):
519         (WebCore::MediaPlayerPrivateGStreamerMSE::maybeFinishSeek):
520         (WebCore::MediaPlayerPrivateGStreamerMSE::seekCompleted):
521         (WebCore::MediaPlayerPrivateGStreamerMSE::updatePlaybackRate): Deleted.
522         (WebCore::MediaPlayerPrivateGStreamerMSE::setRate): Deleted.
523         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
524
525 2020-03-16  Simon Fraser  <simon.fraser@apple.com>
526
527         Remove the zero-delay ScrollingCoordinatorMac commit timer
528         https://bugs.webkit.org/show_bug.cgi?id=209164
529
530         Reviewed by Zalan Bujtas.
531
532         The scrolling tree on macOS should just commit at rendering update time. There's no need
533         for a separate zero-delay timer.
534
535         Tested by existing tests.
536
537         * page/scrolling/mac/ScrollingCoordinatorMac.h:
538         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
539         (WebCore::ScrollingCoordinatorMac::ScrollingCoordinatorMac):
540         (WebCore::ScrollingCoordinatorMac::pageDestroyed):
541         (WebCore::ScrollingCoordinatorMac::scheduleTreeStateCommit):
542         (WebCore::ScrollingCoordinatorMac::commitTreeStateIfNeeded):
543         (WebCore::ScrollingCoordinatorMac::commitTreeState): Deleted.
544
545 2020-03-16  Simon Fraser  <simon.fraser@apple.com>
546
547         Add a bit more UIHitTesting logging, and make it possible to dump EventRegions from WebKit
548         https://bugs.webkit.org/show_bug.cgi?id=209058
549
550         Reviewed by Antti Koivisto.
551
552         Export operator<<(TextStream&, const EventRegion&) so it can be used from Webkit.
553
554         * rendering/EventRegion.h:
555
556 2020-03-16  Tim Horton  <timothy_horton@apple.com>
557
558         Remove a 'using namespace WebCore' in MediaSessionManagerCocoa
559         https://bugs.webkit.org/show_bug.cgi?id=209162
560
561         Reviewed by Simon Fraser.
562
563         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
564         Unified source cleanliness. Not currently causing any trouble, but
565         it did when I changed something locally!
566
567 2020-03-16  ChangSeok Oh  <changseok@webkit.org>
568
569         A change event gets dispatched when textarea gets changed without focus
570         https://bugs.webkit.org/show_bug.cgi?id=202144
571
572         Reviewed by Ryosuke Niwa.
573
574         A crash happens in WebCore::ValidationMessage::buildBubbleTree. An immediate reason
575         is that DOM tree is modified in buildBubbleTree triggered by a timer.
576         The function calls document.updateLayout() that causes a change event
577         for textarea to fire when something changed in the textarea.
578         This bug is not reproduced on Mac because buildBubbleTree is not called.
579         See ValidationMessage::setMessage.
580         On the other hand, the root cause of this issue is triggering the change event
581         for textarea even if it is not focused when a change is made. This behavior
582         is different to what Gecko and Chromium do. When loading the test, they do not
583         trigger the change event although the textarea is filled by the script
584         since the textarea is not focused. Only when we manually make a change (meaning
585         the textarea is focused by user input), the event gets dispatched. To fix it,
586         setChangedSinceLastFormControlChangeEvent(true) is moved below the focus check
587         in HTMLTextAreaElement::subtreeHasChanged();
588
589         Test: fast/forms/textfield-onchange-without-focus.html
590
591         * html/HTMLTextAreaElement.cpp:
592         (WebCore::HTMLTextAreaElement::subtreeHasChanged):
593
594 2020-03-16  Simon Fraser  <simon.fraser@apple.com>
595
596         Update touch event regions once per frame
597         https://bugs.webkit.org/show_bug.cgi?id=209153
598
599         Reviewed by Zalan Bujtas.
600
601         Call document->updateTouchEventRegions() once at the end of Page::updateRendering() instead
602         of relying on a timer.
603
604         Also rename the functions called from Internal to make it clear they are testing-only.
605
606         Page::scrollingStateTreeAsText() needs to eagerly update event regions because they are input
607         to the scrolling tree.
608
609         * dom/Document.cpp:
610         (WebCore::Document::Document):
611         * page/Page.cpp:
612         (WebCore::Page::scrollingStateTreeAsText):
613         (WebCore::Page::touchEventRectsForEventForTesting):
614         (WebCore::Page::passiveTouchEventListenerRectsForTesting):
615         (WebCore::Page::doAfterUpdateRendering):
616         (WebCore::Page::touchEventRectsForEvent): Deleted.
617         (WebCore::Page::passiveTouchEventListenerRects): Deleted.
618         * page/Page.h:
619         * page/scrolling/ScrollingCoordinator.cpp:
620         (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame const):
621         * testing/Internals.cpp:
622         (WebCore::Internals::touchEventRectsForEvent):
623         (WebCore::Internals::passiveTouchEventListenerRects):
624
625 2020-03-15  Darin Adler  <darin@apple.com>
626
627         Move most of TextIterator off of live ranges
628         https://bugs.webkit.org/show_bug.cgi?id=209129
629
630         Reviewed by Antti Koivisto.
631
632         - Change almost all arguments and return values of functions in TextIterator.h
633           to use SimpleRange instead of live ranges. Exceptions are an overload of plainText
634           TextIterator::rangeLength, TextIterator::rangeFromLocationAndLength,
635           TextIterator::getLocationAndLengthFromRange, and TextIterator::subrange. Those
636           five are a little trickier to convert, so I will do them each in separate patches.
637
638         - Go with the flow in adding an include of Node.h to BoundaryPoint.h. I had avoided
639           this in the initial version, but now it seems practical to just leave it that way.
640           This led to removing BoundaryPoint.cpp and moving all functions to the header.
641
642         - Converted many member functions of the Position class from using int to unsigned
643           for offsets. The DOM specifies unsigned for offsets, but for some reason we used
644           int for them a lot historically, even though negative numbers don't make sense.
645           New classes like StaticRange, SimpleRange, and BoundaryPoint are already using
646           unsigned exclusively and we'll eventually convert everything.
647
648         - Remove includes of SimpleRange.h from files that also include TextIterator.h,
649           now that TextIterator.h pulls it in.
650
651         * Sources.txt: Removed BoundaryPoint.cpp.
652         * WebCore.xcodeproj/project.pbxproj: Ditto.
653
654         * accessibility/AXObjectCache.cpp:
655         (WebCore::AXObjectCache::traverseToOffsetInRange): Updated to pass a reference
656         to a range rather than a pointer, after null-checking it.
657         (WebCore::AXObjectCache::lengthForRange): Ditto.
658         (WebCore::AXObjectCache::nextBoundary): Ditto.
659         (WebCore::AXObjectCache::previousBoundary): Ditto.
660         * accessibility/AccessibilityObject.cpp:
661         (WebCore::AccessibilityObject::stringForRange const): Ditto.
662         (WebCore::AccessibilityObject::stringForVisiblePositionRange): Ditto.
663         (WebCore::AccessibilityObject::lengthForVisiblePositionRange const): Ditto.
664
665         * accessibility/AccessibilityObjectInterface.h: Removed an extra include.
666
667         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
668         (-[WebAccessibilityObjectWrapper arrayOfTextForTextMarkers:attributed:]):
669         Updated to pass a reference to a range rather than a pointer, after null-checking it.
670         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
671         (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:spellCheck:]): Ditto.
672
673         * dom/BoundaryPoint.cpp: Removed.
674
675         * dom/BoundaryPoint.h: Removed redundant includes and forward declarations
676         since we're now committing to including "Node.h" here. Moved functions
677         all out of the .cpp file and made them inlines.
678
679         * dom/DocumentMarkerController.cpp:
680         (WebCore::DocumentMarkerController::collectTextRanges): Pass a reference to
681         a range instead of a pointer.
682
683         * dom/Position.cpp:
684         (WebCore::Position::Position): Take unsigned.
685         (WebCore::Position::moveToPosition): Ditto.
686         (WebCore::Position::moveToOffset): Ditto.
687         (WebCore::Position::parentAnchoredEquivalent const): Cast to unsigned.
688         (WebCore::Position::anchorTypeForLegacyEditingPosition): Take unsigned.
689         (WebCore::Position::previous const): Use unsigned.
690         (WebCore::Position::next const): Ditto.
691         (WebCore::Position::uncheckedPreviousOffset): Take unsigned.
692         (WebCore::Position::uncheckedPreviousOffsetForBackwardDeletion): Ditto.
693         (WebCore::Position::uncheckedNextOffset): Ditto.
694         (WebCore::Position::atLastEditingPositionForNode const): Cast to unsigned.
695         (WebCore::Position::atEndOfTree const): Ditto.
696         (WebCore::Position::rendersInDifferentPosition const): Added casts to
697         unsigned and also removed unneeded redundant checks. In a place where
698         we had already checked that both nodes were the same and both offsets
699         were different, we were checking the types of both nodes (but they are
700         the same so only need to check one) and we were checking that both
701         offsets were different (but we already knew they were different).
702         (WebCore::searchAheadForBetterMatch): Use unsigned.
703         (WebCore::Position::getInlineBoxAndOffset const): Ditto.
704         (WebCore::Position::equals const): Removed a cast to int.
705         (WebCore::makeBoundaryPoint): Moved this function here so now it can be
706         used in more places.
707
708         * dom/Position.h: Changed many argument types to unsigned. Moved declarations
709         of all the functions up above all the inline implementations of the functions
710         to separate interface from implementation a bit better. Wrote a FIXME about
711         the name createLegacyEditingPosition. Moved makeBoundaryPoint here and exported
712         it from WebCore so we can use it from more places.
713
714         * dom/Range.cpp:
715         (WebCore::createLiveRange): Moved these functions here from SimpleRange.cpp
716         because a live range is more advanced concept, so makes more sense for live
717         range to know about simple range rather than vice versa.
718
719         * dom/Range.h: Removed some unneeded includes and forward declarations.
720         Added a FIXME about renaming to LiveRange. Moved the createLiveRange
721         functions here. Moved declarations of functions above inline function bodies.
722
723         * dom/SimpleRange.cpp:
724         (WebCore::createLiveRange): Moved to Range.cpp.
725
726         * dom/SimpleRange.h: Exported the constructor. Removed unneeded overload
727         that takes a Range*.
728
729         * editing/ApplyStyleCommand.cpp:
730         (WebCore::ApplyStyleCommand::mergeStartWithPreviousIfIdentical):
731         Refactored code a bit and use unsigned.
732         (WebCore::ApplyStyleCommand::mergeEndWithNextIfIdentical): Use unsigned.
733
734         * editing/Editing.cpp:
735         (WebCore::visibleImageElementsInRangeWithNonLoadedImages): Use a reference
736         to a range rather than a pointer.
737
738         * editing/Editing.h: Added a forward declaration of Range that now seems to
739         be needed to compile.
740
741         * editing/Editor.cpp:
742         (WebCore::Editor::selectedText const): Call makeBoundaryPoint twice here to
743         convert two Position objects into a SimpleRange.
744
745         * editing/HTMLInterchange.cpp: Removed some extra includes.
746         (WebCore::convertHTMLTextToInterchangeFormat): Use variadic
747         StringBuilder::append.
748
749         * editing/TextIterator.cpp:
750         (WebCore::firstNode): Added. We use this instead of Range::firstNode.
751         If we find we need it outside TextIterator we can find a header for it.
752         Not sure it would be great to add it to in BoundaryPoint.h, nor is it
753         obviously better as a BoundaryPoint member function.
754         (WebCore::TextIterator::TextIterator): Cut down on the extra constructors
755         and have the single remaining one take a SimpleRange.
756         (WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
757         Ditto. Also change some int to unsigned.
758         (WebCore::CharacterIterator::CharacterIterator): Ditto.
759         (WebCore::BackwardsCharacterIterator::BackwardsCharacterIterator): Ditto.
760         (WebCore::WordAwareIterator::WordAwareIterator): Ditto.
761         (WebCore::TextIterator::rangeLength): Since this is one of the functions
762         that still takes a live range pointer, updated it to check for null and
763         pass a reference rather than a pointer.
764         (WebCore::TextIterator::rangeFromLocationAndLength): Ditto.
765         (WebCore::hasAnyPlainText): Removed now-unneeded call to createLiveRange.
766         (WebCore::plainText): Updated the main implementation to take a SimpleRange,
767         eliminating the version that takes two Position objects, but keeping the
768         one that takes a live range pointer for now.
769         (WebCore::plainTextReplacingNoBreakSpace): Removed all but the one, and
770         have that one take a SimpleRange.
771
772         * editing/TextIterator.h: Removed the include of SimpleRange.h. Also
773         Updated for the changes above, eliminating five different constructors
774         that take a live range and also overloads that take two Position objects.
775
776         * editing/TextManipulationController.cpp:
777         (WebCore::ParagraphContentIterator::ParagraphContentIterator):
778         Call makeBoundaryPoint twice here to convert two Position objects into
779         a SimpleRange.
780
781         * editing/VisibleSelection.cpp: Removed an include.
782
783         * editing/VisibleUnits.cpp:
784         (WebCore::suffixLengthForRange): Pass a reference to a range known to
785         not be null.
786         (WebCore::previousBoundary): Ditto.
787         (WebCore::nextBoundary): Ditto.
788
789         * editing/cocoa/DataDetection.mm:
790         (WebCore::buildQuery): Take a SimpleRange.
791         (WebCore::DataDetection::detectContentInRange): Added a null check on
792         a live range and pass a reference to it.
793         * editing/cocoa/DictionaryLookup.mm:
794         (WebCOre::DictionaryLookup::rangeAtHitTestResult): Ditto.
795
796         * editing/cocoa/HTMLConverter.mm:
797         (WebCore::editingAttributedStringFromRange): Pass a reference to a range
798         known to not be null.
799         * page/TextIndicator.cpp:
800         (WebCore::estimatedTextColorsForRange): Ditto.
801         (WebCore::containsOnlyWhiteSpaceText): Ditto.
802         * page/ios/FrameIOS.mm:
803         (WebCore::Frame::interpretationsForCurrentRoot const): Ditto.
804
805         * rendering/HitTestResult.cpp:
806         (WebCore::HitTestResult::selectedText const): Added a null check on
807         a live range and pass a reference to it.
808
809 2020-03-16  Pinki Gyanchandani  <pgyanchandani@apple.com>
810
811         Crash in CSSValue::isPrimitiveValue
812         https://bugs.webkit.org/show_bug.cgi?id=208309
813
814         Reviewed by Ryosuke Niwa.
815
816         Added a NULL check before dereferencing value in ApplyStyleCommand::computedFontSize
817
818         Test: editing/execCommand/primitive-value.html
819
820         * editing/ApplyStyleCommand.cpp:
821         (WebCore::ApplyStyleCommand::computedFontSize):
822
823 2020-03-16  Megan Gardner  <megan_gardner@apple.com>
824
825         Color Picker crashes on touch
826         https://bugs.webkit.org/show_bug.cgi?id=209086
827
828         Reviewed by Darin Adler.
829
830         Vector sizing lost in refactor. Not perfomance sensitive code, so just expanding vector as needed.
831
832         Test: fast/forms/color/color-input-activate-crash.html
833
834         * html/ColorInputType.cpp:
835         (WebCore::ColorInputType::suggestedColors const):
836
837 2020-03-16  Simon Fraser  <simon.fraser@apple.com>
838
839         Remove FrameView::scheduleRenderingUpdate()
840         https://bugs.webkit.org/show_bug.cgi?id=209109
841
842         Reviewed by Antti Koivisto.
843
844         FrameView::scheduleRenderingUpdate() called through to compositor(), but that just
845         turned around to call scheduleRenderingUpdate() via Page. So Remove it and change
846         callers to call Page::scheduleRenderingUpdate() directly.
847
848         * page/FrameView.cpp:
849         (WebCore::FrameView::setViewExposedRect):
850         (WebCore::FrameView::scheduleRenderingUpdate): Deleted.
851         * page/FrameView.h:
852         * page/Page.cpp:
853         (WebCore::Page::scheduleRenderingUpdate):
854         * page/Page.h:
855         * rendering/RenderLayerCompositor.cpp:
856         (WebCore::RenderLayerCompositor::scheduleRenderingUpdate):
857
858 2020-03-16  Simon Fraser  <simon.fraser@apple.com>
859
860         Commit Xcode-modified xcfilelist.
861
862         New WebXR idl files.
863
864         * DerivedSources-input.xcfilelist:
865         * DerivedSources-output.xcfilelist:
866
867 2020-03-14  Simon Fraser  <simon.fraser@apple.com>
868
869         Factor some post-updateRendering code into its own function
870         https://bugs.webkit.org/show_bug.cgi?id=209108
871
872         Reviewed by Antti Koivisto.
873
874         Make a new function to hold code that needs to do post update-rendering work.
875         It asserts that the layout is clean at the end.
876
877         * page/Page.cpp:
878         (WebCore::Page::updateRendering):
879         (WebCore::Page::doAfterUpdateRendering):
880         * page/Page.h:
881
882 2020-03-16  Daniel Bates  <dabates@apple.com>
883
884         ASSERTION FAILURE: !result.innerNode() || (request.resultIsElementList() && result.listBasedTestResult().size()) in RenderLayer::hitTestContents()
885         https://bugs.webkit.org/show_bug.cgi?id=209112
886
887         Reviewed by Darin Adler.
888
889         Fix rect-based hit testing (e.g. used in the impl of document.elementsFromPoint()) of ::before
890         and ::after pseudo elements. Same issue as in r133330, updateHitTestResult() and addNodeToRectBasedTestResult()
891         are using different "hit" nodes. In particular, RenderObject::updateHitTestResult() knows how to
892         reason about ::before and ::after pseudo elements, but addNodeToRectBasedTestResult() cannot.
893         Standardize the concept of the node used for hit testing from something-specifically added to RenderBlock
894         in r133330 to all renderers. Have both updateHitTestResult() and addNodeToRectBasedTestResult()
895         make use of this concept so that they consider the same hit node.
896
897         Test: fast/dom/nodesFromRect/pseudo-empty-svg-image-crash.html
898
899         * layout/integration/LayoutIntegrationLineLayout.cpp:
900         (WebCore::LayoutIntegration::LineLayout::hitTest):
901         * rendering/EllipsisBox.cpp:
902         (WebCore::EllipsisBox::nodeAtPoint):
903         * rendering/InlineFlowBox.cpp:
904         (WebCore::InlineFlowBox::nodeAtPoint):
905         * rendering/InlineTextBox.cpp:
906         (WebCore::InlineTextBox::nodeAtPoint):
907         Update code to call nodeForHitTest() to keep the code behavior we have today. Note that RenderElement::element()
908         and RenderText::textNode() just cast the return value of RenderObject::node().
909         * rendering/RenderBlock.cpp:
910         (WebCore::RenderBlock::nodeForHitTest const): Remove special case for RenderView now that I added RenderView::nodeForHitTest().
911         Moreover, this special case was returning the document even though RenderView::updateHitTestResult() hit
912         test the document element. See remarks for RenderView::nodeForHitTest() for more details.
913         * rendering/RenderBlock.h:
914         * rendering/RenderBox.cpp:
915         (WebCore::RenderBox::nodeAtPoint): Use nodeForHitTest(). This fixes the bug. Currently, updateHitTestResult()
916         knows that when RenderObject::node() is nullptr and the parent renderer is for generated content that it can
917         walk up the hierarchy to find the hit PseudoElement. But in the call to addNodeToListBasedTestResult(), RenderObject::element()
918         was passed, which is nullptr for an anonymous node, and addNodeToListBasedTestResult() doesn't have enough info
919         to know that this means generated content was hit and hence it is not able to find the PseudoElement. This
920         disagreement caused the assertion failure because updateHitTestResult() would update the inner node, but
921         addNodeToListBasedTestResult() would not add a node to the set.
922         * rendering/RenderInline.cpp:
923         (WebCore::RenderInline::hitTestCulledInline): Use nodeForHitTest().
924         (WebCore::RenderInline::updateHitTestResult): Update code as needed to use nodeForHitTest(). Also while I
925         am here fix up code style of comment and rename the local from element to node to match the return value
926         of nodeForHitTest().
927         * rendering/RenderMultiColumnSet.cpp:
928         (WebCore::RenderMultiColumnSet::nodeForHitTest const): Added.
929         (WebCore::RenderMultiColumnSet::updateHitTestResult): Update code as needed to use nodeForHitTest().
930         * rendering/RenderMultiColumnSet.h:
931         * rendering/RenderObject.cpp:
932         (WebCore::RenderObject::nodeForHitTest const): Added.
933         (WebCore::RenderObject::updateHitTestResult): Update code as needed to use nodeForHitTest().
934         * rendering/RenderObject.h:
935         * rendering/RenderTable.cpp:
936         (WebCore::RenderTable::nodeAtPoint): Ditto.
937         * rendering/RenderView.cpp:
938         (WebCore::RenderView::nodeForHitTest const): Added. This overrides RenderBlock::nodeForHitTest(), which
939         following r155370 was returning the document as the hit test node even though RenderView::updateHitTestResult()
940         considered the document element as the hit node for a RenderView. As a result of this change, the rect-based
941         hit testing no longer returns the document (seen in test results as #document) in the list of nodes.
942         (WebCore::RenderView::updateHitTestResult): Update code as needed to use nodeForHitTest().
943         * rendering/RenderView.h:
944         * rendering/SimpleLineLayoutFunctions.cpp:
945         (WebCore::SimpleLineLayout::hitTestFlow): Ditto.
946         * rendering/svg/RenderSVGContainer.cpp:
947         (WebCore::RenderSVGContainer::nodeAtFloatPoint): Ditto.
948         * rendering/svg/RenderSVGImage.cpp:
949         (WebCore::RenderSVGImage::nodeAtFloatPoint): Ditto.
950         * rendering/svg/RenderSVGRoot.cpp:
951         (WebCore::RenderSVGRoot::nodeAtPoint): Ditto.
952         * rendering/svg/RenderSVGShape.cpp:
953         (WebCore::RenderSVGShape::nodeAtFloatPoint): Ditto.
954         * rendering/svg/SVGInlineTextBox.cpp:
955         (WebCore::SVGInlineTextBox::nodeAtPoint): Ditto.
956
957 2020-03-16  Youenn Fablet  <youenn@apple.com>
958
959         Make CoreAudioCaptureSourceFactoryIOS an AudioSession::InterruptionObserver
960         https://bugs.webkit.org/show_bug.cgi?id=209138
961
962         Reviewed by Eric Carlson.
963
964         Instead of listening to Audiosession interruptions, CoreAudioCaptureSourceFactoryIOS is now relying on AudioSession directly.
965         This allows removing some duplicate code.
966         No change of behavior.
967
968         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.h:
969         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:
970         (-[WebCoreAudioCaptureSourceIOSListener initWithCallback:]):
971         (WebCore::CoreAudioCaptureSourceFactoryIOS::CoreAudioCaptureSourceFactoryIOS):
972         (WebCore::CoreAudioCaptureSourceFactoryIOS::~CoreAudioCaptureSourceFactoryIOS):
973         (-[WebCoreAudioCaptureSourceIOSListener handleInterruption:]): Deleted.
974
975 2020-03-16  Youenn Fablet  <youenn@apple.com>
976
977         Apply rotation at source level if WebRTC sink ask so
978         https://bugs.webkit.org/show_bug.cgi?id=205645
979
980         Reviewed by Eric Carlson.
981
982         Add a virtual method to RealtimeMediaSource to pass the information that the sink prefers the frames to be rotated before sending them.
983 r       By default, the method does nothing and RealtimeOutgoingVideoSource will continue to do the rotation itself.
984         Update ImageRotationSessionVT to be more easily usable by users having MediaSample instead of CVPixelBuffer.
985         Update RealtimeOutgoingVideoSource to use that routine: whenever applying rotation is needed,
986         it will ask its track source to apply rotation. If the track source cannot do it, it will do it on its own.
987
988         Test: webrtc/video-rotation-no-cvo.html
989
990         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
991         (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources):
992         * WebCore.xcodeproj/project.pbxproj:
993         * platform/graphics/cv/ImageRotationSessionVT.h:
994         (WebCore::operator==):
995         (WebCore::operator!=):
996         * platform/graphics/cv/ImageRotationSessionVT.mm:
997         (WebCore::ImageRotationSessionVT::ImageRotationSessionVT):
998         (WebCore::ImageRotationSessionVT::initialize):
999         (WebCore::ImageRotationSessionVT::rotate):
1000         * platform/mediastream/RealtimeMediaSource.h:
1001         * platform/mediastream/RealtimeOutgoingVideoSource.cpp:
1002         (WebCore::RealtimeOutgoingVideoSource::setSource):
1003         (WebCore::RealtimeOutgoingVideoSource::applyRotation):
1004         (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink):
1005         * platform/mediastream/RealtimeOutgoingVideoSource.h:
1006
1007 2020-03-16  youenn fablet  <youenn@apple.com>
1008
1009         Audio is not played from an audio element when the srcObject object has unstarted video tracks
1010         https://bugs.webkit.org/show_bug.cgi?id=207041
1011         <rdar://problem/59084745>
1012
1013         Reviewed by Eric Carlson.
1014
1015         In case MediaPlayer is an audio element, we should just make it as if there is no video track in the stream.
1016
1017         Test: imported/w3c/web-platform-tests/webrtc/audio-video-element-playing.html
1018
1019         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1020         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1021         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
1022         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
1023         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::activeVideoTrack const):
1024         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::didPassCORSAccessCheck const):
1025         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode const):
1026         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentReadyState):
1027         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack):
1028         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
1029
1030 2020-03-16  youenn fablet  <youenn@apple.com>
1031
1032         RTCRtpSender of kind video should have a null dtmf attribute
1033         https://bugs.webkit.org/show_bug.cgi?id=209135
1034
1035         Reviewed by Eric Carlson.
1036
1037         Test: imported/w3c/web-platform-tests/webrtc/RTCRtpSender.https.html
1038
1039         * Modules/mediastream/RTCRtpSender.cpp:
1040         (WebCore::RTCRtpSender::dtmf):
1041
1042         * rendering/line/LineLayoutTraversal.h: Removed some unneeded includes.
1043         * testing/Internals.cpp: Ditto.
1044
1045 2020-03-13  Sergio Villar Senin  <svillar@igalia.com>
1046
1047         [WebXR] IDLs, stubs and build configuration for WPE
1048         https://bugs.webkit.org/show_bug.cgi?id=208702
1049
1050         Reviewed by Dean Jackson.
1051
1052         Added the IDLs defined by the spec with very basic empty implementations to get them
1053         built. Apart from that a very basic implementation of the required platform code using
1054         OpenXR API was also added.
1055
1056         No new tests as no new functionality was really added (empty implementations). However
1057         follow up patches will import the already available WPT tests for WebXR.
1058
1059         Largely based on previous work by Žan Doberšek.
1060
1061         * CMakeLists.txt:
1062         * Configurations/FeatureDefines.xcconfig: Added ENABLE_WEBXR off by default.
1063         * DerivedSources.make:
1064         * Modules/webxr/NavigatorWebXR.cpp: Added.
1065         (WebCore::NavigatorWebXR::xr):
1066         (WebCore::NavigatorWebXR::from):
1067         * Modules/webxr/NavigatorWebXR.h: Added.
1068         * Modules/webxr/NavigatorWebXR.idl: Added.
1069         * Modules/webxr/WebXRBoundedReferenceSpace.cpp: Added.
1070         (WebCore::WebXRBoundedReferenceSpace::boundsGeometry const):
1071         * Modules/webxr/WebXRBoundedReferenceSpace.h: Added.
1072         * Modules/webxr/WebXRBoundedReferenceSpace.idl: Added.
1073         * Modules/webxr/WebXRFrame.cpp: Added.
1074         (WebCore::WebXRFrame::create):
1075         (WebCore::WebXRFrame::WebXRFrame):
1076         (WebCore::WebXRFrame::session const):
1077         (WebCore::WebXRFrame::getViewerPose):
1078         (WebCore::WebXRFrame::getPose):
1079         * Modules/webxr/WebXRFrame.h: Added.
1080         * Modules/webxr/WebXRFrame.idl: Added.
1081         * Modules/webxr/WebXRInputSource.cpp: Added.
1082         (WebCore::WebXRInputSource::create):
1083         (WebCore::WebXRInputSource::WebXRInputSource):
1084         (WebCore::WebXRInputSource::handedness const):
1085         (WebCore::WebXRInputSource::targetRayMode const):
1086         (WebCore::WebXRInputSource::targetRaySpace const):
1087         (WebCore::WebXRInputSource::gripSpace const):
1088         (WebCore::WebXRInputSource::profiles const):
1089         * Modules/webxr/WebXRInputSource.h: Added.
1090         * Modules/webxr/WebXRInputSource.idl: Added.
1091         * Modules/webxr/WebXRInputSourceArray.cpp: Added.
1092         (WebCore::WebXRInputSourceArray::length const):
1093         (WebCore::WebXRInputSourceArray::item const):
1094         * Modules/webxr/WebXRInputSourceArray.h: Added.
1095         * Modules/webxr/WebXRInputSourceArray.idl: Added.
1096         * Modules/webxr/WebXRPose.cpp: Added.
1097         (WebCore::WebXRPose::create):
1098         (WebCore::WebXRPose::WebXRPose):
1099         (WebCore::WebXRPose::transform const):
1100         (WebCore::WebXRPose::emulatedPosition const):
1101         * Modules/webxr/WebXRPose.h: Added.
1102         * Modules/webxr/WebXRPose.idl: Added.
1103         * Modules/webxr/WebXRReferenceSpace.cpp: Added.
1104         (WebCore::WebXRReferenceSpace::WebXRReferenceSpace):
1105         (WebCore::WebXRReferenceSpace::getOffsetReferenceSpace):
1106         * Modules/webxr/WebXRReferenceSpace.h: Added.
1107         * Modules/webxr/WebXRReferenceSpace.idl: Added.
1108         * Modules/webxr/WebXRRenderState.cpp: Added.
1109         (WebCore::WebXRRenderState::create):
1110         (WebCore::WebXRRenderState::WebXRRenderState):
1111         (WebCore::WebXRRenderState::depthNear const):
1112         (WebCore::WebXRRenderState::depthFar const):
1113         (WebCore::WebXRRenderState::inlineVerticalFieldOfView const):
1114         (WebCore::WebXRRenderState::baseLayer const):
1115         * Modules/webxr/WebXRRenderState.h: Added.
1116         * Modules/webxr/WebXRRenderState.idl: Added.
1117         * Modules/webxr/WebXRRigidTransform.cpp: Added.
1118         (WebCore::WebXRRigidTransform::create):
1119         (WebCore::WebXRRigidTransform::WebXRRigidTransform):
1120         (WebCore::WebXRRigidTransform::position const):
1121         (WebCore::WebXRRigidTransform::orientation const):
1122         (WebCore::WebXRRigidTransform::matrix const):
1123         (WebCore::WebXRRigidTransform::inverse const):
1124         * Modules/webxr/WebXRRigidTransform.h: Added.
1125         * Modules/webxr/WebXRRigidTransform.idl: Added.
1126         * Modules/webxr/WebXRSession.cpp: Added.
1127         (WebCore::WebXRSession::environmentBlendMode const):
1128         (WebCore::WebXRSession::visibilityState const):
1129         (WebCore::WebXRSession::renderState const):
1130         (WebCore::WebXRSession::inputSources const):
1131         (WebCore::WebXRSession::updateRenderState):
1132         (WebCore::WebXRSession::requestReferenceSpace):
1133         (WebCore::WebXRSession::requestAnimationFrame):
1134         (WebCore::WebXRSession::cancelAnimationFrame):
1135         (WebCore::WebXRSession::end):
1136         (WebCore::WebXRSession::activeDOMObjectName const):
1137         (WebCore::WebXRSession::stop):
1138         * Modules/webxr/WebXRSession.h: Added.
1139         * Modules/webxr/WebXRSession.idl: Added.
1140         * Modules/webxr/WebXRSpace.cpp: Added.
1141         (WebCore::WebXRSpace::WebXRSpace):
1142         * Modules/webxr/WebXRSpace.h: Added.
1143         * Modules/webxr/WebXRSpace.idl: Added.
1144         * Modules/webxr/WebXRSystem.cpp: Added.
1145         (WebCore::WebXRSystem::create):
1146         (WebCore::WebXRSystem::WebXRSystem):
1147         (WebCore::WebXRSystem::isSessionSupported):
1148         (WebCore::WebXRSystem::requestSession):
1149         (WebCore::WebXRSystem::activeDOMObjectName const):
1150         (WebCore::WebXRSystem::stop):
1151         * Modules/webxr/WebXRSystem.h: Added.
1152         * Modules/webxr/WebXRSystem.idl: Added.
1153         * Modules/webxr/WebXRView.cpp: Added.
1154         (WebCore::WebXRView::create):
1155         (WebCore::WebXRView::WebXRView):
1156         (WebCore::WebXRView::eye const):
1157         (WebCore::WebXRView::projectionMatrix const):
1158         (WebCore::WebXRView::transform const):
1159         * Modules/webxr/WebXRView.h: Added.
1160         * Modules/webxr/WebXRView.idl: Added.
1161         * Modules/webxr/WebXRViewerPose.cpp: Added.
1162         (WebCore::WebXRViewerPose::create):
1163         (WebCore::WebXRViewerPose::views const):
1164         * Modules/webxr/WebXRViewerPose.h: Added.
1165         * Modules/webxr/WebXRViewerPose.idl: Added.
1166         * Modules/webxr/WebXRViewport.cpp: Added.
1167         (WebCore::WebXRViewport::create):
1168         (WebCore::WebXRViewport::x const):
1169         (WebCore::WebXRViewport::y const):
1170         (WebCore::WebXRViewport::width const):
1171         (WebCore::WebXRViewport::height const):
1172         * Modules/webxr/WebXRViewport.h: Added.
1173         * Modules/webxr/WebXRViewport.idl: Added.
1174         * Modules/webxr/WebXRWebGLLayer.cpp: Added.
1175         (WebCore::WebXRWebGLLayer::create):
1176         (WebCore::WebXRWebGLLayer::WebXRWebGLLayer):
1177         (WebCore::WebXRWebGLLayer::antialias const):
1178         (WebCore::WebXRWebGLLayer::ignoreDepthValues const):
1179         (WebCore::WebXRWebGLLayer::framebuffer const):
1180         (WebCore::WebXRWebGLLayer::framebufferWidth const):
1181         (WebCore::WebXRWebGLLayer::framebufferHeight const):
1182         (WebCore::WebXRWebGLLayer::getViewport):
1183         (WebCore::WebXRWebGLLayer::getNativeFramebufferScaleFactor):
1184         * Modules/webxr/WebXRWebGLLayer.h: Added.
1185         * Modules/webxr/WebXRWebGLLayer.idl: Added.
1186         * Modules/webxr/XREnvironmentBlendMode.h: Added.
1187         * Modules/webxr/XREnvironmentBlendMode.idl: Added.
1188         * Modules/webxr/XREye.h: Added.
1189         * Modules/webxr/XREye.idl: Added.
1190         * Modules/webxr/XRFrameRequestCallback.h: Added.
1191         * Modules/webxr/XRFrameRequestCallback.idl: Added.
1192         * Modules/webxr/XRHandedness.h: Added.
1193         * Modules/webxr/XRHandedness.idl: Added.
1194         * Modules/webxr/XRInputSourceEvent.cpp: Added.
1195         (WebCore::XRInputSourceEvent::create):
1196         (WebCore::XRInputSourceEvent::XRInputSourceEvent):
1197         (WebCore::XRInputSourceEvent::frame const):
1198         (WebCore::XRInputSourceEvent::inputSource const):
1199         (WebCore::XRInputSourceEvent::buttonIndex const):
1200         * Modules/webxr/XRInputSourceEvent.h: Added.
1201         * Modules/webxr/XRInputSourceEvent.idl: Added.
1202         * Modules/webxr/XRInputSourcesChangeEvent.cpp: Added.
1203         (WebCore::XRInputSourcesChangeEvent::create):
1204         (WebCore::XRInputSourcesChangeEvent::XRInputSourcesChangeEvent):
1205         (WebCore::XRInputSourcesChangeEvent::session const):
1206         (WebCore::XRInputSourcesChangeEvent::added const):
1207         (WebCore::XRInputSourcesChangeEvent::removed const):
1208         * Modules/webxr/XRInputSourcesChangeEvent.h: Added.
1209         * Modules/webxr/XRInputSourcesChangeEvent.idl: Added.
1210         * Modules/webxr/XRReferenceSpaceEvent.cpp: Added.
1211         (WebCore::XRReferenceSpaceEvent::create):
1212         (WebCore::XRReferenceSpaceEvent::XRReferenceSpaceEvent):
1213         (WebCore::XRReferenceSpaceEvent::referenceSpace const):
1214         (WebCore::XRReferenceSpaceEvent::transform const):
1215         * Modules/webxr/XRReferenceSpaceEvent.h: Added.
1216         * Modules/webxr/XRReferenceSpaceEvent.idl: Added.
1217         * Modules/webxr/XRReferenceSpaceType.h: Added.
1218         * Modules/webxr/XRReferenceSpaceType.idl: Added.
1219         * Modules/webxr/XRRenderStateInit.h: Added.
1220         * Modules/webxr/XRRenderStateInit.idl: Added.
1221         * Modules/webxr/XRSessionEvent.cpp: Added.
1222         (WebCore::XRSessionEvent::create):
1223         (WebCore::XRSessionEvent::XRSessionEvent):
1224         (WebCore::XRSessionEvent::session const):
1225         * Modules/webxr/XRSessionEvent.h: Added.
1226         * Modules/webxr/XRSessionEvent.idl: Added.
1227         * Modules/webxr/XRSessionInit.h: Added.
1228         * Modules/webxr/XRSessionInit.idl: Added.
1229         * Modules/webxr/XRSessionMode.h: Added.
1230         * Modules/webxr/XRSessionMode.idl: Added.
1231         * Modules/webxr/XRTargetRayMode.h: Added.
1232         * Modules/webxr/XRTargetRayMode.idl: Added.
1233         * Modules/webxr/XRVisibilityState.h: Added.
1234         * Modules/webxr/XRVisibilityState.idl: Added.
1235         * Modules/webxr/XRWebGLLayerInit.h: Added.
1236         * Modules/webxr/XRWebGLLayerInit.idl: Added.
1237         * PlatformWPE.cmake: Added OpenXR libraries and include paths.
1238         * Sources.txt: Added new cpp files.
1239         * WebCore.xcodeproj/project.pbxproj: Added new files.
1240         * bindings/IDLTypes.h: Added SequenceStorageType.
1241         * bindings/js/JSDOMConvertSequences.h:
1242         * bindings/js/WebCoreBuiltinNames.h:
1243         * dom/EventNames.h:
1244         * dom/EventNames.in: Added WebXR events.
1245         * dom/EventTargetFactory.in: Added WebXR event targets.
1246         * page/RuntimeEnabledFeatures.h: Added new runtime feature for WebXR.
1247         (WebCore::RuntimeEnabledFeatures::setWebXREnabled):
1248         (WebCore::RuntimeEnabledFeatures::webXREnabled const):
1249         * platform/xr/PlatformXR.cpp: Added.
1250         * platform/xr/PlatformXR.h: Added.
1251         * platform/xr/openxr/PlatformXR.cpp: Added.
1252         (PlatformXR::createStructure): Utility function to create OpenXR structs.
1253         (PlatformXR::resultToString): Translates OpenXR error codes to strings.
1254         (PlatformXR::Instance::Impl::Impl):
1255         (PlatformXR::Instance::Impl::~Impl):
1256         (PlatformXR::Instance::singleton):
1257
1258 2020-03-16  Zan Dobersek  <zdobersek@igalia.com>
1259
1260         [Cairo] Path copy constructor and operator must also copy over CTM
1261         https://bugs.webkit.org/show_bug.cgi?id=183327
1262
1263         Reviewed by Carlos Garcia Campos.
1264
1265         Cairo implementations of Path copy constructor and assignment operator
1266         must also copy over the current transformation matrix that's maintained
1267         on the source path's cairo_t context.
1268
1269         cairo_copy_path() copies the current path off of a Cairo context, but
1270         during that also transforms every point on the path through inverse of
1271         the CTM, back into user coordinates. For copying to be done correctly,
1272         the copied path must be transformed through the CTM when it's appended
1273         to the target Cairo context. For that reason the CTM has to be copied
1274         over from source to target context before the path is copied and
1275         appended.
1276
1277         * platform/graphics/cairo/PathCairo.cpp:
1278         (WebCore::Path::Path):
1279         (WebCore::Path::operator=):
1280
1281 2020-03-16  youenn fablet  <youenn@apple.com>
1282
1283         Unique origins should not be Potentially Trustworthy
1284         https://bugs.webkit.org/show_bug.cgi?id=209049
1285
1286         Reviewed by Darin Adler.
1287
1288         Unique origins should not be considered trustworthy as per https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy.
1289
1290         Test: http/tests/security/iframe-unique-origin.https.html
1291
1292         * dom/Document.cpp:
1293         (WebCore::Document::isSecureContext const):
1294         Removed check for top level origins as we make all unique origins not trusted.
1295         * page/SecurityOrigin.cpp:
1296
1297 2020-03-16  youenn fablet  <youenn@apple.com>
1298
1299         Remove the use of empty WebRTC sources for receiver tracks
1300         https://bugs.webkit.org/show_bug.cgi?id=209061
1301
1302         Reviewed by Eric Carlson.
1303
1304         We no longer need to create receivers with empty sources since we now always have a libwebrtc receiver from which we can get the track.
1305         We remove that code path.
1306         This sldo allows using the right track parameters from the start, like track id.
1307
1308         Covered by existing and rebased tests.
1309
1310         * Modules/mediastream/RTCPeerConnection.h:
1311         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1312         (WebCore::LibWebRTCMediaEndpoint::addPendingTrackEvent):
1313         (WebCore::LibWebRTCMediaEndpoint::collectTransceivers):
1314         (WebCore::LibWebRTCMediaEndpoint::newTransceiver):
1315         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1316         (WebCore::LibWebRTCPeerConnectionBackend::createReceiver):
1317         (WebCore::LibWebRTCPeerConnectionBackend::addTrack):
1318         (WebCore::LibWebRTCPeerConnectionBackend::addTransceiverFromTrackOrKind):
1319         (WebCore::LibWebRTCPeerConnectionBackend::newRemoteTransceiver):
1320         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
1321         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.cpp:
1322         (WebCore::LibWebRTCRtpReceiverBackend::createSource):
1323         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h:
1324         * platform/mediastream/RealtimeIncomingAudioSource.cpp:
1325         (WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource):
1326         * platform/mediastream/RealtimeIncomingAudioSource.h:
1327         * platform/mediastream/RealtimeIncomingVideoSource.cpp:
1328         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
1329         * platform/mediastream/RealtimeIncomingVideoSource.h:
1330         * testing/MockLibWebRTCPeerConnection.h:
1331         (WebCore::MockMediaStreamTrack::state const):
1332         (WebCore::MockRtpReceiver::SetObserver):
1333
1334 2020-03-16  Hurnjoo Lee  <hurnjoo.lee@samsung.com>, Fujii Hironori  <Hironori.Fujii@sony.com>, Carlos Garcia Campos  <cgarcia@igalia.com>
1335
1336         [Cairo][SVG] marker-mid isn't shown on a joint of rectilinearly connected line-to path segments
1337         https://bugs.webkit.org/show_bug.cgi?id=113849
1338
1339         Reviewed by Adrian Perez de Castro.
1340
1341         Marker-mid of svg is not displayed because path elements that added to
1342         cairo backend are optimized. If the new line_to has same slope with
1343         the previous path element, then the path element is joined to previous
1344         path element.
1345
1346         Example:
1347
1348         added path elements : moveto(-5,-2), lineto(0,-2), lineto(5,-2)
1349         cairo_path_data : moveto(-5,-2), lineto(5, -2)
1350
1351         This patch stores all of path informations separately in order to avoid
1352         this problem. When generating positions of markers, we use stored path
1353         informations instead of cairo_path_data.
1354
1355         When a new operation can't be directly stored in an ElementPath, we fallback to use cairo_path_data() in
1356         Path::apply().
1357
1358         * platform/graphics/Path.h: Add new constructor that receives a cairo context, make ensureCairoPath() private
1359         and add m_elements member.
1360         * platform/graphics/cairo/FontCairo.cpp:
1361         (WebCore::Font::platformPathForGlyph const): Create a cairo context for the path and use the new constructor
1362         that receives a RefPtr<cairo_t>&&.
1363         * platform/graphics/cairo/PathCairo.cpp:
1364         (WebCore::Path::Path): Initialize m_elements to an empty vector when created without a cairo context.
1365         (WebCore::Path::operator=): Also copy m_elements.
1366         (WebCore::Path::clear): Initialize m_elements to an empty vector.
1367         (WebCore::Path::translate): Apply the translate to elements in m_elements.
1368         (WebCore::Path::appendElement): Helper to add an operation to m_elements.
1369         (WebCore::Path::moveToSlowCase): Call appendElement() if m_elements is not nullopt.
1370         (WebCore::Path::addLineToSlowCase): Ditto.
1371         (WebCore::Path::addRect): Ditto.
1372         (WebCore::Path::addQuadCurveToSlowCase): Ditto.
1373         (WebCore::Path::addBezierCurveToSlowCase): Ditto.
1374         (WebCore::Path::addArcSlowCase): Set m_elements to nullopt.
1375         (WebCore::Path::addArcTo): Ditto.
1376         (WebCore::Path::addEllipse): Ditto.
1377         (WebCore::Path::addPath): Ditto.
1378         (WebCore::Path::closeSubpath): Call appendElement() if m_elements is not nullopt.
1379         (WebCore::Path::applySlowCase const): Use elements from m_elements if it's not nullopt, otherwise fallback to
1380         use cairo_path_data.
1381         (WebCore::Path::transform): Apply the transform to elements in m_elements.
1382
1383 2020-03-16  Rob Buis  <rbuis@igalia.com>
1384
1385         Remove addHTTPOriginIfNeeded calls
1386         https://bugs.webkit.org/show_bug.cgi?id=209127
1387
1388         Reviewed by Darin Adler.
1389
1390         Remove addHTTPOriginIfNeeded calls since they are get requests and navigations and the spec [1]
1391         indicates that the Origin header should not be written out, making these calls no-ops.
1392
1393        [1] https://fetch.spec.whatwg.org/#append-a-request-origin-header
1394
1395         * loader/FrameLoader.cpp:
1396         (WebCore::FrameLoader::changeLocation):
1397         (WebCore::FrameLoader::loadURL):
1398
1399 2020-03-16  Rob Buis  <rbuis@igalia.com>
1400
1401         Simplify ChromeClient.createWindow
1402         https://bugs.webkit.org/show_bug.cgi?id=209123
1403
1404         Reviewed by Darin Adler.
1405
1406         Simplify ChromeClient.createWindow by removing the FrameLoadRequest parameter.
1407         It was only passed for its ResourceRequest member, which can also be obtained
1408         from the NavigationAction parameter.
1409
1410         * loader/EmptyClients.h:
1411         * loader/FrameLoader.cpp:
1412         (WebCore::createWindow):
1413         * page/Chrome.cpp:
1414         (WebCore::Chrome::createWindow const):
1415         * page/Chrome.h:
1416         * page/ChromeClient.h:
1417         * page/ContextMenuController.cpp:
1418         (WebCore::openNewWindow):
1419
1420 2020-03-15  Fujii Hironori  <Hironori.Fujii@sony.com>
1421
1422         KeyedDecoderGeneric fails to allocate Vector while decoding broken data
1423         https://bugs.webkit.org/show_bug.cgi?id=207324
1424
1425         Reviewed by Darin Adler.
1426
1427         There were three crash bugs in it.
1428
1429         KeyedDecoderGeneric was trying to allocate a buffer without
1430         ensuring the size wouldn't exceed the decoding data size by using
1431         bufferIsLargeEnoughToContain.
1432
1433         It was trying to push an itme into the top dictionary of emtpy
1434         m_dictionaryStack when EndObject tag would appear without the
1435         preceding BeginObject tag.
1436
1437         It was trying to push an item into the top array of empty
1438         m_arrayStack when EndArray tag would appear without the preceding
1439         BeginArray tag.
1440
1441         Tests: TestWebKitAPI: KeyedCoding.DecodeRandomData
1442
1443         * platform/generic/KeyedDecoderGeneric.cpp:
1444         (WebCore::readString):
1445         (WebCore::KeyedDecoderGeneric::KeyedDecoderGeneric):
1446         Check bufferIsLargeEnoughToContain(size) before allocating a Vector with size.
1447         Check if m_dictionaryStack and m_arrayStack are empty.
1448
1449 2020-03-15  Chris Dumez  <cdumez@apple.com>
1450
1451         [DRT] InternalSettingsGenerated::resetToConsistentState() may override TestOptions::enableBackForwardCache
1452         https://bugs.webkit.org/show_bug.cgi?id=207481
1453         <rdar://problem/59331661>
1454
1455         Reviewed by Darin Adler.
1456
1457         Add a support for a new excludeFromInternalSetting option in Settings.yaml and use it for
1458         'usesBackForwardCache' setting. This means that script will no longer be able to toggle
1459         this particular setting via internals.settings JS API. Tests wanting to turn on the
1460         back / forward cache are supposed to use the following:
1461         <!-- webkit-test-runner [ enableBackForwardCache=true ] -->
1462
1463         Using internals.settings JS API to turn on the back/forward cache would not work well
1464         with WebKit2 because of process-swap-on-navigation. Support for it in WK1 / DRT was
1465         causing flakiness because of a conflict between the 2 ways of enabling the setting.
1466
1467         * Scripts/GenerateSettings.rb:
1468         * Scripts/SettingsTemplates/InternalSettingsGenerated.cpp.erb:
1469         * Scripts/SettingsTemplates/InternalSettingsGenerated.h.erb:
1470         * Scripts/SettingsTemplates/InternalSettingsGenerated.idl.erb:
1471         * page/Settings.yaml:
1472
1473 2020-03-15  Zalan Bujtas  <zalan@apple.com>
1474
1475         [LFC][TFC] Add basic column span support for content box width
1476         https://bugs.webkit.org/show_bug.cgi?id=209120
1477         <rdar://problem/60463424>
1478
1479         Reviewed by Antti Koivisto.
1480
1481         Take the column spanning into account when computing the content width for the table cell.
1482         [content box width = column width(1) + column width(2) + .. + column width(spanning value) + ((spanning value - 1) * horizontal spacing)]
1483
1484         Test: fast/layoutformattingcontext/table-colspan-simple.html
1485
1486         * layout/tableformatting/TableFormattingContext.cpp:
1487         (WebCore::Layout::TableFormattingContext::layoutInFlowContent):
1488         (WebCore::Layout::TableFormattingContext::layoutTableCellBox):
1489         (WebCore::Layout::TableFormattingContext::positionTableCells):
1490         * layout/tableformatting/TableFormattingContext.h:
1491         * layout/tableformatting/TableGrid.cpp:
1492         (WebCore::Layout::TableGrid::appendCell):
1493         * layout/tableformatting/TableGrid.h:
1494         (WebCore::Layout::TableGrid::CellInfo::startColumn const):
1495         (WebCore::Layout::TableGrid::CellInfo::endColumn const):
1496         (WebCore::Layout::TableGrid::CellInfo::startRow const):
1497         (WebCore::Layout::TableGrid::CellInfo::endRow const):
1498         (WebCore::Layout::TableGrid::CellInfo::columnSpan const):
1499         (WebCore::Layout::TableGrid::CellInfo::rowSpan const):
1500
1501 2020-03-15  Yusuke Suzuki  <ysuzuki@apple.com>
1502
1503         Should not use variable-length-array (VLA)
1504         https://bugs.webkit.org/show_bug.cgi?id=209043
1505
1506         Reviewed by Mark Lam.
1507
1508         * Configurations/Base.xcconfig:
1509         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
1510         (WebCore::wrapSerializedCryptoKey):
1511         (WebCore::unwrapSerializedCryptoKey):
1512         * html/canvas/WebGL2RenderingContext.cpp:
1513         (WebCore::WebGL2RenderingContext::getInternalformatParameter):
1514         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
1515         (WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices):
1516         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
1517         (WebCore::updateDisplayID):
1518         (WebCore::ScreenDisplayCaptureSourceMac::screenCaptureDevices):
1519
1520 2020-03-14  Brent Fulgham  <bfulgham@apple.com>
1521
1522         Add missing checks needed for AppBound Quirk
1523         https://bugs.webkit.org/show_bug.cgi?id=209117
1524         <rdar://problem/60460097>
1525
1526         Reviewed by John Wilander.
1527
1528         The checks for the 'NeedsInAppBrowserPrivacyQuirks' flag added in r258101 was incomplete.
1529         Two additional call sites need to check the state of the flag.
1530
1531         * bindings/js/ScriptController.cpp:
1532         (WebCore::ScriptController::executeScriptInWorld): Add missing check for the quirk.
1533         * loader/FrameLoaderClient.h: Add new API for the 'NeedsInAppBrowserPrivacyQuirks'
1534         debug flag.
1535         * page/Frame.cpp:
1536         (WebCore::Frame::injectUserScriptImmediately): Ditto.
1537
1538 2020-03-10  Darin Adler  <darin@apple.com>
1539
1540         Change all return values in TextIterator header from live ranges to SimpleRange
1541         https://bugs.webkit.org/show_bug.cgi?id=208906
1542
1543         Reviewed by Antti Koivisto.
1544
1545         This is another step in moving off of live ranges for WebKit internals.
1546
1547         - Change return values of remaining functions that were returning live ranges in
1548           the TextIterator header to return SimpleRange.
1549         - Change some arguments from live ranges to SimpleRange.
1550         - At some call sites, use createLiveRange to convert the SimpleRange into a live
1551           range (for now), but at others update the code to use SimpleRange.
1552         - Renamed a version of findPlainText that returns a boolean to containsPlainText.
1553         - Convert call sites that were using createLiveRange just to use the
1554           Range::startPosition and Range::endPosition functions to instead use a new
1555           overload of the createLegacyEditingPosition function that can be used with
1556           SimpleRange::start and SimpleRange::end because it takes a BoundaryPoint.
1557
1558         * accessibility/AXObjectCache.cpp:
1559         (WebCore::AXObjectCache::rangeMatchesTextNearRange): Return Optional<SimpleRange>
1560         and take SimpleRange argument.
1561         (WebCore::AXObjectCache::previousBoundary): Updated since
1562         SimplifiedBackwardsTextIterator::range now returns SimpleRange.
1563         * accessibility/AXObjectCache.h: Updated for the above.
1564
1565         * accessibility/AccessibilityObjectInterface.h:
1566         (WebCore::AXCoreObject::containsText const): Updated for name change.
1567         Now containsPlainText instead of findPlainText.
1568
1569         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1570         (-[WebAccessibilityObjectWrapper arrayOfTextForTextMarkers:attributed:]):
1571         Use createLegacyEditingPosition instead of createLiveRange.
1572         (-[WebAccessibilityObjectWrapper rangeFromMarkers:withText:]): Use createLiveRange.
1573
1574         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1575         (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:spellCheck:]):
1576         Use createLegacyEditingPosition instead of createLiveRange.
1577
1578         * dom/Position.cpp:
1579         (WebCore::createLegacyEditingPosition): Added an overload that takes a BoundaryPoint.
1580         * dom/Position.h: Updated for the above, also removed unneeded includes and forward
1581         declarations.
1582
1583         * editing/Editing.cpp:
1584         (WebCore::visiblePositionForIndexUsingCharacterIterator): Updated since
1585         CharacterIterator::range is now a SimpleRange, use createLegacyEditingPosition.
1586
1587         * editing/Editor.cpp:
1588         (WebCore::Editor::advanceToNextMisspelling): Updated since CharacterIterator::range
1589         is now a SimpleRange.
1590         (WebCore::Editor::rangeOfString): Updated since findPlainText now returns a
1591         SimpleRange; use createLiveRange.
1592         (WebCore::Editor::countMatchesForText): Ditto.
1593
1594         * editing/TextIterator.cpp:
1595         (WebCore::SimplifiedBackwardsTextIterator::range const): Return a SimpleRange.
1596         (WebCore::CharacterIterator::range const): Ditto.
1597         (WebCore::characterSubrange): Updated since CharacterIterator::range returns
1598         a SimpleRange. Use createLiveRange.
1599         (WebCore::BackwardsCharacterIterator::BackwardsCharacterIterator): Cut down
1600         code here by initializing data members in the class definition.
1601         (WebCore::BackwardsCharacterIterator::range const): Return a SimpleRange.
1602         (WebCore::WordAwareIterator::WordAwareIterator): Cut down code here by
1603         initializing data members in the class definition.
1604         (WebCore::hasAnyPlainText): Take a SimpleRange, use createLiveRange.
1605         (WebCore::plainTextUsingBackwardsTextIteratorForTesting): Take a SimpleRange,
1606         use createLiveRange.
1607         (WebCore::collapsedToBoundary): Take and return a SimpleRange.
1608         (WebCore::findPlainTextMatches): Take a SimpleRange, use createLiveRange.
1609         (WebCore::rangeForMatch): Take and return a SimpleRange.
1610         (WebCore::findClosestPlainText): Ditto.
1611         (WebCore::findPlainText): Ditto.
1612         (WebCore::containsPlainText): Renamed from findPlainText since this returns
1613         a boolean, not a found location of some text.
1614         * editing/TextIterator.h: Updated for the above. Also changed some data
1615         members to use unsigned for offsets rather than int.
1616
1617         * editing/TextManipulationController.cpp:
1618         (WebCore::ParagraphContentIterator::startPosition): Use
1619         createLegacyEditingPosition instead of createLiveRange.
1620         (WebCore::ParagraphContentIterator::endPosition): Ditto.
1621
1622         * editing/VisiblePosition.h: Added a forward declaration here since Position.h
1623         no longer forward declares it.
1624
1625         * editing/VisibleSelection.cpp:
1626         (WebCore::VisibleSelection::appendTrailingWhitespace): Updated since
1627         CharacterIterator::range is now a SimpleRange, use createLegacyEditingPosition.
1628         * editing/VisibleUnits.cpp:
1629         (WebCore::previousBoundary): Ditto.
1630         (WebCore::nextBoundary): Ditto.
1631
1632         * testing/Internals.cpp:
1633         (WebCore::Internals::rangeOfStringNearLocation): Updated since
1634         findClosestPlainText now returns a SimpleRange, use createLiveRange.
1635
1636 2020-03-14  Zalan Bujtas  <zalan@apple.com>
1637
1638         [LFC][TFC] Fill in the gaps with anonymous table cell boxes
1639         https://bugs.webkit.org/show_bug.cgi?id=209114
1640         <rdar://problem/60458806>
1641
1642         Reviewed by Antti Koivisto.
1643
1644         17.5 Visual layout of table contents
1645         A "missing cell" is a cell in the row/column grid that is not
1646         occupied by an element or pseudo-element. Missing cells are rendered
1647         as if an anonymous table-cell box occupied their position in the grid.
1648         (https://www.w3.org/TR/CSS22/tables.html)
1649
1650         This helps to keep TableGrid an actual grid.
1651
1652         Test: fast/layoutformattingcontext/table-missing-cells-simple.html
1653
1654         * layout/layouttree/LayoutTreeBuilder.cpp:
1655         (WebCore::Layout::TreeBuilder::buildTableStructure):
1656
1657 2020-03-14  Peng Liu  <peng.liu6@apple.com>
1658
1659         Cleanup RenderMediaControls.cpp and RenderMediaControlElements.cpp
1660         https://bugs.webkit.org/show_bug.cgi?id=209008
1661
1662         Reviewed by Daniel Bates.
1663
1664         Merge RenderMediaControls.[h|cpp] and RenderMediaControlElements.[h|cpp].
1665         Remove class RenderMediaVolumeSliderContainer because we can use RenderBlockFlow
1666         to render MediaControlTextTrackContainerElement.
1667
1668         No new tests, no functional change.
1669
1670         * Sources.txt:
1671         * WebCore.xcodeproj/project.pbxproj:
1672         * html/shadow/MediaControlElementTypes.cpp:
1673         * html/shadow/MediaControlElements.cpp:
1674         (WebCore::MediaControlTextTrackContainerElement::createElementRenderer):
1675         * rendering/RenderMediaControlElements.cpp: Removed.
1676         * rendering/RenderMediaControlElements.h: Removed.
1677         * rendering/RenderMediaControls.cpp:
1678         (WebCore::RenderMediaVolumeSliderContainer::RenderMediaVolumeSliderContainer):
1679         (WebCore::RenderMediaVolumeSliderContainer::layout):
1680         (WebCore::RenderMediaControlTimelineContainer::RenderMediaControlTimelineContainer):
1681         (WebCore::RenderMediaControlTimelineContainer::layout):
1682         * rendering/RenderMediaControls.h:
1683         * rendering/RenderThemeMac.mm:
1684
1685 2020-03-14  Daniel Bates  <dabates@apple.com>
1686
1687         Share HitTestResult::addNodeToListBasedTestResult() impl for LayoutRect and FloatRect overloads
1688         https://bugs.webkit.org/show_bug.cgi?id=209107
1689
1690         Reviewed by Brady Eidson.
1691
1692         Remove code duplication for adding a node to the result set.
1693
1694         * rendering/HitTestResult.cpp:
1695         (WebCore::HitTestResult::addNodeToListBasedTestResultCommon): Added.
1696         (WebCore::HitTestResult::addNodeToListBasedTestResult): Write in terms of addNodeToListBasedTestResultCommon().
1697         * rendering/HitTestResult.h:
1698
1699 2020-03-14  Zalan Bujtas  <zalan@apple.com>
1700
1701         [Tree building] Reset the fragmented flow status before calling child.willBeRemovedFromTree.
1702         https://bugs.webkit.org/show_bug.cgi?id=209100
1703         <rdar://problem/60434672>
1704
1705         Reviewed by Simon Fraser.
1706
1707         ::willBeRemovedFromTree() assumes all the cleanup has happened and it's the final step before calling d'tor.
1708         It clears m_fragmentList that resetFragmentedFlowStateOnRemoval() later checks for consistency (m_fragmentList.contains(fragment)).
1709
1710         Test: fast/multicol/reparent-fragment-flow-content.html
1711
1712         * rendering/updating/RenderTreeBuilder.cpp:
1713         (WebCore::RenderTreeBuilder::detachFromRenderElement):
1714
1715 2020-03-14  Rob Buis  <rbuis@igalia.com>
1716
1717         Set Origin header value to null rather than omitting it
1718         https://bugs.webkit.org/show_bug.cgi?id=186030
1719
1720         Reviewed by Youenn Fablet.
1721
1722         For every redirect, addHTTPOriginIfNeeded should be called to
1723         make sure that the tainted origin logic is applied [1, Step 10] and
1724         thus the request after redirect has the correct Origin header.
1725
1726         Make AppleWin treat 308 redirects like 307 and so keeping http
1727         methods across redirects. This is similar to
1728         https://bugs.webkit.org/show_bug.cgi?id=154348.
1729
1730         [1] https://fetch.spec.whatwg.org/#concept-http-network-or-cache-fetch
1731
1732         * loader/FrameLoader.cpp:
1733         (WebCore::FrameLoader::addHTTPOriginIfNeeded):
1734         * loader/SubresourceLoader.cpp:
1735         (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
1736         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
1737         (WebCore::ResourceHandleCFURLConnectionDelegate::createResourceRequest):
1738
1739 2020-03-14  Ryosuke Niwa  <rniwa@webkit.org>
1740
1741         Call SVGTRefElement::buildPendingResource in SVGElement::didFinishInsertingNode
1742         https://bugs.webkit.org/show_bug.cgi?id=208981
1743
1744         Reviewed by Antti Koivisto.
1745
1746         This patch moves the call to SVGTRefElement::buildPendingResource from SVGElement::insertedIntoAncestor
1747         to SVGElement::didFinishInsertingNode.
1748
1749         * svg/SVGElement.cpp:
1750         (WebCore::SVGElement::insertedIntoAncestor): Return true when the element has a pending resource ID.
1751         (WebCore::SVGElement::didFinishInsertingNode): Added. Calls buildPendingResourcesIfNeeded.
1752         * svg/SVGElement.h:
1753
1754 2020-03-13  Said Abou-Hallawa  <said@apple.com>
1755
1756         SVGMatrix should have the access right of its owner SVGTransform always
1757         https://bugs.webkit.org/show_bug.cgi?id=207462
1758
1759         Reviewed by Simon Fraser.
1760
1761         The SVGMatrix needs to be reattached to its owner SVGTransform when the
1762         access right of this owner changes. The access right of the owner changes
1763         when it gets attached to or detached from a higher level owner.
1764
1765         Test: svg/dom/SVGTransformList-anim-read-only.html
1766
1767         * svg/SVGTransform.h:
1768         * svg/properties/SVGProperty.h:
1769         (WebCore::SVGProperty::attach):
1770         (WebCore::SVGProperty::detach):
1771         (WebCore::SVGProperty::reattach):
1772
1773 2020-03-13  Alex Christensen  <achristensen@webkit.org>
1774
1775         WKWebView._negotiatedLegacyTLS should be correct after back/forward navigations
1776         https://bugs.webkit.org/show_bug.cgi?id=209011
1777         <rdar://problem/59370588>
1778
1779         Reviewed by Youenn Fablet.
1780
1781         This is basically r258343 but for legacy TLS negotiation instead of plaintext HTTP use.
1782
1783         * dom/SecurityContext.h:
1784         (WebCore::SecurityContext::usedLegacyTLS const):
1785         (WebCore::SecurityContext::setUsedLegacyTLS):
1786         * history/CachedFrame.cpp:
1787         (WebCore::CachedFrame::usedLegacyTLS const):
1788         (WebCore::CachedFrame::setUsedLegacyTLS): Deleted.
1789         * history/CachedFrame.h:
1790         (WebCore::CachedFrame::usedLegacyTLS const): Deleted.
1791         * loader/FrameLoader.cpp:
1792         (WebCore::FrameLoader::commitProvisionalLoad):
1793         * platform/network/ResourceResponseBase.cpp:
1794         (WebCore::ResourceResponseBase::includeCertificateInfo const):
1795         * platform/network/ResourceResponseBase.h:
1796         (WebCore::ResourceResponseBase::setUsedLegacyTLS):
1797
1798 2020-03-13  Zalan Bujtas  <zalan@apple.com>
1799
1800         [Tree building] Block::attachIgnoringContinuation should allow inline tables as before child container
1801         https://bugs.webkit.org/show_bug.cgi?id=209095
1802         <rdar://problem/59837588>
1803
1804         Reviewed by Simon Fraser.
1805
1806         It's perfectly valid to have an inline table as the anonymous container for the before child.
1807         It'll get wrapped inside an anonymous block right before we insert the block box candidate, so
1808         the final result will be something like:
1809
1810         new block level child (this is the child we are inserting)
1811         anonymous block wrapper
1812           inline table (this is the before child's inline container)
1813             before child 
1814
1815         Test: fast/table/before-child-is-inline-table.html
1816
1817         * rendering/updating/RenderTreeBuilderBlock.cpp:
1818         (WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation):
1819
1820 2020-03-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
1821
1822         [GPU Process] GraphicsContextStateChange::apply() should process ShadowsIgnoreTransformsChange before processing ShadowChange
1823         https://bugs.webkit.org/show_bug.cgi?id=209071
1824
1825         Reviewed by Darin Adler.
1826
1827         Ensure GraphicsContextStateChange::apply() calls shadowsIgnoreTransforms()
1828         before calling setLegacyShadow() or setShadow().
1829
1830         Test: This patch fixes the following tests when running:
1831         "run-webkit-tests --internal-feature RenderCanvasInGPUProcessEnabled"
1832             fast/canvas/canvas-image-shadow.html
1833             fast/canvas/canvas-scale-drawImage-shadow.html
1834             fast/canvas/canvas-scale-fillPath-shadow.html
1835             fast/canvas/canvas-scale-fillRect-shadow.html
1836             fast/canvas/canvas-scale-shadowBlur.html
1837             fast/canvas/canvas-transforms-fillRect-shadow.html
1838             fast/canvas/fillText-shadow.html
1839
1840         * platform/graphics/GraphicsContext.cpp:
1841         (WebCore::GraphicsContextStateChange::apply const):
1842
1843 2020-03-13  John Wilander  <wilander@apple.com>
1844
1845         Remove unused code related to removePrevalentDomains()
1846         https://bugs.webkit.org/show_bug.cgi?id=209078
1847         <rdar://problem/59681984>
1848
1849         Reviewed by Brent Fulgham.
1850
1851         The various removePrevalentDomains() functions and its IPC endpoint are unused and should be removed.
1852
1853         No new tests. Just dead code removal.
1854
1855         * platform/network/NetworkStorageSession.cpp:
1856         (WebCore::NetworkStorageSession::removePrevalentDomains): Deleted.
1857         * platform/network/NetworkStorageSession.h:
1858
1859 2020-03-13  Myles C. Maxfield  <mmaxfield@apple.com>
1860
1861         [Cocoa] Push applicationSDKVersion() down from WebCore into WTF
1862         https://bugs.webkit.org/show_bug.cgi?id=209030
1863
1864         Reviewed by Simon Fraser.
1865
1866         * html/HTMLObjectElement.cpp:
1867         * html/MediaElementSession.cpp:
1868         (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback const):
1869         * loader/DocumentThreadableLoader.cpp:
1870         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
1871         * platform/RuntimeApplicationChecks.h:
1872         * platform/Timer.cpp:
1873         (WebCore::shouldSuppressThreadSafetyCheck):
1874         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
1875         (WebCore::applicationSDKVersionOverride): Deleted.
1876         (WebCore::setApplicationSDKVersion): Deleted.
1877         (WebCore::applicationSDKVersion): Deleted.
1878
1879 2020-03-13  Jiewen Tan  <jiewen_tan@apple.com>
1880
1881         [WebAuthn] Customize a bit more on the macOS LocalAuthentication prompt
1882         https://bugs.webkit.org/show_bug.cgi?id=208703
1883         <rdar://problem/60136974>
1884
1885         Reviewed by Darin Adler.
1886
1887         * en.lproj/Localizable.strings:
1888         * platform/LocalizedStrings.cpp:
1889         (WebCore::touchIDPromptTitle):
1890         * platform/LocalizedStrings.h:
1891         Adds a new formatted UI string to help with RP ID.
1892
1893 2020-03-13  Peng Liu  <peng.liu6@apple.com>
1894
1895         Safari sometimes crashes when switch video into PiP mode
1896         https://bugs.webkit.org/show_bug.cgi?id=208904
1897
1898         Reviewed by Simon Fraser.
1899
1900         With this patch, MediaControlTextTrackContainerElement won't paint its subtree
1901         to an image buffer (for the captions in video fullscreen or picture-in-picture mode)
1902         when the cues are updated. Instead, it only sets the flag m_needsGenerateTextTrackRepresentation
1903         to true after running layout based on the new cues. After that, it paints its subtree
1904         to an image buffer if needed at the end of Page::updateRendering() when the layout is clean.
1905         TextTrackRepresentationCocoa will use the image buffer to set the content of the layer
1906         for captions in video fullscreen or picture-in-picture mode.
1907
1908         MediaControlTextTrackContainerElement class is responsible for rendering the captions in both:
1909         1) a video player in the inline mode.
1910         2) a video player in "video fullscreen" or picture-in-picture mode.
1911         This patch refactors some functions to make their responsibilities clear.
1912
1913         * Modules/mediacontrols/MediaControlsHost.cpp:
1914         (WebCore::MediaControlsHost::updateTextTrackRepresentationImageIfNeeded):
1915         * Modules/mediacontrols/MediaControlsHost.h:
1916         * dom/Document.cpp:
1917         (WebCore::Document::setMediaElementShowingTextTrack):
1918         (WebCore::Document::clearMediaElementShowingTextTrack):
1919         (WebCore::Document::updateTextTrackRepresentationImageIfNeeded):
1920         * dom/Document.h:
1921
1922         Functions textTracksAreReady(), textTrackReadyStateChanged() and configureTextTrackDisplay()
1923         should be wrapped with "#if ENABLE(VIDEO_TRACK)".
1924         * html/HTMLMediaElement.cpp:
1925         (WebCore::HTMLMediaElement::setTextTrackRepresentation):
1926         (WebCore::HTMLMediaElement::textTracksAreReady const):
1927         (WebCore::HTMLMediaElement::textTrackReadyStateChanged):
1928         (WebCore::HTMLMediaElement::configureTextTrackDisplay):
1929         (WebCore::HTMLMediaElement::updateTextTrackRepresentationImageIfNeeded):
1930         * html/HTMLMediaElement.h:
1931
1932         * html/shadow/MediaControlElements.cpp:
1933         (WebCore::MediaControlTextTrackContainerElement::createElementRenderer):
1934         (WebCore::MediaControlTextTrackContainerElement::updateDisplay):
1935         (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentationImageIfNeeded):
1936         (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentationIfNeeded):
1937         (WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation):
1938         (WebCore::MediaControlTextTrackContainerElement::updateTextTrackStyle):
1939         (WebCore::MediaControlTextTrackContainerElement::enteredFullscreen):
1940         (WebCore::MediaControlTextTrackContainerElement::updateVideoDisplaySize):
1941         (WebCore::MediaControlTextTrackContainerElement::updateSizes):
1942         (WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
1943         (WebCore::MediaControlTextTrackContainerElement::textTrackRepresentationBoundsChanged):
1944         (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation): Deleted.
1945         (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentationStyle): Deleted.
1946         (WebCore::MediaControlTextTrackContainerElement::layoutIfNecessary): Deleted.
1947         (WebCore::MediaControlTextTrackContainerElement::updateCueStyles): Deleted.
1948         * html/shadow/MediaControlElements.h:
1949         * html/shadow/MediaControls.cpp:
1950         (WebCore::MediaControls::updateTextTrackRepresentationImageIfNeeded):
1951         * html/shadow/MediaControls.h:
1952         * page/Page.cpp:
1953         (WebCore::Page::updateRendering):
1954         * rendering/RenderMediaControlElements.cpp:
1955         (WebCore::RenderMediaControlTextTrackContainer::RenderMediaControlTextTrackContainer):
1956         (WebCore::RenderMediaControlTextTrackContainer::layout):
1957         (WebCore::RenderTextTrackContainerElement::RenderTextTrackContainerElement): Deleted.
1958         (WebCore::RenderTextTrackContainerElement::layout): Deleted.
1959         * rendering/RenderMediaControlElements.h:
1960
1961 2020-03-13  Ryan Haddad  <ryanhaddad@apple.com>
1962
1963         Unreviewed, reverting r258391.
1964
1965         Breaks internal builds.
1966
1967         Reverted changeset:
1968
1969         "Apply rotation at source level if WebRTC sink ask so"
1970         https://bugs.webkit.org/show_bug.cgi?id=205645
1971         https://trac.webkit.org/changeset/258391
1972
1973 2020-03-13  Kate Cheney  <katherine_cheney@apple.com>
1974
1975         Report all third party loads on a per-page basis
1976         https://bugs.webkit.org/show_bug.cgi?id=209032
1977         <rdar://problem/60397323>
1978
1979         Reviewed by Chris Dumez.
1980
1981         Test: http/tests/resourceLoadStatistics/loaded-registrable-domains-get-reported.html
1982
1983         Rename this function to more accurately reflect its purpose of sending
1984         loaded registrable domains to the WebPage.
1985
1986         * Modules/websockets/WebSocket.cpp:
1987         (WebCore::WebSocket::connect):
1988         * loader/FrameLoaderClient.h:
1989         * loader/ResourceLoader.cpp:
1990         (WebCore::ResourceLoader::willSendRequestInternal):
1991         * loader/cache/CachedResourceLoader.cpp:
1992         (WebCore::CachedResourceLoader::requestResource):
1993
1994 2020-03-13  Antti Koivisto  <antti@apple.com>
1995
1996         Remove AffectedByDrag style flag
1997         https://bugs.webkit.org/show_bug.cgi?id=209054
1998
1999         Reviewed by Simon Fraser.
2000
2001         As a followup to r258321, remove the last remaining user action related AffectedBy flag.
2002
2003         This also cleans out a bunch of scetchy, risky code from render tree (style invalidation!).
2004
2005         * css/SelectorChecker.cpp:
2006         (WebCore::SelectorChecker::checkOne const):
2007         * dom/DataTransfer.cpp:
2008         (WebCore::DataTransfer::createDragImage const):
2009         * dom/Element.cpp:
2010         (WebCore::Element::isUserActionElementDragged const):
2011         (WebCore::Element::setBeingDragged):
2012
2013         Move dragged state for render tree to Element where it belongs.
2014
2015         (WebCore::Element::hasFlagsSetDuringStylingOfChildren const):
2016         * dom/Element.h:
2017         (WebCore::Element::isBeingDragged const):
2018         (WebCore::Element::descendantsAffectedByPreviousSibling const):
2019         (WebCore::Element::setDescendantsAffectedByPreviousSibling):
2020         (WebCore::Element::childrenAffectedByDrag const): Deleted.
2021         (WebCore::Element::setChildrenAffectedByDrag): Deleted.
2022         * dom/Node.h:
2023         * dom/UserActionElementSet.h:
2024         (WebCore::UserActionElementSet::isBeingDragged):
2025         (WebCore::UserActionElementSet::setBeingDragged):
2026
2027         Invalidate using PseudoClassChangeInvalidation that doesn't require any flags.
2028
2029         * platform/DragImage.cpp:
2030         (WebCore::ScopedNodeDragEnabler::ScopedNodeDragEnabler):
2031         (WebCore::ScopedNodeDragEnabler::~ScopedNodeDragEnabler):
2032         * rendering/RenderBlock.cpp:
2033         (WebCore::RenderBlock::updateDragState): Deleted.
2034         * rendering/RenderBlock.h:
2035         * rendering/RenderInline.cpp:
2036         (WebCore::RenderInline::updateDragState): Deleted.
2037         * rendering/RenderInline.h:
2038         * rendering/RenderObject.cpp:
2039         (WebCore::RenderObject::updateDragState): Deleted.
2040         (WebCore::RenderObject::setIsDragging): Deleted.
2041         * rendering/RenderObject.h:
2042         (WebCore::RenderObject::RenderObjectRareData::RenderObjectRareData):
2043         (WebCore::RenderObject::isDragging const): Deleted.
2044         * rendering/style/RenderStyle.cpp:
2045         (WebCore::RenderStyle::RenderStyle):
2046         * rendering/style/RenderStyle.h:
2047         (WebCore::RenderStyle::NonInheritedFlags::operator== const):
2048         (WebCore::RenderStyle::affectedByDrag const): Deleted.
2049         (WebCore::RenderStyle::setAffectedByDrag): Deleted.
2050         * style/StyleRelations.cpp:
2051         (WebCore::Style::commitRelationsToRenderStyle):
2052         (WebCore::Style::commitRelations):
2053         * style/StyleRelations.h:
2054
2055 2020-03-13  Andres Gonzalez  <andresg_22@apple.com>
2056
2057         [WebAccessibilityObjectWrapper renderWidgetChildren] does not need to run on main thread.
2058         https://bugs.webkit.org/show_bug.cgi?id=209053
2059         <rdar://problem/60349440>
2060
2061         Reviewed by Chris Fleizach.
2062
2063         Since we are caching the platform widget in IsolatedMode (NSView),
2064         there is no need to dispatch renderWidgetChildren to the main thread.
2065
2066         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2067         (-[WebAccessibilityObjectWrapper renderWidgetChildren]):
2068
2069 2020-03-13  Ryosuke Niwa  <rniwa@webkit.org>
2070
2071         Crash in TextIterator::node via TextManipulationController::replace
2072         https://bugs.webkit.org/show_bug.cgi?id=209048
2073
2074         Reviewed by Wenson Hsieh.
2075
2076         The crash was caused by item.start being null in TextManipulationController::replace for a paragraph
2077         consisting of just an image because TextManipulationController::observeParagraphs never may never set
2078         startOfCurrentParagraph in such a case (content.isTextContent can be false for an image!).
2079
2080         Fixed the bug by setting startOfCurrentParagraph to a position before the current content's node
2081         when inserting a token for a RenderReplaced if it's null.
2082
2083         Test: TextManipulation.CompleteTextManipulationShouldReplaceContentsAroundParagraphWithJustImage
2084
2085         * editing/TextManipulationController.cpp:
2086         (WebCore::TextManipulationController::observeParagraphs):
2087
2088 2020-03-13  Michael Catanzaro  <mcatanzaro@gnome.org>
2089
2090         -Wredundant-move in CSSPropertyParserHelpers.cpp
2091         https://bugs.webkit.org/show_bug.cgi?id=209019
2092
2093         Reviewed by Youenn Fablet.
2094
2095         Silence compiler warning by removing improper WTFMove().
2096
2097         * css/parser/CSSPropertyParserHelpers.cpp:
2098         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedRadialGradient):
2099
2100 2020-03-13  Youenn Fablet  <youenn@apple.com>
2101
2102         Apply rotation at source level if WebRTC sink ask so
2103         https://bugs.webkit.org/show_bug.cgi?id=205645
2104
2105         Reviewed by Eric Carlson.
2106
2107         Add a virtual method to RealtimeMediaSource to pass the information that the sink prefers the frames to be rotated before sending them.
2108 r       By default, the method does nothing and RealtimeOutgoingVideoSource will continue to do the rotation itself.
2109         Update ImageRotationSessionVT to be more easily usable by users having MediaSample instead of CVPixelBuffer.
2110         Update RealtimeOutgoingVideoSource to use that routine: whenever applying rotation is needed,
2111         it will ask its track source to apply rotation. If the track source cannot do it, it will do it on its own.
2112
2113         Test: webrtc/video-rotation-no-cvo.html
2114
2115         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2116         (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources):
2117         * WebCore.xcodeproj/project.pbxproj:
2118         * platform/graphics/cv/ImageRotationSessionVT.h:
2119         (WebCore::operator==):
2120         (WebCore::operator!=):
2121         * platform/graphics/cv/ImageRotationSessionVT.mm:
2122         (WebCore::ImageRotationSessionVT::ImageRotationSessionVT):
2123         (WebCore::ImageRotationSessionVT::initialize):
2124         (WebCore::ImageRotationSessionVT::rotate):
2125         * platform/mediastream/RealtimeMediaSource.h:
2126         * platform/mediastream/RealtimeOutgoingVideoSource.cpp:
2127         (WebCore::RealtimeOutgoingVideoSource::setSource):
2128         (WebCore::RealtimeOutgoingVideoSource::applyRotation):
2129         (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink):
2130         * platform/mediastream/RealtimeOutgoingVideoSource.h:
2131
2132 2020-03-13  youenn fablet  <youenn@apple.com>
2133
2134         Remove use of PlatformMediaSession types in AudioSession
2135         https://bugs.webkit.org/show_bug.cgi?id=208995
2136
2137         Reviewed by Eric Carlson.
2138
2139         Remove type for beginInterruption since AudioSession always trigger system interruptions.
2140         Have a dedicated type for endInterruption.
2141         No change of behavior.
2142
2143         * platform/audio/AudioSession.cpp:
2144         (WebCore::AudioSession::beginInterruption):
2145         (WebCore::AudioSession::endInterruption):
2146         * platform/audio/AudioSession.h:
2147         * platform/audio/ios/AudioSessionIOS.mm:
2148         (-[WebInterruptionObserverHelper interruption:]):
2149         (WebCore::AudioSession::beginInterruption):
2150         (WebCore::AudioSession::endInterruption):
2151         * platform/audio/ios/MediaSessionManagerIOS.h:
2152
2153 2020-03-13  Antti Koivisto  <antti@apple.com>
2154
2155         Remove unused affectedBy style flags
2156         https://bugs.webkit.org/show_bug.cgi?id=209009
2157
2158         Reviewed by Antoine Quint.
2159
2160         These flags are unused after r258321. Remove the flags and the code that generates them.
2161
2162         * css/SelectorChecker.cpp:
2163         (WebCore::SelectorChecker::checkOne const):
2164         * cssjit/SelectorCompiler.cpp:
2165         (WebCore::SelectorCompiler::addStyleRelationFunction):
2166         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsActive):
2167         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsHovered):
2168         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasFocusWithin):
2169         * dom/Element.cpp:
2170         (WebCore::Element::hasFlagsSetDuringStylingOfChildren const):
2171         (WebCore::Element::resetStyleRelations):
2172         * dom/Element.h:
2173         (WebCore::Element::styleAffectedByEmpty const):
2174         (WebCore::Element::descendantsAffectedByPreviousSibling const):
2175         (WebCore::Element::setStyleAffectedByEmpty):
2176         (WebCore::Element::setDescendantsAffectedByPreviousSibling):
2177         (WebCore::Element::styleAffectedByActive const): Deleted.
2178         (WebCore::Element::styleAffectedByFocusWithin const): Deleted.
2179         (WebCore::Element::childrenAffectedByHover const): Deleted.
2180         (WebCore::Element::setStyleAffectedByFocusWithin): Deleted.
2181         (WebCore::Element::setChildrenAffectedByHover): Deleted.
2182         (WebCore::Element::setStyleAffectedByActive): Deleted.
2183         * dom/Node.h:
2184         * rendering/style/RenderStyle.cpp:
2185         (WebCore::RenderStyle::RenderStyle):
2186         * rendering/style/RenderStyle.h:
2187         (WebCore::RenderStyle::affectedByDrag const):
2188         (WebCore::RenderStyle::NonInheritedFlags::operator== const):
2189         (WebCore::RenderStyle::affectedByHover const): Deleted.
2190         (WebCore::RenderStyle::affectedByActive const): Deleted.
2191         (WebCore::RenderStyle::setAffectedByHover): Deleted.
2192         (WebCore::RenderStyle::setAffectedByActive): Deleted.
2193         * style/StyleRelations.cpp:
2194         (WebCore::Style::commitRelationsToRenderStyle):
2195         (WebCore::Style::commitRelations):
2196         * style/StyleRelations.h:
2197         * style/StyleSharingResolver.cpp:
2198         (WebCore::Style::SharingResolver::canShareStyleWithElement const):
2199
2200         Compare the hasFocusWithin bit instead.
2201
2202 2020-03-12  Yusuke Suzuki  <ysuzuki@apple.com>
2203
2204         Report crashed cell in jsCast in debug builds
2205         https://bugs.webkit.org/show_bug.cgi?id=209041
2206         <rdar://problem/59705631>
2207
2208         Reviewed by Mark Lam.
2209
2210         We should take JSLock when touching JSC::VM.
2211
2212         * page/MemoryRelease.cpp:
2213         (WebCore::logMemoryStatisticsAtTimeOfDeath):
2214         * page/PerformanceLogging.cpp:
2215         (WebCore::PerformanceLogging::memoryUsageStatistics):
2216
2217 2020-03-12  Cathie Chen  <cathiechen@igalia.com>
2218
2219         REGRESSION(r255957): Element with scroll-behavior:smooth isn't draggable after r255957
2220         https://bugs.webkit.org/show_bug.cgi?id=208566
2221
2222         Reviewed by Simon Fraser and Frédéric Wang.
2223
2224         To perform smooth scroll, RenderLayer::scrollRectToVisible checks the value of scroll-behavior.
2225         It starts an animated scrolling if scroll-behavior is smooth.
2226         On the other hand, the drag action would start an autoscroll if the element is scrollable.
2227         The autoscroll uses m_autoscrollTimer which is a repeating timer, when the timer fired it calls
2228         scrollRectToVisible with different positions.
2229         So if performing autoscroll on scroll-bahavior: smooth element, there are two nested animations.
2230         When timer fired, scrollRectToVisible is called, because of scroll-behavior:smooth, it starts
2231         animated scrolling not instant scrolling. Then there's the next timer fired, the previous
2232         animated scrolling would be canceled. Eventually, the element becomes un-draggable.
2233         To fix this, while performing autoscroll, scrollRectToVisible shouldn't trigger animated scrolling
2234         no matter what the value of scroll-behavior is.
2235
2236         Test: fast/events/drag-smooth-scroll-element.html
2237
2238         * rendering/RenderLayer.cpp:
2239         (WebCore::RenderLayer::scrollRectToVisible):
2240         (WebCore::RenderLayer::autoscroll):
2241         * rendering/RenderLayer.h:
2242
2243 2020-03-12  Zalan Bujtas  <zalan@apple.com>
2244
2245         RenderTreeNeedsLayoutChecker asserts with imported/w3c/web-platform-tests/css/css-position/position-absolute-crash-chrome-005.html
2246         https://bugs.webkit.org/show_bug.cgi?id=209022
2247         <rdar://problem/60390647>
2248
2249         Reviewed by Simon Fraser.
2250
2251         Fix the case when
2252         1. the block level box is no longer the containing block for its out-of-flow descendants and
2253         2. the new containing block does not get marked dirty because there's a re-layout boundary (overflow: hidden)
2254         between the old and the new containing block.
2255
2256         Test: fast/block/containing-block-for-out-of-flow-becomes-static.html
2257
2258         * rendering/RenderBlock.cpp:
2259         (WebCore::RenderBlock::removePositionedObjectsIfNeeded):
2260         (WebCore::RenderBlock::removePositionedObjects):
2261
2262 2020-03-12  Ryosuke Niwa  <rniwa@webkit.org>
2263
2264         Crash in TextManipulationController::replace
2265         https://bugs.webkit.org/show_bug.cgi?id=209021
2266
2267         Reviewed by Wenson Hsieh.
2268
2269         This patch addresses two issues that can lead to a crash in TextManipulationController::replace.
2270
2271         The biggest issue here is that commonAncestor can be a descendent of insertionPoint's containerNode.
2272         Addressed this issue by computing the first node to remove in the same traveral where commonAncestor
2273         is computed by way of remembering the very first content node (firstContentNode). This also lets us
2274         eliminate the secondary, redundant traversal to discover all the nodes to remove.
2275
2276         In addition, the set of nodes to remove could sometimes contain commonAncestor and its ancestors.
2277         This patch addresses this issue by removing all inclusive ancestors of commonAncestor from nodesToRemove.
2278
2279         * editing/TextManipulationController.cpp:
2280         (WebCore::TextManipulationController::replace):
2281
2282 2020-03-12  Per Arne Vollan  <pvollan@apple.com>
2283
2284         [macOS] _AXSApplicationAccessibilityEnabled should not be called
2285         https://bugs.webkit.org/show_bug.cgi?id=208953
2286
2287         Reviewed by Brent Fulgham.
2288
2289         The function _AXSApplicationAccessibilityEnabled and the notification kAXSApplicationAccessibilityEnabledNotification
2290         exist on macOS, but they do not have the same behavior as on iOS, and should not be used in the same way. Using this
2291         function and notification on macOS was introduced in <https://bugs.webkit.org/show_bug.cgi?id=208690>, and this patch
2292         partially reverts this behavior.
2293
2294         API test: WebKit.IsRemoteUIAppForAccessibility
2295
2296         * testing/Internals.cpp:
2297         (WebCore::Internals::isRemoteUIAppForAccessibility):
2298         * testing/Internals.h:
2299         * testing/Internals.idl:
2300         * testing/Internals.mm:
2301         (WebCore::Internals::isRemoteUIAppForAccessibility):
2302
2303 2020-03-12  Andres Gonzalez  <andresg_22@apple.com>
2304
2305         Cache the ScrollView platformWidget to avoid [WebAccessibilityObjectWrapper scrollViewParent] hitting the main thread too often.
2306         https://bugs.webkit.org/show_bug.cgi?id=209010
2307
2308         Reviewed by Chris Fleizach.
2309
2310         - [WebAccessibilityObjectWrapper scrollViewParent] is called very often
2311         and blocks the AXThread to retrieve a value from the main thread. This
2312         change caches the PlatformWidget for the corresponding ScrollView (an
2313         NSView) to avoid hitting the main thread that often.
2314         - In Addition, made the ScrollView member of AccessibilityScrollView a
2315         WeakPtr instead of a naked pointer.
2316         - Removed an unused lock from AXIsolatedObject and the const qualifier
2317         from the return value of stringAttributeValue which is unnecessary.
2318
2319         * accessibility/AccessibilityObject.h:
2320         * accessibility/AccessibilityObjectInterface.h:
2321         * accessibility/AccessibilityScrollView.cpp:
2322         (WebCore::AccessibilityScrollView::AccessibilityScrollView):
2323         (WebCore::AccessibilityScrollView::platformWidget const):
2324         (WebCore::AccessibilityScrollView::widgetForAttachmentView const):
2325         (WebCore::AccessibilityScrollView::webAreaObject const):
2326         (WebCore::AccessibilityScrollView::documentFrameView const):
2327         (WebCore::AccessibilityScrollView::parentObject const):
2328         (WebCore::AccessibilityScrollView::parentObjectIfExists const):
2329         (WebCore::AccessibilityScrollView::getScrollableAreaIfScrollable const):
2330         * accessibility/AccessibilityScrollView.h:
2331         * accessibility/isolatedtree/AXIsolatedObject.cpp:
2332         (WebCore::AXIsolatedObject::initializeAttributeData):
2333         (WebCore::AXIsolatedObject::stringAttributeValue const):
2334         (WebCore::AXIsolatedObject::platformWidget const):
2335         * accessibility/isolatedtree/AXIsolatedObject.h:
2336         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2337         (-[WebAccessibilityObjectWrapper scrollViewParent]):
2338
2339 2020-03-12  Andres Gonzalez  <andresg_22@apple.com>
2340
2341         Attributes SelectionTextMarkerRange and Start/EndTextMarker need to run on the main thread.
2342         https://bugs.webkit.org/show_bug.cgi?id=208996
2343
2344         Reviewed by Chris Fleizach.
2345
2346         Covered by existing tests.
2347
2348         Dispatch to the main thread the computation of these accessibility attributes.
2349
2350         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2351         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2352
2353 2020-03-12  Andres Gonzalez  <andresg_22@apple.com>
2354
2355         AX: Isolated tree: Crash in URL retrieval
2356         https://bugs.webkit.org/show_bug.cgi?id=208942
2357         <rdar://problem/60337588>
2358
2359         Reviewed by Chris Fleizach.
2360
2361         Test: accessibility/url-test.html
2362
2363         * accessibility/AccessibilityRenderObject.cpp:
2364         (WebCore::AccessibilityRenderObject::url const): Check for m_renderer
2365         before dereferencing and re-use the associated Node. Also fixes the last
2366         type check and downcast that were using different types.
2367
2368 2020-03-12  Alex Christensen  <achristensen@webkit.org>
2369
2370         WKWebView.hasOnlySecureContent should be correct after back/forward navigations
2371         https://bugs.webkit.org/show_bug.cgi?id=207609
2372         <rdar://problem/59371252>
2373
2374         Reviewed by Ryosuke Niwa.
2375
2376         The web process informs the UI process of insecure content loads when http resources are requested from https pages.
2377         The web process also remembers that this happened.
2378         Rather than ask the UI process during a navigation, which can sometimes get information about the wrong navigation,
2379         just use the remembered values.  We will need to do something for legacy TLS loads too, but I left that code as it is
2380         for this patch.  Another is coming soon.
2381
2382         Covered by API tests.
2383
2384         * history/CachedFrame.cpp:
2385         (WebCore::CachedFrame::setUsedLegacyTLS):
2386         (WebCore::CachedFrame::hasInsecureContent const):
2387         (WebCore::CachedFrame::setHasInsecureContent): Deleted.
2388         * history/CachedFrame.h:
2389         (WebCore::CachedFrame::hasInsecureContent const): Deleted.
2390         * loader/FrameLoader.cpp:
2391         (WebCore::FrameLoader::commitProvisionalLoad):
2392
2393 2020-03-12  Simon Fraser  <simon.fraser@apple.com>
2394
2395         REGRESSION (r257938): Some pointerevents/ios/touch-action-region tests started to fail
2396         https://bugs.webkit.org/show_bug.cgi?id=209005
2397         <rdar://problem/60337239>
2398
2399         Reviewed by Tim Horton, Wenson Hsieh.
2400
2401         We need to continue to paint event regions if there are touch-action elements.
2402
2403         Tested by existing tests.
2404
2405         * rendering/RenderLayerBacking.cpp:
2406         (WebCore::RenderLayerBacking::updateEventRegion):
2407
2408 2020-03-12  youenn fablet  <youenn@apple.com>
2409
2410         FrameLoader should own its FrameLoaderClient
2411         https://bugs.webkit.org/show_bug.cgi?id=208918
2412
2413         Reviewed by Geoffrey Garen.
2414
2415         Update Frame/FrameLoader constructors to get a UniqueRef<FrameLoaderClient>.
2416         This makes the lifetime management much clearer and allows some WebKit1/WebKit2 clean-up.
2417
2418         Covered by existing tests.
2419
2420         * loader/EmptyClients.cpp:
2421         (WebCore::pageConfigurationWithEmptyClients):
2422         * loader/EmptyFrameLoaderClient.h:
2423         * loader/FrameLoader.cpp:
2424         (WebCore::FrameLoader::FrameLoader):
2425         (WebCore::FrameLoader::~FrameLoader):
2426         (WebCore::FrameLoader::init):
2427         (WebCore::FrameLoader::initForSynthesizedDocument):
2428         (WebCore::FrameLoader::didExplicitOpen):
2429         (WebCore::FrameLoader::receivedFirstData):
2430         (WebCore::FrameLoader::finishedParsing):
2431         (WebCore::FrameLoader::loadArchive):
2432         (WebCore::FrameLoader::setOpener):
2433         (WebCore::FrameLoader::provisionalLoadStarted):
2434         (WebCore::FrameLoader::loadInSameDocument):
2435         (WebCore::FrameLoader::prepareForLoadStart):
2436         (WebCore::FrameLoader::setupForReplace):
2437         (WebCore::FrameLoader::load):
2438         (WebCore::FrameLoader::loadWithNavigationAction):
2439         (WebCore::FrameLoader::loadWithDocumentLoader):
2440         (WebCore::FrameLoader::willLoadMediaElementURL):
2441         (WebCore::FrameLoader::reloadWithOverrideEncoding):
2442         (WebCore::FrameLoader::reload):
2443         (WebCore::FrameLoader::setDocumentLoader):
2444         (WebCore::FrameLoader::commitProvisionalLoad):
2445         (WebCore::FrameLoader::transitionToCommitted):
2446         (WebCore::FrameLoader::clientRedirectCancelledOrFinished):
2447         (WebCore::FrameLoader::clientRedirected):
2448         (WebCore::FrameLoader::closeOldDataSources):
2449         (WebCore::FrameLoader::willChangeTitle):
2450         (WebCore::FrameLoader::dispatchDidFailProvisionalLoad):
2451         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
2452         (WebCore::FrameLoader::didReachLayoutMilestone):
2453         (WebCore::FrameLoader::didReachVisuallyNonEmptyState):
2454         (WebCore::FrameLoader::frameLoadCompleted):
2455         (WebCore::FrameLoader::checkLoadComplete):
2456         (WebCore::FrameLoader::userAgent const):
2457         (WebCore::FrameLoader::dispatchOnloadEvents):
2458         (WebCore::FrameLoader::detachViewsAndDocumentLoader):
2459         (WebCore::FrameLoader::receivedMainResourceError):
2460         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
2461         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
2462         (WebCore::FrameLoader::loadedResourceFromMemoryCache):
2463         (WebCore::FrameLoader::loadDifferentDocumentItem):
2464         (WebCore::FrameLoader::cancelledError const):
2465         (WebCore::FrameLoader::blockedByContentBlockerError const):
2466         (WebCore::FrameLoader::blockedError const):
2467         (WebCore::FrameLoader::blockedByContentFilterError const):
2468         (WebCore::FrameLoader::connectionProperties):
2469         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
2470         (WebCore::FrameLoader::dispatchGlobalObjectAvailableInAllWorlds):
2471         (WebCore::FrameLoader::didChangeTitle):
2472         (WebCore::FrameLoader::dispatchDidCommitLoad):
2473         (WebCore::FrameLoader::tellClientAboutPastMemoryCacheLoads):
2474         (WebCore::FrameLoader::completePageTransitionIfNeeded):
2475         * loader/FrameLoader.h:
2476         * loader/FrameLoaderClient.h:
2477         * page/Frame.cpp:
2478         (WebCore::Frame::Frame):
2479         (WebCore::Frame::create):
2480         * page/Frame.h:
2481         * page/Page.cpp:
2482         (WebCore::Page::Page):
2483         * page/PageConfiguration.cpp:
2484         (WebCore::PageConfiguration::PageConfiguration):
2485         * page/PageConfiguration.h:
2486         * workers/service/context/SWContextManager.cpp:
2487         * workers/service/context/SWContextManager.h:
2488
2489 2020-03-11  Simon Fraser  <simon.fraser@apple.com>
2490
2491         REGRESSION (r254054): finance.google.com watch list renders initially then disappears for 5+ seconds before reappearing
2492         https://bugs.webkit.org/show_bug.cgi?id=208972
2493         <rdar://problem/59727171>
2494
2495         Reviewed by Zalan Bujtas.
2496         
2497         After r254054 we could get a style change in which opacity was unchanged, but
2498         hasAutoUsedZIndex() in the style changed (because Adjuster::adjustAnimatedStyle() can set it).
2499
2500         In this case we failed to trigger layout, which means that we failed to recompute visual
2501         overflow when a layer changed from being self-painting to non-self-painting (which affects
2502         visual overflow computation and has hasAutoUsedZIndex() as input). We'd thus fail to paint some
2503         renderers because their visual overflow didn't intersect the paint dirty rect.
2504
2505         Fix by having RenderStyle::changeRequiresLayout() return true if hasAutoUsedZIndex() differs
2506         between the styles. This has minimal performance impact; rareNonInheritedDataChangeRequiresLayout()
2507         already returns true if opacity, filters and other stacking-context-affecting properties change.
2508
2509         Test: fast/overflow/animation-recompute-overflow.html
2510
2511         * rendering/RenderBox.cpp:
2512         (WebCore::RenderBox::addOverflowFromChild):
2513         (WebCore::RenderBox::addLayoutOverflow):
2514         * rendering/style/RenderStyle.cpp:
2515         (WebCore::RenderStyle::changeRequiresLayout const):
2516
2517 2020-03-12  Daniel Bates  <dabates@apple.com>
2518
2519         FocusController::setFocusedElement() should tell client of refocused element
2520         https://bugs.webkit.org/show_bug.cgi?id=208880
2521
2522         Reviewed by Wenson Hsieh.
2523
2524         If the specified new focus element is non-nullptr and is already focused then tell the client
2525         that the element was re-focused so that it may update its input state, if needed. On iOS, this
2526         lets the UI process evaluate again whether to start an input session (i.e. bring up the keyboard),
2527         which may have been disallowed when the element was originally focused (say, it was programmatically
2528         focused and there was no hardware keyboard attached).
2529
2530         * page/FocusController.cpp:
2531         (WebCore::FocusController::setFocusedElement):
2532
2533 2020-03-12  Rob Buis  <rbuis@igalia.com>
2534
2535         Implement wildcard behavior for Cross-Origin-Expose-Headers
2536         https://bugs.webkit.org/show_bug.cgi?id=208800
2537
2538         Reviewed by Youenn Fablet.
2539
2540         Implement wildcard behavior for Cross-Origin-Expose-Headers [1] while also
2541         checking for credentials mode.
2542
2543         Test: imported/w3c/web-platform-tests/xhr/cors-expose-star.sub.any.html
2544
2545         [1] https://fetch.spec.whatwg.org/#ref-for-concept-response-cors-exposed-header-name-list%E2%91%A2
2546
2547         * Modules/fetch/FetchResponse.cpp:
2548         (WebCore::FetchResponse::create):
2549         (WebCore::FetchResponse::BodyLoader::didReceiveResponse):
2550         (WebCore::FetchResponse::BodyLoader::start):
2551         * Modules/fetch/FetchResponse.h:
2552         * loader/DocumentThreadableLoader.cpp:
2553         (WebCore::DocumentThreadableLoader::didReceiveResponse):
2554         (WebCore::DocumentThreadableLoader::didFinishLoading):
2555         * platform/network/ResourceResponseBase.cpp:
2556         (WebCore::ResourceResponseBase::filter):
2557         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting):
2558         * platform/network/ResourceResponseBase.h:
2559
2560 2020-03-12  youenn fablet  <youenn@apple.com>
2561
2562         Remove no longer used code in LibWebRTCMediaEndpoint to handle remote streams
2563         https://bugs.webkit.org/show_bug.cgi?id=208919
2564
2565         Reviewed by Eric Carlson.
2566
2567         These stream APIs are legacy now and not useful anymore.
2568         Stop implementing the corresponding callbacks and remove related code.
2569         Coverd by existing tests.
2570
2571         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2572         (WebCore::LibWebRTCMediaEndpoint::addRemoteStream): Deleted.
2573         (WebCore::LibWebRTCMediaEndpoint::addRemoteTrack): Deleted.
2574         (WebCore::LibWebRTCMediaEndpoint::OnAddStream): Deleted.
2575         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2576
2577 2020-03-12  Pavel Feldman  <pavel.feldman@gmail.com>
2578
2579         [Curl] sort out MS vs Seconds confusion in Cookies
2580         https://bugs.webkit.org/show_bug.cgi?id=208964
2581
2582         Reviewed by Don Olmstead.
2583
2584         Making sure curl parser is storing expires using millis in the code. Using consistent time
2585         functions around the changed code.
2586  
2587         * platform/network/curl/CookieJarDB.cpp:
2588         (WebCore::CookieJarDB::searchCookies):
2589         (WebCore::CookieJarDB::getAllCookies):
2590         (WebCore::CookieJarDB::setCookie):
2591         * platform/network/curl/CookieUtil.cpp:
2592         (WebCore::CookieUtil::parseExpiresMS):
2593         (WebCore::CookieUtil::parseCookieAttributes):
2594
2595 2020-03-12  youenn fablet  <youenn@apple.com>
2596
2597         Move AudioSession interruption listener code to AudioSession
2598         https://bugs.webkit.org/show_bug.cgi?id=208714
2599
2600         Reviewed by Jer Noble.
2601
2602         Move AudioSession interruption detection code from MediaSessionManagerIOS helper to AudioSessionIOS.
2603         Add interruption observer capabilities to AudioSession and make MediaSessionManagerIOS an observer of it.
2604         Manually tested.
2605
2606         * platform/audio/AudioSession.cpp:
2607         (WebCore::AudioSession::addInterruptionObserver):
2608         (WebCore::AudioSession::removeInterruptionObserver):
2609         (WebCore::AudioSession::beginInterruption):
2610         (WebCore::AudioSession::endInterruption):
2611         * platform/audio/AudioSession.h:
2612         * platform/audio/ios/AudioSessionIOS.mm:
2613         (-[WebInterruptionObserverHelper initWithCallback:]):
2614         (-[WebInterruptionObserverHelper dealloc]):
2615         (-[WebInterruptionObserverHelper clearCallback]):
2616         (-[WebInterruptionObserverHelper interruption:]):
2617         (WebCore::AudioSessionPrivate::AudioSessionPrivate):
2618         (WebCore::AudioSessionPrivate::~AudioSessionPrivate):
2619         (WebCore::AudioSession::addInterruptionObserver):
2620         (WebCore::AudioSession::removeInterruptionObserver):
2621         (WebCore::AudioSession::beginInterruption):
2622         (WebCore::AudioSession::endInterruption):
2623         * platform/audio/ios/MediaSessionHelperIOS.h:
2624         * platform/audio/ios/MediaSessionHelperIOS.mm:
2625         (-[WebMediaSessionHelper initWithCallback:]):
2626         * platform/audio/ios/MediaSessionManagerIOS.h:
2627         * platform/audio/ios/MediaSessionManagerIOS.mm:
2628         (WebCore::MediaSessionManageriOS::MediaSessionManageriOS):
2629         (WebCore::MediaSessionManageriOS::~MediaSessionManageriOS):
2630         (WebCore::MediaSessionManageriOS::providePresentingApplicationPIDIfNecessary):
2631
2632 2020-03-12  Antti Koivisto  <antti@apple.com>
2633
2634         Accurate style invalidation for user action pseudo classes
2635         https://bugs.webkit.org/show_bug.cgi?id=208859
2636         <rdar://problem/55196888>
2637
2638         Reviewed by Zalan Bujtas.
2639
2640         Currently :hover, :focus, :focus-within and :active lack fine grained invalidation using
2641         rule sets like we do with class and attribute selectors.
2642
2643         This can be added easily following the same pattern.
2644
2645         Tests: fast/selectors/style-invalidation-hover-change-descendants.html
2646                fast/selectors/style-invalidation-hover-change-siblings.html
2647                fast/selectors/style-invalidation-focus-change-descendants.html
2648                fast/selectors/style-invalidation-focus-change-siblings.html
2649                fast/selectors/style-invalidation-focus-within-change-descendants.html
2650                fast/selectors/style-invalidation-focus-within-change-siblings.html
2651
2652         * Sources.txt:
2653         * WebCore.xcodeproj/project.pbxproj:
2654         * dom/Element.cpp:
2655         (WebCore::Element::setActive):
2656         (WebCore::Element::setFocus):
2657         (WebCore::Element::setHasFocusWithin):
2658         (WebCore::Element::setHovered):
2659
2660         Use PseudoClassChangeInvalidation.
2661
2662         * dom/Element.h:
2663         (WebCore::Element::setHasFocusWithin): Deleted.
2664         * page/FrameViewLayoutContext.cpp:
2665         (WebCore::RenderTreeNeedsLayoutChecker::~RenderTreeNeedsLayoutChecker):
2666         * style/PseudoClassChangeInvalidation.cpp: Added.
2667         (WebCore::Style::PseudoClassChangeInvalidation::computeInvalidation):
2668
2669         Compute invalidation rule set for a pseudo class change.
2670
2671         (WebCore::Style::PseudoClassChangeInvalidation::invalidateStyleWithRuleSets):
2672         * style/PseudoClassChangeInvalidation.h: Added.
2673         (WebCore::Style::PseudoClassChangeInvalidation::PseudoClassChangeInvalidation):
2674         (WebCore::Style::PseudoClassChangeInvalidation::~PseudoClassChangeInvalidation):
2675         * style/RuleFeature.cpp:
2676         (WebCore::Style::RuleFeatureSet::recursivelyCollectFeaturesFromSelector):
2677         (WebCore::Style::RuleFeatureSet::collectFeatures):
2678
2679         Collect pseudo class features, similar to classes/attributes.
2680
2681         (WebCore::Style::RuleFeatureSet::add):
2682         (WebCore::Style::RuleFeatureSet::clear):
2683         (WebCore::Style::RuleFeatureSet::shrinkToFit):
2684         * style/RuleFeature.h:
2685         * style/StyleScopeRuleSets.cpp:
2686         (WebCore::Style::ScopeRuleSets::collectFeatures const):
2687         (WebCore::Style::ensureInvalidationRuleSets):
2688
2689         Make more generic to allow enum key.
2690
2691         (WebCore::Style::ScopeRuleSets::pseudoClassInvalidationRuleSets const):
2692
2693         Create pseudo class invalidation ruleset.
2694
2695         * style/StyleScopeRuleSets.h:
2696
2697 2020-03-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
2698
2699         [GPU Process] GraphicsContextStateChange must accumulate fill and stroke fields as single properties
2700         https://bugs.webkit.org/show_bug.cgi?id=208971
2701
2702         Reviewed by Simon Fraser.
2703
2704         Setting the fill or the stroke should set one field: color, gradient or
2705         pattern. When detecting a change any of them, accumulate() should copy
2706         all of the fields from the source state to the destination state.
2707
2708         * platform/graphics/GraphicsContext.cpp:
2709         (WebCore::GraphicsContextStateChange::accumulate):
2710         * platform/graphics/GraphicsContext.h:
2711
2712 2020-03-11  Antoine Quint  <graouts@webkit.org>
2713
2714         AnimationTimeline should not have multiple HashMaps with raw Element* keys
2715         https://bugs.webkit.org/show_bug.cgi?id=208079
2716         <rdar://problem/59687906>
2717
2718         Reviewed by Ryosuke Niwa.
2719
2720         We introduce a new ElementAnimationRareData class that holds the KeyframeEffectStack previously owned by ElementRareData as well as a few maps and lists
2721         owned by AnimationTimeline which would use raw Element pointers as keys. Specifically, this is what changed:
2722
2723         - AnimationTimeline::m_elementToRunningCSSTransitionByCSSPropertyID → ElementAnimationRareData::runningTransitionByProperty()
2724         - AnimationTimeline::m_elementToCompletedCSSTransitionByCSSPropertyID → ElementAnimationRareData::completedTransitionByProperty()
2725         - AnimationTimeline::m_elementToCSSAnimationsCreatedByMarkupMap → ElementAnimationRareData::animationsCreatedByMarkup()
2726         - AnimationTimeline::m_elementToCSSTransitionsMap → ElementAnimationRareData::transitions()
2727         - AnimationTimeline::m_elementToCSSAnimationsMap → ElementAnimationRareData::cssAnimations()
2728         - AnimationTimeline::m_elementToAnimationsMap → ElementAnimationRareData::webAnimations()
2729
2730         For convenience, these new members are exposed via Element directly.
2731
2732         No change in behavior, so no new tests.
2733
2734         * Headers.cmake:
2735         * Sources.txt:
2736         * WebCore.xcodeproj/project.pbxproj:
2737         * animation/AnimationPlaybackEventInit.h:
2738         * animation/AnimationTimeline.cpp:
2739         (WebCore::AnimationTimeline::animationWasAddedToElement):
2740         (WebCore::removeCSSTransitionFromMap):
2741         (WebCore::AnimationTimeline::animationWasRemovedFromElement):
2742         (WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement):
2743         (WebCore::AnimationTimeline::animationsForElement const):
2744         (WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup):
2745         (WebCore::AnimationTimeline::willDestroyRendererForElement):
2746         (WebCore::AnimationTimeline::elementWasRemoved):
2747         (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement):
2748         (WebCore::AnimationTimeline::updateCSSAnimationsForElement):
2749         (WebCore::propertyInStyleMatchesValueForTransitionInMap):
2750         (WebCore::AnimationTimeline::updateCSSTransitionsForElementAndProperty):
2751         (WebCore::AnimationTimeline::updateCSSTransitionsForElement):
2752         (WebCore::removeAnimationFromMapForElement): Deleted.
2753         (WebCore::AnimationTimeline::ensureRunningTransitionsByProperty): Deleted.
2754         * animation/AnimationTimeline.h:
2755         * animation/ComputedEffectTiming.h:
2756         * animation/DocumentTimeline.cpp:
2757         (WebCore::DocumentTimeline::transitionDidComplete):
2758         * animation/ElementAnimationRareData.cpp: Copied from Source/WebCore/animation/ComputedEffectTiming.h.
2759         (WebCore::ElementAnimationRareData::ElementAnimationRareData):
2760         (WebCore::ElementAnimationRareData::~ElementAnimationRareData):
2761         (WebCore::ElementAnimationRareData::ensureKeyframeEffectStack):
2762         * animation/ElementAnimationRareData.h: Added.
2763         (WebCore::ElementAnimationRareData::keyframeEffectStack):
2764         (WebCore::ElementAnimationRareData::webAnimations):
2765         (WebCore::ElementAnimationRareData::cssAnimations):
2766         (WebCore::ElementAnimationRareData::transitions):
2767         (WebCore::ElementAnimationRareData::animationsCreatedByMarkup):
2768         (WebCore::ElementAnimationRareData::setAnimationsCreatedByMarkup):
2769         (WebCore::ElementAnimationRareData::completedTransitionByProperty):
2770         (WebCore::ElementAnimationRareData::runningTransitionsByProperty):
2771         * animation/KeyframeEffect.h:
2772         * animation/OptionalEffectTiming.h:
2773         * animation/WebAnimation.h:
2774         * animation/WebAnimationTypes.h: Copied from Source/WebCore/animation/WebAnimationUtilities.h.
2775         (WebCore::WebAnimationsMarkableDoubleTraits::isEmptyValue):
2776         (WebCore::WebAnimationsMarkableDoubleTraits::emptyValue):
2777         * animation/WebAnimationUtilities.h:
2778         (WebCore::WebAnimationsMarkableDoubleTraits::isEmptyValue): Deleted.
2779         (WebCore::WebAnimationsMarkableDoubleTraits::emptyValue): Deleted.
2780         * dom/Element.cpp:
2781         (WebCore::Element::animationRareData const):
2782         (WebCore::Element::ensureAnimationRareData):
2783         (WebCore::Element::keyframeEffectStack const):
2784         (WebCore::Element::ensureKeyframeEffectStack):
2785         (WebCore::Element::hasKeyframeEffects const):
2786         (WebCore::Element::webAnimations):
2787         (WebCore::Element::cssAnimations):
2788         (WebCore::Element::transitions):
2789         (WebCore::Element::animationsCreatedByMarkup):
2790         (WebCore::Element::setAnimationsCreatedByMarkup):
2791         (WebCore::Element::completedTransitionByProperty):
2792         (WebCore::Element::runningTransitionsByProperty):
2793         * dom/Element.h:
2794         * dom/ElementRareData.h:
2795         (WebCore::ElementRareData::elementAnimationRareData):
2796         (WebCore::ElementRareData::useTypes const):
2797         (WebCore::ElementRareData::ensureAnimationRareData):
2798         (WebCore::ElementRareData::keyframeEffectStack): Deleted.
2799         (WebCore::ElementRareData::setKeyframeEffectStack): Deleted.
2800         * dom/Node.cpp:
2801         (WebCore::stringForRareDataUseType):
2802         * dom/NodeRareData.h:
2803
2804 2020-03-11  Jer Noble  <jer.noble@apple.com>
2805
2806         Adopt AVSampleBufferVideoOutput
2807         https://bugs.webkit.org/show_bug.cgi?id=208951
2808
2809         Reviewed by Eric Carlson.
2810
2811         Adopt AVSampleBufferVideoOutput, used for extracting decoded samples from an AVSampleBufferDisplayLayer.
2812
2813         Rather than use a separate decompression session when we need to, e.g., paint samples into WebGL, we will
2814         add a AVSBVO to the AVSBDL and use it to extract CVPixelBuffers when asked.
2815
2816         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2817         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2818         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastPixelBuffer):
2819         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::acceleratedRenderingStateChanged):
2820         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
2821         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::isVideoOutputAvailable const):
2822
2823 2020-03-11  Andres Gonzalez  <andresg_22@apple.com>
2824
2825         Removed unused textElements member from AccessibilityText structure.
2826         https://bugs.webkit.org/show_bug.cgi?id=208967
2827
2828         Reviewed by Chris Fleizach.
2829
2830         The textElements member of AccessibilityText is not used by any client
2831         and its computation is causing crashes in IsolatedTree mode. So this
2832         change removes it.
2833
2834         * accessibility/AccessibilityNodeObject.cpp:
2835         (WebCore::AccessibilityNodeObject::titleElementText const):
2836         (WebCore::AccessibilityNodeObject::ariaLabeledByText const):
2837         * accessibility/AccessibilityObject.h:
2838         (WebCore::AccessibilityText::AccessibilityText):
2839         * accessibility/isolatedtree/AXIsolatedObject.cpp:
2840         (WebCore::AXIsolatedObject::initializeAttributeData):
2841         (WebCore::AXIsolatedObject::accessibilityText const):
2842         * accessibility/isolatedtree/AXIsolatedObject.h:
2843
2844 2020-03-11  Don Olmstead  <don.olmstead@sony.com>
2845
2846         Non-unified build fixes early March 2020 edition Take 2
2847         https://bugs.webkit.org/show_bug.cgi?id=208968
2848
2849         Unreviewed build fix.
2850
2851         * editing/TextIterator.cpp:
2852         * editing/TextIterator.h:
2853         * editing/TextManipulationController.cpp:
2854         * editing/VisibleSelection.cpp:
2855         * editing/VisibleUnits.cpp:
2856
2857 2020-03-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2858
2859         Large single select elements are incorrectly sized
2860         https://bugs.webkit.org/show_bug.cgi?id=208966
2861
2862         Reviewed by Tim Horton.
2863
2864         Adjusts several size and margin values for menu lists (i.e. the default appearance of non-multiple select
2865         elements) to reflect recent changes in macOS. Additionally, adds a workaround for <rdar://problem/60350699>,
2866         which causes text inside many form controls (including select buttons) to be incorrectly sized.
2867
2868         * platform/mac/ThemeMac.h:
2869         * platform/mac/ThemeMac.mm:
2870         (WebCore::ThemeMac::systemFontSizeFor):
2871         (WebCore::ThemeMac::controlFont const):
2872         * rendering/RenderThemeMac.mm:
2873
2874         Replace calls to +[NSFont systemFontSizeForControlSize:] with `ThemeMac::systemFontSizeFor(NSControlSize size)`
2875         in order to work around <rdar://problem/60350699>.
2876
2877         (WebCore::RenderThemeMac::updateCachedSystemFontDescription const):
2878         (WebCore::RenderThemeMac::setFontFromControlSize const):
2879         (WebCore::RenderThemeMac::controlSizeForSystemFont const):
2880         (WebCore::RenderThemeMac::popupButtonMargins const):
2881         (WebCore::menuListButtonSizes):
2882
2883 2020-03-11  Canhai Chen  <canhai_chen@apple.com>
2884
2885         AX: accessibilityReplaceRange:withText: doesn't post an AXValueChanged notification like when typing with kb
2886         https://bugs.webkit.org/show_bug.cgi?id=208332
2887         <rdar://problem/58489685>
2888
2889         Reviewed by Chris Fleizach.
2890
2891         When accessibilityReplaceRange:withText: is called to insert or replace text, there should be a
2892         AXValueChanged notification posted with the correct user info to notify the AX client that the text value
2893         has been changed with detailed info about the change.
2894
2895         Post a notification in Editor::replaceSelectionWithFragment for EditAction::Insert edit type 
2896         with replaced text and selection.
2897
2898         Add a new test for text replacement value change notification in editable div, text input, and textarea,
2899         including direct text insertion and replace-and-insert.
2900
2901         Test: accessibility/mac/replace-text-with-range-value-change-notification.html
2902
2903         * editing/Editor.cpp:
2904         (WebCore::Editor::replaceSelectionWithFragment):
2905         * editing/ReplaceSelectionCommand.h:
2906         (WebCore::ReplaceSelectionCommand::documentFragmentPlainText const):
2907
2908 2020-03-11  Andres Gonzalez  <andresg_22@apple.com>
2909
2910         AX: Isolated tree: enabling secondary thread for the wrong clients
2911         https://bugs.webkit.org/show_bug.cgi?id=208950
2912
2913         Reviewed by Chris Fleizach.
2914
2915         Removed incorrect call to _AXUIElementUseSecondaryAXThread and wrap it
2916         in initializeSecondaryAXThread with the appropriate checks.
2917
2918         * accessibility/AXObjectCache.cpp:
2919         (WebCore::AXObjectCache::isolatedTreeFocusedObject):
2920         (WebCore::AXObjectCache::initializeSecondaryAXThread):
2921         (WebCore::AXObjectCache::isolatedTreeRootObject):
2922         * accessibility/AXObjectCache.h:
2923
2924 2020-03-11  Jer Noble  <jer.noble@apple.com>
2925
2926         [EME] Issue an "encrypted" event when a new encrypted initialization segment is encountered
2927         https://bugs.webkit.org/show_bug.cgi?id=208923
2928
2929         Reviewed by Eric Carlson.
2930
2931         When AVStreamDataParser encounters an initialization segment indicating encrypted content, it
2932         will issue a -streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID: message
2933         to its delegate. If the parser is already associated with an AVContentKeySession, it will instead
2934         allow the session to handle the initialization segment and the delagete method will not be called.
2935
2936         When the latter situation occurs, we can detect that the -didProvideRequest callback did not
2937         occur due to the client calling MediaKeySession.generateRequest() and therefore must have been
2938         due to parsing an encrypted segment. In response, store the request in a list of "unexpected"
2939         requests to be checked the next time a MediaKeySession tries to generateRequest(). Then, we will
2940         pass the initalizationData and type to HTMLMediaElement through a new client interface, where it
2941         will use that initializationData to issue an "encrypted" event. If the client passes that same
2942         initializationData back into MediaKeySession, the "unexpected" request can be found, and re-used.
2943
2944         Drive-by fixes: Added a ton of debug logging messages to the CDMPrivate classes.
2945
2946         * Modules/encryptedmedia/CDM.cpp:
2947         (WebCore::CDM::CDM):
2948         * Modules/encryptedmedia/CDM.h:
2949         * Modules/encryptedmedia/CDMClient.h:
2950         * Modules/encryptedmedia/MediaKeySession.cpp:
2951         (WebCore::MediaKeySession::create):
2952         (WebCore::MediaKeySession::MediaKeySession):
2953         * Modules/encryptedmedia/MediaKeySession.h:
2954         * Modules/encryptedmedia/MediaKeySystemAccess.cpp:
2955         (WebCore::MediaKeySystemAccess::createMediaKeys):
2956         * Modules/encryptedmedia/MediaKeySystemAccess.h:
2957         * Modules/encryptedmedia/MediaKeySystemAccess.idl:
2958         * Modules/encryptedmedia/MediaKeys.cpp:
2959         (WebCore::MediaKeys::MediaKeys):
2960         (WebCore::MediaKeys::createSession):
2961         (WebCore::MediaKeys::setServerCertificate):
2962         (WebCore::MediaKeys::attachCDMClient):
2963         (WebCore::MediaKeys::detachCDMClient):
2964         (WebCore::MediaKeys::attemptToResumePlaybackOnClients):
2965         (WebCore::MediaKeys::unrequestedInitializationDataReceived):
2966         (WebCore::MediaKeys::nextChildIdentifier const):
2967         * Modules/encryptedmedia/MediaKeys.h:
2968         (WebCore::MediaKeys::create): Deleted.
2969         (WebCore::MediaKeys::cdmInstance): Deleted.
2970         (WebCore::MediaKeys::cdmInstance const): Deleted.
2971         * Modules/encryptedmedia/MediaKeys.idl:
2972         * WebCore.xcodeproj/project.pbxproj:
2973         * html/HTMLMediaElement.cpp:
2974         (WebCore::HTMLMediaElement::cdmClientUnrequestedInitializationDataReceived):
2975         * html/HTMLMediaElement.h:
2976         * platform/encryptedmedia/CDMFactory.h:
2977         * platform/encryptedmedia/CDMInstance.h:
2978         (WebCore::CDMInstance::setClient):
2979         (WebCore::CDMInstance::clearClient):
2980         (WebCore::CDMInstance::setLogger):
2981         * platform/encryptedmedia/CDMInstanceSession.h:
2982         (WebCore::CDMInstanceSession::setLogger):
2983         (WebCore::CDMInstanceSession::setClient):
2984         * platform/encryptedmedia/CDMPrivate.h:
2985         (WebCore::CDMPrivate::setLogger):
2986         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
2987         (WebCore::logChannel):
2988         (WebCore::CDMPrivateFairPlayStreaming::setLogger):
2989         (WebCore::CDMPrivateFairPlayStreaming::supportsConfiguration const):
2990         * platform/graphics/avfoundation/CDMFairPlayStreaming.h:
2991         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
2992         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2993         (WebCore::logChannel):
2994         (WebCore::initTypeForRequest):
2995         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setLogger):
2996         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::takeUnexpectedKeyRequestForInitializationData):
2997         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setServerCertificate):
2998         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setStorageDirectory):
2999         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setClient):
3000         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::clearClient):
3001         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
3002         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequests):
3003         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRenewingRequest):
3004         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvidePersistableRequest):
3005         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
3006         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestDidSucceed):
3007         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::shouldRetryRequestForReason):
3008         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::groupSessionIdentifierChanged):
3009         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionForRequest const):
3010         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::setLogger):
3011         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestLicense):
3012         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
3013         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::loadSession):
3014         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::closeSession):
3015         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData):
3016         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::setClient):
3017         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::hasRequest const):
3018
3019 2020-03-11  Jiewen Tan  <jiewen_tan@apple.com>
3020
3021         [WebAuthn] Formalize the Keychain schema
3022         https://bugs.webkit.org/show_bug.cgi?id=183533
3023         <rdar://problem/43347926>
3024
3025         Reviewed by Brent Fulgham.
3026
3027         Covered by new test contents within existing files.
3028
3029         * Modules/webauthn/AuthenticatorAssertionResponse.cpp:
3030         (WebCore::AuthenticatorAssertionResponse::create):
3031         (WebCore::AuthenticatorAssertionResponse::AuthenticatorAssertionResponse):
3032         * Modules/webauthn/AuthenticatorAssertionResponse.h:
3033         Modifies the constructors to accept userEntity.name.
3034
3035         * Modules/webauthn/cbor/CBORValue.h:
3036         Adds a FIXME.
3037
3038         * testing/MockWebAuthenticationConfiguration.h:
3039         (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::encode const):
3040         (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::decode):
3041         * testing/MockWebAuthenticationConfiguration.idl:
3042         Modifies the test infra to use Credential ID as the unique identifier for a credential instead of
3043         the original combination of RP ID and user handle.
3044
3045 2020-03-11  Daniel Bates  <dabates@apple.com>
3046
3047         REGRESSION (r257502): HitTestLocation::HitTestLocation(const FloatPoint&, const FloatQuad&) should set m_isRectBased to true
3048         https://bugs.webkit.org/show_bug.cgi?id=208947
3049
3050         Reviewed by Wenson Hsieh.
3051
3052         Partial revert of r257502. I accidentally removed initialization of m_isRectBased when refactoring
3053         the code in HitTestLocation::HitTestLocation(const FloatPoint&, const FloatQuad&). Revert this to
3054         be faithful to the code before my change.
3055
3056         * rendering/HitTestLocation.cpp:
3057
3058 2020-03-11  Myles C. Maxfield  <mmaxfield@apple.com>
3059
3060         icloud.com Notes text in titles and headings is distorted
3061         https://bugs.webkit.org/show_bug.cgi?id=208908
3062         <rdar://problem/58874371>
3063
3064         Reviewed by Zalan Bujtas.
3065
3066         icloud.com Notes determines if a font has finished loading by measuring it repeatedly.
3067         Depending on the state of the page, we may slice the text differently in different
3068         circumstances. These slices are all supposed to sum together equivalently, but
3069         floating point precision may cause the results to be slightly off.
3070
3071         WidthIterator::applyFontTransforms() was summing a large list of numbers, and then
3072         subtracting the same large list of numbers. A more robust design would be to sum
3073         it twice, and then subtract the two sums.
3074
3075         Test: fast/text/shaping-width-precision.html
3076
3077         * platform/graphics/WidthIterator.cpp:
3078         (WebCore::WidthIterator::applyFontTransforms):
3079
3080 2020-03-11  Zalan Bujtas  <zalan@apple.com>
3081
3082         SVG filter triggers unstable layout.
3083         https://bugs.webkit.org/show_bug.cgi?id=207444
3084         rdar://problem/59297004
3085
3086         Reviewed by Simon Fraser.
3087
3088         SVG filter code marks DOM nodes dirty and schedules style recalc outside of the SVG root
3089         while in layout. This could lead to unstable layout and cause battery drain.
3090         (See webkit.org/b/208903)
3091
3092         * rendering/RenderLayer.cpp: Remove filterNeedsRepaint(). It's a dangerously misleading name and should
3093         not be part of RenderLayer.
3094         (WebCore::RenderLayer::calculateClipRects const):
3095         * rendering/RenderLayer.h:
3096         * rendering/RenderLayerFilters.cpp:
3097         (WebCore::RenderLayerFilters::notifyFinished):
3098         * rendering/svg/RenderSVGResourceContainer.cpp:
3099         (WebCore::RenderSVGResourceContainer::markAllClientsForInvalidation):
3100         (WebCore::RenderSVGResourceContainer::markAllClientLayersForInvalidation):
3101
3102 2020-03-11  Antoine Quint  <graouts@webkit.org>
3103
3104         [Mac wk2 Release] imported/w3c/web-platform-tests/web-animations/timing-model/animations/updating-the-finished-state.html flaky fail
3105         https://bugs.webkit.org/show_bug.cgi?id=206746
3106         <rdar://problem/58867580>
3107
3108         Reviewed by Dean Jackson.
3109
3110         Because we could end up in situation where localTime was very marginally smaller than endTime inside of WebAnimation::play(), we would end up
3111         with an unresolved hold time and we would return before calling WebAnimation::timingDidChange() and thus scheduling an animation update from
3112         the timeline because we'd assume it was paused. As a result, the animation would never end and the test would wait for a "finish" event which
3113         would never come.
3114
3115         We now account for an epsilon value when comparing times to account for such situations.
3116
3117         * animation/WebAnimation.cpp:
3118         (WebCore::WebAnimation::play):
3119
3120 2020-03-11  Chris Dumez  <cdumez@apple.com>
3121
3122         Defer async scripts until DOMContentLoaded or first paint, whichever comes first
3123         https://bugs.webkit.org/show_bug.cgi?id=208896
3124
3125         Reviewed by Darin Adler.
3126
3127         Defer async scripts until DOMContentLoaded or first paint, whichever comes first. In
3128         Bug 207698, we deferred them until DOMContentLoaded, as a first-paint optimization.
3129         However, this seems overly aggressive on pages like wikipedia and it is sufficient
3130         to defer those scripts until first-paint to get the performance win.
3131
3132         * dom/Document.cpp:
3133         (WebCore::Document::shouldDeferAsynchronousScriptsUntilParsingFinishes const):
3134         * page/Settings.yaml:
3135
3136 2020-03-11  Jack Lee  <shihchieh_lee@apple.com>
3137
3138         Consolidate detachment of document timeline into Document::commonTeardown.
3139         https://bugs.webkit.org/show_bug.cgi?id=208786
3140         <rdar://problem/59936716>
3141
3142         Reviewed by Ryosuke Niwa.
3143
3144         Move detachment of DocumentTimeline to Document::commonTeardown(). 
3145
3146         No new tests. Covered by existing document tests.
3147
3148         * dom/Document.cpp:
3149         (WebCore::Document::removedLastRef):
3150         (WebCore::Document::commonTeardown):
3151         (WebCore::Document::prepareForDestruction):
3152
3153 2020-03-11  Commit Queue  <commit-queue@webkit.org>
3154
3155         Unreviewed, reverting r258263.
3156         https://bugs.webkit.org/show_bug.cgi?id=208922
3157
3158         it is breaking internal builds (Requested by youenn on
3159         #webkit).
3160
3161         Reverted changeset:
3162
3163         "Move AudioSession interruption listener code to AudioSession"
3164         https://bugs.webkit.org/show_bug.cgi?id=208714
3165         https://trac.webkit.org/changeset/258263
3166
3167 2020-03-11  youenn fablet  <youenn@apple.com>
3168
3169         Move AudioSession interruption listener code to AudioSession
3170         https://bugs.webkit.org/show_bug.cgi?id=208714
3171
3172         Reviewed by Jer Noble.
3173
3174         Move AudioSession interruption detection code from MediaSessionManagerIOS helper to AudioSessionIOS.
3175         Add interruption observer capabilities to AudioSession and make MediaSessionManagerIOS an observer of it.
3176         Manually tested.
3177
3178         * platform/audio/AudioSession.cpp:
3179         (WebCore::AudioSession::addInterruptionObserver):
3180         (WebCore::AudioSession::removeInterruptionObserver):
3181         (WebCore::AudioSession::beginInterruption):
3182         (WebCore::AudioSession::endInterruption):
3183         * platform/audio/AudioSession.h:
3184         * platform/audio/ios/AudioSessionIOS.mm:
3185         (-[WebInterruptionObserverHelper initWithCallback:]):
3186         (-[WebInterruptionObserverHelper dealloc]):
3187         (-[WebInterruptionObserverHelper clearCallback]):
3188         (-[WebInterruptionObserverHelper interruption:]):
3189         (WebCore::AudioSessionPrivate::AudioSessionPrivate):
3190         (WebCore::AudioSessionPrivate::~AudioSessionPrivate):
3191         (WebCore::AudioSession::addInterruptionObserver):
3192         (WebCore::AudioSession::removeInterruptionObserver):
3193         (WebCore::AudioSession::beginInterruption):
3194         (WebCore::AudioSession::endInterruption):
3195         * platform/audio/ios/MediaSessionHelperIOS.h:
3196         * platform/audio/ios/MediaSessionHelperIOS.mm:
3197         (-[WebMediaSessionHelper initWithCallback:]):
3198         * platform/audio/ios/MediaSessionManagerIOS.h:
3199         * platform/audio/ios/MediaSessionManagerIOS.mm:
3200         (WebCore::MediaSessionManageriOS::MediaSessionManageriOS):
3201         (WebCore::MediaSessionManageriOS::~MediaSessionManageriOS):
3202         (WebCore::MediaSessionManageriOS::providePresentingApplicationPIDIfNecessary):
3203
3204 2020-03-11  Jack Lee  <shihchieh_lee@apple.com>
3205
3206         Crash in KeyframeEffect::getAnimatedStyle
3207         https://bugs.webkit.org/show_bug.cgi?id=208318
3208         <rdar://problem/59848234>
3209
3210         Reviewed by Antoine Quint.
3211
3212         Quit getAnimatedStyle if element is rendererless.
3213
3214         Test: fast/animation/keyframe-rendererless-element-crash.html
3215
3216         * animation/KeyframeEffect.cpp:
3217         (WebCore::KeyframeEffect::getAnimatedStyle):
3218
3219 2020-03-11  Youenn Fablet  <youenn@apple.com>
3220
3221         [iOS] Unskip fast/mediastream tests
3222         https://bugs.webkit.org/show_bug.cgi?id=208636
3223
3224         Reviewed by Eric Carlson.
3225
3226         Add label to the settings so that we correctly send this information back to WebProcess.
3227         Covered by existing tests.
3228
3229         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3230         (WebCore::AVVideoCaptureSource::settings):
3231         * platform/mock/MockRealtimeAudioSource.cpp:
3232         (WebCore::MockRealtimeAudioSource::settings):
3233         * platform/mock/MockRealtimeVideoSource.cpp:
3234         (WebCore::MockRealtimeVideoSource::settings):
3235
3236 2020-03-10  Tomoki Imai  <Tomoki.Imai@sony.com>
3237
3238         [OpenSSL] Implement WebCrypto APIs for AES-CTR and AES-KW
3239         https://bugs.webkit.org/show_bug.cgi?id=208186
3240
3241         Reviewed by Fujii Hironori.
3242
3243         Added WebCrypto implementations for the following algorithms with OpenSSL.
3244         - AES-CTR
3245         - AES-KW
3246
3247         Enabled WebCrypto LayoutTests for AES-CTR and AES-KW.
3248
3249         * crypto/openssl/CryptoAlgorithmAES_CTROpenSSL.cpp:
3250         (WebCore::aesAlgorithm): Added. Helper function to select which AES-CTR algorithm to be used by checking key size.
3251         (WebCore::crypt): Added. Helper function shared by platformEncrypt/platformDecrypt.
3252         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt): Implemented.
3253         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt): Implemented.
3254         * crypto/openssl/CryptoAlgorithmAES_KWOpenSSL.cpp:
3255         (WebCore::aesAlgorithm): Added. Helper function to select which AES-KW algorithm to be used by checking key size.
3256         (WebCore::cryptWrapKey):  Added. Helper function for platformWrapKey.
3257         (WebCore::cryptUnwrapKey): Added. Helper function for platformUnwrapKey.
3258         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey): Implemented.
3259         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey): Implemented.
3260         * crypto/openssl/CryptoAlgorithmRegistryOpenSSL.cpp:
3261         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Registered CryptoAlgorithmAES_CTR and CryptoAlgorithmAES_KW.
3262
3263 2020-03-10  Don Olmstead  <don.olmstead@sony.com>
3264
3265         [GPU Process] Work towards compiling out on non-Cocoa ports
3266         https://bugs.webkit.org/show_bug.cgi?id=208899
3267
3268         Reviewed by Darin Adler.
3269
3270         Add in additional headers required for GPU Process build.
3271
3272         * Headers.cmake:
3273
3274 2020-03-08  Darin Adler  <darin@apple.com>
3275
3276         Make TextIterator::range return a SimpleRange
3277         https://bugs.webkit.org/show_bug.cgi?id=208797
3278
3279         Reviewed by Don Olmstead.
3280
3281         * accessibility/AXObjectCache.cpp:
3282         (WebCore::AXObjectCache::traverseToOffsetInRange): Updated since
3283         TextIterator::range returns a SimpleRange. Also use TextIterator::node where
3284         appropriate instead of repeating the code for it here.
3285         (WebCore::AXObjectCache::lengthForRange): Use TextIterator::node.
3286
3287         * accessibility/AccessibilityObject.cpp:
3288         (WebCore::AccessibilityObject::stringForRange const): Use TextIterator::node.
3289         (WebCore::AccessibilityObject::stringForVisiblePositionRange): Ditto.
3290         (WebCore::AccessibilityObject::lengthForVisiblePositionRange const): Ditto.
3291
3292         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3293         (-[WebAccessibilityObjectWrapper arrayOfTextForTextMarkers:attributed:]):
3294         Use TextIterator::node and createLiveRange.
3295
3296         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: Added include
3297         of SimpleRange and removed "using namespace HTMLNames".
3298         (AXAttributeStringSetStyle): Use HTMLNames namespace explicitly.
3299         (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:spellCheck:]):
3300         Use TextIterator::node.
3301         (-[WebAccessibilityObjectWrapper subrole]): Use HTMLNames namespace explicitly.
3302
3303         * dom/DocumentMarkerController.cpp:
3304         (WebCore::DocumentMarkerController::collectTextRanges): Use createLiveRange
3305         here since we don't want to convert move the class to SimpleRange at this time.
3306
3307         * dom/Position.cpp: Added include of Range.h.
3308
3309         * dom/RangeBoundaryPoint.h: Removed a bogus "const" on the return value of
3310         RangeBoundaryPoint::toPosition.
3311
3312         * editing/TextIterator.cpp:
3313         (WebCore::BitStack::BitStack): Deleted.
3314         (WebCore::BitStack::size const): Deleted.
3315         (WebCore::TextIterator::range const): Return a SimpleRange.
3316         (WebCore::TextIterator::node const): Updated for the above.
3317         (WebCore::CharacterIterator::range const): Use SimpleRange right up until the
3318         return statement, where we do createLiveRange. Will come back and remove that soon.
3319         (WebCore::TextIterator::rangeFromLocationAndLength): Use createLiveRange in
3320         one place, SimpleRange in another.
3321
3322         * editing/TextIterator.h: Removed include of "Range.h" since we can just use
3323         a forward declaration instead. Removed unneeded forward declarations. Simplified
3324         the BitStack and TextIteratorCopyableText classes by initializing data members
3325         and removing explicit definitions of the constructors and destructors. Took out
3326         a stray "explicit" that wasn't needed. Changed the return value of
3327         TextIterator::range to SimpleRange.
3328
3329         * editing/TextManipulationController.cpp:
3330         (WebCore::ParagraphContentIterator::ParagraphContentIterator): Call
3331         createLiveRange.
3332         (WebCore::ParagraphContentIterator::advance): Ditto.
3333         (WebCore::ParagraphContentIterator::startPosition): Ditto.
3334         (WebCore::ParagraphContentIterator::endPosition): Ditto.
3335
3336         * editing/cocoa/DataDetection.mm:
3337         (WebCore::DataDetection::detectContentInRange): Use createLiveRange.
3338
3339         * editing/cocoa/HTMLConverter.mm:
3340         (WebCore::editingAttributedStringFromRange): Use SimpleRange instead
3341         of a live range.
3342
3343 2020-03-10  Simon Fraser  <simon.fraser@apple.com>
3344
3345         Track "scrolling scope" on RenderLayers
3346         https://bugs.webkit.org/show_bug.cgi?id=208620
3347
3348         Reviewed by Zalan Bujtas.
3349         
3350         The scrolling scope code added in r257920 failed to recompute m_contentsScrollingScope
3351         when hasCompositedScrollableOverflow() changed, causing bugs on gmail.
3352
3353         Recompute the m_contentsScrollingScope to match or not match the m_boxScrollingScope
3354         based on whether the layer is composited-scrollable.
3355
3356         Test: fast/scrolling/mac/absolute-in-overflow-scroll-dynamic.html
3357
3358         * rendering/RenderLayer.cpp:
3359         (WebCore::RenderLayer::updateLayerPosition):
3360         * rendering/RenderLayerCompositor.cpp:
3361         (WebCore::isScrolledByOverflowScrollLayer):
3362
3363 2020-03-10  Don Olmstead  <don.olmstead@sony.com>
3364
3365         Non-unified build fixes early March 2020 edition
3366         https://bugs.webkit.org/show_bug.cgi?id=208897
3367
3368         Unreviewed build fix.
3369
3370         * Modules/mediacontrols/MediaControlsHost.h:
3371         * dom/BoundaryPoint.h:
3372         * dom/StaticRange.cpp:
3373         * editing/FrameSelection.cpp:
3374         * loader/cache/CachedResourceRequest.cpp:
3375         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
3376
3377 2020-03-10  Jack Lee  <shihchieh_lee@apple.com>
3378
3379         Nullptr crash in CompositeEditCommand::moveParagraphWithClones when indenting non-enclosed elements.
3380         https://bugs.webkit.org/show_bug.cgi?id=208628
3381         <rdar://problem/52011509>
3382
3383         Reviewed by Ryosuke Niwa.
3384
3385         When indenting a non-enclosed paragraph, quit if start of contents is not a descendant or sibling of outer block.
3386
3387         Test: fast/editing/indent-non-enclosed-element-crash.html
3388
3389         * editing/IndentOutdentCommand.cpp:
3390         (WebCore::IndentOutdentCommand::indentIntoBlockquote):
3391
3392 2020-03-10  Stephan Szabo  <stephan.szabo@sony.com>
3393
3394         [PlayStation] incomplete type 'WebCore::ScrollingStateFrameScrollingNode' named in nested name specifier
3395         https://bugs.webkit.org/show_bug.cgi?id=208882
3396
3397         Reviewed by Simon Fraser.
3398
3399         No new tests, build fix.
3400
3401         * page/scrolling/ScrollingTreeScrollingNode.cpp:
3402           Add include of ScrollingStateFrameScrollingNode
3403           when ENABLE(SCROLLING_THREAD) is true.
3404
3405 2020-03-10  Alex Christensen  <achristensen@webkit.org>
3406
3407         Build fix.
3408
3409         * platform/audio/ios/MediaSessionHelperIOS.mm:
3410         (MediaSessionHelperiOS::providePresentingApplicationPID):
3411         Fix an unused parameter warning.
3412
3413 2020-03-10  Simon Fraser  <simon.fraser@apple.com>
3414
3415         REGRESSION (r257920): inbox flickers and disappears when scrolling gmail
3416         https://bugs.webkit.org/show_bug.cgi?id=208883
3417         rdar://problem/60287447
3418