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