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