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