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