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