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