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