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