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