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