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