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