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