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