[MediaStream] RealtimeMediaSource should be able to vend hashed IDs
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-10-02  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-02  Philippe Normand  <pnormand@igalia.com>
141
142         [GStreamer][playbin3] Stream tag lists leaks
143         https://bugs.webkit.org/show_bug.cgi?id=190192
144
145         Reviewed by Xabier Rodriguez-Calvar.
146
147         The gst_stream_get_tags() result is transfer-full, so needs to be adopted to prevent a leak.
148         Also check the tags list pointer which might be NULL in some cases.
149
150         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
151         (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
152         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
153         (WebCore::MediaPlayerPrivateGStreamer::naturalSize const):
154         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
155         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
156
157 2018-10-01  Michael Catanzaro  <mcatanzaro@igalia.com>
158
159         Unreviewed, fix unused variable in RenderLayer::updateScrollableAreaSet
160
161         * rendering/RenderLayer.cpp:
162         (WebCore::RenderLayer::calculateClipRects const): This is a prepare-ChangeLog bug. I don't
163         have any changes in this function....
164
165 2018-10-02  Alicia Boya García  <aboya@igalia.com>
166
167         [MSE][GStreamer] Make same thread assert non-release
168         https://bugs.webkit.org/show_bug.cgi?id=189924
169
170         Reviewed by Xabier Rodriguez-Calvar.
171
172         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
173         (WebCore::AppendPipeline::handleNewAppsinkSample):
174
175 2018-10-01  Ryosuke Niwa  <rniwa@webkit.org>
176
177         Add a new variant of serializePreservingVisualAppearance which takes VisibleSelection
178         https://bugs.webkit.org/show_bug.cgi?id=190108
179
180         Reviewed by Wenson Hsieh.
181
182         Added a version of serializePreservingVisualAppearance which takes VisibleSelection so that we can avoid creating
183         a range simply to get the first node and the end node of the selection later. This simple change also fixes a bug
184         demonstrated in editing/pasteboard/paste-table-003.html.
185
186         Test: editing/pasteboard/paste-table-003.html
187
188         * editing/cocoa/EditorCocoa.mm:
189         (WebCore::Editor::selectionInHTMLFormat): Adopt the new variant.
190         * editing/gtk/EditorGtk.cpp:
191         (WebCore::Editor::writeSelectionToPasteboard): Ditto.
192         * editing/markup.cpp:
193         (WebCore::serializePreservingVisualAppearance): Added.
194         * editing/markup.h:
195         * editing/wpe/EditorWPE.cpp:
196         (WebCore::Editor::writeSelectionToPasteboard): Ditto.
197         * loader/archive/cf/LegacyWebArchive.cpp:
198         (WebCore::LegacyWebArchive::createFromSelection): Ditto.
199         * platform/win/PasteboardWin.cpp:
200         (WebCore::Pasteboard::writeSelection): Ditto.
201
202 2018-10-01  Alex Christensen  <achristensen@webkit.org>
203
204         Don't read from WebCore's bundle for IDNScriptWhiteList
205         https://bugs.webkit.org/show_bug.cgi?id=190157
206
207         Reviewed by Dan Bernstein.
208
209         No change in behavior.  This increases performance by not reading from the WebCore bundle,
210         and it makes it so that URL-related functionality can be moved to a place without
211         a bundle for resources.
212
213         * Resources/IDNScriptWhiteList.txt: Removed.
214         * WebCore.xcodeproj/project.pbxproj:
215         * platform/mac/WebCoreNSURLExtras.mm:
216         (WebCore::whiteListIDNScripts):
217         (WebCore::allCharactersInIDNScriptWhiteList):
218         (WebCore::readIDNScriptWhiteListFile): Deleted.
219
220 2018-10-01  Alex Christensen  <achristensen@webkit.org>
221
222         Unreviewed, rolling out r236551.
223
224         Fails URL validating too aggressively
225
226         Reverted changeset:
227
228         "URLWithUserTypedString should return nil for URLs deemed to
229         be invalid by WebCore::URL"
230         https://bugs.webkit.org/show_bug.cgi?id=189979
231         https://trac.webkit.org/changeset/236551
232
233 2018-10-01  Keith Miller  <keith_miller@apple.com>
234
235         Create a RELEASE_AND_RETURN macro for ExceptionScopes
236         https://bugs.webkit.org/show_bug.cgi?id=190163
237
238         Reviewed by Mark Lam.
239
240         The new RELEASE_AND_RETURN does all the work for cases
241         where you want to return the result of some expression
242         without explicitly checking for an exception. This is
243         much like the existing RETURN_IF_EXCEPTION macro.
244
245         No new tests since this is a refactor.
246
247         * bridge/runtime_array.cpp:
248         (JSC::RuntimeArray::put):
249
250 2018-10-01  Daniel Bates  <dabates@apple.com>
251
252         Attempt to fix the watchOS build after <https://trac.webkit.org/changeset/236678>
253         (https://bugs.webkit.org/show_bug.cgi?id=189974)
254
255         Explicitly cast index to unsigned to make the operator[] call unambiguous.
256
257         * platform/ios/KeyEventIOS.mm:
258         (WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent):
259
260 2018-10-01  Ryosuke Niwa  <rniwa@webkit.org>
261
262         ASAN failure in ~GCReachableRef()
263         https://bugs.webkit.org/show_bug.cgi?id=190113
264
265         Reviewed by Darin Adler.
266
267         The bug was caused by ~GCReachableRef accessing Ref after it had been poisoned for ASAN
268         in Ref::leakRef via Ref(Ref&& other). Fixed the bug by using RefPtr instead since that's
269         the simplest solution here although we could unpoison Ref temporarily as done in ~Ref.
270
271         * dom/GCReachableRef.h:
272         (WebCore::GCReachableRef::GCReachableRef):
273         (WebCore::GCReachableRef::~GCReachableRef):
274         (WebCore::GCReachableRef::operator-> const):
275         (WebCore::GCReachableRef::get const):
276         (WebCore::GCReachableRef::operator T& const):
277         (WebCore::GCReachableRef::operator! const):
278         (WebCore::GCReachableRef::isNull const): Deleted.
279
280 2018-10-01  Sihui Liu  <sihui_liu@apple.com>
281
282         Remove StorageProcess
283         https://bugs.webkit.org/show_bug.cgi?id=189975
284
285         Reviewed by Geoffrey Garen.
286
287         Clean up code. No behavior change.
288
289         * English.lproj/Localizable.strings:
290
291 2018-10-01  Alicia Boya García  <aboya@igalia.com>
292
293         [MSE][GStreamer] Set a minimum sample duration
294         https://bugs.webkit.org/show_bug.cgi?id=190125
295
296         Reviewed by Xabier Rodriguez-Calvar.
297
298         The last sample of the audio track in the asset used in this test
299         player has a tiny duration (100 ns):
300
301         http://orange-opensource.github.io/hasplayer.js/1.2.0/player.html?url=http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism/Manifest
302
303         So small, we were truncating it to zero. We're not supposed to have
304         frames with zero duration. Instead, lets set a minimum frame duration
305         for those fringe cases.
306
307         * platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
308         (WebCore::MediaSampleGStreamer::MediaSampleGStreamer):
309
310 2018-10-01  Daniel Bates  <dabates@apple.com>
311
312         [iOS] Special keys are misidentified in DOM keyboard events
313         https://bugs.webkit.org/show_bug.cgi?id=189974
314
315         Reviewed by Wenson Hsieh.
316
317         This patch fixes two issues:
318             1. Special keyboard keys would be misidentified in dispatched DOM keyboard events.
319             2. DOM keypress events may not be dispatched for some special keys.
320
321         UIKit uses special input strings to identify the Page Up, Page Down, Escape, Up Arrow, Down Arrow,
322         Left Arrow, and Right Arrow keys. It also uses ASCII control characters to represent some other
323         special keys, including Num Lock / Clear, Home, End, Forward Delete, and F1, ..., F24. We need
324         to explicitly handle these special keyboard keys in order to be able to identify the key that
325         was pressed as well as to correctly disambiguate a key down to know whether to dispatch a DOM
326         keypress event for the key.
327
328         Unlike UIKit, AppKit reserves Unicode Private Use Area (PUA) code points in 0xF700–0xF8FF to
329         represent special keyboard keys. This makes it straightforward to disambiguate such keys using
330         the input string of the keyboard event alone. To simplify the implementation for iOS
331         we normalize the input string be AppKit compatible. See the explaination for WebCore::windowsKeyCodeForCharCode()
332         below for more details on why this is done.
333
334         Tests: fast/events/ios/keydown-keyup-arrow-keys-in-non-editable-element.html
335                fast/events/ios/keypress-keys-in-non-editable-element.html
336
337         * SourcesCocoa.txt:
338         * WebCore.xcodeproj/project.pbxproj:
339         Do not use unified source build strategy when building WebEvent.mm as it makes
340         use of SoftLinking macros that are incompatible with this strategy.
341
342         * platform/ios/KeyEventIOS.mm:
343         (WebCore::windowsKeyCodeForCharCode): Recognize some special AppKit special char codes.
344         These special char codes are generated by WebKit. WebKit uses the same special char codes
345         as AppKit as a convenience instead of defining our own constants for the same purpose.
346         Encoding the special UIKit input strings (e.g. up arrow) as distinct char codes allows us
347         to use integer arithmetic and switch blocks to map characters to Windows virtual key
348         codes as opposed to special cased branches to perform pointer or string comparisions.
349         The latter would be necessary in Modern WebKit in order for key down events to be properly
350         disambiguated to dispatch a DOM keypress event because pointers are not perserved, though
351         what they point to is, when sending the WebEvent from UIProcess to the WebProcess and
352         vice versa.
353         (WebCore::isFunctionKey): Convenience function that determines whether the specified char
354         code corresponds to a function key on the keyboard. The term "function key" is taken from
355         AppKit parlance to describe a special keyboard key. These keys include F1, F2, ..., F24,
356         and cursor keys among other special keyboard keys.
357         (WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent): Write in terms of isFunctionKey().
358         * platform/ios/PlatformEventFactoryIOS.h:
359         * platform/ios/PlatformEventFactoryIOS.mm:
360         (WebCore::keyIdentifierForKeyEvent): Remove code to handle UIKit special input strings as
361         we now map such special input strings to char codes and hence can use the default code path.
362         (WebCore::keyForKeyEvent): Ditto.
363         (WebCore::codeForKeyEvent): Remove code to compute the Window virtual key code corresponding
364         to a UIKit special key command now that we map such special input strings to char codes and
365         subsequently map the char codes to the Windows virtual key code (see -[WebEvent initWithKeyEventType:...]
366         constructors). So, we can now use WebEvent.keyCode directly to compute the DOM UIEvents code
367         for the event.
368         (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): Remove code to fix up
369         WebEvent.keyCode to account for UIKit special input strings now that we map such special key
370         commands to char codes and subsequently map the char codes to the Windows virtual key code (see -[WebEvent initWithKeyEventType:...]
371         constructors). So, we can now take WebEvent.keyCode verbatim to be the Window virtual key code.
372         (WebCore::convertSpecialKeyToCharCode): Deleted.
373         (WebCore::keyCodeForEvent): Deleted.
374         * platform/ios/WebEvent.mm:
375         (normalizedStringWithAppKitCompatibilityMapping): Added; converts a UIKit character string
376         to the corresponding AppKit-compatible one (if not already compatible). See the explaination
377         for WebCore::windowsKeyCodeForCharCode() above for more details on why this is done.
378
379         (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:keyCode:isTabKey:characterSet:]):
380         (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:withInputManagerHint:keyCode:isTabKey:]):
381         Normalize the character strings to be AppKit compatible.
382
383 2018-10-01  Simon Fraser  <simon.fraser@apple.com>
384
385         Optimize RenderStyle::diff() and clean up the code
386         https://bugs.webkit.org/show_bug.cgi?id=190104
387
388         Reviewed by Dan Bernstein.
389
390         RenderStyle::changeRequiresLayout() and related should only check values on 
391         m_rareNonInheritedData and m_rareInheritedData after checking for pointer equality.
392         To reduce the chances of future changes regressing this, move code comparing values
393         on StyleRare[Non]InheritedData into dedication functions.
394         
395         In addition, the transform comparison double-compared the transformOperations,
396         because m_rareNonInheritedData->transform != other.m_rareNonInheritedData->transform
397         is a deep comparison, and it was followed by *m_rareNonInheritedData->transform != *other.m_rareNonInheritedData->transform.
398         Change the first to be a pointer comparison.
399
400         * rendering/style/RenderStyle.cpp:
401         (WebCore::rareNonInheritedDataChangeRequiresLayout):
402         (WebCore::rareInheritedDataChangeRequiresLayout):
403         (WebCore::RenderStyle::changeRequiresLayout const):
404         (WebCore::rareNonInheritedDataChangeRequiresLayerRepaint):
405         (WebCore::RenderStyle::changeRequiresLayerRepaint const):
406         (WebCore::rareNonInheritedDataChangeRequiresRepaint):
407         (WebCore::rareInheritedDataChangeRequiresRepaint):
408         (WebCore::RenderStyle::changeRequiresRepaint const):
409
410 2018-10-01  Alex Christensen  <achristensen@webkit.org>
411
412         URL should not use TextEncoding internally
413         https://bugs.webkit.org/show_bug.cgi?id=190111
414
415         Reviewed by Andy Estes.
416
417         That dependency makes it impossible to move or use elsewhere.
418         Using TextEncoding was overkill because we know the credentials are UTF-8 percent-encoded in a parsed URL.
419         No change in behavior as verified by new API tests.
420
421         * page/SecurityOrigin.cpp:
422         * page/csp/ContentSecurityPolicySourceList.cpp:
423         * platform/URL.cpp:
424         (WebCore::decodeEscapeSequencesFromParsedURL):
425         (WebCore::URL::user const):
426         (WebCore::URL::pass const):
427         (WebCore::URL::fileSystemPath const):
428         (WebCore::decodeURLEscapeSequences): Deleted.
429         * platform/URL.h:
430         * platform/network/DataURLDecoder.cpp:
431         * platform/text/TextEncoding.cpp:
432         (WebCore::decodeURLEscapeSequences):
433         * platform/text/TextEncoding.h:
434
435 2018-10-01  Simon Pieters  <zcorpan@gmail.com>
436
437         <form> in quirks mode should have margin-block-end: 1em
438         https://bugs.webkit.org/show_bug.cgi?id=157788
439
440         Reviewed by Simon Fraser.
441
442         Change the default style for forms to take writing-mode into account
443         in quirks mode. Matches the behavior of Gecko and Edge and the HTML
444         standard.
445
446         Spec: https://html.spec.whatwg.org/multipage/rendering.html#flow-content-3
447
448         Test: imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/flow-content-0/form-margin-quirk.html
449
450         * css/quirks.css:
451         (form):
452
453 2018-10-01  Jeremy Jones  <jeremyj@apple.com>
454
455         Unify implementation in VideoFullscreenInterfaceAVKit
456         https://bugs.webkit.org/show_bug.cgi?id=190091
457         rdar://problem/44734523
458
459         Reviewed by Jer Noble.
460
461         No new tests because no behavior change.
462
463         Unified code in VideoFullscreenInterfaceAVKit now that new code path is proven and include
464         any changes that had been made in the old path.
465
466         * platform/ios/VideoFullscreenInterfaceAVKit.h:
467         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
468         (-[WebAVPlayerViewControllerDelegate playerViewControllerShouldStartPictureInPictureFromInlineWhenEnteringBackground:]):
469         (VideoFullscreenInterfaceAVKit::preparedToExitFullscreen):
470         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
471         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
472         (VideoFullscreenControllerContext::requestUpdateInlineRect):
473         (VideoFullscreenControllerContext::requestVideoContentLayer):
474         (VideoFullscreenControllerContext::returnVideoContentLayer):
475         (VideoFullscreenControllerContext::didSetupFullscreen):
476         (VideoFullscreenControllerContext::didExitFullscreen):
477
478 2018-10-01  Antoine Quint  <graouts@apple.com>
479
480         [Web Animations] Ensure renderers with accelerated animations have layers
481         https://bugs.webkit.org/show_bug.cgi?id=189990
482
483         Reviewed by Simon Fraser.
484
485         In r236501 we added code that would make a RenderBox and a RenderInline query the document timeline for whether a given element has
486         accelerated animations running on it. Since the calls to requiresLayer() are in a hot path, we instead keep a list of elements with
487         exclusively accelerated animations running.
488
489         No new tests, this is already covered by webanimations/accelerated-animation-with-delay.html and webanimations/opacity-animation-yields-compositing-span.html
490         which respectively check that we can apply an accelerated animation to a non-positioned block and an inline element.
491
492         * animation/AnimationTimeline.h:
493         * animation/DocumentTimeline.cpp:
494         (WebCore::DocumentTimeline::detachFromDocument):
495         (WebCore::DocumentTimeline::animationWasAddedToElement):
496         (WebCore::DocumentTimeline::animationWasRemovedFromElement):
497         (WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange):
498         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement): Iterate over an element's animations to determine
499         whether all of its animations are running accelerated, then update the HashSet containing elements running accelerated animations to remove or
500         add this element.
501         (WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated const): Make a simple contains() call on the HashSet containing elements
502         running accelerated animations.
503         * animation/DocumentTimeline.h:
504         * animation/KeyframeEffectReadOnly.cpp:
505         (WebCore::KeyframeEffectReadOnly::updateAcceleratedAnimationState):
506         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
507         * rendering/RenderBoxModelObject.h:
508
509 2018-10-01  Alicia Boya García  <aboya@igalia.com>
510
511         [GStreamer] Fix abort in gst_sample_get_info()
512         https://bugs.webkit.org/show_bug.cgi?id=190135
513
514         Reviewed by Philippe Normand.
515
516         A flush can occur before any frame has finished decoding -- especially
517         in tests, where actions on the player often occur in quick succession.
518
519         Therefore, the code must not assume by the time a flush occurs any
520         frame has reached the sink. This patch fixes a case when such wrong
521         assumption was causing gst_sample_get_info() to abort (crashing
522         WebKit).
523
524         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
525         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
526         (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink):
527
528 2018-10-01  Olivier Blin  <olivier.blin@softathome.com>
529
530         [WPE] fix buffer over-read in RenderThemeWPE::mediaControlsStyleSheet()
531         https://bugs.webkit.org/show_bug.cgi?id=190139
532
533         Reviewed by Michael Catanzaro.
534
535         Like done upstream for EFL in r210213
536         https://bugs.webkit.org/show_bug.cgi?id=166622
537
538         This has been detected by a charactersAreAllASCII() assert failure.
539
540         This is because ASCIILiteral() is wrongly used in mediaControlsStyleSheet().
541         mediaControlsBaseUserAgentStyleSheet is a char array, not a null-terminated string.
542         It is thus incorrect to use StringImpl::createFromLiteral() that calls
543         strlen() to get the string length.
544
545         The String::ConstructFromLiteral constructor can not be used, since it
546         skips the last character.
547
548         * platform/wpe/RenderThemeWPE.cpp:
549         (WebCore::RenderThemeWPE::mediaControlsStyleSheet):
550         Explicitely pass the size to the String constructor.
551
552 2018-10-01  Rob Buis  <rbuis@igalia.com>
553
554         Align XMLHttpRequest's overrideMimeType() with the standard
555         https://bugs.webkit.org/show_bug.cgi?id=169276
556
557         Reviewed by Chris Dumez.
558
559         Implement the overrideMimeType() as specified in that standard, i.e.
560         add a check that the passed mime type is valid and if not fallback
561         to application/octet-stream.
562
563         In order for this patch to have any effect, I went ahead and
564         made an improvement to the ContentType parsing, parseContentType now
565         will reject mime types that do not match the type / subtype format, I
566         believe this is required by both RFC2045 and mimesniff specs.
567
568         This behavior matches Chrome and Firefox.
569
570         Test: web-platform-tests/xhr/overridemimetype-invalid-mime-type.htm
571
572         * platform/network/ParsedContentType.cpp:
573         (WebCore::parseContentType):
574         * xml/XMLHttpRequest.cpp:
575         (WebCore::XMLHttpRequest::overrideMimeType):
576
577
578 2018-10-01  Chris Dumez  <cdumez@apple.com>
579
580         Make crossOriginObject.then undefined for promises
581         https://bugs.webkit.org/show_bug.cgi?id=190094
582
583         Reviewed by Darin Adler.
584
585         Make crossOriginObject.then undefined for promises. This allows promises to work better with cross-origin WindowProxy
586         and Location objects.
587
588         Specification:
589         - https://github.com/whatwg/html/pull/3242
590         - https://github.com/whatwg/dom/issues/536
591
592         This aligns our behavior with Blink and Gecko.
593
594         No new tests, rebaselined existing test.
595
596         * bindings/js/JSDOMWindowCustom.cpp:
597         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
598         (WebCore::addCrossOriginWindowOwnPropertyNames):
599         * bindings/js/JSLocationCustom.cpp:
600         (WebCore::getOwnPropertySlotCommon):
601         (WebCore::addCrossOriginLocationOwnPropertyNames):
602
603 2018-10-01  Xan Lopez  <xan@igalia.com>
604
605         [SOUP] Fix the build for libsoup > 2.61.90
606         https://bugs.webkit.org/show_bug.cgi?id=190126
607
608         Reviewed by Michael Catanzaro.
609
610         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
611
612 2018-10-01  Alicia Boya García  <aboya@igalia.com>
613
614         [MSE][GStreamer] Reset running time in PlaybackPipeline::flush()
615         https://bugs.webkit.org/show_bug.cgi?id=190076
616
617         Reviewed by Philippe Normand.
618
619         Test: media/media-source/media-source-seek-redundant-append.html
620
621         PlaybackPipeline::flush() is called when already enqueued frames are
622         appended again. This may be caused by a quality change or just a
623         redundant append. Either way, the pipeline has to be flushed and
624         playback begin again, but without changing the player position by
625         much.
626
627         There are two kinds of time to consider here: stream time (i.e. the
628         time of a frame as written in the file, e.g. a frame may have stream
629         time 0:01:00), and running time (i.e. how much time since playback
630         started should pass before the frame should be played, e.g. if we
631         started playing at 0:00:59 that same frame would have a running time
632         of just 1 second).
633
634         Notice how running time depends on where and when playback starts.
635         Running time can also be optionally resetted after a flush. (This is
636         indeed done currently by most demuxers after a seek.)
637
638         Instead of resetting running time, PlaybackPipeline used to modify the
639         first GstSegment emitted after the flush. A GstSegment declares the
640         mapping between stream time and running time for the following frames.
641         There, PlaybackPipeline used to set `base` (the running time at which
642         the segment starts) to the position reported by a position query
643         (which is stream time).
644
645         This, of course, only worked when playback (or the last seek) started
646         at stream time 0:00:00, since that's the only case where running time
647         equals stream time. In other cases delays as long as the difference
648         between these timelines would appear. This is demonstrated in the
649         attached test, where seeks and appends are made in such an order that
650         the difference is more than 5 minutes, making the playback stall for
651         >5 minutes before playing 1 second of audio.
652
653         This patch fixes the problem by resetting running time with the flush
654         and not modifying GstSegment.base anymore (it will be left as zero,
655         which is now correct since the running time has been reset).
656
657         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
658         (WebCore::PlaybackPipeline::flush):
659         (WebCore::segmentFixerProbe): Deleted.
660
661 2018-09-30  Ryosuke Niwa  <rniwa@webkit.org>
662
663         Use Position instead of Range in createMarkupInternal
664         https://bugs.webkit.org/show_bug.cgi?id=190107
665
666         Reviewed by Darin Adler.
667
668         Use two Position's indicating start and end instead of Range in createMarkupInternal and StylizedMarkupAccumulator
669         in order to support copy & paste across shadow boundaries in the bug 157443. This patch also removes the use of
670         Range in MarkupAccumulator since all uses of range is via StylizedMarkupAccumulator.
671
672         Also renamed createMarkupInternal to serializePreservingVisualAppearanceInternal to match the rename in r236612.
673
674         * dom/Position.cpp:
675         (WebCore::Position::firstNode const):  Added.
676         * dom/Position.h:
677         * editing/MarkupAccumulator.cpp:
678         (WebCore::MarkupAccumulator::MarkupAccumulator): No longer takes Range.
679         (WebCore::MarkupAccumulator::appendText): Removed the code to truncate string at the boundary points of the range.
680         * editing/MarkupAccumulator.h:
681         (WebCore::MarkupAccumulator): Made this class non-copyable.
682         * editing/markup.cpp:
683         (WebCore::StyledMarkupAccumulator::StyledMarkupAccumulator): Now takes and stores two positions.
684
685         (WebCore::StyledMarkupAccumulator::appendText): Use textContentRespectingRange in the case annotation is disabled
686         instead of calling to MarkupAccumulator::appendText, which no longer respects boundary offsets.
687
688         (WebCore::StyledMarkupAccumulator::renderedTextRespectingRange): Renamed from renderedText. Updated to respect
689         boundary offsets defined by m_start and m_end Positions instead of m_range Range.
690
691         (WebCore::StyledMarkupAccumulator::textContentRespectingRange): Renamed from stringValueForRange. Ditto.
692
693         (WebCore::StyledMarkupAccumulator::serializeNodes): Now computes startNode and pastEnd nodes from start and end
694         Positions. Note that the end position is always the next node in the tree order  for a character node
695         and computeNodeAfterPosition returns nullptr for a character data.
696
697         (WebCore::highestAncestorToWrapMarkup): Now takes two positions instead of a range.
698
699         (WebCore::serializePreservingVisualAppearanceInternal): Renamed from createMarkupInternal. Removed the obsolete
700         comments which were added for DOMRange in WebKitLegacy.
701
702         (WebCore::serializePreservingVisualAppearance):
703
704         (WebCore::sanitizedMarkupForFragmentInDocument): Create positions instead of a range to pass to
705         serializePreservingVisualAppearanceInternal.
706
707         (WebCore::serializeFragment):
708
709         * editing/markup.h:
710         * page/PageSerializer.cpp:
711         (WebCore::PageSerializer::SerializerMarkupAccumulator): Removed the unnecessary WebCore namespace qualifier.
712
713 2018-09-30  Walker Henderson  <wjahenderson@gmail.com>
714
715         AudioNode.connect should return passed destination node
716         https://bugs.webkit.org/show_bug.cgi?id=188834
717
718         Reviewed by Eric Carlson.
719
720         No new tests, rebaselined existing test.
721
722         * Modules/webaudio/AudioBasicInspectorNode.cpp:
723         (WebCore::AudioBasicInspectorNode::connect): Deleted.
724         * Modules/webaudio/AudioBasicInspectorNode.h:
725         * Modules/webaudio/AudioNode.cpp:
726         * Modules/webaudio/AudioNode.h:
727         * Modules/webaudio/AudioNode.idl:
728
729 2018-09-30  Eric Carlson  <eric.carlson@apple.com>
730
731         [MediaStream] Clean up RealtimeMediaSource settings change handling
732         https://bugs.webkit.org/show_bug.cgi?id=189998
733         <rdar://problem/44797884>
734
735         Reviewed by Youenn Fablet.
736
737         No new tests, updated webrtc/video-disabled-black.html.
738
739         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
740         (WebCore::CanvasCaptureMediaStreamTrack::Source::Source):
741         (WebCore::CanvasCaptureMediaStreamTrack::Source::settings):
742         (WebCore::CanvasCaptureMediaStreamTrack::Source::settingsDidChange):
743         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized):
744         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
745         * platform/mediastream/RealtimeIncomingVideoSource.cpp:
746         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
747         (WebCore::RealtimeIncomingVideoSource::settings):
748         (WebCore::RealtimeIncomingVideoSource::settingsDidChange):
749         * platform/mediastream/RealtimeIncomingVideoSource.h:
750         * platform/mediastream/RealtimeMediaSource.cpp:
751         (WebCore::RealtimeMediaSource::settingsDidChange):
752         (WebCore::RealtimeMediaSource::notifySettingsDidChangeObservers):
753         (WebCore::RealtimeMediaSource::setSize):
754         (WebCore::RealtimeMediaSource::setFrameRate):
755         (WebCore::RealtimeMediaSource::setAspectRatio):
756         (WebCore::RealtimeMediaSource::setFacingMode):
757         (WebCore::RealtimeMediaSource::setVolume):
758         (WebCore::RealtimeMediaSource::setSampleRate):
759         (WebCore::RealtimeMediaSource::setSampleSize):
760         (WebCore::RealtimeMediaSource::setEchoCancellation):
761         * platform/mediastream/RealtimeMediaSource.h:
762         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
763         (WebCore::GStreamerAudioCaptureSource::settingsDidChange):
764         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
765         (WebCore::GStreamerVideoCaptureSource::settingsDidChange):
766         * platform/mediastream/mac/AVVideoCaptureSource.mm:
767         (WebCore::AVVideoCaptureSource::settingsDidChange):
768         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
769         (WebCore::CoreAudioCaptureSource::settingsDidChange):
770         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
771         (WebCore::DisplayCaptureSourceCocoa::settingsDidChange):
772         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
773         (WebCore::RealtimeIncomingVideoSourceCocoa::processNewSample):
774         * platform/mock/MockRealtimeAudioSource.cpp:
775         (WebCore::MockRealtimeAudioSource::settingsDidChange):
776         * platform/mock/MockRealtimeVideoSource.cpp:
777         (WebCore::MockRealtimeVideoSource::settingsDidChange):
778
779 2018-09-30  Eric Carlson  <eric.carlson@apple.com>
780
781         [MediaStream] Use display-specific capture factories
782         https://bugs.webkit.org/show_bug.cgi?id=190043
783         <rdar://problem/44834412>
784
785         Reviewed by Youenn Fablet.
786
787         No new tests, no change in functionality.
788
789         * Sources.txt:
790         * WebCore.xcodeproj/project.pbxproj:
791         * platform/mediastream/RealtimeMediaSource.cpp:
792         (WebCore::RealtimeMediaSource::AudioCaptureFactory::~AudioCaptureFactory): Deleted.
793         (WebCore::RealtimeMediaSource::VideoCaptureFactory::~VideoCaptureFactory): Deleted.
794         * platform/mediastream/RealtimeMediaSource.h:
795         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
796         (WebCore::RealtimeMediaSourceCenter::createMediaStream):
797         (WebCore::RealtimeMediaSourceCenter::getDisplayMediaDevices):
798         * platform/mediastream/RealtimeMediaSourceCenter.h:
799         (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
800         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
801         * platform/mediastream/RealtimeMediaSourceFactory.cpp: Added.
802         (WebCore::SingleSourceFactory::setActiveSource):
803         (WebCore::SingleSourceFactory::unsetActiveSource):
804         * platform/mediastream/RealtimeMediaSourceFactory.h: Added.
805         (WebCore::SingleSourceFactory::activeSource):
806         (WebCore::VideoCaptureFactory::setVideoCapturePageState):
807         (WebCore::DisplayCaptureFactory::setDisplayCapturePageState):
808         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
809         (WebCore::libWebRTCVideoCaptureSourceFactory):
810         (WebCore::libWebRTCDisplayCaptureSourceFactory):
811         (WebCore::GStreamerVideoCaptureSource::factory):
812         (WebCore::GStreamerVideoCaptureSource::displayFactory):
813         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h:
814         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp:
815         (WebCore::RealtimeMediaSourceCenterLibWebRTC::audioCaptureSourceFactory):
816         (WebCore::RealtimeMediaSourceCenterLibWebRTC::audioFactory):
817         (WebCore::RealtimeMediaSourceCenterLibWebRTC::videoFactory):
818         (WebCore::RealtimeMediaSourceCenterLibWebRTC::displayCaptureFactory):
819         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h:
820         * platform/mediastream/mac/AVVideoCaptureSource.mm:
821         (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
822         (WebCore::AVVideoCaptureSource::setupCaptureSession):
823         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
824         (WebCore::CoreAudioCaptureSource::factory):
825         * platform/mediastream/mac/CoreAudioCaptureSource.h:
826         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
827         (WebCore::RealtimeMediaSourceCenterMac::videoCaptureSourceFactory):
828         (WebCore::RealtimeMediaSourceCenterMac::displayCaptureSourceFactory):
829         (WebCore::RealtimeMediaSourceCenterMac::audioCaptureSourceFactory):
830         (WebCore::RealtimeMediaSourceCenterMac::audioFactory):
831         (WebCore::RealtimeMediaSourceCenterMac::videoFactory):
832         (WebCore::RealtimeMediaSourceCenterMac::displayCaptureFactory):
833         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
834         * platform/mock/MockRealtimeAudioSource.cpp:
835         (WebCore::MockRealtimeAudioSource::~MockRealtimeAudioSource):
836         (WebCore::MockRealtimeAudioSource::startProducingData):
837         (): Deleted.
838         (WebCore::mockAudioCaptureSourceFactory): Deleted.
839         (WebCore::MockRealtimeAudioSource::factory): Deleted.
840         * platform/mock/MockRealtimeAudioSource.h:
841         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
842         (WebCore::MockRealtimeVideoSourceFactory::setVideoCapturePageState):
843         (WebCore::MockRealtimeMediaSourceCenter::audioFactory):
844         (WebCore::MockRealtimeMediaSourceCenter::videoFactory):
845         (WebCore::MockRealtimeMediaSourceCenter::displayCaptureFactory):
846         * platform/mock/MockRealtimeMediaSourceCenter.h:
847         * platform/mock/MockRealtimeVideoSource.cpp:
848         (): Deleted.
849         (WebCore::MockRealtimeVideoSourceFactory::setVideoCapturePageState): Deleted.
850         (WebCore::mockVideoCaptureSourceFactory): Deleted.
851         (WebCore::MockRealtimeVideoSource::factory): Deleted.
852         * platform/mock/MockRealtimeVideoSource.h:
853
854 2018-09-29  Oriol Brufau  <obrufau@igalia.com>
855
856         [css-grid] Properly align items next to collapsed tracks with gutters
857         https://bugs.webkit.org/show_bug.cgi?id=190089
858
859         Reviewed by Manuel Rego Casasnovas.
860
861         gridAreaPositionForInFlowChild could return a wrong end position for
862         grid items adjacent to a collapsed track, because it didn't take into
863         account that gutters collapse in that case. Therefore, "center" or
864         "end" alignments displayed the item at the wrong position.
865
866         Test: imported/w3c/web-platform-tests/css/css-grid/alignment/grid-gutters-013.html
867
868         * rendering/RenderGrid.cpp:
869         (WebCore::RenderGrid::gridAreaPositionForInFlowChild const):
870
871 2018-09-29  Alicia Boya García  <aboya@igalia.com>
872
873         [GStreamer][MSE] Use GObject for GST_TRACE_OBJECT
874         https://bugs.webkit.org/show_bug.cgi?id=190045
875
876         Reviewed by Philippe Normand.
877
878         Passing a non-GObject object to GST_TRACE_OBJECT() can be
879         theoretically misunderstood by the GStreamer logging function, so this
880         patch avoids that.
881
882         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
883         (WebCore::AppendPipeline::appsrcEndOfAppendCheckerProbe):
884         (WebCore::AppendPipeline::handleEndOfAppend):
885         (WebCore::AppendPipeline::consumeAppsinkAvailableSamples):
886         (WebCore::AppendPipeline::pushNewBuffer):
887
888 2018-09-28  Zamiul Haque  <zhaque@apple.com>
889
890         Angled gradient backgrounds in body render vertically when body height is 0
891         https://bugs.webkit.org/show_bug.cgi?id=177232
892         <rdar://problem/34548230>.
893
894         Reviewed by Tim Horton.
895
896         Specifically, gradients displayed at an angle (ie. 45 degrees) are rendered
897         as if they are vertical when the body tag containing the gradient
898         has a height of 0. Other browsers do not render under these circumstances,
899         so WebKit was modified to follow in suit. The problem was due to layout sizes for
900         fill tiles being calculated with a minimum height of 1px. A simple change of the
901         minimum height and width to 0px was enough to bring about the desired behavior.
902
903         Tests: angled-background-repeating-gradient-rendering-vertical.html
904
905         * rendering/RenderBoxModelObject.cpp:
906         (WebCore::RenderBoxModelObject::calculateFillTileSize const):
907
908 2018-09-28  Wenson Hsieh  <wenson_hsieh@apple.com>
909
910         No DOM API to instantiate an attachment for an img element
911         https://bugs.webkit.org/show_bug.cgi?id=189934
912         <rdar://problem/44743222>
913
914         Reviewed by Ryosuke Niwa.
915
916         Adds support for HTMLAttachmentElement.getAttachmentIdentifier, a function that internal WebKit clients can use
917         to ensure that an image element is backed by a unique _WKAttachment. See below for more details.
918
919         Tests:  WKAttachmentTests.AddAttachmentToConnectedImageElement
920                 WKAttachmentTests.ChangeFileWrapperForPastedImage
921                 WKAttachmentTests.ConnectImageWithAttachmentToDocument
922
923         * dom/Document.cpp:
924         (WebCore::Document::registerAttachmentIdentifier):
925
926         Add a new hook to register an empty _WKAttachment in the UI process with a given identifier. Used when creating
927         a new empty attachment to back an image element.
928
929         * dom/Document.h:
930         * editing/Editor.cpp:
931         (WebCore::Editor::registerAttachmentIdentifier):
932         (WebCore::Editor::notifyClientOfAttachmentUpdates):
933         * editing/Editor.h:
934         * html/HTMLAttachmentElement.cpp:
935         (WebCore::HTMLAttachmentElement::getAttachmentIdentifier):
936
937         Creates an attachment element to back the image element, if an attachment does not already exist, and returns
938         the unique identifier. This also causes an empty corresponding _WKAttachment to be created in the client, whose
939         file wrapper determines the contents of the image.
940
941         (WebCore::HTMLAttachmentElement::ensureUniqueIdentifier):
942         (WebCore::HTMLAttachmentElement::hasEnclosingImage const):
943         (WebCore::HTMLAttachmentElement::updateEnclosingImageWithData):
944
945         Add a helper that updates the source of the enclosing image element given a content type and image data, by
946         creating a new blob and blob URL.
947
948         * html/HTMLAttachmentElement.h:
949         * html/HTMLAttachmentElement.idl:
950         * html/HTMLImageElement.idl:
951
952         Rename webkitAttachmentIdentifier to just attachmentIdentifier.
953
954         * page/EditorClient.h:
955         (WebCore::EditorClient::registerAttachmentIdentifier):
956         (WebCore::EditorClient::didInsertAttachmentWithIdentifier):
957
958 2018-09-28  Chris Dumez  <cdumez@apple.com>
959
960         The return value of an OnBeforeUnloadEventHandler should always be coerced into a DOMString
961         https://bugs.webkit.org/show_bug.cgi?id=190090
962
963         Reviewed by Ryosuke Niwa.
964
965         The return value of an OnBeforeUnloadEventHandler should always be coerced into a DOMString:
966         - https://html.spec.whatwg.org/#onbeforeunloadeventhandler
967         - https://html.spec.whatwg.org/#the-event-handler-processing-algorithm (Step 5)
968
969         In particular, this means that returning false in an OnBeforeUnloadEventHandler should NOT
970         cancel the event when the event is a CustomEvent (and not a BeforeUnloadEvent). This is
971         because the return value cannot be false at:
972         - https://html.spec.whatwg.org/#the-event-handler-processing-algorithm (Step 5. Otherwise case).
973
974         No new tests, rebaselined existing test.
975
976         * bindings/js/JSEventListener.cpp:
977         (WebCore::JSEventListener::handleEvent):
978
979 2018-09-28  Simon Fraser  <simon.fraser@apple.com>
980
981         RenderLayer::removeOnlyThisLayer() should not call updateLayerPositions()
982         https://bugs.webkit.org/show_bug.cgi?id=190093
983
984         Reviewed by Dean Jackson and Zalan Bujtas.
985         
986         It's wrong for RenderLayer::removeOnlyThisLayer() to call updateLayerPositions(),
987         because this is called at style update time, and layout will be stale.
988         
989         It was added (see webkit.org/b/25252) so that opacity changes, which can destroy layers, correctly update
990         descendants. However, RenderStyle::changeRequiresLayout() checks for opacity <=> no opacity
991         changes and triggers layout accordingly, which will result in a full post-layout
992         updateLayerPositions().
993         
994         This also revealed that changes to the "isolate" property fail to trigger any kind of style recalc or layout;
995         we need it to trigger layout (for now) because it affects z-order.
996
997         Covered by existing tests.
998
999         * rendering/RenderLayer.cpp:
1000         (WebCore::RenderLayer::removeOnlyThisLayer):
1001         * rendering/style/RenderStyle.cpp:
1002         (WebCore::RenderStyle::changeRequiresLayout const):
1003
1004 2018-09-28  Jiewen Tan  <jiewen_tan@apple.com>
1005
1006         [WebAuthN] Polish WebAuthN auto-test environment
1007         https://bugs.webkit.org/show_bug.cgi?id=189283
1008         <rdar://problem/44117828>
1009
1010         Reviewed by Chris Dumez.
1011
1012         This patch removes the old mocking mechanism.
1013
1014         Tests: http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https.html
1015                http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https.html
1016                http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https.html
1017
1018         * DerivedSources.make:
1019         * WebCore.xcodeproj/project.pbxproj:
1020         * testing/Internals.cpp:
1021         (WebCore::Internals::Internals):
1022         (WebCore::Internals::mockAuthenticatorCoordinator const): Deleted.
1023         * testing/Internals.h:
1024         * testing/Internals.idl:
1025         * testing/MockAuthenticatorCoordinator.cpp: Removed.
1026         * testing/MockAuthenticatorCoordinator.h: Removed.
1027         * testing/MockAuthenticatorCoordinator.idl: Removed.
1028
1029 2018-09-28  Jer Noble  <jer.noble@apple.com>
1030
1031         Refactoring: eliminate raw pointer usage in Fullscreen code
1032         https://bugs.webkit.org/show_bug.cgi?id=188747
1033         <rdar://problem/43541164>
1034
1035         Reviewed by Alex Christensen.
1036
1037         Two sources of raw pointers in the Fullscreen code:
1038         - Model classes (PlaybackSessionModel and VideoFullscreenModel) aren't ref-able, so
1039           they are passed around as raw references.
1040         - Observer classes (PlaybackSessionModelClient and VideoFullscreenModelClient, and
1041           VideoFullscreenChangeObserver) are also passed around as raw pointers, but shouldn't
1042           be ref-able.
1043
1044         Make Model classes ref-able by adding ref() and deref() which call virtual refModel and
1045         derefModel methods, overridden by implementing subclasses. Make every concrete observer
1046         inherit from CanMakeWeakPtr, and every registration method take WeakPtr wrappers around
1047         the client interface.
1048
1049         Since every Interface class now holds a strong reference to its Model classes, and each
1050         Model class holds a weak reference to all its clients, no explicit invalidate() method
1051         is necessary.
1052
1053         Notes:
1054
1055         - Since the weak pointer methods need to be able to downcast to the abstract base class,
1056           observers need to inherit publically (rather than privately) from those base classes.
1057         - Media element Models should compose EventListener rather than inheriting from it, since
1058           EventListener has its own RefCount.
1059         - WeakPtrs can't be held in HashSets (because they change value, and therefore hash, when
1060           their underlying object is destroyed), so clients should be stored in a Vector instead.
1061         - Interfaces should be given all required Refs at creation time, so that they can store
1062           those parameters as Refs instead of RefPtrs.
1063
1064         * platform/cocoa/PlaybackSessionInterface.h:
1065         (WebCore::PlaybackSessionInterface::~PlaybackSessionInterface): Deleted.
1066         * platform/cocoa/PlaybackSessionModel.h:
1067         (WebCore::PlaybackSessionModel::ref):
1068         (WebCore::PlaybackSessionModel::deref):
1069         (WebCore::PlaybackSessionModel::~PlaybackSessionModel): Deleted.
1070         * platform/cocoa/PlaybackSessionModelMediaElement.h:
1071         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
1072         (WebCore::PlaybackSessionModelMediaElement::PlaybackSessionModelMediaElement):
1073         (WebCore::PlaybackSessionModelMediaElement::~PlaybackSessionModelMediaElement):
1074         (WebCore::PlaybackSessionModelMediaElement::setMediaElement):
1075         (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
1076         (WebCore::PlaybackSessionModelMediaElement::addClient):
1077         (WebCore::PlaybackSessionModelMediaElement::removeClient):
1078         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionOptions):
1079         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionIndices):
1080         (WebCore::PlaybackSessionModelMediaElement::handleEvent): Deleted.
1081         * platform/cocoa/VideoFullscreenChangeObserver.h:
1082         (WebCore::VideoFullscreenChangeObserver::~VideoFullscreenChangeObserver): Deleted.
1083         * platform/cocoa/VideoFullscreenModel.h:
1084         (WebCore::VideoFullscreenModel::ref):
1085         (WebCore::VideoFullscreenModel::deref):
1086         (WebCore::VideoFullscreenModel::~VideoFullscreenModel): Deleted.
1087         * platform/cocoa/VideoFullscreenModelVideoElement.h:
1088         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
1089         (VideoFullscreenModelVideoElement::VideoFullscreenModelVideoElement):
1090         (VideoFullscreenModelVideoElement::setVideoElement):
1091         (VideoFullscreenModelVideoElement::addClient):
1092         (VideoFullscreenModelVideoElement::removeClient):
1093         (VideoFullscreenModelVideoElement::setHasVideo):
1094         (VideoFullscreenModelVideoElement::setVideoDimensions):
1095         (VideoFullscreenModelVideoElement::willEnterPictureInPicture):
1096         (VideoFullscreenModelVideoElement::didEnterPictureInPicture):
1097         (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture):
1098         (VideoFullscreenModelVideoElement::willExitPictureInPicture):
1099         (VideoFullscreenModelVideoElement::didExitPictureInPicture):
1100         (VideoFullscreenModelVideoElement::handleEvent): Deleted.
1101         * platform/ios/PlaybackSessionInterfaceAVKit.h:
1102         (WebCore::PlaybackSessionInterfaceAVKit::create):
1103         (WebCore::PlaybackSessionInterfaceAVKit::playbackSessionModel const):
1104         (): Deleted.
1105         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
1106         (WebCore::PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit):
1107         (WebCore::PlaybackSessionInterfaceAVKit::~PlaybackSessionInterfaceAVKit):
1108         (WebCore::PlaybackSessionInterfaceAVKit::invalidate): Deleted.
1109         * platform/ios/VideoFullscreenInterfaceAVKit.h:
1110         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1111         (-[WebAVPlayerLayer layoutSublayers]):
1112         (-[WebAVPlayerLayer resolveBounds]):
1113         (-[WebAVPlayerLayer setVideoGravity:]):
1114         (VideoFullscreenInterfaceAVKit::create):
1115         (VideoFullscreenInterfaceAVKit::VideoFullscreenInterfaceAVKit):
1116         (VideoFullscreenInterfaceAVKit::~VideoFullscreenInterfaceAVKit):
1117         (VideoFullscreenInterfaceAVKit::setVideoFullscreenChangeObserver):
1118         (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
1119         (VideoFullscreenInterfaceAVKit::setupFullscreen):
1120         (VideoFullscreenInterfaceAVKit::presentingViewController):
1121         (VideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen):
1122         (VideoFullscreenInterfaceAVKit::preparedToExitFullscreen):
1123         (VideoFullscreenInterfaceAVKit::willStartPictureInPicture):
1124         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
1125         (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture):
1126         (VideoFullscreenInterfaceAVKit::willStopPictureInPicture):
1127         (VideoFullscreenInterfaceAVKit::didStopPictureInPicture):
1128         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
1129         (VideoFullscreenInterfaceAVKit::doSetup):
1130         (VideoFullscreenInterfaceAVKit::setMode):
1131         (VideoFullscreenInterfaceAVKit::clearMode):
1132         (VideoFullscreenInterfaceAVKit::setVideoFullscreenModel): Deleted.
1133         (VideoFullscreenInterfaceAVKit::invalidate): Deleted.
1134         * platform/ios/WebAVPlayerController.h:
1135         * platform/ios/WebAVPlayerController.mm:
1136         (-[WebAVPlayerController delegate]):
1137         (-[WebAVPlayerController playbackSessionInterface]):
1138         (-[WebAVPlayerController setPlaybackSessionInterface:]):
1139         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1140         (VideoFullscreenControllerContext::didCleanupFullscreen):
1141         (VideoFullscreenControllerContext::addClient):
1142         (VideoFullscreenControllerContext::removeClient):
1143         (VideoFullscreenControllerContext::willEnterPictureInPicture):
1144         (VideoFullscreenControllerContext::didEnterPictureInPicture):
1145         (VideoFullscreenControllerContext::failedToEnterPictureInPicture):
1146         (VideoFullscreenControllerContext::willExitPictureInPicture):
1147         (VideoFullscreenControllerContext::didExitPictureInPicture):
1148         (VideoFullscreenControllerContext::setUpFullscreen):
1149         * platform/mac/PlaybackSessionInterfaceMac.h:
1150         * platform/mac/PlaybackSessionInterfaceMac.mm:
1151         (WebCore::PlaybackSessionInterfaceMac::create):
1152         (WebCore::PlaybackSessionInterfaceMac::PlaybackSessionInterfaceMac):
1153         (WebCore::PlaybackSessionInterfaceMac::playbackSessionModel const):
1154         (WebCore::PlaybackSessionInterfaceMac::rateChanged):
1155         (WebCore::PlaybackSessionInterfaceMac::beginScrubbing):
1156         (WebCore::PlaybackSessionInterfaceMac::endScrubbing):
1157         (WebCore::PlaybackSessionInterfaceMac::setPlayBackControlsManager):
1158         (WebCore::PlaybackSessionInterfaceMac::updatePlaybackControlsManagerTiming):
1159         (WebCore::PlaybackSessionInterfaceMac::~PlaybackSessionInterfaceMac): Deleted.
1160         (WebCore::PlaybackSessionInterfaceMac::invalidate): Deleted.
1161         * platform/mac/VideoFullscreenInterfaceMac.h:
1162         (WebCore::VideoFullscreenInterfaceMac::create):
1163         (WebCore::VideoFullscreenInterfaceMac::videoFullscreenModel const):
1164         (WebCore::VideoFullscreenInterfaceMac::playbackSessionModel const):
1165         (WebCore::VideoFullscreenInterfaceMac::videoFullscreenChangeObserver const):
1166         * platform/mac/VideoFullscreenInterfaceMac.mm:
1167         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]):
1168         (-[WebVideoFullscreenInterfaceMacObjC boundsDidChangeForVideoViewContainer:]):
1169         (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]):
1170         (-[WebVideoFullscreenInterfaceMacObjC pipActionPlay:]):
1171         (-[WebVideoFullscreenInterfaceMacObjC pipActionPause:]):
1172         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]):
1173         (WebCore::VideoFullscreenInterfaceMac::VideoFullscreenInterfaceMac):
1174         (WebCore::VideoFullscreenInterfaceMac::~VideoFullscreenInterfaceMac):
1175         (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenChangeObserver):
1176         (WebCore::VideoFullscreenInterfaceMac::setMode):
1177         (WebCore::VideoFullscreenInterfaceMac::clearMode):
1178         (WebCore::VideoFullscreenInterfaceMac::invalidate):
1179         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitPiP):
1180         (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenModel): Deleted.
1181         * platform/mac/WebPlaybackControlsManager.mm:
1182         (-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]):
1183         (-[WebPlaybackControlsManager setCurrentAudioTouchBarMediaSelectionOption:]):
1184         (-[WebPlaybackControlsManager setCurrentLegibleTouchBarMediaSelectionOption:]):
1185         (-[WebPlaybackControlsManager togglePlayback]):
1186         (-[WebPlaybackControlsManager setPlaying:]):
1187         (-[WebPlaybackControlsManager isPlaying]):
1188         (-[WebPlaybackControlsManager togglePictureInPicture]):
1189
1190 2018-09-28  Chris Dumez  <cdumez@apple.com>
1191
1192         Drop support for cross-origin-window-policy header
1193         https://bugs.webkit.org/show_bug.cgi?id=190081
1194
1195         Reviewed by Ryosuke Niwa.
1196
1197         Drop support for cross-origin-window-policy header as this was never enabled and its design has
1198         some issues we have not resolved. An alternative is being worked on but will be substantially
1199         different so there is not much value in keeping this code around.
1200
1201         * bindings/js/JSDOMBindingSecurity.cpp:
1202         * bindings/js/JSDOMBindingSecurity.h:
1203         * bindings/js/JSDOMWindowCustom.cpp:
1204         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
1205         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
1206         (WebCore::addCrossOriginWindowPropertyNames):
1207         (WebCore::addScopedChildrenIndexes):
1208         (WebCore::addCrossOriginWindowOwnPropertyNames):
1209         (WebCore::JSDOMWindow::getOwnPropertyNames):
1210         * bindings/js/JSDOMWindowCustom.h:
1211         * bindings/js/JSRemoteDOMWindowCustom.cpp:
1212         * bindings/scripts/CodeGeneratorJS.pm:
1213         (GenerateAttributeGetterBodyDefinition):
1214         (GenerateAttributeSetterBodyDefinition):
1215         (GenerateOperationBodyDefinition):
1216         * bindings/scripts/IDLAttributes.json:
1217         * dom/Document.cpp:
1218         (WebCore::Document::canNavigate):
1219         * loader/FrameLoader.cpp:
1220         (WebCore::FrameLoader::didBeginDocument):
1221         * page/AbstractDOMWindow.cpp:
1222         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
1223         * page/AbstractDOMWindow.h:
1224         * page/DOMWindow.idl:
1225         * page/Settings.yaml:
1226         * platform/network/HTTPParsers.cpp:
1227         * platform/network/HTTPParsers.h:
1228
1229 2018-09-28  Daniel Bates  <dabates@apple.com>
1230
1231         [iOS] Allow programmatic focus when hardware keyboard is attached
1232         https://bugs.webkit.org/show_bug.cgi?id=190017
1233         <rdar://problem/42270463>
1234
1235         Reviewed by Wenson Hsieh.
1236
1237         Add support for checking if the embedding client is WebKitTestRunner and export isDumpRenderTree()
1238         so that we can make use of it from WebKit. We will make use of these functions to keep the current
1239         behavior of disallowing programmatic focus when running tests in these apps. This is needed to
1240         keep testing deterministic. Otherwise, test results would be dependent on whether a hardware
1241         keyboard is attached. When running tests in Simulator.app the hardware keyboard may also not be
1242         connected (i.e. Hardware > Keyboard > Connect Hardware Keyboard is disabled).
1243
1244         * platform/RuntimeApplicationChecks.h:
1245         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
1246         (WebCore::IOSApplication::isWebKitTestRunner): Added.
1247
1248 2018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
1249
1250         REGRESSION(r236609): API tests for mso list preservation are failing
1251         https://bugs.webkit.org/show_bug.cgi?id=190095
1252
1253         Reviewed by Wenson Hsieh.
1254
1255         The regression was caused by appendNodeToPreserveMSOList called after an early return for not having renderer.
1256         Clearly, comment & style elements coming from a MS word document wouldn't have a renderer.
1257
1258         Fixed the bug by changing the order.
1259
1260         * editing/markup.cpp:
1261         (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
1262
1263 2018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
1264
1265         Build fix after r236612.
1266
1267         * platform/win/PasteboardWin.cpp:
1268         (WebCore::Pasteboard::writeSelection):
1269
1270 2018-09-28  Andy Estes  <aestes@apple.com>
1271
1272         [Apple Pay] Remove the "in-store" button type
1273         https://bugs.webkit.org/show_bug.cgi?id=190079
1274
1275         Reviewed by Tim Horton.
1276
1277         According to <https://developer.apple.com/design/human-interface-guidelines/apple-pay/buttons-and-marks/buttons/>,
1278         this button is meant only for certain kinds of native apps. It shouldn't be available on the web.
1279
1280         Updated http/tests/ssl/applepay/ApplePayButton.html.
1281
1282         * css/CSSPrimitiveValueMappings.h:
1283         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1284         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const):
1285         * css/CSSValueKeywords.in:
1286         * css/parser/CSSParserFastPaths.cpp:
1287         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
1288         * rendering/RenderThemeCocoa.mm:
1289         (WebCore::toPKPaymentButtonType):
1290         * rendering/style/RenderStyleConstants.h:
1291
1292 2018-09-28  Chris Dumez  <cdumez@apple.com>
1293
1294         document.open() should throw errors for cross-origin calls
1295         https://bugs.webkit.org/show_bug.cgi?id=189371
1296         <rdar://problem/44282700>
1297
1298         Reviewed by Youenn Fablet.
1299
1300         document.open() / document.write() should throw errors for cross-origin calls as per:
1301         - https://html.spec.whatwg.org/#document-open-steps (Step 4)
1302
1303         No new tests, rebaselined existing tests.
1304
1305         * dom/Document.cpp:
1306         (WebCore::Document::open):
1307         (WebCore::Document::write):
1308         (WebCore::Document::writeln):
1309         * dom/Document.h:
1310
1311 2018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
1312
1313         Rename createMarkup to serializePreservingVisualAppearance
1314         https://bugs.webkit.org/show_bug.cgi?id=190086
1315
1316         Reviewed by Wenson Hsieh.
1317
1318         Renamed the function to clarify what it does. Also removed the unused Range::toHTML.
1319
1320         * dom/Range.cpp:
1321         (WebCore::Range::toHTML const): Deleted.
1322         * dom/Range.h:
1323         * editing/CompositeEditCommand.cpp:
1324         (WebCore::CompositeEditCommand::moveParagraphs):
1325         * editing/cocoa/EditorCocoa.mm:
1326         (WebCore::Editor::selectionInHTMLFormat):
1327         * editing/gtk/EditorGtk.cpp:
1328         (WebCore::Editor::writeSelectionToPasteboard):
1329         * editing/markup.cpp:
1330         (WebCore::serializePreservingVisualAppearance):
1331         (WebCore::createMarkup): Deleted.
1332         * editing/markup.h:
1333         * editing/wpe/EditorWPE.cpp:
1334         (WebCore::Editor::writeSelectionToPasteboard):
1335         * loader/archive/cf/LegacyWebArchive.cpp:
1336         (WebCore::LegacyWebArchive::create):
1337         (WebCore::LegacyWebArchive::createFromSelection):
1338         * platform/win/PasteboardWin.cpp:
1339         (WebCore::Pasteboard::writeRangeToDataObject):
1340
1341 2018-09-28  Simon Fraser  <simon.fraser@apple.com>
1342
1343         Remove some unused RenderLayer code
1344         https://bugs.webkit.org/show_bug.cgi?id=190078
1345
1346         Reviewed by Zalan Bujtas.
1347
1348         The 'outOfFlowDescendantContainingBlocks' code was related to the accelerated overflow scrolling code that
1349         I removed recently.
1350         
1351         updateDescendantsLayerListsIfNeeded() is never called.
1352
1353         * rendering/RenderLayer.cpp:
1354         (WebCore::RenderLayer::updateDescendantDependentFlags):
1355         (WebCore::RenderLayer::calculateClipRects const):
1356         * rendering/RenderLayer.h:
1357
1358 2018-09-28  Commit Queue  <commit-queue@webkit.org>
1359
1360         Unreviewed, rolling out r236605.
1361         https://bugs.webkit.org/show_bug.cgi?id=190087
1362
1363         caused three API test timeouts (Requested by jernoble on
1364         #webkit).
1365
1366         Reverted changeset:
1367
1368         "Refactoring: eliminate raw pointer usage in Fullscreen code"
1369         https://bugs.webkit.org/show_bug.cgi?id=188747
1370         https://trac.webkit.org/changeset/236605
1371
1372 2018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
1373
1374         Simplify StyledMarkupAccumulator::traverseNodesForSerialization
1375         https://bugs.webkit.org/show_bug.cgi?id=190073
1376
1377         Reviewed by Antti Koivisto.
1378
1379         Simplified the range traversal algorithm in traverseNodesForSerialization as it was too complicated
1380         to support shadow DOM for copy and paste.
1381
1382         Instead of using NodeTraversal::next to traverse past ancestors and then figuring out which ancestor
1383         must be closed or to wrap the existing markup with, new code collects the list of ancestors as we
1384         traverse out of them.
1385
1386         Also extracted lambdas for generating markup and deciding whether to skip a node as well as keeping
1387         track of the depth of the current markup. This further reduces the code complexity of the actual
1388         node traversal algorithm. Keeping track of the depth allows us to now generate ancestor elements'
1389         closing tags without keeping a stack of ancestor nodes we opened at all times.
1390
1391         * editing/markup.cpp:
1392         (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
1393
1394 2018-09-27  Ryosuke Niwa  <rniwa@webkit.org>
1395
1396         Replace every use of Node::offsetInCharacters() by Node::isCharacterDataNode()
1397         https://bugs.webkit.org/show_bug.cgi?id=190069
1398
1399         Reviewed by Zalan Bujtas.
1400
1401         Removed Node::offsetInCharacters() and replaced every use of it by isCharacterDataNode()
1402         because their implementations are identical.
1403
1404         Note that offsetInCharacters() sounds like a function which returns some kind of an offset
1405         but it doesn't. It returns true when called on a CharacterData and false elsewhere.
1406
1407         * accessibility/AXObjectCache.cpp:
1408         (WebCore::characterOffsetsInOrder):
1409         (WebCore::AXObjectCache::startOrEndCharacterOffsetForRange):
1410         (WebCore::AXObjectCache::characterOffsetFromVisiblePosition):
1411         * dom/CharacterData.cpp:
1412         (WebCore::CharacterData::offsetInCharacters const): Deleted.
1413         * dom/CharacterData.h:
1414         * dom/Node.cpp:
1415         (WebCore::Node::offsetInCharacters const): Deleted.
1416         * dom/Node.h:
1417         * dom/Position.cpp:
1418         (WebCore::Position::parentAnchoredEquivalent const):
1419         * dom/Position.h:
1420         (WebCore::lastOffsetInNode):
1421         (WebCore::minOffsetForNode):
1422         (WebCore::offsetIsBeforeLastNodeOffset):
1423         * dom/Range.cpp:
1424         (WebCore::Range::firstNode const):
1425         (WebCore::Range::pastLastNode const):
1426         * dom/RangeBoundaryPoint.h:
1427         (WebCore::RangeBoundaryPoint::setOffset):
1428         (WebCore::RangeBoundaryPoint::setToEndOfNode):
1429         * editing/Editing.cpp:
1430         (WebCore::lastOffsetForEditing):
1431         * editing/TextIterator.cpp:
1432         (WebCore::nextInPreOrderCrossingShadowBoundaries):
1433         (WebCore::TextIterator::node const):
1434         (WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
1435         * page/DOMSelection.cpp:
1436         (WebCore::DOMSelection::extend):
1437
1438 2018-09-28  Jer Noble  <jer.noble@apple.com>
1439
1440         Refactoring: eliminate raw pointer usage in Fullscreen code
1441         https://bugs.webkit.org/show_bug.cgi?id=188747
1442         <rdar://problem/43541164>
1443
1444         Reviewed by Alex Christensen.
1445
1446         Two sources of raw pointers in the Fullscreen code:
1447         - Model classes (PlaybackSessionModel and VideoFullscreenModel) aren't ref-able, so
1448           they are passed around as raw references.
1449         - Observer classes (PlaybackSessionModelClient and VideoFullscreenModelClient, and
1450           VideoFullscreenChangeObserver) are also passed around as raw pointers, but shouldn't
1451           be ref-able.
1452
1453         Make Model classes ref-able by adding ref() and deref() which call virtual refModel and
1454         derefModel methods, overridden by implementing subclasses. Make every concrete observer
1455         inherit from CanMakeWeakPtr, and every registration method take WeakPtr wrappers around
1456         the client interface.
1457
1458         Since every Interface class now holds a strong reference to its Model classes, and each
1459         Model class holds a weak reference to all its clients, no explicit invalidate() method
1460         is necessary.
1461
1462         Notes:
1463
1464         - Since the weak pointer methods need to be able to downcast to the abstract base class,
1465           observers need to inherit publically (rather than privately) from those base classes.
1466         - Media element Models should compose EventListener rather than inheriting from it, since
1467           EventListener has its own RefCount.
1468         - WeakPtrs can't be held in HashSets (because they change value, and therefore hash, when
1469           their underlying object is destroyed), so clients should be stored in a Vector instead.
1470         - Interfaces should be given all required Refs at creation time, so that they can store
1471           those parameters as Refs instead of RefPtrs.
1472
1473         * platform/cocoa/PlaybackSessionInterface.h:
1474         (WebCore::PlaybackSessionInterface::~PlaybackSessionInterface): Deleted.
1475         * platform/cocoa/PlaybackSessionModel.h:
1476         (WebCore::PlaybackSessionModel::ref):
1477         (WebCore::PlaybackSessionModel::deref):
1478         (WebCore::PlaybackSessionModel::~PlaybackSessionModel): Deleted.
1479         * platform/cocoa/PlaybackSessionModelMediaElement.h:
1480         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
1481         (WebCore::PlaybackSessionModelMediaElement::PlaybackSessionModelMediaElement):
1482         (WebCore::PlaybackSessionModelMediaElement::~PlaybackSessionModelMediaElement):
1483         (WebCore::PlaybackSessionModelMediaElement::setMediaElement):
1484         (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
1485         (WebCore::PlaybackSessionModelMediaElement::addClient):
1486         (WebCore::PlaybackSessionModelMediaElement::removeClient):
1487         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionOptions):
1488         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionIndices):
1489         (WebCore::PlaybackSessionModelMediaElement::handleEvent): Deleted.
1490         * platform/cocoa/VideoFullscreenChangeObserver.h:
1491         (WebCore::VideoFullscreenChangeObserver::~VideoFullscreenChangeObserver): Deleted.
1492         * platform/cocoa/VideoFullscreenModel.h:
1493         (WebCore::VideoFullscreenModel::ref):
1494         (WebCore::VideoFullscreenModel::deref):
1495         (WebCore::VideoFullscreenModel::~VideoFullscreenModel): Deleted.
1496         * platform/cocoa/VideoFullscreenModelVideoElement.h:
1497         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
1498         (VideoFullscreenModelVideoElement::VideoFullscreenModelVideoElement):
1499         (VideoFullscreenModelVideoElement::setVideoElement):
1500         (VideoFullscreenModelVideoElement::addClient):
1501         (VideoFullscreenModelVideoElement::removeClient):
1502         (VideoFullscreenModelVideoElement::setHasVideo):
1503         (VideoFullscreenModelVideoElement::setVideoDimensions):
1504         (VideoFullscreenModelVideoElement::willEnterPictureInPicture):
1505         (VideoFullscreenModelVideoElement::didEnterPictureInPicture):
1506         (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture):
1507         (VideoFullscreenModelVideoElement::willExitPictureInPicture):
1508         (VideoFullscreenModelVideoElement::didExitPictureInPicture):
1509         (VideoFullscreenModelVideoElement::handleEvent): Deleted.
1510         * platform/ios/PlaybackSessionInterfaceAVKit.h:
1511         (WebCore::PlaybackSessionInterfaceAVKit::create):
1512         (WebCore::PlaybackSessionInterfaceAVKit::playbackSessionModel const):
1513         (): Deleted.
1514         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
1515         (WebCore::PlaybackSessionInterfaceAVKit::PlaybackSessionInterfaceAVKit):
1516         (WebCore::PlaybackSessionInterfaceAVKit::~PlaybackSessionInterfaceAVKit):
1517         (WebCore::PlaybackSessionInterfaceAVKit::invalidate): Deleted.
1518         * platform/ios/VideoFullscreenInterfaceAVKit.h:
1519         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1520         (-[WebAVPlayerLayer layoutSublayers]):
1521         (-[WebAVPlayerLayer resolveBounds]):
1522         (-[WebAVPlayerLayer setVideoGravity:]):
1523         (VideoFullscreenInterfaceAVKit::create):
1524         (VideoFullscreenInterfaceAVKit::VideoFullscreenInterfaceAVKit):
1525         (VideoFullscreenInterfaceAVKit::~VideoFullscreenInterfaceAVKit):
1526         (VideoFullscreenInterfaceAVKit::setVideoFullscreenChangeObserver):
1527         (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
1528         (VideoFullscreenInterfaceAVKit::setupFullscreen):
1529         (VideoFullscreenInterfaceAVKit::presentingViewController):
1530         (VideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen):
1531         (VideoFullscreenInterfaceAVKit::preparedToExitFullscreen):
1532         (VideoFullscreenInterfaceAVKit::willStartPictureInPicture):
1533         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
1534         (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture):
1535         (VideoFullscreenInterfaceAVKit::willStopPictureInPicture):
1536         (VideoFullscreenInterfaceAVKit::didStopPictureInPicture):
1537         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
1538         (VideoFullscreenInterfaceAVKit::doSetup):
1539         (VideoFullscreenInterfaceAVKit::setMode):
1540         (VideoFullscreenInterfaceAVKit::clearMode):
1541         (VideoFullscreenInterfaceAVKit::setVideoFullscreenModel): Deleted.
1542         (VideoFullscreenInterfaceAVKit::invalidate): Deleted.
1543         * platform/ios/WebAVPlayerController.h:
1544         * platform/ios/WebAVPlayerController.mm:
1545         (-[WebAVPlayerController delegate]):
1546         (-[WebAVPlayerController playbackSessionInterface]):
1547         (-[WebAVPlayerController setPlaybackSessionInterface:]):
1548         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1549         (VideoFullscreenControllerContext::didCleanupFullscreen):
1550         (VideoFullscreenControllerContext::addClient):
1551         (VideoFullscreenControllerContext::removeClient):
1552         (VideoFullscreenControllerContext::willEnterPictureInPicture):
1553         (VideoFullscreenControllerContext::didEnterPictureInPicture):
1554         (VideoFullscreenControllerContext::failedToEnterPictureInPicture):
1555         (VideoFullscreenControllerContext::willExitPictureInPicture):
1556         (VideoFullscreenControllerContext::didExitPictureInPicture):
1557         (VideoFullscreenControllerContext::setUpFullscreen):
1558         * platform/mac/PlaybackSessionInterfaceMac.h:
1559         * platform/mac/PlaybackSessionInterfaceMac.mm:
1560         (WebCore::PlaybackSessionInterfaceMac::create):
1561         (WebCore::PlaybackSessionInterfaceMac::PlaybackSessionInterfaceMac):
1562         (WebCore::PlaybackSessionInterfaceMac::playbackSessionModel const):
1563         (WebCore::PlaybackSessionInterfaceMac::rateChanged):
1564         (WebCore::PlaybackSessionInterfaceMac::beginScrubbing):
1565         (WebCore::PlaybackSessionInterfaceMac::endScrubbing):
1566         (WebCore::PlaybackSessionInterfaceMac::setPlayBackControlsManager):
1567         (WebCore::PlaybackSessionInterfaceMac::updatePlaybackControlsManagerTiming):
1568         (WebCore::PlaybackSessionInterfaceMac::~PlaybackSessionInterfaceMac): Deleted.
1569         (WebCore::PlaybackSessionInterfaceMac::invalidate): Deleted.
1570         * platform/mac/VideoFullscreenInterfaceMac.h:
1571         (WebCore::VideoFullscreenInterfaceMac::create):
1572         (WebCore::VideoFullscreenInterfaceMac::videoFullscreenModel const):
1573         (WebCore::VideoFullscreenInterfaceMac::playbackSessionModel const):
1574         (WebCore::VideoFullscreenInterfaceMac::videoFullscreenChangeObserver const):
1575         * platform/mac/VideoFullscreenInterfaceMac.mm:
1576         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]):
1577         (-[WebVideoFullscreenInterfaceMacObjC boundsDidChangeForVideoViewContainer:]):
1578         (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]):
1579         (-[WebVideoFullscreenInterfaceMacObjC pipActionPlay:]):
1580         (-[WebVideoFullscreenInterfaceMacObjC pipActionPause:]):
1581         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]):
1582         (WebCore::VideoFullscreenInterfaceMac::VideoFullscreenInterfaceMac):
1583         (WebCore::VideoFullscreenInterfaceMac::~VideoFullscreenInterfaceMac):
1584         (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenChangeObserver):
1585         (WebCore::VideoFullscreenInterfaceMac::setMode):
1586         (WebCore::VideoFullscreenInterfaceMac::clearMode):
1587         (WebCore::VideoFullscreenInterfaceMac::invalidate):
1588         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitPiP):
1589         (WebCore::VideoFullscreenInterfaceMac::setVideoFullscreenModel): Deleted.
1590         * platform/mac/WebPlaybackControlsManager.mm:
1591         (-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]):
1592         (-[WebPlaybackControlsManager setCurrentAudioTouchBarMediaSelectionOption:]):
1593         (-[WebPlaybackControlsManager setCurrentLegibleTouchBarMediaSelectionOption:]):
1594         (-[WebPlaybackControlsManager togglePlayback]):
1595         (-[WebPlaybackControlsManager setPlaying:]):
1596         (-[WebPlaybackControlsManager isPlaying]):
1597         (-[WebPlaybackControlsManager togglePictureInPicture]):
1598
1599 2018-09-28  Chris Dumez  <cdumez@apple.com>
1600
1601         Drop iOS specific quirk in SettingsBase::scriptEnabledChanged()
1602         https://bugs.webkit.org/show_bug.cgi?id=190077
1603         <rdar://problem/44812613>
1604
1605         Reviewed by Zalan Bujtas.
1606
1607         Drop iOS specific quirk in SettingsBase::scriptEnabledChanged() that would dirty style after the
1608         "JavaScriptEnabled" setting's state is toggled. I do not see a good reason to do this given that
1609         scripts would not get executed until a reload.
1610
1611         If we find out after dropping this that this is actually useful for some reason, then we can
1612         always bring it back and consider making this non-iOS specific, as well as documenting why this
1613         it is needed.
1614
1615         * page/Settings.yaml:
1616         * page/SettingsBase.cpp:
1617         (WebCore::SettingsBase::scriptEnabledChanged): Deleted.
1618         * page/SettingsBase.h:
1619
1620 2018-09-27  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1621
1622         [Curl] Fix priority issue with multiple cookies with different level of path.
1623         https://bugs.webkit.org/show_bug.cgi?id=189920
1624
1625         Reviewed by Fujii Hironori.
1626
1627         When multiple cookies are stored in the database for same site, the priority of
1628         multiple cookies which matches path criteria was not defined. The backend
1629         implementation `sqlite` then returns the first matching result, which is the one
1630         stored earlier.
1631
1632         Test: http/tests/cookies/cookie-with-multiple-level-path.html
1633
1634         * platform/network/curl/CookieJarDB.cpp:
1635         (WebCore::CookieJarDB::searchCookies):
1636
1637 2018-09-26  Ryosuke Niwa  <rniwa@webkit.org>
1638
1639         Use enum class in createMarkup arguments
1640         https://bugs.webkit.org/show_bug.cgi?id=190028
1641
1642         Reviewed by Wenson Hsieh.
1643
1644         Replaced enums used by createMarkup with equivalent enum classes: EChildrenOnly with SerializedNodes,
1645         EAbsoluteURLs with ResolveURLs, and EFragmentSerialization with SerializationSyntax.
1646
1647         Also replaced the boolean convertBlocksToInlines with an enum class of the same name.
1648
1649         Finally, renamed the createMarkup variant which doesn't serialize style and used for innerHTML and XMLSerializer
1650         to serializeFragment.
1651
1652         * dom/Element.cpp:
1653         (WebCore::Element::innerHTML const):
1654         (WebCore::Element::outerHTML const):
1655         * dom/ShadowRoot.cpp:
1656         (WebCore::ShadowRoot::innerHTML const):
1657         * editing/CompositeEditCommand.cpp:
1658         (WebCore::CompositeEditCommand::moveParagraphs):
1659         * editing/HTMLInterchange.h:
1660         (WebCore::AnnotateForInterchange): Renamed from EAnnotateForInterchange.
1661         * editing/MarkupAccumulator.cpp:
1662         (WebCore::MarkupAccumulator::MarkupAccumulator):
1663         (WebCore::MarkupAccumulator::serializeNodes):
1664         (WebCore::MarkupAccumulator::serializeNodesWithNamespaces):
1665         (WebCore::MarkupAccumulator::resolveURLIfNeeded const):
1666         * editing/MarkupAccumulator.h:
1667         (WebCore::MarkupAccumulator::inXMLFragmentSerialization const):
1668         * editing/ReplaceRangeWithTextCommand.cpp:
1669         (WebCore::ReplaceRangeWithTextCommand::inputEventDataTransfer const):
1670         * editing/ReplaceSelectionCommand.cpp:
1671         (WebCore::ReplaceSelectionCommand::willApplyCommand):
1672         * editing/SpellingCorrectionCommand.cpp:
1673         (WebCore::SpellingCorrectionCommand::inputEventDataTransfer const):
1674         * editing/cocoa/EditorCocoa.mm:
1675         (WebCore::Editor::selectionInHTMLFormat):
1676         * editing/cocoa/WebContentReaderCocoa.mm:
1677         (WebCore::WebContentMarkupReader::readRTFD):
1678         (WebCore::WebContentMarkupReader::readRTF):
1679         * editing/gtk/EditorGtk.cpp:
1680         (WebCore::Editor::writeImageToPasteboard):
1681         (WebCore::Editor::writeSelectionToPasteboard):
1682         * editing/markup.cpp:
1683         (WebCore::StyledMarkupAccumulator::StyledMarkupAccumulator):
1684         (WebCore::StyledMarkupAccumulator::serializeNodes):
1685         (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
1686         (WebCore::highestAncestorToWrapMarkup):
1687         (WebCore::createMarkupInternal):
1688         (WebCore::createMarkup):
1689         (WebCore::sanitizedMarkupForFragmentInDocument):
1690         (WebCore::serializeFragment): Renamed from createMarkup. This is used for innerHTML and XMLSerializer,
1691         which faithfully serializes the fragment without any computed style as inline styles.
1692         (WebCore::documentTypeString):
1693         (WebCore::createFullMarkup): Deleted two varinats used in WebKitLegacy.
1694         * editing/markup.h:
1695         (WebCore::ResolveURLs): Renamed from EAbsoluteURLs.
1696         (WebCore::ConvertBlocksToInlines): Added.
1697         (WebCore::SerializedNodes): Renamed from EChildrenOnly.
1698         (WebCore::SerializationSyntax): Renamed from EFragmentSerialization.
1699         * editing/wpe/EditorWPE.cpp:
1700         (WebCore::Editor::writeSelectionToPasteboard):
1701         * inspector/DOMEditor.cpp:
1702         * inspector/agents/InspectorDOMAgent.cpp:
1703         (WebCore::InspectorDOMAgent::getOuterHTML):
1704         * loader/archive/cf/LegacyWebArchive.cpp:
1705         (WebCore::LegacyWebArchive::create):
1706         (WebCore::LegacyWebArchive::createFromSelection):
1707         * page/PageSerializer.cpp:
1708         (WebCore::PageSerializer::SerializerMarkupAccumulator::SerializerMarkupAccumulator):
1709         (WebCore::PageSerializer::serializeFrame):
1710         * page/win/DragControllerWin.cpp:
1711         (WebCore::DragController::declareAndWriteDragImage):
1712         * Source/WebCore/platform/win/PasteboardWin.cpp:
1713         (WebCore::Pasteboard::writeRangeToDataObject):
1714         (WebCore::Pasteboard::writeSelection):
1715         * xml/XMLHttpRequest.cpp:
1716         (WebCore::XMLHttpRequest::send):
1717         * xml/XMLSerializer.cpp:
1718         (WebCore::XMLSerializer::serializeToString):
1719         * xml/XSLTProcessorLibxslt.cpp:
1720         (WebCore::xsltStylesheetPointer):
1721         (WebCore::xmlDocPtrFromNode):
1722
1723 2018-09-27  John Wilander  <wilander@apple.com>
1724
1725         Resource Load Statistics: Non-redirected top frame navigation should not get captured in statistics
1726         https://bugs.webkit.org/show_bug.cgi?id=190055
1727         <rdar://problem/44843460>
1728
1729         Reviewed by Chris Dumez.
1730
1731         Test: http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html
1732
1733         * loader/ResourceLoadStatistics.cpp:
1734         (WebCore::ResourceLoadStatistics::decode):
1735             Corrects legacy statistics for frames and triggers a re-classification.
1736
1737 2018-09-27  Jer Noble  <jer.noble@apple.com>
1738
1739         Unreviewed watchOS build fix; Fix declaration for ports which USE(ENCRYPTED_MEDIA) but don't
1740         HAVE(AVCONTENTKEYSESSION).
1741
1742         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1743
1744 2018-09-27  Justin Michaud  <justin_michaud@apple.com>
1745
1746         Remove duplicate CSS Properties and Values feature on status page
1747         https://bugs.webkit.org/show_bug.cgi?id=189909
1748
1749         Reviewed by Simon Fraser.
1750
1751         Update CSS properties and values api feature in features.json
1752
1753         * features.json:
1754
1755 2018-09-27  Jer Noble  <jer.noble@apple.com>
1756
1757         MediaPlayer should have mediaPlayerWaitingForKeyChanged() / bool waitingForKey() accessor
1758         https://bugs.webkit.org/show_bug.cgi?id=189951
1759
1760         Reviewed by Eric Carlson.
1761
1762         In order to implement the "Resume Playback" section of EME, part 4, we need to be able
1763         to query whether the MediaPlayer is still waiting for a key after attemptToDecrypt()
1764         has been called. Currently this involves no behavioral changes, as all modern EME ports
1765         will still just notify the media element that they no longer need keys after one has
1766         been added, but future ports may be able to wait for multiple keys before reporting
1767         that it is no longer waiting for keys.
1768
1769         * html/HTMLMediaElement.cpp:
1770         (WebCore::HTMLMediaElement::mediaPlayerWaitingForKeyChanged):
1771         (WebCore::HTMLMediaElement::attemptToResumePlaybackIfNecessary):
1772         (WebCore::HTMLMediaElement::mediaPlayerWaitingForKey): Deleted.
1773         * html/HTMLMediaElement.h:
1774         * platform/graphics/MediaPlayer.cpp:
1775         (WebCore::MediaPlayer::waitingForKeyChanged):
1776         (WebCore::MediaPlayer::waitingForKey const):
1777         (WebCore::MediaPlayer::waitingForKey): Deleted.
1778         * platform/graphics/MediaPlayer.h:
1779         (WebCore::MediaPlayerClient::mediaPlayerWaitingForKeyChanged):
1780         (WebCore::MediaPlayerClient::mediaPlayerWaitingForKey): Deleted.
1781         * platform/graphics/MediaPlayerPrivate.h:
1782         (WebCore::MediaPlayerPrivateInterface::waitingForKey const):
1783         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1784         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1785         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
1786         (WebCore::MediaPlayerPrivateAVFoundationObjC::attemptToDecryptWithInstance):
1787         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1788         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1789         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::attemptToDecryptWithInstance):
1790         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitingForKey const):
1791         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::waitingForKeyChanged):
1792         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::initializationDataEncountered):
1793         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1794         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1795         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
1796         (WebCore::SourceBufferPrivateAVFObjC::attemptToDecrypt):
1797         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1798         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
1799         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1800         (WebCore::MediaPlayerPrivateGStreamerBase::reportWaitingForKey):
1801         (WebCore::MediaPlayerPrivateGStreamerBase::setWaitingForKey):
1802         (WebCore::MediaPlayerPrivateGStreamerBase::waitingForKey const):
1803         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1804         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
1805         (webkitMediaCommonEncryptionDecryptSinkEventHandler):
1806
1807 2018-09-27  Alicia Boya García  <aboya@igalia.com>
1808
1809         [MSE] Fix unwanted sample erase from the decode queue
1810         https://bugs.webkit.org/show_bug.cgi?id=180643
1811
1812         Reviewed by Jer Noble.
1813
1814         Test: media/media-source/media-source-append-acb-no-frame-lost.html
1815
1816         This bug reproduced when unordered appends were made. For instance, if
1817         the application appended [0, 10) and then [20, 30), the frame at 20
1818         would be wrongly discarded from the decode queue.
1819
1820         Later the application could append [10, 20) and the gap at [20, 21)
1821         would persist in the decode queue, even if the frame remained in the
1822         track buffer table.
1823
1824         Thanks to Daniel Zhang for reporting the issue.
1825
1826         * Modules/mediasource/SourceBuffer.cpp:
1827         (WebCore::SourceBuffer::provideMediaData):
1828
1829 2018-09-27  Alex Christensen  <achristensen@webkit.org>
1830
1831         URLParser should use TextEncoding through an abstract class
1832         https://bugs.webkit.org/show_bug.cgi?id=190027
1833
1834         Reviewed by Andy Estes.
1835
1836         URLParser uses TextEncoding for one call to encode, which is only used for encoding the query of URLs in documents with non-UTF encodings.
1837         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.
1838         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.
1839         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
1840         without also moving TextEncoding, TextCodec, TextCodecICU, ThreadGlobalData, and the rest of WebCore and JavaScriptCore.
1841
1842         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,
1843         and TextEncodings now have a vtable, which uses a few more bytes of memory total for WebKit.
1844
1845         * css/parser/CSSParserContext.h:
1846         (WebCore::CSSParserContext::completeURL const):
1847         * css/parser/CSSParserIdioms.cpp:
1848         (WebCore::completeURL):
1849         * dom/Document.cpp:
1850         (WebCore::Document::completeURL const):
1851         * html/HTMLBaseElement.cpp:
1852         (WebCore::HTMLBaseElement::href const):
1853         Move the call to encodingForFormSubmission from the URL constructor to the 3 call sites that specify the encoding from the Document.
1854         * loader/FormSubmission.cpp:
1855         (WebCore::FormSubmission::create):
1856         * loader/TextResourceDecoder.cpp:
1857         (WebCore::TextResourceDecoder::encodingForURLParsing):
1858         * loader/TextResourceDecoder.h:
1859         * platform/URL.cpp:
1860         (WebCore::URL::URL):
1861         * platform/URL.h:
1862         (WebCore::URLTextEncoding::~URLTextEncoding):
1863         * platform/URLParser.cpp:
1864         (WebCore::URLParser::encodeNonUTF8Query):
1865         (WebCore::URLParser::copyURLPartsUntil):
1866         (WebCore::URLParser::URLParser):
1867         (WebCore::URLParser::parse):
1868         (WebCore::URLParser::encodeQuery): Deleted.
1869         A pointer replaces the boolean isUTF8Encoding and the TextEncoding& which had a default value of UTF8Encoding.
1870         Now the pointer being null means that we use UTF8, and the pointer being non-null means we use that encoding.
1871         * platform/URLParser.h:
1872         (WebCore::URLParser::URLParser):
1873         * platform/text/TextEncoding.cpp:
1874         (WebCore::UTF7Encoding):
1875         (WebCore::TextEncoding::encodingForFormSubmissionOrURLParsing const):
1876         (WebCore::ASCIIEncoding):
1877         (WebCore::Latin1Encoding):
1878         (WebCore::UTF16BigEndianEncoding):
1879         (WebCore::UTF16LittleEndianEncoding):
1880         (WebCore::UTF8Encoding):
1881         (WebCore::WindowsLatin1Encoding):
1882         (WebCore::TextEncoding::encodingForFormSubmission const): Deleted.
1883         Use NeverDestroyed because TextEncoding now has a virtual destructor.
1884         * platform/text/TextEncoding.h:
1885         Rename encodingForFormSubmission to encodingForFormSubmissionOrURLParsing to make it more clear that we are intentionally using it for both.
1886
1887 2018-09-27  John Wilander  <wilander@apple.com>
1888
1889         Resource Load Statistics: Remove temporary compatibility fix for auto-dismiss popups
1890         https://bugs.webkit.org/show_bug.cgi?id=189980
1891         <rdar://problem/44780645>
1892
1893         Reviewed by Alex Christensen.
1894
1895         Test: http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss.html
1896
1897         The change in https://bugs.webkit.org/show_bug.cgi?id=183620 was a temporary
1898         compatibility fix as explained in:
1899         https://webkit.org/blog/8311/intelligent-tracking-prevention-2-0/. We should
1900         remove it.
1901
1902         Most of these changes remove the parameter isTriggeredByUserGesture since it's no longer needed.
1903
1904         * loader/ResourceLoadObserver.cpp:
1905         (WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback):
1906         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1907         (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener):
1908         (WebCore::ResourceLoadObserver::logWindowCreation): Deleted.
1909         * loader/ResourceLoadObserver.h:
1910         * page/DOMWindow.cpp:
1911         (WebCore::DOMWindow::createWindow):
1912             Now no longer logs anything to ResourceLoadObserver.
1913
1914 2018-09-27  Ryan Haddad  <ryanhaddad@apple.com>
1915
1916         Unreviewed, rolling out r236557.
1917
1918         Really roll out r236557 this time because it breaks internal
1919         builds.
1920
1921         Reverted changeset:
1922
1923         "Add VP8 support to WebRTC"
1924         https://bugs.webkit.org/show_bug.cgi?id=189976
1925         https://trac.webkit.org/changeset/236557
1926
1927 2018-09-27  Chris Dumez  <cdumez@apple.com>
1928
1929         Fragment should be stripped from document URL during document.open() URL propagation
1930         https://bugs.webkit.org/show_bug.cgi?id=189374
1931         <rdar://problem/44282736>
1932
1933         Reviewed by Alex Christensen.
1934
1935         Strip the Document URL fragment during document.open() URL propagation if the entry document
1936         is not the current document, as per:
1937         - https://html.spec.whatwg.org/#document-open-steps (Step 11.2.)
1938
1939         No new tests, rebaselined existing test.
1940
1941         * dom/Document.cpp:
1942         (WebCore::Document::open):
1943
1944 2018-09-27  Youenn Fablet  <youenn@apple.com>
1945
1946         Add VP8 support to WebRTC
1947         https://bugs.webkit.org/show_bug.cgi?id=189976
1948
1949         Reviewed by Eric Carlson.
1950
1951         Add a runtime flag to control activation of VP8 codec.
1952         Bind this runtime flag to the video codec factories.
1953         Test: webrtc/video-mute-vp8.html
1954
1955         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1956         (WebCore::createLibWebRTCPeerConnectionBackend):
1957         * page/RuntimeEnabledFeatures.h:
1958         (WebCore::RuntimeEnabledFeatures::webRTCVP8CodecEnabled const):
1959         (WebCore::RuntimeEnabledFeatures::setWebRTCVP8CodecEnabled):
1960         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
1961         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
1962         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
1963         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
1964         * testing/Internals.cpp:
1965         (WebCore::Internals::resetToConsistentState):
1966         Enable VP8 codec for tests.
1967
1968 2018-09-27  Chris Dumez  <cdumez@apple.com>
1969
1970         Crash under WebCore::deleteCookiesForHostnames()
1971         https://bugs.webkit.org/show_bug.cgi?id=190040
1972         <rdar://problem/38020368>
1973
1974         Reviewed by Alex Christensen.
1975
1976         Update NetworkStorageSession::deleteCookiesForHostnames() to properly deal with the fact
1977         that NSHTTPCookie.domain can return nil.
1978
1979         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1980         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
1981
1982 2018-09-27  Youenn Fablet  <youenn@apple.com>
1983
1984         Use kCVPixelFormatType_420YpCbCr8Planar for capturing frames
1985         https://bugs.webkit.org/show_bug.cgi?id=190014
1986
1987         Reviewed by Eric Carlson.
1988
1989         On Mac, rely on the monoplanar format which can be displayed without any issue.
1990         Once rendering is fixed, we should change it back to biplanar as it is closer to what libwebrtc consumes.
1991         Covered by manual testing.
1992
1993         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1994         (WebCore::avVideoCapturePixelBufferFormat):
1995         (WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset):
1996         (WebCore::AVVideoCaptureSource::setupCaptureSession):
1997         (WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
1998
1999 2018-09-27  Andy Estes  <aestes@apple.com>
2000
2001         [Apple Pay] Support granular errors in PaymentDetailsUpdate
2002         https://bugs.webkit.org/show_bug.cgi?id=189938
2003
2004         Reviewed by Youenn Fablet.
2005
2006         Implemented the shippingAddressErrors, payerErrors, and paymentMethodErrors properties on
2007         PaymentDetailsUpdate, as specified in the Payment Request API W3C Editor's Draft of
2008         26 September 2018.
2009
2010         When these errors are specified in a PaymentDetailsUpdate, map them to PaymentErrors. For
2011         shippingAddressErrors and payerErrors, we use the "shippingContactInvalid" code and a
2012         contact field that matches the shippingAddressError or payerError property specified.
2013
2014         For paymentMethodErrors, we interpret this as a sequence of ApplePayErrors, which are
2015         converted to PaymentErrors as in Apple Pay JS.
2016
2017         Tests: http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrors.https.html
2018                http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrorsV3.https.html
2019
2020         * DerivedSources.make: Removed some tabs and added new .idl files.
2021         * Modules/applepay/ApplePayError.idl: Moved ApplePayErrorCode and ApplePayErrorContactField
2022         into their own .idl files so they can be used in MockPaymentError.
2023         * Modules/applepay/ApplePayErrorCode.h: Added.
2024         * Modules/applepay/ApplePayErrorCode.idl: Added.
2025         * Modules/applepay/ApplePayErrorContactField.h: Added.
2026         * Modules/applepay/ApplePayErrorContactField.idl: Added.
2027
2028         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
2029         (WebCore::appendShippingContactInvalidError): Appended a "shippingContactInvalid"
2030         PaymentError to errors if the message is non-null.
2031         (WebCore::ApplePayPaymentHandler::computeErrors const):
2032         (WebCore::ApplePayPaymentHandler::detailsUpdated):
2033         (WebCore::ApplePayPaymentHandler::shippingAddressUpdated): Computed a vector of PaymentErrors
2034         based on shippingAddressErrors, payerErrors, and paymentMethodErrors.
2035
2036         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
2037
2038         * Modules/paymentrequest/PaymentDetailsUpdate.h:
2039         * Modules/paymentrequest/PaymentDetailsUpdate.idl: Defined shippingAddressErrors,
2040         payerErrors, and paymentMethodErrors.
2041
2042         * Modules/paymentrequest/PaymentHandler.h:
2043         * Modules/paymentrequest/PaymentRequest.cpp:
2044         (WebCore::PaymentRequest::paymentMethodChanged):
2045         (WebCore::PaymentRequest::settleDetailsPromise): Passed shippingAddressErrors, payerErrors,
2046         and paymentMethodErrors to the payment handler.
2047
2048         * SourcesCocoa.txt:
2049         * WebCore.xcodeproj/project.pbxproj:
2050
2051         * testing/MockPaymentCoordinator.cpp:
2052         (WebCore::MockPaymentCoordinator::completeShippingContactSelection): Stored errors in m_errors.
2053         * testing/MockPaymentCoordinator.h:
2054         * testing/MockPaymentCoordinator.idl: Added an errors attribute.
2055
2056         * testing/MockPaymentError.h: Added.
2057         * testing/MockPaymentError.idl: Added.
2058
2059 2018-09-27  Alex Christensen  <achristensen@webkit.org>
2060
2061         URLWithUserTypedString should return nil for URLs deemed to be invalid by WebCore::URL
2062         https://bugs.webkit.org/show_bug.cgi?id=189979
2063
2064         Reviewed by Youenn Fablet.
2065
2066         * platform/mac/WebCoreNSURLExtras.mm:
2067         (WebCore::URLWithUserTypedString):
2068         (WebCore::dataForURLComponentType):
2069         (WebCore::URLByRemovingComponentAndSubsequentCharacter):
2070         (WebCore::URLByCanonicalizingURL):
2071         (WebCore::originalURLData):
2072         (WebCore::userVisibleString):
2073
2074 2018-09-27  Chris Dumez  <cdumez@apple.com>
2075
2076         document.open() should not propagate URLs to non-fully active documents
2077         https://bugs.webkit.org/show_bug.cgi?id=189375
2078         <rdar://problem/44282755>
2079
2080         Reviewed by Youenn Fablet.
2081
2082         Update our document.open() to not propagate URLs to non-fully active documents, as per:
2083         - https://html.spec.whatwg.org/#document-open-steps (Step 11)
2084
2085         A "fully active" document is defined by at:
2086         - https://html.spec.whatwg.org/#fully-active
2087
2088         No new tests, rebaselined existing test.
2089
2090         * dom/Document.cpp:
2091         (WebCore::Document::open):
2092         (WebCore::Document::isFullyActive const):
2093         * dom/Document.h:
2094         * dom/Document.idl:
2095
2096 2018-09-27  Alicia Boya García  <aboya@igalia.com>
2097
2098         [MSE][GStreamer] Use sentinel buffer to detect end of append
2099         https://bugs.webkit.org/show_bug.cgi?id=189924
2100
2101         Reviewed by Philippe Normand.
2102
2103         This patch introduces a new mechanism to detect when an append has
2104         been consumed completely by the demuxer. It takes advantage of the
2105         fact that buffer pushing is synchronous: both the appsrc and the
2106         demuxer live in the same streaming thread. When appsrc pushes a
2107         buffer, it's actually making a qtdemux function call (it calls its
2108         "chain" function). The demuxer will return from that call when it has
2109         finished processing that buffer; only then the control returns to
2110         appsrc, that can push the next buffer.
2111
2112         By pushing an additional buffer and capturing it in a probe we can
2113         detect reliably when the previous buffer has been processed.
2114         Because the pipeline only has one thread, at this point no more frames
2115         can arrive to the appsink.
2116
2117         This replaces the old method of detecting end of append which relied
2118         on the `need-data` event, which is more difficult to handle correctly
2119         because it fires whenever the appsrc is empty (or below a given
2120         level), which also happens when a buffer has not been pushed yet or
2121         in response to a flush.
2122
2123         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2124         (WebCore::EndOfAppendMeta::init):
2125         (WebCore::EndOfAppendMeta::transform):
2126         (WebCore::EndOfAppendMeta::free):
2127         (WebCore::AppendPipeline::staticInitialization):
2128         (WebCore::AppendPipeline::AppendPipeline):
2129         (WebCore::AppendPipeline::~AppendPipeline):
2130         (WebCore::AppendPipeline::appsrcEndOfAppendCheckerProbe):
2131         (WebCore::AppendPipeline::handleApplicationMessage):
2132         (WebCore::AppendPipeline::handleEndOfAppend):
2133         (WebCore::AppendPipeline::consumeAppsinkAvailableSamples):
2134         (WebCore::AppendPipeline::resetPipeline):
2135         (WebCore::AppendPipeline::pushNewBuffer):
2136         (WebCore::AppendPipeline::handleAppsrcNeedDataReceived): Deleted.:
2137         (WebCore::AppendPipeline::handleAppsrcAtLeastABufferLeft): Deleted.
2138         (WebCore::AppendPipeline::checkEndOfAppend): Deleted.
2139         (WebCore::AppendPipeline::setAppsrcDataLeavingProbe): Deleted.
2140         (WebCore::AppendPipeline::removeAppsrcDataLeavingProbe): Deleted.
2141         (WebCore::AppendPipeline::reportAppsrcAtLeastABufferLeft): Deleted.
2142         (WebCore::AppendPipeline::reportAppsrcNeedDataReceived): Deleted.
2143         (WebCore::appendPipelineAppsrcDataLeaving): Deleted.
2144         (WebCore::appendPipelineAppsrcNeedData): Deleted.
2145         * platform/graphics/gstreamer/mse/AppendPipeline.h:
2146
2147 2018-09-27  Chris Dumez  <cdumez@apple.com>
2148
2149         The WebContent process should not process incoming IPC while waiting for a sync IPC reply
2150         https://bugs.webkit.org/show_bug.cgi?id=184183
2151         <rdar://problem/36800576>
2152
2153         Reviewed by Ryosuke Niwa.
2154
2155         Drop test infrastructure for the DoNotProcessIncomingMessagesWhenWaitingForSyncReply IPC::SendOption
2156         given that this SendOption was removed from this patch.
2157
2158         * page/ChromeClient.h:
2159         * testing/Internals.cpp:
2160         * testing/Internals.h:
2161         * testing/Internals.idl:
2162
2163 2018-09-27  Philippe Normand  <pnormand@igalia.com>
2164
2165         Unreviewed, GTK Ubuntu LTS build fix attempt after r236396.
2166
2167         * platform/graphics/gstreamer/GStreamerCommon.h:
2168
2169 2018-09-27  Antoine Quint  <graouts@apple.com>
2170
2171         [Web Animations] Turn Web Animations with CSS integration on
2172         https://bugs.webkit.org/show_bug.cgi?id=184819
2173         <rdar://problem/39597337>
2174
2175         Reviewed by Dean Jackson.
2176
2177         * page/RuntimeEnabledFeatures.h:
2178
2179 2018-09-26  YUHAN WU  <yuhan_wu@apple.com>
2180
2181         Video track clone cannot preserve original property
2182         https://bugs.webkit.org/show_bug.cgi?id=189872
2183         <rdar://problem/44706579>
2184
2185         Reviewed by Youenn Fablet.
2186
2187         Fix the issue that the cloned track created by canvas.captureStream().getVideoTracks() cannot keep some attributes, such as enabled.
2188         Updated a testcase expected result:
2189         LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/MediaStreamTrack-contentHint.html
2190
2191         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
2192         (WebCore::CanvasCaptureMediaStreamTrack::CanvasCaptureMediaStreamTrack):
2193         (WebCore::CanvasCaptureMediaStreamTrack::create):
2194         (WebCore::CanvasCaptureMediaStreamTrack::clone):
2195         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
2196         * Modules/mediastream/MediaStreamTrack.h:
2197
2198 2018-09-26  Alex Christensen  <achristensen@webkit.org>
2199
2200         Unreviewed, rolling out r236524.
2201
2202         Broke API tests
2203
2204         Reverted changeset:
2205
2206         "URLWithUserTypedString should return nil for URLs deemed to
2207         be invalid by WebCore::URL"
2208         https://bugs.webkit.org/show_bug.cgi?id=189979
2209         https://trac.webkit.org/changeset/236524
2210
2211 2018-09-26  Per Arne Vollan  <pvollan@apple.com>
2212
2213         WebVTT cue alignment broken
2214         https://bugs.webkit.org/show_bug.cgi?id=190004
2215
2216         Reviewed by Eric Carlson.
2217
2218         If the position of the queue is unspecified, the default value of 50 was used, which is incorrect.
2219         This patch also updates the API according to https://w3c.github.io/webvtt/#the-vttcue-interface.
2220         The position attribute should not be a double, but either a double or the "auto" keyword. Parts
2221         of this patch is inspired by the associated code in the Chromium project.
2222
2223         Test: media/track/track-cue-left-align.html
2224
2225         * html/track/TextTrackCueGeneric.cpp:
2226         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
2227         (WebCore::TextTrackCueGeneric::setPosition):
2228         * html/track/TextTrackCueGeneric.h:
2229         * html/track/VTTCue.cpp:
2230         (WebCore::VTTCueBox::applyCSSProperties):
2231         (WebCore::VTTCue::initialize):
2232         (WebCore::VTTCue::position const):
2233         (WebCore::VTTCue::setPosition):
2234         (WebCore::VTTCue::textPositionIsAuto const):
2235         (WebCore::VTTCue::calculateComputedTextPosition const):
2236         (WebCore::VTTCue::calculateDisplayParameters):
2237         (WebCore::VTTCue::toJSON const):
2238         * html/track/VTTCue.h:
2239         (WebCore::VTTCue::position const): Deleted.
2240         * html/track/VTTCue.idl:
2241
2242 2018-09-26  James Savage  <james.savage@apple.com>
2243
2244         Allow override of viewport configuration.
2245         https://bugs.webkit.org/show_bug.cgi?id=188772.
2246         <rdar://problem/43538892>.
2247
2248         Reviewed by Simon Fraser.
2249
2250         * page/Settings.yaml:
2251         * page/ViewportConfiguration.cpp:
2252         (WebCore::ViewportConfiguration::nativeWebpageParameters): Provide a viewport configuration
2253         similar to width=device-width, with initial scale set to 1.
2254         * page/ViewportConfiguration.h:
2255
2256 2018-09-26  Alex Christensen  <achristensen@webkit.org>
2257
2258         URLs with mismatched surrogate pairs in the host should fail to parse
2259         https://bugs.webkit.org/show_bug.cgi?id=190005
2260
2261         Reviewed by Chris Dumez.
2262
2263         Elsewhere in the URLParser, when we encounter mismatched surrogate pairs we use the replacement character,
2264         but that just fails later on in domainToASCII, so we may as well just fail.
2265         This behavior matches Chrome, but is unclear in the spec.  There are no valid uses of hosts containing mismatched surrogate pairs.
2266         Covered by new API tests.
2267
2268         * platform/URLParser.cpp:
2269         (WebCore::URLParser::parseHostAndPort):
2270
2271 2018-09-26  Alex Christensen  <achristensen@webkit.org>
2272
2273         uidna_nameToASCII only needs a buffer capacity of 64
2274         https://bugs.webkit.org/show_bug.cgi?id=190006
2275
2276         Reviewed by Chris Dumez.
2277
2278         This is specified in https://www.unicode.org/reports/tr46/#ToASCII
2279         This is how Chrome and Firefox also behave with long unicode hosts.
2280
2281         * platform/URLParser.cpp:
2282         (WebCore::URLParser::domainToASCII):
2283
2284 2018-09-26  Alex Christensen  <achristensen@webkit.org>
2285
2286         URLWithUserTypedString should return nil for URLs deemed to be invalid by WebCore::URL
2287         https://bugs.webkit.org/show_bug.cgi?id=189979
2288         <rdar://problem/44119696>
2289
2290         Reviewed by Chris Dumez.
2291
2292         Covered by an API test.
2293
2294         * platform/mac/WebCoreNSURLExtras.mm:
2295         (WebCore::URLWithData):
2296
2297 2018-09-26  Ryosuke Niwa  <rniwa@webkit.org>
2298
2299         Selection should work across shadow boundary when initiated by a mouse drag
2300         https://bugs.webkit.org/show_bug.cgi?id=151380
2301         <rdar://problem/24363872>
2302
2303         Revert the change that I said I would from r236519.
2304
2305         * editing/VisibleSelection.cpp:
2306         (WebCore::VisibleSelection::adjustSelectionToAvoidCrossingShadowBoundaries):
2307
2308 2018-09-26  Commit Queue  <commit-queue@webkit.org>
2309
2310         Unreviewed, rolling out r236511.
2311         https://bugs.webkit.org/show_bug.cgi?id=190008
2312
2313         It is breaking some WebRTC tests (Requested by youenn on
2314         #webkit).
2315
2316         Reverted changeset:
2317
2318         "[MediaStream] Clean up RealtimeMediaSource settings change
2319         handling"
2320         https://bugs.webkit.org/show_bug.cgi?id=189998
2321         https://trac.webkit.org/changeset/236511
2322
2323 2018-09-26  Ryosuke Niwa  <rniwa@webkit.org>
2324
2325         Selection should work across shadow boundary when initiated by a mouse drag
2326         https://bugs.webkit.org/show_bug.cgi?id=151380
2327         <rdar://problem/24363872>
2328
2329         Reviewed by Antti Koivisto and Wenson Hsieh.
2330
2331         This patch adds the basic support for selecting content across shadow DOM boundaries to VisibleSelection,
2332         which is enough to allow users to select content across shadow DOM boundaries via a mouse drag.
2333
2334         This is the first step in allowing users to select, copy and paste content across shadow DOM boundaries,
2335         which is a serious user experience regression right now. The new behavior is disabled by default under
2336         an interal debug feature flag: selectionAcrossShadowBoundariesEnabled.
2337
2338         Like Chrome, we are not going to support selecting editable content across shadow DOM boundaries since
2339         we'd have to generalize every editing commands to make that work, and there aren't any HTML editors that
2340         use shadow DOM boundaries within an editable region yet. For simplicity, we also don't support extending
2341         a selection out of a shadow root which resides inside an editing region.
2342
2343         The keyboard based navigation & manipulation of selection as well as allowing copy & paste of content
2344         across shadow DOM boundaries will be implemented by separate patches. DOMSelection will not expose this new
2345         behavior either. This is tracked in the spec as https://github.com/w3c/webcomponents/issues/79
2346
2347         Tests: editing/selection/selection-across-shadow-boundaries-mixed-editability-1.html
2348                editing/selection/selection-across-shadow-boundaries-mixed-editability-2.html
2349                editing/selection/selection-across-shadow-boundaries-mixed-editability-3.html
2350                editing/selection/selection-across-shadow-boundaries-mixed-editability-4.html
2351                editing/selection/selection-across-shadow-boundaries-mixed-editability-5.html
2352                editing/selection/selection-across-shadow-boundaries-readonly-1.html
2353                editing/selection/selection-across-shadow-boundaries-readonly-2.html
2354                editing/selection/selection-across-shadow-boundaries-readonly-3.html
2355                editing/selection/selection-across-shadow-boundaries-user-select-all-1.html
2356
2357         * editing/VisibleSelection.cpp:
2358         (WebCore::isInUserAgentShadowRootOrHasEditableShadowAncestor): Added.
2359         (WebCore::VisibleSelection::adjustSelectionToAvoidCrossingShadowBoundaries): When the feature is enabled,
2360         allow crossing shadow DOM boundaries except when either end is inside an user agent shadow root, or one of
2361         its shadow includign ancestor is inside an editable region. The latter check is needed to disallow
2362         an extension of a selection starting in a shadow tree inside a non-editable region inside an editable region
2363         to outside the editable region. The rest of the editing code is not ready to deal with selection like that.
2364         * page/Settings.yaml: Added an internal debug feature to enable this new behavior.
2365
2366 2018-09-26  Chris Dumez  <cdumez@apple.com>
2367
2368         Ignore-opens-during-unload counter of a parent should apply to its children during beforeunload event
2369         https://bugs.webkit.org/show_bug.cgi?id=189376
2370         <rdar://problem/44282754>
2371
2372         Reviewed by Ryosuke Niwa.
2373
2374         Make sure the Ignore-opens-during-unload counter of a parent stays incremented while we are firing the
2375         beforeunload event for its descendants, as per:
2376         - https://html.spec.whatwg.org/multipage/browsing-the-web.html#prompt-to-unload-a-document
2377
2378         No new tests, rebaselined existing tests.
2379
2380         * loader/FrameLoader.cpp:
2381         (WebCore::FrameLoader::shouldClose):
2382         (WebCore::FrameLoader::dispatchBeforeUnloadEvent):
2383
2384 2018-09-26  Justin Fan  <justin_fan@apple.com>
2385
2386         WebGL 2: Adding logging to in-progress features
2387         https://bugs.webkit.org/show_bug.cgi?id=189978
2388
2389         Reviewed by Jon Lee.
2390
2391         Logging will allow us to better identify the most in-demand WebGL 2 features and prioritize our efforts.
2392
2393         No tests as no change in WebGL functionality.
2394
2395         * html/canvas/WebGL2RenderingContext.cpp: Added logging statement to every function not yet implemented.
2396         (WebCore::WebGL2RenderingContext::blitFramebuffer):
2397         (WebCore::WebGL2RenderingContext::framebufferTextureLayer):
2398         (WebCore::WebGL2RenderingContext::invalidateFramebuffer):
2399         (WebCore::WebGL2RenderingContext::invalidateSubFramebuffer):
2400         (WebCore::WebGL2RenderingContext::readBuffer):
2401         (WebCore::WebGL2RenderingContext::texStorage3D):
2402         (WebCore::WebGL2RenderingContext::texImage2D):
2403         (WebCore::WebGL2RenderingContext::texImage3D):
2404         (WebCore::WebGL2RenderingContext::texSubImage2D):
2405         (WebCore::WebGL2RenderingContext::texSubImage3D):
2406         (WebCore::WebGL2RenderingContext::copyTexSubImage3D):
2407         (WebCore::WebGL2RenderingContext::compressedTexImage2D):
2408         (WebCore::WebGL2RenderingContext::compressedTexImage3D):
2409         (WebCore::WebGL2RenderingContext::compressedTexSubImage3D):
2410         (WebCore::WebGL2RenderingContext::getFragDataLocation):
2411         (WebCore::WebGL2RenderingContext::uniform1ui):
2412         (WebCore::WebGL2RenderingContext::uniform2ui):
2413         (WebCore::WebGL2RenderingContext::uniform3ui):
2414         (WebCore::WebGL2RenderingContext::uniform4ui):
2415         (WebCore::WebGL2RenderingContext::uniform1uiv):
2416         (WebCore::WebGL2RenderingContext::uniform2uiv):
2417         (WebCore::WebGL2RenderingContext::uniform3uiv):
2418         (WebCore::WebGL2RenderingContext::uniform4uiv):
2419         (WebCore::WebGL2RenderingContext::uniformMatrix2x3fv):
2420         (WebCore::WebGL2RenderingContext::uniformMatrix3x2fv):
2421         (WebCore::WebGL2RenderingContext::uniformMatrix2x4fv):
2422         (WebCore::WebGL2RenderingContext::uniformMatrix4x2fv):
2423         (WebCore::WebGL2RenderingContext::uniformMatrix3x4fv):
2424         (WebCore::WebGL2RenderingContext::uniformMatrix4x3fv):
2425         (WebCore::WebGL2RenderingContext::vertexAttribI4i):
2426         (WebCore::WebGL2RenderingContext::vertexAttribI4iv):
2427         (WebCore::WebGL2RenderingContext::vertexAttribI4ui):
2428         (WebCore::WebGL2RenderingContext::vertexAttribI4uiv):
2429         (WebCore::WebGL2RenderingContext::vertexAttribIPointer):
2430         (WebCore::WebGL2RenderingContext::drawRangeElements):
2431         (WebCore::WebGL2RenderingContext::createQuery):
2432         (WebCore::WebGL2RenderingContext::deleteQuery):
2433         (WebCore::WebGL2RenderingContext::isQuery):
2434         (WebCore::WebGL2RenderingContext::beginQuery):
2435         (WebCore::WebGL2RenderingContext::endQuery):
2436         (WebCore::WebGL2RenderingContext::getQuery):
2437         (WebCore::WebGL2RenderingContext::getQueryParameter):
2438         (WebCore::WebGL2RenderingContext::createSampler):
2439         (WebCore::WebGL2RenderingContext::deleteSampler):
2440         (WebCore::WebGL2RenderingContext::isSampler):
2441         (WebCore::WebGL2RenderingContext::bindSampler):
2442         (WebCore::WebGL2RenderingContext::samplerParameteri):
2443         (WebCore::WebGL2RenderingContext::samplerParameterf):
2444         (WebCore::WebGL2RenderingContext::getSamplerParameter):
2445         (WebCore::WebGL2RenderingContext::fenceSync):
2446         (WebCore::WebGL2RenderingContext::isSync):
2447         (WebCore::WebGL2RenderingContext::deleteSync):
2448         (WebCore::WebGL2RenderingContext::clientWaitSync):
2449         (WebCore::WebGL2RenderingContext::waitSync):
2450         (WebCore::WebGL2RenderingContext::getSyncParameter):
2451         (WebCore::WebGL2RenderingContext::createTransformFeedback):
2452         (WebCore::WebGL2RenderingContext::deleteTransformFeedback):
2453         (WebCore::WebGL2RenderingContext::isTransformFeedback):
2454         (WebCore::WebGL2RenderingContext::bindTransformFeedback):
2455         (WebCore::WebGL2RenderingContext::beginTransformFeedback):
2456         (WebCore::WebGL2RenderingContext::endTransformFeedback):
2457         (WebCore::WebGL2RenderingContext::transformFeedbackVaryings):
2458         (WebCore::WebGL2RenderingContext::getTransformFeedbackVarying):
2459         (WebCore::WebGL2RenderingContext::pauseTransformFeedback):
2460         (WebCore::WebGL2RenderingContext::resumeTransformFeedback):
2461         (WebCore::WebGL2RenderingContext::bindBufferBase):
2462         (WebCore::WebGL2RenderingContext::bindBufferRange):
2463         (WebCore::WebGL2RenderingContext::getUniformIndices):
2464         (WebCore::WebGL2RenderingContext::getUniformBlockIndex):
2465         (WebCore::WebGL2RenderingContext::getActiveUniformBlockParameter):
2466         (WebCore::WebGL2RenderingContext::getActiveUniformBlockName):
2467         (WebCore::WebGL2RenderingContext::uniformBlockBinding):
2468
2469 2018-09-26  Eric Carlson  <eric.carlson@apple.com>
2470
2471         [MediaStream] Clean up RealtimeMediaSource settings change handling
2472         https://bugs.webkit.org/show_bug.cgi?id=189998
2473         <rdar://problem/44797884>
2474
2475         Reviewed by Youenn Fablet.
2476
2477         No new tests, no change in functionality.
2478
2479         * platform/mediastream/RealtimeMediaSource.cpp:
2480         (WebCore::RealtimeMediaSource::notifySettingsDidChangeObservers):
2481         (WebCore::RealtimeMediaSource::setSize):
2482         (WebCore::RealtimeMediaSource::setFrameRate):
2483         (WebCore::RealtimeMediaSource::setAspectRatio):
2484         (WebCore::RealtimeMediaSource::setFacingMode):
2485         (WebCore::RealtimeMediaSource::setVolume):
2486         (WebCore::RealtimeMediaSource::setSampleRate):
2487         (WebCore::RealtimeMediaSource::setSampleSize):
2488         (WebCore::RealtimeMediaSource::setEchoCancellation):
2489         (WebCore::RealtimeMediaSource::settingsDidChange): Deleted.
2490         * platform/mediastream/RealtimeMediaSource.h:
2491         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2492         (WebCore::AVVideoCaptureSource::settingsDidChange):
2493         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2494         (WebCore::CoreAudioCaptureSource::settingsDidChange):
2495         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
2496         (WebCore::DisplayCaptureSourceCocoa::settingsDidChange):
2497         * platform/mock/MockRealtimeAudioSource.cpp:
2498         (WebCore::MockRealtimeAudioSource::settingsDidChange):
2499         * platform/mock/MockRealtimeVideoSource.cpp:
2500         (WebCore::MockRealtimeVideoSource::settingsDidChange):
2501
2502 2018-09-26  Antoine Quint  <graouts@apple.com>
2503
2504         [Web Animations] Ensure renderers with accelerated animations have layers
2505         https://bugs.webkit.org/show_bug.cgi?id=189990
2506         <rdar://problem/44791222>
2507
2508         Reviewed by Zalan Bujtas.
2509
2510         We have done some work already in webkit.org/b/189784 to prevent never-ending calls to DocumentTimeline::updateAnimations(). This was due to
2511         the change made for webkit.org/b/186930 where we queued calls to updateAnimations() in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
2512         while we were waiting for a renderer with a layer backing for a given animation target. Instead of doing this, we now ensure renderers always
2513         have a layer when they have an accelerated animation applied.
2514
2515         No new tests, this is already covered by webanimations/accelerated-animation-with-delay.html and webanimations/opacity-animation-yields-compositing-span.html
2516         which respectively check that we can apply an accelerated animation to a non-positioned block and an inline element.
2517
2518         * animation/DocumentTimeline.cpp:
2519         (WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated const): This method should have been marked const all along and it is
2520         now required so it can be called through RenderBox::requiresLayer() and RenderInline::requiresLayer().
2521         (WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated): Deleted.
2522         * animation/DocumentTimeline.h:
2523         * animation/KeyframeEffectReadOnly.cpp:
2524         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Stop enqueuing the accelerated actions in case we're lacking a composited renderer
2525         since this situation should no longer arise.
2526         * rendering/RenderBox.h: Make requiresLayer() return true if this renderer's element is the target of accelerated animations.
2527         * rendering/RenderBoxModelObject.cpp:
2528         (WebCore::RenderBoxModelObject::hasRunningAcceleratedAnimations const): Query the document timeline, if it exists, to check that this renderer's element
2529         has accelerated animations applied.
2530         * rendering/RenderBoxModelObject.h:
2531         * rendering/RenderInline.h: Make requiresLayer() return true if this renderer's element is the target of accelerated animations.
2532
2533 2018-09-25  Eric Carlson  <eric.carlson@apple.com>
2534
2535         [MediaStream] Add Mac window capture source
2536         https://bugs.webkit.org/show_bug.cgi?id=189958
2537         <rdar://problem/44767616>
2538
2539         Reviewed by Youenn Fablet.
2540
2541         * SourcesCocoa.txt: Add WindowDisplayCaptureSourceMac.
2542         * WebCore.xcodeproj/project.pbxproj: Ditto.
2543
2544         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
2545         (WebCore::DisplayCaptureManagerCocoa::captureDevices): Include window "devices".
2546         (WebCore::DisplayCaptureManagerCocoa::updateWindowCaptureDevices): New.
2547         (WebCore::DisplayCaptureManagerCocoa::windowCaptureDeviceWithPersistentID): New.
2548         (WebCore::DisplayCaptureManagerCocoa::captureDeviceWithPersistentID): Include window devices.
2549         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
2550
2551         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
2552         (WebCore::DisplayCaptureSourceCocoa::DisplayCaptureSourceCocoa):
2553         (WebCore::DisplayCaptureSourceCocoa::settings): Use frameSize, report surface type and 
2554         logical surface.
2555         (WebCore::DisplayCaptureSourceCocoa::settingsDidChange): Clear m_lastSampleBuffer when size changes.
2556         (WebCore::DisplayCaptureSourceCocoa::frameSize const): New, return size() or intrinsic size.
2557         (WebCore::DisplayCaptureSourceCocoa::setIntrinsicSize): New.
2558         (WebCore::DisplayCaptureSourceCocoa::emitFrame): generateFrame now returns a CVPixelBuffer
2559         so derived classes don't have to deal with resizing/transforming.
2560         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
2561
2562         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2563
2564         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
2565         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
2566         (WebCore::ScreenDisplayCaptureSourceMac::ScreenDisplayCaptureSourceMac): Add fixme.
2567         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Update intrinsic size when
2568         width/height changes.
2569         (WebCore::ScreenDisplayCaptureSourceMac::generateFrame): Return a CVPixelBuffer.
2570
2571         * platform/mediastream/mac/WindowDisplayCaptureSourceMac.h: Added.
2572         * platform/mediastream/mac/WindowDisplayCaptureSourceMac.mm: Added.
2573         (WebCore::anyOfCGWindow):
2574         (WebCore::windowDescription):
2575         (WebCore::WindowDisplayCaptureSourceMac::create):
2576         (WebCore::WindowDisplayCaptureSourceMac::WindowDisplayCaptureSourceMac):
2577         (WebCore::WindowDisplayCaptureSourceMac::windowImage):
2578         (WebCore::WindowDisplayCaptureSourceMac::generateFrame):
2579         (WebCore::WindowDisplayCaptureSourceMac::pixelBufferFromCGImage):
2580         (WebCore::WindowDisplayCaptureSourceMac::windowCaptureDeviceWithPersistentID):
2581         (WebCore::WindowDisplayCaptureSourceMac::windowCaptureDevices):
2582
2583 2018-09-25  Justin Fan  <justin_fan@apple.com>
2584
2585         WebGL 2 Conformance: primitive restart and draw_primitive_restart WebGL2 sample
2586         https://bugs.webkit.org/show_bug.cgi?id=189625
2587         <rdar://problem/42882620>
2588
2589         Reviewed by Dean Jackson.
2590
2591         Ref test: webgl/webgl2-primitive-restart.html.
2592
2593         Implement support for Primitive Restart Fixed Index as expected 
2594         by the WebGL 2 specifications. 
2595
2596         * html/canvas/WebGL2RenderingContext.cpp:
2597         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
2598         * html/canvas/WebGLRenderingContextBase.h:
2599         (WebCore::WebGLRenderingContextBase::getLastIndex): Template that must be defined in header.
2600         * html/canvas/WebGLRenderingContextBase.cpp:
2601         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
2602         * platform/graphics/GraphicsContext3D.h:
2603         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
2604         (WebCore::GraphicsContext3D::GraphicsContext3D):
2605         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2606         (WebCore::GraphicsContext3D::primitiveRestartIndex):
2607
2608 2018-09-25  John Wilander  <wilander@apple.com>
2609
2610         Change from HAVE(CFNETWORK_STORAGE_PARTITIONING) to ENABLE(RESOURCE_LOAD_STATISTICS)
2611         https://bugs.webkit.org/show_bug.cgi?id=189959
2612         <rdar://problem/44767642>
2613
2614         Reviewed by Chris Dumez.
2615
2616         No new tests because of no code change.
2617
2618         We no longer make use of CFNetwork's cookie partitioning so we should
2619         change the compile-time flag to something that makes sense. This should
2620         also make it easier/cleaner for other ports.
2621
2622         * dom/Document.cpp:
2623         (WebCore::Document::hasStorageAccess):
2624         (WebCore::Document::requestStorageAccess):
2625         (WebCore::Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction):
2626         * dom/Document.h:
2627         * loader/EmptyFrameLoaderClient.h:
2628         * loader/FrameLoaderClient.h:
2629         * loader/ResourceLoadObserver.cpp:
2630         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2631         (WebCore::ResourceLoadObserver::logWindowCreation):
2632         * loader/ResourceLoadObserver.h:
2633         * page/DOMWindow.cpp:
2634         (WebCore::DOMWindow::createWindow):
2635         * platform/network/NetworkStorageSession.h:
2636         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2637         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
2638         (WebCore::cookiesForURL):
2639         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
2640
2641 2018-09-25  Jiewen Tan  <jiewen_tan@apple.com>
2642
2643         [WebAuthN] Make AuthenticatorManager
2644         https://bugs.webkit.org/show_bug.cgi?id=189279
2645         <rdar://problem/44116792>
2646
2647         Reviewed by Chris Dumez.
2648
2649         This patch does the following things in WebCore in order to support AuthenticatorManager:
2650         1) It separates AuthenticatorTransport from PublicKeyCredentialDescriptor such that the enum
2651         can be queried from WebKit directly.
2652         2) It adds AuthenticatorAttachment to PublicKeyCredentialCreationOptions such that relying parties
2653         could express their interests in cross platform authenticators.
2654         3) It enhances IPC encoder/decoder of a few such that Vectors and empty objects can be correctly coded.
2655         4) It moves the LocalAuthenticator implementation to WebKit to better integrate with AuthenticatorManager.
2656         5) It moves linking to LocalAuthentication.framework to WebKit as well.
2657         6) It temporarily bans old mock test mechanism in Internals so we could enable the new mock test mechanism in
2658         WebKitTestRunner which we will have a better coverage of codes in UI Process. Those tests will be either
2659         removed or ported to the new mechanism in Bug 189283.
2660         7) It also removes "using namespace WebCore" from the top namespace in some .mm files as they are reordered
2661         to where they could introduce name confusions.
2662
2663         Tests: http/wpt/webauthn/public-key-credential-create-failure-local.https.html
2664                http/wpt/webauthn/public-key-credential-create-success-local.https.html
2665                http/wpt/webauthn/public-key-credential-get-failure-local.https.html
2666                http/wpt/webauthn/public-key-credential-get-success-local.https.html
2667                http/wpt/webauthn/public-key-credential-is-user-verifying-platform-authenticator-available.html
2668
2669         * CMakeLists.txt:
2670         * Configurations/WebCore.xcconfig:
2671         * DerivedSources.make:
2672         * Modules/webauthn/AuthenticatorTransport.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
2673         * Modules/webauthn/AuthenticatorTransport.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialDescriptor.idl.
2674         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
2675         (WebCore::PublicKeyCredentialCreationOptions::encode const):
2676         (WebCore::PublicKeyCredentialCreationOptions::decode):
2677         * Modules/webauthn/PublicKeyCredentialCreationOptions.idl:
2678         * Modules/webauthn/PublicKeyCredentialData.h:
2679         (WebCore::PublicKeyCredentialData::encode const):
2680         (WebCore::PublicKeyCredentialData::decode):
2681         * Modules/webauthn/PublicKeyCredentialDescriptor.h:
2682         (WebCore::PublicKeyCredentialDescriptor::encode const):
2683         * Modules/webauthn/PublicKeyCredentialDescriptor.idl:
2684         * Modules/webauthn/cocoa/LocalAuthenticator.mm: Removed.
2685         * Sources.txt:
2686         * SourcesCocoa.txt:
2687         * WebCore.xcodeproj/project.pbxproj:
2688         * dom/ExceptionData.h:
2689         * platform/cocoa/LocalAuthenticationSoftLink.mm: Removed.
2690         * platform/cocoa/SharedBufferCocoa.mm:
2691         (-[WebCoreSharedBufferData initWithSharedBufferDataSegment:]):
2692         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
2693         (VideoFullscreenModelVideoElement::VideoFullscreenModelVideoElement): Deleted.
2694         (VideoFullscreenModelVideoElement::~VideoFullscreenModelVideoElement): Deleted.
2695         (VideoFullscreenModelVideoElement::setVideoElement): Deleted.
2696         (VideoFullscreenModelVideoElement::handleEvent): Deleted.
2697         (VideoFullscreenModelVideoElement::updateForEventName): Deleted.
2698         (VideoFullscreenModelVideoElement::willExitFullscreen): Deleted.
2699         (VideoFullscreenModelVideoElement::setVideoFullscreenLayer): Deleted.
2700         (VideoFullscreenModelVideoElement::waitForPreparedForInlineThen): Deleted.
2701         (VideoFullscreenModelVideoElement::requestFullscreenMode): Deleted.
2702         (VideoFullscreenModelVideoElement::setVideoLayerFrame): Deleted.
2703         (VideoFullscreenModelVideoElement::setVideoLayerGravity): Deleted.
2704         (VideoFullscreenModelVideoElement::observedEventNames): Deleted.
2705         (VideoFullscreenModelVideoElement::eventNameAll): Deleted.
2706         (VideoFullscreenModelVideoElement::fullscreenModeChanged): Deleted.
2707         (VideoFullscreenModelVideoElement::addClient): Deleted.
2708         (VideoFullscreenModelVideoElement::removeClient): Deleted.
2709         (VideoFullscreenModelVideoElement::isVisible const): Deleted.
2710         (VideoFullscreenModelVideoElement::setHasVideo): Deleted.
2711         (VideoFullscreenModelVideoElement::setVideoDimensions): Deleted.
2712         (VideoFullscreenModelVideoElement::willEnterPictureInPicture): Deleted.
2713         (VideoFullscreenModelVideoElement::didEnterPictureInPicture): Deleted.
2714         (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture): Deleted.
2715         (VideoFullscreenModelVideoElement::willExitPictureInPicture): Deleted.
2716         (VideoFullscreenModelVideoElement::didExitPictureInPicture): Deleted.
2717         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
2718         (WebCore::hasExplicitBeginTime):
2719         (WebCore::setHasExplicitBeginTime):
2720         (WebCore::toCAFillModeType):
2721         (WebCore::toCAValueFunctionType):
2722         (WebCore::toCAMediaTimingFunction):
2723         (WebCore::PlatformCAAnimationCocoa::setFromValue):
2724         (WebCore::PlatformCAAnimationCocoa::setToValue):
2725         (WebCore::PlatformCAAnimationCocoa::setValues):
2726         (fromCAFillModeType): Deleted.
2727         (fromCAValueFunctionType): Deleted.
2728         (PlatformCAAnimationCocoa::create): Deleted.
2729         (PlatformCAAnimationCocoa::PlatformCAAnimationCocoa): Deleted.
2730         (PlatformCAAnimationCocoa::~PlatformCAAnimationCocoa): Deleted.
2731         (PlatformCAAnimationCocoa::copy const): Deleted.
2732         (PlatformCAAnimationCocoa::platformAnimation const): Deleted.
2733         (PlatformCAAnimationCocoa::keyPath const): Deleted.
2734         (PlatformCAAnimationCocoa::beginTime const): Deleted.
2735         (PlatformCAAnimationCocoa::setBeginTime): Deleted.
2736         (PlatformCAAnimationCocoa::duration const): Deleted.
2737         (PlatformCAAnimationCocoa::setDuration): Deleted.
2738         (PlatformCAAnimationCocoa::speed const): Deleted.
2739         (PlatformCAAnimationCocoa::setSpeed): Deleted.
2740         (PlatformCAAnimationCocoa::timeOffset const): Deleted.
2741         (PlatformCAAnimationCocoa::setTimeOffset): Deleted.
2742         (PlatformCAAnimationCocoa::repeatCount const): Deleted.
2743         (PlatformCAAnimationCocoa::setRepeatCount): Deleted.
2744         (PlatformCAAnimationCocoa::autoreverses const): Deleted.
2745         (PlatformCAAnimationCocoa::setAutoreverses): Deleted.
2746         (PlatformCAAnimationCocoa::fillMode const): Deleted.
2747         (PlatformCAAnimationCocoa::setFillMode): Deleted.
2748         (PlatformCAAnimationCocoa::setTimingFunction): Deleted.
2749         (PlatformCAAnimationCocoa::copyTimingFunctionFrom): Deleted.
2750         (PlatformCAAnimationCocoa::isRemovedOnCompletion const): Deleted.
2751         (PlatformCAAnimationCocoa::setRemovedOnCompletion): Deleted.
2752         (PlatformCAAnimationCocoa::isAdditive const): Deleted.
2753         (PlatformCAAnimationCocoa::setAdditive): Deleted.
2754         (PlatformCAAnimationCocoa::valueFunction const): Deleted.
2755         (PlatformCAAnimationCocoa::setValueFunction): Deleted.
2756         (PlatformCAAnimationCocoa::setFromValue): Deleted.
2757         (PlatformCAAnimationCocoa::copyFromValueFrom): Deleted.
2758         (PlatformCAAnimationCocoa::setToValue): Deleted.
2759         (PlatformCAAnimationCocoa::copyToValueFrom): Deleted.
2760         (PlatformCAAnimationCocoa::setValues): Deleted.
2761         (PlatformCAAnimationCocoa::copyValuesFrom): Deleted.
2762         (PlatformCAAnimationCocoa::setKeyTimes): Deleted.
2763         (PlatformCAAnimationCocoa::copyKeyTimesFrom): Deleted.
2764         (PlatformCAAnimationCocoa::setTimingFunctions): Deleted.
2765         (PlatformCAAnimationCocoa::copyTimingFunctionsFrom): Deleted.
2766         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
2767         (PlatformCAFilters::filterValueForOperation): Deleted.
2768         (PlatformCAFilters::colorMatrixValueForFilter): Deleted.
2769         (PlatformCAFilters::setBlendingFiltersOnLayer): Deleted.
2770         (PlatformCAFilters::numAnimatedFilterProperties): Deleted.
2771         (PlatformCAFilters::animatedFilterPropertyName): Deleted.
2772         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2773         (-[WebAnimationDelegate animationDidStart:]):
2774         (-[WebAnimationDelegate animationDidStop:finished:]):
2775         (-[WebAnimationDelegate setOwner:]):
2776         (PlatformCALayerCocoa::create): Deleted.
2777         (PlatformCALayer::platformCALayer): Deleted.
2778         (mediaTimeToCurrentTime): Deleted.
2779         (PlatformCALayerCocoa::setOwner): Deleted.
2780         (toCAFilterType): Deleted.
2781         (PlatformCALayerCocoa::layerTypeForPlatformLayer): Deleted.
2782         (PlatformCALayerCocoa::PlatformCALayerCocoa): Deleted.
2783         (PlatformCALayerCocoa::commonInit): Deleted.
2784         (PlatformCALayerCocoa::clone const): Deleted.
2785         (PlatformCALayerCocoa::~PlatformCALayerCocoa): Deleted.
2786         (PlatformCALayerCocoa::animationStarted): Deleted.
2787         (PlatformCALayerCocoa::animationEnded): Deleted.
2788         (PlatformCALayerCocoa::setNeedsDisplay): Deleted.
2789         (PlatformCALayerCocoa::setNeedsDisplayInRect): Deleted.
2790         (PlatformCALayerCocoa::copyContentsFromLayer): Deleted.
2791         (PlatformCALayerCocoa::superlayer const): Deleted.
2792         (PlatformCALayerCocoa::removeFromSuperlayer): Deleted.
2793         (PlatformCALayerCocoa::setSublayers): Deleted.
2794         (PlatformCALayerCocoa::removeAllSublayers): Deleted.
2795         (PlatformCALayerCocoa::appendSublayer): Deleted.
2796         (PlatformCALayerCocoa::insertSublayer): Deleted.
2797         (PlatformCALayerCocoa::replaceSublayer): Deleted.
2798         (PlatformCALayerCocoa::adoptSublayers): Deleted.
2799         (PlatformCALayerCocoa::addAnimationForKey): Deleted.
2800         (PlatformCALayerCocoa::removeAnimationForKey): Deleted.
2801         (PlatformCALayerCocoa::animationForKey): Deleted.
2802         (PlatformCALayerCocoa::setMask): Deleted.
2803         (PlatformCALayerCocoa::isOpaque const): Deleted.
2804         (PlatformCALayerCocoa::setOpaque): Deleted.
2805         (PlatformCALayerCocoa::bounds const): Deleted.
2806         (PlatformCALayerCocoa::setBounds): Deleted.
2807         (PlatformCALayerCocoa::position const): Deleted.
2808         (PlatformCALayerCocoa::setPosition): Deleted.
2809         (PlatformCALayerCocoa::anchorPoint const): Deleted.
2810         (PlatformCALayerCocoa::setAnchorPoint): Deleted.
2811         (PlatformCALayerCocoa::transform const): Deleted.
2812         (PlatformCALayerCocoa::setTransform): Deleted.
2813         (PlatformCALayerCocoa::sublayerTransform const): Deleted.
2814         (PlatformCALayerCocoa::setSublayerTransform): Deleted.
2815         (PlatformCALayerCocoa::isHidden const): Deleted.
2816         (PlatformCALayerCocoa::setHidden): Deleted.
2817         (PlatformCALayerCocoa::contentsHidden const): Deleted.
2818         (PlatformCALayerCocoa::setContentsHidden): Deleted.
2819         (PlatformCALayerCocoa::userInteractionEnabled const): Deleted.
2820         (PlatformCALayerCocoa::setUserInteractionEnabled): Deleted.
2821         (PlatformCALayerCocoa::setBackingStoreAttached): Deleted.
2822         (PlatformCALayerCocoa::backingStoreAttached const): Deleted.
2823         (PlatformCALayerCocoa::geometryFlipped const): Deleted.
2824         (PlatformCALayerCocoa::setGeometryFlipped): Deleted.
2825         (PlatformCALayerCocoa::isDoubleSided const): Deleted.
2826         (PlatformCALayerCocoa::setDoubleSided): Deleted.
2827         (PlatformCALayerCocoa::masksToBounds const): Deleted.
2828         (PlatformCALayerCocoa::setMasksToBounds): Deleted.
2829         (PlatformCALayerCocoa::acceleratesDrawing const): Deleted.
2830         (PlatformCALayerCocoa::setAcceleratesDrawing): Deleted.
2831         (PlatformCALayerCocoa::wantsDeepColorBackingStore const): Deleted.
2832         (PlatformCALayerCocoa::setWantsDeepColorBackingStore): Deleted.
2833         (PlatformCALayerCocoa::supportsSubpixelAntialiasedText const): Deleted.
2834         (PlatformCALayerCocoa::setSupportsSubpixelAntialiasedText): Deleted.
2835         (PlatformCALayerCocoa::hasContents const): Deleted.
2836         (PlatformCALayerCocoa::contents const): Deleted.
2837         (PlatformCALayerCocoa::setContents): Deleted.
2838         (PlatformCALayerCocoa::setContentsRect): Deleted.
2839         (PlatformCALayerCocoa::setMinificationFilter): Deleted.
2840         (PlatformCALayerCocoa::setMagnificationFilter): Deleted.
2841         (PlatformCALayerCocoa::backgroundColor const): Deleted.
2842         (PlatformCALayerCocoa::setBackgroundColor): Deleted.
2843         (PlatformCALayerCocoa::setBorderWidth): Deleted.
2844         (PlatformCALayerCocoa::setBorderColor): Deleted.
2845         (PlatformCALayerCocoa::opacity const): Deleted.
2846         (PlatformCALayerCocoa::setOpacity): Deleted.
2847         (PlatformCALayerCocoa::setFilters): Deleted.
2848         (PlatformCALayerCocoa::copyFiltersFrom): Deleted.
2849         (PlatformCALayerCocoa::filtersCanBeComposited): Deleted.
2850         (PlatformCALayerCocoa::setBlendMode): Deleted.
2851         (PlatformCALayerCocoa::setName): Deleted.
2852         (PlatformCALayerCocoa::setSpeed): Deleted.
2853         (PlatformCALayerCocoa::setTimeOffset): Deleted.
2854         (PlatformCALayerCocoa::contentsScale const): Deleted.
2855         (PlatformCALayerCocoa::setContentsScale): Deleted.
2856         (PlatformCALayerCocoa::cornerRadius const): Deleted.
2857         (PlatformCALayerCocoa::setCornerRadius): Deleted.
2858         (PlatformCALayerCocoa::setEdgeAntialiasingMask): Deleted.
2859         (PlatformCALayerCocoa::shapeRoundedRect const): Deleted.
2860         (PlatformCALayerCocoa::setShapeRoundedRect): Deleted.
2861         (PlatformCALayerCocoa::shapeWindRule const): Deleted.
2862         (PlatformCALayerCocoa::setShapeWindRule): Deleted.
2863         (PlatformCALayerCocoa::shapePath const): Deleted.
2864         (PlatformCALayerCocoa::setShapePath): Deleted.
2865         (PlatformCALayerCocoa::requiresCustomAppearanceUpdateOnBoundsChange const): Deleted.
2866         (PlatformCALayerCocoa::updateCustomAppearance): Deleted.
2867         (layerContentsFormat): Deleted.
2868         (PlatformCALayerCocoa::updateContentsFormat): Deleted.
2869         (PlatformCALayerCocoa::tiledBacking): Deleted.
2870         (PlatformCALayer::isWebLayer): Deleted.
2871         (PlatformCALayer::setBoundsOnMainThread): Deleted.
2872         (PlatformCALayer::setPositionOnMainThread): Deleted.
2873         (PlatformCALayer::setAnchorPointOnMainThread): Deleted.
2874         (PlatformCALayer::collectRectsToPaint): Deleted.
2875         (PlatformCALayer::drawLayerContents): Deleted.
2876         (PlatformCALayer::frameForLayer): Deleted.
2877         (PlatformCALayerCocoa::createCompatibleLayer const): Deleted.
2878         (PlatformCALayerCocoa::enumerateRectsBeingDrawn): Deleted.
2879         (PlatformCALayerCocoa::backingStoreBytesPerPixel const): Deleted.
2880         (PlatformCALayerCocoa::avPlayerLayer const): Deleted.
2881         * platform/graphics/ca/cocoa/WebSystemBackdropLayer.mm:
2882         (-[WebLightSystemBackdropLayer init]):
2883         (-[WebDarkSystemBackdropLayer init]):
2884         * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
2885         (-[WebTiledBackingLayer createTileController:]):
2886         (-[WebTiledBackingLayer setNeedsDisplayInRect:]):
2887         (-[WebTiledBackingLayer setBorderColor:]):
2888         * testing/Internals.cpp:
2889         (WebCore::Internals::Internals):
2890
2891 2018-09-25  YUHAN WU  <yuhan_wu@apple.com>
2892
2893         Implement MediaStreamTrack Content Hints
2894         https://bugs.webkit.org/show_bug.cgi?id=189262
2895         <rdar://problem/44101773>
2896
2897         Reviewed by Youenn Fablet.
2898
2899         contentHint is a new attribute which is stored in MediaStreamTrackPrivate.
2900         https://w3c.github.io/mst-content-hint/
2901
2902         Covered by tests: 
2903         LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/MediaStreamTrack-contentHint.html
2904         LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/idlharness.window.html
2905
2906         * Modules/mediastream/MediaStreamTrack.cpp:
2907         (WebCore::MediaStreamTrack::contentHint const):
2908         (WebCore::MediaStreamTrack::setContentHint):
2909         * Modules/mediastream/MediaStreamTrack.h:
2910         * Modules/mediastream/MediaStreamTrack.idl:
2911         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2912         (WebCore::MediaStreamTrackPrivate::setContentHint):
2913         (WebCore::MediaStreamTrackPrivate::clone):
2914         * platform/mediastream/MediaStreamTrackPrivate.h:
2915         (WebCore::MediaStreamTrackPrivate::contentHint):
2916
2917 2018-09-25  Alex Christensen  <achristensen@webkit.org>
2918
2919         Allow for suffixes to com.apple.WebKit.WebContent
2920         https://bugs.webkit.org/show_bug.cgi?id=189972
2921
2922         Reviewed by Chris Dumez.
2923
2924         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2925         (WebCore::isInWebProcess):
2926
2927 2018-09-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2928
2929         [iOS] Fix the open source iOS 12 build after r236445
2930         https://bugs.webkit.org/show_bug.cgi?id=189953
2931
2932         Reviewed by Alex Christensen.
2933
2934         Remove soft-linking macros from several sources in WebCore, and instead import UIKitSoftLink from PAL. This
2935         allows different WebCore sources to soft-link UIKit (and its classes and symbols) without reimplementing
2936         WebCore::UIKitLibrary.
2937
2938         * editing/cocoa/FontAttributesCocoa.mm:
2939         * editing/cocoa/FontShadowCocoa.mm:
2940         (WebCore::FontShadow::createShadow const):
2941         * platform/graphics/cocoa/ColorCocoa.mm:
2942         (WebCore::platformColor):
2943         * platform/ios/PlatformScreenIOS.mm:
2944         (WebCore::screenIsMonochrome):
2945         (WebCore::screenHasInvertedColors):
2946         (WebCore::screenSize):
2947         (WebCore::availableScreenSize):
2948         (WebCore::screenScaleFactor):
2949
2950 2018-09-25  Thibault Saunier  <tsaunier@igalia.com>
2951
2952         [WPE][GTK][WebRTC] Fixup VP8 encoding support
2953         https://bugs.webkit.org/show_bug.cgi?id=189921
2954
2955         Previous leak fixing commit introduced a regression in
2956         the way the encoded buffer were prepared in the default
2957         GStreamerVideoEncoder::Fragmentize implementation (when
2958         encoding with VP8 basically).
2959
2960         + Fix a build warning in the decoder.
2961         + Fix some wrong object members namings.
2962         + Properly move the caps reference when setting restriction caps.
2963         + Do not raise a GStreamer error when GStreamerVideoEncoder::OnEncodedImage
2964           fails - this might be a network issue and other encoders do not consider that
2965           fatal.
2966         + Use GstMappedBuffer where appropriate.
2967
2968         Reviewed by Philippe Normand.
2969
2970         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
2971         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
2972         (WebCore::GStreamerVideoEncoder::InitEncode):
2973         (WebCore::GStreamerVideoEncoder::newSampleCallback):
2974         (WebCore::GStreamerVideoEncoder::Fragmentize):
2975         (WebCore::GStreamerVideoEncoder::SetRestrictionCaps):
2976
2977 2018-09-25  Eric Carlson  <eric.carlson@apple.com>
2978
2979         [MediaStream] Update constraints supported by getDisplayMedia
2980         https://bugs.webkit.org/show_bug.cgi?id=189930
2981
2982         Reviewed by Youenn Fablet.
2983
2984         No new tests, updated http/tests/media/media-stream/get-display-media-prompt.html.
2985
2986         * Modules/mediastream/MediaDevices.cpp:
2987         (WebCore::MediaDevices::getDisplayMedia const): Ignore audio constraints.
2988
2989         * Modules/mediastream/UserMediaRequest.cpp:
2990         (WebCore::hasInvalidGetDisplayMediaConstraint): Check for invalid constraints.
2991         (WebCore::UserMediaRequest::start): Check for invalid constraints.
2992         (WebCore::UserMediaRequest::deny): Support new error.
2993         * Modules/mediastream/UserMediaRequest.h:
2994
2995         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2996         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
2997
2998 2018-09-25  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2999
3000         [EME] Fix variable name that should have gone in r236317
3001         https://bugs.webkit.org/show_bug.cgi?id=189944
3002
3003         Reviewed by Jer Noble.
3004
3005         m_cdmInstanceClientWeakPtrFactory becomes
3006         m_cdmInstanceSessionClientWeakPtrFactory as its type changes to
3007         CDMInstanceSessionClient.
3008
3009         * Modules/encryptedmedia/MediaKeySession.cpp:
3010         (WebCore::MediaKeySession::MediaKeySession):
3011         * Modules/encryptedmedia/MediaKeySession.h:
3012
3013 2018-09-25  Simon Fraser  <simon.fraser@apple.com>
3014
3015         Clean up code around RenderLayer's "has accelerated scrolling" functions
3016         https://bugs.webkit.org/show_bug.cgi?id=189932
3017
3018         Reviewed by Zalan Bujtas.
3019         
3020         RenderLayer had:
3021         
3022         bool hasAcceleratedTouchScrolling()
3023         bool hasTouchScrollableOverflow()
3024         bool usesAcceleratedScrolling()
3025         bool usesCompositedScrolling()
3026         bool usesAsyncScrolling()
3027         
3028         which are hard to keep in your head. Removed usesAcceleratedScrolling() since it just returns hasTouchScrollableOverflow().
3029         Renamed hasAcceleratedTouchScrolling() to canUseAcceleratedTouchScrolling() to indicate that it just looks at style,
3030         not whether layout has given the layer scrollable overflow yet. Tidy up some #ifdefs.
3031         
3032         usesCompositedScrolling() and usesAsyncScrolling() are ScrollableArea overrides, and
3033         look at backing layers, so require that compositing has run already. Note this in comments.
3034
3035         * rendering/RenderLayer.cpp:
3036         (WebCore::RenderLayer::canUseAcceleratedTouchScrolling const):
3037         (WebCore::RenderLayer::hasTouchScrollableOverflow const):
3038         (WebCore::RenderLayer::handleTouchEvent):
3039         (WebCore::RenderLayer::usesAsyncScrolling const):
3040         (WebCore::RenderLayer::showsOverflowControls const):
3041         (WebCore::RenderLayer::calculateClipRects const):
3042         (WebCore::RenderLayer::hasAcceleratedTouchScrolling const): Deleted.
3043         (WebCore::RenderLayer::usesAcceleratedScrolling const): Deleted.
3044         * rendering/RenderLayer.h:
3045         * rendering/RenderLayerBacking.cpp:
3046         (WebCore::layerOrAncestorIsTransformedOrUsingCompositedScrolling):
3047         (WebCore::RenderLayerBacking::updateConfiguration):
3048         * rendering/RenderLayerCompositor.cpp:
3049         (WebCore::RenderLayerCompositor::useCoordinatedScrollingForLayer const):
3050         (WebCore::RenderLayerCompositor::requiresCompositingForOverflowScrolling const):
3051
3052 2018-09-24  Fujii Hironori  <Hironori.Fujii@sony.com>
3053
3054         Rename WTF_COMPILER_GCC_OR_CLANG to WTF_COMPILER_GCC_COMPATIBLE
3055         https://bugs.webkit.org/show_bug.cgi?id=189733
3056
3057         Reviewed by Michael Catanzaro.
3058
3059         No new tests (No behavior change).
3060
3061         * platform/graphics/cpu/arm/filters/FELightingNEON.cpp:
3062         * platform/graphics/cpu/arm/filters/FELightingNEON.h:
3063         * platform/graphics/filters/FELighting.cpp:
3064         (WebCore::FELighting::platformApply):
3065         * platform/graphics/filters/FELighting.h:
3066
3067 2018-09-24  John Wilander  <wilander@apple.com>
3068
3069         Cap lifetime of persistent cookies created client-side through document.cookie
3070         https://bugs.webkit.org/show_bug.cgi?id=189933
3071         <rdar://problem/44741888>
3072
3073         Reviewed by Chris Dumez.
3074
3075         Test: http/tests/cookies/capped-lifetime-for-cookie-set-in-js.html
3076
3077         As pointed out in https://github.com/mikewest/http-state-tokens:
3078
3079         1) Cookies are available to JavaScript by default via document.cookie, which
3080         enables a smooth upgrade from one-time XSS to theft of persistent credentials
3081         and also makes cookies available to Spectre-like attacks on memory.
3082
3083         2) Though the HttpOnly attribute was introduced well over a decade ago, only
3084         ~8.31% of Set-Cookie operations use it today (stats from Chrome). We need
3085         developer incentives to put proper protections in place.
3086
3087         3) The median (uncompressed) Cookie request header is 409 bytes, while the 90th
3088         percentile is 1,589 bytes, the 95th 2,549 bytes, the 99th 4,601 bytes, and
3089         ~0.1% of Cookie headers are over 10kB (stats from Chrome). This is bad for load
3090         performance.
3091
3092         In addition to this, third-party scripts running in first-party contexts can
3093         read user data through document.cookie and even store cross-site tracking data
3094         in them.
3095
3096         Authentication cookies should be HttpOnly and thus not be affected by
3097         restrictions to document.cookie. Cookies that persist for a long time should
3098         be Secure, HttpOnly, and SameSite to provide good security and privacy.
3099
3100         By capping the lifetime of persistent cookies set through document.cookie we
3101         embark on a journey towards better cookie management on the web.
3102
3103         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
3104         (WebCore::filterCookies):
3105             Now caps the life time of persistent cookies to one week (seven days).
3106         * testing/Internals.cpp:
3107         (WebCore::Internals::getCookies const):
3108             New test function to get to cookie meta data such as expiry.
3109         * testing/Internals.h:
3110         * testing/Internals.idl:
3111
3112 2018-09-24  Simon Fraser  <simon.fraser@apple.com>
3113
3114         Remove filterRes parameter from SVG filters
3115         https://bugs.webkit.org/show_bug.cgi?id=129565
3116         <rdar://problem/44714340>
3117
3118         Reviewed by Dean Jackson.
3119         
3120         Remove support for the "filterRes" attribute on SVG filters. It's marked as
3121         deprecated in https://drafts.fxtf.org/filter-effects/#element-attrdef-filter-filterres
3122         and no longer supported by Chrome or Firefox.
3123         
3124         Removed existing filterRes tests, added new test checking that it has no effect.
3125
3126         Tests: svg/filters/filterRes-is-noop.svg
3127
3128         * rendering/svg/RenderSVGResourceFilter.cpp:
3129         (WebCore::RenderSVGResourceFilter::applyResource):
3130         * svg/SVGElement.cpp:
3131         (WebCore::SVGElement::animatableAttributeForName):
3132         * svg/SVGFilterElement.cpp:
3133         (WebCore::SVGFilterElement::registerAttributes):
3134         (WebCore::SVGFilterElement::parseAttribute):
3135         (WebCore::SVGFilterElement::filterResXIdentifier): Deleted.
3136         (WebCore::SVGFilterElement::filterResYIdentifier): Deleted.
3137         (WebCore::SVGFilterElement::setFilterRes): Deleted.
3138         * svg/SVGFilterElement.h:
3139         * svg/SVGFilterElement.idl:
3140         * svg/svgattrs.in:
3141
3142 2018-09-24  Ryosuke Niwa  <rniwa@webkit.org>
3143
3144         Don't cause a crash even when some IDL attribute is missing CEReactions
3145         https://bugs.webkit.org/show_bug.cgi?id=189937
3146
3147         Reviewed by Simon Fraser.
3148
3149         Replaced release assertions in ElementQueue::add and ElementQueue::invokeAll by debug assertions
3150         since a missing CEReactions resulting in a crash is a terrible user experience.
3151
3152         Also made the iteration in invokeAll safe when more elements were added to m_elements.
3153
3154         No new tests since we would still hit debug assertions, and this behavior should only come up
3155         when some IDL attribute is erroneously missing CEReactions.
3156
3157         * dom/CustomElementReactionQueue.cpp:
3158         (WebCore::CustomElementReactionQueue::ElementQueue::add):
3159         (WebCore::CustomElementReactionQueue::ElementQueue::invokeAll):
3160
3161 2018-09-24  Wenson Hsieh  <wenson_hsieh@apple.com>
3162
3163         Refactor Editor::fontAttributesForSelectionStart to be platform-agnostic
3164         https://bugs.webkit.org/show_bug.cgi?id=189918
3165         Work towards <rdar://problem/44648705>
3166
3167         Reviewed by Tim Horton.
3168
3169         Refactors the functionality in Editor::fontAttributesForSelectionStart to not be Cocoa-only. Rename this to
3170         fontAttributesAtSelectionStart (to be consistent with `EditingStyle::styleAtSelectionStart`) and move it from
3171         EditorCocoa.mm to Editor.cpp; instead of creating and populating an NSDictionary with font attribute
3172         information, create and populate a new `FontAttributes` struct that contains the same information. Cocoa clients
3173         in WebKitLegacy may then create an `NSDictionary` as needed from the `FontAttributes`.
3174
3175         * SourcesCocoa.txt:
3176         * WebCore.xcodeproj/project.pbxproj:
3177         * editing/Editor.cpp:
3178         (WebCore::Editor::platformFontAttributesAtSelectionStart const):
3179
3180         Add a hook to allow platforms to supply additional information in FontAttributes. On Cocoa, this adds a UIFont
3181         or NSFont to FontAttributes; otherwise, this is a no-op.
3182
3183         (WebCore::Editor::fontAttributesAtSelectionStart const):
3184         * editing/Editor.h:
3185         * editing/FontAttributeChanges.cpp:
3186         (WebCore::cssValueListForShadow):
3187         * editing/FontAttributeChanges.h:
3188         (): Deleted.
3189         (WebCore::FontShadow::encode const): Deleted.
3190         (WebCore::FontShadow::decode): Deleted.
3191         * editing/FontAttributes.h: Added.
3192
3193         Introduce a new struct that contains font attribute information. May be converted into an NSDictionary for use
3194         by Cocoa clients in WebKitLegacy and WebKit. In a future patch, this will become serializable over IPC for use
3195         in WebKit2.
3196
3197         * editing/FontShadow.h: Added.
3198
3199         Move FontShadow out into a separate header file, included in `FontAttributeChanges.h` and `FontAttributes.h`.
3200
3201         (WebCore::FontShadow::encode const):
3202         (WebCore::FontShadow::decode):
3203         * editing/cocoa/EditorCocoa.mm:
3204
3205         Add a helper function to convert a WebCore::Color to either `UIColor` on iOS or `NSColor` when AppKit is being
3206         used.
3207
3208         (WebCore::Editor::platformFontAttributesAtSelectionStart const):
3209         (WebCore::Editor::getTextDecorationAttributesRespectingTypingStyle const): Deleted.
3210
3211         Remove a helper function that was only used to compute text decoration attributes in
3212         fontAttributesForSelectionStart.
3213
3214         (WebCore::Editor::fontAttributesForSelectionStart const): Deleted.
3215         * editing/cocoa/FontAttributesCocoa.mm: Added.
3216         (WebCore::FontAttributes::createDictionary const):
3217         * editing/cocoa/FontShadowCocoa.mm: Added.
3218         (WebCore::FontShadow::createShadow const):
3219         * editing/cocoa/HTMLConverter.mm:
3220         (_webKitBundle):
3221         (HTMLConverter::_colorForElement):
3222         (_platformColor): Deleted.
3223
3224         Adopt platformColor().
3225
3226         * platform/graphics/cocoa/ColorCocoa.h: Added.
3227         * platform/graphics/cocoa/ColorCocoa.mm: Added.
3228         (WebCore::platformColor):
3229         * platform/graphics/metal/GPURenderPassDescriptorMetal.mm:
3230
3231         Build fix due to changes in unified sources.
3232
3233         * platform/mac/WebCoreNSFontManagerExtras.mm:
3234         (WebCore::computedFontAttributeChanges):
3235         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
3236         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
3237
3238         More build fixes due to changes in unified sources.
3239
3240 2018-09-24  Jer Noble  <jer.noble@apple.com>
3241
3242         SharedBuffer should have an equality test
3243         https://bugs.webkit.org/show_bug.cgi?id=189919
3244
3245         Reviewed by Alex Christensen.
3246
3247         Test: TestWebKitAPI SharedBuffer.isEqualTo.
3248
3249         * platform/SharedBuffer.cpp:
3250         * platform/SharedBuffer.h:
3251         (WebCore::operator==):
3252         (WebCore::operator!=):
3253
3254 2018-09-24  Ryosuke Niwa  <rniwa@webkit.org>
3255
3256         imported/w3c/web-platform-tests/shadow-dom/slotchange.html is a flaky failure
3257         https://bugs.webkit.org/show_bug.cgi?id=167652
3258
3259         Reviewed by Saam Barati.
3260
3261         The bug appears to be caused by the JS wrappers of slot elements getting prematurely collected.
3262         Deployed GCReachableRef introduced in r236376 to fix the bug.
3263
3264         Test: fast/shadow-dom/signal-slot-list-retains-js-wrappers.html
3265
3266         * dom/MutationObserver.cpp:
3267         (WebCore::signalSlotList):
3268         (WebCore::MutationObserver::enqueueSlotChangeEvent):
3269         (WebCore::MutationObserver::notifyMutationObservers):
3270
3271 2018-09-24  Ryosuke Niwa  <rniwa@webkit.org>
3272
3273         Release assert when using paper-textarea due to autocorrect IDL attribute missing CEReactions
3274         https://bugs.webkit.org/show_bug.cgi?id=174629
3275         <rdar://problem/33407620>
3276
3277         Reviewed by Simon Fraser.
3278
3279         The bug was caused by autocorrect and autocapitalize IDL attributes missing CEReactions.
3280
3281         Test: fast/custom-elements/autocorrect-autocapitalize-idl-attributes-crash.html
3282
3283         * html/HTMLElement.idl:
3284
3285 2018-09-24  Chris Dumez  <cdumez@apple.com>
3286
3287         No-op document.open() calls should not have any side effects
3288         https://bugs.webkit.org/show_bug.cgi?id=189373
3289         <rdar://problem/44282702>
3290
3291         Reviewed by Geoffrey Garen.
3292
3293         Update document.open() implementation to match the specification [1] more closely.
3294         In particular, URLs updates should happen much later, at step 11. They were happening
3295         too early and would cause side effects when returning early.
3296
3297         [1] https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#document-open-steps
3298
3299         No new tests, rebaselined existing test.
3300
3301         * dom/Document.cpp:
3302         (WebCore::Document::open):
3303
3304 2018-09-24  Daniel Bates  <dabates@apple.com>
3305
3306         Include more headers in IOSurface.mm, PixelBufferResizer.{h, mm}
3307         https://bugs.webkit.org/show_bug.cgi?id=189928
3308
3309         Reviewed by Andy Estes.
3310
3311         Make building IOSurface.mm and PixelBufferResizer.mm deterministic regardless of
3312         which bundle of unified sources they are built in.
3313
3314         * platform/graphics/cocoa/IOSurface.mm: Include headers HostWindow.h and PlatformScreen.h
3315         since we make use of functionality from these headers.
3316         * platform/graphics/cv/PixelBufferResizer.h: Include header IntSize.h since
3317         we need the size of an IntSize for m_size.
3318         * platform/graphics/cv/PixelBufferResizer.mm: Include header Logging.h since
3319         this file makes use of logging facilities. Also substitute #import for #include
3320         while I am here since this file is an Objective-C++ file.
3321
3322 2018-09-24  Andy Estes  <aestes@apple.com>
3323
3324         [Payment Request] Events cleanup
3325         https://bugs.webkit.org/show_bug.cgi?id=189925
3326
3327         Reviewed by Simon Fraser.
3328
3329         1. Constructed MerchantValidationEvents (and ApplePayValidateMerchantEvents) with rvalue
3330         references to validationURLs.
3331         2. Instead of MerchantValidationEvent and PaymentRequestUpdateEvent having a
3332         RefPtr<PaymentRequest>, downcasted their target to a PaymentRequest. Trusted versions of
3333         these events are always dispatched to a PaymentRequest object.
3334         3. Defined MerchantValidationEventInit in MerchantValidationEvent.idl instead of having a
3335         separate .idl and .h for this dictionary.
3336
3337         No new tests. No change in behavior.
3338
3339         * CMakeLists.txt:
3340         * DerivedSources.make:
3341         * Modules/applepay/ApplePaySession.cpp:
3342         (WebCore::ApplePaySession::validateMerchant):
3343         * Modules/applepay/ApplePaySession.h:
3344         * Modules/applepay/ApplePayValidateMerchantEvent.cpp:
3345         (WebCore::ApplePayValidateMerchantEvent::ApplePayValidateMerchantEvent):
3346         * Modules/applepay/ApplePayValidateMerchantEvent.h:
3347         (WebCore::ApplePayValidateMerchantEvent::create):
3348         * Modules/applepay/PaymentCoordinator.cpp:
3349         (WebCore::PaymentCoordinator::validateMerchant):
3350         * Modules/applepay/PaymentCoordinator.h:
3351         * Modules/applepay/PaymentSession.h:
3352         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
3353         (WebCore::ApplePayPaymentHandler::validateMerchant):
3354         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
3355         * Modules/paymentrequest/MerchantValidationEvent.cpp:
3356         (WebCore::MerchantValidationEvent::create):
3357         (WebCore::MerchantValidationEvent::MerchantValidationEvent):
3358         (WebCore::MerchantValidationEvent::complete):
3359         * Modules/paymentrequest/MerchantValidationEvent.h:
3360         * Modules/paymentrequest/MerchantValidationEvent.idl:
3361         * Modules/paymentrequest/MerchantValidationEventInit.h: Removed.
3362         * Modules/paymentrequest/MerchantValidationEventInit.idl: Removed.
3363         * Modules/paymentrequest/PaymentMethodChangeEvent.cpp:
3364         (WebCore::PaymentMethodChangeEvent::PaymentMethodChangeEvent):
3365         * Modules/paymentrequest/PaymentMethodChangeEvent.h:
3366         * Modules/paymentrequest/PaymentRequest.cpp:
3367         (WebCore::PaymentRequest::shippingAddressChanged):
3368         (WebCore::PaymentRequest::shippingOptionChanged):
3369         (WebCore::PaymentRequest::paymentMethodChanged):
3370         * Modules/paymentrequest/PaymentRequest.h:
3371         (isType):
3372         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp:
3373         (WebCore::PaymentRequestUpdateEvent::PaymentRequestUpdateEvent):
3374         (WebCore::PaymentRequestUpdateEvent::updateWith):
3375         * Modules/paymentrequest/PaymentRequestUpdateEvent.h:
3376         * Sources.txt:
3377         * WebCore.xcodeproj/project.pbxproj:
3378         * dom/EventTarget.cpp:
3379   &