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