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