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