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