Properly determine if css custom property values are computationally independent
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-10-06  Justin Michaud  <justin_michaud@apple.com>
2
3         Properly determine if css custom property values are computationally independent
4         https://bugs.webkit.org/show_bug.cgi?id=190303
5
6         Reviewed by Antti Koivisto.
7
8         Add getDirectComputationalDependencies method to determine if a value is computationally
9         dependent. Use this method in CSS.registerProperty to replace existing substring checks.
10         No new tests are needed because the existing tests cover this behaviour.
11
12         * css/CSSCalculationValue.cpp:
13         (WebCore::determineCategory):
14         * css/CSSCalculationValue.h:
15         (WebCore::CSSCalcValue::getDirectComputationalDependencies const):
16         (WebCore::CSSCalcValue::getDirectRootComputationalDependencies const):
17         * css/CSSCustomPropertyValue.cpp:
18         (WebCore::CSSCustomPropertyValue::customCSSText const):
19         (WebCore::CSSCustomPropertyValue::tokens const):
20         (WebCore::CSSCustomPropertyValue::setResolvedTypedValue):
21         * css/CSSCustomPropertyValue.h:
22         * css/CSSPrimitiveValue.cpp:
23         (WebCore::CSSPrimitiveValue::getDirectComputationalDependencies const):
24         (WebCore::CSSPrimitiveValue::getDirectRootComputationalDependencies const):
25         * css/CSSPrimitiveValue.h:
26         * css/CSSValue.cpp:
27         (WebCore::CSSValue::getDirectComputationalDependencies const):
28         (WebCore::CSSValue::getDirectRootComputationalDependencies const):
29         * css/CSSValue.h:
30         * css/CSSVariableData.cpp:
31         (WebCore::CSSVariableData::CSSVariableData):
32         (WebCore::CSSVariableData::resolveVariableReference const):
33         * css/DOMCSSRegisterCustomProperty.cpp:
34         (WebCore::DOMCSSRegisterCustomProperty::registerProperty):
35
36 2018-10-05  Chris Dumez  <cdumez@apple.com>
37
38         Regression(r236862): Crash under DOMWindowExtension::willDetachGlobalObjectFromFrame()
39         https://bugs.webkit.org/show_bug.cgi?id=190320
40         <rdar://problem/45044814>
41
42         Reviewed by Geoffrey Garen.
43
44         r236862 caused DOMWindowProperty::willDetachGlobalObjectFromFrame() to get called several
45         times. There was no effect for most DOMWindowProperty objects. However, it would cause
46         crashes for DOMWindowExtension objects, which subclass DOMWindowProperty and override
47         DOMWindowProperty::willDetachGlobalObjectFromFrame() because they dereference the frame
48         without null checking it.
49
50         To address the issue, we now make sure DOMWindowProperty::willDetachGlobalObjectFromFrame()
51         is not called several times.
52
53         * dom/Document.cpp:
54         (WebCore::Document::detachFromFrame):
55         Stop calling DOMWindow::willDetachDocumentFromFrame() here as most call sites already
56         take care of calling DOMWindow::willDetachDocumentFromFrame() beforehand (e.g.
57         Document::prepareForDestruction()).
58         Also, return early if the Document is already detached from its frame.
59
60         (WebCore::Document::frameWasDisconnectedFromOwner):
61         Add new utility function called when a Frame is disconnected from its owner which
62         calls both Document::detachFromFrame() and DOMWindow::willDetachDocumentFromFrame().
63
64         * dom/Document.h:
65         * page/DOMWindow.cpp:
66         (WebCore::DOMWindow::willDetachDocumentFromFrame):
67         Return early if the Window is already detached from its frame.
68
69         * page/Frame.cpp:
70         (WebCore::Frame::disconnectOwnerElement):
71
72 2018-10-05  Jer Noble  <jer.noble@apple.com>
73
74         Further unreviewed watchOS build fix: videoPerformanceMetrics unavailable on watchOS.
75
76         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
77         (WebCore::MediaPlayerPrivateAVFoundationObjC::videoPlaybackQualityMetrics):
78
79 2018-10-05  Jer Noble  <jer.noble@apple.com>
80
81        Unreviewed watchOS build fix: videoPerformanceMetrics unavailable on watchOS.
82
83         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
84         (WebCore::MediaPlayerPrivateAVFoundationObjC::videoPlaybackQualityMetrics):
85
86 2018-10-05  Eric Carlson  <eric.carlson@apple.com>
87
88         [MediaStream] RealtimeMediaSource should be able to vend hashed IDs
89         https://bugs.webkit.org/show_bug.cgi?id=190142
90         <rdar://problem/44911109>
91
92         Reviewed by Youenn Fablet.
93
94         No new tests, covered by existing tests.
95
96         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
97         (WebCore::CanvasCaptureMediaStreamTrack::Source::Source): Update order of parameters passed
98         to base class.
99
100         * Modules/mediastream/MediaDevicesRequest.cpp:
101         (WebCore::MediaDevicesRequest::start): ASSERT if document.deviceIDHashSalt is not the same
102         as passed salt.
103
104         * Modules/mediastream/MediaStreamTrack.cpp:
105         (WebCore::MediaStreamTrack::getSettings const): Don't need to hash ID.
106         (WebCore::MediaStreamTrack::getCapabilities const): Ditto.
107         * Modules/mediastream/MediaStreamTrack.h:
108         * Modules/mediastream/MediaStreamTrack.idl:
109
110         * Modules/mediastream/UserMediaRequest.cpp:
111         (WebCore::UserMediaRequest::allow): Pass hash salt to createMediaStream.
112
113         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
114         (WebCore::LibWebRTCPeerConnectionBackend::createReceiverForSource): Update order of parameters passed
115         to base class.
116
117         * Modules/webaudio/MediaStreamAudioSource.cpp:
118         (WebCore::MediaStreamAudioSource::MediaStreamAudioSource): Ditto.
119         * platform/mediastream/MediaConstraints.h:
120
121         * platform/mediastream/RealtimeIncomingAudioSource.cpp:
122         (WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource): Ditto.
123
124         * platform/mediastream/RealtimeIncomingVideoSource.cpp:
125         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource): Ditto.
126
127         * platform/mediastream/RealtimeMediaSource.cpp:
128         (WebCore::RealtimeMediaSource::RealtimeMediaSource): Calculate hashed ID.
129         (WebCore::RealtimeMediaSource::selectSettings): Use m_hashedID.
130         (WebCore::RealtimeMediaSource::hashedId const): New.
131         (WebCore::RealtimeMediaSource::deviceIDHashSalt const): New.
132         * platform/mediastream/RealtimeMediaSource.h:
133
134         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
135         (WebCore::RealtimeMediaSourceCenter::createMediaStream): Take hash salt, pass it when creating
136         a source.
137         (WebCore::RealtimeMediaSourceCenter::getUserMediaDevices): Ditto.
138         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): Ditto.
139         * platform/mediastream/RealtimeMediaSourceCenter.h:
140
141         * platform/mediastream/RealtimeMediaSourceFactory.h:
142         * platform/mediastream/RealtimeVideoSource.cpp:
143         (WebCore::RealtimeVideoSource::RealtimeVideoSource): Update parameters.
144         * platform/mediastream/RealtimeVideoSource.h:
145
146         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
147         (WebCore::GStreamerAudioCaptureSource::create): Ditto.
148         (WebCore::GStreamerAudioCaptureSource::GStreamerAudioCaptureSource): Ditto.
149         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h:
150
151         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
152         (WebCore::GStreamerVideoCaptureSource::create): Ditto.
153         (WebCore::GStreamerVideoCaptureSource::GStreamerVideoCaptureSource): Ditto.
154         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h:
155
156         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
157         (WebCore::WrappedMockRealtimeAudioSource::WrappedMockRealtimeAudioSource): Ditto.
158         (WebCore::MockRealtimeAudioSource::create): Ditto.
159         (WebCore::MockGStreamerAudioCaptureSource::MockGStreamerAudioCaptureSource): Ditto.
160         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h:
161
162         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp:
163         (WebCore::MockRealtimeVideoSource::create): Ditto.
164         (WebCore::MockGStreamerVideoCaptureSource::MockGStreamerVideoCaptureSource): Ditto.
165         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h:
166
167         * platform/mediastream/mac/AVVideoCaptureSource.h:
168         * platform/mediastream/mac/AVVideoCaptureSource.mm:
169         (WebCore::AVVideoCaptureSource::create): Ditto.
170         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource): Ditto.
171         (WebCore::AVVideoCaptureSource::settings): Use hashedId to set device ID.
172         (WebCore::AVVideoCaptureSource::capabilities): Ditto.
173
174         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
175         (WebCore::CoreAudioCaptureSource::create): Update parameters.
176         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource): Ditto.
177         (WebCore::CoreAudioCaptureSource::capabilities): Use hashedId to set device ID.
178         (WebCore::CoreAudioCaptureSource::settings): Ditto.
179         * platform/mediastream/mac/CoreAudioCaptureSource.h:
180
181         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
182         (WebCore::DisplayCaptureSourceCocoa::DisplayCaptureSourceCocoa): Update parameters.
183         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
184
185         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
186         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
187         (WebCore::MockRealtimeAudioSource::create): Ditto.
188         (WebCore::MockRealtimeAudioSourceMac::MockRealtimeAudioSourceMac): Ditto.
189
190         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
191         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
192         (WebCore::MockRealtimeVideoSource::create): Ditto.
193         (WebCore::MockRealtimeVideoSourceMac::MockRealtimeVideoSourceMac): Ditto.
194
195         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
196
197         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
198         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
199         (WebCore::ScreenDisplayCaptureSourceMac::create): Ditto.
200         (WebCore::ScreenDisplayCaptureSourceMac::ScreenDisplayCaptureSourceMac): Ditto.
201         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Update logging.
202         (WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream): Ditto.
203         (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable): Ditto.
204
205         * platform/mediastream/mac/WindowDisplayCaptureSourceMac.h:
206         * platform/mediastream/mac/WindowDisplayCaptureSourceMac.mm:
207         (WebCore::WindowDisplayCaptureSourceMac::create): Update parameters.
208
209         * platform/mock/MockRealtimeAudioSource.cpp:
210         (WebCore::MockRealtimeAudioSource::create): Ditto.
211         (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource): Ditto.
212         (WebCore::MockRealtimeAudioSource::settings): Use hashedId to set device ID.
213         (WebCore::MockRealtimeAudioSource::capabilities): Ditto.
214         * platform/mock/MockRealtimeAudioSource.h:
215
216         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
217
218         * platform/mock/MockRealtimeVideoSource.cpp:
219         (WebCore::MockRealtimeVideoSource::create): Update parameters.
220         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): Ditto.
221         (WebCore::MockRealtimeVideoSource::capabilities): Use hashedId to set device ID.
222         (WebCore::MockRealtimeVideoSource::settings): Ditto.
223         * platform/mock/MockRealtimeVideoSource.h:
224
225 2018-10-03  Jer Noble  <jer.noble@apple.com>
226
227         Add support for reporting "display composited video frames" through the VideoPlaybackQuality object.
228         https://bugs.webkit.org/show_bug.cgi?id=190266
229
230         Reviewed by Eric Carlson.
231
232         Test: TestWebKitAPI.VideoQualityDisplayCompositing
233
234         Modify VideoPlaybackQuality to take a VideoPlaybackQualityMetrics object in its
235         constructor (rather than individual fields). Add a new setting to control visibility
236         of the displayCompositedVideoFrames attribute on VideoPlaybackQuality. Add support
237         for VideoPlaybackQualityMetrics to MediaPlayerPrivateAVFoundationObjC.
238
239         * Modules/mediasource/VideoPlaybackQuality.cpp:
240         (WebCore::VideoPlaybackQuality::create):
241         (WebCore::VideoPlaybackQuality::VideoPlaybackQuality):
242         * Modules/mediasource/VideoPlaybackQuality.h:
243         (WebCore::VideoPlaybackQuality::displayCompositedVideoFrames const):
244         * Modules/mediasource/VideoPlaybackQuality.idl:
245         * html/HTMLMediaElement.cpp:
246         (WebCore::HTMLMediaElement::getVideoPlaybackQuality):
247         * html/HTMLMediaElement.h:
248         * html/HTMLMediaElement.idl:
249         * page/Settings.yaml:
250         * platform/graphics/MediaPlayer.h:
251         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
252         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
253         (WebCore::MediaPlayerPrivateAVFoundationObjC::videoPlaybackQualityMetrics):
254         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
255         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics):
256         * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
257         (WebCore::MockMediaSourcePrivate::videoPlaybackQualityMetrics):
258
259 2018-10-05  Ryan Haddad  <ryanhaddad@apple.com>
260
261         Unreviewed, rolling out r236866.
262
263         Breaks internal builds.
264
265         Reverted changeset:
266
267         "Add support for reporting "display composited video frames"
268         through the VideoPlaybackQuality object."
269         https://bugs.webkit.org/show_bug.cgi?id=190266
270         https://trac.webkit.org/changeset/236866
271
272 2018-10-05  Antoine Quint  <graouts@apple.com>
273
274         [Web Animations] REGRESSION (r236809): crash under AnimationTimeline::updateCSSAnimationsForElement()
275         https://bugs.webkit.org/show_bug.cgi?id=190307
276         <rdar://problem/45009901>
277
278         Reviewed by Dean Jackson.
279
280         We could crash with an invalid access to cssAnimationsByName since cancelOrRemoveDeclarativeAnimation() already
281         does the job of clearing the m_elementToCSSAnimationByName entry for this particular element if there are no
282         animations targeting it anymore. This started happening in r236809 when we switched from a simple call to to cancel()
283         to a call to cancelOrRemoveDeclarativeAnimation(). We can safely remove the removal here since cancelOrRemoveDeclarativeAnimation()
284         will already have performed this task safely if needed.
285
286         * animation/AnimationTimeline.cpp:
287         (WebCore::AnimationTimeline::updateCSSAnimationsForElement):
288
289 2018-10-04  Jer Noble  <jer.noble@apple.com>
290
291         Add support for reporting "display composited video frames" through the VideoPlaybackQuality object.
292         https://bugs.webkit.org/show_bug.cgi?id=190266
293
294         Reviewed by Eric Carlson.
295
296         Test: TestWebKitAPI.VideoQualityDisplayCompositing
297
298         Modify VideoPlaybackQuality to take a VideoPlaybackQualityMetrics object in its
299         constructor (rather than individual fields). Add a new setting to control visibility
300         of the displayCompositedVideoFrames attribute on VideoPlaybackQuality. Add support
301         for VideoPlaybackQualityMetrics to MediaPlayerPrivateAVFoundationObjC.
302
303         * Modules/mediasource/VideoPlaybackQuality.cpp:
304         (WebCore::VideoPlaybackQuality::create):
305         (WebCore::VideoPlaybackQuality::VideoPlaybackQuality):
306         * Modules/mediasource/VideoPlaybackQuality.h:
307         (WebCore::VideoPlaybackQuality::displayCompositedVideoFrames const):
308         * Modules/mediasource/VideoPlaybackQuality.idl:
309         * html/HTMLMediaElement.cpp:
310         (WebCore::HTMLMediaElement::getVideoPlaybackQuality):
311         * html/HTMLMediaElement.h:
312         * html/HTMLMediaElement.idl:
313         * page/Settings.yaml:
314         * platform/graphics/MediaPlayer.h:
315         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
316         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
317         (WebCore::MediaPlayerPrivateAVFoundationObjC::videoPlaybackQualityMetrics):
318         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
319         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics):
320         * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
321         (WebCore::MockMediaSourcePrivate::videoPlaybackQualityMetrics):
322
323 2018-10-04  Chris Dumez  <cdumez@apple.com>
324
325         A Document / Window should lose its browsing context as soon as its iframe is removed from the document
326         https://bugs.webkit.org/show_bug.cgi?id=190282
327
328         Reviewed by Ryosuke Niwa.
329
330         A Document / Window should lose its browsing context (aka Frame) as soon as its iframe is removed from
331         the document. In WebKit, a Document / Window's Frame was only getting nulled out when the frame gets
332         destroyed, which happens later usually after a GC happens.
333
334         Specification:
335         - https://html.spec.whatwg.org/#the-iframe-element
336         """
337         When an iframe element is removed from a document, the user agent must discard the element's nested browsing
338         context, if it is not null, and then set the element's nested browsing context to null.
339         """
340
341         This was not consistent with the specification or other browsers (tested Chrome and Firefox) so this
342         patch is aligning our behavior.
343
344         In a follow-up, I am planning to look into making the Window not be a FrameDestructionObserver, and instead
345         get its frame from the Document. This should make the code simpler.
346
347         No new tests, rebaselined existing tests.
348
349         * Modules/mediastream/MediaDevices.cpp:
350         (WebCore::MediaDevices::getUserMedia const):
351         * Modules/mediastream/MediaDevices.h:
352         Update getUserMedia() to reject a the Promise with an InvalidStateError when calling after the
353         document has been detached, instead of throwing an InvalidStateError. This behavior is as per
354         specification:
355         - https://w3c.github.io/mediacapture-main/#dom-mediadevices-getusermedia (Step 4)
356         I needed to make this change to keep one of our layout tests passing.
357
358         * dom/Document.cpp:
359         (WebCore::Document::attachToCachedFrame):
360         (WebCore::Document::detachFromFrame):
361         * dom/Document.h:
362         * page/DOMWindow.cpp:
363         (WebCore::DOMWindow::didSecureTransitionTo):
364         (WebCore::DOMWindow::willDetachDocumentFromFrame):
365         (WebCore::DOMWindow::setStatus):
366         (WebCore::DOMWindow::detachFromFrame):
367         (WebCore::DOMWindow::attachToFrame):
368         * page/DOMWindow.h:
369         * page/DOMWindowProperty.cpp:
370         (WebCore::DOMWindowProperty::disconnectFrameForDocumentSuspension):
371         (WebCore::DOMWindowProperty::willDestroyGlobalObjectInCachedFrame):
372         (WebCore::DOMWindowProperty::willDestroyGlobalObjectInFrame):
373         * page/Frame.cpp:
374         (WebCore::Frame::disconnectOwnerElement):
375
376         * platform/mock/MockRealtimeVideoSource.cpp:
377         (WebCore::MockRealtimeVideoSource::drawText):
378         Calling drawText() with a null String hits an assertion in debug. This was triggered by one of
379         our layout tests so I made sure we only call drawText when the String is not null.
380
381 2018-10-04  Jeremy Jones  <jeremyj@apple.com>
382
383         Unify implementation in VideoFullscreenInterfaceAVKit
384         https://bugs.webkit.org/show_bug.cgi?id=190091
385         rdar://problem/44734523
386
387         Reviewed by Jer Noble.
388
389         No new tests because no behavior change.
390
391         Unified code in VideoFullscreenInterfaceAVKit now that new code path is proven and include
392         any changes that had been made in the old path.
393
394         * platform/ios/VideoFullscreenInterfaceAVKit.h:
395         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
396         (-[WebAVPlayerViewControllerDelegate playerViewControllerShouldStartPictureInPictureFromInlineWhenEnteringBackground:]):
397         (VideoFullscreenInterfaceAVKit::preparedToExitFullscreen):
398         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
399         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
400         (VideoFullscreenControllerContext::requestUpdateInlineRect):
401         (VideoFullscreenControllerContext::requestVideoContentLayer):
402         (VideoFullscreenControllerContext::returnVideoContentLayer):
403         (VideoFullscreenControllerContext::didSetupFullscreen):
404         (VideoFullscreenControllerContext::didExitFullscreen):
405
406 2018-10-04  Justin Michaud  <justin_michaud@apple.com>
407
408         Bindings generator should support static attributes that are interfaces with CallWith
409         https://bugs.webkit.org/show_bug.cgi?id=190292
410
411         Reviewed by Chris Dumez.
412
413         Add support for static attributes that support callWith to the bindings generator. This
414         is needed for CSS.paintWorklet.
415
416         * bindings/scripts/CodeGeneratorJS.pm:
417         (GenerateAttributeGetterBodyDefinition):
418         * bindings/scripts/test/JS/JSTestObj.cpp:
419         (WebCore::jsTestObjConstructorTestStaticReadonlyObjGetter):
420         (WebCore::jsTestObjConstructorTestStaticReadonlyObj):
421         * bindings/scripts/test/TestObj.idl:
422
423 2018-10-04  Matt Lewis  <jlewis3@apple.com>
424
425         Unreviewed, rolling out r236730.
426
427         This caused a consistent crash in test http/tests/media/media-stream/get-display-media-prompt.html.
428
429         Reverted changeset:
430
431         "[MediaStream] RealtimeMediaSource should be able to vend
432         hashed IDs"
433         https://bugs.webkit.org/show_bug.cgi?id=190142
434         https://trac.webkit.org/changeset/236730
435
436 2018-10-04  Wenson Hsieh  <wenson_hsieh@apple.com>
437
438         [macOS] Fix some font attribute conversion bugs in preparation for "Font > Styles…" support in WebKit2
439         https://bugs.webkit.org/show_bug.cgi?id=190289
440         <rdar://problem/45020806>
441
442         Reviewed by Ryosuke Niwa.
443
444         Makes some small adjustments to fix two bugs in font attribute conversion logic. See below for more detail.
445
446         Tests:  FontManagerTests.AddFontShadowUsingFontOptions
447                 FontManagerTests.AddAndRemoveColorsUsingFontOptions
448
449         * editing/FontAttributeChanges.cpp:
450         (WebCore::cssValueListForShadow):
451         * editing/cocoa/FontAttributesCocoa.mm:
452
453         Currently, we bail from adding a font shadow if the shadow's offset is empty. However, valid shadow offsets may
454         have negative dimensions, so a check for `isZero()` should be used instead.
455
456         (WebCore::FontAttributes::createDictionary const):
457         * platform/mac/WebCoreNSFontManagerExtras.mm:
458
459         Fall back to a transparent background color; this allows senders to remove the current background color by just
460         removing NSBackgroundColorAttributeName from the attribute dictionary, rather than explicitly setting it to the
461         transparent color (this scenario is exercised when using "Font > Styles…" to specify a font style without a
462         background color).
463
464         (WebCore::computedFontAttributeChanges):
465
466 2018-10-03  Ryosuke Niwa  <rniwa@webkit.org>
467
468         MutationRecord doesn't keep JS wrappers of target, addedNodes, and removedNodes alive
469         https://bugs.webkit.org/show_bug.cgi?id=190277
470
471         Reviewed by Antti Koivisto.
472
473         The bug was caused by JSMutationRecord not visiting any of the nodes referenced by mutation records.
474
475         Fixed the bug by adding JSMutationRecord::visitAdditionalChildren, which adds the root nodes of
476         the root nodes of the target, addedNodes, and removedNodes in each mutation record.
477
478         Test: fast/dom/MutationObserver/mutation-record-keeps-js-wrappers-of-nodes-alive.html
479
480         * Sources.txt:
481         * WebCore.xcodeproj/project.pbxproj:
482         * bindings/js/JSMutationRecordCustom.cpp: Added.
483         (WebCore::JSMutationRecord::visitAdditionalChildren): Added.
484         * bindings/js/JSPerformanceObserverCustom.cpp: This file got dumped out of a unified build file
485         where using namespace JSC was defined. Use the fully qualified names to refer to JSC types.
486         (WebCore::JSPerformanceObserverOwner::isReachableFromOpaqueRoots):
487         * dom/MutationRecord.cpp:
488         (WebCore::ChildListRecord::visitNodesConcurrently): Added.
489         (WebCore::RecordWithEmptyNodeLists::visitNodesConcurrently): Added.
490         (WebCore::MutationRecordWithNullOldValue::visitNodesConcurrently): Added.
491         * dom/MutationRecord.h:
492         * dom/MutationRecord.idl:
493
494 2018-10-04  Jiewen Tan  <jiewen_tan@apple.com>
495
496         [WebAuthN] Move time out control from WebProcess to UIProcess
497         https://bugs.webkit.org/show_bug.cgi?id=189642
498         <rdar://problem/44476765>
499
500         Reviewed by Chris Dumez.
501
502         Since now the control unit of WebAuthN has been moved to UI Process, i.e. AuthenticatorManager,
503         the time out timer should move to UI Process as well.
504
505         Tests: http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html
506                http/wpt/webauthn/public-key-credential-get-failure-local-silent.https.html
507
508         * Modules/webauthn/AuthenticatorCoordinator.cpp:
509         (WebCore::AuthenticatorCoordinator::create const):
510         (WebCore::AuthenticatorCoordinator::discoverFromExternalSource const):
511         (WebCore::AuthenticatorCoordinatorInternal::initTimeoutTimer): Deleted.
512         (WebCore::AuthenticatorCoordinatorInternal::didTimeoutTimerFire): Deleted.
513         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
514         (WebCore::PublicKeyCredentialCreationOptions::encode const):
515         (WebCore::PublicKeyCredentialCreationOptions::decode):
516         * Modules/webauthn/PublicKeyCredentialRequestOptions.h:
517         (WebCore::PublicKeyCredentialRequestOptions::encode const):
518         (WebCore::PublicKeyCredentialRequestOptions::decode):
519
520 2018-10-04  Chris Dumez  <cdumez@apple.com>
521
522         Regression(r236779): Crash when changing the input element type from inside an 'input' event listener
523         https://bugs.webkit.org/show_bug.cgi?id=190252
524
525         Reviewed by Alex Christensen.
526
527         Add a null check for element() after firing the 'input' event and before firing the 'change' event
528         in case the input event listener changes the input type.
529
530         Tests: fast/dom/HTMLInputElement/change-type-in-click-event-listener.html
531                fast/dom/HTMLInputElement/change-type-in-input-event-listener.html
532
533         * html/BaseCheckableInputType.cpp:
534         (WebCore::BaseCheckableInputType::fireInputAndChangeEvents):
535
536 2018-10-04  Yuhan Wu  <yuhan_wu@apple.com>
537
538         runtime flag and IDL for MediaRecorder
539         https://bugs.webkit.org/show_bug.cgi?id=190018
540
541         Reviewed by Youenn Fablet and Chris Dumez.
542
543         Covered by tests:
544         imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-constructor.html
545         imported/w3c/web-platform-tests/mediacapture-record/BlobEvent-constructor.html
546
547         Add an architecture of the IDL and the class for MediaRecorder and BlobEvent.
548
549         * CMakeLists.txt:
550         * DerivedSources.make:
551         * Modules/mediarecorder/BlobEvent.h:
552         (WebCore::BlobEvent::create):
553         (WebCore::BlobEvent:::Event):
554         * Modules/mediarecorder/BlobEvent.idl:
555         * Modules/mediarecorder/MediaRecorder.cpp:
556         (WebCore::MediaRecorder::create):
557         (WebCore::MediaRecorder::MediaRecorder):
558         (WebCore::MediaRecorder::activeDOMObjectName const):
559         (WebCore::MediaRecorder::canSuspendForDocumentSuspension const):
560         * Modules/mediarecorder/MediaRecorder.h: Added.
561         (WebCore::MediaRecorder::state const):
562         (WebCore::MediaRecorder::~MediaRecorder):
563         * Modules/mediarecorder/MediaRecorder.idl:
564         * Modules/mediastream/RTCRtpReceiver.cpp:
565         * Sources.txt:
566         * WebCore.xcodeproj/project.pbxproj:
567         * bindings/js/WebCoreBuiltinNames.h:
568         * page/RuntimeEnabledFeatures.h:
569         (WebCore::RuntimeEnabledFeatures::mediaRecorderEnabled const):
570         (WebCore::RuntimeEnabledFeatures::setMediaRecorderEnabled):
571
572 2018-10-04  Chris Dumez  <cdumez@apple.com>
573
574         Unreviewed, rolling out r236803.
575
576         Caused crashes on some bots
577
578         Reverted changeset:
579
580         "Regression(r236779): Crash when changing the input element
581         type from inside an 'input' event listener"
582         https://bugs.webkit.org/show_bug.cgi?id=190252
583         https://trac.webkit.org/changeset/236803
584
585 2018-10-04  Dan Bernstein  <mitz@apple.com>
586
587         Tried to fix the Mojave build after r236832.
588
589         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
590         (-[WebAVStreamDataParserListener streamDataParserWillProvideContentKeyRequestInitializationData:forTrackID:]):
591         (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]):
592
593 2018-10-04  Michael Catanzaro  <mcatanzaro@igalia.com>
594
595         ENABLE(ASSERT) used in grid code when !ASSERT_DISABLED is desired
596         https://bugs.webkit.org/show_bug.cgi?id=190145
597
598         Reviewed by Javier Fernandez.
599
600         Replace ENABLE(ASSERT), which doesn't exist, with !ASSERT_DISABLED.
601
602         * rendering/RenderGrid.cpp:
603         (WebCore::RenderGrid::placeItemsOnGrid const):
604         (WebCore::RenderGrid::baselinePosition const):
605         * rendering/style/GridArea.h:
606         (WebCore::GridSpan::GridSpan):
607
608 2018-10-04  Dan Bernstein  <mitz@apple.com>
609
610         WebCore part of [Xcode] Update some build settings as recommended by Xcode 10
611         https://bugs.webkit.org/show_bug.cgi?id=190250
612
613         Reviewed by Andy Estes.
614
615         * Configurations/Base.xcconfig: Enabled CLANG_WARN_COMMA, CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF,
616           CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED, and CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS.
617
618         * WebCore.xcodeproj/project.pbxproj: Let Xcode update LastUpgradeCheck and remove a
619           duplicate reference in a Compile Sources build phase.
620
621         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: Suppress -Wdeprecated-implementations
622           around implementations of deprecated accessibility methods.
623
624         * loader/TextResourceDecoder.cpp:
625         (WebCore::TextResourceDecoder::checkForBOM): Addressed CLANG_WARN_COMMA.
626
627         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
628         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]):
629           Suppress -Wdeprecated-implementations around implementations of this deprecated delegate method.
630         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): Ditto.
631
632 2018-10-02  Darin Adler  <darin@apple.com>
633
634         AudioNode.connect should use [ReturnValue]
635         https://bugs.webkit.org/show_bug.cgi?id=190231
636
637         Reviewed by Eric Carlson.
638
639         This is a slightly more efficient way to return a value that is always
640         identical to one of the arguments, so use it here.
641
642         * Modules/webaudio/AudioBasicInspectorNode.cpp:
643         (WebCore::AudioBasicInspectorNode::connect): Return ExceptionOr<void>.
644         * Modules/webaudio/AudioBasicInspectorNode.h: Ditto.
645         * Modules/webaudio/AudioNode.cpp:
646         (WebCore::AudioNode::connect): Ditto.
647         * Modules/webaudio/AudioNode.h: Ditto.
648
649         * Modules/webaudio/AudioNode.idl: Use [ReturnValue].
650
651 2018-10-03  Justin Michaud  <justin_michaud@apple.com>
652
653         Registered custom properties should allow inheritance to be controlled
654         https://bugs.webkit.org/show_bug.cgi?id=190038
655
656         Reviewed by Antti Koivisto.
657
658         Tests: css-custom-properties-api/inherits.html
659                css-custom-properties-api/length.html
660                css-custom-properties-api/length2.html
661
662         Add support for inherits property on registered css custom properties, as well
663         as a starting point for evaluating registered custom properties with types. Registered
664         custom properties are evaluated as length values before being substituted. Currently,
665         relative unit cycles are not detected.
666
667         A proper solution is still needed to resolve relative unit cycles, and to apply properties like font
668         and line-height before they are needed by custom properties. In this patch, the font-size property is
669         applied twice, once before and once after resolving custom property values.
670
671         * Sources.txt:
672         * WebCore.xcodeproj/project.pbxproj:
673         * css/CSSComputedStyleDeclaration.cpp:
674         (WebCore::ComputedStyleExtractor::customPropertyValue):
675         (WebCore::CSSComputedStyleDeclaration::length const):
676         (WebCore::CSSComputedStyleDeclaration::item const):
677
678         Allow JS to get custom properties that have been resolved to a length. Also add properties from
679         m_rareNonInheritedData.
680
681         * css/CSSCustomPropertyValue.cpp:
682         (WebCore::CSSCustomPropertyValue::checkVariablesForCycles const):
683         (WebCore::CSSCustomPropertyValue::resolveVariableReferences const):
684         * css/CSSCustomPropertyValue.h:
685         * css/CSSRegisteredCustomProperty.cpp: Copied from Source/WebCore/css/CSSRegisteredCustomProperty.h.
686         (WebCore::CSSRegisteredCustomProperty::CSSRegisteredCustomProperty):
687         (WebCore::CSSRegisteredCustomProperty::initialValueCopy const):
688         * css/CSSRegisteredCustomProperty.h:
689         (WebCore::CSSRegisteredCustomProperty::initialValue const):
690         * css/CSSVariableData.cpp:
691         (WebCore::CSSVariableData::checkVariablesForCycles const):
692         (WebCore::CSSVariableData::checkVariablesForCyclesWithRange const):
693         (WebCore::CSSVariableData::resolveVariableFallback const):
694         (WebCore::CSSVariableData::resolveVariableReference const):
695         (WebCore::CSSVariableData::resolveVariableReferences const):
696         (WebCore::CSSVariableData::resolveTokenRange const):
697         * css/CSSVariableData.h:
698         * css/CSSVariableReferenceValue.cpp:
699         (WebCore::CSSVariableReferenceValue::checkVariablesForCycles const):
700         * css/CSSVariableReferenceValue.h:
701         * css/DOMCSSRegisterCustomProperty.cpp:
702         (WebCore::DOMCSSRegisterCustomProperty::registerProperty):
703
704         Use RenderStyle over passing in a customProperties map.
705
706         * css/StyleBuilder.h:
707         * css/StyleBuilderConverter.h:
708         (WebCore::StyleBuilderConverter::convertLength):
709         (WebCore::StyleBuilderConverter::convertLengthOrAuto):
710         (WebCore::StyleBuilderConverter::convertLengthSizing):
711         (WebCore::StyleBuilderConverter::convertLengthMaxSizing):
712         * css/StyleBuilderCustom.h:
713         (WebCore::StyleBuilderCustom::applyInitialCustomProperty):
714         (WebCore::StyleBuilderCustom::applyInheritCustomProperty):
715         (WebCore::StyleBuilderCustom::applyValueCustomProperty):
716         * css/StyleResolver.cpp:
717         (WebCore::StyleResolver::useSVGZoomRules const):
718         (WebCore::StyleResolver::useSVGZoomRulesForLength const):
719         (WebCore::StyleResolver::applyProperty):
720         (WebCore::StyleResolver::resolvedVariableValue const):
721         (WebCore::StyleResolver::applyCascadedProperties):
722         (WebCore::StyleResolver::useSVGZoomRules): Deleted.
723         (WebCore::StyleResolver::useSVGZoomRulesForLength): Deleted.
724         (WebCore::StyleResolver::resolvedVariableValue): Deleted.
725         * css/StyleResolver.h:
726         * css/makeprop.pl:
727
728         Move custom property initial values to StyleBuilerCustom. Hook them up to correctly deal with
729         inheritance, unset and revert values.
730
731         * css/parser/CSSParser.cpp:
732         (WebCore::CSSParser::parseValueWithVariableReferences):
733         * css/parser/CSSParser.h:
734         * css/parser/CSSParserContext.cpp:
735         (WebCore::CSSParserContext::CSSParserContext):
736         * css/parser/CSSParserContext.h:
737         * css/parser/CSSPropertyParser.cpp:
738         (WebCore::CSSPropertyParser::parseSingleValue):
739
740         Allow parsing custom property values as lengths.
741
742         * rendering/style/RenderStyle.cpp:
743         (WebCore::RenderStyle::checkVariablesInCustomProperties):
744         * rendering/style/RenderStyle.h:
745         (WebCore::RenderStyle::inheritedCustomProperties const):
746         (WebCore::RenderStyle::nonInheritedCustomProperties const):
747         (WebCore::RenderStyle::setInheritedCustomPropertyValue):
748         (WebCore::RenderStyle::setNonInheritedCustomPropertyValue):
749         (WebCore::RenderStyle::getCustomProperty const):
750         (WebCore::RenderStyle::customProperties const): Deleted.
751         (WebCore::RenderStyle::setCustomPropertyValue): Deleted.
752         * rendering/style/StyleRareNonInheritedData.cpp:
753         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
754         (WebCore::StyleRareNonInheritedData::operator== const):
755         * rendering/style/StyleRareNonInheritedData.h:
756         * style/StyleResolveForDocument.cpp:
757         (WebCore::Style::resolveForDocument):
758
759         Add support for RenderStyle to deal with both inherited and non-inherited properties, and to find
760         cycles between them.
761
762 2018-10-03  Ryosuke Niwa  <rniwa@webkit.org>
763
764         Clear m_pendingTargets in MutationObserver::takeRecords
765         https://bugs.webkit.org/show_bug.cgi?id=190240
766
767         Reviewed by Geoffrey Garen.
768
769         In r236781, we delayed the clearing of m_pendingTargets until the end of microtask to avoid a race between
770         mutation record's JS wrappers getting created and GC marking JS wrappers of elements in mutation records.
771
772         This patch shortens this delay to until mutation record's JS wrappers are created. Specifically, we make
773         MutationObserver::takeRecords() return a struct which has both pending targets hash set and the vector of
774         mutation records so that the hash set survives through the creation of JS wrappers for mutation records.
775
776         To do this, a new IDL extended attribute "ResultField" is introduced to specify the member variable in
777         which the result is stored.
778
779         No new tests. Unfortunately, this race condition appears to be impossible to capture in a regression test.
780
781         * bindings/scripts/CodeGeneratorJS.pm:
782         (GenerateOperationBodyDefinition):
783         * bindings/scripts/IDLAttributes.json:
784         * bindings/scripts/test/JS/JSTestInterface.cpp:
785         (WebCore::jsTestInterfacePrototypeFunctionTakeNodesBody):
786         (WebCore::jsTestInterfacePrototypeFunctionTakeNodes):
787         * bindings/scripts/test/TestImplements.idl: Added a test case.
788         * dom/MutationObserver.cpp:
789         (WebCore::MutationObserver::takeRecords):
790         (WebCore::MutationObserver::deliver):
791         * dom/MutationObserver.h:
792         * dom/MutationObserver.idl:
793
794 2018-10-03  Youenn Fablet  <youenn@apple.com>
795
796         Add VP8 support to WebRTC
797         https://bugs.webkit.org/show_bug.cgi?id=189976
798
799         Reviewed by Eric Carlson.
800
801         Add a runtime flag to control activation of VP8 codec.
802         Bind this runtime flag to the video codec factories.
803         Test: webrtc/video-mute-vp8.html
804
805         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
806         (WebCore::createLibWebRTCPeerConnectionBackend):
807         * page/RuntimeEnabledFeatures.h:
808         (WebCore::RuntimeEnabledFeatures::webRTCVP8CodecEnabled const):
809         (WebCore::RuntimeEnabledFeatures::setWebRTCVP8CodecEnabled):
810         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
811         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
812         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
813         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
814         * testing/Internals.cpp:
815         (WebCore::Internals::resetToConsistentState):
816         Enable VP8 codec for tests.
817
818 2018-09-28  Jiewen Tan  <jiewen_tan@apple.com>
819
820         [WebCrypto] ECDSA could not deal with invalid signature inputs
821         https://bugs.webkit.org/show_bug.cgi?id=189879
822         <rdar://problem/44701276>
823
824         Reviewed by Brent Fulgham.
825
826         Add some guards over detections of the start positions of r/s.
827
828         Covered by improved existing tests.
829
830         * crypto/mac/CryptoAlgorithmECDSAMac.cpp:
831         (WebCore::verifyECDSA):
832
833 2018-10-03  Jer Noble  <jer.noble@apple.com>
834
835         Add a quirk to disable Modern EME for sites which are broken with it enabled
836         https://bugs.webkit.org/show_bug.cgi?id=190051
837
838         Reviewed by Daniel Bates.
839
840         Add a new class, parallel to Settings, to track quirk behavior. Extend the bindings
841         generator to support a DisabledByQuirk attribute, and set this attribute for all
842         the Modern EME types. Check whether the quirk is set inside HTMLMediaElement in
843         addition to the existing Setting.
844
845         * Modules/encryptedmedia/MediaKeyMessageEvent.idl:
846         * Modules/encryptedmedia/MediaKeySession.idl:
847         * Modules/encryptedmedia/MediaKeyStatusMap.idl:
848         * Modules/encryptedmedia/MediaKeySystemAccess.idl:
849         * Modules/encryptedmedia/MediaKeys.idl:
850         * Modules/encryptedmedia/NavigatorEME.idl:
851         * Sources.txt:
852         * WebCore.xcodeproj/project.pbxproj:
853         * bindings/scripts/CodeGenerator.pm:
854         (WK_ucfirst):
855         * bindings/scripts/CodeGeneratorJS.pm:
856         (NeedsRuntimeCheck):
857         (GenerateRuntimeEnableConditionalString):
858         * bindings/scripts/IDLAttributes.json:
859         * bindings/scripts/preprocess-idls.pl:
860         (GenerateConstructorAttributes):
861         * dom/Document.cpp:
862         (WebCore::Document::Document):
863         * dom/Document.h:
864         (WebCore::Document::quirks const):
865         * html/HTMLMediaElement.cpp:
866         (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
867         (WebCore::HTMLMediaElement::mediaPlayerInitializationDataEncountered):
868         * html/HTMLMediaElement.idl:
869         * page/Quirks.cpp: Added.
870         (Quirks::Quirks):
871         (Quirks::disableEncryptedMediaAPIQuirk const):
872         * page/Quirks.h: Added.
873
874 2018-10-03  Antoine Quint  <graouts@apple.com>
875
876         [Web Animations] REGRESSION: setting 'animation-name: none' after a 'fill: forwards' animation has completed does not revert to the unanimated style
877         https://bugs.webkit.org/show_bug.cgi?id=190257
878         <rdar://problem/41341473>
879
880         Reviewed by Dean Jackson.
881
882         Test: animations/animation-fill-forwards-removal.html
883
884         While we removed a declarative animation that was no longer targetting its element, we were not removing it from the declarative animation maps
885         on the timeline, which means that the animation would still be picked up when resolving styles. We now notify the timeline that the animation
886         was detached from the element. This preserves the DeclarativeAnimation relationship returning the element as its effect's target and the document
887         timeline as its timeline, but the document timeline will no longer see this animation as targeting this element.
888
889         * animation/AnimationTimeline.cpp:
890         (WebCore::AnimationTimeline::cancelOrRemoveDeclarativeAnimation):
891         * animation/DeclarativeAnimation.h:
892         (WebCore::DeclarativeAnimation::target const):
893
894 2018-10-03  Jer Noble  <jer.noble@apple.com>
895
896         CRASH in CVPixelBufferGetBytePointerCallback()
897         https://bugs.webkit.org/show_bug.cgi?id=190092
898
899         Reviewed by Eric Carlson.
900
901         Speculative fix for crash that occurs when callers of CVPixelBufferGetBytePointerCallback() attempt
902         to read the last byte of a CVPixelBuffer (as a pre-flight check) and crash due to a memory access
903         error. It's speculated that mismatching CVPixelBufferLockBytePointer / CVPixelBufferUnlockBytePointer
904         calls could result in an incorrect state inside the CVPixelBuffer. Add log count checks, locking, and
905         release logging to try to pinpoint if mismatch lock counts are occurring in this code path.
906
907         * platform/graphics/cv/PixelBufferConformerCV.cpp:
908         (WebCore::CVPixelBufferGetBytePointerCallback):
909         (WebCore::CVPixelBufferReleaseBytePointerCallback):
910         (WebCore::CVPixelBufferReleaseInfoCallback):
911         (WebCore::PixelBufferConformerCV::createImageFromPixelBuffer):
912
913 2018-10-03  Chris Dumez  <cdumez@apple.com>
914
915         Regression(r236779): Crash when changing the input element type from inside an 'input' event listener
916         https://bugs.webkit.org/show_bug.cgi?id=190252
917
918         Reviewed by Alex Christensen.
919
920         Add a null check for element() after firing the 'input' event and before firing the 'change' event
921         in case the input event listener changes the input type.
922
923         Tests: fast/dom/HTMLInputElement/change-type-in-click-event-listener.html
924                fast/dom/HTMLInputElement/change-type-in-input-event-listener.html
925
926         * html/BaseCheckableInputType.cpp:
927         (WebCore::BaseCheckableInputType::fireInputAndChangeEvents):
928
929 2018-10-03  Chris Dumez  <cdumez@apple.com>
930
931         Passing noopener=NOOPENER to window.open() should cause the new window to not have an opener
932         https://bugs.webkit.org/show_bug.cgi?id=190251
933
934         Reviewed by Alex Christensen.
935
936         Passing noopener=NOOPENER to window.open() should cause the new window to not have an opener,
937         similarly to noopener=1:
938         - https://html.spec.whatwg.org/#window-open-steps (step 5)
939
940         It does not matter what the value is, if there is a key named "noopener", then the new window
941         should not have an opener.
942
943         No new tests, rebaselined existing test.
944
945         * page/WindowFeatures.cpp:
946         (WebCore::setWindowFeature):
947
948 2018-10-03  Ryosuke Niwa  <rniwa@webkit.org>
949
950         GC can collect JS wrappers of nodes in the mutation records waiting to be delivered
951         https://bugs.webkit.org/show_bug.cgi?id=190115
952
953         Reviewed by Geoffrey Garen.
954
955         Fixed the bug by retaining JS wrappers of elements in mutation records using GCReachableRef.
956
957         This patch deploys GCReachableRef in two places: MutationObserver where each mutation record's
958         target is kept alive and MutationObserverRegistration where each node which had been removed
959         from an observed tree is kept alive for a subtree observation.
960
961         No new test since the test which can reproduce this problem is too slow.
962
963         * dom/GCReachableRef.h:
964         (WebCore::GCReachableRef): Made it work with hash table.
965         (WebCore::GCReachableRef::operator T& const):
966         (WebCore::GCReachableRef::GCReachableRef):
967         (WebCore::GCReachableRef::isHashTableDeletedValue const):
968         (WebCore::GCReachableRef::isHashTableEmptyValue const):
969         (WebCore::GCReachableRef::ptrAllowingHashTableEmptyValue const):
970         (WebCore::GCReachableRef::ptrAllowingHashTableEmptyValue):
971         (WebCore::GCReachableRef::assignToHashTableEmptyValue):
972         (WTF::HashTraits<WebCore::GCReachableRef<P>>::emptyValue):
973         (WTF::HashTraits<WebCore::GCReachableRef<P>>::constructEmptyValue):
974         (WTF::HashTraits<WebCore::GCReachableRef<P>>::isEmptyValue):
975         (WTF::HashTraits<WebCore::GCReachableRef<P>>::assignToEmpty):
976         (WTF::HashTraits<WebCore::GCReachableRef<P>>::peek):
977         (WTF::HashTraits<WebCore::GCReachableRef<P>>::take):
978         * dom/MutationObserver.cpp:
979         (WebCore::MutationObserver::takeRecords): Don't clear m_pendingTargets because that would allow wrappers
980         to be collected before elements in mutation records are accessed. We delay until the end of the current
981         microtask at which point deliver() function is called.
982         (WebCore::MutationObserver::disconnect):
983         (WebCore::MutationObserver::enqueueMutationRecord): Add the target to the list of elements to keep alive.
984         This is needed for a newly inserted node, a node with attribute change, etc...
985         (WebCore::MutationObserver::deliver): Keep the set of transient registration targets alive until mutation
986         records are delivered to each observer. These are nodes which had been removed from a tree and whose
987         subtree had still been obsreved up until this point.
988         * dom/MutationObserver.h:
989         * dom/MutationObserverRegistration.cpp:
990         (WebCore::MutationObserverRegistration::observedSubtreeNodeWillDetach):
991         (WebCore::MutationObserverRegistration::takeTransientRegistrations): Return the hash set of elemenets
992         that need to be kept alive so that MutationObserver::deliver can keep them alive until the deliver
993         function had been called.
994         (WebCore::MutationObserverRegistration::addRegistrationNodesToSet const):
995         * dom/MutationObserverRegistration.h:
996
997 2018-10-03  Dean Jackson  <dino@apple.com>
998
999         Make the Pointer Events feature description valid
1000         https://bugs.webkit.org/show_bug.cgi?id=190254
1001
1002         Reviewed by Simon Fraser.
1003
1004         * features.json:
1005
1006 2018-10-03  Matt Lewis  <jlewis3@apple.com>
1007
1008         Unreviewed, rolling out r236781.
1009
1010         The test added with this commit is timing out consistently.
1011
1012         Reverted changeset:
1013
1014         "GC can collect JS wrappers of nodes in the mutation records
1015         waiting to be delivered"
1016         https://bugs.webkit.org/show_bug.cgi?id=190115
1017         https://trac.webkit.org/changeset/236781
1018
1019 2018-10-03  Dean Jackson  <dino@apple.com>
1020
1021         [macOS] Switching to discrete GPU should be done in the UI process
1022         https://bugs.webkit.org/show_bug.cgi?id=189361
1023         <rdar://problem/43949622>
1024
1025         Try to fix the IOSMAC build.
1026
1027         * platform/graphics/GraphicsContext3D.h:
1028
1029 2018-10-03  Chris Dumez  <cdumez@apple.com>
1030
1031         input.checked is incorrect while we're parsing its children
1032         https://bugs.webkit.org/show_bug.cgi?id=190227
1033
1034         Reviewed by Ryosuke Niwa.
1035
1036         input.checked was incorrect while we're parsing its children because we were delaying updating the
1037         checked state until HTMLInputElement::finishParsingChildren() is called, to avoid a bad interaction
1038         with form state restoration.
1039
1040         In this patch, we update the checked state as soon as the 'checked' attribute is set, when we know
1041         that no form state to restore.
1042
1043         fast/forms/radio/state-restore-radio-group.html covers the form restoration case and is still
1044         passing.
1045
1046         No new tests, rebaselined existing test.
1047
1048         * html/FormController.cpp:
1049         (WebCore::FormController::hasFormStateToRestore const):
1050         * html/FormController.h:
1051         * html/HTMLInputElement.cpp:
1052         (WebCore::HTMLInputElement::parseAttribute):
1053
1054 2018-10-03  Miguel Gomez  <magomez@igalia.com>
1055
1056         [GTK][WPE] Incorrect rendering of layers whose backingStore hasn't changed
1057         https://bugs.webkit.org/show_bug.cgi?id=190249
1058
1059         Reviewed by Žan Doberšek.
1060
1061         Do not overwrite m_nicosia.performLayerSync when updating the content buffers or we lose
1062         the value calculated during the layer flush. Use an OR instead to keep the old value.
1063
1064         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1065         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
1066
1067 2018-10-03  Youenn Fablet  <youenn@apple.com>
1068
1069         Enable H264 simulcast
1070         https://bugs.webkit.org/show_bug.cgi?id=190167
1071
1072         Reviewed by Eric Carlson.
1073
1074         Activate H264 simulcast trial field.
1075         Make track.getSettings() expose width and height for incoming tracks.
1076
1077         Test: webrtc/simulcast-h264.html
1078
1079         * Configurations/WebCore.xcconfig:
1080         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1081         (WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint):
1082         * platform/mediastream/RealtimeIncomingVideoSource.cpp:
1083         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
1084
1085 2018-10-03  Michael Catanzaro  <mcatanzaro@igalia.com>
1086
1087         -Wunused-variable in RenderLayer::updateScrollableAreaSet
1088         https://bugs.webkit.org/show_bug.cgi?id=190200
1089
1090         Reviewed by Yusuke Suzuki.
1091
1092         Pass it through UNUSED_VARIABLE().
1093
1094         * rendering/RenderLayer.cpp:
1095         (WebCore::RenderLayer::calculateClipRects const):
1096
1097 2018-10-03  Zan Dobersek  <zdobersek@igalia.com>
1098
1099         Ref<FetchResponse> use-after-move in DOMCache::put()
1100         https://bugs.webkit.org/show_bug.cgi?id=190239
1101
1102         Reviewed by Youenn Fablet.
1103
1104         Retrieve reference from the Ref<FetchResponse> object before it's
1105         move-captured in the lambda that's passed to the
1106         FetchResponse::consumeBodyReceivedByChunk() method that is invoked on
1107         that very same object. This is a classic use-after-move bug that pops
1108         up on compilers with different C++ calling convention.
1109
1110         * Modules/cache/DOMCache.cpp:
1111         (WebCore::DOMCache::put):
1112
1113 2018-10-03  Ryosuke Niwa  <rniwa@webkit.org>
1114
1115         Enable selectionAcrossShadowBoundariesEnabled by default in WebKitLegacy
1116         https://bugs.webkit.org/show_bug.cgi?id=190238
1117
1118         Reviewed by Antti Koivisto.
1119
1120         Enable the feature by default.
1121
1122         * page/Settings.yaml:
1123
1124 2018-10-02  Ryosuke Niwa  <rniwa@webkit.org>
1125
1126         Copying content with shadow DOM doesn't copy any contents
1127         https://bugs.webkit.org/show_bug.cgi?id=157443
1128
1129         Reviewed by Wenson Hsieh.
1130
1131         This patch adds the support for copying and pasting content across shadow boundaries in HTML and plain text,
1132         which is enabled whenever selection across shadow boundaries is enabled.
1133
1134         To do this, TextIterator now has a constructor which takes two Positions, and the node traversal code in
1135         StyledMarkupAccumulator has been abstracted via helper functions as done for TextIterator.
1136
1137         When serializing a HTMl slot element, serialize it as a span with "display: contents" to make sure when
1138         the content is pasted into a shadow tree, it wouldn't affect the slot assignment of the shadow tree.
1139
1140         Tests: editing/pasteboard/copy-paste-across-shadow-boundaries-1.html
1141                editing/pasteboard/copy-paste-across-shadow-boundaries-2.html
1142                editing/pasteboard/copy-paste-across-shadow-boundaries-3.html
1143                editing/pasteboard/copy-paste-across-shadow-boundaries-4.html
1144                editing/pasteboard/copy-paste-across-shadow-boundaries-with-style-1.html
1145                editing/pasteboard/copy-paste-across-shadow-boundaries-with-style-2.html
1146                editing/pasteboard/copy-paste-with-shadow-content.html
1147
1148         * dom/ComposedTreeIterator.h:
1149         (WebCore::assignedSlotIgnoringUserAgentShadow): Moved from TextIterator.cpp.
1150         (WebCore::shadowRootIgnoringUserAgentShadow): Ditto.
1151         (WebCore::firstChildInComposedTreeIgnoringUserAgentShadow): Ditto.
1152         (WebCore::nextSiblingInComposedTreeIgnoringUserAgentShadow): Ditto.
1153         * dom/Position.h:
1154         (WebCore::Position::treeScope const): Added.
1155         * editing/EditingStyle.cpp:
1156         (WebCore::EditingStyle::addDisplayContents): Added.
1157         * editing/EditingStyle.h:
1158         * editing/Editor.cpp:
1159         (WebCore::Editor::selectedText const): Use the new behavior when selectionAcrossShadowBoundariesEnabled is set.
1160         (WebCore::Editor::selectedTextForDataTransfer const): Ditto.
1161         * editing/MarkupAccumulator.cpp:
1162         (WebCore::MarkupAccumulator::appendEndElement): Renamed from appendEndTag. Now takes StringBuilder.
1163         * editing/MarkupAccumulator.h:
1164         (WebCore::MarkupAccumulator::appendEndTag):
1165         * editing/TextIterator.cpp:
1166         (WebCore::TextIterator::TextIterator): Added a new variant which takes two positions.
1167         (WebCore::TextIterator::init):
1168         (WebCore::firstChild):
1169         (WebCore::nextSibling):
1170         (WebCore::plainText): Ditto.
1171         * editing/TextIterator.h:
1172         * editing/cocoa/EditorCocoa.mm:
1173         (WebCore::Editor::selectionInHTMLFormat): Use the new behavior if selectionAcrossShadowBoundariesEnabled is set.
1174         * editing/gtk/EditorGtk.cpp:
1175         (WebCore::Editor::writeSelectionToPasteboard): Ditto.
1176         * editing/markup.cpp:
1177         (WebCore::StyledMarkupAccumulator::parentNode): Added.
1178         (WebCore::StyledMarkupAccumulator::firstChild): Added.
1179         (WebCore::StyledMarkupAccumulator::nextSibling): Added.
1180         (WebCore::StyledMarkupAccumulator::nextSkippingChildren): Added.
1181         (WebCore::StyledMarkupAccumulator::hasChildNodes): Added.
1182         (WebCore::StyledMarkupAccumulator::isDescendantOf): Added.
1183         (WebCore::StyledMarkupAccumulator::StyledMarkupAccumulator):
1184         (WebCore::StyledMarkupAccumulator::appendElement): Serialize a slot element as a span with display: contents.
1185         (WebCore::StyledMarkupAccumulator::appendEndElement): Added. Ditto.
1186         (WebCore::StyledMarkupAccumulator::serializeNodes):
1187         (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization): Use the newly added helper functions to
1188         traverse the composed tree when m_useComposedTree is set.
1189         (WebCore::commonShadowIncludingAncestor): Added.
1190         (WebCore::serializePreservingVisualAppearanceInternal): Added SerializeComposedTree as an argument. Also use
1191         StyledMarkupAccumulator::parentNode to serialize special common ancestors; e.g. to preserve b, i, etc...
1192         (WebCore::serializePreservingVisualAppearance): Ditto to the variant which takes VisibleSelection.
1193         (WebCore::sanitizedMarkupForFragmentInDocument):
1194         * editing/markup.h:
1195         * editing/wpe/EditorWPE.cpp:
1196         (WebCore::Editor::writeSelectionToPasteboard):
1197         * loader/archive/cf/LegacyWebArchive.cpp:
1198         (WebCore::LegacyWebArchive::createFromSelection):
1199         * page/PageSerializer.cpp:
1200         (WebCore::PageSerializer::SerializerMarkupAccumulator::appendEndElement):
1201         * testing/Internals.cpp:
1202         (WebCore::Internals::setSelectionWithoutValidation): Added. A helper function to create a selection across
1203         shadow boundaries for testing purposes.
1204         * testing/Internals.h:
1205         * testing/Internals.idl:
1206
1207 2018-10-02  Chris Dumez  <cdumez@apple.com>
1208
1209         MessageEvent.ports should return the same object
1210         https://bugs.webkit.org/show_bug.cgi?id=190151
1211
1212         Reviewed by Darin Adler.
1213
1214         MessageEvent.ports should return the same object it was initialized to instead of
1215         constructing a new JSValue every time.
1216
1217         No new tests, rebaselined existing test.
1218
1219         * bindings/js/JSMessageEventCustom.cpp:
1220         (WebCore::JSMessageEvent::ports const):
1221         (WebCore::JSMessageEvent::visitAdditionalChildren):
1222         * dom/MessageEvent.cpp:
1223         (WebCore::MessageEvent::initMessageEvent):
1224         * dom/MessageEvent.h:
1225         * dom/MessageEvent.idl:
1226
1227 2018-10-01  Ryosuke Niwa  <rniwa@webkit.org>
1228
1229         GC can collect JS wrappers of nodes in the mutation records waiting to be delivered
1230         https://bugs.webkit.org/show_bug.cgi?id=190115
1231
1232         Reviewed by Geoffrey Garen.
1233
1234         Fixed the bug by retaining JS wrappers of elements in mutation records using GCReachableRef.
1235
1236         This patch deploys GCReachableRef in two places: MutationObserver where each mutation record's
1237         target is kept alive and MutationObserverRegistration where each node which had been removed
1238         from an observed tree is kept alive for a subtree observation.
1239
1240         Test: fast/dom/MutationObserver/mutation-observer-retains-js-wrappers-of-targets-alive.html
1241
1242         * dom/GCReachableRef.h:
1243         (WebCore::GCReachableRef): Made it work with hash table.
1244         (WebCore::GCReachableRef::operator T& const):
1245         (WebCore::GCReachableRef::GCReachableRef):
1246         (WebCore::GCReachableRef::isHashTableDeletedValue const):
1247         (WebCore::GCReachableRef::isHashTableEmptyValue const):
1248         (WebCore::GCReachableRef::ptrAllowingHashTableEmptyValue const):
1249         (WebCore::GCReachableRef::ptrAllowingHashTableEmptyValue):
1250         (WebCore::GCReachableRef::assignToHashTableEmptyValue):
1251         (WTF::HashTraits<WebCore::GCReachableRef<P>>::emptyValue):
1252         (WTF::HashTraits<WebCore::GCReachableRef<P>>::constructEmptyValue):
1253         (WTF::HashTraits<WebCore::GCReachableRef<P>>::isEmptyValue):
1254         (WTF::HashTraits<WebCore::GCReachableRef<P>>::assignToEmpty):
1255         (WTF::HashTraits<WebCore::GCReachableRef<P>>::peek):
1256         (WTF::HashTraits<WebCore::GCReachableRef<P>>::take):
1257         * dom/MutationObserver.cpp:
1258         (WebCore::MutationObserver::takeRecords): Don't clear m_pendingTargets because that would allow wrappers
1259         to be collected before elements in mutation records are accessed. We delay until the end of the current
1260         microtask at which point deliver() function is called.
1261         (WebCore::MutationObserver::disconnect):
1262         (WebCore::MutationObserver::enqueueMutationRecord): Add the target to the list of elements to keep alive.
1263         This is needed for a newly inserted node, a node with attribute change, etc...
1264         (WebCore::MutationObserver::deliver): Keep the set of transient registration targets alive until mutation
1265         records are delivered to each observer. These are nodes which had been removed from a tree and whose
1266         subtree had still been obsreved up until this point.
1267         * dom/MutationObserver.h:
1268         * dom/MutationObserverRegistration.cpp:
1269         (WebCore::MutationObserverRegistration::observedSubtreeNodeWillDetach):
1270         (WebCore::MutationObserverRegistration::takeTransientRegistrations): Return the hash set of elemenets
1271         that need to be kept alive so that MutationObserver::deliver can keep them alive until the deliver
1272         function had been called.
1273         (WebCore::MutationObserverRegistration::addRegistrationNodesToSet const):
1274         * dom/MutationObserverRegistration.h:
1275
1276 2018-10-02  Chris Dumez  <cdumez@apple.com>
1277
1278         radio / checkbox inputs should fire "click, input, change" events in order when clicked
1279         https://bugs.webkit.org/show_bug.cgi?id=190223
1280
1281         Reviewed by Ryosuke Niwa.
1282
1283         radio / checkbox inputs should fire "click, input, change" events in order when clicked:
1284         - https://html.spec.whatwg.org/#radio-button-state-(type=radio)
1285         - https://html.spec.whatwg.org/#checkbox-state-(type=checkbox)
1286         - https://dom.spec.whatwg.org/#ref-for-eventtarget-activation-behavior③ (step 11)
1287
1288         Gecko and Blink already behave this way. However, WebKit has the following issues:
1289         - the input event is not fired
1290         - the click event is fired after the change event
1291
1292         No new tests, updated / rebaselined existing tests.
1293
1294         * html/BaseCheckableInputType.cpp:
1295         (WebCore::BaseCheckableInputType::fireInputAndChangeEvents):
1296         * html/BaseCheckableInputType.h:
1297         * html/CheckboxInputType.cpp:
1298         (WebCore::CheckboxInputType::willDispatchClick):
1299         (WebCore::CheckboxInputType::didDispatchClick):
1300         * html/HTMLInputElement.cpp:
1301         (WebCore::HTMLInputElement::setChecked):
1302         * html/HTMLInputElement.h:
1303         * html/RadioInputType.cpp:
1304         (WebCore::RadioInputType::willDispatchClick):
1305         (WebCore::RadioInputType::didDispatchClick):
1306
1307 2018-10-02  Chris Dumez  <cdumez@apple.com>
1308
1309         fieldset.elements should return an HTMLCollection instead of an HTMLFormControlsCollection
1310         https://bugs.webkit.org/show_bug.cgi?id=190218
1311
1312         Reviewed by Alex Christensen.
1313
1314         fieldset.elements should return an HTMLCollection instead of an HTMLFormControlsCollection:
1315         - https://github.com/whatwg/html/commit/8beedf0c2ffd38853caddec67490288f47afc8eb
1316
1317         Gecko has always behaved this way. Blink aligned with Gecko and the HTML specification in December 2016:
1318         - https://bugs.chromium.org/p/chromium/issues/detail?id=665291
1319
1320         This simplifies our HTMLFieldSetElement code a lot.
1321
1322         Test: fast/forms/fieldset/fieldset-elements-htmlcollection.html
1323
1324         * html/CollectionType.h:
1325         * html/GenericCachedHTMLCollection.cpp:
1326         (WebCore::GenericCachedHTMLCollection<traversalType>::elementMatches const):
1327         * html/HTMLCollection.cpp:
1328         (WebCore::HTMLCollection::rootTypeFromCollectionType):
1329         (WebCore::invalidationTypeExcludingIdAndNameAttributes):
1330         * html/HTMLFieldSetElement.cpp:
1331         (WebCore::HTMLFieldSetElement::elements):
1332         * html/HTMLFieldSetElement.h:
1333         * html/HTMLFieldSetElement.idl:
1334         * html/HTMLFormControlsCollection.cpp:
1335         (WebCore::HTMLFormControlsCollection::HTMLFormControlsCollection):
1336         (WebCore:: const):
1337         (WebCore::HTMLFormControlsCollection::copyFormControlElementsVector const):
1338         (WebCore::HTMLFormControlsCollection::ownerNode const):
1339         (WebCore::HTMLFormControlsCollection::updateNamedElementCache const):
1340         * html/HTMLFormControlsCollection.h:
1341
1342 2018-10-02  Devin Rousso  <drousso@apple.com>
1343
1344         Web Inspector: prevent layer events from firing until the layer information is re-requested
1345         https://bugs.webkit.org/show_bug.cgi?id=190159
1346
1347         Reviewed by Joseph Pecoraro.
1348
1349         Test: inspector/layers/layerTreeDidChange.html
1350
1351         * inspector/agents/InspectorLayerTreeAgent.h:
1352         * inspector/agents/InspectorLayerTreeAgent.cpp:
1353         (WebCore::InspectorLayerTreeAgent::reset):
1354         (WebCore::InspectorLayerTreeAgent::layerTreeDidChange):
1355         (WebCore::InspectorLayerTreeAgent::layersForNode):
1356
1357 2018-10-02  Brian Burg  <bburg@apple.com>
1358
1359         Web Automation: tab default key handler should always cycle focus when page is controlled by automation
1360         https://bugs.webkit.org/show_bug.cgi?id=190221
1361         <rdar://problem/44914534>
1362
1363         Reviewed by Joseph Pecoraro.
1364
1365         This change progresses WPT WebDriver test special_keys.py::test_webdriver_special_key_sends_keydown[TAB-expected24].
1366
1367         * page/FocusController.cpp:
1368         (WebCore::FocusController::advanceFocusInDocumentOrder):
1369         Always cycle focus if the page is controlled by automation. If the chrome takes
1370         focus, then the first responder will be something other than the WebView, which
1371         causes subsequent WebDriver commands to hang.
1372
1373 2018-10-01  Dean Jackson  <dino@apple.com>
1374
1375         [macOS] Switching to discrete GPU should be done in the UI process
1376         https://bugs.webkit.org/show_bug.cgi?id=189361
1377         <rdar://problem/43949622>
1378
1379         Reviewed by Simon Fraser.
1380
1381         Based on an earlier patch by Per Arne Vollan.
1382
1383         Due to the fact we can't talk to the Window Server, the Web Process can
1384         no longer muxing to the discrete GPU directly. Instead we have to get the
1385         UI Process to process the change. Do this by adding a new Chrome client
1386         called GPUClient, that will have implementations provided by both WebKit
1387         and legacy WebKit.
1388
1389         Unfortunately this can't be tested by a regular WKTR since:
1390         - it requires specific hardware
1391         - swapping to/from the discrete GPU takes about 20 seconds
1392         - running concurrent tests could confuse the tests into thinking
1393           the wrong GPU is active
1394
1395         Instead we'll write a specific test for this functionality and
1396         run it on a separate bot.
1397
1398         * WebCore.xcodeproj/project.pbxproj: Add GPUClient files.
1399
1400         * page/Chrome.cpp: Drive by clean-up.
1401         (WebCore::Chrome::windowScreenDidChange):
1402
1403         * platform/graphics/GraphicsContext3D.h: We need to keep track of
1404         whether we've muxed for this context, in order to not respond to
1405         the screen change notifications (they are misleading in the case
1406         of muxing).
1407
1408         * platform/graphics/GraphicsContext3DManager.cpp: Rather than try
1409         to mux directly, call into GPUClient.
1410         (WebCore::GraphicsContext3DManager::displayWasReconfigured):
1411         (WebCore::GraphicsContext3DManager::updateHighPerformanceState):
1412         (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired):
1413         (WebCore::GraphicsContext3DManager::recycleContextIfNecessary):
1414         * platform/graphics/GraphicsContext3DManager.h:
1415
1416         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm: Only reconfigure
1417         the virtual display if it didn't happen from muxing.
1418         (WebCore::GraphicsContext3D::GraphicsContext3D):
1419         (WebCore::GraphicsContext3D::updateCGLContext):
1420         (WebCore::GraphicsContext3D::screenDidChange):
1421
1422         * platform/graphics/mac/SwitchingGPUClient.cpp: Added.
1423         (WebCore::SwitchingGPUClient::singleton):
1424         (WebCore::SwitchingGPUClient::setSingleton):
1425         * platform/graphics/mac/SwitchingGPUClient.h: Added.
1426
1427         * testing/Internals.cpp: Testing helper.
1428         (WebCore::Internals::hasMuxableGPU):
1429         * testing/Internals.h:
1430         * testing/Internals.idl:
1431
1432 2018-10-02  Chris Dumez  <cdumez@apple.com>
1433
1434         Image.__proto__ should be Function.prototype, not HTMLElement.prototype
1435         https://bugs.webkit.org/show_bug.cgi?id=190216
1436
1437         Reviewed by Alex Christensen.
1438
1439         Properties created for named constructors should always use Function.prototype as prototype, as per:
1440         - https://heycam.github.io/webidl/#named-constructors
1441
1442         Gecko and Blink agree with the Web IDL specification. However, WebKit was using the parent interface's
1443         prototype if such a parent existing. So Image.__proto__ would end up being HTMLElement.prototype
1444         instead of Function.prototype.
1445
1446         No new tests, rebaselined existing test.
1447
1448         * bindings/scripts/CodeGeneratorJS.pm:
1449         (GenerateConstructorHelperMethods):
1450
1451 2018-10-02  Alex Christensen  <achristensen@webkit.org>
1452
1453         Prepare WebCoreNSURLExtras for ARC
1454         https://bugs.webkit.org/show_bug.cgi?id=190219
1455
1456         Reviewed by Tim Horton.
1457
1458         ARC doesn't like the explicit sending of -release.
1459         Use RetainPtr instead.
1460
1461         * platform/mac/WebCoreNSURLExtras.mm:
1462         (WebCore::collectRangesThatNeedMapping):
1463         (WebCore::collectRangesThatNeedEncoding):
1464         (WebCore::collectRangesThatNeedDecoding):
1465         (WebCore::applyHostNameFunctionToMailToURLString):
1466         (WebCore::applyHostNameFunctionToURLString):
1467         (WebCore::mapHostNames):
1468         (WebCore::stringByTrimmingWhitespace):
1469         (WebCore::URLWithUserTypedString):
1470         (WebCore::userVisibleString):
1471         (WebCore::rangeOfURLScheme):
1472         (WebCore::looksLikeAbsoluteURL):
1473         (WebCore::retain): Deleted.
1474
1475 2018-10-02  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1476
1477         [Curl] Fix missing values of  resource timing API.
1478         https://bugs.webkit.org/show_bug.cgi?id=190193
1479
1480         Reviewed by Alex Christensen.
1481
1482         The property nextHopProtocol was not returned correctly. It was
1483         returned only when remote inspector is opened.
1484
1485         Tests: http/wpt/resource-timing/rt-nextHopProtocol.html
1486                http/wpt/resource-timing/rt-nextHopProtocol.worker.html
1487
1488         * platform/network/curl/CurlContext.cpp:
1489         (WebCore::CurlHandle::getNetworkLoadMetrics):
1490         (WebCore::CurlHandle::addExtraNetworkLoadMetrics):
1491
1492 2018-10-02  Alex Christensen  <achristensen@webkit.org>
1493
1494         Remove unused linked-on-or-before-iOS5 check
1495         https://bugs.webkit.org/show_bug.cgi?id=190164
1496
1497         Reviewed by Michael Saboff.
1498
1499         If an app hasn't been updated since iOS5, it can't run supported iOS.
1500         This value is also only checked in an uninstantiated template function.
1501
1502         * platform/URL.cpp:
1503         (WebCore::enableURLSchemeCanonicalization): Deleted.
1504         (WebCore::equal): Deleted.
1505         * platform/URL.h:
1506
1507 2018-10-02  Alex Christensen  <achristensen@webkit.org>
1508
1509         Remove ParsedURLString
1510         https://bugs.webkit.org/show_bug.cgi?id=190154
1511
1512         Reviewed by Chris Dumez.
1513
1514         Before the introduction of URLParser, it would indicate that we should assume the String
1515         is from a valid URL so we can skip canonicalization and just find the offsets inside the String
1516         to quickly create a URL.  It was a performance optimization that caused security issues when
1517         misused.  Since the introduction of URLParser, we have a fast path for all URL parsing, so
1518         right now it actually doesn't change any behavior.  It's just a relic of the past that complicates
1519         the URL class, making it harder to express which constructor to use and making it harder to move
1520         the class.
1521
1522         * Modules/navigatorcontentutils/NavigatorContentUtils.cpp:
1523         (WebCore::NavigatorContentUtils::registerProtocolHandler):
1524         (WebCore::NavigatorContentUtils::isProtocolHandlerRegistered):
1525         (WebCore::NavigatorContentUtils::unregisterProtocolHandler):
1526         * dom/Document.cpp:
1527         (WebCore::Document::updateBaseURL):
1528         (WebCore::Document::initSecurityContext):
1529         * dom/ExtensionStyleSheets.cpp:
1530         (WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache const):
1531         * dom/ProcessingInstruction.cpp:
1532         (WebCore::ProcessingInstruction::checkStyleSheet):
1533         * editing/markup.cpp:
1534         (WebCore::completeURLs):
1535         * fileapi/BlobURL.cpp:
1536         (WebCore::BlobURL::createBlobURL):
1537         * history/HistoryItem.cpp:
1538         (WebCore::HistoryItem::url const):
1539         (WebCore::HistoryItem::originalURL const):
1540         * html/HTMLFrameElementBase.cpp:
1541         (WebCore::HTMLFrameElementBase::location const):
1542         * html/HTMLMediaElement.cpp:
1543         (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
1544         * html/PublicURLManager.cpp:
1545         (WebCore::PublicURLManager::stop):
1546         * inspector/InspectorStyleSheet.cpp:
1547         (WebCore::InspectorStyleSheet::resourceStyleSheetText const):
1548         * inspector/agents/InspectorPageAgent.cpp:
1549         (WebCore::InspectorPageAgent::getCookies):
1550         (WebCore::InspectorPageAgent::deleteCookie):
1551         (WebCore::InspectorPageAgent::getResourceContent):
1552         (WebCore::InspectorPageAgent::searchInResource):
1553         * inspector/agents/page/PageDebuggerAgent.cpp:
1554         (WebCore::PageDebuggerAgent::sourceMapURLForScript):
1555         * loader/DocumentLoader.cpp:
1556         (WebCore::DocumentLoader::subresources const):
1557         * loader/FrameLoader.cpp:
1558         (WebCore::FrameLoader::init):
1559         (WebCore::FrameLoader::initForSynthesizedDocument):
1560         * loader/HistoryController.cpp:
1561         (WebCore::HistoryController::pushState):
1562         (WebCore::HistoryController::replaceState):
1563         * loader/appcache/ApplicationCache.cpp:
1564         (WebCore::ApplicationCache::addResource):
1565         (WebCore::ApplicationCache::resourceForURL):
1566         * loader/appcache/ApplicationCacheGroup.cpp:
1567         (WebCore::ApplicationCacheGroup::startLoadingEntry):
1568         (WebCore::ApplicationCacheGroup::addEntry):
1569         * loader/appcache/ApplicationCacheStorage.cpp:
1570         (WebCore::ApplicationCacheStorage::cacheGroupForURL):
1571         (WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL):
1572         (WebCore::ApplicationCacheStorage::loadCache):
1573         (WebCore::ApplicationCacheStorage::manifestURLs):
1574         * loader/archive/cf/LegacyWebArchive.cpp:
1575         (WebCore::LegacyWebArchive::create):
1576         * page/DOMWindow.cpp:
1577         (WebCore::DOMWindow::createWindow):
1578         * page/PageSerializer.cpp:
1579         (WebCore::PageSerializer::urlForBlankFrame):
1580         * platform/URL.cpp:
1581         (WebCore::blankURL):
1582         * platform/URL.h:
1583         (): Deleted.
1584         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
1585         (WebCore::MediaPlayerPrivateAVFoundation::load):
1586         * platform/network/BlobRegistryImpl.cpp:
1587         (WebCore::BlobRegistryImpl::populateBlobsForFileWriting):
1588         * platform/network/ResourceRequestBase.h:
1589         (WebCore::ResourceRequestBase::decodeBase):
1590         * platform/network/ResourceResponseBase.cpp:
1591         (WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
1592         * platform/network/cf/DNSResolveQueueCFNet.cpp:
1593         (WebCore::DNSResolveQueueCFNet::updateIsUsingProxy):
1594         * platform/network/cf/ResourceRequest.h:
1595         (WebCore::ResourceRequest::ResourceRequest):
1596         * platform/network/curl/CookieJarDB.cpp:
1597         (WebCore::CookieJarDB::searchCookies):
1598         (WebCore::CookieJarDB::setCookie):
1599         (WebCore::CookieJarDB::deleteCookie):
1600         * platform/network/curl/ResourceRequest.h:
1601         (WebCore::ResourceRequest::ResourceRequest):
1602         * platform/network/soup/ResourceRequest.h:
1603         (WebCore::ResourceRequest::ResourceRequest):
1604         * xml/XSLTProcessorLibxslt.cpp:
1605         (WebCore::docLoaderFunc):
1606
1607 2018-10-02  Per Arne Vollan  <pvollan@apple.com>
1608
1609         [WebVTT] Cue with line setting is not rendered correctly
1610         https://bugs.webkit.org/show_bug.cgi?id=190168
1611
1612         Reviewed by Eric Carlson.
1613
1614         When the line setting contains an optional alignment value, the cue is not rendered at the correct position,
1615         see https://w3c.github.io/webvtt/#webvtt-line-cue-setting. This patch does not implement correct handling of
1616         the line setting alignment values, it only makes sure parsing does not fail when the cue has line alignment
1617         settings.
1618
1619         Test: media/track/track-cue-line-position.html
1620
1621         * html/track/VTTCue.cpp:
1622         (WebCore::VTTCueBox::applyCSSProperties):
1623         (WebCore::VTTCue::getPositionCoordinates const):
1624         (WebCore::VTTCue::setCueSettings):
1625
1626 2018-10-02  Antti Koivisto  <antti@apple.com>
1627
1628         User installed fonts are not always disabled when they should be
1629         https://bugs.webkit.org/show_bug.cgi?id=190195
1630
1631         Reviewed by Geoffrey Garen.
1632
1633         SVG images and some theme cases fail to respect the setting. Besides the obvious problem this
1634         is also a performance issue as various font caches include this setting in the key.
1635
1636         * platform/graphics/FontDescription.cpp:
1637         (WebCore::m_shouldAllowUserInstalledFonts):
1638
1639         Initialize to 'No' by default. All paths where user fonts make sense already set the bit from
1640         settings. This fixes some cases in system themes that construct FontDescriptions from scratch.
1641
1642         * rendering/RenderElement.cpp:
1643         (WebCore::RenderElement::styleWillChange):
1644
1645         Add assertion. This verified the change with the existing tests.
1646
1647         * svg/graphics/SVGImage.cpp:
1648         (WebCore::SVGImage::dataChanged):
1649
1650         Always disallow user fonts in SVG used as images.
1651
1652 2018-10-01  Dean Jackson  <dino@apple.com>
1653
1654         Remove CSS Animation Triggers
1655         https://bugs.webkit.org/show_bug.cgi?id=190175
1656         <rdar://problem/44925626>
1657
1658         Reviewed by Simon Fraser.
1659
1660         Remove the never-properly specified CSS Animation Triggers.
1661
1662         * Configurations/FeatureDefines.xcconfig:
1663         * Sources.txt:
1664         * WebCore.xcodeproj/project.pbxproj:
1665         * css/CSSAnimationTriggerScrollValue.cpp: Removed.
1666         * css/CSSAnimationTriggerScrollValue.h: Removed.
1667         * css/CSSComputedStyleDeclaration.cpp:
1668         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
1669         (WebCore::createAnimationTriggerValue): Deleted.
1670         (WebCore::animationTriggerValue): Deleted.
1671         * css/CSSProperties.json:
1672         * css/CSSToStyleMap.cpp:
1673         (WebCore::CSSToStyleMap::mapAnimationTrigger): Deleted.
1674         * css/CSSToStyleMap.h:
1675         * css/CSSValue.cpp:
1676         (WebCore::CSSValue::equals const):
1677         (WebCore::CSSValue::cssText const):
1678         (WebCore::CSSValue::destroy):
1679         * css/CSSValue.h:
1680         (WebCore::CSSValue::isAnimationTriggerScrollValue const): Deleted.
1681         * css/parser/CSSPropertyParser.cpp:
1682         (WebCore::consumeAnimationValue):
1683         (WebCore::CSSPropertyParser::parseSingleValue):
1684         (WebCore::consumeWebkitAnimationTrigger): Deleted.
1685         * page/FrameView.cpp:
1686         (WebCore::FrameView::sendScrollEvent):
1687         * page/RuntimeEnabledFeatures.h:
1688         (WebCore::RuntimeEnabledFeatures::setAnimationTriggersEnabled): Deleted.
1689         (WebCore::RuntimeEnabledFeatures::animationTriggersEnabled const): Deleted.
1690         * page/animation/AnimationBase.cpp:
1691         (WebCore::AnimationBase::updateStateMachine):
1692         (WebCore::AnimationBase::fireAnimationEventsIfNeeded):
1693         (WebCore::AnimationBase::timeToNextService):
1694         (WebCore::AnimationBase::getElapsedTime const):
1695         * page/animation/CSSAnimationController.cpp:
1696         (WebCore::CSSAnimationControllerPrivate::animationWillBeRemoved):
1697         (WebCore::CSSAnimationControllerPrivate::addToAnimationsDependentOnScroll): Deleted.
1698         (WebCore::CSSAnimationControllerPrivate::removeFromAnimationsDependentOnScroll): Deleted.
1699         (WebCore::CSSAnimationControllerPrivate::scrollWasUpdated): Deleted.
1700         (WebCore::CSSAnimationController::wantsScrollUpdates const): Deleted.
1701         (WebCore::CSSAnimationController::scrollWasUpdated): Deleted.
1702         * page/animation/CSSAnimationController.h:
1703         * page/animation/CSSAnimationControllerPrivate.h:
1704         (WebCore::CSSAnimationControllerPrivate::wantsScrollUpdates const): Deleted.
1705         (WebCore::CSSAnimationControllerPrivate::scrollPosition const): Deleted.
1706         * page/animation/CompositeAnimation.cpp:
1707         (WebCore::CompositeAnimation::updateKeyframeAnimations):
1708         * page/animation/CompositeAnimation.h:
1709         (WebCore::CompositeAnimation::hasScrollTriggeredAnimation const): Deleted.
1710         * platform/animation/Animation.cpp:
1711         (WebCore::Animation::Animation):
1712         (WebCore::Animation::operator=):
1713         (WebCore::Animation::animationsMatch const):
1714         * platform/animation/Animation.h:
1715         (WebCore::Animation::isTimingFunctionSet const):
1716         (WebCore::Animation::isEmpty const):
1717         (WebCore::Animation::clearTimingFunction):
1718         (WebCore::Animation::clearAll):
1719         (WebCore::Animation::animationMode const):
1720         (WebCore::Animation::setAnimationMode):
1721         (WebCore::Animation::initialTimingFunction):
1722         (WebCore::Animation::isTriggerSet const): Deleted.
1723         (WebCore::Animation::clearTrigger): Deleted.
1724         (WebCore::Animation::trigger const): Deleted.
1725         (WebCore::Animation::setTrigger): Deleted.
1726         (WebCore::Animation::initialTrigger): Deleted.
1727         * platform/animation/AnimationTrigger.h: Removed.
1728         * platform/graphics/ca/GraphicsLayerCA.cpp:
1729         (WebCore::GraphicsLayerCA::animationCanBeAccelerated const):
1730 2018-10-02  Commit Queue  <commit-queue@webkit.org>
1731
1732         Unreviewed, rolling out r236624 and r236671.
1733         https://bugs.webkit.org/show_bug.cgi?id=190207
1734
1735         The change in r236624 introduced crashes on the bots
1736         (Requested by ryanhaddad on #webkit).
1737
1738         Reverted changesets:
1739
1740         "Refactoring: eliminate raw pointer usage in Fullscreen code"
1741         https://bugs.webkit.org/show_bug.cgi?id=188747
1742         https://trac.webkit.org/changeset/236624
1743
1744         "Unify implementation in VideoFullscreenInterfaceAVKit"
1745         https://bugs.webkit.org/show_bug.cgi?id=190091
1746         https://trac.webkit.org/changeset/236671
1747
1748 2018-10-02  Sihui Liu  <sihui_liu@apple.com>
1749
1750         Add release assertion to ensure m_owningPointerForClose is null in UniqueIDBDatabase::invokeOperationAndTransactionTimer()
1751         https://bugs.webkit.org/show_bug.cgi?id=190178
1752
1753         Reviewed by Chris Dumez.
1754
1755         This would help debug rdar://problem/44902833.
1756
1757         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1758         (WebCore::IDBServer::UniqueIDBDatabase::invokeOperationAndTransactionTimer):
1759
1760 2018-10-02  Commit Queue  <commit-queue@webkit.org>
1761
1762         Unreviewed, rolling out r236719.
1763         https://bugs.webkit.org/show_bug.cgi?id=190197
1764
1765         this revision caused 39 layout test failures that tested for
1766         scrolling, a bug was also not present in the commit or change
1767         log. (Requested by Truitt on #webkit).
1768
1769         Reverted changeset:
1770
1771         "Unreviewed, fix unused variable in
1772         RenderLayer::updateScrollableAreaSet"
1773         https://trac.webkit.org/changeset/236719
1774
1775 2018-10-02  Alicia Boya García  <aboya@igalia.com>
1776
1777         [MSE][GStreamer] Add h264parse to accept MP4 without stss
1778         https://bugs.webkit.org/show_bug.cgi?id=190143
1779
1780         Reviewed by Xabier Rodriguez-Calvar.
1781
1782         The MP4 file used in this URL does not contain a stss (Sync Sample
1783         Box). In consequence, in acordance with the ISO BMFF spec, all samples
1784         are assumed to be sync frames... But in this case that is not true,
1785         it's just that the file is wrong (e.g. created with a buggy muxer).
1786
1787         http://orange-opensource.github.io/hasplayer.js/1.2.0/player.html?url=http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism/Manifest
1788
1789         The way it works in other browsers is because instead of trusting the
1790         MP4 stss table, they rely on parsing the h264 frames. We can do that
1791         too.
1792
1793         This patch also changes RELEASE_ASSERT() when creating the parsers
1794         to GLib criticals.
1795
1796         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1797         (WebCore::createOptionalParserForFormat):
1798
1799 2018-10-02  Eric Carlson  <eric.carlson@apple.com>
1800
1801         [MediaStream] RealtimeMediaSource should be able to vend hashed IDs
1802         https://bugs.webkit.org/show_bug.cgi?id=190142
1803         <rdar://problem/44911109>
1804
1805         Reviewed by Youenn Fablet.
1806
1807         No new tests, covered by existing tests.
1808
1809         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
1810         (WebCore::CanvasCaptureMediaStreamTrack::Source::Source): Update order of parameters passed
1811         to base class.
1812
1813         * Modules/mediastream/MediaDevicesRequest.cpp:
1814         (WebCore::MediaDevicesRequest::start): ASSERT if document.deviceIDHashSalt is not the same
1815         as passed salt.
1816
1817         * Modules/mediastream/MediaStreamTrack.cpp:
1818         (WebCore::MediaStreamTrack::getSettings const): Don't need to hash ID.
1819         (WebCore::MediaStreamTrack::getCapabilities const): Ditto.
1820         * Modules/mediastream/MediaStreamTrack.h:
1821         * Modules/mediastream/MediaStreamTrack.idl:
1822
1823         * Modules/mediastream/UserMediaRequest.cpp:
1824         (WebCore::UserMediaRequest::allow): Pass hash salt to createMediaStream.
1825
1826         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1827         (WebCore::LibWebRTCPeerConnectionBackend::createReceiverForSource): Update order of parameters passed
1828         to base class.
1829
1830         * Modules/webaudio/MediaStreamAudioSource.cpp:
1831         (WebCore::MediaStreamAudioSource::MediaStreamAudioSource): Ditto.
1832         * platform/mediastream/MediaConstraints.h:
1833
1834         * platform/mediastream/RealtimeIncomingAudioSource.cpp:
1835         (WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource): Ditto.
1836
1837         * platform/mediastream/RealtimeIncomingVideoSource.cpp:
1838         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource): Ditto.
1839
1840         * platform/mediastream/RealtimeMediaSource.cpp:
1841         (WebCore::RealtimeMediaSource::RealtimeMediaSource): Calculate hashed ID.
1842         (WebCore::RealtimeMediaSource::selectSettings): Use m_hashedID.
1843         (WebCore::RealtimeMediaSource::hashedId const): New.
1844         (WebCore::RealtimeMediaSource::deviceIDHashSalt const): New.
1845         * platform/mediastream/RealtimeMediaSource.h:
1846
1847         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1848         (WebCore::RealtimeMediaSourceCenter::createMediaStream): Take hash salt, pass it when creating
1849         a source.
1850         (WebCore::RealtimeMediaSourceCenter::getUserMediaDevices): Ditto.
1851         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): Ditto.
1852         * platform/mediastream/RealtimeMediaSourceCenter.h:
1853
1854         * platform/mediastream/RealtimeMediaSourceFactory.h:
1855         * platform/mediastream/RealtimeVideoSource.cpp:
1856         (WebCore::RealtimeVideoSource::RealtimeVideoSource): Update parameters.
1857         * platform/mediastream/RealtimeVideoSource.h:
1858
1859         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
1860         (WebCore::GStreamerAudioCaptureSource::create): Ditto.
1861         (WebCore::GStreamerAudioCaptureSource::GStreamerAudioCaptureSource): Ditto.
1862         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h:
1863
1864         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
1865         (WebCore::GStreamerVideoCaptureSource::create): Ditto.
1866         (WebCore::GStreamerVideoCaptureSource::GStreamerVideoCaptureSource): Ditto.
1867         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h:
1868
1869         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
1870         (WebCore::WrappedMockRealtimeAudioSource::WrappedMockRealtimeAudioSource): Ditto.
1871         (WebCore::MockRealtimeAudioSource::create): Ditto.
1872         (WebCore::MockGStreamerAudioCaptureSource::MockGStreamerAudioCaptureSource): Ditto.
1873         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h:
1874
1875         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp:
1876         (WebCore::MockRealtimeVideoSource::create): Ditto.
1877         (WebCore::MockGStreamerVideoCaptureSource::MockGStreamerVideoCaptureSource): Ditto.
1878         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h:
1879
1880         * platform/mediastream/mac/AVVideoCaptureSource.h:
1881         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1882         (WebCore::AVVideoCaptureSource::create): Ditto.
1883         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource): Ditto.
1884         (WebCore::AVVideoCaptureSource::settings): Use hashedId to set device ID.
1885         (WebCore::AVVideoCaptureSource::capabilities): Ditto.
1886
1887         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1888         (WebCore::CoreAudioCaptureSource::create): Update parameters.
1889         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource): Ditto.
1890         (WebCore::CoreAudioCaptureSource::capabilities): Use hashedId to set device ID.
1891         (WebCore::CoreAudioCaptureSource::settings): Ditto.
1892         * platform/mediastream/mac/CoreAudioCaptureSource.h:
1893
1894         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
1895         (WebCore::DisplayCaptureSourceCocoa::DisplayCaptureSourceCocoa): Update parameters.
1896         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
1897
1898         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
1899         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
1900         (WebCore::MockRealtimeAudioSource::create): Ditto.
1901         (WebCore::MockRealtimeAudioSourceMac::MockRealtimeAudioSourceMac): Ditto.
1902
1903         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
1904         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
1905         (WebCore::MockRealtimeVideoSource::create): Ditto.
1906         (WebCore::MockRealtimeVideoSourceMac::MockRealtimeVideoSourceMac): Ditto.
1907
1908         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1909
1910         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
1911         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
1912         (WebCore::ScreenDisplayCaptureSourceMac::create): Ditto.
1913         (WebCore::ScreenDisplayCaptureSourceMac::ScreenDisplayCaptureSourceMac): Ditto.
1914         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Update logging.
1915         (WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream): Ditto.
1916         (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable): Ditto.
1917
1918         * platform/mediastream/mac/WindowDisplayCaptureSourceMac.h:
1919         * platform/mediastream/mac/WindowDisplayCaptureSourceMac.mm:
1920         (WebCore::WindowDisplayCaptureSourceMac::create): Update parameters.
1921
1922         * platform/mock/MockRealtimeAudioSource.cpp:
1923         (WebCore::MockRealtimeAudioSource::create): Ditto.
1924         (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource): Ditto.
1925         (WebCore::MockRealtimeAudioSource::settings): Use hashedId to set device ID.
1926         (WebCore::MockRealtimeAudioSource::capabilities): Ditto.
1927         * platform/mock/MockRealtimeAudioSource.h:
1928
1929         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1930
1931         * platform/mock/MockRealtimeVideoSource.cpp:
1932         (WebCore::MockRealtimeVideoSource::create): Update parameters.
1933         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): Ditto.
1934         (WebCore::MockRealtimeVideoSource::capabilities): Use hashedId to set device ID.
1935         (WebCore::MockRealtimeVideoSource::settings): Ditto.
1936         * platform/mock/MockRealtimeVideoSource.h:
1937
1938 2018-10-02  Philippe Normand  <pnormand@igalia.com>
1939
1940         [GStreamer][playbin3] Stream tag lists leaks
1941         https://bugs.webkit.org/show_bug.cgi?id=190192
1942
1943         Reviewed by Xabier Rodriguez-Calvar.
1944
1945         The gst_stream_get_tags() result is transfer-full, so needs to be adopted to prevent a leak.
1946         Also check the tags list pointer which might be NULL in some cases.
1947
1948         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
1949         (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
1950         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1951         (WebCore::MediaPlayerPrivateGStreamer::naturalSize const):
1952         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
1953         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
1954
1955 2018-10-01  Michael Catanzaro  <mcatanzaro@igalia.com>
1956
1957         Unreviewed, fix unused variable in RenderLayer::updateScrollableAreaSet
1958
1959         * rendering/RenderLayer.cpp:
1960         (WebCore::RenderLayer::calculateClipRects const): This is a prepare-ChangeLog bug. I don't
1961         have any changes in this function....
1962
1963 2018-10-02  Alicia Boya García  <aboya@igalia.com>
1964
1965         [MSE][GStreamer] Make same thread assert non-release
1966         https://bugs.webkit.org/show_bug.cgi?id=189924
1967
1968         Reviewed by Xabier Rodriguez-Calvar.
1969
1970         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1971         (WebCore::AppendPipeline::handleNewAppsinkSample):
1972
1973 2018-10-01  Ryosuke Niwa  <rniwa@webkit.org>
1974
1975         Add a new variant of serializePreservingVisualAppearance which takes VisibleSelection
1976         https://bugs.webkit.org/show_bug.cgi?id=190108
1977
1978         Reviewed by Wenson Hsieh.
1979
1980         Added a version of serializePreservingVisualAppearance which takes VisibleSelection so that we can avoid creating
1981         a range simply to get the first node and the end node of the selection later. This simple change also fixes a bug
1982         demonstrated in editing/pasteboard/paste-table-003.html.
1983
1984         Test: editing/pasteboard/paste-table-003.html
1985
1986         * editing/cocoa/EditorCocoa.mm:
1987         (WebCore::Editor::selectionInHTMLFormat): Adopt the new variant.
1988         * editing/gtk/EditorGtk.cpp:
1989         (WebCore::Editor::writeSelectionToPasteboard): Ditto.
1990         * editing/markup.cpp:
1991         (WebCore::serializePreservingVisualAppearance): Added.
1992         * editing/markup.h:
1993         * editing/wpe/EditorWPE.cpp:
1994         (WebCore::Editor::writeSelectionToPasteboard): Ditto.
1995         * loader/archive/cf/LegacyWebArchive.cpp:
1996         (WebCore::LegacyWebArchive::createFromSelection): Ditto.
1997         * platform/win/PasteboardWin.cpp:
1998         (WebCore::Pasteboard::writeSelection): Ditto.
1999
2000 2018-10-01  Alex Christensen  <achristensen@webkit.org>
2001
2002         Don't read from WebCore's bundle for IDNScriptWhiteList
2003         https://bugs.webkit.org/show_bug.cgi?id=190157
2004
2005         Reviewed by Dan Bernstein.
2006
2007         No change in behavior.  This increases performance by not reading from the WebCore bundle,
2008         and it makes it so that URL-related functionality can be moved to a place without
2009         a bundle for resources.
2010
2011         * Resources/IDNScriptWhiteList.txt: Removed.
2012         * WebCore.xcodeproj/project.pbxproj:
2013         * platform/mac/WebCoreNSURLExtras.mm:
2014         (WebCore::whiteListIDNScripts):
2015         (WebCore::allCharactersInIDNScriptWhiteList):
2016         (WebCore::readIDNScriptWhiteListFile): Deleted.
2017
2018 2018-10-01  Alex Christensen  <achristensen@webkit.org>
2019
2020         Unreviewed, rolling out r236551.
2021
2022         Fails URL validating too aggressively
2023
2024         Reverted changeset:
2025
2026         "URLWithUserTypedString should return nil for URLs deemed to
2027         be invalid by WebCore::URL"
2028         https://bugs.webkit.org/show_bug.cgi?id=189979
2029         https://trac.webkit.org/changeset/236551
2030
2031 2018-10-01  Keith Miller  <keith_miller@apple.com>
2032
2033         Create a RELEASE_AND_RETURN macro for ExceptionScopes
2034         https://bugs.webkit.org/show_bug.cgi?id=190163
2035
2036         Reviewed by Mark Lam.
2037
2038         The new RELEASE_AND_RETURN does all the work for cases
2039         where you want to return the result of some expression
2040         without explicitly checking for an exception. This is
2041         much like the existing RETURN_IF_EXCEPTION macro.
2042
2043         No new tests since this is a refactor.
2044
2045         * bridge/runtime_array.cpp:
2046         (JSC::RuntimeArray::put):
2047
2048 2018-10-01  Daniel Bates  <dabates@apple.com>
2049
2050         Attempt to fix the watchOS build after <https://trac.webkit.org/changeset/236678>
2051         (https://bugs.webkit.org/show_bug.cgi?id=189974)
2052
2053         Explicitly cast index to unsigned to make the operator[] call unambiguous.
2054
2055         * platform/ios/KeyEventIOS.mm:
2056         (WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent):
2057
2058 2018-10-01  Ryosuke Niwa  <rniwa@webkit.org>
2059
2060         ASAN failure in ~GCReachableRef()
2061         https://bugs.webkit.org/show_bug.cgi?id=190113
2062
2063         Reviewed by Darin Adler.
2064
2065         The bug was caused by ~GCReachableRef accessing Ref after it had been poisoned for ASAN
2066         in Ref::leakRef via Ref(Ref&& other). Fixed the bug by using RefPtr instead since that's
2067         the simplest solution here although we could unpoison Ref temporarily as done in ~Ref.
2068
2069         * dom/GCReachableRef.h:
2070         (WebCore::GCReachableRef::GCReachableRef):
2071         (WebCore::GCReachableRef::~GCReachableRef):
2072         (WebCore::GCReachableRef::operator-> const):
2073         (WebCore::GCReachableRef::get const):
2074         (WebCore::GCReachableRef::operator T& const):
2075         (WebCore::GCReachableRef::operator! const):
2076         (WebCore::GCReachableRef::isNull const): Deleted.
2077
2078 2018-10-01  Sihui Liu  <sihui_liu@apple.com>
2079
2080         Remove StorageProcess
2081         https://bugs.webkit.org/show_bug.cgi?id=189975
2082
2083         Reviewed by Geoffrey Garen.
2084
2085         Clean up code. No behavior change.
2086
2087         * English.lproj/Localizable.strings:
2088
2089 2018-10-01  Alicia Boya García  <aboya@igalia.com>
2090
2091         [MSE][GStreamer] Set a minimum sample duration
2092         https://bugs.webkit.org/show_bug.cgi?id=190125
2093
2094         Reviewed by Xabier Rodriguez-Calvar.
2095
2096         The last sample of the audio track in the asset used in this test
2097         player has a tiny duration (100 ns):
2098
2099         http://orange-opensource.github.io/hasplayer.js/1.2.0/player.html?url=http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism/Manifest
2100
2101         So small, we were truncating it to zero. We're not supposed to have
2102         frames with zero duration. Instead, lets set a minimum frame duration
2103         for those fringe cases.
2104
2105         * platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
2106         (WebCore::MediaSampleGStreamer::MediaSampleGStreamer):
2107
2108 2018-10-01  Daniel Bates  <dabates@apple.com>
2109
2110         [iOS] Special keys are misidentified in DOM keyboard events
2111         https://bugs.webkit.org/show_bug.cgi?id=189974
2112
2113         Reviewed by Wenson Hsieh.
2114
2115         This patch fixes two issues:
2116             1. Special keyboard keys would be misidentified in dispatched DOM keyboard events.
2117             2. DOM keypress events may not be dispatched for some special keys.
2118
2119         UIKit uses special input strings to identify the Page Up, Page Down, Escape, Up Arrow, Down Arrow,
2120         Left Arrow, and Right Arrow keys. It also uses ASCII control characters to represent some other
2121         special keys, including Num Lock / Clear, Home, End, Forward Delete, and F1, ..., F24. We need
2122         to explicitly handle these special keyboard keys in order to be able to identify the key that
2123         was pressed as well as to correctly disambiguate a key down to know whether to dispatch a DOM
2124         keypress event for the key.
2125
2126         Unlike UIKit, AppKit reserves Unicode Private Use Area (PUA) code points in 0xF700–0xF8FF to
2127         represent special keyboard keys. This makes it straightforward to disambiguate such keys using
2128         the input string of the keyboard event alone. To simplify the implementation for iOS
2129         we normalize the input string be AppKit compatible. See the explaination for WebCore::windowsKeyCodeForCharCode()
2130         below for more details on why this is done.
2131
2132         Tests: fast/events/ios/keydown-keyup-arrow-keys-in-non-editable-element.html
2133                fast/events/ios/keypress-keys-in-non-editable-element.html
2134
2135         * SourcesCocoa.txt:
2136         * WebCore.xcodeproj/project.pbxproj:
2137         Do not use unified source build strategy when building WebEvent.mm as it makes
2138         use of SoftLinking macros that are incompatible with this strategy.
2139
2140         * platform/ios/KeyEventIOS.mm:
2141         (WebCore::windowsKeyCodeForCharCode): Recognize some special AppKit special char codes.
2142         These special char codes are generated by WebKit. WebKit uses the same special char codes
2143         as AppKit as a convenience instead of defining our own constants for the same purpose.
2144         Encoding the special UIKit input strings (e.g. up arrow) as distinct char codes allows us
2145         to use integer arithmetic and switch blocks to map characters to Windows virtual key
2146         codes as opposed to special cased branches to perform pointer or string comparisions.
2147         The latter would be necessary in Modern WebKit in order for key down events to be properly
2148         disambiguated to dispatch a DOM keypress event because pointers are not perserved, though
2149         what they point to is, when sending the WebEvent from UIProcess to the WebProcess and
2150         vice versa.
2151         (WebCore::isFunctionKey): Convenience function that determines whether the specified char
2152         code corresponds to a function key on the keyboard. The term "function key" is taken from
2153         AppKit parlance to describe a special keyboard key. These keys include F1, F2, ..., F24,
2154         and cursor keys among other special keyboard keys.
2155         (WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent): Write in terms of isFunctionKey().
2156         * platform/ios/PlatformEventFactoryIOS.h:
2157         * platform/ios/PlatformEventFactoryIOS.mm:
2158         (WebCore::keyIdentifierForKeyEvent): Remove code to handle UIKit special input strings as
2159         we now map such special input strings to char codes and hence can use the default code path.
2160         (WebCore::keyForKeyEvent): Ditto.
2161         (WebCore::codeForKeyEvent): Remove code to compute the Window virtual key code corresponding
2162         to a UIKit special key command now that we map such special input strings to char codes and
2163         subsequently map the char codes to the Windows virtual key code (see -[WebEvent initWithKeyEventType:...]
2164         constructors). So, we can now use WebEvent.keyCode directly to compute the DOM UIEvents code
2165         for the event.
2166         (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): Remove code to fix up
2167         WebEvent.keyCode to account for UIKit special input strings now that we map such special key
2168         commands to char codes and subsequently map the char codes to the Windows virtual key code (see -[WebEvent initWithKeyEventType:...]
2169         constructors). So, we can now take WebEvent.keyCode verbatim to be the Window virtual key code.
2170         (WebCore::convertSpecialKeyToCharCode): Deleted.
2171         (WebCore::keyCodeForEvent): Deleted.
2172         * platform/ios/WebEvent.mm:
2173         (normalizedStringWithAppKitCompatibilityMapping): Added; converts a UIKit character string
2174         to the corresponding AppKit-compatible one (if not already compatible). See the explaination
2175         for WebCore::windowsKeyCodeForCharCode() above for more details on why this is done.
2176
2177         (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:keyCode:isTabKey:characterSet:]):
2178         (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:withInputManagerHint:keyCode:isTabKey:]):
2179         Normalize the character strings to be AppKit compatible.
2180
2181 2018-10-01  Simon Fraser  <simon.fraser@apple.com>
2182
2183         Optimize RenderStyle::diff() and clean up the code
2184         https://bugs.webkit.org/show_bug.cgi?id=190104
2185
2186         Reviewed by Dan Bernstein.
2187
2188         RenderStyle::changeRequiresLayout() and related should only check values on 
2189         m_rareNonInheritedData and m_rareInheritedData after checking for pointer equality.
2190         To reduce the chances of future changes regressing this, move code comparing values
2191         on StyleRare[Non]InheritedData into dedication functions.
2192         
2193         In addition, the transform comparison double-compared the transformOperations,
2194         because m_rareNonInheritedData->transform != other.m_rareNonInheritedData->transform
2195         is a deep comparison, and it was followed by *m_rareNonInheritedData->transform != *other.m_rareNonInheritedData->transform.
2196         Change the first to be a pointer comparison.
2197
2198         * rendering/style/RenderStyle.cpp:
2199         (WebCore::rareNonInheritedDataChangeRequiresLayout):
2200         (WebCore::rareInheritedDataChangeRequiresLayout):
2201         (WebCore::RenderStyle::changeRequiresLayout const):
2202         (WebCore::rareNonInheritedDataChangeRequiresLayerRepaint):
2203         (WebCore::RenderStyle::changeRequiresLayerRepaint const):
2204         (WebCore::rareNonInheritedDataChangeRequiresRepaint):
2205         (WebCore::rareInheritedDataChangeRequiresRepaint):
2206         (WebCore::RenderStyle::changeRequiresRepaint const):
2207
2208 2018-10-01  Alex Christensen  <achristensen@webkit.org>
2209
2210         URL should not use TextEncoding internally
2211         https://bugs.webkit.org/show_bug.cgi?id=190111
2212
2213         Reviewed by Andy Estes.
2214
2215         That dependency makes it impossible to move or use elsewhere.
2216         Using TextEncoding was overkill because we know the credentials are UTF-8 percent-encoded in a parsed URL.
2217         No change in behavior as verified by new API tests.
2218
2219         * page/SecurityOrigin.cpp:
2220         * page/csp/ContentSecurityPolicySourceList.cpp:
2221         * platform/URL.cpp:
2222         (WebCore::decodeEscapeSequencesFromParsedURL):
2223         (WebCore::URL::user const):
2224         (WebCore::URL::pass const):
2225         (WebCore::URL::fileSystemPath const):
2226         (WebCore::decodeURLEscapeSequences): Deleted.
2227         * platform/URL.h:
2228         * platform/network/DataURLDecoder.cpp:
2229         * platform/text/TextEncoding.cpp:
2230         (WebCore::decodeURLEscapeSequences):
2231         * platform/text/TextEncoding.h:
2232
2233 2018-10-01  Simon Pieters  <zcorpan@gmail.com>
2234
2235         <form> in quirks mode should have margin-block-end: 1em
2236         https://bugs.webkit.org/show_bug.cgi?id=157788
2237
2238         Reviewed by Simon Fraser.
2239
2240         Change the default style for forms to take writing-mode into account
2241         in quirks mode. Matches the behavior of Gecko and Edge and the HTML
2242         standard.
2243
2244         Spec: https://html.spec.whatwg.org/multipage/rendering.html#flow-content-3
2245
2246         Test: imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/flow-content-0/form-margin-quirk.html
2247
2248         * css/quirks.css:
2249         (form):
2250
2251 2018-10-01  Jeremy Jones  <jeremyj@apple.com>
2252
2253         Unify implementation in VideoFullscreenInterfaceAVKit
2254         https://bugs.webkit.org/show_bug.cgi?id=190091
2255         rdar://problem/44734523
2256
2257         Reviewed by Jer Noble.
2258
2259         No new tests because no behavior change.
2260
2261         Unified code in VideoFullscreenInterfaceAVKit now that new code path is proven and include
2262         any changes that had been made in the old path.
2263
2264         * platform/ios/VideoFullscreenInterfaceAVKit.h:
2265         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2266         (-[WebAVPlayerViewControllerDelegate playerViewControllerShouldStartPictureInPictureFromInlineWhenEnteringBackground:]):
2267         (VideoFullscreenInterfaceAVKit::preparedToExitFullscreen):
2268         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
2269         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2270         (VideoFullscreenControllerContext::requestUpdateInlineRect):
2271         (VideoFullscreenControllerContext::requestVideoContentLayer):
2272         (VideoFullscreenControllerContext::returnVideoContentLayer):
2273         (VideoFullscreenControllerContext::didSetupFullscreen):
2274         (VideoFullscreenControllerContext::didExitFullscreen):
2275
2276 2018-10-01  Antoine Quint  <graouts@apple.com>
2277
2278         [Web Animations] Ensure renderers with accelerated animations have layers
2279         https://bugs.webkit.org/show_bug.cgi?id=189990
2280
2281         Reviewed by Simon Fraser.
2282
2283         In r236501 we added code that would make a RenderBox and a RenderInline query the document timeline for whether a given element has
2284         accelerated animations running on it. Since the calls to requiresLayer() are in a hot path, we instead keep a list of elements with
2285         exclusively accelerated animations running.
2286
2287         No new tests, this is already covered by webanimations/accelerated-animation-with-delay.html and webanimations/opacity-animation-yields-compositing-span.html
2288         which respectively check that we can apply an accelerated animation to a non-positioned block and an inline element.
2289
2290         * animation/AnimationTimeline.h:
2291         * animation/DocumentTimeline.cpp:
2292         (WebCore::DocumentTimeline::detachFromDocument):
2293         (WebCore::DocumentTimeline::animationWasAddedToElement):
2294         (WebCore::DocumentTimeline::animationWasRemovedFromElement):
2295         (WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange):
2296         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement): Iterate over an element's animations to determine
2297         whether all of its animations are running accelerated, then update the HashSet containing elements running accelerated animations to remove or
2298         add this element.
2299         (WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated const): Make a simple contains() call on the HashSet containing elements
2300         running accelerated animations.
2301         * animation/DocumentTimeline.h:
2302         * animation/KeyframeEffectReadOnly.cpp:
2303         (WebCore::KeyframeEffectReadOnly::updateAcceleratedAnimationState):
2304         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
2305         * rendering/RenderBoxModelObject.h:
2306
2307 2018-10-01  Alicia Boya García  <aboya@igalia.com>
2308
2309         [GStreamer] Fix abort in gst_sample_get_info()
2310         https://bugs.webkit.org/show_bug.cgi?id=190135
2311
2312         Reviewed by Philippe Normand.
2313
2314         A flush can occur before any frame has finished decoding -- especially
2315         in tests, where actions on the player often occur in quick succession.
2316
2317         Therefore, the code must not assume by the time a flush occurs any
2318         frame has reached the sink. This patch fixes a case when such wrong
2319         assumption was causing gst_sample_get_info() to abort (crashing
2320         WebKit).
2321
2322         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2323         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
2324         (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink):
2325
2326 2018-10-01  Olivier Blin  <olivier.blin@softathome.com>
2327
2328         [WPE] fix buffer over-read in RenderThemeWPE::mediaControlsStyleSheet()
2329         https://bugs.webkit.org/show_bug.cgi?id=190139
2330
2331         Reviewed by Michael Catanzaro.
2332
2333         Like done upstream for EFL in r210213
2334         https://bugs.webkit.org/show_bug.cgi?id=166622
2335
2336         This has been detected by a charactersAreAllASCII() assert failure.
2337
2338         This is because ASCIILiteral() is wrongly used in mediaControlsStyleSheet().
2339         mediaControlsBaseUserAgentStyleSheet is a char array, not a null-terminated string.
2340         It is thus incorrect to use StringImpl::createFromLiteral() that calls
2341         strlen() to get the string length.
2342
2343         The String::ConstructFromLiteral constructor can not be used, since it
2344         skips the last character.
2345
2346         * platform/wpe/RenderThemeWPE.cpp:
2347         (WebCore::RenderThemeWPE::mediaControlsStyleSheet):
2348         Explicitely pass the size to the String constructor.
2349
2350 2018-10-01  Rob Buis  <rbuis@igalia.com>
2351
2352         Align XMLHttpRequest's overrideMimeType() with the standard
2353         https://bugs.webkit.org/show_bug.cgi?id=169276
2354
2355         Reviewed by Chris Dumez.
2356
2357         Implement the overrideMimeType() as specified in that standard, i.e.
2358         add a check that the passed mime type is valid and if not fallback
2359         to application/octet-stream.
2360
2361         In order for this patch to have any effect, I went ahead and
2362         made an improvement to the ContentType parsing, parseContentType now
2363         will reject mime types that do not match the type / subtype format, I
2364         believe this is required by both RFC2045 and mimesniff specs.
2365
2366         This behavior matches Chrome and Firefox.
2367
2368         Test: web-platform-tests/xhr/overridemimetype-invalid-mime-type.htm
2369
2370         * platform/network/ParsedContentType.cpp:
2371         (WebCore::parseContentType):
2372         * xml/XMLHttpRequest.cpp:
2373         (WebCore::XMLHttpRequest::overrideMimeType):
2374
2375
2376 2018-10-01  Chris Dumez  <cdumez@apple.com>
2377
2378         Make crossOriginObject.then undefined for promises
2379         https://bugs.webkit.org/show_bug.cgi?id=190094
2380
2381         Reviewed by Darin Adler.
2382
2383         Make crossOriginObject.then undefined for promises. This allows promises to work better with cross-origin WindowProxy
2384         and Location objects.
2385
2386         Specification:
2387         - https://github.com/whatwg/html/pull/3242
2388         - https://github.com/whatwg/dom/issues/536
2389
2390         This aligns our behavior with Blink and Gecko.
2391
2392         No new tests, rebaselined existing test.
2393
2394         * bindings/js/JSDOMWindowCustom.cpp:
2395         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
2396         (WebCore::addCrossOriginWindowOwnPropertyNames):
2397         * bindings/js/JSLocationCustom.cpp:
2398         (WebCore::getOwnPropertySlotCommon):
2399         (WebCore::addCrossOriginLocationOwnPropertyNames):
2400
2401 2018-10-01  Xan Lopez  <xan@igalia.com>
2402
2403         [SOUP] Fix the build for libsoup > 2.61.90
2404         https://bugs.webkit.org/show_bug.cgi?id=190126
2405
2406         Reviewed by Michael Catanzaro.
2407
2408         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
2409
2410 2018-10-01  Alicia Boya García  <aboya@igalia.com>
2411
2412         [MSE][GStreamer] Reset running time in PlaybackPipeline::flush()
2413         https://bugs.webkit.org/show_bug.cgi?id=190076
2414
2415         Reviewed by Philippe Normand.
2416
2417         Test: media/media-source/media-source-seek-redundant-append.html
2418
2419         PlaybackPipeline::flush() is called when already enqueued frames are
2420         appended again. This may be caused by a quality change or just a
2421         redundant append. Either way, the pipeline has to be flushed and
2422         playback begin again, but without changing the player position by
2423         much.
2424
2425         There are two kinds of time to consider here: stream time (i.e. the
2426         time of a frame as written in the file, e.g. a frame may have stream
2427         time 0:01:00), and running time (i.e. how much time since playback
2428         started should pass before the frame should be played, e.g. if we
2429         started playing at 0:00:59 that same frame would have a running time
2430         of just 1 second).
2431
2432         Notice how running time depends on where and when playback starts.
2433         Running time can also be optionally resetted after a flush. (This is
2434         indeed done currently by most demuxers after a seek.)
2435
2436         Instead of resetting running time, PlaybackPipeline used to modify the
2437         first GstSegment emitted after the flush. A GstSegment declares the
2438         mapping between stream time and running time for the following frames.
2439         There, PlaybackPipeline used to set `base` (the running time at which
2440         the segment starts) to the position reported by a position query
2441         (which is stream time).
2442
2443         This, of course, only worked when playback (or the last seek) started
2444         at stream time 0:00:00, since that's the only case where running time
2445         equals stream time. In other cases delays as long as the difference
2446         between these timelines would appear. This is demonstrated in the
2447         attached test, where seeks and appends are made in such an order that
2448         the difference is more than 5 minutes, making the playback stall for
2449         >5 minutes before playing 1 second of audio.
2450
2451         This patch fixes the problem by resetting running time with the flush
2452         and not modifying GstSegment.base anymore (it will be left as zero,
2453         which is now correct since the running time has been reset).
2454
2455         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
2456         (WebCore::PlaybackPipeline::flush):
2457         (WebCore::segmentFixerProbe): Deleted.
2458
2459 2018-09-30  Ryosuke Niwa  <rniwa@webkit.org>
2460
2461         Use Position instead of Range in createMarkupInternal
2462         https://bugs.webkit.org/show_bug.cgi?id=190107
2463
2464         Reviewed by Darin Adler.
2465
2466         Use two Position's indicating start and end instead of Range in createMarkupInternal and StylizedMarkupAccumulator
2467         in order to support copy & paste across shadow boundaries in the bug 157443. This patch also removes the use of
2468         Range in MarkupAccumulator since all uses of range is via StylizedMarkupAccumulator.
2469
2470         Also renamed createMarkupInternal to serializePreservingVisualAppearanceInternal to match the rename in r236612.
2471
2472         * dom/Position.cpp:
2473         (WebCore::Position::firstNode const):  Added.
2474         * dom/Position.h:
2475         * editing/MarkupAccumulator.cpp:
2476         (WebCore::MarkupAccumulator::MarkupAccumulator): No longer takes Range.
2477         (WebCore::MarkupAccumulator::appendText): Removed the code to truncate string at the boundary points of the range.
2478         * editing/MarkupAccumulator.h:
2479         (WebCore::MarkupAccumulator): Made this class non-copyable.
2480         * editing/markup.cpp:
2481         (WebCore::StyledMarkupAccumulator::StyledMarkupAccumulator): Now takes and stores two positions.
2482
2483         (WebCore::StyledMarkupAccumulator::appendText): Use textContentRespectingRange in the case annotation is disabled
2484         instead of calling to MarkupAccumulator::appendText, which no longer respects boundary offsets.
2485
2486         (WebCore::StyledMarkupAccumulator::renderedTextRespectingRange): Renamed from renderedText. Updated to respect
2487         boundary offsets defined by m_start and m_end Positions instead of m_range Range.
2488
2489         (WebCore::StyledMarkupAccumulator::textContentRespectingRange): Renamed from stringValueForRange. Ditto.
2490
2491         (WebCore::StyledMarkupAccumulator::serializeNodes): Now computes startNode and pastEnd nodes from start and end
2492         Positions. Note that the end position is always the next node in the tree order  for a character node
2493         and computeNodeAfterPosition returns nullptr for a character data.
2494
2495         (WebCore::highestAncestorToWrapMarkup): Now takes two positions instead of a range.
2496
2497         (WebCore::serializePreservingVisualAppearanceInternal): Renamed from createMarkupInternal. Removed the obsolete
2498         comments which were added for DOMRange in WebKitLegacy.
2499
2500         (WebCore::serializePreservingVisualAppearance):
2501
2502         (WebCore::sanitizedMarkupForFragmentInDocument): Create positions instead of a range to pass to
2503         serializePreservingVisualAppearanceInternal.
2504
2505         (WebCore::serializeFragment):
2506
2507         * editing/markup.h:
2508         * page/PageSerializer.cpp:
2509         (WebCore::PageSerializer::SerializerMarkupAccumulator): Removed the unnecessary WebCore namespace qualifier.
2510
2511 2018-09-30  Walker Henderson  <wjahenderson@gmail.com>
2512
2513         AudioNode.connect should return passed destination node
2514         https://bugs.webkit.org/show_bug.cgi?id=188834
2515
2516         Reviewed by Eric Carlson.
2517
2518         No new tests, rebaselined existing test.
2519
2520         * Modules/webaudio/AudioBasicInspectorNode.cpp:
2521         (WebCore::AudioBasicInspectorNode::connect): Deleted.
2522         * Modules/webaudio/AudioBasicInspectorNode.h:
2523         * Modules/webaudio/AudioNode.cpp:
2524         * Modules/webaudio/AudioNode.h:
2525         * Modules/webaudio/AudioNode.idl:
2526
2527 2018-09-30  Eric Carlson  <eric.carlson@apple.com>
2528
2529         [MediaStream] Clean up RealtimeMediaSource settings change handling
2530         https://bugs.webkit.org/show_bug.cgi?id=189998
2531         <rdar://problem/44797884>
2532
2533         Reviewed by Youenn Fablet.
2534
2535         No new tests, updated webrtc/video-disabled-black.html.
2536
2537         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
2538         (WebCore::CanvasCaptureMediaStreamTrack::Source::Source):
2539         (WebCore::CanvasCaptureMediaStreamTrack::Source::settings):
2540         (WebCore::CanvasCaptureMediaStreamTrack::Source::settingsDidChange):
2541         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized):
2542         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
2543         * platform/mediastream/RealtimeIncomingVideoSource.cpp:
2544         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
2545         (WebCore::RealtimeIncomingVideoSource::settings):
2546         (WebCore::RealtimeIncomingVideoSource::settingsDidChange):
2547         * platform/mediastream/RealtimeIncomingVideoSource.h:
2548         * platform/mediastream/RealtimeMediaSource.cpp:
2549         (WebCore::RealtimeMediaSource::settingsDidChange):
2550         (WebCore::RealtimeMediaSource::notifySettingsDidChangeObservers):
2551         (WebCore::RealtimeMediaSource::setSize):
2552         (WebCore::RealtimeMediaSource::setFrameRate):
2553         (WebCore::RealtimeMediaSource::setAspectRatio):
2554         (WebCore::RealtimeMediaSource::setFacingMode):
2555         (WebCore::RealtimeMediaSource::setVolume):
2556         (WebCore::RealtimeMediaSource::setSampleRate):
2557         (WebCore::RealtimeMediaSource::setSampleSize):
2558         (WebCore::RealtimeMediaSource::setEchoCancellation):
2559         * platform/mediastream/RealtimeMediaSource.h:
2560         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
2561         (WebCore::GStreamerAudioCaptureSource::settingsDidChange):
2562         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
2563         (WebCore::GStreamerVideoCaptureSource::settingsDidChange):
2564         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2565         (WebCore::AVVideoCaptureSource::settingsDidChange):
2566         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2567         (WebCore::CoreAudioCaptureSource::settingsDidChange):
2568         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
2569         (WebCore::DisplayCaptureSourceCocoa::settingsDidChange):
2570         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
2571         (WebCore::RealtimeIncomingVideoSourceCocoa::processNewSample):
2572         * platform/mock/MockRealtimeAudioSource.cpp:
2573         (WebCore::MockRealtimeAudioSource::settingsDidChange):
2574         * platform/mock/MockRealtimeVideoSource.cpp:
2575         (WebCore::MockRealtimeVideoSource::settingsDidChange):
2576
2577 2018-09-30  Eric Carlson  <eric.carlson@apple.com>
2578
2579         [MediaStream] Use display-specific capture factories
2580         https://bugs.webkit.org/show_bug.cgi?id=190043
2581         <rdar://problem/44834412>
2582
2583         Reviewed by Youenn Fablet.
2584
2585         No new tests, no change in functionality.
2586
2587         * Sources.txt:
2588         * WebCore.xcodeproj/project.pbxproj:
2589         * platform/mediastream/RealtimeMediaSource.cpp:
2590         (WebCore::RealtimeMediaSource::AudioCaptureFactory::~AudioCaptureFactory): Deleted.
2591         (WebCore::RealtimeMediaSource::VideoCaptureFactory::~VideoCaptureFactory): Deleted.
2592         * platform/mediastream/RealtimeMediaSource.h:
2593         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2594         (WebCore::RealtimeMediaSourceCenter::createMediaStream):
2595         (WebCore::RealtimeMediaSourceCenter::getDisplayMediaDevices):
2596         * platform/mediastream/RealtimeMediaSourceCenter.h:
2597         (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
2598         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
2599         * platform/mediastream/RealtimeMediaSourceFactory.cpp: Added.
2600         (WebCore::SingleSourceFactory::setActiveSource):
2601         (WebCore::SingleSourceFactory::unsetActiveSource):
2602         * platform/mediastream/RealtimeMediaSourceFactory.h: Added.
2603         (WebCore::SingleSourceFactory::activeSource):
2604         (WebCore::VideoCaptureFactory::setVideoCapturePageState):
2605         (WebCore::DisplayCaptureFactory::setDisplayCapturePageState):
2606         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
2607         (WebCore::libWebRTCVideoCaptureSourceFactory):
2608         (WebCore::libWebRTCDisplayCaptureSourceFactory):
2609         (WebCore::GStreamerVideoCaptureSource::factory):
2610         (WebCore::GStreamerVideoCaptureSource::displayFactory):
2611         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h:
2612         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp:
2613         (WebCore::RealtimeMediaSourceCenterLibWebRTC::audioCaptureSourceFactory):
2614         (WebCore::RealtimeMediaSourceCenterLibWebRTC::audioFactory):
2615         (WebCore::RealtimeMediaSourceCenterLibWebRTC::videoFactory):
2616         (WebCore::RealtimeMediaSourceCenterLibWebRTC::displayCaptureFactory):
2617         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h:
2618         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2619         (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
2620         (WebCore::AVVideoCaptureSource::setupCaptureSession):
2621         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2622         (WebCore::CoreAudioCaptureSource::factory):
2623         * platform/mediastream/mac/CoreAudioCaptureSource.h:
2624         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2625         (WebCore::RealtimeMediaSourceCenterMac::videoCaptureSourceFactory):
2626         (WebCore::RealtimeMediaSourceCenterMac::displayCaptureSourceFactory):
2627         (WebCore::RealtimeMediaSourceCenterMac::audioCaptureSourceFactory):
2628         (WebCore::RealtimeMediaSourceCenterMac::audioFactory):
2629         (WebCore::RealtimeMediaSourceCenterMac::videoFactory):
2630         (WebCore::RealtimeMediaSourceCenterMac::displayCaptureFactory):
2631         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
2632         * platform/mock/MockRealtimeAudioSource.cpp:
2633         (WebCore::MockRealtimeAudioSource::~MockRealtimeAudioSource):
2634         (WebCore::MockRealtimeAudioSource::startProducingData):
2635         (): Deleted.
2636         (WebCore::mockAudioCaptureSourceFactory): Deleted.
2637         (WebCore::MockRealtimeAudioSource::factory): Deleted.
2638         * platform/mock/MockRealtimeAudioSource.h:
2639         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2640         (WebCore::MockRealtimeVideoSourceFactory::setVideoCapturePageState):
2641         (WebCore::MockRealtimeMediaSourceCenter::audioFactory):
2642         (WebCore::MockRealtimeMediaSourceCenter::videoFactory):
2643         (WebCore::MockRealtimeMediaSourceCenter::displayCaptureFactory):
2644         * platform/mock/MockRealtimeMediaSourceCenter.h:
2645         * platform/mock/MockRealtimeVideoSource.cpp:
2646         (): Deleted.
2647         (WebCore::MockRealtimeVideoSourceFactory::setVideoCapturePageState): Deleted.
2648         (WebCore::mockVideoCaptureSourceFactory): Deleted.
2649         (WebCore::MockRealtimeVideoSource::factory): Deleted.
2650         * platform/mock/MockRealtimeVideoSource.h:
2651
2652 2018-09-29  Oriol Brufau  <obrufau@igalia.com>
2653
2654         [css-grid] Properly align items next to collapsed tracks with gutters
2655         https://bugs.webkit.org/show_bug.cgi?id=190089
2656
2657         Reviewed by Manuel Rego Casasnovas.
2658
2659         gridAreaPositionForInFlowChild could return a wrong end position for
2660         grid items adjacent to a collapsed track, because it didn't take into
2661         account that gutters collapse in that case. Therefore, "center" or
2662         "end" alignments displayed the item at the wrong position.
2663
2664         Test: imported/w3c/web-platform-tests/css/css-grid/alignment/grid-gutters-013.html
2665
2666         * rendering/RenderGrid.cpp:
2667         (WebCore::RenderGrid::gridAreaPositionForInFlowChild const):
2668
2669 2018-09-29  Alicia Boya García  <aboya@igalia.com>
2670
2671         [GStreamer][MSE] Use GObject for GST_TRACE_OBJECT
2672         https://bugs.webkit.org/show_bug.cgi?id=190045
2673
2674         Reviewed by Philippe Normand.
2675
2676         Passing a non-GObject object to GST_TRACE_OBJECT() can be
2677         theoretically misunderstood by the GStreamer logging function, so this
2678         patch avoids that.
2679
2680         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2681         (WebCore::AppendPipeline::appsrcEndOfAppendCheckerProbe):
2682         (WebCore::AppendPipeline::handleEndOfAppend):
2683         (WebCore::AppendPipeline::consumeAppsinkAvailableSamples):
2684         (WebCore::AppendPipeline::pushNewBuffer):
2685
2686 2018-09-28  Zamiul Haque  <zhaque@apple.com>
2687
2688         Angled gradient backgrounds in body render vertically when body height is 0
2689         https://bugs.webkit.org/show_bug.cgi?id=177232
2690         <rdar://problem/34548230>.
2691
2692         Reviewed by Tim Horton.
2693
2694         Specifically, gradients displayed at an angle (ie. 45 degrees) are rendered
2695         as if they are vertical when the body tag containing the gradient
2696         has a height of 0. Other browsers do not render under these circumstances,
2697         so WebKit was modified to follow in suit. The problem was due to layout sizes for
2698         fill tiles being calculated with a minimum height of 1px. A simple change of the
2699         minimum height and width to 0px was enough to bring about the desired behavior.
2700
2701         Tests: angled-background-repeating-gradient-rendering-vertical.html
2702
2703         * rendering/RenderBoxModelObject.cpp:
2704         (WebCore::RenderBoxModelObject::calculateFillTileSize const):
2705
2706 2018-09-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2707
2708         No DOM API to instantiate an attachment for an img element
2709         https://bugs.webkit.org/show_bug.cgi?id=189934
2710         <rdar://problem/44743222>
2711
2712         Reviewed by Ryosuke Niwa.
2713
2714         Adds support for HTMLAttachmentElement.getAttachmentIdentifier, a function that internal WebKit clients can use
2715         to ensure that an image element is backed by a unique _WKAttachment. See below for more details.
2716
2717         Tests:  WKAttachmentTests.AddAttachmentToConnectedImageElement
2718                 WKAttachmentTests.ChangeFileWrapperForPastedImage
2719                 WKAttachmentTests.ConnectImageWithAttachmentToDocument
2720
2721         * dom/Document.cpp:
2722         (WebCore::Document::registerAttachmentIdentifier):
2723
2724         Add a new hook to register an empty _WKAttachment in the UI process with a given identifier. Used when creating
2725         a new empty attachment to back an image element.
2726
2727         * dom/Document.h:
2728         * editing/Editor.cpp:
2729         (WebCore::Editor::registerAttachmentIdentifier):
2730         (WebCore::Editor::notifyClientOfAttachmentUpdates):
2731         * editing/Editor.h:
2732         * html/HTMLAttachmentElement.cpp:
2733         (WebCore::HTMLAttachmentElement::getAttachmentIdentifier):
2734
2735         Creates an attachment element to back the image element, if an attachment does not already exist, and returns
2736         the unique identifier. This also causes an empty corresponding _WKAttachment to be created in the client, whose
2737         file wrapper determines the contents of the image.
2738
2739         (WebCore::HTMLAttachmentElement::ensureUniqueIdentifier):
2740         (WebCore::HTMLAttachmentElement::hasEnclosingImage const):
2741         (WebCore::HTMLAttachmentElement::updateEnclosingImageWithData):
2742
2743         Add a helper that updates the source of the enclosing image element given a content type and image data, by
2744         creating a new blob and blob URL.
2745
2746         * html/HTMLAttachmentElement.h:
2747         * html/HTMLAttachmentElement.idl:
2748         * html/HTMLImageElement.idl:
2749
2750         Rename webkitAttachmentIdentifier to just attachmentIdentifier.
2751
2752         * page/EditorClient.h:
2753         (WebCore::EditorClient::registerAttachmentIdentifier):
2754         (WebCore::EditorClient::didInsertAttachmentWithIdentifier):
2755
2756 2018-09-28  Chris Dumez  <cdumez@apple.com>
2757
2758         The return value of an OnBeforeUnloadEventHandler should always be coerced into a DOMString
2759         https://bugs.webkit.org/show_bug.cgi?id=190090
2760
2761         Reviewed by Ryosuke Niwa.
2762
2763         The return value of an OnBeforeUnloadEventHandler should always be coerced into a DOMString:
2764         - https://html.spec.whatwg.org/#onbeforeunloadeventhandler
2765         - https://html.spec.whatwg.org/#the-event-handler-processing-algorithm (Step 5)
2766
2767         In particular, this means that returning false in an OnBeforeUnloadEventHandler should NOT
2768         cancel the event when the event is a CustomEvent (and not a BeforeUnloadEvent). This is
2769         because the return value cannot be false at:
2770         - https://html.spec.whatwg.org/#the-event-handler-processing-algorithm (Step 5. Otherwise case).
2771
2772         No new tests, rebaselined existing test.
2773
2774         * bindings/js/JSEventListener.cpp:
2775         (WebCore::JSEventListener::handleEvent):
2776
2777 2018-09-28  Simon Fraser  <simon.fraser@apple.com>
2778
2779         RenderLayer::removeOnlyThisLayer() should not call updateLayerPositions()
2780         https://bugs.webkit.org/show_bug.cgi?id=190093
2781
2782         Reviewed by Dean Jackson and Zalan Bujtas.
2783         
2784         It's wrong for RenderLayer::removeOnlyThisLayer() to call updateLayerPositions(),
2785         because this is called at style update time, and layout will be stale.
2786         
2787         It was added (see webkit.org/b/25252) so that opacity changes, which can destroy layers, correctly update
2788         descendants. However, RenderStyle::changeRequiresLayout() checks for opacity <=> no opacity
2789         changes and triggers layout accordingly, which will result in a full post-layout
2790         updateLayerPositions().
2791         
2792         This also revealed that changes to the "isolate" property fail to trigger any kind of style recalc or layout;
2793         we need it to trigger layout (for now) because it affects z-order.
2794
2795         Covered by existing tests.
2796
2797         * rendering/RenderLayer.cpp:
2798         (WebCore::RenderLayer::removeOnlyThisLayer):
2799         * rendering/style/RenderStyle.cpp:
2800         (WebCore::RenderStyle::changeRequiresLayout const):
2801
2802 2018-09-28  Jiewen Tan  <jiewen_tan@apple.com>
2803
2804         [WebAuthN] Polish WebAuthN auto-test environment
2805         https://bugs.webkit.org/show_bug.cgi?id=189283
2806         <rdar://problem/44117828>
2807
2808         Reviewed by Chris Dumez.
2809
2810         This patch removes the old mocking mechanism.
2811
2812         Tests: http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https.html
2813                http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https.html
2814                http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https.html
2815
2816         * DerivedSources.make:
2817         * WebCore.xcodeproj/project.pbxproj:
2818         * testing/Internals.cpp:
2819         (WebCore::Internals::Internals):
2820         (WebCore::Internals::mockAuthenticatorCoordinator const): Deleted.
2821         * testing/Internals.h:
2822         * testing/Internals.idl:
2823         * testing/MockAuthenticatorCoordinator.cpp: Removed.
2824         * testing/MockAuthenticatorCoordinator.h: Removed.
2825         * testing/MockAuthenticatorCoordinator.idl: Removed.
2826
2827 2018-09-28  Jer Noble  <jer.noble@apple.com>
2828
2829         Refactoring: eliminate raw pointer usage in Fullscreen code
2830         https://bugs.webkit.org/show_bug.cgi?id=188747
2831         <rdar://problem/43541164>
2832
2833         Reviewed by Alex Christensen.
2834
2835         Two sources of raw pointers in the Fullscreen code:
2836         - Model classes (PlaybackSessionModel and VideoFullscreenModel) aren't ref-able, so
2837           they are passed around as raw references.
2838         - Observer classes (PlaybackSessionModelClient and VideoFullscreenModelClient, and
2839           VideoFullscreenChangeObserver) are also passed around as raw pointers, but shouldn't
2840           be ref-able.
2841
2842         Make Model classes ref-able by adding ref() and deref() which call virtual refModel and
2843         derefModel methods, overridden by implementing subclasses. Make every concrete observer
2844         inherit from CanMakeWeakPtr, and every registration method take WeakPtr wrappers around
2845         the client interface.
2846
2847         Since every Interface class now holds a strong reference to its Model classes, and each
2848         Model class holds a weak reference to all its clients, no explicit invalidate() method
2849         is necessary.
2850
2851         Notes:
2852
2853         - Since the weak pointer methods need to be able to downcast to the abstract base class,
2854           observers need to inherit publically (rather than privately) from those base classes.
2855         - Media element Models should compose EventListener rather than inheriting from it, since
2856           EventListener has its own RefCount.
2857         - WeakPtrs can't be held in HashSets (because they change value, and therefore hash, when
2858           their underlying object is destroyed), so clients should be stored in a Vector instead.
2859         - Interfaces should be given all required Refs at creation time, so that they can store
2860           those parameters as Refs instead of RefPtrs.
2861
2862         * platform/cocoa/PlaybackSessionInterface.h:
2863         (WebCore::PlaybackSessionInterface::~PlaybackSessionInterface): Deleted.
2864         * platform/cocoa/PlaybackSessionModel.h:
2865         (WebCore::PlaybackSessionModel::ref):
2866         (WebCore::PlaybackSessionModel::deref):
2867         (WebCore::PlaybackSessionModel::~PlaybackSessionModel): Deleted.
2868         * platform/cocoa/PlaybackSessionModelMediaElement.h:
2869         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
2870         (WebCore::PlaybackSessionModelMediaElement::PlaybackSessionModelMediaElement):
2871         (WebCore::PlaybackSessionModelMediaElement::~PlaybackSessionModelMediaElement):
2872         (WebCore::PlaybackSessionModelMediaElement::setMediaElement):
2873         (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
2874         (WebCore::PlaybackSessionModelMediaElement::addClient):
2875         (WebCore::PlaybackSessionModelMediaElement::removeClient):
2876         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionOptions):
2877         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionIndices):
2878         (WebCore::PlaybackSessionModelMediaElement::handleEvent): Deleted.
2879         * platform/cocoa/VideoFullscreenChangeObserver.h:
2880         (WebCore::VideoFullscreenChangeObserver::~VideoFullscreenChangeObserver): Deleted.
2881         * platform/cocoa/VideoFullscreenModel.h:
2882         (WebCore::VideoFullscreenModel::ref):
2883         (WebCore::VideoFullscreenModel::deref):
2884         (WebCore::VideoFullscreenModel::~VideoFullscreenModel): Deleted.
2885         * platform/cocoa/VideoFullscreenModelVideoElement.h:
2886         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
2887         (VideoFullscreenModelVideoElement::VideoFullscreenModelVideoElement):
2888         (VideoFullscreenModelVideoElement::setVideoElement):
2889         (VideoFullscreenModelVideoElement::addClient):
2890         (VideoFullscreenModelVideoElement::removeClient):
2891         (VideoFullscreenModelVideoElement::setHasVideo):
2892         (VideoFullscreenModelVideoElement::setVideoDimensions):
2893         (VideoFullscreenModelVideoElement::willEnterPictureInPicture):
2894         (VideoFullscreenModelVideoElement::didEnterPictureInPicture):
2895         (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture):
2896         (VideoFullscreenModelVideoElement::willExitPictureInPicture):
2897         (VideoFullscreenModelVideoElement::didExitPictureInPicture):
2898         (VideoFullscreenModelVideoElement::handleEvent): Deleted.
2899         * platform/ios/PlaybackSessionInterfaceAVKit.h:
2900         (WebCore::PlaybackSessionInterfaceAVKit::create):
2901         (WebCore::PlaybackSessionInterfaceAVKit::playbackSessionModel const):
2902         (): Deleted.
2903         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
2904         (WebCore::PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit):
2905         (WebCore::PlaybackSessionInterfaceAVKit::~PlaybackSessionInterfaceAVKit):
2906         (WebCore::PlaybackSessionInterfaceAVKit::invalidate): Deleted.
2907         * platform/ios/VideoFullscreenInterfaceAVKit.h:
2908         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2909         (-[WebAVPlayerLayer layoutSublayers]):
2910         (-[WebAVPlayerLayer resolveBounds]):
2911         (-[WebAVPlayerLayer setVideoGravity:]):
2912         (VideoFullscreenInterfaceAVKit::create):
2913         (VideoFullscreenInterfaceAVKit::VideoFullscreenInterfaceAVKit):
2914         (VideoFullscreenInterfaceAVKit::~VideoFullscreenInterfaceAVKit):
2915         (VideoFullscreenInterfaceAVKit::setVideoFullscreenChangeObserver):
2916         (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
2917         (VideoFullscreenInterfaceAVKit::setupFullscreen):
2918         (VideoFullscreenInterfaceAVKit::presentingViewController):
2919         (VideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen):
2920         (VideoFullscreenInterfaceAVKit::preparedToExitFullscreen):
2921         (VideoFullscreenInterfaceAVKit::willStartPictureInPicture):
2922         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
2923         (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture):
2924         (VideoFullscreenInterfaceAVKit::willStopPictureInPicture):
2925         (VideoFullscreenInterfaceAVKit::didStopPictureInPicture):
2926         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
2927         (VideoFullscreenInterfaceAVKit::doSetup):
2928         (VideoFullscreenInterfaceAVKit::setMode):
2929         (VideoFullscreenInterfaceAVKit::clearMode):
2930         (VideoFullscreenInterfaceAVKit::setVideoFullscreenModel): Deleted.
2931         (VideoFullscreenInterfaceAVKit::invalidate): Deleted.
2932         * platform/ios/WebAVPlayerController.h:
2933         * platform/ios/WebAVPlayerController.mm:
2934         (-[WebAVPlayerController delegate]):
2935         (-[WebAVPlayerController playbackSessionInterface]):
2936         (-[WebAVPlayerController setPlaybackSessionInterface:]):
2937         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2938         (VideoFullscreenControllerContext::didCleanupFullscreen):
2939         (VideoFullscreenControllerContext::addClient):
2940         (VideoFullscreenControllerContext::removeClient):
2941         (VideoFullscreenControllerContext::willEnterPictureInPicture):
2942         (VideoFullscreenControllerContext::didEnterPictureInPicture):
2943         (VideoFullscreenControllerContext::failedToEnterPictureInPicture):
2944         (VideoFullscreenControllerContext::willExitPictureInPicture):
2945         (VideoFullscreenControllerContext::didExitPictureInPicture):
2946         (VideoFullscreenControllerContext::setUpFullscreen):
2947         * platform/mac/PlaybackSessionInterfaceMac.h:
2948         * platform/mac/PlaybackSessionInterfaceMac.mm:
2949         (WebCore::PlaybackSessionInterfaceMac::create):
2950         (WebCore::PlaybackSessionInterfaceMac::PlaybackSessionInterfaceMac):
2951         (WebCore::PlaybackSessionInterfaceMac::playbackSessionModel const):
2952         (WebCore::PlaybackSessionInterfaceMac::rateChanged):
2953         (WebCore::PlaybackSessionInterfaceMac::beginScrubbing):
2954         (WebCore::PlaybackSessionInterfaceMac::endScrubbing):
2955         (WebCore::PlaybackSessionInterfaceMac::setPlayBackControlsManager):
2956         (WebCore::PlaybackSessionInterfaceMac::updatePlaybackControlsManagerTiming):
2957         (WebCore::PlaybackSessionInterfaceMac::~PlaybackSessionInterfaceMac): Deleted.
2958         (WebCore::PlaybackSessionInterfaceMac::invalidate): Deleted.
2959         * platform/mac/VideoFullscreenInterfaceMac.h:
2960         (WebCore::VideoFullscreenInterfaceMac::create):
2961         (WebCore::VideoFullscreenInterfaceMac::videoFullscreenModel const):
2962         (WebCore::VideoFullscreenInterfaceMac::playbackSessionModel const):
2963         (WebCore::VideoFullscreenInterfaceMac::videoFullscreenChangeObserver const):
2964         * platform/mac/VideoFullscreenInterfaceMac.mm:
2965         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]):
2966         (-[WebVideoFullscreenInterfaceMacObjC boundsDidChangeForVideoViewContainer:]):
2967         (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]):
2968         (-[WebVideoFullscreenInterfaceMacObjC pipActionPlay:]):
2969         (-[WebVideoFullscreenInterfaceMacObjC pipActionPause:]):
2970         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]):
2971         (WebCore::VideoFullscreenInterfaceMac::VideoFullscreenInterfaceMac):
2972         (WebCore::VideoFullscreenInterfaceMac::~VideoFullscreenInterfaceMac):
2973         (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenChangeObserver):
2974         (WebCore::VideoFullscreenInterfaceMac::setMode):
2975         (WebCore::VideoFullscreenInterfaceMac::clearMode):
2976         (WebCore::VideoFullscreenInterfaceMac::invalidate):
2977         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitPiP):
2978         (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenModel): Deleted.
2979         * platform/mac/WebPlaybackControlsManager.mm:
2980         (-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]):
2981         (-[WebPlaybackControlsManager setCurrentAudioTouchBarMediaSelectionOption:]):
2982         (-[WebPlaybackControlsManager setCurrentLegibleTouchBarMediaSelectionOption:]):
2983         (-[WebPlaybackControlsManager togglePlayback]):
2984         (-[WebPlaybackControlsManager setPlaying:]):
2985         (-[WebPlaybackControlsManager isPlaying]):
2986         (-[WebPlaybackControlsManager togglePictureInPicture]):
2987
2988 2018-09-28  Chris Dumez  <cdumez@apple.com>
2989
2990         Drop support for cross-origin-window-policy header
2991         https://bugs.webkit.org/show_bug.cgi?id=190081
2992
2993         Reviewed by Ryosuke Niwa.
2994
2995         Drop support for cross-origin-window-policy header as this was never enabled and its design has
2996         some issues we have not resolved. An alternative is being worked on but will be substantially
2997         different so there is not much value in keeping this code around.
2998
2999         * bindings/js/JSDOMBindingSecurity.cpp:
3000         * bindings/js/JSDOMBindingSecurity.h:
3001         * bindings/js/JSDOMWindowCustom.cpp:
3002         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
3003         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
3004         (WebCore::addCrossOriginWindowPropertyNames):
3005         (WebCore::addScopedChildrenIndexes):
3006         (WebCore::addCrossOriginWindowOwnPropertyNames):
3007         (WebCore::JSDOMWindow::getOwnPropertyNames):
3008         * bindings/js/JSDOMWindowCustom.h:
3009         * bindings/js/JSRemoteDOMWindowCustom.cpp:
3010         * bindings/scripts/CodeGeneratorJS.pm:
3011         (GenerateAttributeGetterBodyDefinition):
3012         (GenerateAttributeSetterBodyDefinition):
3013         (GenerateOperationBodyDefinition):
3014         * bindings/scripts/IDLAttributes.json:
3015         * dom/Document.cpp:
3016         (WebCore::Document::canNavigate):
3017         * loader/FrameLoader.cpp:
3018         (WebCore::FrameLoader::didBeginDocument):
3019         * page/AbstractDOMWindow.cpp:
3020         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
3021         * page/AbstractDOMWindow.h:
3022         * page/DOMWindow.idl:
3023         * page/Settings.yaml:
3024         * platform/network/HTTPParsers.cpp:
3025         * platform/network/HTTPParsers.h:
3026
3027 2018-09-28  Daniel Bates  <dabates@apple.com>
3028
3029         [iOS] Allow programmatic focus when hardware keyboard is attached
3030         https://bugs.webkit.org/show_bug.cgi?id=190017
3031         <rdar://problem/42270463>
3032
3033         Reviewed by Wenson Hsieh.
3034
3035         Add support for checking if the embedding client is WebKitTestRunner and export isDumpRenderTree()
3036         so that we can make use of it from WebKit. We will make use of these functions to keep the current
3037         behavior of disallowing programmatic focus when running tests in these apps. This is needed to
3038         keep testing deterministic. Otherwise, test results would be dependent on whether a hardware
3039         keyboard is attached. When running tests in Simulator.app the hardware keyboard may also not be
3040         connected (i.e. Hardware > Keyboard > Connect Hardware Keyboard is disabled).
3041
3042         * platform/RuntimeApplicationChecks.h:
3043         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
3044         (WebCore::IOSApplication::isWebKitTestRunner): Added.
3045
3046 2018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
3047
3048         REGRESSION(r236609): API tests for mso list preservation are failing
3049         https://bugs.webkit.org/show_bug.cgi?id=190095
3050
3051         Reviewed by Wenson Hsieh.
3052
3053         The regression was caused by appendNodeToPreserveMSOList called after an early return for not having renderer.
3054         Clearly, comment & style elements coming from a MS word document wouldn't have a renderer.
3055
3056         Fixed the bug by changing the order.
3057
3058         * editing/markup.cpp:
3059         (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
3060
3061 2018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
3062
3063         Build fix after r236612.
3064
3065         * platform/win/PasteboardWin.cpp:
3066         (WebCore::Pasteboard::writeSelection):
3067
3068 2018-09-28  Andy Estes  <aestes@apple.com>
3069
3070         [Apple Pay] Remove the "in-store" button type
3071         https://bugs.webkit.org/show_bug.cgi?id=190079
3072
3073         Reviewed by Tim Horton.
3074
3075         According to <https://developer.apple.com/design/human-interface-guidelines/apple-pay/buttons-and-marks/buttons/>,
3076         this button is meant only for certain kinds of native apps. It shouldn't be available on the web.
3077
3078         Updated http/tests/ssl/applepay/ApplePayButton.html.
3079
3080         * css/CSSPrimitiveValueMappings.h:
3081         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3082         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const):
3083         * css/CSSValueKeywords.in:
3084         * css/parser/CSSParserFastPaths.cpp:
3085         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
3086         * rendering/RenderThemeCocoa.mm:
3087         (WebCore::toPKPaymentButtonType):
3088         * rendering/style/RenderStyleConstants.h:
3089
3090 2018-09-28  Chris Dumez  <cdumez@apple.com>
3091
3092         document.open() should throw errors for cross-origin calls
3093         https://bugs.webkit.org/show_bug.cgi?id=189371
3094         <rdar://problem/44282700>
3095
3096         Reviewed by Youenn Fablet.
3097
3098         document.open() / document.write() should throw errors for cross-origin calls as per:
3099         - https://html.spec.whatwg.org/#document-open-steps (Step 4)
3100
3101         No new tests, rebaselined existing tests.
3102
3103         * dom/Document.cpp:
3104         (WebCore::Document::open):
3105         (WebCore::Document::write):
3106         (WebCore::Document::writeln):
3107         * dom/Document.h:
3108
3109 2018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
3110
3111         Rename createMarkup to serializePreservingVisualAppearance
3112         https://bugs.webkit.org/show_bug.cgi?id=190086
3113
3114         Reviewed by Wenson Hsieh.
3115
3116         Renamed the function to clarify what it does. Also removed the unused Range::toHTML.
3117
3118         * dom/Range.cpp:
3119         (WebCore::Range::toHTML const): Deleted.
3120         * dom/Range.h:
3121         * editing/CompositeEditCommand.cpp:
3122         (WebCore::CompositeEditCommand::moveParagraphs):
3123         * editing/cocoa/EditorCocoa.mm:
3124         (WebCore::Editor::selectionInHTMLFormat):
3125         * editing/gtk/EditorGtk.cpp:
3126         (WebCore::Editor::writeSelectionToPasteboard):
3127         * editing/markup.cpp:
3128         (WebCore::serializePreservingVisualAppearance):
3129         (WebCore::createMarkup): Deleted.
3130         * editing/markup.h:
3131         * editing/wpe/EditorWPE.cpp:
3132         (WebCore::Editor::writeSelectionToPasteboard):
3133         * loader/archive/cf/LegacyWebArchive.cpp:
3134         (WebCore::LegacyWebArchive::create):
3135         (WebCore::LegacyWebArchive::createFromSelection):
3136         * platform/win/PasteboardWin.cpp:
3137         (WebCore::Pasteboard::writeRangeToDataObject):
3138
3139 2018-09-28  Simon Fraser  <simon.fraser@apple.com>
3140
3141         Remove some unused RenderLayer code
3142         https://bugs.webkit.org/show_bug.cgi?id=190078
3143
3144         Reviewed by Zalan Bujtas.
3145
3146         The 'outOfFlowDescendantContainingBlocks' code was related to the accelerated overflow scrolling code that
3147         I removed recently.
3148         
3149         updateDescendantsLayerListsIfNeeded() is never called.
3150
3151         * rendering/RenderLayer.cpp:
3152         (WebCore::RenderLayer::updateDescendantDependentFlags):
3153         (WebCore::RenderLayer::calculateClipRects const):
3154         * rendering/RenderLayer.h:
3155
3156 2018-09-28  Commit Queue  <commit-queue@webkit.org>
3157
3158         Unreviewed, rolling out r236605.
3159         https://bugs.webkit.org/show_bug.cgi?id=190087
3160
3161         caused three API test timeouts (Requested by jernoble on
3162         #webkit).
3163
3164         Reverted changeset:
3165
3166         "Refactoring: eliminate raw pointer usage in Fullscreen code"
3167         https://bugs.webkit.org/show_bug.cgi?id=188747
3168         https://trac.webkit.org/changeset/236605
3169
3170 2018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
3171
3172         Simplify StyledMarkupAccumulator::traverseNodesForSerialization
3173         https://bugs.webkit.org/show_bug.cgi?id=190073
3174
3175         Reviewed by Antti Koivisto.
3176
3177         Simplified the range traversal algorithm in traverseNodesForSerialization as it was too complicated
3178         to support shadow DOM for copy and paste.
3179
3180         Instead of using NodeTraversal::next to traverse past ancestors and then figuring out which ancestor
3181         must be closed or to wrap the existing markup with, new code collects the list of ancestors as we
3182         traverse out of them.
3183
3184         Also extracted lambdas for generating markup and deciding whether to skip a node as well as keeping
3185         track of the depth of the current markup. This further reduces the code complexity of the actual
3186         node traversal algorithm. Keeping track of the depth allows us to now generate ancestor elements'
3187         closing tags without keeping a stack of ancestor nodes we opened at all times.
3188
3189         * editing/markup.cpp:
3190         (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
3191
3192 2018-09-27  Ryosuke Niwa  <rniwa@webkit.org>
3193
3194         Replace every use of Node::offsetInCharacters() by Node::isCharacterDataNode()
3195         https://bugs.webkit.org/show_bug.cgi?id=190069
3196
3197         Reviewed by Zalan Bujtas.
3198
3199         Removed Node::offsetInCharacters() and replaced every use of it by isCharacterDataNode()
3200         because their implementations are identical.
3201
3202         Note that offsetInCharacters() sounds like a function which returns some kind of an offset
3203         but it doesn't. It returns true when called on a CharacterData and false elsewhere.
3204
3205         * accessibility/AXObjectCache.cpp:
3206         (WebCore::characterOffsetsInOrder):
3207         (WebCore::AXObjectCache::startOrEndCharacterOffsetForRange):
3208         (WebCore::AXObjectCache::characterOffsetFromVisiblePosition):
3209         * dom/CharacterData.cpp:
3210         (WebCore::CharacterData::offsetInCharacters const): Deleted.
3211         * dom/CharacterData.h:
3212         * dom/Node.cpp:
3213         (WebCore::Node::offsetInCharacters const): Deleted.
3214         * dom/Node.h:
3215         * dom/Position.cpp:
3216         (WebCore::Position::parentAnchoredEquivalent const):
3217         * dom/Position.h:
3218         (WebCore::lastOffsetInNode):
3219         (WebCore::minOffsetForNode):
3220         (WebCore::offsetIsBeforeLastNodeOffset):
3221         * dom/Range.cpp:
3222         (WebCore::Range::firstNode const):
3223         (WebCore::Range::pastLastNode const):
3224         * dom/RangeBoundaryPoint.h:
3225         (WebCore::RangeBoundaryPoint::setOffset):
3226         (WebCore::RangeBoundaryPoint::setToEndOfNode):
3227         * editing/Editing.cpp:
3228         (WebCore::lastOffsetForEditing):
3229         * editing/TextIterator.cpp:
3230         (WebCore::nextInPreOrderCrossingShadowBoundaries):
3231         (WebCore::TextIterator::node const):
3232         (WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
3233         * page/DOMSelection.cpp:
3234         (WebCore::DOMSelection::extend):
3235
3236 2018-09-28  Jer Noble  <jer.noble@apple.com>
3237
3238         Refactoring: eliminate raw pointer usage in Fullscreen code
3239         https://bugs.webkit.org/show_bug.cgi?id=188747
3240         <rdar://problem/43541164>
3241
3242         Reviewed by Alex Christensen.
3243
3244         Two sources of raw pointers in the Fullscreen code:
3245         - Model classes (PlaybackSessionModel and VideoFullscreenModel) aren't ref-able, so
3246           they are passed around as raw references.
3247         - Observer classes (PlaybackSessionModelClient and VideoFullscreenModelClient, and
3248           VideoFullscreenChangeObserver) are also passed around as raw pointers, but shouldn't
3249           be ref-able.
3250
3251         Make Model classes ref-able by adding ref() and deref() which call virtual refModel and
3252         derefModel methods, overridden by implementing subclasses. Make every concrete observer
3253         inherit from CanMakeWeakPtr, and every registration method take WeakPtr wrappers around
3254         the client interface.
3255
3256         Since every Interface class now holds a strong reference to its Model classes, and each
3257         Model class holds a weak reference to all its clients, no explicit invalidate() method
3258         is necessary.
3259
3260         Notes:
3261
3262         - Since the weak pointer methods need to be able to downcast to the abstract base class,
3263           observers need to inherit publically (rather than privately) from those base classes.
3264         - Media element Models should compose EventListener rather than inheriting from it, since
3265           EventListener has its own RefCount.
3266         - WeakPtrs can't be held in HashSets (because they change value, and therefore hash, when
3267           their underlying object is destroyed), so clients should be stored in a Vector instead.
3268         - Interfaces should be given all required Refs at creation time, so that they can store
3269           those parameters as Refs instead of RefPtrs.
3270
3271         * platform/cocoa/PlaybackSessionInterface.h:
3272         (WebCore::PlaybackSessionInterface::~PlaybackSessionInterface): Deleted.
3273         * platform/cocoa/PlaybackSessionModel.h:
3274         (WebCore::PlaybackSessionModel::ref):
3275         (WebCore::PlaybackSessionModel::deref):
3276         (WebCore::PlaybackSessionModel::~PlaybackSessionModel): Deleted.
3277         * platform/cocoa/PlaybackSessionModelMediaElement.h:
3278         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
3279         (WebCore::PlaybackSessionModelMediaElement::PlaybackSessionModelMediaElement):
3280         (WebCore::PlaybackSessionModelMediaElement::~PlaybackSessionModelMediaElement):
3281         (WebCore::PlaybackSessionModelMediaElement::setMediaElement):
3282         (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
3283         (WebCore::PlaybackSessionModelMediaElement::addClient):
3284         (WebCore::PlaybackSessionModelMediaElement::removeClient):
3285         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionOptions):
3286         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionIndices):
3287         (WebCore::PlaybackSessionModelMediaElement::handleEvent): Deleted.
3288         * platform/cocoa/VideoFullscreenChangeObserver.h:
3289         (WebCore::VideoFullscreenChangeObserver::~VideoFullscreenChangeObserver): Deleted.
3290         * platform/cocoa/VideoFullscreenModel.h:
3291         (WebCore::VideoFullscreenModel::ref):
3292         (WebCore::VideoFullscreenModel::deref):
3293         (WebCore::VideoFullscreenModel::~VideoFullscreenModel): Deleted.
3294         * platform/cocoa/VideoFullscreenModelVideoElement.h:
3295         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
3296         (VideoFullscreenModelVideoElement::VideoFullscreenModelVideoElement):
3297         (VideoFullscreenModelVideoElement::setVideoElement):
3298         (VideoFullscreenModelVideoElement::addClient):
3299         (VideoFullscreenModelVideoElement::removeClient):
3300         (VideoFullscreenModelVideoElement::setHasVideo):
3301         (VideoFullscreenModelVideoElement::setVideoDimensions):
3302         (VideoFullscreenModelVideoElement::willEnterPictureInPicture):
3303         (VideoFullscreenModelVideoElement::didEnterPictureInPicture):
3304         (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture):
3305         (VideoFullscreenModelVideoElement::willExitPictureInPicture):
3306         (VideoFullscreenModelVideoElement::didExitPictureInPicture):
3307         (VideoFullscreenModelVideoElement::handleEvent): Deleted.
3308         * platform/ios/PlaybackSessionInterfaceAVKit.h:
3309         (WebCore::PlaybackSessionInterfaceAVKit::create):
3310         (WebCore::PlaybackSessionInterfaceAVKit::playbackSessionModel const):
3311         (): Deleted.
3312         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
3313         (WebCore::PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit):
3314         (WebCore::PlaybackSessionInterfaceAVKit::~PlaybackSessionInterfaceAVKit):
3315         (WebCore::PlaybackSessionInterfaceAVKit::invalidate): Deleted.
3316         * platform/ios/VideoFullscreenInterfaceAVKit.h:
3317         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
3318         (-[WebAVPlayerLayer layoutSublayers]):
3319         (-[WebAVPlayerLayer resolveBounds]):
3320         (-[WebAVPlayerLayer setVideoGravity:]):
3321         (VideoFullscreenInterfaceAVKit::create):
3322         (VideoFullscreenInterfaceAVKit::VideoFullscreenInterfaceAVKit):
3323         (VideoFullscreenInterfaceAVKit::~VideoFullscreenInterfaceAVKit):
3324         (VideoFullscreenInterfaceAVKit::setVideoFullscreenChangeObserver):
3325         (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
3326         (VideoFullscreenInterfaceAVKit::setupFullscreen):
3327         (VideoFullscreenInterfaceAVKit::presentingViewController):
3328         (VideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen):
3329         (VideoFullscreenInterfaceAVKit::preparedToExitFullscreen):
3330         (VideoFullscreenInterfaceAVKit::willStartPictureInPicture):
3331         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
3332         (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture):
3333         (VideoFullscreenInterfaceAVKit::willStopPictureInPicture):
3334         (VideoFullscreenInterfaceAVKit::didStopPictureInPicture):
3335         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
3336         (VideoFullscreenInterfaceAVKit::doSetup):
3337         (VideoFullscreenInterfaceAVKit::setMode):
3338         (VideoFullscreenInterfaceAVKit::clearMode):
3339         (VideoFullscreenInterfaceAVKit::setVideoFullscreenModel): Deleted.
3340         (VideoFullscreenInterfaceAVKit::invalidate): Deleted.
3341         * platform/ios/WebAVPlayerController.h:
3342         * platform/ios/WebAVPlayerController.mm:
3343         (-[WebAVPlayerController delegate]):
3344         (-[WebAVPlayerController playbackSessionInterface]):
3345         (-[WebAVPlayerController setPlaybackSessionInterface:]):
3346         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3347         (VideoFullscreenControllerContext::didCleanupFullscreen):
3348         (VideoFullscreenControllerContext::addClient):
3349         (VideoFullscreenControllerContext::removeClient):
3350         (VideoFullscreenControllerContext::willEnterPictureInPicture):
3351         (VideoFullscreenControllerContext::didEnterPictureInPicture):
3352         (VideoFullscreenControllerContext::failedToEnterPictureInPicture):
3353         (VideoFullscreenControllerContext::willExitPictureInPicture):
3354         (VideoFullscreenControllerContext::didExitPictureInPicture):
3355         (VideoFullscreenControllerContext::setUpFullscreen):
3356         * platform/mac/PlaybackSessionInterfaceMac.h:
3357         * platform/mac/PlaybackSessionInterfaceMac.mm:
3358         (WebCore::PlaybackSessionInterfaceMac::create):
3359         (WebCore::PlaybackSessionInterfaceMac::PlaybackSessionInterfaceMac):
3360         (WebCore::PlaybackSessionInterfaceMac::playbackSessionModel const):
3361         (WebCore::PlaybackSessionInterfaceMac::rateChanged):
3362         (WebCore::PlaybackSessionInterfaceMac::beginScrubbing):
3363         (WebCore::PlaybackSessionInterfaceMac::endScrubbing):
3364         (WebCore::PlaybackSessionInterfaceMac::setPlayBackControlsManager):
3365         (WebCore::PlaybackSessionInterfaceMac::updatePlaybackControlsManagerTiming):
3366         (WebCore::PlaybackSessionInterfaceMac::~PlaybackSessionInterfaceMac): Deleted.
3367         (WebCore::PlaybackSessionInterfaceMac::invalidate): Deleted.
3368         * platform/mac/VideoFullscreenInterfaceMac.h:
3369         (WebCore::VideoFullscreenInterfaceMac::create):
3370         (WebCore::VideoFullscreenInterfaceMac::videoFullscreenModel const):
3371         (WebCore::VideoFullscreenInterfaceMac::playbackSessionModel const):
3372         (WebCore::VideoFullscreenInterfaceMac::videoFullscreenChangeObserver const):
3373         * platform/mac/VideoFullscreenInterfaceMac.mm:
3374         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]):
3375         (-[WebVideoFullscreenInterfaceMacObjC boundsDidChangeForVideoViewContainer:]):
3376         (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]):
3377         (-[WebVideoFullscreenInterfaceMacObjC pipActionPlay:]):
3378         (-[WebVideoFullscreenInterfaceMacObjC pipActionPause:]):
3379         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]):
3380         (WebCore::VideoFullscreenInterfaceMac::VideoFullscreenInterfaceMac):
3381         (WebCore::VideoFullscreenInterfaceMac::~VideoFullscreenInterfaceMac):
3382         (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenChangeObserver):
3383         (WebCore::VideoFullscreenInterfaceMac::setMode):
3384         (WebCore::VideoFullscreenInterfaceMac::clearMode):
3385         (WebCore::VideoFullscreenInterfaceMac::invalidate):
3386         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitPiP):
3387         (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenModel): Deleted.
3388         * platform/mac/WebPlaybackControlsManager.mm:
3389         (-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]):
3390         (-[WebPlaybackControlsManager setCurrentAudioTouchBarMediaSelectionOption:]):
3391         (-[WebPlaybackControlsManager setCurrentLegibleTouchBarMediaSelectionOption:]):
3392         (-[WebPlaybackControlsManager togglePlayback]):
3393         (-[WebPlaybackControlsManager setPlaying:]):
3394         (-[WebPlaybackControlsManager isPlaying]):
3395         (-[WebPlaybackControlsManager togglePictureInPicture]):
3396