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