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