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