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