[Web Animations] Positive delays of accelerated animations are not respected
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-09-10  Antoine Quint  <graouts@apple.com>
2
3         [Web Animations] Positive delays of accelerated animations are not respected
4         https://bugs.webkit.org/show_bug.cgi?id=189411
5         <rdar://problem/44151416>
6
7         Reviewed by Dean Jackson.
8
9         Test: webanimations/accelerated-animation-with-delay-and-seek.html
10
11         We were only accounting for negative delays for accelerated actions. We also were misbehaving
12         when seeking an animation with a delay (positive or negative) since we wouldn't reset the animation
13         begin time to be the current time when adjusting its time offset, while the begin time set when
14         first creating the animation would be set accounting for the time offset.
15
16         * animation/KeyframeEffectReadOnly.cpp:
17         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
18         * platform/graphics/ca/GraphicsLayerCA.cpp:
19         (WebCore::GraphicsLayerCA::seekCAAnimationOnLayer):
20
21 2018-09-10  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
22
23         [WTF] Add Markable<T, Traits>
24         https://bugs.webkit.org/show_bug.cgi?id=189231
25
26         Reviewed by Sam Weinig.
27
28         Use Markable<Seconds> and Markable<WallTime> in ResourceResponseBase.
29         Since these fields are parsed results from http header fields, Seconds::nan() and WallTime::nan()
30         can be used as an empty value for these fields. Thus we can use Markable because it uses
31         these nan values as an empty values (they are configured by Seconds::MarkableTraits and WallTime::MarkableTraits).
32         This reduces the size of ResourceResponseBase from 448 to 416.
33
34         * platform/network/ResourceResponseBase.h:
35
36 2018-09-07  Matt Rajca  <mrajca@apple.com>
37
38         Touch Bar displays an active PIP button for audio elements (and it doesn't do anything)
39         https://bugs.webkit.org/show_bug.cgi?id=189433
40         <rdar://problem/44186498> Touch Bar displays an active PIP button for audio elements (and it doesn't do anything)
41
42         Reviewed by Eric Carlson.
43
44         When playing an audio element, the media Touch Bar displays an active PIP button even though only
45         videos are PIP-able. Pressing it does not do anything. The issue is canTogglePictureInPicture is set
46         to YES unconditionally on the WebPlaybackControlsManager. It is then only updated based on whether or
47         not external playback is enabled.
48
49         This patch extends that logic such that the picture-in-picture Touch Bar button will be disabled for
50         audio elements. Since PlaybackSessionModelMediaElement today does not know whether we're dealing
51         with an audio or video element, a new isPictureInPictureSupported flag has been added (as well as
52         the plumbing necessary to get the state over from the web process).
53
54         An API test has been added that checks the value of the canTogglePictureInPicture and ensures it
55         is NO when audio elements are playing. To expose it to tests, a _canTogglePictureInPictureForTesting
56         property has been added to the WKTesting category.
57
58         * platform/cocoa/PlaybackSessionModel.h:
59         (WebCore::PlaybackSessionModelClient::isPictureInPictureSupportedChanged):
60         * platform/cocoa/PlaybackSessionModelMediaElement.h:
61         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
62         (WebCore::PlaybackSessionModelMediaElement::setMediaElement):
63         (WebCore::PlaybackSessionModelMediaElement::isPictureInPictureSupported const):
64         * platform/mac/PlaybackSessionInterfaceMac.h:
65         * platform/mac/PlaybackSessionInterfaceMac.mm:
66         (WebCore::PlaybackSessionInterfaceMac::isPictureInPictureSupportedChanged):
67         (WebCore::PlaybackSessionInterfaceMac::externalPlaybackChanged):
68         (WebCore::PlaybackSessionInterfaceMac::updatePlaybackControlsManagerCanTogglePictureInPicture):
69
70 2018-09-10  Alicia Boya García  <aboya@igalia.com>
71
72         [GStreamer] Fix overflow in buffered ranges
73         https://bugs.webkit.org/show_bug.cgi?id=189419
74
75         Reviewed by Philippe Normand.
76
77         Scale operations on big numbers (like media timestamps or durations)
78         should be made with GStreamer utility functions to avoid overflows.
79
80         This fixes an assertion when a 24 hour long fragmented MP4 file is
81         played.
82
83         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
84         (WebCore::MediaPlayerPrivateGStreamer::buffered const):
85
86 2018-09-07  Frederic Wang  <fwang@igalia.com>
87
88         Refactor filter list checking code
89         https://bugs.webkit.org/show_bug.cgi?id=185087
90
91         Reviewed by Yusuke Suzuki.
92
93         No new tests, behavior unchanged.
94
95         * animation/KeyframeEffectReadOnly.h: Add missing forward-declaration FilterOperations.
96
97 2018-09-10  Philippe Normand  <pnormand@igalia.com>
98
99         [GStreamer] Several media related tests timing out around the same revision
100         https://bugs.webkit.org/show_bug.cgi?id=189349
101
102         Reviewed by Carlos Garcia Campos.
103
104         The timeouts were happening because the `ended` event was no
105         longer properly emitted. The change in playbackPosition also
106         ensures `timeupdate` event remains emitted in a... timely manner.
107
108         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
109         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
110         Reduce the position cache threshold to 200ms, which is a value
111         slightly lower than the 250ms defined in HTMLMediaElement.
112         (WebCore::MediaPlayerPrivateGStreamer::didEnd): Reset the cached
113         position value to ensure the following query will most likely
114         return the same value as reported by the duration query.
115
116 2018-09-10  Rob Buis  <rbuis@igalia.com>
117
118         XMLHttpRequest: overrideMimeType should not update the response's "Content-Type" header
119         https://bugs.webkit.org/show_bug.cgi?id=189465
120
121         Reviewed by Frédéric Wang.
122
123         The xhr spec changed [1, 2] so that overrideMimeType should not update the
124         response's "Content-Type" header anymore.
125
126         Behavior matches Firefox and Chrome.
127
128         [1] https://xhr.spec.whatwg.org/#dom-xmlhttprequest-overridemimetype
129         [2] https://github.com/whatwg/xhr/issues/157
130
131         Tests: http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-content-type-header.html
132                web-platform-tests/xhr/overridemimetype-invalid-mime-type.htm
133
134         * xml/XMLHttpRequest.cpp:
135         (WebCore::XMLHttpRequest::didReceiveResponse):
136
137 2018-09-10  Antoine Quint  <graouts@apple.com>
138
139         [Web Animations] Interrupting an accelerated CSS transition on a composited element in flight fails
140         https://bugs.webkit.org/show_bug.cgi?id=189405
141         <rdar://problem/43342639>
142
143         Reviewed by Simon Fraser.
144
145         Test: webanimations/accelerated-transition-interrupted-on-composited-element.html
146
147         If we interrupt an animation on an element that is composited also outside of the duration of the animation,
148         the "stop" accelerated action would fail to be performed because we no longer had a resolved current time and
149         the accelerated animation applied to the layer would never be removed.
150
151         However, having a resolved current time is not necessary to stop an animation, only for the other types of
152         actions (play, pause and seek). So we now simply default to a 0s time for an unresolved current time for a
153         simple fix to this issue.
154
155         * animation/KeyframeEffectReadOnly.cpp:
156         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
157
158 2018-09-09  Fujii Hironori  <Hironori.Fujii@sony.com>
159
160         Add specialized template declarations of HashTraits and DefaultHash to detect misuse
161         https://bugs.webkit.org/show_bug.cgi?id=189044
162
163         Reviewed by Yusuke Suzuki.
164
165         Some classes have a separate header for specializations of
166         WTF::HashTraits and WTF::DefaultHash to reduce the number of
167         header files included. For example, ColorHash.h and Color.h.
168
169         If someone is mistakenly using HashSet or HashMap without
170         including the specialization header, unexpected template
171         instantiation can cause subtle bugs. For example, MSVC linker
172         would silently produce an broken executable (Bug 188893).
173
174         By applying this change, I found three misuse cases in
175         DebugPageOverlays.cpp, AVVideoCaptureSource.h and WebPage.h. As
176         far as I analyzed, I concluded that these misuses don't introduce
177         any bugs at the moment, and they are not testable (Bug 189044 Comment 9),
178         except the MSVC issue (Bug 188893).
179
180         No new tests (Covered by existing tests).
181
182         * Modules/webdatabase/SQLResultSetRowList.h: Removed unused #include <wtf/HashTraits.h>.
183         * bindings/js/SerializedScriptValue.cpp: Ditto.
184         * page/DebugPageOverlays.cpp: Added #include "ColorHash.h" to instantiate HashMap<String, Color>.
185         * platform/URLHash.h: Added DefaultHash<URL> specialization definition.
186         * platform/URL.h: Added specialized template declarations.
187         * platform/graphics/Color.h: Ditto.
188         * platform/graphics/FloatSize.h: Ditto.
189         * platform/graphics/IntPoint.h: Ditto.
190         * platform/graphics/IntSize.h: Ditto.
191         * platform/network/ProtectionSpace.h: Ditto.
192         * platform/network/ProtectionSpaceHash.h: Removed unnecessary DefaultHash declaration.
193         * platform/mediastream/mac/AVVideoCaptureSource.h:
194         Added #include "IntSizeHash.h" to instantiate HashMap<String, IntSize>.
195
196 2018-09-09  Fujii Hironori  <Hironori.Fujii@sony.com>
197
198         [Win][Clang] Add FloatRect(const RECT&) constructor
199         https://bugs.webkit.org/show_bug.cgi?id=189398
200
201         Reviewed by Alex Christensen.
202
203         While trying to build WebKit WinCairo port with the latest Clang
204         (Bug 171618), the following compilation errors were reported.
205
206           error: no viable conversion from returned value of type 'RECT' (aka 'tagRECT') to function return type 'WebCore::FloatRect'
207
208         No new tests (No behavior change).
209
210         * platform/graphics/FloatRect.h:
211         * platform/graphics/win/FloatRectDirect2D.cpp:
212         (WebCore::FloatRect::FloatRect): Added a new constructor taking a RECT as the argument.
213
214 2018-09-08  Andy Estes  <aestes@apple.com>
215
216         [Apple Pay] Dispatch a paymentmethodchange event when the payment method changes
217         https://bugs.webkit.org/show_bug.cgi?id=189386
218
219         Reviewed by Darin Adler.
220
221         Implemented the "payment method changed" algorithm as defined in the Payment Request API W3C
222         Editor's Draft of 05 September 2018.
223
224         Payment Request says that the user agent MAY run this algorithm when the payment method
225         changes. In our case, we only wish to dispatch this event when a listener is registered for
226         it. Since PassKit requires merchants to respond to this event by calling updateWith() within
227         30 seconds, firing the event unconditionally would break compatibility with existing
228         clients.
229
230         For merchants that do not listen for this event, they can continue to use modifiers to
231         update details based on the selected payment method type.
232         
233         Also made PaymentMethodChangeEvent.methodDetails a cached attribute in a way that avoids
234         potential reference cycles from holding a JSC::Strong in the wrapped object.
235
236         Test: http/tests/ssl/applepay/ApplePayPaymentMethodChangeEvent.https.html
237
238         * CMakeLists.txt:
239         * DerivedSources.make:
240         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
241         (WebCore::toJSDictionary):
242         (WebCore::ApplePayPaymentHandler::didAuthorizePayment):
243         (WebCore::ApplePayPaymentHandler::didSelectPaymentMethod):
244         * Modules/paymentrequest/PaymentMethodChangeEvent.cpp:
245         (WebCore::PaymentMethodChangeEvent::PaymentMethodChangeEvent):
246         * Modules/paymentrequest/PaymentMethodChangeEvent.h:
247         * Modules/paymentrequest/PaymentMethodChangeEvent.idl:
248         * Modules/paymentrequest/PaymentMethodChangeEventInit.idl: Removed.
249         * Modules/paymentrequest/PaymentRequest.cpp:
250         (WebCore::PaymentRequest::paymentMethodChanged):
251         * Modules/paymentrequest/PaymentRequest.h:
252         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp:
253         (WebCore::PaymentRequestUpdateEvent::updateWith):
254         * Sources.txt:
255         * WebCore.xcodeproj/project.pbxproj:
256         * bindings/js/JSPaymentMethodChangeEventCustom.cpp: Added.
257         (WebCore::JSPaymentMethodChangeEvent::methodDetails const):
258         (WebCore::JSPaymentMethodChangeEvent::visitAdditionalChildren):
259
260 2018-09-08  Simon Fraser  <simon.fraser@apple.com>
261
262         Clean up code related to Document node removal
263         https://bugs.webkit.org/show_bug.cgi?id=189452
264
265         Reviewed by Wenson Hsieh.
266
267         Replace the "amongChildrenOnly" boolean argument with an enum for clarity.
268         
269         Rename the remove*OfSubtree functions, because that naming is very unclear.
270         Instead, use adjust*OnNodeRemoval which better describes what the code does.
271
272         * dom/Document.cpp:
273         (WebCore::isNodeInSubtree):
274         (WebCore::Document::adjustFocusedNodeOnNodeRemoval):
275         (WebCore::Document::nodeChildrenWillBeRemoved):
276         (WebCore::Document::nodeWillBeRemoved):
277         (WebCore::Document::adjustFocusNavigationNodeOnNodeRemoval):
278         (WebCore::Document::adjustFullScreenElementOnNodeRemoval):
279         (WebCore::Document::removeFocusedNodeOfSubtree): Deleted.
280         (WebCore::Document::removeFocusNavigationNodeOfSubtree): Deleted.
281         (WebCore::Document::removeFullScreenElementOfSubtree): Deleted.
282         * dom/Document.h:
283         * dom/Element.cpp:
284         (WebCore::Element::removeShadowRoot):
285         * loader/FrameLoader.cpp:
286         (WebCore::FrameLoader::clear):
287
288 2018-09-08  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
289
290         [CSSJIT] Use lshiftPtr instead of mul32
291         https://bugs.webkit.org/show_bug.cgi?id=189451
292
293         Reviewed by Sam Weinig.
294
295         Use `value << 4` instead of `value * 16`. In 64bit environment, sizeof(Style::Relation) is 16,
296         so that we can use `value << 4` in CSS JIT.
297
298         No behavior change.
299
300         * cssjit/SelectorCompiler.cpp:
301         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateAddStyleRelation):
302
303 2018-09-07  Fujii Hironori  <Hironori.Fujii@sony.com>
304
305         [Win][Clang] exceptionShouldTerminateProgram of StructuredExceptionHandlerSuppressor.cpp should take DWORD
306         https://bugs.webkit.org/show_bug.cgi?id=189402
307
308         Reviewed by Alex Christensen.
309
310         Clang reports compilation errors like following:
311
312         > StructuredExceptionHandlerSuppressor.cpp(38,10):  error: case value evaluates to 2147483650, which cannot be narrowed to type 'int' [-Wc++11-narrowing]
313         >     case EXCEPTION_DATATYPE_MISALIGNMENT:
314         >          ^
315
316         No new tests (no behavioral change).
317
318         * platform/win/StructuredExceptionHandlerSuppressor.cpp:
319         (exceptionShouldTerminateProgram): Changed the type of argument from int to DWORD.
320
321 2018-09-07  Basuke Suzuki  <Basuke.Suzuki@sony.com>
322
323         [Curl] Stop sending request with credential if no authorization requested.
324         https://bugs.webkit.org/show_bug.cgi?id=189057
325
326         Reviewed by Alex Christensen.
327
328         When 401 response returns without 'www-authenticate' header, suppress another request with credential.
329
330         Test: http/tests/xmlhttprequest/unauthorized-without-authenticate-header.html
331
332         * platform/network/curl/CurlResourceHandleDelegate.cpp:
333         (WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse):
334
335 2018-09-07  Fujii Hironori  <Hironori.Fujii@sony.com>
336
337         [Win][Clang] duplicated variable name `advance` in UniscribeController::shapeAndPlaceItem
338         https://bugs.webkit.org/show_bug.cgi?id=189399
339
340         Reviewed by Myles C. Maxfield.
341
342         Clang reports the following compilation error:
343
344         UniscribeController.cpp(372,56):  error: invalid operands to binary expression ('float' and 'WebCore::GlyphBufferAdvance' (aka 'WebCore::FloatSize'))
345              GlyphBufferAdvance advance(-origin.width() + advance, -origin.height());
346                                         ~~~~~~~~~~~~~~~ ^ ~~~~~~~
347         No new tests (No behavior change).
348
349         * platform/graphics/win/UniscribeController.cpp:
350         (WebCore::UniscribeController::shapeAndPlaceItem): Replaced the second variable named `advance` with `glyphAdvance`.
351
352 2018-09-07  Youenn Fablet  <youenn@apple.com>
353
354         RTCRtpReceiver::track should return a MediaStreamTrack reference
355         https://bugs.webkit.org/show_bug.cgi?id=189420
356
357         Reviewed by Eric Carlson.
358
359         As per spec, a receiver always has a track.
360         Remove unneeded RTCRtpSenderReceiverBase and make RTCRtpReceiver have a Ref<MediaStreamTrack>.
361         RTCRtpSender keeps having a RefPtr<MediaStreamTrack>.
362         Update call sites accordingly. 
363         No change of behavior.
364
365         * Modules/mediastream/RTCRtpReceiver.cpp:
366         (WebCore::RTCRtpReceiver::RTCRtpReceiver):
367         (WebCore::RTCRtpReceiver::stop):
368         * Modules/mediastream/RTCRtpReceiver.h:
369         (WebCore::RTCRtpReceiver::track):
370         * Modules/mediastream/RTCRtpReceiver.idl:
371         * Modules/mediastream/RTCRtpSender.cpp:
372         (WebCore::RTCRtpSender::RTCRtpSender):
373         * Modules/mediastream/RTCRtpSender.h:
374         (WebCore::RTCRtpSender::track):
375         * Modules/mediastream/RTCRtpSender.idl:
376         * Modules/mediastream/RTCRtpSenderReceiverBase.h: Removed.
377         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
378         (WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
379         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
380         (WebCore::LibWebRTCPeerConnectionBackend::videoReceiver):
381         (WebCore::LibWebRTCPeerConnectionBackend::audioReceiver):
382         * WebCore.xcodeproj/project.pbxproj:
383
384 2018-09-07  Daniel Bates  <dabates@apple.com>
385
386         Cleanup: Remove extraneous "using namespace" and scope WebCore::LogThreading
387         https://bugs.webkit.org/show_bug.cgi?id=189381
388
389         Reviewed by Simon Fraser.
390
391         * platform/ios/wak/WKGraphics.mm:
392         * platform/ios/wak/WebCoreThread.mm:
393         (WebThreadEnable):
394
395 2018-09-07  Wenson Hsieh  <wenson_hsieh@apple.com>
396
397         Clean up FontAttributeChanges.cpp after r235748
398         https://bugs.webkit.org/show_bug.cgi?id=189394
399
400         Reviewed by Tim Horton.
401
402         * Sources.txt: Move FontAttributeChanges.cpp into unified sources.
403         * WebCore.xcodeproj/project.pbxproj:
404         * editing/FontAttributeChanges.cpp: Replace `#import`s with `#include`s.
405
406 2018-09-07  Basuke Suzuki  <Basuke.Suzuki@sony.com>
407
408         [Curl][WebKitLegacy] Stop sending credential embedded in the url via XHR.
409         https://bugs.webkit.org/show_bug.cgi?id=189198
410
411         Reviewed by Alexey Proskuryakov.
412
413         Because sync XHR of Curl port uses passed request directly, the credential information in
414         url is not removed. Use ResourceHandleInternal's firstRequest because those are
415         already takne out.
416
417         Test: http/tests/xmlhttprequest/url-with-credentials.html
418
419         * platform/network/curl/ResourceHandleCurl.cpp:
420         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
421
422 2018-09-07  Youenn Fablet  <youenn@apple.com>
423
424         RealtimeOutgoingVideoSourceCocoa should use VTImageRotationSession to rotate CVPixelBuffers
425         https://bugs.webkit.org/show_bug.cgi?id=189427
426
427         Reviewed by Eric Carlson.
428
429         Previously, we were relying on libwebrtc utils to do the rotation.
430         This is inefficient compared to VTImageRotateSession and also induces additional memory cost
431         since libwebrtc is rotating using its own buffers and the encoder will convert this buffer back to a CVPixelBuffer.
432
433         Instead use VTImageRotationSession when rotation must be done at sending side.
434         Covered by webrtc/video-rotation.html.
435
436         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
437         (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated):
438         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h:
439         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm:
440         (WebCore::computeRotatedWidthAndHeight):
441         (WebCore::RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer):
442
443 2018-09-07  Youenn Fablet  <youenn@apple.com>
444
445         Add support for unified plan transceivers
446         https://bugs.webkit.org/show_bug.cgi?id=189390
447
448         Reviewed by Eric Carlson.
449
450         Keep previous transceiver behavior when unified plan flag is off.
451         Otherwise, use the libwebrtc transceiver API to create and use unified plan transceivers.
452         Fuel the implementation of transceivers through a dedicated backend.
453
454         Update transceiver IDL and make some smaller fixes at the same time:
455         - Make sure remote sources have a proper name as per https://w3c.github.io/webrtc-pc/#dfn-create-an-rtcrtpreceiver.
456         - Add support for transceiver.currentDirection.
457
458         Our mock peer connections are only supporting plan B APIs at the moment.
459         We therefore mandate plan B when using such mocks until we can upgrade mocks to support unified plan APIs.
460
461         Covered by modified and rebased tests.
462
463         * Modules/mediastream/PeerConnectionBackend.cpp:
464         (WebCore::PeerConnectionBackend::addTrack):
465         * Modules/mediastream/PeerConnectionBackend.h:
466         * Modules/mediastream/RTCPeerConnection.cpp:
467         (WebCore::RTCPeerConnection::addTrack):
468         (WebCore::RTCPeerConnection::addTransceiver):
469         * Modules/mediastream/RTCRtpSender.cpp:
470         (WebCore::RTCRtpSender::RTCRtpSender):
471         * Modules/mediastream/RTCRtpTransceiver.cpp:
472         (WebCore::RTCRtpTransceiver::mid const):
473         (WebCore::RTCRtpTransceiver::currentDirection const):
474         * Modules/mediastream/RTCRtpTransceiver.h:
475         (WebCore::RTCRtpTransceiver::backend):
476         * Modules/mediastream/RTCRtpTransceiver.idl:
477         * Modules/mediastream/RTCRtpTransceiverBackend.h:
478         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
479         (WebCore::LibWebRTCMediaEndpoint::addTrack):
480         (WebCore::LibWebRTCMediaEndpoint::newTransceiver):
481         (WebCore::LibWebRTCMediaEndpoint::addTransceiver):
482         (WebCore::LibWebRTCMediaEndpoint::transceiverBackendFromSender):
483         (WebCore::LibWebRTCMediaEndpoint::OnAddTrack):
484         (WebCore::LibWebRTCMediaEndpoint::OnTrack):
485         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
486         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
487         (WebCore::createReceiverForSource):
488         (WebCore::LibWebRTCPeerConnectionBackend::createReceiver):
489         (WebCore::LibWebRTCPeerConnectionBackend::videoReceiver):
490         (WebCore::LibWebRTCPeerConnectionBackend::audioReceiver):
491         (WebCore::LibWebRTCPeerConnectionBackend::addTrack):
492         (WebCore::LibWebRTCPeerConnectionBackend::addTransceiver):
493         (WebCore::backendFromRTPTransceiver):
494         (WebCore::LibWebRTCPeerConnectionBackend::existingTransceiver):
495         (WebCore::LibWebRTCPeerConnectionBackend::newTransceiver):
496         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
497         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
498         (WebCore::LibWebRTCRtpSenderBackend::replaceTrack):
499         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
500         * Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.cpp: Added.
501         (WebCore::LibWebRTCRtpTransceiverBackend::createReceiverBackend):
502         (WebCore::LibWebRTCRtpTransceiverBackend::createSenderBackend):
503         (WebCore::LibWebRTCRtpTransceiverBackend::direction const):
504         (WebCore::LibWebRTCRtpTransceiverBackend::currentDirection const):
505         (WebCore::LibWebRTCRtpTransceiverBackend::setDirection):
506         (WebCore::LibWebRTCRtpTransceiverBackend::mid):
507         (WebCore::LibWebRTCRtpTransceiverBackend::stop):
508         * Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h: Added.
509         * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
510         (WebCore::toRTCRtpTransceiverDirection):
511         (WebCore::fromRTCRtpTransceiverDirection):
512         (WebCore::fromRtpTransceiverInit):
513         * Modules/mediastream/libwebrtc/LibWebRTCUtils.h:
514         * WebCore.xcodeproj/project.pbxproj:
515         * platform/mediastream/RealtimeIncomingAudioSource.cpp:
516         (WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource):
517         * platform/mediastream/RealtimeIncomingVideoSource.cpp:
518         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
519         * platform/mediastream/RealtimeMediaSource.h:
520         * testing/Internals.cpp:
521         (WebCore::Internals::useMockRTCPeerConnectionFactory):
522
523 2018-09-07  Rob Buis  <rbuis@igalia.com>
524
525         XMLHttpRequest: open() does not throw a SYNTAX_ERR exception if method is empty or url cannot be resolved
526         https://bugs.webkit.org/show_bug.cgi?id=46008
527
528         Reviewed by Chris Dumez.
529
530         Check if passed URL is valid as specified here [1].
531
532         Test: web-platform-tests/xhr/open-url-bogus.htm
533
534         [1] https://xhr.spec.whatwg.org/#the-open()-method Step 7
535
536         * xml/XMLHttpRequest.cpp:
537         (WebCore::XMLHttpRequest::open):
538
539 2018-09-07  Frederic Wang  <fwang@igalia.com>
540
541         [CSSOM View] Handle the scrollingElement in Element::scroll(Left/Top/Width/Height/To)
542         https://bugs.webkit.org/show_bug.cgi?id=182230
543
544         Reviewed by Simon Fraser.
545
546         This commit moves the special logic for "scrolling element" body from the
547         HtmlBodyElement::scroll(Left/Top/Width/Height/To) functions to the Element class. The code
548         is executed when the element is the scrolling element which includes the case of body
549         in Quirks mode and of documentElement in standard mode. This makes the behavior closer to
550         the CSSOM View spec (bug 5991) while not deviating too much from the current implementation.
551         Finally, CSSOMViewScrollingAPI is now enabled for running tests and some adjustments are made
552         to existing tests. Further improvements will be performed in dependencies of bug 5991.
553
554         No new tests, already covered by existing tests.
555
556         * dom/Document.cpp: Split scrollingElement into two functions so that one can be called
557         internally without updating the layout.
558         (WebCore::Document::scrollingElement):
559         (WebCore::Document::scrollingElementForAPI):
560         * dom/Document.h: Ditto.
561         * dom/Document.idl: Use the version updating the layout for API calls.
562         * dom/Element.cpp: Add include to call DOMWindow::ScrollTo
563         (WebCore::Element::scrollTo): Moved some logic from HtmlBodyElement to handle the case of
564         the scrolling element. Also skip special handling of documentElement() when
565         CSSOMViewScrollingAPI is disabled.
566         (WebCore::adjustContentsScrollPositionOrSizeForZoom): Moved some logic from HtmlBodyElement
567         to handle the case of the scrolling element. Also add a FIXME for improving these kinds of
568         helper functions. Renamed to make more explicit the semantic of the value argument.
569         (WebCore::Element::scrollLeft): Moved some logic from HtmlBodyElement to handle the case of
570         the scrolling element. Use the new documentFrameWithNonNullView() helper function.
571         (WebCore::Element::scrollTop): Ditto.
572         (WebCore::Element::setScrollLeft): Ditto
573         (WebCore::Element::setScrollTop): Ditto.
574         (WebCore::Element::scrollWidth): Ditto.
575         (WebCore::Element::scrollHeight): Ditto.
576         * dom/Element.h:
577         (WebCore::Document::documentFrameWithNonNullView): New helper function to retrieve the
578         frame and ensure a view is available.
579         * html/HTMLBodyElement.cpp: Remove code that is now in Element.
580         * html/HTMLBodyElement.h: Ditto.
581
582 2018-09-07  Don Olmstead  <don.olmstead@sony.com>
583
584         [AX] Fix compile error in AXObjectCache constructor when !HAVE(ACCESSIBILITY)
585         https://bugs.webkit.org/show_bug.cgi?id=189423
586         <rdar://problem/44231775>
587
588         Reviewed by Yusuke Suzuki.
589
590         No new tests. Compilation fix.
591
592         * accessibility/AXObjectCache.h:
593         (WebCore::AXObjectCache::AXObjectCache):
594
595 2018-09-07  Zalan Bujtas  <zalan@apple.com>
596
597         [LFC] Replace "computed" value with "used" value to match spec language
598         https://bugs.webkit.org/show_bug.cgi?id=189414
599
600         Reviewed by Antti Koivisto.
601
602         * layout/FormattingContext.cpp:
603         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
604         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
605         * layout/FormattingContext.h:
606         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
607         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
608         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
609         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
610         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
611         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
612         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
613         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
614         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
615         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
616         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
617         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
618         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
619         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
620         * layout/FormattingContextGeometry.cpp:
621         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
622         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
623         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
624         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
625         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
626         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
627         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
628         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
629         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
630         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
631         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
632         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
633         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
634         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
635         * layout/blockformatting/BlockFormattingContext.cpp:
636         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
637         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
638         * layout/blockformatting/BlockFormattingContext.h:
639         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
640         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
641         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
642         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
643         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
644         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
645         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
646         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
647         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
648         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
649         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
650
651 2018-09-06  Ryosuke Niwa  <rniwa@webkit.org>
652
653         ShadowRoot should have its own node flag
654         https://bugs.webkit.org/show_bug.cgi?id=189392
655
656         Reviewed by Antti Koivisto.
657
658         Added IsShadowRootFlag and IsDocumentNodeFlag, and removed IsDocumentFragmentFlag and IsStyledElementFlag.
659         Also re-ordered flags to group flags used by subclasses below ones directly used by Node in
660         accordinate with the comment.
661
662         No new tests since there should be no behavioral change.
663
664         * dom/ContainerNode.h:
665         (WebCore::Node::isTreeScope const): Deleted.
666         * dom/Node.h:
667         (WebCore::Node::isStyledElement const): Check if this is a HTML, SVG, or MathML element instead.
668         (WebCore::Node::isDocumentNode const): Simply check IsDocumentNodeFlag.
669         (WebCore::Node::isTreeScope const): Check if this is a document or a shadow root Instead of comparing
670         the tree scope to this.
671         (WebCore::Node::isDocumentFragment const): Check if this is a container node which is neither document,
672         element, nor shadow root.
673         (WebCore::Node::isShadowRoot const): Simply check IsShadowRootFlag. This is the change needed to fix
674         the blockign bug 166748.
675         (WebCore::Node::flagIsShadowRoot): Added. Will be used in the bug 166748.
676
677 2018-09-06  Zalan Bujtas  <zalan@apple.com>
678
679         [LFC] Inline replaced height calculation should use "used value"
680         https://bugs.webkit.org/show_bug.cgi?id=189395
681
682         Reviewed by Antti Koivisto.
683
684         Use the already assigned width value (aka used value) instead of the computed value when computing the inline's height.
685         see https://www.w3.org/TR/CSS22/cascade.html#value-stages for "used" and "computed" value.
686
687         * layout/FormattingContextGeometry.cpp:
688         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
689
690 2018-09-06  Wenson Hsieh  <wenson_hsieh@apple.com>
691
692         Refactor WebCore::EditAction to be an 8-bit enum class
693         https://bugs.webkit.org/show_bug.cgi?id=189383
694
695         Reviewed by Dan Bernstein.
696
697         Currently, EditAction.h defines an EditAction as an enum. This patch changes EditAction to instead be an 8-bit-
698         wide enum class, and renames all EditAction values from EditAction(*) to EditAction::(*).
699
700         No change in behavior.
701
702         * editing/ApplyStyleCommand.h:
703         (WebCore::ApplyStyleCommand::create):
704         * editing/CompositeEditCommand.cpp:
705         (WebCore::CompositeEditCommand::apply):
706         (WebCore::deleteSelectionEditingActionForEditingAction):
707         * editing/CompositeEditCommand.h:
708         (WebCore::EditCommandComposition::wasCreateLinkCommand const):
709         * editing/CreateLinkCommand.h:
710         * editing/DeleteFromTextNodeCommand.h:
711         (WebCore::DeleteFromTextNodeCommand::create):
712         * editing/DeleteSelectionCommand.h:
713         (WebCore::DeleteSelectionCommand::create):
714         * editing/DictationCommand.cpp:
715         (WebCore::DictationCommand::insertTextRunWithoutNewlines):
716         (WebCore::DictationCommand::insertParagraphSeparator):
717         * editing/EditAction.h:
718         (): Deleted.
719         * editing/EditCommand.cpp:
720         (WebCore::inputTypeNameForEditingAction):
721         * editing/EditCommand.h:
722         * editing/Editor.cpp:
723         (WebCore::inputEventDataForEditingStyleAndAction):
724         (WebCore::ClearTextCommand::editingAction const):
725         (WebCore::Editor::handleTextEvent):
726         (WebCore::Editor::replaceSelectionWithFragment):
727         (WebCore::Editor::performCutOrCopy):
728         (WebCore::Editor::setBaseWritingDirection):
729         (WebCore::Editor::markMisspellingsAfterTypingToWord):
730         (WebCore::Editor::changeBackToReplacedString):
731         (WebCore::Editor::transpose):
732         * editing/Editor.h:
733         * editing/EditorCommand.cpp:
734         (WebCore::applyCommandToFrame):
735         (WebCore::executeInsertFragment):
736         (WebCore::executeBackColor):
737         (WebCore::executeFontName):
738         (WebCore::executeFontSize):
739         (WebCore::executeFontSizeDelta):
740         (WebCore::executeForeColor):
741         (WebCore::executeJustifyCenter):
742         (WebCore::executeJustifyFull):
743         (WebCore::executeJustifyLeft):
744         (WebCore::executeJustifyRight):
745         (WebCore::executeMakeTextWritingDirectionLeftToRight):
746         (WebCore::executeMakeTextWritingDirectionNatural):
747         (WebCore::executeMakeTextWritingDirectionRightToLeft):
748         (WebCore::executeStrikethrough):
749         (WebCore::executeSubscript):
750         (WebCore::executeSuperscript):
751         (WebCore::executeToggleBold):
752         (WebCore::executeToggleItalic):
753         (WebCore::executeUnderline):
754         (WebCore::executeUnscript):
755         * editing/FormatBlockCommand.h:
756         * editing/IndentOutdentCommand.h:
757         * editing/InsertIntoTextNodeCommand.h:
758         (WebCore::InsertIntoTextNodeCommand::create):
759         * editing/InsertListCommand.cpp:
760         (WebCore::InsertListCommand::editingAction const):
761         * editing/InsertNodeBeforeCommand.h:
762         (WebCore::InsertNodeBeforeCommand::create):
763         * editing/InsertParagraphSeparatorCommand.h:
764         (WebCore::InsertParagraphSeparatorCommand::create):
765         * editing/InsertTextCommand.h:
766         (WebCore::InsertTextCommand::create):
767         (WebCore::InsertTextCommand::createWithMarkerSupplier):
768         * editing/MoveSelectionCommand.cpp:
769         (WebCore::MoveSelectionCommand::doApply):
770         (WebCore::MoveSelectionCommand::editingAction const):
771         * editing/RemoveFormatCommand.h:
772         * editing/RemoveNodeCommand.h:
773         (WebCore::RemoveNodeCommand::create):
774         * editing/ReplaceRangeWithTextCommand.cpp:
775         (WebCore::ReplaceRangeWithTextCommand::ReplaceRangeWithTextCommand):
776         (WebCore::ReplaceRangeWithTextCommand::doApply):
777         * editing/ReplaceSelectionCommand.cpp:
778         (WebCore::ReplaceSelectionCommand::completeHTMLReplacement):
779         (WebCore::ReplaceSelectionCommand::performTrivialReplace):
780         * editing/ReplaceSelectionCommand.h:
781         (WebCore::ReplaceSelectionCommand::create):
782         * editing/SpellingCorrectionCommand.cpp:
783         (WebCore::SpellingCorrectionCommand::SpellingCorrectionCommand):
784         (WebCore::SpellingCorrectionCommand::doApply):
785         * editing/TextInsertionBaseCommand.h:
786         * editing/TypingCommand.cpp:
787         (WebCore::editActionForTypingCommand):
788         (WebCore::editActionIsDeleteByTyping):
789         (WebCore::TypingCommand::isBeforeInputEventCancelable const):
790         (WebCore::TypingCommand::inputEventData const):
791         (WebCore::TypingCommand::inputEventDataTransfer const):
792         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
793         (WebCore::TypingCommand::insertParagraphSeparator):
794         * editing/UnlinkCommand.h:
795         * editing/ios/DictationCommandIOS.cpp:
796         (WebCore::DictationCommandIOS::DictationCommandIOS):
797         * editing/ios/EditorIOS.mm:
798         (WebCore::Editor::removeUnchangeableStyles):
799         * page/DragController.cpp:
800         (WebCore::DragController::concludeEditDrag):
801
802 2018-09-06  Simon Fraser  <simon.fraser@apple.com>
803
804         Fix the build for non-Cocoa platforms after r235772.
805
806         * platform/graphics/cairo/GradientCairo.cpp:
807         (WebCore::Gradient::createPlatformGradient):
808         * platform/graphics/win/GradientDirect2D.cpp:
809         (WebCore::Gradient::generateGradient):
810         (WebCore::Gradient::fill):
811
812 2018-09-06  Zalan Bujtas  <zalan@apple.com>
813
814         [LFC] Add support for min/max-height percentage values.
815         https://bugs.webkit.org/show_bug.cgi?id=189391
816
817         Reviewed by Antti Koivisto.
818
819         The percentage is calculated with respect to the height of the generated box's containing block.
820         If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element
821         is not absolutely positioned, the percentage value is treated as '0' (for 'min-height') or 'none' (for 'max-height').
822
823         Test: fast/block/block-only/min-max-height-percentage.html
824
825         * layout/FormattingContext.cpp:
826         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
827         * layout/FormattingContext.h:
828         * layout/FormattingContextGeometry.cpp:
829         (WebCore::Layout::FormattingContext::Geometry::computedValueIfNotAuto):
830         (WebCore::Layout::FormattingContext::Geometry::computedMaxHeight):
831         (WebCore::Layout::FormattingContext::Geometry::computedMinHeight):
832         * layout/blockformatting/BlockFormattingContext.cpp:
833         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
834
835 2018-09-06  Megan Gardner  <megan_gardner@apple.com>
836
837         Add Support for Conic Gradients
838         https://bugs.webkit.org/show_bug.cgi?id=189329
839         <rdar://problem/21444701>
840
841         Reviewed by Simon Fraser.
842
843         Add support for rendering CSS conic gradients.
844         The parsing work was already done, this just hooks up the data we have
845         with the CG functionality for conic gradients. Add the needed plumbing
846         to allow for this additional type and fill in the creation of 
847         a conic gradient.
848
849         Tests: fast/gradients/conic-repeating.html
850                fast/gradients/conic.html
851
852         * css/CSSGradientValue.cpp:
853         (WebCore::createGradient):
854         (WebCore::LinearGradientAdapter::gradientLength const):
855         (WebCore::RadialGradientAdapter::gradientLength const):
856         (WebCore::ConicGradientAdapter::ConicGradientAdapter):
857         (WebCore::ConicGradientAdapter::gradientLength const):
858         (WebCore::ConicGradientAdapter::maxExtent const):
859         (WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange):
860
861         Compute what the color stops should be if they extend past 0-1
862
863         (WebCore::CSSGradientValue::computeStops):
864         (WebCore::CSSConicGradientValue::createGradient):
865         (WebCore::LinearGradientAdapter::startPoint const): Deleted.
866         (WebCore::LinearGradientAdapter::endPoint const): Deleted.
867         (WebCore::RadialGradientAdapter::startPoint const): Deleted.
868         (WebCore::RadialGradientAdapter::endPoint const): Deleted.
869
870         Start and End points weren't very universal. All we really need from these
871         gradientAdapters is their length, so just ask for that instead.
872
873         * inspector/InspectorCanvas.cpp:
874         (WebCore::InspectorCanvas::buildArrayForCanvasGradient):
875         * platform/graphics/Gradient.cpp:
876         (WebCore::Gradient::create):
877         (WebCore::Gradient::Gradient):
878         (WebCore::Gradient::type const):
879         (WebCore::Gradient::adjustParametersForTiledDrawing):
880         (WebCore::Gradient::isZeroSize const):
881         (WebCore::Gradient::hash const):
882         * platform/graphics/Gradient.h:
883         * platform/graphics/cg/GradientCG.cpp:
884         (WebCore::Gradient::paint):
885
886 2018-09-06  Wenson Hsieh  <wenson_hsieh@apple.com>
887
888         [macOS] [WK2] Support changing attributes for selected text (text shadow, underline, strike-through)
889         https://bugs.webkit.org/show_bug.cgi?id=189356
890         <rdar://problem/44185674>
891
892         Reviewed by Tim Horton.
893
894         Add support for encoding and decoding FontAttributeChanges, so that we can send FontAttributeChanges over IPC in
895         WebKit2. Also change m_verticalAlign to a new VerticalAlignChange enum type, so that it's no longer tied to the
896         CSS property values of "vertical-align", and can be encoded/decoded separately from VerticalAlign in
897         RenderStyleConstants.
898
899         Test: FontManagerTests.ChangeAttributesWithFontEffectsBox
900
901         * editing/FontAttributeChanges.cpp:
902         (WebCore::FontAttributeChanges::createEditingStyle const):
903         * editing/FontAttributeChanges.h:
904         (WebCore::FontAttributeChanges::setVerticalAlign):
905         (WebCore::FontShadow::encode const):
906         (WebCore::FontShadow::decode):
907         (WebCore::FontAttributeChanges::encode const):
908         (WebCore::FontAttributeChanges::decode):
909         * platform/mac/WebCoreNSFontManagerExtras.mm:
910         (WebCore::computedFontAttributeChanges):
911
912 2018-09-06  Zalan Bujtas  <zalan@apple.com>
913
914         [LFC][BFC] Add support for min(max)-height
915         https://bugs.webkit.org/show_bug.cgi?id=189377
916
917         Reviewed by Antti Koivisto.
918
919         See https://www.w3.org/TR/CSS22/visudet.html#min-max-heights for details.
920
921         Tests: fast/block/block-only/absolute-position-min-max-height.html
922                fast/block/block-only/float-min-max-height.html
923                fast/block/block-only/inflow-min-max-height.html
924
925         * layout/FormattingContext.cpp:
926         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
927         * layout/FormattingContext.h:
928         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
929         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
930         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
931         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
932         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
933         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
934         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
935         * layout/FormattingContextGeometry.cpp:
936         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
937         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
938         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
939         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
940         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
941         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
942         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
943         * layout/blockformatting/BlockFormattingContext.cpp:
944         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
945         * layout/blockformatting/BlockFormattingContext.h:
946         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
947         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
948         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
949         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
950         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
951
952 2018-09-06  Eric Carlson  <eric.carlson@apple.com>
953
954         [MediaStream] Include supported frame rates in video capture presets
955         https://bugs.webkit.org/show_bug.cgi?id=189351
956         <rdar://problem/44188917>
957
958         Reviewed by Youenn Fablet.
959
960         No new tests, no functionality changed.
961
962         Include frame rates as well as width/height in video capture presets, so the mock video
963         capture devices model real camera devices more closely.
964
965         * platform/mediastream/RealtimeMediaSource.cpp:
966         (WebCore::RealtimeMediaSource::setSizeAndFrameRate): Renamed from applySizeAndFrameRate. Use
967         setSize instead of setWidth and setHeight.
968         (WebCore::RealtimeMediaSource::applyConstraints): applySizeAndFrameRate -> setSizeAndFrameRate.
969         (WebCore::RealtimeMediaSource::applySizeAndFrameRate): Deleted.
970         (WebCore::RealtimeMediaSource::setWidth): Deleted.
971         (WebCore::RealtimeMediaSource::setHeight): Deleted.
972         * platform/mediastream/RealtimeMediaSource.h:
973
974         * platform/mediastream/RealtimeVideoSource.cpp:
975         (WebCore::RealtimeVideoSource::setSupportedPresets): New.
976         (WebCore::updateMinMax):
977         (WebCore::RealtimeVideoSource::addSupportedCapabilities const): Calculate capabilities from
978         presets.
979         (WebCore::RealtimeVideoSource::supportsSizeAndFrameRate): Use bestSupportedSizeAndFrameRate.
980         (WebCore::RealtimeVideoSource::bestSupportedSizeAndFrameRate): 
981         (WebCore::RealtimeVideoSource::setSizeAndFrameRate):
982         (WebCore::RealtimeVideoSource::setSupportedFrameRates): Deleted.
983         (WebCore::RealtimeVideoSource::bestSupportedCaptureSizeForWidthAndHeight): Deleted.
984         (WebCore::RealtimeVideoSource::applySizeAndFrameRate): Deleted.
985         (WebCore::RealtimeVideoSource::supportsFrameRate): Deleted.
986         * platform/mediastream/RealtimeVideoSource.h:
987         (WebCore::RealtimeVideoSource::setSupportedCaptureSizes): Deleted.
988         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
989         (WebCore::GStreamerVideoCaptureSource::stopProducingData):
990         * platform/mediastream/mac/AVVideoCaptureSource.h:
991         * platform/mediastream/mac/AVVideoCaptureSource.mm:
992         (WebCore::AVVideoCaptureSource::setSizeAndFrameRate):
993         (WebCore::AVVideoCaptureSource::applySizeAndFrameRate): Deleted.
994         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
995         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
996         * platform/mock/MockMediaDevice.h:
997         (WebCore::MockCameraProperties::encode const):
998         (WebCore::MockCameraProperties::decode):
999         (WebCore::MockDisplayProperties::encode const):
1000         (WebCore::MockDisplayProperties::decode):
1001         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1002         (WebCore::defaultDevices):
1003         * platform/mock/MockRealtimeVideoSource.cpp:
1004         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
1005         (WebCore::MockRealtimeVideoSource::capabilities const):
1006         (WebCore::MockRealtimeVideoSource::settings const):
1007
1008 2018-09-06  Antti Koivisto  <antti@apple.com>
1009
1010         Actively prewarm processes created for prewarm pool
1011         https://bugs.webkit.org/show_bug.cgi?id=189364
1012
1013         Reviewed by Chris Dumez.
1014
1015         Do some basic prewarming for newly created processes.
1016
1017         * Sources.txt:
1018         * WebCore.xcodeproj/project.pbxproj:
1019         * css/CSSDefaultStyleSheets.cpp:
1020         (WebCore::CSSDefaultStyleSheets::loadFullDefaultStyle):
1021         * css/CSSDefaultStyleSheets.h:
1022         * page/Frame.cpp:
1023         (WebCore::Frame::Frame):
1024         * page/ProcessWarming.cpp: Added.
1025         (WebCore::ProcessWarming::initializeNames):
1026
1027         Factor name initialization into a function.
1028
1029         (WebCore::ProcessWarming::prewarm):
1030
1031         Prewarm
1032         - names
1033         - settings (system fonts)
1034         - user agent stylesheet
1035         - JavaScript VM
1036         - telephone number detection
1037
1038         * page/ProcessWarming.h: Added.
1039
1040 2018-09-06  Youenn Fablet  <youenn@apple.com>
1041
1042         Move replaceTrack logic to RTCRtpSender backend
1043         https://bugs.webkit.org/show_bug.cgi?id=189359
1044
1045         Reviewed by Eric Carlson.
1046
1047         Move replaceTrack handling from LibWebRTCPeerConnectionBackend to LibWebRTCRtpSenderBackend.
1048         This will allow using SetTrack when fully implementing unified plan.
1049         No change of behavior.
1050
1051         * Modules/mediastream/RTCRtpSender.cpp:
1052         (WebCore::RTCRtpSender::replaceTrack):
1053         * Modules/mediastream/RTCRtpSender.h:
1054         * Modules/mediastream/RTCRtpSender.idl:
1055         * Modules/mediastream/RTCRtpSenderBackend.h:
1056         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1057         (WebCore::LibWebRTCPeerConnectionBackend::replaceTrack): Deleted.
1058         (WebCore::LibWebRTCPeerConnectionBackend::enqueueReplaceTrackTask): Deleted.
1059         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
1060         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
1061         (WebCore::updateTrackSource):
1062         (WebCore::LibWebRTCRtpSenderBackend::replaceTrack):
1063         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
1064
1065 2018-09-06  Andy Estes  <aestes@apple.com>
1066
1067         [Apple Pay] Rename the -apple-pay-button-type value "checkout" to "check-out"
1068         https://bugs.webkit.org/show_bug.cgi?id=189366
1069         <rdar://problem/44193218>
1070
1071         Reviewed by Sam Weinig.
1072
1073         The button title is "Check out with Apple Pay", so we should use the verb phrase "check out"
1074         rather than the noun "checkout" for naming this value.
1075
1076         Updated http/tests/ssl/applepay/ApplePayButtonV4.html.
1077
1078         * css/CSSPrimitiveValueMappings.h:
1079         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1080         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const):
1081         * css/CSSValueKeywords.in:
1082         * css/parser/CSSParserFastPaths.cpp:
1083         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
1084         * rendering/RenderThemeCocoa.mm:
1085         (WebCore::toPKPaymentButtonType):
1086         * rendering/style/RenderStyleConstants.h:
1087
1088 2018-09-06  Jer Noble  <jer.noble@apple.com>
1089
1090         Don't pause playback when locking screen if video is being displayed on second screen.
1091         https://bugs.webkit.org/show_bug.cgi?id=189321
1092
1093         Reviewed by Eric Carlson.
1094
1095         Expand the existing behavior when AirPlaying to an external device to playing to a local
1096         external screen. Don't pause when the screen locks, and don't stop buffering in that mode either.
1097
1098         Add a KVO-observer to the WebAVPlayerController's playingOnSecondScreen property, and pass
1099         that observed value on to the media element.
1100
1101         * html/HTMLMediaElement.cpp:
1102         (WebCore::HTMLMediaElement::setShouldPlayToPlaybackTarget):
1103         (WebCore::HTMLMediaElement::setPlayingOnSecondScreen):
1104         (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
1105         (WebCore::HTMLMediaElement::processingUserGestureForMedia const):
1106         (WebCore::HTMLMediaElement::mediaState const):
1107         (WebCore::HTMLMediaElement::purgeBufferedDataIfPossible):
1108         (WebCore::HTMLMediaElement::shouldOverrideBackgroundLoadingRestriction const):
1109         (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const): Deleted.
1110         (WebCore::HTMLMediaElement::canPlayToWirelessPlaybackTarget const): Deleted.
1111         (WebCore::HTMLMediaElement::isPlayingToWirelessPlaybackTarget const): Deleted.
1112         * html/HTMLMediaElement.h:
1113         (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const):
1114         (WebCore::HTMLMediaElement::isPlayingToExternalTarget const):
1115         * html/MediaElementSession.cpp:
1116         (WebCore::MediaElementSession::canPlayToWirelessPlaybackTarget const): Deleted.
1117         * html/MediaElementSession.h:
1118         * platform/audio/PlatformMediaSession.h:
1119         (WebCore::PlatformMediaSessionClient::setWirelessPlaybackTarget):
1120         (WebCore::PlatformMediaSessionClient::isPlayingOnSecondScreen const):
1121         (WebCore::PlatformMediaSession::canPlayToWirelessPlaybackTarget const): Deleted.
1122         (WebCore::PlatformMediaSessionClient::canPlayToWirelessPlaybackTarget const): Deleted.
1123         * platform/cocoa/PlaybackSessionModel.h:
1124         * platform/cocoa/PlaybackSessionModelMediaElement.h:
1125         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
1126         (WebCore::PlaybackSessionModelMediaElement::setPlayingOnSecondScreen):
1127         * platform/ios/WebAVPlayerController.mm:
1128         (-[WebAVPlayerController init]):
1129         (-[WebAVPlayerController dealloc]):
1130         (-[WebAVPlayerController observeValueForKeyPath:ofObject:change:context:]):
1131         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1132         (VideoFullscreenControllerContext::setPlayingOnSecondScreen):
1133
1134 2018-09-06  Frederic Wang  <fwang@igalia.com>
1135
1136         Group options of scrollRectToVisible into a struct
1137         https://bugs.webkit.org/show_bug.cgi?id=189352
1138
1139         Reviewed by Simon Fraser.
1140
1141         RenderLayer::scrollRectToVisible and RenderObject::scrollRectToVisible have several
1142         parameters to configure the type of scrolling. This patch groups the const options into a
1143         single struct to make easier to handle them in the future. For example, an #ifdefed scroll
1144         behavior option will be added in bug 188043. This refactoring can maybe help too for other
1145         scroll extensions (e.g. bug 176454 and bug 161611).
1146
1147         No new tests, behavior unchanged.
1148
1149         * accessibility/AccessibilityObject.cpp:
1150         (WebCore::AccessibilityObject::scrollToMakeVisible const): Pass options via a struct.
1151         * dom/Element.cpp:
1152         (WebCore::Element::scrollIntoView): Ditto.
1153         (WebCore::Element::scrollIntoViewIfNeeded): Ditto.
1154         (WebCore::Element::scrollIntoViewIfNotVisible): Ditto.
1155         * editing/FrameSelection.cpp: Include RenderLayer.h in all WebKit ports in order to define
1156         ScrollRectToVisibleOptions.
1157         (WebCore::FrameSelection::revealSelection): Pass options via a struct.
1158         * page/FrameView.cpp:
1159         (WebCore::FrameView::scrollToFocusedElementInternal): Ditto.
1160         (WebCore::FrameView::scrollToAnchor): Ditto.
1161         * rendering/RenderLayer.cpp:
1162         (WebCore::RenderLayer::scrollRectToVisible): Pass options via a struct. Note that
1163         absoluteRect and insideFixed are modified in this function.
1164         (WebCore::RenderLayer::autoscroll): Pass options via a struct.
1165         * rendering/RenderLayer.h: Add ScrollRectToVisibleOptions and use it in order to pass
1166         scrollRectToVisible options.
1167         * rendering/RenderObject.cpp:
1168         (WebCore::RenderObject::scrollRectToVisible): Pass options via a struct
1169         * rendering/RenderObject.h: Forward-declare ScrollRectToVisibleOptions and use in order to
1170         pass scrollRectToVisible options.
1171
1172 2018-09-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1173
1174         [macOS] Cannot change font size at selection until font panel is shown
1175         https://bugs.webkit.org/show_bug.cgi?id=189295
1176         <rdar://problem/35593389>
1177
1178         Reviewed by Ryosuke Niwa.
1179
1180         Currently, attempting to alter the font size of currently selected editable text in WKWebView via menu items
1181         will fail if the font panel has never been shown. This is because WebViewImpl::changeFontFromFontPanel, which is
1182         responsible for converting the current font at the selection to the new font using -[NSFontManager convertFont:]
1183         bails as a result of NSFontManager's currently selected font always being nil.
1184
1185         WKWebView is responsible for keeping NSFontManager up-to-date with the currently selected font; in fact, this
1186         was initially the case in r180465, which introduced NSFontManager support in WebKit2 by propagating EditorState
1187         updates that contained font information for the current selection. However, this regressed performance due to
1188         selected font computation triggering extra layout passes; r180768 addressed this by introducing a mechanism for
1189         requesting the font at the current selection, and only updating NSFontManager with the new selected font when
1190         the shared font panel is visible (determined by KVO on NSFontPanel). However, this again regressed WKWebView
1191         launch performance, due to KVO registration always forcing the shared NSFontPanel to be created. r182037
1192         addressed this by only registering for KVO on the font panel if the WKWebView has been made editable (SPI on
1193         WKWebView).
1194
1195         This leads to two issues when attempting to alter font attributes using macOS UI: (1) in web views that have not
1196         been made editable using SPI, showing the font panel and attempting to change the font fails due to the selected
1197         font staying nil, because we've never begun registering for KVO notifications on the font panel so we don't try
1198         to keep the font manager up to date. (2) Even if the web view is made editable, if the font panel is never
1199         shown, then the font manager still won't be kept up to date with the current selection, so changing fonts using
1200         menu items still does not work.
1201
1202         We fix both of these problems by refactoring font manager support on WebKit2 such that an up-to-date selected
1203         font in the UI process is no longer necessary in order to alter the font at the current selection. To do this,
1204         we figure out what changes the NSFontManager would've made to the currently selected font in the UI process, and
1205         then propagate this information to the web process, where we convert this information into an EditingStyle which
1206         we apply to the current selection.
1207
1208         The code to both determine the attributes changed by NSFontManager and to convert these attributes into editing
1209         styles to be applied via Editor already exists in WebKitLegacy, in WebHTMLView.mm. This patch moves this
1210         existing logic into WebCore and teases it apart into two portions: the first portion probes NSFontManager to
1211         determine which aspects of the font changed and constructs FontChanges, which captures these differences. The
1212         second portion maps FontChanges to an EditingStyle, which can then be applied to the current selection. In
1213         WebKitLegacy, we construct FontChanges using the font manager, and then immediately use it to create and apply
1214         an EditingStyle. In WebKit, we construct FontChanges in the UI process using the font manager, and then send
1215         this over to the web process via WebPage::changeFont, which then creates and applies the EditingStyle.
1216
1217         Note that this patch also introduces FontAttributeChanges, which is similar in concept to FontChanges, but
1218         captures a broader range of changes possible via NSFontPanel. This was done so that we can eliminate all of the
1219         font manager probing code (along with the two specimen fonts) from WebHTMLView, but is also necessary in order
1220         to allow changing font shadow, strikethrough, and underlines via the font panel to work in WebKit2. This will be
1221         fixed in a followup, by making FontAttributeChanges IPC encodable and by making WKWebView/WKView respond to the
1222         -changeAttributes: selector.
1223
1224         Changes in behavior to WebKit2 are covered by new API tests; legacy WebKit behavior should remain unchanged.
1225
1226         Tests:  FontManagerTests.ChangeFontSizeWithMenuItems
1227                 FontManagerTests.ChangeFontWithPanel
1228
1229         * SourcesCocoa.txt:
1230         * WebCore.xcodeproj/project.pbxproj:
1231         * editing/Editor.h:
1232
1233         Remove applyFontStyles.
1234
1235         * editing/FontAttributeChanges.cpp: Added.
1236         (WebCore::FontChanges::platformFontFamilyNameForCSS const):
1237
1238         Given a font family name and a font name, returns the string to use as the "font-family" style property value.
1239         Originally from WebHTMLView.mm.
1240
1241         (WebCore::FontChanges::createEditingStyle const):
1242
1243         Converts font changes to an EditingStyle that can be used to apply these changes.
1244
1245         (WebCore::FontChanges::createStyleProperties const):
1246
1247         Introduce FontChanges, which encapsulates changes which are to be applied to the font in the current selection.
1248
1249         (WebCore::cssValueListForShadow):
1250         (WebCore::FontAttributeChanges::createEditingStyle const):
1251
1252         Converts font attribute changes to an EditingStyle that can be used to apply these changes.
1253
1254         * editing/FontAttributeChanges.h: Added.
1255
1256         Introduce FontAttributeChanges, which encapsulates changes which are to be applied to the font attributes in the
1257         current selection. This includes a set of FontChanges, as well as additional attributes such as strike-through
1258         and underlines.
1259
1260         (WebCore::FontChanges::setFontName):
1261         (WebCore::FontChanges::setFontFamily):
1262         (WebCore::FontChanges::setFontSize):
1263         (WebCore::FontChanges::setFontSizeDelta):
1264         (WebCore::FontChanges::setBold):
1265         (WebCore::FontChanges::setItalic):
1266         (WebCore::FontAttributeChanges::setVerticalAlign):
1267         (WebCore::FontAttributeChanges::setBackgroundColor):
1268         (WebCore::FontAttributeChanges::setForegroundColor):
1269         (WebCore::FontAttributeChanges::setShadow):
1270         (WebCore::FontAttributeChanges::setStrikeThrough):
1271         (WebCore::FontAttributeChanges::setUnderline):
1272         (WebCore::FontAttributeChanges::setFontChanges):
1273
1274         Setters for FontChanges and FontAttributeChanges. Initially, most of these values are optional, indicating that
1275         there should be no change.
1276
1277         (WebCore::FontChanges::encode const):
1278         (WebCore::FontChanges::decode):
1279
1280         Add encoding/decoding support to FontChanges, so that it can be sent over IPC for WebKit2.
1281
1282         * editing/cocoa/FontAttributeChangesCocoa.mm: Added.
1283         (WebCore::FontChanges::platformFontFamilyNameForCSS const):
1284
1285         Helper method to determine whether the font family or the font name should be used, by looking up the PostScript
1286         font name using a FontDescriptor and comparing it against the result of -[NSFont fontName]. This logic was
1287         originally in WebHTMLView.mm.
1288
1289         * editing/mac/EditorMac.mm:
1290         (WebCore::Editor::applyFontStyles): Deleted.
1291         * platform/mac/WebCoreNSFontManagerExtras.h: Added.
1292         * platform/mac/WebCoreNSFontManagerExtras.mm: Added.
1293
1294         Add helper functions to compute FontChanges and FontAttributeChanges from NSFontManager.
1295
1296         (WebCore::firstFontConversionSpecimen):
1297         (WebCore::secondFontConversionSpecimen):
1298
1299         Two "specimen fonts" used to determine what changes NSFontManager or NSFontPanel makes when performing font or
1300         font attribute conversion. Moved from WebHTMLView.mm.
1301
1302         (WebCore::computedFontChanges):
1303         (WebCore::computedFontAttributeChanges):
1304
1305         Moved here from WebHTMLView.mm. Instead of converting font attributes to NSStrings and setting properties on
1306         DOMCSSStyleDeclaration, we instead specify properties on MutableStyleProperties using CSSValues.
1307
1308 2018-09-06  Zalan Bujtas  <zalan@apple.com>
1309
1310         [LFC][BFC] Add support for min(max)-width
1311         https://bugs.webkit.org/show_bug.cgi?id=189358
1312
1313         Reviewed by Antti Koivisto.
1314
1315         See https://www.w3.org/TR/CSS22/visudet.html#min-max-widths for details.
1316
1317         Tests: fast/block/block-only/absolute-position-min-max-width.html
1318                fast/block/block-only/float-min-max-width.html
1319                fast/block/block-only/inflow-min-max-width.html
1320
1321         * layout/FormattingContext.cpp:
1322         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
1323         * layout/FormattingContext.h:
1324         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
1325         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
1326         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1327         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1328         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1329         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
1330         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1331         * layout/FormattingContextGeometry.cpp:
1332         (WebCore::Layout::FormattingContext::Geometry::computedValueIfNotAuto):
1333         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1334         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1335         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1336         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
1337         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
1338         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
1339         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1340         * layout/blockformatting/BlockFormattingContext.cpp:
1341         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
1342         * layout/blockformatting/BlockFormattingContext.h:
1343         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
1344         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1345         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
1346         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1347         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1348         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
1349         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
1350
1351 2018-09-06  Eric Carlson  <eric.carlson@apple.com>
1352
1353         [MediaStream] Initialize AVVideoCapture video presets
1354         https://bugs.webkit.org/show_bug.cgi?id=189355
1355
1356         Reviewed by Youenn Fablet.
1357
1358         No new tests, no functionality changed.
1359
1360         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1361         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource): Don't try to load symbols if they
1362         aren't available.
1363
1364 2018-09-06  Ali Juma  <ajuma@chromium.org>
1365
1366         IntersectionObserver leaks documents
1367         https://bugs.webkit.org/show_bug.cgi?id=189128
1368
1369         Reviewed by Simon Fraser.
1370
1371         Currently, Documents own IntersectionObservers while IntersectionObservers own callbacks
1372         that have strong references to Documents. To break this cycle, make Documents only have
1373         weak pointers to IntersectionObservers. Instead, manage the lifetime of an
1374         IntersectionObserver as an ActiveDOMObject, overriding hasPendingActivity to keep
1375         the observer alive while there are ongoing observations.
1376
1377         However, there is a still a potential reference cycle. The callback keeps global
1378         references alive, so if there's a global reference to the observer in JavaScript,
1379         we have an observer->callback->observer cycle, keeping the callback (and hence the Document)
1380         alive. To break this cycle, make IntersectionObserver release the callback when its
1381         Document is stopped.
1382
1383         With these changes, there are no longer any leaks reported with run-webkit-tests --world-leaks
1384         on LayoutTests/intersection-observer and LayoutTests/imported/w3c/web-platform-tests/intersection-observer.
1385
1386         Tests: intersection-observer/no-document-leak.html
1387                intersection-observer/observer-and-callback-without-js-references.html
1388
1389         * dom/Document.cpp:
1390         (WebCore::Document::addIntersectionObserver):
1391         (WebCore::Document::removeIntersectionObserver):
1392         * dom/Document.h:
1393         * dom/Element.cpp:
1394         (WebCore::Element::didMoveToNewDocument):
1395         * page/IntersectionObserver.cpp:
1396         (WebCore::IntersectionObserver::IntersectionObserver):
1397         (WebCore::IntersectionObserver::~IntersectionObserver):
1398         (WebCore::IntersectionObserver::observe):
1399         (WebCore::IntersectionObserver::rootDestroyed):
1400         (WebCore::IntersectionObserver::createTimestamp const):
1401         (WebCore::IntersectionObserver::notify):
1402         (WebCore::IntersectionObserver::hasPendingActivity const):
1403         (WebCore::IntersectionObserver::activeDOMObjectName const):
1404         (WebCore::IntersectionObserver::canSuspendForDocumentSuspension const):
1405         (WebCore::IntersectionObserver::stop):
1406         * page/IntersectionObserver.h:
1407         (WebCore::IntersectionObserver::trackingDocument const):
1408         (WebCore::IntersectionObserver::trackingDocument): Deleted.
1409         * page/IntersectionObserver.idl:
1410
1411 2018-09-05  Zalan Bujtas  <zalan@apple.com>
1412
1413         [LFC] Adapt to the new const WeakPtr<>
1414         https://bugs.webkit.org/show_bug.cgi?id=189334
1415
1416         Reviewed by Antti Koivisto.
1417
1418         * layout/FormattingContext.cpp:
1419         (WebCore::Layout::FormattingContext::FormattingContext):
1420         * layout/FormattingContext.h:
1421         * layout/LayoutContext.cpp:
1422         (WebCore::Layout::LayoutContext::initializeRoot):
1423         * layout/LayoutContext.h:
1424         * layout/floats/FloatAvoider.cpp:
1425         (WebCore::Layout::FloatAvoider::FloatAvoider):
1426         * layout/floats/FloatAvoider.h:
1427         * layout/floats/FloatingState.cpp:
1428         (WebCore::Layout::FloatingState::FloatItem::FloatItem):
1429         (WebCore::Layout::FloatingState::FloatingState):
1430         * layout/floats/FloatingState.h:
1431         * layout/layouttree/LayoutContainer.cpp:
1432         (WebCore::Layout::Container::addOutOfFlowDescendant):
1433         * layout/layouttree/LayoutContainer.h:
1434         (WebCore::Layout::Container::outOfFlowDescendants const):
1435
1436 2018-09-06  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1437
1438         [GStreamer] Extra ASSERTs at MainThreadNotifier
1439         https://bugs.webkit.org/show_bug.cgi?id=188786
1440
1441         Reviewed by Carlos Garcia Campos.
1442
1443         We add a couple of checks in debug mode: there is only one bit on
1444         per notification and ensure a notifier was invalidated before
1445         being destroyed.
1446
1447         * platform/graphics/gstreamer/MainThreadNotifier.h:
1448
1449 2018-09-05  Youenn Fablet  <youenn@apple.com>
1450
1451         Move ownership of outgoing source to RTCRtpSender backend
1452         https://bugs.webkit.org/show_bug.cgi?id=189310
1453
1454         Reviewed by Alex Christensen.
1455
1456         RTCRtpSender should own the source so that it can replace/stop it.
1457         Since this is libwebrtc specific, the source is actually owned by the backend.
1458         Simplified replaceTrack a bit based on that.
1459
1460         No change of behavior.
1461
1462         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1463         (WebCore::LibWebRTCMediaEndpoint::addTrack):
1464         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1465         (WebCore::LibWebRTCPeerConnectionBackend::doStop):
1466         (WebCore::updateTrackSource):
1467         (WebCore::LibWebRTCPeerConnectionBackend::replaceTrack):
1468         (WebCore::LibWebRTCPeerConnectionBackend::applyRotationForOutgoingVideoSources):
1469         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
1470         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
1471
1472 2018-09-05  Brent Fulgham  <bfulgham@apple.com>
1473
1474         The width of an empty or nullptr TextRun should be zero
1475         https://bugs.webkit.org/show_bug.cgi?id=189154
1476         <rdar://problem/43685926>
1477
1478         Reviewed by Zalan Bujtas.
1479
1480         If a page has an empty TextRun and attempts to paint it we can crash with a nullptr.
1481
1482         This patch recognizes that an empty TextRun should always produce a zero width, rather than
1483         attempt to compute this value from font data. It also prevents ListBox from attempting to
1484         paint a null string.
1485
1486         Test: fast/text/null-string-textrun.html
1487
1488         * platform/graphics/FontCascade.cpp:
1489         (WebCore::FontCascade::widthOfTextRange const): An empty TextRun has zero width.
1490         (WebCore::FontCascade::width const): Ditto.
1491         * platform/graphics/TextRun.h:
1492         (WebCore::TextRun::TextRun): ASSERT that the supplied String is non-null.
1493         (WebCore::TextRun::setText): Ditto.
1494         * rendering/RenderListBox.cpp:
1495         (WebCore::RenderListBox::paintItemForeground): Don't attempt to paint a null string.
1496
1497 2018-09-05  Zalan Bujtas  <zalan@apple.com>
1498
1499         [LFC][BFC] ComputeFloat* methods should take a const FloatingContext&
1500         https://bugs.webkit.org/show_bug.cgi?id=189333
1501
1502         Reviewed by Antti Koivisto.
1503
1504         Only layoutFormattingContextRoot() needs a non-const FloatingContext& object (to add the floating box to the floating state).
1505
1506         * layout/blockformatting/BlockFormattingContext.cpp:
1507         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
1508         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
1509         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
1510         * layout/blockformatting/BlockFormattingContext.h:
1511
1512 2018-09-05  Youenn Fablet  <youenn@apple.com>
1513
1514         Introduce a backend for RTCRtpTransceiver
1515         https://bugs.webkit.org/show_bug.cgi?id=189322
1516
1517         Reviewed by Eric Carlson.
1518
1519         Introduce RTCRtpTransceiverBackend to implement the transceiver functionality using libwebrtc.
1520         Remove provisional mids as it will be done by the webrtc backend.
1521
1522         No observable change of behavior yet since there is no transceiver backend yet.
1523
1524         * Modules/mediastream/PeerConnectionBackend.h:
1525         * Modules/mediastream/RTCRtpTransceiver.cpp:
1526         (WebCore::RTCRtpTransceiver::RTCRtpTransceiver):
1527         (WebCore::RTCRtpTransceiver::mid const):
1528         (WebCore::RTCRtpTransceiver::direction const):
1529         (WebCore::RTCRtpTransceiver::setDirection):
1530         (WebCore::RTCRtpTransceiver::stop):
1531         (WebCore::RTCRtpTransceiver::getNextMid): Deleted.
1532         (WebCore::RTCRtpTransceiver::directionString const): Deleted.
1533         * Modules/mediastream/RTCRtpTransceiver.h:
1534         (WebCore::RTCRtpTransceiver::create):
1535         (WebCore::RTCRtpTransceiver::provisionalMid const): Deleted.
1536         (WebCore::RTCRtpTransceiver::setMid): Deleted.
1537         * Modules/mediastream/RTCRtpTransceiverBackend.h: Added.
1538         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1539         (WebCore::LibWebRTCPeerConnectionBackend::createReceiver):
1540         (WebCore::LibWebRTCPeerConnectionBackend::videoReceiver):
1541         (WebCore::LibWebRTCPeerConnectionBackend::audioReceiver):
1542         (WebCore::LibWebRTCPeerConnectionBackend::addTrack):
1543         (WebCore::LibWebRTCPeerConnectionBackend::completeAddTransceiver):
1544         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
1545         * WebCore.xcodeproj/project.pbxproj:
1546
1547 2018-09-05  Zalan Bujtas  <zalan@apple.com>
1548
1549         [LFC] Pass in const LayoutContext& to geometry methods when possible
1550         https://bugs.webkit.org/show_bug.cgi?id=189331
1551
1552         Reviewed by Antti Koivisto.
1553
1554         Only layout and layout-like methods (intrinsic width computation -> shrink to fit -> out-of-flow/floating boxes) should take a
1555         non-const LayoutContext&. Other geometry functions should not mutate the the context.
1556
1557         * layout/FormattingContext.cpp:
1558         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
1559         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
1560         (WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const):
1561         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1562         * layout/FormattingContext.h:
1563         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1564         * layout/FormattingContextGeometry.cpp:
1565         (WebCore::Layout::contentHeightForFormattingContextRoot):
1566         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
1567         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1568         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1569         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
1570         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
1571         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
1572         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
1573         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
1574         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1575         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1576         (WebCore::Layout::FormattingContext::Geometry::computedBorder):
1577         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
1578         * layout/LayoutContext.cpp:
1579         (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
1580         (WebCore::Layout::LayoutContext::establishedFormattingState const):
1581         (WebCore::Layout::LayoutContext::createFormattingStateForFormattingRootIfNeeded):
1582         (WebCore::Layout::LayoutContext::formattingContext const):
1583         (WebCore::Layout::LayoutContext::establishedFormattingState): Deleted.
1584         (WebCore::Layout::LayoutContext::formattingContext): Deleted.
1585         * layout/LayoutContext.h:
1586         * layout/blockformatting/BlockFormattingContext.cpp:
1587         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
1588         (WebCore::Layout::BlockFormattingContext::computeStaticPosition const):
1589         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTop const):
1590         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTopForAncestors const):
1591         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
1592         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
1593         (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const):
1594         (WebCore::Layout::BlockFormattingContext::computeInFlowPositionedPosition const):
1595         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
1596         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
1597         * layout/blockformatting/BlockFormattingContext.h:
1598         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1599         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1600         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1601         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
1602         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
1603         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
1604         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
1605         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
1606         (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraints):
1607         * layout/inlineformatting/InlineFormattingContext.cpp:
1608         (WebCore::Layout::InlineFormattingContext::computeStaticPosition const):
1609         (WebCore::Layout::InlineFormattingContext::computeInFlowPositionedPosition const):
1610         * layout/inlineformatting/InlineFormattingContext.h:
1611
1612 2018-09-05  Youenn Fablet  <youenn@apple.com>
1613
1614         Expose RTCRtpSender.setParameters
1615         https://bugs.webkit.org/show_bug.cgi?id=189307
1616
1617         Reviewed by Eric Carlson.
1618
1619         Implement RTCRtpSender.setParameters.
1620         This is an incomplete implementation as we need to refresh parameters as per the spec and testing is much easier with full transceiver support.
1621         Implementation uses sender backend to set the parameters at libwebrtc level.
1622         Fix the case of a stopped sender/transceiver in which case promise should be rejected.
1623         Covered by rebased and modified tests.
1624
1625         * Modules/mediastream/RTCRtpParameters.h:
1626         * Modules/mediastream/RTCRtpSender.cpp:
1627         (WebCore::RTCRtpSender::setParameters):
1628         * Modules/mediastream/RTCRtpSender.h:
1629         * Modules/mediastream/RTCRtpSender.idl:
1630         * Modules/mediastream/RTCRtpSenderBackend.h:
1631         * Modules/mediastream/RTCRtpTransceiver.cpp:
1632         (WebCore::RTCRtpTransceiver::stop):
1633         * Modules/mediastream/RTCRtpTransceiver.h:
1634         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.cpp:
1635         (WebCore::LibWebRTCRtpReceiverBackend::getParameters):
1636         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
1637         (WebCore::LibWebRTCRtpSenderBackend::getParameters const):
1638         (WebCore::LibWebRTCRtpSenderBackend::setParameters):
1639         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
1640         * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
1641         (WebCore::toRTCEncodingParameters):
1642         (WebCore::fromRTCEncodingParameters):
1643         (WebCore::toRTCHeaderExtensionParameters):
1644         (WebCore::fromRTCHeaderExtensionParameters):
1645         (WebCore::toRTCCodecParameters):
1646         (WebCore::toRTCRtpParameters):
1647         (WebCore::fromRTCRtpParameters):
1648         * Modules/mediastream/libwebrtc/LibWebRTCUtils.h:
1649
1650 2018-09-05  Simon Fraser  <simon.fraser@apple.com>
1651
1652         Remove some logging that I committed by mistake.
1653
1654         * rendering/RenderLayerFilters.cpp:
1655         (WebCore::RenderLayerFilters::RenderLayerFilters):
1656         (WebCore::RenderLayerFilters::~RenderLayerFilters):
1657
1658 2018-09-05  Zalan Bujtas  <zalan@apple.com>
1659
1660         [LFC] Construct the Display::Box objects on demand.
1661         https://bugs.webkit.org/show_bug.cgi?id=189320
1662
1663         Reviewed by Antti Koivisto.
1664
1665         * layout/FormattingContext.cpp:
1666         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1667         * layout/LayoutContext.cpp:
1668         (WebCore::Layout::LayoutContext::initializeRoot):
1669         (WebCore::Layout::LayoutContext::displayBoxForLayoutBox const):
1670         (WebCore::Layout::LayoutContext::createDisplayBox): Deleted.
1671         * layout/LayoutContext.h:
1672         (WebCore::Layout::LayoutContext::displayBoxForLayoutBox const): Deleted.
1673         * layout/Verification.cpp:
1674         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
1675         * layout/blockformatting/BlockFormattingContext.cpp:
1676         (WebCore::Layout::BlockFormattingContext::layout const):
1677         * layout/displaytree/DisplayBox.h:
1678
1679 2018-09-05  Woodrow Wang  <woodrow_wang@apple.com>
1680
1681         Add infrastructure to dump resource load statistics
1682         https://bugs.webkit.org/show_bug.cgi?id=189213
1683
1684         Reviewed by Daniel Bates. 
1685
1686         The dumping functionality is not currently used, but will be included in tests for
1687         <https://bugs.webkit.org/show_bug.cgi?id=187773>.
1688
1689         * loader/ResourceLoadStatistics.h:
1690
1691 2018-09-05  Ryan Haddad  <ryanhaddad@apple.com>
1692
1693         Unreviewed, fix the build with recent SDKs.
1694
1695         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1696         (WebCore::exernalDeviceDisplayNameForPlayer):
1697
1698 2018-09-05  Woodrow Wang  <woodrow_wang@apple.com>
1699
1700         Added runtime feature flag for web API statistics
1701         https://bugs.webkit.org/show_bug.cgi?id=189211
1702
1703         Reviewed by Daniel Bates.
1704
1705         Added functionality to get and set the runtime flag.
1706
1707         * page/RuntimeEnabledFeatures.h:
1708         (WebCore::RuntimeEnabledFeatures::setWebAPIStatisticsEnabled):
1709         (WebCore::RuntimeEnabledFeatures::webAPIStatisticsEnabled const):
1710
1711 2018-09-05  Youenn Fablet  <youenn@apple.com>
1712
1713         Move replaceTrack logic to LibWebRTCPeerConnectionBackend
1714         https://bugs.webkit.org/show_bug.cgi?id=189281
1715
1716         Reviewed by Eric Carlson.
1717
1718         Move replaceTrack handling code from RTCPeerConnection to LibWebRTCPeerConnectionBackend.
1719         This makes the logic easier to understand.
1720         Future refactoring will further try to put more handling in RTCRtpSenderBackend.
1721         No change of behavior.
1722
1723         * Modules/mediastream/RTCPeerConnection.cpp:
1724         * Modules/mediastream/RTCPeerConnection.h:
1725         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1726         (WebCore::tryUpdatingTrackSource):
1727         (WebCore::LibWebRTCPeerConnectionBackend::replaceTrack):
1728         (WebCore::LibWebRTCPeerConnectionBackend::enqueueReplaceTrackTask):
1729         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
1730         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
1731         (WebCore::LibWebRTCRtpSenderBackend::replaceTrack):
1732
1733 2018-09-05  Zalan Bujtas  <zalan@apple.com>
1734
1735         [LFC] LayoutContext::displayBoxForLayoutBox() should return a Display::Box&
1736         https://bugs.webkit.org/show_bug.cgi?id=189311
1737
1738         Reviewed by Antti Koivisto.
1739
1740         When the layout logic needs a Display::Box, we must have already created one for the associated Layout::Box.
1741         (It does not necessarily mean that evey Layout::Box has a Display::Box. For example in case of inline formatting context,
1742         we don't create a Display::Box for every inline box, but the formatting logic does not require such pairs.)
1743
1744         * layout/FormattingContext.cpp:
1745         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
1746         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
1747         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
1748         (WebCore::Layout::FormattingContext::mapBoxToAncestor):
1749         (WebCore::Layout::FormattingContext::mapTopLeftToAncestor):
1750         (WebCore::Layout::FormattingContext::mapCoordinateToAncestor):
1751         (WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const):
1752         * layout/FormattingContextGeometry.cpp:
1753         (WebCore::Layout::contentHeightForFormattingContextRoot):
1754         (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned):
1755         (WebCore::Layout::staticHorizontalPositionForOutOfFlowPositioned):
1756         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
1757         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
1758         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1759         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1760         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1761         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
1762         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1763         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1764         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1765         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
1766         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
1767         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
1768         * layout/LayoutContext.h:
1769         (WebCore::Layout::LayoutContext::displayBoxForLayoutBox const):
1770         * layout/Verification.cpp:
1771         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
1772         * layout/blockformatting/BlockFormattingContext.cpp:
1773         (WebCore::Layout::BlockFormattingContext::computeStaticPosition const):
1774         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTop const):
1775         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTopForAncestors const):
1776         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
1777         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
1778         (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const):
1779         (WebCore::Layout::BlockFormattingContext::computeInFlowPositionedPosition const):
1780         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
1781         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
1782         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1783         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1784         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1785         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
1786         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
1787         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
1788         * layout/blockformatting/BlockMarginCollapse.cpp:
1789         (WebCore::Layout::isMarginTopCollapsedWithParent):
1790         (WebCore::Layout::isMarginBottomCollapsedThrough):
1791         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWithParent):
1792         * layout/floats/FloatingContext.cpp:
1793         (WebCore::Layout::FloatingContext::positionForFloat const):
1794         (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
1795         * layout/floats/FloatingState.cpp:
1796         (WebCore::Layout::FloatingState::append):
1797         * layout/inlineformatting/InlineFormattingContext.cpp:
1798         (WebCore::Layout::InlineFormattingContext::layout const):
1799         * layout/layouttree/LayoutTreeBuilder.cpp:
1800         (WebCore::Layout::outputLayoutTree):
1801         (WebCore::Layout::showLayoutTree):
1802
1803 2018-09-05  Zalan Bujtas  <zalan@apple.com>
1804
1805         [LFC] Drop Display:Box from FormattingContext::compute* functions
1806         https://bugs.webkit.org/show_bug.cgi?id=189309
1807
1808         Reviewed by Antti Koivisto.
1809
1810         They are redundant and could get out of sync.
1811
1812         * layout/FormattingContext.cpp:
1813         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
1814         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
1815         (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
1816         (WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const):
1817         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1818         * layout/FormattingContext.h:
1819         * layout/blockformatting/BlockFormattingContext.cpp:
1820         (WebCore::Layout::BlockFormattingContext::layout const):
1821         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
1822         (WebCore::Layout::BlockFormattingContext::computeStaticPosition const):
1823         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTop const):
1824         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTopForAncestors const):
1825         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
1826         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
1827         (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const):
1828         (WebCore::Layout::BlockFormattingContext::computeInFlowPositionedPosition const):
1829         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
1830         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
1831         * layout/blockformatting/BlockFormattingContext.h:
1832         * layout/inlineformatting/InlineFormattingContext.cpp:
1833         (WebCore::Layout::InlineFormattingContext::computeStaticPosition const):
1834         (WebCore::Layout::InlineFormattingContext::computeInFlowPositionedPosition const):
1835         * layout/inlineformatting/InlineFormattingContext.h:
1836
1837 2018-09-05  Jer Noble  <jer.noble@apple.com>
1838
1839         Add MediaCapabilities as an Experimental Feature
1840         https://bugs.webkit.org/show_bug.cgi?id=189209
1841
1842         Reviewed by Eric Carlson.
1843
1844         Move mediaCapabilitiesEnabled out of RuntimeEnabledFeatures. It already (also) exists in Settings.
1845
1846         * Modules/mediacapabilities/MediaCapabilities.idl:
1847         * Modules/mediacapabilities/MediaCapabilitiesInfo.idl:
1848         * Modules/mediacapabilities/NavigatorMediaCapabilities.idl:
1849         * Modules/mediacapabilities/ScreenLuminance.idl:
1850         * page/RuntimeEnabledFeatures.h:
1851         (WebCore::RuntimeEnabledFeatures::setMediaCapabilitiesEnabled): Deleted.
1852         (WebCore::RuntimeEnabledFeatures::mediaCapabilitiesEnabled const): Deleted.
1853
1854 2018-09-05  Woodrow Wang  <woodrow_wang@apple.com>
1855
1856         Add functionality to encode and decode a uint64_t in KeyedCoding
1857         https://bugs.webkit.org/show_bug.cgi?id=189216
1858
1859         Reviewed by Daniel Bates.
1860
1861         I've added this functionality in order to be able to encode and decode the raw uint64_t 
1862         representation of an OptionSet for my patch here <https://bugs.webkit.org/show_bug.cgi?id=187773>. 
1863
1864         The changes in the KeyedEncoder/KeyedDecoder for Glib were made because they are derived classes
1865         of KeyedCoding which contains pure virtual functions that need to be implemented.
1866
1867         * platform/KeyedCoding.h:
1868         * platform/cf/KeyedDecoderCF.cpp:
1869         (WebCore::KeyedDecoderCF::decodeUInt64):
1870         * platform/cf/KeyedDecoderCF.h:
1871         * platform/cf/KeyedEncoderCF.cpp:
1872         (WebCore::KeyedEncoderCF::encodeUInt64):
1873         * platform/cf/KeyedEncoderCF.h:
1874         * platform/glib/KeyedDecoderGlib.cpp:
1875         (WebCore::KeyedDecoderGlib::decodeUInt64):
1876         * platform/glib/KeyedDecoderGlib.h:
1877         * platform/glib/KeyedEncoderGlib.cpp:
1878         (WebCore::KeyedEncoderGlib::encodeUInt64):
1879         * platform/glib/KeyedEncoderGlib.h:
1880
1881 2018-09-05  Zan Dobersek  <zdobersek@igalia.com>
1882
1883         [GTK] ASSERT(!m_nicosia.imageBacking) when starting any YouTube video
1884         https://bugs.webkit.org/show_bug.cgi?id=189215
1885
1886         Reviewed by Carlos Garcia Campos.
1887
1888         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1889         (WebCore::CoordinatedGraphicsLayer::purgeBackingStores):
1890         Manually clear out any layer-side state of any image backing that is
1891         associated with this layer, much like we do for backing stores.
1892
1893 2018-09-05  Eric Carlson  <eric.carlson@apple.com>
1894
1895         [MediaStream] Simplify logic when changing RealtimeMediaSource settings
1896         https://bugs.webkit.org/show_bug.cgi?id=189284
1897         <rdar://problem/44117948>
1898
1899         Reviewed by Youenn Fablet.
1900
1901         Remove all "apply<setting>" methods from RealtimeMediaSource and derived classes, and
1902         add a bitfield to settingsDidChange so classes can do setting-specific setup and
1903         configuration by overriding settingsDidChange.
1904
1905         No new tests, no functionality changed.
1906
1907         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
1908         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized):
1909         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
1910         * platform/mediastream/MediaConstraints.h:
1911         (WebCore::NumericConstraint::fitnessDistance const):
1912         (WebCore::NumericConstraint::valueForDiscreteCapabilityValues const):
1913         * platform/mediastream/RealtimeIncomingVideoSource.h:
1914         (): Deleted.
1915         * platform/mediastream/RealtimeMediaSource.cpp:
1916         (WebCore::RealtimeMediaSource::RealtimeMediaSource):
1917         (WebCore::RealtimeMediaSource::settingsDidChange):
1918         (WebCore::RealtimeMediaSource::fitnessDistance):
1919         (WebCore::applyNumericConstraint):
1920         (WebCore::RealtimeMediaSource::applyConstraint):
1921         (WebCore::RealtimeMediaSource::applyConstraints):
1922         (WebCore::RealtimeMediaSource::setSize):
1923         (WebCore::RealtimeMediaSource::setWidth):
1924         (WebCore::RealtimeMediaSource::setHeight):
1925         (WebCore::RealtimeMediaSource::setFrameRate):
1926         (WebCore::RealtimeMediaSource::setAspectRatio):
1927         (WebCore::RealtimeMediaSource::setFacingMode):
1928         (WebCore::RealtimeMediaSource::setVolume):
1929         (WebCore::RealtimeMediaSource::setSampleRate):
1930         (WebCore::RealtimeMediaSource::setSampleSize):
1931         (WebCore::RealtimeMediaSource::setEchoCancellation):
1932         * platform/mediastream/RealtimeMediaSource.h:
1933         * platform/mediastream/RealtimeMediaSourceSettings.cpp:
1934         (WebCore::RealtimeMediaSourceSettings::diff const):
1935         * platform/mediastream/RealtimeMediaSourceSettings.h:
1936         (WebCore::RealtimeMediaSourceSettings::allFlags):
1937         * platform/mediastream/RealtimeVideoSource.cpp:
1938         (WebCore::RealtimeVideoSource::applySize): Deleted.
1939         (WebCore::RealtimeVideoSource::applyFrameRate): Deleted.
1940         * platform/mediastream/RealtimeVideoSource.h:
1941         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
1942         (WebCore::GStreamerAudioCaptureSource::settingsDidChange):
1943         (WebCore::GStreamerAudioCaptureSource::applySampleRate): Deleted.
1944         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h:
1945         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
1946         (WebCore::GStreamerVideoCaptureSource::settingsDidChange):
1947         (WebCore::GStreamerVideoCaptureSource::applySize): Deleted.
1948         (WebCore::GStreamerVideoCaptureSource::applyFrameRate): Deleted.
1949         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h:
1950         * platform/mediastream/mac/AVVideoCaptureSource.h:
1951         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1952         (WebCore::AVVideoCaptureSource::settingsDidChange):
1953         (WebCore::AVVideoCaptureSource::setPreset):
1954         (WebCore::AVVideoCaptureSource::setFrameRate):
1955         (WebCore::AVVideoCaptureSource::applySizeAndFrameRate):
1956         (WebCore::AVVideoCaptureSource::processNewFrame):
1957         (WebCore::AVVideoCaptureSource::applySize): Deleted.
1958         (WebCore::AVVideoCaptureSource::applyFrameRate): Deleted.
1959         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1960         (WebCore::CoreAudioCaptureSource::settingsDidChange):
1961         (WebCore::CoreAudioCaptureSource::applySampleRate): Deleted.
1962         (WebCore::CoreAudioCaptureSource::applyEchoCancellation): Deleted.
1963         * platform/mediastream/mac/CoreAudioCaptureSource.h:
1964         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
1965         (WebCore::DisplayCaptureSourceCocoa::settingsDidChange):
1966         (WebCore::DisplayCaptureSourceCocoa::startProducingData):
1967         (WebCore::DisplayCaptureSourceCocoa::applySize): Deleted.
1968         (WebCore::DisplayCaptureSourceCocoa::applyFrameRate): Deleted.
1969         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
1970         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
1971         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
1972         (WebCore::MockRealtimeAudioSourceMac::settingsDidChange):
1973         (WebCore::MockRealtimeAudioSourceMac::applySampleRate): Deleted.
1974         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
1975         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
1976         (WebCore::MockRealtimeVideoSourceMac::settingsDidChange):
1977         (WebCore::MockRealtimeVideoSourceMac::applySize): Deleted.
1978         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
1979         (WebCore::RealtimeIncomingVideoSourceCocoa::processNewSample):
1980         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
1981         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
1982         (WebCore::ScreenDisplayCaptureSourceMac::settingsDidChange):
1983         (WebCore::ScreenDisplayCaptureSourceMac::applySize): Deleted.
1984         (WebCore::ScreenDisplayCaptureSourceMac::applyFrameRate): Deleted.
1985         * platform/mock/MockRealtimeAudioSource.cpp:
1986         (WebCore::MockRealtimeAudioSource::settingsDidChange):
1987         * platform/mock/MockRealtimeAudioSource.h:
1988         * platform/mock/MockRealtimeVideoSource.cpp:
1989         (WebCore::MockRealtimeVideoSource::settingsDidChange):
1990         (WebCore::MockRealtimeVideoSource::applySize): Deleted.
1991         * platform/mock/MockRealtimeVideoSource.h:
1992
1993 2018-09-05  Zalan Bujtas <zalan@apple.com>
1994
1995         [LFC][BFC] Move MarginCollapse class under BlockFormattingContext::Geometry
1996         https://bugs.webkit.org/show_bug.cgi?id=189296
1997
1998         Reviewed by Antti Koivisto.
1999
2000         Margin collapsing is part of geometry after all.
2001
2002         * layout/blockformatting/BlockFormattingContext.cpp:
2003         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTop const):
2004         * layout/blockformatting/BlockFormattingContext.h:
2005         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2006         (WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginTop):
2007         * layout/blockformatting/BlockMarginCollapse.cpp:
2008         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginTopFromFirstChild):
2009         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginTop):
2010         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginTop):
2011         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBottom):
2012         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginTop):
2013         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBottom):
2014         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWithParent):
2015         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginTopCollapsedWithParentMarginBottom):
2016         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBottomFromLastChild):
2017         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBottom):
2018         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild): Deleted.
2019         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginTop): Deleted.
2020         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginTop): Deleted.
2021         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBottom): Deleted.
2022         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop): Deleted.
2023         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom): Deleted.
2024         (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent): Deleted.
2025         (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginTopCollapsedWithParentMarginBottom): Deleted.
2026         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild): Deleted.
2027         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBottom): Deleted.
2028         (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginTop): Deleted.
2029
2030 2018-09-04  Zalan Bujtas  <zalan@apple.com>
2031
2032         [LFC] Make BlockFormattingContext::Geometry a subclass of FormattingContext::Geometry
2033         https://bugs.webkit.org/show_bug.cgi?id=189294
2034
2035         Reviewed by Antti Koivisto.
2036
2037         This simplifies some of the call sites.
2038
2039         * layout/blockformatting/BlockFormattingContext.cpp:
2040         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
2041         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
2042         * layout/blockformatting/BlockFormattingContext.h:
2043         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2044         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2045         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
2046         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
2047         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
2048         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
2049         (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraints):
2050
2051 2018-09-04  Frederic Wang  <fwang@igalia.com>
2052
2053         Add basic support for ScrollIntoViewOptions
2054         https://bugs.webkit.org/show_bug.cgi?id=189258
2055
2056         Reviewed by Simon Fraser.
2057
2058         This patch introduces a new ScrollIntoViewOptions parameter that can be passed into
2059         Element.scrollIntoView instead of a boolean. A basic support for scroll alignments is
2060         implemented, so that it is closer to the behavior of the CSSOMView spec while still remaining
2061         compatible with the current boolean-parameter implementation. Full implementation that
2062         takes into account orientation/direction will be handled in bug 161611. This patch is also a
2063         preliminary step to support the ScrollBehavior (bug 188043) for ScrollIntoView.
2064
2065         Tests: web-platform-tests/css/cssom-view/scrollintoview-html
2066                web-platform-tests/css/cssom-view/scrollIntoView-smooth.html
2067
2068         * CMakeLists.txt: Add new IDL files.
2069         * DerivedSources.make: Ditto.
2070         * Sources.txt: Add new generated cpp JS bindings.
2071         * WebCore.xcodeproj/project.pbxproj: Add files to build to XCode.
2072         * dom/Element.cpp:
2073         (WebCore::toScrollAlignment): Convert ScrollLogicalPosition to scroll alignment. Orientation
2074         and direction are not implemented yet.
2075         (WebCore::Element::scrollIntoView): Implement new scrollIntoView version accepting
2076         ScrollIntoViewOptions parameter.
2077         * dom/Element.h: Declare new scrollIntoView.
2078         * dom/Element.idl: Make scrollIntoView accept a ScrollIntoViewOptions parameter.
2079         * page/ScrollIntoViewOptions.h: Added.
2080         * page/ScrollIntoViewOptions.idl: Added.
2081         * page/ScrollLogicalPosition.h: Added.
2082         * page/ScrollLogicalPosition.idl: Added.
2083
2084 2018-09-04  Oriol Brufau  <obrufau@igalia.com>
2085
2086         Check important flags when serializing shorthand with "initial" values
2087         https://bugs.webkit.org/show_bug.cgi?id=188984
2088
2089         Reviewed by Antti Koivisto.
2090
2091         Test: imported/w3c/web-platform-tests/css/cssom/shorthand-serialization.html
2092
2093         The test still has some failures due to https://bugs.webkit.org/show_bug.cgi?id=185953
2094         but without this patch it would fail earlier.
2095
2096         * css/StyleProperties.cpp:
2097         (WebCore::StyleProperties::get4Values const):
2098
2099 2018-09-04  Antti Koivisto  <antti@apple.com>
2100
2101         Remove pointless RenderSVGResourceMode::ApplyToDefault enum value
2102         https://bugs.webkit.org/show_bug.cgi?id=189260
2103
2104         Reviewed by Sam Weinig.
2105
2106         Default does not need a bit, it is better represented with an empty OptionSet.
2107
2108         * rendering/svg/RenderSVGResource.cpp:
2109         (WebCore::requestPaintingResource):
2110         * rendering/svg/RenderSVGResource.h:
2111         * rendering/svg/RenderSVGResourceClipper.cpp:
2112         (WebCore::RenderSVGResourceClipper::applyResource):
2113         * rendering/svg/RenderSVGResourceFilter.cpp:
2114         (WebCore::RenderSVGResourceFilter::applyResource):
2115         (WebCore::RenderSVGResourceFilter::postApplyResource):
2116         * rendering/svg/RenderSVGResourceGradient.cpp:
2117         (WebCore::RenderSVGResourceGradient::applyResource):
2118         * rendering/svg/RenderSVGResourceMasker.cpp:
2119         (WebCore::RenderSVGResourceMasker::applyResource):
2120         * rendering/svg/RenderSVGResourcePattern.cpp:
2121         (WebCore::RenderSVGResourcePattern::applyResource):
2122         (WebCore::RenderSVGResourcePattern::postApplyResource):
2123         * rendering/svg/RenderSVGResourceSolidColor.cpp:
2124         (WebCore::RenderSVGResourceSolidColor::applyResource):
2125         (WebCore::RenderSVGResourceSolidColor::postApplyResource):
2126         * rendering/svg/SVGInlineTextBox.cpp:
2127         (WebCore::SVGInlineTextBox::SVGInlineTextBox):
2128         (WebCore::SVGInlineTextBox::paintSelectionBackground):
2129         (WebCore::SVGInlineTextBox::paint):
2130         (WebCore::SVGInlineTextBox::acquirePaintingResource):
2131         (WebCore::SVGInlineTextBox::paintDecorationWithStyle):
2132         * rendering/svg/SVGRenderingContext.cpp:
2133         (WebCore::SVGRenderingContext::~SVGRenderingContext):
2134         (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
2135
2136 2018-08-29  Emilio Cobos Álvarez  <emilio@crisal.io>
2137
2138         Remove PseudoElementUserAgentCustom.
2139         https://bugs.webkit.org/show_bug.cgi?id=189089
2140
2141         Reviewed by Ryosuke Niwa.
2142
2143         Tests at https://github.com/web-platform-tests/wpt/pull/12743.
2144
2145         * css/CSSSelector.cpp:
2146         (WebCore::CSSSelector::pseudoId):
2147         (WebCore::CSSSelector::parsePseudoElementType):
2148         * css/CSSSelector.h:
2149         (WebCore::CSSSelector::isCustomPseudoElement const):
2150         * css/RuleSet.cpp:
2151         (WebCore::RuleSet::addRule):
2152         * css/parser/CSSParserSelector.h:
2153         (WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching const):
2154
2155 2018-09-04  Dean Jackson  <dino@apple.com>
2156
2157         Post review Weinig fix-ups
2158         https://bugs.webkit.org/show_bug.cgi?id=189288
2159
2160         Reviewed by Sam Weinig.
2161
2162         Fix-ups from https://bugs.webkit.org/show_bug.cgi?id=189252
2163
2164         * platform/MIMETypeRegistry.cpp:
2165         (WebCore::MIMETypeRegistry::getSystemPreviewMIMETypes):
2166         (WebCore::initializeSystemPreviewMIMETypes): Deleted.
2167         * rendering/RenderThemeIOS.mm:
2168         (WebCore::arKitBundle):
2169         (WebCore::loadARKitPDFPage):
2170         (WebCore::systemPreviewLogo):
2171
2172 2018-09-04  Ryosuke Niwa  <rniwa@webkit.org>
2173
2174         slotchange event doesn't get fired when inserting, removing, or renaming slot elements
2175         https://bugs.webkit.org/show_bug.cgi?id=189144
2176         <rdar://problem/43871061>
2177
2178         Reviewed by Antti Koivisto.
2179
2180         This patch implements `slotchange` event when a slot element is inserted, removed, or renamed in the DOM tree.
2181         Let us consider each scenario separately.
2182
2183         Insertion (https://dom.spec.whatwg.org/#concept-node-insert): In this case, we must fire `slotchange` event on
2184         slot elements whose assigned nodes have changed in the tree order. When there is at most one slot element for
2185         each name, this can be done by simply checking whether each slot has assigned nodes or not. When there are more
2186         than one slot element, however, the newly inserted slot element may now become the first slot of a given name,
2187         and gain assined nodes while the previously first element loses its assigned nodes. To see if the newly inserted
2188         slot element is the first of its kind, we must travere the DOM tree to check the order of that and the previously
2189         first slot element. To do this, we resolve the slot elements before start inserting nodes in
2190         executeNodeInsertionWithScriptAssertion via SlotAssignment::resolveSlotsBeforeNodeInsertionOrRemoval. Note that
2191         when the DOM tree has at most one slot element of its kind, resolveSlotsBeforeNodeInsertionOrRemoval is a no-op
2192         and addSlotElementByName continues to operate in O(1). Becasue addSlotElementByName is called on each inserted
2193         slot element in the tree order, we do the tree traversal upon finding the first slot element which has more than
2194         one of its kind in the current tree. In this case, we resolve all other slot elements and enqueues slotchange
2195         event as needed to avoid doing the tree traversal more than once.
2196
2197         Removal (https://dom.spec.whatwg.org/#concept-node-remove): In removal, we're concerned with removing the first
2198         slot element of its kind. We must fire slotchange event on the remaining slot elements which became the first of
2199         its kind after the removal as well as the ones which got removed from the tree if they had assigned nodes.
2200         Furthermore, the DOM specification mandates that we first fire slotchange events in the tree from which a node
2201         was removed and then in the removed subtree. Because we must only fire slotchange event on the first slot element
2202         of its kind which has been removed, we must resolve the first slot elements of each kind before a node removal
2203         in removeAllChildrenWithScriptAssertion and removeNodeWithScriptAssertion as we've done for insertion. Again,
2204         in the case there was at most one slot element of each kind, resolveSlotsBeforeNodeInsertionOrRemoval is a no-op
2205         and removeSlotElementByName would continue to operate in O(1). When there are multiple slot elements for a given
2206         kind, we immediately enqueue slotchange event on the slot elements which newly became the first of its kind but
2207         delay the enqueuing of slotchange event on the removed slot elements until removeSlotElementByName is called on
2208         that element so that enqueuing of slotchange events on the slot elements still remaining in the in the tree would
2209         happen before those which got removed as the DOM specification mandates.
2210
2211         Rename (https://dom.spec.whatwg.org/#shadow-tree-slots): In the case the slot element's name content attribute
2212         is changed, the renamed element might have become the first of its kind or ceased to be the first of its kind.
2213         There could be two other slot elements appearing later in the tree order which might have gained or lost assigned
2214         nodes as a result. In this case, we invoke the algorithms for removing & inserting the slot with a key difference:
2215         we enqueue slotchange event on the renamed slot immediately if it has assigned nodes.
2216
2217         To enqueue slotchange event in the tree order, this patch adds oldElement, which is a WeakPtr to a slot element,
2218         to SlotAssignment::Slot. This WeakPtr is set to the slot element which used to have assigned nodes prior to the
2219         node insertion, removal, or rename but no longer has after the mutation. This patch also adds a slot mutation
2220         version number, m_slotMutationVersion, which is incremented whenever a node is about to be inserted or removed,
2221         and slot resolution version, m_slotResolutionVersion, which is set to the current slot mutation version number
2222         when the full slot resolution is triggered during slot mutations. They are used to avoid redundant tree traversals
2223         in resolveSlotsAfterSlotMutation. This patch also makes m_needsToResolveSlotElements compiled in release builds
2224         to avoid resolving slot elements when there is at most one slot element of each kind.
2225
2226         For insertion, oldElement is set to the slot which used to be the first of its kind before getting set to a slot
2227         element being inserted in resolveSlotsAfterSlotMutation. We enqueue slotchange event on the newly inserted slot
2228         element at that point (1). Since the slot element which used to be the first of its kind appears after the newly
2229         inserted slot element by definition, we're guaranteed to see this oldElement later in the tree traversal upon
2230         which we enqueue slotchange event. Note that if this slot element was the first of its kind, then we're simply
2231         hitting (1), which is O(1) and does not invoke the tree traversal.
2232
2233         For removal, oldElement is set to the slot which used to be the first of its kind. Because this slot element is
2234         getting removed, slotchange event must be enqueud after slotchange events have been enqueued on all slot elements
2235         still remaining in the tree. To do this, we enqueue slotchange event immediately on the first slot element of
2236         its kind during the tree traversal as we encounter it (2), and set oldElement to the previosuly-first-but-removed
2237         slot element. slotchange event is enqueued on this slot element when removeSlotElementByName is later invoked via
2238         HTMLSlotElement::removedFromAncestor which traverses each removed element in the tree order. Again, if this was
2239         the last slot of its kind, we'd simply expedite (2) by enqueuing slotchange event during removeSlotElementByName,
2240         which is O(1).
2241
2242         When the DOM invokes the concept to replace all children (https://dom.spec.whatwg.org/#concept-node-replace-all),
2243         however, this algorithm isn't sufficient because the removal of each child happens one after another. We would
2244         either need to resolve slots between each removal, or treat the removal of all children as a single operation.
2245         While the DOM specification currently specifies the former behavior, this patch implements the latter behavior
2246         to avoid useless work. See the DOM spec issue: https://github.com/w3c/webcomponents/issues/764
2247
2248         Test: fast/shadow-dom/slotchange-for-slot-mutation.html
2249
2250         * dom/ContainerNode.cpp:
2251         (WebCore::ContainerNode::removeAllChildrenWithScriptAssertion): Call resolveSlotsBeforeNodeInsertionOrRemoval
2252         before start removing children.
2253         (WebCore::ContainerNode::removeNodeWithScriptAssertion): Ditto.
2254         (WebCore::executeNodeInsertionWithScriptAssertion): Ditto before inserting children.
2255         * dom/ShadowRoot.cpp:
2256         (WebCore::ShadowRoot::~ShadowRoot): Set m_hasBegunDeletingDetachedChildren to true. This flag is used to supress
2257         slotchange events during the shadow tree destruction.
2258         (WebCore::ShadowRoot::renameSlotElement): Added.
2259         (WebCore::ShadowRoot::removeSlotElementByName): Added oldParentOfRemovedTree as an argument.
2260         * dom/ShadowRoot.h:
2261         (WebCore::ShadowRoot::shouldFireSlotchangeEvent): Added.
2262         * dom/SlotAssignment.cpp:
2263         (WebCore::findSlotElement): Added.
2264         (WebCore::nextSlotElementSkippingSubtree): Added.
2265         (WebCore::SlotAssignment::hasAssignedNodes): Added. Returns true if the slot of a given name has assigned nodes.
2266         (WebCore::SlotAssignment::renameSlotElement): Added.
2267         (WebCore::SlotAssignment::addSlotElementByName): Call resolveSlotsAfterSlotMutation when slotchange event needs
2268         to be dispatched for the current slot and there are more than one slot elements.
2269         (WebCore::SlotAssignment::removeSlotElementByName): Ditto. When the slot's oldElement is set to the current slot
2270         element, meaning that this slot element used to have assigned nodes, then enqueue slotchange event. It also has
2271         a special case for oldParentOfRemovedTree is null when renaming a slot element. In this case, we want to enqueue
2272         slot change event immediately on the renamed slot element and any affected elements as in a node insertion since
2273         removeSlotElementByName would never be called on a slot element which newly become the first of its kind after
2274         a slot rename.
2275         (WebCore::SlotAssignment::resolveSlotsAfterSlotMutation): Added. This is the slot resolution algorithm invoked
2276         when there are more than one slot elements for a given name. It has two modes dealing with insertion & removal.
2277         The insertion mode is also used for renaming a slot element. The firs
2278         (WebCore::SlotAssignment::resolveSlotsBeforeNodeInsertionOrRemoval): Added. Resolves all slot elements prior to
2279         inserting or removing nodes. In many cases, this should be a no-op since m_needsToResolveSlotElements is set to
2280         true only when there are more than one slot element of its kind.
2281         (WebCore::SlotAssignment::willRemoveAllChildren): Ditto. Also sets m_willBeRemovingAllChildren to true.
2282         (WebCore::SlotAssignment::didChangeSlot):
2283         (WebCore::SlotAssignment::resolveAllSlotElements): Use seenFirstElement instead of element to indicate whether
2284         we have seen a slot element of given name for consistency with resolveSlotsAfterSlotMutation.
2285         * dom/SlotAssignment.h:
2286         (WebCore::SlotAssignment::Slot): Added oldElement and seenFirstElement.
2287         (WebCore::SlotAssignment): Always compile m_needsToResolveSlotElements. Added m_willBeRemovingAllChildren,
2288         m_slotMutationVersion, and m_slotResolutionVersion.
2289         (WebCore::ShadowRoot::resolveSlotsBeforeNodeInsertionOrRemoval): Added. Calls the one in SlotAssignment.
2290         (WebCore::ShadowRoot::willRemoveAllChildren): Ditto.
2291         * html/HTMLSlotElement.cpp:
2292         (WebCore::HTMLSlotElement::removedFromAncestor):
2293         (WebCore::HTMLSlotElement::attributeChanged): Calls ShadowRoot::renameSlotElement instead of
2294         removeSlotElementByName and addSlotElementByName pair.
2295
2296 2018-09-04  Youenn Fablet  <youenn@apple.com>
2297
2298         Make LibWebRTCRtpSenderBackend own its libwebrtc RTP sender backend
2299         https://bugs.webkit.org/show_bug.cgi?id=189270
2300
2301         Reviewed by Eric Carlson.
2302
2303         Previously, the libwebrtc senders were owned in LibWebRTCMediaEndpoint.
2304         This patch makes them be owned by LibWebRTCRtpSenderBackend.
2305         This simplifies the implementation of RTCRtpSender::getParameters.
2306         This will help simplify the implementation of RTCRtpSender::replaceTrack.
2307
2308         removeTrack is also refactored so that LibWebRTCMediaEndpoint directly uses libwebrtc constructs and not WebCore libwebrtc-agnostic ones.
2309
2310         No change of behavior.
2311
2312         * Modules/mediastream/PeerConnectionBackend.h:
2313         (WebCore::PeerConnectionBackend::removeTrack):
2314         (WebCore::PeerConnectionBackend::notifyRemovedTrack): Deleted.
2315         * Modules/mediastream/RTCPeerConnection.cpp:
2316         (WebCore::RTCPeerConnection::removeTrack):
2317         * Modules/mediastream/RTCRtpSender.cpp:
2318         (WebCore::RTCRtpSender::getParameters):
2319         * Modules/mediastream/RTCRtpSender.h:
2320         (WebCore::RTCRtpSender::backend):
2321         * Modules/mediastream/RTCRtpSenderBackend.h:
2322         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2323         (WebCore::LibWebRTCMediaEndpoint::addTrack):
2324         (WebCore::LibWebRTCMediaEndpoint::removeTrack):
2325         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
2326         (WebCore::LibWebRTCMediaEndpoint::stop):
2327         (WebCore::LibWebRTCMediaEndpoint::shouldOfferAllowToReceiveAudio const): Deleted.
2328         (WebCore::LibWebRTCMediaEndpoint::shouldOfferAllowToReceiveVideo const): Deleted.
2329         (WebCore::LibWebRTCMediaEndpoint::getRTCRtpSenderParameters): Deleted.
2330         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2331         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2332         (WebCore::backendFromRTPSender):
2333         (WebCore::LibWebRTCPeerConnectionBackend::addTrack):
2334         (WebCore::LibWebRTCPeerConnectionBackend::addTransceiver):
2335         (WebCore::LibWebRTCPeerConnectionBackend::removeTrack):
2336         (WebCore::LibWebRTCPeerConnectionBackend::shouldOfferAllowToReceive const):
2337         (WebCore::LibWebRTCPeerConnectionBackend::notifyRemovedTrack): Deleted.
2338         (WebCore::LibWebRTCPeerConnectionBackend::getParameters const): Deleted.
2339         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2340         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
2341         (WebCore::LibWebRTCRtpSenderBackend::getParameters const):
2342         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
2343
2344 2018-09-04  Wenson Hsieh  <wenson_hsieh@apple.com>
2345
2346         Populate "text/uri-list" with multiple URLs when the pasteboard contains multiple URLs
2347         https://bugs.webkit.org/show_bug.cgi?id=188890
2348         <rdar://problem/43648605>
2349
2350         Reviewed by Tim Horton.
2351
2352         Adds support for exposing a newline separated list of URLs via DataTransfer's "text/uri-list" type when pasting
2353         or dropping multiple items on the pasteboard that can be represented as URLs. Currently on iOS, only the URL of
2354         the first item (if present) is exposed, and on macOS, only the first out of all the URLs in the pasteboard is
2355         exposed.
2356
2357         To fix this, we introduce `Pasteboard::readAllStrings`, which reads a list of pasteboard strings collected from
2358         all available items on the platform pasteboard. Currently, this is only used to provide a list of URL strings
2359         when fetching data for the "text/uri-list" type when calling `DataTransfer.getData()` and
2360         `DataTransferItem.getAsString()`.
2361
2362         Tests:  DragAndDropTests.ExposeMultipleURLsInDataTransfer
2363                 UIPasteboardTests.DataTransferURIListContainsMultipleURLs
2364                 PasteMixedContent.PasteOneOrMoreURLs
2365
2366         * dom/DataTransfer.cpp:
2367         (WebCore::readURLsFromPasteboardAsString):
2368
2369         Add a helper method that reads all URL strings from the pasteboard (for the MIME type "text/uri-list", which
2370         corresponds to NSURLPboardType and "public.url" on macOS and iOS, respectively) and returns a single string
2371         containing all non-empty URLs joined by newline characters. Also takes a filtering block which may be used to
2372         reject URLs from being included in "text/uri-list" output.
2373
2374         (WebCore::DataTransfer::getDataForItem const):
2375         (WebCore::DataTransfer::readStringFromPasteboard const):
2376
2377         Insteading of reading a single string from the pasteboard for "text/uri-list", call the above helper function to
2378         read all URL strings in the pasteboard. If there are files present in the pasteboard, we also filter out URLs
2379         whose schemes are not in the set of schemes that are safe to expose to the page (i.e. http(s), blob, and data).
2380
2381         * platform/Pasteboard.cpp:
2382         (WebCore::Pasteboard::readAllStrings):
2383
2384         Add a default non-Cocoa implementation of readAllStrings() that returns a vector, which may contain the result
2385         of readString().
2386
2387         * platform/Pasteboard.h:
2388         * platform/PasteboardStrategy.h:
2389         * platform/PlatformPasteboard.h:
2390
2391         Add plumbing to grab a list of strings from the pasteboard for a given type.
2392
2393         * platform/cocoa/PasteboardCocoa.mm:
2394         (WebCore::Pasteboard::readAllStrings):
2395         (WebCore::Pasteboard::readString):
2396
2397         Implement these two methods in terms of `readPlatformValuesAsStrings`. `readAllStrings` returns the full list of
2398         results, while `readString` only returns the first result.
2399
2400         * platform/ios/PasteboardIOS.mm:
2401         (WebCore::Pasteboard::readPlatformValuesAsStrings):
2402         (WebCore::Pasteboard::readPlatformValueAsString): Deleted.
2403
2404         Refactor this Cocoa helper function to return a list of pasteboard string values for the given type, rather than
2405         a single string.
2406
2407         * platform/ios/PlatformPasteboardIOS.mm:
2408         (WebCore::PlatformPasteboard::allStringsForType const):
2409
2410         Grab a string for each item (represented by an NSItemProvider) in the pasteboard that has data for the given
2411         type identifier.
2412
2413         (WebCore::PlatformPasteboard::readString const):
2414
2415         Return the absolute string of the NSURL, instead of WebCore::URL::string(). This is needed to handle the case
2416         where the NSURL is constructed from absolute and relative parts using a Plist. While -absoluteString gets us the
2417         full URL string, URL::string() only returns the relative portion.
2418
2419         * platform/mac/PasteboardMac.mm:
2420         (WebCore::Pasteboard::readPlatformValuesAsStrings):
2421         (WebCore::Pasteboard::readPlatformValueAsString): Deleted.
2422
2423         Also refactor this to retrieve a list of pasteboard strings, rather than a single result.
2424
2425         * platform/mac/PlatformPasteboardMac.mm:
2426         (WebCore::typeIdentifierForPasteboardType):
2427         (WebCore::PlatformPasteboard::allStringsForType const):
2428
2429         Add an implementation for `allStringsForType` on macOS. Unlike iOS, it's much trickier to get this right since
2430         we need to maintain compatibility with legacy "NS*Pboard" types, and `NSPasteboardItem` can only provide data
2431         for `NSPasteboardType`s (i.e. UTIs), so there's no way to just iterate through each pasteboard item and ask it
2432         for data that matches the given type, if the types are not UTIs. However, in the case where we have multiple
2433         items, the client must have used NSPasteboardWriting-conformant objects and/or NSPasteboardItem itself to write
2434         data to the pasteboard. Since NSPasteboardWriting-conformant objects register modern pasteboard types when
2435         writing to the pasteboard, we can simply iterate over these pasteboard items and ask for property lists using
2436         type identifiers instead of having to worry about legacy pasteboard types. Furthermore, in the case where there
2437         is only a single item in the pasteboard and we do need to handle legacy pasteboard types, using `-[NSPasteboard
2438         stringForType:]` in the same way we do currently should yield the correct result.
2439
2440         As such, in the case where there is a single pasteboard item, we use `-[NSPasteboard stringForType:]` with the
2441         original legacy type, and in the case where there are multiple items on the pasteboard, we iterate over each of
2442         the pasteboard items and call `-[NSPasteboardItem propertyListForType:]` with the modern pasteboard type
2443         corresponding to the given legacy pasteboard type.
2444
2445         The different corner cases in this logic are tested by the new API test, PasteMixedContent.PasteOneOrMoreURLs,
2446         which exercises several different ways of writing one or more URLs to the pasteboard on macOS, which each result
2447         in different legacy and modern pasteboard types being written to the pasteboard; our implementation of
2448         `PlatformPasteboard::allStringsForType` on macOS handles all cases correctly.
2449
2450 2018-09-04  Simon Fraser  <simon.fraser@apple.com>
2451
2452         CSS reference filter that references a tiled feTurbulence is blank
2453         https://bugs.webkit.org/show_bug.cgi?id=188950
2454
2455         Reviewed by Dean Jackson.
2456         
2457         We need to run the code that was in RenderSVGResourceFilterPrimitive::determineFilterPrimitiveSubregion()
2458         for CSS reference filters, to set up the various rects in the filter effects.
2459         
2460         Do this by moving the code to FilterEffect::determineFilterPrimitiveSubregion(), which makes sense
2461         because it recurses on the FilterEffect input chain. To make it CSS/SVGFilter agnostic, we move filterRegionInUserSpace()
2462         to the Filter base class (for CSSFilter, it just returns m_filterRegion).
2463
2464         Test: css3/filters/reference-filter-set-filter-regions.html
2465
2466         * platform/graphics/filters/Filter.h:
2467         * platform/graphics/filters/FilterEffect.cpp:
2468         (WebCore::FilterEffect::determineFilterPrimitiveSubregion):
2469         * platform/graphics/filters/FilterEffect.h:
2470         * rendering/CSSFilter.cpp:
2471         (WebCore::CSSFilter::determineFilterPrimitiveSubregion):
2472         * rendering/CSSFilter.h:
2473         * rendering/RenderLayerFilters.cpp:
2474         (WebCore::RenderLayerFilters::beginFilterEffect):
2475         * rendering/svg/RenderSVGResourceFilter.cpp:
2476         (WebCore::RenderSVGResourceFilter::applyResource):
2477         * rendering/svg/RenderSVGResourceFilterPrimitive.cpp:
2478         (WebCore::RenderSVGResourceFilterPrimitive::determineFilterPrimitiveSubregion): Deleted.
2479         * rendering/svg/RenderSVGResourceFilterPrimitive.h:
2480         * svg/graphics/filters/SVGFilter.h:
2481
2482 2018-09-04  Zalan Bujtas  <zalan@apple.com>
2483
2484         [LFC] Rename LayoutPair to BoxPair
2485         https://bugs.webkit.org/show_bug.cgi?id=189276
2486
2487         Reviewed by Antti Koivisto.
2488
2489         * layout/FormattingContext.h:
2490         * layout/blockformatting/BlockFormattingContext.cpp:
2491         (WebCore::Layout::BlockFormattingContext::layout const):
2492
2493 2018-09-04  Youenn Fablet  <youenn@apple.com>
2494
2495         Disable WebRTC unified plan runtime flag by default
2496         https://bugs.webkit.org/show_bug.cgi?id=189264
2497
2498         Reviewed by Jer Noble.
2499
2500         Covered by existing tests.
2501
2502         * testing/Internals.cpp:
2503         (WebCore::Internals::resetToConsistentState):
2504         Activate unified plan for testing.
2505
2506 2018-09-04  Zalan Bujtas  <zalan@apple.com>
2507
2508         [LFC][BFC] Merge computeInFlowWidth(Height)AndMargin and computeFloatingWidth(Height)AndMargin.
2509         https://bugs.webkit.org/show_bug.cgi?id=189271
2510
2511         Reviewed by Antti Koivisto.
2512
2513         This is in preparation for adding min/max-widht(height).
2514
2515         * layout/FormattingContext.cpp:
2516         (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const): Deleted.
2517         (WebCore::Layout::FormattingContext::computeFloatingWidthAndMargin const): Deleted.
2518         * layout/FormattingContext.h:
2519         * layout/blockformatting/BlockFormattingContext.cpp:
2520         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
2521         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
2522         (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const): Deleted.
2523         (WebCore::Layout::BlockFormattingContext::computeInFlowWidthAndMargin const): Deleted.
2524         * layout/blockformatting/BlockFormattingContext.h:
2525
2526 2018-09-04  Rob Buis  <rbuis@igalia.com>
2527
2528         Adjust XMLHttpRequest username/password precedence rules
2529         https://bugs.webkit.org/show_bug.cgi?id=184910
2530
2531         Reviewed by Chris Dumez.
2532
2533         Steps 9.1 and 9.2 in the XMLHTTPRequest::open [1] algorithm
2534         specify that non null user or non null password ought
2535         to be set on the URL, so implement this.
2536
2537         Behavior matches Firefox and Chrome.
2538
2539         [1] https://xhr.spec.whatwg.org/#dom-xmlhttprequest-open
2540
2541         Test: xhr/send-authentication-competing-names-passwords.htm
2542
2543         * xml/XMLHttpRequest.cpp:
2544         (WebCore::XMLHttpRequest::open):
2545
2546 2018-09-04  Simon Fraser  <simon.fraser@apple.com>
2547
2548         Simplify RenderLayer filter code
2549         https://bugs.webkit.org/show_bug.cgi?id=189248
2550
2551         Reviewed by Dean Jackson.
2552         
2553         Painting filters in RenderLayer involved the confusingly named RenderLayer::FilterInfo,
2554         and FilterEffectRenderer/FilterEffectRendererHelper. Reduce confusion by just collapsing
2555         these together into RenderLayerFilters. RenderLayerFilters stores a reference to the
2556         CSSFilter, and knows how to set it up, and vend a GraphicsContext* for painting the content
2557         to be filtered.
2558         
2559         It's also simpler to just give RenderLayer a member variable for RenderLayerFilters, rather
2560         than using a side hash (we can recoup the space in other ways layer).
2561
2562         * Sources.txt:
2563         * WebCore.xcodeproj/project.pbxproj:
2564         * css/CSSFilterImageValue.cpp:
2565         * rendering/CSSFilter.h:
2566         * rendering/FilterEffectRenderer.cpp: Removed.
2567         * rendering/FilterEffectRenderer.h: Removed.
2568         * rendering/RenderLayer.cpp:
2569         (WebCore::RenderLayer::RenderLayer):
2570         (WebCore::RenderLayer::~RenderLayer):
2571         (WebCore::RenderLayer::paintsWithFilters const):
2572         (WebCore::RenderLayer::requiresFullLayerImageForFilters const):
2573         (WebCore::RenderLayer::setFilterBackendNeedsRepaintingInRect):
2574         (WebCore::RenderLayer::filtersForPainting const):
2575         (WebCore::RenderLayer::setupFilters):
2576         (WebCore::RenderLayer::applyFilters):
2577         (WebCore::RenderLayer::paintLayerContents):
2578         (WebCore::RenderLayer::calculateClipRects const):
2579         (WebCore::RenderLayer::filter const): Deleted.
2580         (WebCore::RenderLayer::filterPainter const): Deleted.
2581         (WebCore::RenderLayer::hasFilterThatIsPainting const): Deleted.
2582         * rendering/RenderLayer.h:
2583         * rendering/RenderLayerFilterInfo.cpp: Removed.
2584         * rendering/RenderLayerFilters.cpp: Added.
2585         (WebCore::RenderLayerFilters::RenderLayerFilters):
2586         (WebCore::RenderLayerFilters::~RenderLayerFilters):
2587         (WebCore::RenderLayerFilters::setFilter):
2588         (WebCore::RenderLayerFilters::hasFilterThatMovesPixels const):
2589         (WebCore::RenderLayerFilters::hasFilterThatShouldBeRestrictedBySecurityOrigin const):
2590         (WebCore::RenderLayerFilters::notifyFinished):
2591         (WebCore::RenderLayerFilters::updateReferenceFilterClients):
2592         (WebCore::RenderLayerFilters::removeReferenceFilterClients):
2593         (WebCore::RenderLayerFilters::buildFilter):
2594         (WebCore::RenderLayerFilters::beginFilterEffect):
2595         (WebCore::RenderLayerFilters::applyFilterEffect):
2596         * rendering/RenderLayerFilters.h: Renamed from Source/WebCore/rendering/RenderLayerFilterInfo.h.
2597
2598 2018-09-04  Dean Jackson  <dino@apple.com>
2599
2600         Build fix.
2601
2602         * testing/Internals.cpp:
2603
2604 2018-09-03  Dean Jackson  <dino@apple.com>
2605
2606         Move SystemPreview code from WebKitAdditions to WebKit
2607         https://bugs.webkit.org/show_bug.cgi?id=189252
2608         <rdar://problem/44080245>
2609
2610         Reviewed by Wenson Hsieh.
2611
2612         Move the WebKitAdditions code into WebKit/WebCore.
2613
2614         * html/HTMLAnchorElement.cpp:
2615         (WebCore::HTMLAnchorElement::relList const): Look for "ar".
2616         (WebCore::HTMLAnchorElement::isSystemPreviewLink const): Ditto.
2617
2618         * platform/MIMETypeRegistry.cpp: Add a couple of new static methods
2619         for System Preview MIME types.
2620         (WebCore::initializeSystemPreviewMIMETypes):
2621         (WebCore::MIMETypeRegistry::getSystemPreviewMIMETypes):
2622         (WebCore::MIMETypeRegistry::isSystemPreviewMIMEType):
2623         * platform/MIMETypeRegistry.h:
2624
2625         * rendering/RenderThemeIOS.mm: Load the ARKit artwork from the framework.
2626         (WebCore::arKitBundle):
2627         (WebCore::loadARKitPDFPage):
2628         (WebCore::systemPreviewLogo):
2629         (WebCore::RenderThemeIOS::paintSystemPreviewBadge):
2630
2631         * testing/Internals.cpp: Remove internal helper.
2632         (WebCore::Internals::systemPreviewRelType): Deleted.
2633         * testing/Internals.h:
2634         * testing/Internals.idl:
2635
2636 2018-09-04  Andy Estes  <aestes@apple.com>
2637
2638         [Payment Request] PaymentResponse should have an onpayerdetailchange event handler
2639         https://bugs.webkit.org/show_bug.cgi?id=189249
2640
2641         Reviewed by Alex Christensen.
2642
2643         Implemented the onpayerdetailchange event handler as defined in the Payment Request API W3C Editor's Draft of 30 August 2018.
2644
2645         The "payer detail changed" algorithm will be implemented in a follow-up patch.
2646
2647         Covered by existing web platform tests.
2648
2649         * Modules/paymentrequest/PaymentResponse.cpp:
2650         (WebCore::PaymentResponse::scriptExecutionContext const):
2651         * Modules/paymentrequest/PaymentResponse.h:
2652         * Modules/paymentrequest/PaymentResponse.idl:
2653         * dom/EventNames.h:
2654         * dom/EventTargetFactory.in:
2655
2656 2018-09-04  Youenn Fablet  <youenn@apple.com>
2657
2658         Introduce LibWebRTC backends for sender and receiver
2659         https://bugs.webkit.org/show_bug.cgi?id=189171
2660
2661         Reviewed by Alejandro G. Castro.
2662
2663         Rename RTCRtpSender::Backend to RTCRtpSenderBackend, ditto for RTCRtpReceiver::Backend.
2664         Make RTCRtpSender/RTCRtpReceiver own their backend.
2665         This will allow the backends to own a libwebrtc sender/receiver ref counted object
2666         and might allow us to cleanly separate code from unified plan vs plan B.
2667
2668         Update code so that libwebrtc code specific code is now creating senders and receivers.
2669         This moves code from RTCPeerConnection down to LibWebRTCPeerConnectionBackend, in particular for
2670         addTrack and addTransceiver methods.
2671
2672         Moved some code from LibWebRTCMediaEndpoint to LibWebRTCUtils to ease readability.
2673
2674         A future patch will allow to tie the libwebrtc sender/receiver to WebKit DOM sender/receiver.
2675
2676         Covered by existing tests.
2677
2678         * Modules/mediastream/PeerConnectionBackend.cpp:
2679         (WebCore::PeerConnectionBackend::addTrack):
2680         (WebCore::PeerConnectionBackend::addTransceiver):
2681         * Modules/mediastream/PeerConnectionBackend.h:
2682         * Modules/mediastream/RTCPeerConnection.cpp:
2683         (WebCore::RTCPeerConnection::addTrack):
2684         (WebCore::RTCPeerConnection::addTransceiver):
2685         (WebCore::RTCPeerConnection::enqueueReplaceTrackTask):
2686         * Modules/mediastream/RTCPeerConnection.h:
2687         * Modules/mediastream/RTCRtpReceiver.cpp:
2688         (WebCore::RTCRtpReceiver::RTCRtpReceiver):
2689         * Modules/mediastream/RTCRtpReceiver.h:
2690         (WebCore::RTCRtpReceiver::create):
2691         (WebCore::RTCRtpReceiver::setBackend):
2692         * Modules/mediastream/RTCRtpReceiverBackend.h: Added.
2693         (WebCore::RTCRtpReceiverBackend::getParameters):
2694         * Modules/mediastream/RTCRtpSender.cpp:
2695         (WebCore::RTCRtpSender::create):
2696         (WebCore::RTCRtpSender::RTCRtpSender):
2697         * Modules/mediastream/RTCRtpSender.h:
2698         * Modules/mediastream/RTCRtpSenderBackend.h: Added.
2699         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2700         (WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
2701         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2702         (WebCore::LibWebRTCPeerConnectionBackend::videoReceiver):
2703         (WebCore::LibWebRTCPeerConnectionBackend::audioReceiver):
2704         (WebCore::LibWebRTCPeerConnectionBackend::addTrack):
2705         (WebCore::LibWebRTCPeerConnectionBackend::addTransceiver):
2706         (WebCore::LibWebRTCPeerConnectionBackend::completeAddTransceiver):
2707         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2708         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.cpp: Added.
2709         (WebCore::LibWebRTCRtpReceiverBackend::getParameters):
2710         * Modules/mediastream/libwebrtc/LibWebRTCRtpReceiverBackend.h: Added.
2711         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp: Added.
2712         (WebCore::LibWebRTCRtpSenderBackend::replaceTrack):
2713         (WebCore::LibWebRTCRtpSenderBackend::getParameters const):
2714         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h: Added.
2715         * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp: Added.
2716         (WebCore::fillEncodingParameters):
2717         (WebCore::fillHeaderExtensionParameters):
2718         (WebCore::fillCodecParameters):
2719         (WebCore::fillRtpParameters):
2720         * Modules/mediastream/libwebrtc/LibWebRTCUtils.h: Added.
2721         (WebCore::fromStdString):
2722         * WebCore.xcodeproj/project.pbxproj:
2723
2724 2018-09-04  Antoine Quint  <graouts@apple.com>
2725
2726         [Modern Media Controls] Disabling both fullscreen and picture-in-picture shows an empty top left container
2727         https://bugs.webkit.org/show_bug.cgi?id=189259
2728         <rdar://problem/42026625>
2729
2730         Reviewed by Dean Jackson.
2731
2732         Test: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-disabled-fullscreen-and-pip.html
2733
2734         Ensure the top left controls bar is hidden when none of its children are visible.
2735
2736         * Modules/modern-media-controls/controls/inline-media-controls.js:
2737         (InlineMediaControls.prototype.layout):
2738
2739 2018-09-04  Daniel Bates  <dabates@apple.com>
2740
2741         Attempt to fix failing tests following r235615 (https://bugs.webkit.org/show_bug.cgi?id=187925)
2742
2743         An inline text box that does not have combined text and contains a single character
2744         should be considered as having text content.
2745
2746         * rendering/InlineTextBox.cpp:
2747         (WebCore::InlineTextBox::hasTextContent const):
2748
2749 2018-09-04  Per Arne Vollan  <pvollan@apple.com>
2750
2751         Add test for fix in https://bugs.webkit.org/show_bug.cgi?id=187922
2752         https://bugs.webkit.org/show_bug.cgi?id=187925
2753
2754         Reviewed by Simon Fraser.
2755
2756         This will test that the function primaryScreenDisplayID() returns a valid display ID.
2757
2758         Test: fast/misc/valid-primary-screen-displayID.html
2759
2760         * platform/PlatformScreen.h:
2761         * platform/mac/PlatformScreenMac.mm:
2762         (WebCore::primaryScreenDisplayID):
2763         * testing/Internals.cpp:
2764         (WebCore::Internals::primaryScreenDisplayID):
2765         * testing/Internals.h:
2766         * testing/Internals.idl:
2767
2768 2018-09-04  Daniel Bates  <dabates@apple.com>
2769
2770         Add helper function to create a potential CORS request
2771         https://bugs.webkit.org/show_bug.cgi?id=189251
2772
2773         Reviewed by Andy Estes.
2774
2775         Add a new function, createPotentialAccessControlRequest, that we will use to implement the algorithm Create a potential-
2776         CORS request from the HTML standard: <https://html.spec.whatwg.org/multipage/urls-and-fetching.html#create-a-potential-cors-request> (31 August 2018).
2777         This function replaces CachedResourceRequest::setAsPotentiallyCrossOrigin() and is the first step towards separating
2778         the concepts of CORS settings states and module script credentials mode as well as implementing the aforementioned
2779         algorithm. Rename CachedResourceRequest::setAsPotentiallyCrossOrigin() to deprecatedSetAsPotentiallyCrossOrigin()
2780         and switch existing callers to use createPotentialAccessControlRequest(). For now, createPotentialAccessControlRequest()
2781         is implemented in terms of deprecatedSetAsPotentiallyCrossOrigin().
2782
2783         No functionality changed. So, no new tests.
2784
2785         * bindings/js/CachedScriptFetcher.cpp:
2786         (WebCore::CachedScriptFetcher::requestScriptWithCache const): Write in terms of WebCore::createPotentialAccessControlRequest().
2787         * html/HTMLLinkElement.cpp:
2788         (WebCore::HTMLLinkElement::process): Ditto.
2789         * html/parser/HTMLResourcePreloader.cpp:
2790         (WebCore::PreloadRequest::resourceRequest): Ditto.
2791         * loader/CrossOriginAccessControl.cpp:
2792         (WebCore::createPotentialAccessControlRequest): For now, implemented in terms of CachedResourceRequest::deprecatedSetAsPotentiallyCrossOrigin().
2793         * loader/CrossOriginAccessControl.h:
2794         * loader/ImageLoader.cpp:
2795         (WebCore::ImageLoader::updateFromElement): Write in terms of WebCore::createPotentialAccessControlRequest().
2796         * loader/LinkLoader.cpp:
2797         (WebCore::LinkLoader::preloadIfNeeded): Ditto.
2798         * loader/MediaResourceLoader.cpp:
2799         (WebCore::MediaResourceLoader::requestResource): Ditto. Also renamed local variable cacheRequest to cachedRequest.
2800         * loader/TextTrackLoader.cpp:
2801         (WebCore::TextTrackLoader::load): Write in terms of WebCore::createPotentialAccessControlRequest(). Also change local variable
2802         document from a pointer to a reference since this function asserts that the script execution context is a non-null Document.
2803         * loader/cache/CachedResourceRequest.cpp:
2804         (WebCore::CachedResourceRequest::deprecatedSetAsPotentiallyCrossOrigin): Renamed; formerly named setAsPotentiallyCrossOrigin.
2805         (WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin): Deleted.
2806         * loader/cache/CachedResourceRequest.h:
2807         (WebCore::CachedResourceRequest::setPriority): Added.
2808
2809 2018-09-04  Daniel Bates  <dabates@apple.com>
2810
2811         Remove redundant inline text boxes for empty combined text
2812         https://bugs.webkit.org/show_bug.cgi?id=189119
2813
2814         Reviewed by Zalan Bujtas.
2815
2816         We should consider inline text boxes that have a combined text renderer (RenderCombineText)
2817         whose composed string is empty as "redundant" just as we do for inline text boxes that have
2818         a non-combined text renderer that have zero length so that we remove them. Such boxes are
2819         visibly empty and do not take up space visually. By removing them we reduce memory and make
2820         it easier to reason about the line box tree.
2821
2822         Currently RenderBlockFlow::computeBlockDirectionPositionsForLine() tests if an inline text
2823         box is empty by checking if it has a zero length (InlineTextBox::len()). However an inline
2824         text box associated with a RenderCombineText always has length 1 regardless of whether the
2825         composed string it represents is the empty string. Instead we should expose a way to check
2826         if an inline text box is visually empty and have RenderBlockFlow::computeBlockDirectionPositionsForLine()
2827         query the inline text box for this answer.
2828
2829         * rendering/InlineTextBox.cpp:
2830         (WebCore::InlineTextBox::hasTextContent const): Added. Returns whether an inline text box
2831         has text content. We do not need to consider hypenation since hypens are an embellishment (i.e.
2832         they are not part of the markup of the page).
2833         (WebCore::InlineTextBox::paint): Write in terms of hasTextContent().
2834         (WebCore::InlineTextBox::subdivideAndResolveStyle): Assert that WebCore::subdivide() always
2835         returns a non-empty list of subdivisions. A non-empty text box should always have at least
2836         one subdivision, say for the unmarked text. I left the existing conditonal (though marked
2837         it as UNLIKELY()) so as to be forgiving and avoid a bad user experience should WebCore::subdivide()
2838         return an empty vector in a non-debug build.
2839         * rendering/InlineTextBox.h:
2840         * rendering/RenderBlockLineLayout.cpp:
2841         (WebCore::RenderBlockFlow::computeBlockDirectionPositionsForLine): Write in terms of InlineTextBox::hasTextContent()
2842         so that we remove empty inline text boxes associated with combined text.
2843         * rendering/RenderText.cpp:
2844         (WebCore::RenderText::positionLineBox): Write in terms of InlineTextBox::hasTextContent().
2845
2846 2018-09-04  Zan Dobersek  <zdobersek@igalia.com> and Ms2ger  <Ms2ger@igalia.com>
2847
2848         Implement support for passing ImageBitmap to texImage2D/texSubImage2D
2849         https://bugs.webkit.org/show_bug.cgi?id=187584
2850
2851         Reviewed by Dean Jackson.
2852
2853         Test: fast/canvas/webgl/gl-teximage-imagebitmap.html
2854
2855         * html/canvas/WebGL2RenderingContext.h: Update union type definition.
2856         * html/canvas/WebGL2RenderingContext.idl: Update union type definition.
2857         * html/canvas/WebGLRenderingContext.idl: Update union type definition.
2858         * html/canvas/WebGLRenderingContextBase.cpp:
2859         (WebCore::WebGLRenderingContextBase::texSubImage2D): implement.
2860         (WebCore::WebGLRenderingContextBase::texImage2D): implement.
2861         * html/canvas/WebGLRenderingContextBase.h: Update union type definition; add to TexFuncValidationSourceType.
2862         * html/canvas/WebGLRenderingContextBase.idl: Remove unused union type definition.
2863
2864 2018-09-04  Yacine Bandou  <yacine.bandou_ext@softathome.com>
2865
2866         [EME] Add the WebM initData support in ClearKey CDM
2867         https://bugs.webkit.org/show_bug.cgi?id=189240
2868
2869         Reviewed by Xabier Rodriguez-Calvar.
2870
2871         Add the "webm" initDataType support in ClearKey CDM.
2872         Read the WebM initData by following the W3C spec https://www.w3.org/TR/eme-initdata-webm/#common-system,
2873         and put it in JSON object format like is specified in https://www.w3.org/TR/encrypted-media/#clear-key-request-format.
2874
2875         Tests: media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse.html
2876                media/encrypted-media/clearKey/clearKey-webm-video-playback-mse.html
2877
2878         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
2879         (WebCore::extractKeyIdFromWebMInitData):
2880         (WebCore::CDMPrivateClearKey::supportsInitDataType const):
2881         (WebCore::CDMPrivateClearKey::supportsInitData const):
2882         (WebCore::CDMInstanceClearKey::requestLicense):
2883
2884 2018-09-03  Andy Estes  <aestes@apple.com>
2885
2886         [Payment Request] Remove PaymentAddress.languageCode
2887         https://bugs.webkit.org/show_bug.cgi?id=189254
2888
2889         Reviewed by Sam Weinig.
2890
2891         PaymentAddress.languageCode is marked as "at risk" in the latest Payment Request Editor's
2892         Draft (30 August 2018). Firefox has already removed it, and Chrome is considering it.
2893
2894         There is some compatibility risk in removing this attribute, but considering we never
2895         populated it with a meaningful value, the risk seems very low. If we learn about
2896         compatibility problems, we can address them by evangelising or even reverting this change.
2897
2898         Updated existing tests.
2899
2900         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
2901         (WebCore::convert):
2902         * Modules/paymentrequest/PaymentAddress.cpp:
2903         (WebCore::PaymentAddress::PaymentAddress):
2904         * Modules/paymentrequest/PaymentAddress.h:
2905         * Modules/paymentrequest/PaymentAddress.idl:
2906
2907 2018-09-03  Andy Estes  <aestes@apple.com>
2908
2909         [Payment Request] Add a stub for PaymentResponse.retry
2910         https://bugs.webkit.org/show_bug.cgi?id=189253
2911
2912         Reviewed by Sam Weinig.
2913
2914         Implemented the AddressErrors, PayerErrorFields, and PaymentValidationErrors dictionaries as
2915         defined in the Payment Request API W3C Editor's Draft of 30 August 2018.
2916
2917         Also added a stub implementation of PaymentResponse.retry. This method will be implemented
2918         with tests in a follow-up patch.
2919
2920         * CMakeLists.txt:
2921         * DerivedSources.make:
2922         * Modules/paymentrequest/AddressErrors.h: Added.
2923         * Modules/paymentrequest/AddressErrors.idl: Added.
2924         * Modules/paymentrequest/PayerErrorFields.h: Added.
2925         * Modules/paymentrequest/PayerErrorFields.idl: Added.
2926         * Modules/paymentrequest/PaymentResponse.cpp:
2927         (WebCore::PaymentResponse::retry):
2928         * Modules/paymentrequest/PaymentResponse.h:
2929         * Modules/paymentrequest/PaymentResponse.idl:
2930         * Modules/paymentrequest/PaymentValidationErrors.h: Added.
2931         * Modules/paymentrequest/PaymentValidationErrors.idl: Added.
2932         * Sources.txt:
2933         * WebCore.xcodeproj/project.pbxproj:
2934
2935 2018-09-03  Andy Estes  <aestes@apple.com>
2936
2937         [Payment Request] MerchantValidationEvent should be enabled by the PaymentRequest setting
2938         https://bugs.webkit.org/show_bug.cgi?id=189250
2939
2940         Reviewed by Daniel Bates.
2941
2942         * Modules/paymentrequest/MerchantValidationEvent.idl:
2943
2944 2018-09-03  Youenn Fablet  <youenn@apple.com>
2945
2946         REGRESSION: Layout Test http/tests/security/bypassing-cors-checks-for-extension-urls.html is Flaky
2947         https://bugs.webkit.org/show_bug.cgi?id=187658
2948         <rdar://problem/42306442>
2949
2950         Reviewed by Alexey Proskuryakov.
2951
2952         Test is flaky as a previous test was setting the isRunningUserScripts state on the Page and it was never reset.
2953         This patch moves this state to the topDocument so that it will be reset for every navigation.
2954         Covered by existing test being no longer flaky.
2955
2956         * dom/Document.h:
2957         (WebCore::Document::setAsRunningUserScripts):
2958         (WebCore::Document::isRunningUserScripts const):
2959         * loader/DocumentThreadableLoader.cpp:
2960         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
2961         * page/Frame.cpp:
2962         (WebCore::Frame::injectUserScriptImmediately):
2963         * page/Page.h:
2964         (WebCore::Page::setAsRunningUserScripts): Deleted.
2965         (WebCore::Page::isRunningUserScripts const): Deleted.
2966         * testing/Internals.cpp:
2967         (WebCore::Internals::setAsRunningUserScripts):
2968
2969 2018-09-03  Andy Estes  <aestes@apple.com>
2970
2971         [Payment Request] Implement the MerchantValidationEvent constructor
2972         https://bugs.webkit.org/show_bug.cgi?id=189235
2973
2974         Reviewed by Daniel Bates.
2975
2976         Implemented the constructor for MerchantValidationEvent as defined in the Payment Request API W3C Editor's Draft of 30 August 2018.
2977
2978         Updated the payment-request web platform tests to include MerchantValidationEvent tests.
2979
2980         Tests: imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.http.html
2981                imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.https.html
2982                imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.http.html
2983                imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html
2984                imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html
2985                imported/w3c/web-platform-tests/payment-request/onmerchantvalidation-attribute.https.html
2986
2987         * CMakeLists.txt:
2988         * DerivedSources.make:
2989         * Modules/paymentrequest/MerchantValidationEvent.cpp:
2990         (WebCore::MerchantValidationEvent::create):
2991         (WebCore::MerchantValidationEvent::MerchantValidationEvent):
2992         (WebCore::MerchantValidationEvent::complete):
2993         * Modules/paymentrequest/MerchantValidationEvent.h:
2994         * Modules/paymentrequest/MerchantValidationEvent.idl:
2995         * Modules/paymentrequest/MerchantValidationEventInit.h: Added.
2996         * Modules/paymentrequest/MerchantValidationEventInit.idl: Added.
2997         * Modules/paymentrequest/PaymentRequest.idl:
2998         * Sources.txt:
2999         * WebCore.xcodeproj/project.pbxproj:
3000         * bindings/js/WebCoreBuiltinNames.h:
3001
3002 2018-09-03  Philippe Normand  <pnormand@igalia.com>
3003
3004         [GStreamer] elements registration clean-ups
3005         https://bugs.webkit.org/show_bug.cgi?id=189192
3006
3007         Reviewed by Xabier Rodriguez-Calvar.
3008
3009         Register all our elements from the base player class. This
3010         simplifies the MSE player by removing duplicated code.
3011
3012         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
3013         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3014         (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements):
3015         (WebCore::registerWebKitGStreamerElements): Deleted.
3016         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3017         (WebCore::MediaPlayerPrivateGStreamerMSE::registerMediaEngine):
3018         (WebCore::MediaPlayerPrivateGStreamerMSE::load):
3019         (WebCore::mimeTypeCache):
3020         (WebCore::initializeGStreamerAndRegisterWebKitMSEElement): Deleted.
3021         (WebCore::MediaPlayerPrivateGStreamerMSE::isAvailable): Deleted.
3022         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
3023
3024 2018-09-02  Zalan Bujtas  <zalan@apple.com>
3025
3026         REGRESSION (r191336): RenderFlexibleBox::adjustChildSizeForMinAndMax crashes in std::optional<>::value()
3027         https://bugs.webkit.org/show_bug.cgi?id=189232
3028         <rdar://problem/43886373>
3029
3030         Reviewed by Brent Fulgham.
3031
3032         It's not guaranteed that RenderFlexibleBox::computeMainAxisExtentForChild() always returns with a valid value.
3033
3034         Test: fast/flexbox/crash-when-min-max-content-is-not-computed.html
3035
3036         * rendering/RenderFlexibleBox.cpp:
3037         (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax):
3038
3039 2018-09-01  Simon Fraser  <simon.fraser@apple.com>
3040
3041         Rename FilterEffectRenderer to CSSFilter
3042         https://bugs.webkit.org/show_bug.cgi?id=189223
3043
3044         Reviewed by Sam Weinig.
3045
3046         Filter was subclassed by SVGFilter for SVG, and FilterEffectRenderer for CSS,
3047         which was very confusing, especially when the code uses renderer() to get it.
3048         
3049         Rename FilterEffectRenderer to CSSFilter, and access via filter().
3050         
3051         Future cleanup will deal with FilterEffectRendererHelper.
3052
3053         * Sources.txt:
3054         * WebCore.xcodeproj/project.pbxproj:
3055         * css/CSSFilterImageValue.cpp:
3056         (WebCore::CSSFilterImageValue::image):
3057         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
3058         * platform/graphics/filters/Filter.h:
3059         (WebCore::Filter::isCSSFilter const):
3060         * rendering/CSSFilter.cpp: Copied from Source/WebCore/rendering/FilterEffectRenderer.cpp.
3061         (WebCore::endMatrixRow):
3062         (WebCore::lastMatrixRow):
3063         (WebCore::CSSFilter::create):
3064         (WebCore::CSSFilter::CSSFilter):
3065         (WebCore::m_sourceGraphic):
3066         (WebCore::CSSFilter::inputContext):
3067         (WebCore::CSSFilter::buildReferenceFilter):
3068         (WebCore::CSSFilter::build):
3069         (WebCore::CSSFilter::updateBackingStoreRect):
3070         (WebCore::CSSFilter::allocateBackingStoreIfNeeded):
3071         (WebCore::CSSFilter::clearIntermediateResults):
3072         (WebCore::CSSFilter::apply):
3073         (WebCore::CSSFilter::computeSourceImageRectForDirtyRect):
3074         (WebCore::CSSFilter::output const):
3075         (WebCore::CSSFilter::setSourceImageRect):
3076         (WebCore::CSSFilter::setMaxEffectRects):
3077         (WebCore::CSSFilter::outputRect const):
3078         * rendering/CSSFilter.h: Copied from Source/WebCore/rendering/FilterEffectRenderer.h.
3079         (isType):
3080         * rendering/FilterEffectRenderer.cpp:
3081         (WebCore::FilterEffectRendererHelper::prepareFilterEffect):
3082         (WebCore::FilterEffectRendererHelper::filterContext const):
3083         (WebCore::FilterEffectRendererHelper::beginFilterEffect):
3084         (WebCore::FilterEffectRendererHelper::applyFilterEffect):
3085         (WebCore::endMatrixRow): Deleted.
3086         (WebCore::lastMatrixRow): Deleted.
3087         (WebCore::FilterEffectRenderer::FilterEffectRenderer): Deleted.
3088         (WebCore::m_sourceGraphic): Deleted.
3089         (WebCore::FilterEffectRenderer::create): Deleted.
3090         (WebCore::FilterEffectRenderer::inputContext): Deleted.
3091         (WebCore::FilterEffectRenderer::buildReferenceFilter): Deleted.
3092         (WebCore::FilterEffectRenderer::build): Deleted.
3093         (WebCore::FilterEffectRenderer::updateBackingStoreRect): Deleted.
3094         (WebCore::FilterEffectRenderer::allocateBackingStoreIfNeeded): Deleted.
3095         (WebCore::FilterEffectRenderer::clearIntermediateResults): Deleted.
3096         (WebCore::FilterEffectRenderer::apply): Deleted.
3097         (WebCore::FilterEffectRenderer::computeSourceImageRectForDirtyRect): Deleted.
3098         (WebCore::FilterEffectRenderer::output const): Deleted.
3099         (WebCore::FilterEffectRenderer::setMaxEffectRects): Deleted.
3100         (WebCore::FilterEffectRenderer::outputRect const): Deleted.
3101         * rendering/FilterEffectRenderer.h:
3102         (WebCore::FilterEffectRendererHelper::FilterEffectRendererHelper):
3103         (WebCore::FilterEffectRenderer::setSourceImageRect): Deleted.
3104         * rendering/RenderBlockFlow.cpp:
3105         * rendering/RenderFrame.cpp:
3106         * rendering/RenderImage.cpp:
3107         * rendering/RenderLayer.cpp:
3108         (WebCore::RenderLayer::requiresFullLayerImageForFilters const):
3109         (WebCore::RenderLayer::filter const):
3110         (WebCore::RenderLayer::filterPainter const):
3111         (WebCore::RenderLayer::setupFilters):
3112         (WebCore::RenderLayer::calculateClipRects const):
3113         (WebCore::RenderLayer::filterRenderer const): Deleted.
3114         * rendering/RenderLayer.h:
3115         * rendering/RenderLayerBacking.cpp:
3116         * rendering/RenderLayerFilterInfo.cpp:
3117         (WebCore::RenderLayer::FilterInfo::setFilter):
3118         (WebCore::RenderLayer::FilterInfo::updateReferenceFilterClients):
3119         (WebCore::RenderLayer::FilterInfo::removeReferenceFilterClients):
3120         (WebCore::RenderLayer::FilterInfo::setRenderer): Deleted.
3121         * rendering/RenderLayerFilterInfo.h:
3122         * rendering/updating/RenderTreeBuilderBlock.cpp:
3123
3124 2018-09-01  Darin Adler  <darin@apple.com>
3125
3126         [CFNetwork] Update CFNetwork SPI use to use CFNetworkSPI.h more consistently
3127         https://bugs.webkit.org/show_bug.cgi?id=189072
3128
3129         Reviewed by Dan Bernstein.
3130
3131         * platform/mac/WebCoreNSURLExtras.mm: Include CFNetworkSPI.h and remove a
3132         declaration of +[NSURLProtocol _protocolClassForRequest:].
3133
3134         * platform/network/mac/ResourceHandleMac.mm: Remove a declaration of
3135         -[NSURLConnection _initWithRequest:delegate:usesCache:maxContentLength:startImmediately:connectionProperties:].
3136         (WebCore::ResourceHandle::createNSURLConnection): Add ignore of
3137         "-Wdeprecated-declarations" around use of the above method, since it
3138         is deprecated.
3139
3140 2018-09-01  Simon Fraser  <simon.fraser@apple.com>
3141
3142         Add some more filter logging
3143         https://bugs.webkit.org/show_bug.cgi?id=189221
3144
3145         Reviewed by Anders Carlsson.
3146
3147         Add logging in FilterEffect::apply() that shows all the filter rects, and logging
3148         that brackets the application of a whole filter chain, for both SVG and CSS filters.
3149
3150         * platform/graphics/filters/FilterEffect.cpp:
3151         (WebCore::FilterEffect::apply):
3152         * rendering/FilterEffectRenderer.cpp:
3153         (WebCore::FilterEffectRendererHelper::applyFilterEffect):
3154         * rendering/svg/RenderSVGResourceFilter.cpp:
3155         (WebCore::RenderSVGResourceFilter::postApplyResource):
3156
3157 2018-08-31  Youenn Fablet  <youenn@apple.com>
3158
3159         Move stats gathering out of LibWebRTCMediaEndpoint
3160         https://bugs.webkit.org/show_bug.cgi?id=189180
3161
3162         Reviewed by Alejandro G. Castro.
3163
3164         Move stats gathering in LibWebRTCStatsCollector.
3165         Make sure that the lambda given to the collector is always called and destroyed from the main thread.
3166         This allows capturing the promise here instead of storing it into the peer connection backend.
3167         No change of behavior.
3168
3169         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3170         (WebCore::LibWebRTCMediaEndpoint::getStats):
3171         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
3172         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3173         (WebCore::LibWebRTCPeerConnectionBackend::getStats):
3174         (WebCore::LibWebRTCPeerConnectionBackend::doStop):
3175         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
3176         * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp: Added.
3177         (WebCore::LibWebRTCStatsCollector::LibWebRTCStatsCollector):
3178         (WebCore::LibWebRTCStatsCollector::~LibWebRTCStatsCollector):
3179         (WebCore::fromStdString):
3180         (WebCore::fillRTCStats):
3181         (WebCore::fillRTCRTPStreamStats):
3182         (WebCore::fillInboundRTPStreamStats):
3183         (WebCore::fillOutboundRTPStreamStats):
3184         (WebCore::fillRTCMediaStreamTrackStats):
3185         (WebCore::fillRTCDataChannelStats):
3186         (WebCore::iceCandidatePairState):
3187         (WebCore::fillRTCIceCandidatePairStats):
3188         (WebCore::fillRTCCertificateStats):
3189         (WebCore::LibWebRTCStatsCollector::OnStatsDelivered):
3190         * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.h: Added.
3191         (WebCore::LibWebRTCStatsCollector::create):
3192         * WebCore.xcodeproj/project.pbxproj:
3193
3194 2018-08-31  Jer Noble  <jer.noble@apple.com>
3195
3196         Compile error in RealtimeOutgoingVideoSource.cpp; unused parameter in libwebrtc header
3197         https://bugs.webkit.org/show_bug.cgi?id=189203
3198
3199         Reviewed by Youenn Fablet.
3200
3201         If RealtimeOutgoingVideoSource.cpp is compiled alone (non-unified) or if it is the first file compiled in
3202         a unified build, there is no pragma set to ignore unused parameter warnings in place.
3203
3204         * platform/mediastream/RealtimeOutgoingVideoSource.cpp:
3205
3206 2018-08-31  Wenson Hsieh  <wenson_hsieh@apple.com>
3207
3208         [iOS] Consolidate the implementations of readString, stringForType, and readURL in PlatformPasteboardIOS.mm
3209         https://bugs.webkit.org/show_bug.cgi?id=189054
3210         <rdar://problem/43819779>
3211
3212         Reviewed by Tim Horton.
3213
3214         Remove redundant and unnecessary logic for reading from the pasteboard on iOS.
3215
3216         * platform/PlatformPasteboard.h:
3217         * platform/ios/PlatformPasteboardIOS.mm:
3218         (WebCore::PlatformPasteboard::stringForType const):
3219
3220         This currently grabs a string corresponding to the given type from the first item in the pasteboard. Make
3221         stringForType instead call readString with pasteboard item index 0.
3222
3223         (WebCore::PlatformPasteboard::count const):
3224         (WebCore::PlatformPasteboard::readBuffer const):
3225         (WebCore::PlatformPasteboard::readString const):
3226
3227         Make readString with "public.url" call readURL.
3228
3229         (WebCore::PlatformPasteboard::readURL const):
3230
3231         Remove logic for reading URLs from the pasteboard as property lists deserialized from properly lists. This was
3232         added in r223195 due to fix a case "when UIPasteboard serializes NSURL as a plist" when grabbing pasteboard data
3233         using -valuesForPasteboardType:inItemSet:. However, this case only arises in non-UI applications (i.e. when
3234         UIApplicationInitialize() has not been invoked); this is currently exercised by the test CopyURL.ValidURL, but
3235         doesn't really correspond to a real-world use case, since all UI applications where a user would be able to
3236         paste in a web view already invoke UIApplicationInitialize().
3237
3238         Instead of handling the case where the pasteboard contains a property list that has not been coerced to an
3239         NSURL, simply remove the code from PlatformPasteboard::readURL and allow UIKit to perform the coercion when
3240         running the test.
3241
3242         (WebCore::PlatformPasteboard::count): Deleted.
3243         (WebCore::PlatformPasteboard::readBuffer): Deleted.
3244         (WebCore::PlatformPasteboard::readString): Deleted.
3245         (WebCore::PlatformPasteboard::readURL): Deleted.
3246
3247         Mark these functions as `const`.
3248
3249         * platform/wpe/PlatformPasteboardWPE.cpp:
3250         (WebCore::PlatformPasteboard::readString const):
3251         (WebCore::PlatformPasteboard::readString): Deleted.
3252
3253         Mark this function as const.
3254
3255 2018-08-31  Jer Noble  <jer.noble@apple.com>
3256
3257         Compilation error in FormData.cpp: incomplete type 'WebCore::SharedBuffer'
3258         https://bugs.webkit.org/show_bug.cgi?id=189207
3259
3260         Reviewed by Youenn Fablet.
3261
3262         If FormData.cpp is compiled alone (non-unified) or if it is the first file compiled in
3263         a unified build, SharedBuffer.h is not included.
3264
3265         * platform/network/FormData.cpp:
3266
3267 2018-08-31  Chris Dumez  <cdumez@apple.com>
3268
3269         [ WK2 ] http/tests/workers/service/client-*-page-cache.html LayoutTests are flaky
3270         https://bugs.webkit.org/show_bug.cgi?id=183705
3271         <rdar://problem/42440606>
3272
3273         Reviewed by Youenn Fablet.
3274
3275         Add internals.serviceWorkerClientIdentifier() utility function so that a layout test can get the
3276         service worker client identifier of a document.
3277
3278         * testing/Internals.cpp:
3279         (WebCore::Internals::serviceWorkerClientIdentifier const):
3280         * testing/Internals.h:
3281         * testing/Internals.idl:
3282
3283 2018-08-31  John Wilander  <wilander@apple.com>
3284
3285         Storage Access API: Maintain access through same-site navigations
3286         https://bugs.webkit.org/show_bug.cgi?id=188564
3287         <rdar://problem/43445160>
3288
3289         Reviewed by Alex Christensen.
3290
3291         Tests: http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html
3292                http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html
3293
3294         * dom/Document.h:
3295             Removed unused member variable m_hasFrameSpecificStorageAccess.
3296         * loader/DocumentLoader.cpp:
3297         (WebCore::DocumentLoader::willSendRequest):
3298         * loader/FrameLoaderClient.h:
3299
3300 2018-08-31  Youenn Fablet  <youenn@apple.com>
3301
3302         WebAudioBufferList.cpp/.h is named as cocoa/WebAudioBufferList.cpp/.h
3303         https://bugs.webkit.org/show_bug.cgi?id=189160
3304
3305         Reviewed by Jer Noble.
3306
3307         Add WebAudioBufferList.cpp to unified build.
3308         Update XCode project so that the file names are right.
3309         No change of behavior.
3310
3311         * PlatformMac.cmake:
3312         * SourcesCocoa.txt:
3313         * WebCore.xcodeproj/project.pbxproj:
3314
3315 2018-08-31  Chris Dumez  <cdumez@apple.com>
3316
3317         Assertion hit in ~CompletionHandler() from ~WebFrame()
3318         https://bugs.webkit.org/show_bug.cgi?id=189199
3319         <rdar://problem/42657233>
3320
3321         Reviewed by Youenn Fablet.
3322
3323         The issue was caused by WebFrame::m_willSubmitFormCompletionHandlers implicitly containing
3324         CompletionHandlers (wrapped in WTF::Functions) and not calling them upon WebFrame
3325         destruction.
3326
3327         No new tests, covered by fast/frames/iframe-target.html.
3328
3329         * loader/EmptyClients.cpp:
3330         (WebCore::EmptyFrameLoaderClient::dispatchWillSubmitForm):
3331         * loader/EmptyFrameLoaderClient.h:
3332         * loader/FrameLoaderClient.h:
3333
3334 2018-08-31  Zalan Bujtas  <zalan@apple.com>
3335
3336         [LFC] Add margin box verification back now that Display::Box has non-computed horizontal margin.
3337         https://bugs.webkit.org/show_bug.cgi?id=189193
3338
3339         Reviewed by Antti Koivisto.
3340
3341         Use the non-computed margin values to verify correctness.
3342         This patch also fixes a margin collapsing issue when the inflow box has a float sibling. The float
3343         sibling does not prevent collapsing with the parent's top/bottom margin.
3344
3345         Test: fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border.html
3346
3347         * layout/Verification.cpp:
3348         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
3349         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
3350         * layout/blockformatting/BlockMarginCollapse.cpp:
3351         (WebCore::Layout::isMarginTopCollapsedWithParent):
3352         (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
3353
3354 2018-08-31  Antti Koivisto  <antti@apple.com>
3355
3356         Replace OptionSet |= and -= operators with add() and remove() functions
3357         https://bugs.webkit.org/show_bug.cgi?id=189169
3358
3359         Reviewed by Anders Carlsson.
3360
3361         * accessibility/AccessibilityObject.cpp:
3362         (WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection const):
3363         * css/StyleBuilderConverter.h:
3364         (WebCore::StyleBuilderConverter::convertTextDecoration):
3365         (WebCore::StyleBuilderConverter::convertTextEmphasisPosition):
3366         (WebCore::StyleBuilderConverter::convertTextUnderlinePosition):
3367         (WebCore::StyleBuilderConverter::convertTextDecorationSkip):
3368         (WebCore::StyleBuilderConverter::convertSpeakAs):
3369         (WebCore::StyleBuilderConverter::convertHangingPunctuation):
3370         * css/parser/CSSParser.cpp:
3371         (WebCore::CSSParser::parseSystemColor):
3372         * dom/Document.cpp:
3373         (WebCore::Document::styleColorOptions const):
3374         * dom/DocumentMarkerController.cpp:
3375         (WebCore::DocumentMarkerController::addMarker):
3376         (WebCore::DocumentMarkerController::removeMarkers):
3377         * dom/ScriptedAnimationController.cpp:
3378         (WebCore::ScriptedAnimationController::addThrottlingReason):
3379         (WebCore::ScriptedAnimationController::removeThrottlingReason):
3380         * dom/SecurityContext.h:
3381         (WebCore::SecurityContext::setFoundMixedContent):
3382         * dom/UIEventWithKeyState.cpp:
3383         (WebCore::UIEventWithKeyState::modifiersFromInitializer):
3384         (WebCore::UIEventWithKeyState::setModifierKeys):
3385         * dom/UserActionElementSet.cpp:
3386         (WebCore::UserActionElementSet::setFlags):
3387         * editing/CompositeEditCommand.cpp:
3388         (WebCore::CompositeEditCommand::moveParagraphs):
3389         * editing/Editor.cpp:
3390         (WebCore::Editor::replaceSelectionWithFragment):
3391         (WebCore::Editor::appliedEditing):
3392         (WebCore::Editor::markMisspellingsAfterTypingToWord):
3393         (WebCore::Editor::markMisspellingsAndBadGrammar):
3394         (WebCore::Editor::resolveTextCheckingTypeMask):
3395         * editing/FrameSelection.cpp:
3396         (WebCore::FrameSelection::moveWithoutValidationTo):
3397         (WebCore::FrameSelection::setSelectedRange):
3398         * editing/FrameSelection.h:
3399         (WebCore::FrameSelection::defaultSetSelectionOptions):
3400         * editing/MoveSelectionCommand.cpp:
3401         (WebCore::MoveSelectionCommand::doApply):
3402         * editing/SpellChecker.cpp:
3403         (WebCore::SpellChecker::didCheckSucceed):
3404         * editing/TextCheckingHelper.cpp:
3405         (WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar):
3406         (WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange const):
3407         * editing/TextIterator.cpp:
3408         (WebCore::SearchBuffer::SearchBuffer):
3409         * html/HTMLAnchorElement.cpp:
3410         (WebCore::HTMLAnchorElement::parseAttribute):
3411         * inspector/agents/InspectorPageAgent.cpp:
3412         (WebCore::InspectorPageAgent::reload):
3413         * page/ContextMenuController.cpp:
3414         (WebCore::ContextMenuController::contextMenuItemSelected):
3415         * page/DOMWindow.cpp:
3416         (WebCore::DOMWindow::find const):
3417         * page/DragController.cpp:
3418         (WebCore::DragController::concludeEditDrag):
3419         * page/FrameSnapshotting.cpp:
3420         (WebCore::snapshotFrameRectWithClip):
3421         * page/FrameView.cpp:
3422         (WebCore::updateLayerPositionFlags):
3423         (WebCore::FrameView::willPaintContents):
3424         * page/Page.cpp:
3425         (WebCore::Page::setIsVisible):
3426         * page/PerformanceObserver.cpp:
3427         (WebCore::PerformanceObserver::observe):
3428         * page/TextIndicator.cpp:
3429         (WebCore::TextIndicator::createWithRange):
3430         * page/WindowFeatures.cpp:
3431         (WebCore::parseDisabledAdaptations):
3432         * page/csp/ContentSecurityPolicy.h:
3433         (WebCore::ContentSecurityPolicy::addHashAlgorithmsForInlineScripts):
3434         (WebCore::ContentSecurityPolicy::addHashAlgorithmsForInlineStylesheets):
3435         * page/csp/ContentSecurityPolicySourceList.cpp:
3436         (WebCore::ContentSecurityPolicySourceList::parseHashSource):
3437         * platform/PlatformEvent.h:
3438         (WebCore::PlatformEvent::PlatformEvent):
3439         * platform/ios/PlatformEventFactoryIOS.mm:
3440         (WebCore::modifiersForEvent):
3441         * platform/mac/PlatformEventFactoryMac.mm:
3442         (WebCore::modifiersForEvent):
3443         * rendering/RenderLayer.cpp:
3444         (WebCore::RenderLayer::updateLayerPositions):
3445         (WebCore::RenderLayer::updateLayerPositionsAfterScroll):
3446         (WebCore::RenderLayer::paintLayer):
3447         (WebCore::RenderLayer::paintLayerContentsAndReflection):
3448         (WebCore::RenderLayer::paintLayerContents):
3449         (WebCore::RenderLayer::paintForegroundForFragments):
3450         * rendering/RenderLayerBacking.cpp:
3451         (WebCore::RenderLayerBacking::paintIntoLayer):
3452         (WebCore::RenderLayerBacking::paintContents):
3453         * rendering/RenderLayerCompositor.cpp:
3454         (WebCore::RenderLayerCompositor::reasonsForCompositing const):
3455         (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus):
3456         * rendering/TextDecorationPainter.cpp:
3457         (WebCore::collectStylesForRenderer):
3458         * rendering/TextPaintStyle.cpp:
3459         (WebCore::computeTextPaintStyle):
3460         * rendering/style/RenderStyle.cpp:
3461         (WebCore::RenderStyle::changeRequiresLayout const):
3462         (WebCore::RenderStyle::changeRequiresLayerRepaint const):
3463         (WebCore::RenderStyle::changeRequiresRepaint const):
3464         * testing/Internals.cpp:
3465         (WebCore::parseFindOptions):
3466         (WebCore::Internals::forceReload):
3467         (WebCore::Internals::setPageVisibility):
3468         (WebCore::Internals::setPageIsFocusedAndActive):
3469
3470 2018-08-31  Aditya Keerthi  <akeerthi@apple.com>
3471
3472         [Datalist][iOS] Add suggestions UI for TextFieldInputTypes
3473         https://bugs.webkit.org/show_bug.cgi?id=186714
3474
3475         Reviewed by Wenson Hsieh.
3476
3477         On iOS, the datalist button should appear as a downward triangle. Furthermore, the
3478         button should only be displayed if the input has focus and there are suggested
3479         values.
3480
3481         * css/html.css:
3482         (input::-webkit-list-button): Draw the triangle using an SVG.
3483         * html/DataListSuggestionInformation.h:
3484         * html/HTMLInputElement.h:
3485         * html/TextFieldInputType.cpp: Added logic to show and hide the datalist button as necessary.
3486         (WebCore::TextFieldInputType::handleFocusEvent):
3487         (WebCore::TextFieldInputType::handleBlurEvent):
3488         (WebCore::TextFieldInputType::didSetValueByUserEdit):
3489         (WebCore::TextFieldInputType::listAttributeTargetChanged):
3490         (WebCore::TextFieldInputType::displaySuggestions):
3491
3492 2018-08-31  Youenn Fablet  <youenn@apple.com>
3493
3494         Move LibWebRTCMediaEndpoint data channel code to LibWebRTCDataChannelHandler
3495         https://bugs.webkit.org/show_bug.cgi?id=189182
3496
3497         Reviewed by Alejandro G. Castro.
3498
3499         Moving data channel code outside of LibWebRTCMediaEndpoint.
3500         This will allow future development to support unified plan.
3501         No change of behavior.
3502
3503         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
3504         (WebCore::LibWebRTCDataChannelHandler::fromRTCDataChannelInit):
3505         (WebCore::LibWebRTCDataChannelHandler::channelEvent):
3506         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
3507         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3508         (WebCore::LibWebRTCMediaEndpoint::createDataChannel):
3509         (WebCore::LibWebRTCMediaEndpoint::OnDataChannel):
3510         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
3511
3512 2018-08-31  Youenn Fablet  <youenn@apple.com>
3513
3514         Move session observers outside LibWebRTCMediaEndpoint
3515         https://bugs.webkit.org/show_bug.cgi?id=189181
3516
3517         Reviewed by Alejandro G. Castro.
3518
3519         Move classes of LibWebRTCMediaEndpoint to a separate file.
3520         No change of behavior.
3521
3522         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
3523         * Modules/mediastream/libwebrtc/LibWebRTCObservers.h: Added.
3524         * WebCore.xcodeproj/project.pbxproj:
3525
3526 2018-08-31  Eric Carlson  <eric.carlson@apple.com>
3527
3528         [MediaStream] Remove AVMediaCaptureSource
3529         https://bugs.webkit.org/show_bug.cgi?id=189159
3530
3531         Reviewed by Youenn Fablet.
3532
3533         No new tests, no change in functionality.
3534
3535         Refactor video capture to get rid of a base class we don't 
3536         need any more.
3537
3538         * WebCore.xcodeproj/project.pbxproj:
3539         * platform/mediastream/mac/AVMediaCaptureSource.h: Removed.
3540         * platform/mediastream/mac/AVMediaCaptureSource.mm: Removed.
3541         * platform/mediastream/mac/AVVideoCaptureSource.h:
3542         (WebCore::AVVideoCaptureSource::session const):
3543         (WebCore::AVVideoCaptureSource::device const):
3544         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3545         (WebCore::globaVideoCaptureSerialQueue):
3546         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
3547         (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
3548         (WebCore::AVVideoCaptureSource::startProducingData):
3549         (WebCore::AVVideoCaptureSource::stopProducingData):
3550         (WebCore::AVVideoCaptureSource::beginConfiguration):
3551         (WebCore::AVVideoCaptureSource::commitConfiguration):
3552         (WebCore::AVVideoCaptureSource::settingsDidChange):
3553         (WebCore::AVVideoCaptureSource::settings const):
3554         (WebCore::AVVideoCaptureSource::capabilities const):
3555         (WebCore::AVVideoCaptureSource::setPreset):
3556         (WebCore::AVVideoCaptureSource::setupSession):
3557         (WebCore::AVVideoCaptureSource::setupCaptureSession):
3558         (WebCore::AVVideoCaptureSource::captureSessionIsRunningDidChange):
3559         (WebCore::AVVideoCaptureSource::interrupted const):
3560         (WebCore::AVVideoCaptureSource::captureSessionRuntimeError):
3561         (WebCore::AVVideoCaptureSource::captureSessionBeginInterruption):
3562         (WebCore::AVVideoCaptureSource::captureSessionEndInterruption):
3563         (-[WebCoreAVVideoCaptureSourceObserver initWithCallback:]):
3564         (-[WebCoreAVVideoCaptureSourceObserver disconnect]):
3565         (-[WebCoreAVVideoCaptureSourceObserver addNotificationObservers]):
3566         (-[WebCoreAVVideoCaptureSourceObserver removeNotificationObservers]):
3567         (-[WebCoreAVVideoCaptureSourceObserver captureOutput:didOutputSampleBuffer:fromConnection:]):
3568         (-[WebCoreAVVideoCaptureSourceObserver observeValueForKeyPath:ofObject:change:context:]):
3569         (-[WebCoreAVVideoCaptureSourceObserver sessionRuntimeError:]):
3570         (-[WebCoreAVVideoCaptureSourceObserver beginSessionInterrupted:]):
3571         (-[WebCoreAVVideoCaptureSourceObserver endSessionInterrupted:]):
3572         (WebCore::AVVideoCaptureSource::initializeCapabilities): Deleted.
3573         (WebCore::AVVideoCaptureSource::initializeSupportedConstraints): Deleted.
3574         (WebCore::AVVideoCaptureSource::updateSettings): Deleted.
3575
3576 2018-08-31  Philippe Normand  <pnormand@igalia.com>
3577
3578         Unreviewed, GTK Ubuntu LTS build fix after r235543.
3579
3580         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3581
3582 2018-08-31  Philippe Normand  <pnormand@igalia.com>
3583
3584         Unreviewed, fix compilation warning in EME GStreamer backend.
3585
3586         Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:1293:19:
3587         warning: format ‘%lu’ expects argument of type ‘long unsigned
3588         int’, but argument 9 has type ‘unsigned int’ [-Wformat=]
3589
3590         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3591         (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered):
3592
3593 2018-08-31  Philippe Normand  <philn@igalia.com>
3594
3595         [GStreamer][GL] useless ifdef in pushTextureToCompositor
3596         https://bugs.webkit.org/show_bug.cgi?id=188552
3597
3598         Reviewed by Xabier Rodriguez-Calvar.
3599
3600         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3601         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
3602         There's no need for an ifdef because the frame holder already
3603         ensures a valid texture ID will be set if it maps a GL video frame.
3604
3605 2018-08-31  David Kilzer  <ddkilzer@apple.com>
3606
3607         REGRESSION (r235190): Fix name of WebAudioBufferList.{cpp,h} in Xcode project
3608
3609         * WebCore.xcodeproj/project.pbxproj:
3610         - Add the 'name' parameter to the file references, then fix the
3611           visual name everywhere else, so these files don't appear as
3612           "cocoa/WebAudioBufferList.{cpp,h}" in the project.
3613
3614 2018-08-31  Frederic Wang  <fwang@igalia.com>
3615
3616         Bug 182053 - [CSSOM View] Implement standard behavior for scrollingElement
3617         https://bugs.webkit.org/show_bug.cgi?id=182053
3618
3619         Reviewed by Simon Fraser.
3620
3621         This commit introduces a new CSSOMViewScrollingAPIEnabled flag that will be used to implement
3622         the standard behavior of DOM scroll* API as specified by the CSSOM View spec (see bug 5991).
3623         It changes the behavior of document.scrollingElement so that it follows the spec when the
3624         flag is enabled. This will allow to pass the WPT test cssom-view/scrollingElement.html when
3625         it becomes the default behavior. WPT tests cssom-view/scrollingElement-quirks-dynamic*.html
3626         still fail; comparing with Chromium's code, we might need to propagate the style of <html>
3627         and <body> to the viewport element. Behaviors for other scrolling attributes will be changed
3628         in follow-up bugs.
3629
3630         Tests: fast/dom/Document/scrollingElement-quirks-mode.html
3631                fast/dom/Document/scrollingElement-standard-mode.html
3632
3633         * dom/Document.cpp:
3634         (WebCore::Document::isBodyPotentiallyScrollable): Helper function to verify whether the body
3635         is potentially scrollable, as defined by the CSSOM View spec. It seems that
3636         RenderObject::hasOverflowClip() may return incorrect value at this point and we might need
3637         to do something similar to Chromium's style propagation to make it work. For now, we just
3638         use the computed style. See bug 182292.
3639         (WebCore::Document::scrollingElement): When CSSOMViewScrollingAPIEnabled is enabled, we
3640         implement the algorithm of the CSSOM View spec.
3641         (WebCore::Document::body const): Verify that the root is actually a <html> element or
3642         otherwise return null. This is required by the CSSOM View spec and for WPT test
3643         scrollingElement.html. It is consistent  with bodyOrFrameset().
3644         * dom/Document.h: Add spec references for body() and bodyOrFrameset() and declare
3645         isBodyPotentiallyScrollable().
3646         * page/Settings.yaml: Add developer option for enabling the CSSOM View behavior.
3647         * rendering/style/RenderStyle.h:
3648         (WebCore::RenderStyle::isOverflowVisible const): Add helper function to check whether the
3649         style implies visible overflow.
3650
3651 2018-08-30  Zalan Bujtas  <zalan@apple.com>
3652
3653         CounterMaps should hold a unique_ptr of CounterMap.
3654         https://bugs.webkit.org/show_bug.cgi?id=189174
3655         <rdar://problem/43686458>
3656
3657         Reviewed by Ryosuke Niwa.
3658
3659         In certain cases calls to CounterMaps might lead to unexpected deletion of the CounterMap object.
3660
3661         Test: fast/css/counters/crash-when-cloning-body.html
3662
3663         * rendering/RenderCounter.cpp:
3664         (WebCore::makeCounterNode):
3665         (WebCore::destroyCounterNodeWithoutMapRemoval):
3666         (WebCore::RenderCounter::destroyCounterNodes):
3667         (WebCore::RenderCounter::destroyCounterNode):
3668         (WebCore::updateCounters):
3669         (showCounterRendererTree):
3670
3671 2018-08-30  Ross Kirsling  <ross.kirsling@sony.com>
3672
3673         Speculative build fix for WPE after r235531.
3674
3675         * platform/graphics/filters/PointLightSource.cpp:
3676         Add missing include.
3677
3678 2018-08-30  Ryosuke Niwa  <rniwa@webkit.org>
3679
3680         Add assignedElements to HTMLSlotElement
3681         https://bugs.webkit.org/show_bug.cgi?id=189146
3682
3683         Reviewed by Darin Adler.
3684
3685         Added assignedElements to HTMLSlotElement. For now, we simply filter the results returned by assignedNodes.
3686
3687         Also fixed a bug that assignedNodes was returning the fallback content when the slot is not in a shadow tree,
3688         which is specified in step 2 of the concept to find flattened slotables for a slot.
3689
3690         Spec: https://html.spec.whatwg.org/multipage/scripting.html#dom-slot-assignedelements
3691               https://dom.spec.whatwg.org/#find-flattened-slotables
3692
3693         Tests: imported/w3c/web-platform-tests/shadow-dom/slots.html
3694                imported/w3c/web-platform-tests/shadow-dom/slots-fallback.html
3695
3696         * html/HTMLSlotElement.cpp:
3697         (WebCore::flattenAssignedNodes): Updated to take Vector<Ref<Node>> for consistency.
3698         (WebCore::HTMLSlotElement::assignedNodes const): Ditto.
3699         (WebCore::HTMLSlotElement::assignedElements const):
3700         * html/HTMLSlotElement.h:
3701         * html/HTMLSlotElement.idl:
3702
3703 2018-08-30  Don Olmstead  <don.olmstead@sony.com>
3704
3705         [CMake] Replace AVFoundationSupport.py using CMake
3706         https://bugs.webkit.org/show_bug.cgi?id=182891
3707
3708         Reviewed by Per Arne Vollan.
3709
3710         No new tests. No change in behavior.
3711
3712         Remove refernces to PAL derived sources.
3713
3714         * PlatformWin.cmake:
3715         * config.h:
3716
3717 2018-08-30  Olivia Barnett  <obarnett@apple.com>
3718
3719         REGRESSION(r235489): fast/dom/navigator-detached-no-crash.html crashes under Navigator::share
3720         https://bugs.webkit.org/show_bug.cgi?id=189170
3721
3722         Reviewed by Tim Horton.
3723
3724         No new tests; fixing a failing existing test.
3725
3726         * page/Navigator.cpp:
3727         (WebCore::Navigator::share):
3728         Added null check for frame.
3729
3730 2018-08-30  Truitt Savell  <tsavell@apple.com>
3731
3732         Unreviewed, rolling out r235516.
3733
3734         Caused 50 Crashes on Sierra
3735
3736         Reverted changeset:
3737
3738         "The width of a nullptr TextRun should be zero"
3739         https://bugs.webkit.org/show_bug.cgi?id=189154
3740         https://trac.webkit.org/changeset/235516
3741
3742 2018-08-30  Tim Horton  <timothy_horton@apple.com>
3743
3744         Bundle unified sources more tightly in projects with deep directory structures
3745         https://bugs.webkit.org/show_bug.cgi?id=189009
3746
3747         Reviewed by Simon Fraser.
3748
3749         Fix a variety of unification errors due to reshuffling the bundles.
3750
3751         * Modules/mediastream/RTCController.cpp:
3752         * SourcesCocoa.txt:
3753         * WebCore.xcodeproj/project.pbxproj:
3754         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
3755         (WebCore::CryptoAlgorithmECDSA::importKey):
3756         * dom/Document.h:
3757         * html/parser/HTMLTreeBuilder.cpp:
3758         * loader/appcache/ApplicationCacheResourceLoader.h:
3759         * page/AlternativeTextClient.h:
3760         * platform/Pasteboard.h:
3761         * platform/graphics/DisplayRefreshMonitor.cpp:
3762         * platform/graphics/FontFamilySpecificationNull.cpp:
3763         * platform/graphics/cocoa/WebGLLayer.mm:
3764         (-[WebGLLayer initWithGraphicsContext3D:]):
3765         (-[WebGLLayer copyImageSnapshotWithColorSpace:]):
3766         (-[WebGLLayer display]):
3767         (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):
3768         * platform/graphics/cocoa/WebGPULayer.mm:
3769         (-[WebGPULayer initWithGPUDevice:]):
3770         * platform/graphics/metal/GPUCommandQueueMetal.mm:
3771         * platform/mac/PasteboardMac.mm:
3772         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
3773         * platform/network/ResourceRequestBase.cpp:
3774         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
3775         * rendering/updating/RenderTreeBuilderInline.cpp:
3776
3777 2018-08-30  Andy Estes  <aestes@apple.com>
3778
3779         [Payment Request] Implement the PaymentMethodChangeEvent and PaymentMethodChangeEventInit interfaces
3780         https://bugs.webkit.org/show_bug.cgi?id=189100
3781
3782         Reviewed by Daniel Bates.
3783
3784         Implement the PaymentMethodChangeEvent interface and PaymentMethodChangeEventInit dictionary
3785         defined in the Payment Request API W3C Editor's Draft of 30 August 2018.
3786
3787         <https://w3c.github.io/payment-request/#paymentmethodchangeevent-interface>
3788
3789         The "payment method changed" algorithm will be implemented in a follow-up.
3790
3791         Covered by existing web platform tests.
3792
3793         * CMakeLists.txt:
3794         * DerivedSources.make:
3795         * Modules/paymentrequest/PaymentMethodChangeEvent.cpp: Added.
3796         (WebCore::PaymentMethodChangeEvent::eventInterface const):
3797         (WebCore::PaymentMethodChangeEvent::PaymentMethodChangeEvent):
3798         * Modules/paymentrequest/PaymentMethodChangeEvent.h: Added.
3799         * Modules/paymentrequest/PaymentMethodChangeEvent.idl: Added.
3800         * Modules/paymentrequest/PaymentMethodChangeEventInit.h: Added.
3801         * Modules/paymentrequest/PaymentMethodChangeEventInit.idl: Added.
3802         * Modules/paymentrequest/PaymentRequest.idl:
3803         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp:
3804         (WebCore::PaymentRequestUpdateEvent::PaymentRequestUpdateEvent):
3805         * Modules/paymentrequest/PaymentRequestUpdateEvent.h:
3806         * Modules/paymentrequest/PaymentRequestUpdateEventInit.h:
3807         * Sources.txt:
3808         * WebCore.xcodeproj/project.pbxproj:
3809         * bindings/js/WebCoreBuiltinNames.h:
3810         * dom/EventNames.h:
3811         * dom/EventNames.in:
3812
3813 2018-08-30  Brent Fulgham  <bfulgham@apple.com>
3814
3815         The width of a nullptr TextRun should be zero
3816         https://bugs.webkit.org/show_bug.cgi?id=189154
3817         <rdar://problem/43685926>
3818
3819         Reviewed by Zalan Bujtas.
3820
3821         If a page has an empty TextRun and attempts to paint it we can crash with a nullptr.
3822
3823         This patch recognizes that an empty TextRun should always produce a zero width, rather than
3824         attempt to compute this value from font data.
3825
3826         Test: fast/text/null-string-textrun.html
3827
3828         * platform/graphics/FontCascade.cpp:
3829         (WebCore::FontCascade::widthOfTextRange const): An empty TextRun has zero width.
3830         (WebCore::FontCascade::width const): Ditto.
3831         (WebCore::FontCascade::codePath const): ASSERT that the TextRun is non-empty.
3832
3833 2018-08-30  Eric Carlson  <eric.carlson@apple.com>
3834
3835         Mock video devices should only support discrete sizes
3836         https://bugs.webkit.org/show_bug.cgi?id=189000
3837         <rdar://problem/43766551>
3838
3839         Reviewed by Youenn Fablet.
3840         
3841         While many/most video capture devices only support a finite number of discrete width/height
3842         pairs, our mock video capture devices supported arbitrary width and height combinations which
3843         made it difficult to write realistic tests using them. Change the mock devices to support
3844         finite "presets" like those supported by AVFoundation. Create a RealtimeVideoSource base
3845         class with support for these presets, so the same code will eventually be used by the mock
3846         and real capture devices.
3847
3848         No new tests, existing tests updated for these changes.
3849
3850         * Sources.txt: Add RealtimeVideoSource.cpp, remove MockRealtimeMediaSource.cpp.
3851
3852         * WebCore.xcodeproj/project.pbxproj: Ditto.
3853
3854         * platform/mediastream/MediaConstraints.h: Deal with min constraint less than the supported minimum
3855         and max larger than the supported maximum when there is no ideal.
3856
3857         * platform/mediastream/RealtimeMediaSource.cpp:
3858         (WebCore::RealtimeMediaSource::selectSettings): Use supportsSizeAndFrameRate for widths,
3859         heights, and framerates in advanced constraints so a width and height that are supported but
3860         in the same preset are filtered out.
3861         (WebCore::RealtimeMediaSource::setSize): New.
3862         * platform/mediastream/RealtimeMediaSource.h:
3863
3864         * platform/mediastream/RealtimeMediaSourceSettings.h: Remove an unneeded include.
3865
3866         * platform/mediastream/RealtimeVideoSource.cpp: Added.
3867         (WebCore::RealtimeVideoSource::RealtimeVideoSource):
3868         (WebCore::RealtimeVideoSource::~RealtimeVideoSource):
3869         (WebCore::RealtimeVideoSource::startProducingData):
3870         (WebCore::RealtimeVideoSource::setSupportedFrameRates):
3871         (WebCore::RealtimeVideoSource::addSupportedCapabilities const):
3872         (WebCore::RealtimeVideoSource::supportsSizeAndFrameRate):
3873         (WebCore::RealtimeVideoSource::bestSupportedCaptureSizeForWidthAndHeight):
3874         (WebCore::RealtimeVideoSource::applySize):
3875         (WebCore::RealtimeVideoSource::applySizeAndFrameRate):
3876         (WebCore::RealtimeVideoSource::videoSampleAvailable):
3877         (WebCore::RealtimeVideoSource::applyFrameRate):
3878         (WebCore::RealtimeVideoSource::supportsFrameRate):
3879
3880         * platform/mediastream/RealtimeVideoSource.h: Copied from Source/WebCore/platform/mock/MockRealtimeAudioSource.h.
3881         (WebCore::RealtimeVideoSource::setSupportedCaptureSizes):
3882         (WebCore::RealtimeVideoSource::setDefaultSize):
3883         (WebCore::RealtimeVideoSource::observedFrameRate const):
3884
3885         * platform/mediastream/mac/AVMediaCaptureSource.mm:
3886         (WebCore::AVMediaCaptureSource::initializeSettings): Don't set&nbs