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