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