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