Unreviewed, rolling out r230749
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-05-15  Michael Catanzaro  <mcatanzaro@igalia.com>
2
3         Unreviewed, rolling out r230749
4
5         This did not work as desired.
6
7         * platform/UserAgentQuirks.cpp:
8         (WebCore::urlRequiresMacintoshPlatform):
9
10 2018-05-15  Dirk Schulze  <krit@webkit.org>
11
12         Add new SVGDOM SVGFEBLEND constants
13         https://bugs.webkit.org/show_bug.cgi?id=185581
14
15         Reviewed by Simon Fraser.
16
17         Provide new SVG DOM constants for the new blend modes added to feBlend.
18
19         https://drafts.fxtf.org/filter-effects-1/#InterfaceSVGFEBlendElement
20
21         * platform/graphics/GraphicsTypes.cpp:
22         (WebCore::blendModeName):
23         * platform/graphics/GraphicsTypes.h:
24         * svg/SVGFEBlendElement.h:
25         (WebCore::SVGPropertyTraits<BlendMode>::highestEnumValue):
26         (WebCore::SVGPropertyTraits<BlendMode>::toString):
27         * svg/SVGFEBlendElement.idl:
28
29 2018-05-15  Antoine Quint  <graouts@apple.com>
30
31         [Web Animations] Expose Web Animations CSS integration as an experimental feature
32         https://bugs.webkit.org/show_bug.cgi?id=185647
33
34         Reviewed by Dean Jackson.
35
36         Make the Web Animations CSS integration flag an experimental feature, and only indicate that it is on if the Web Animations
37         experimental feature is also enabled.
38
39         * dom/Document.cpp:
40         (WebCore::Document::didBecomeCurrentDocumentInFrame):
41         (WebCore::Document::resume):
42         * dom/Element.cpp:
43         (WebCore::Element::removedFromAncestor):
44         * dom/PseudoElement.cpp:
45         (WebCore::PseudoElement::clearHostElement):
46         * history/CachedFrame.cpp:
47         (WebCore::CachedFrameBase::restore):
48         * page/Frame.cpp:
49         (WebCore::Frame::clearTimers):
50         * page/FrameView.cpp:
51         (WebCore::FrameView::didDestroyRenderTree):
52         * page/Page.cpp:
53         (WebCore::Page::handleLowModePowerChange):
54         (WebCore::Page::setIsVisibleInternal):
55         (WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged):
56         * page/RuntimeEnabledFeatures.h:
57         (WebCore::RuntimeEnabledFeatures::setWebAnimationsCSSIntegrationEnabled):
58         (WebCore::RuntimeEnabledFeatures::webAnimationsCSSIntegrationEnabled const):
59         (WebCore::RuntimeEnabledFeatures::setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted.
60         (WebCore::RuntimeEnabledFeatures::cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled const): Deleted.
61         * rendering/RenderLayer.cpp:
62         (WebCore::RenderLayer::currentTransform const):
63         (WebCore::RenderLayer::calculateClipRects const):
64         * rendering/RenderLayerBacking.cpp:
65         (WebCore::RenderLayerBacking::updateGeometry):
66         * rendering/RenderLayerCompositor.cpp:
67         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const):
68         (WebCore::RenderLayerCompositor::isRunningTransformAnimation const):
69         * rendering/updating/RenderTreeUpdater.cpp:
70         (WebCore::RenderTreeUpdater::tearDownRenderers):
71         * style/StyleTreeResolver.cpp:
72         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
73         * testing/InternalSettings.cpp:
74         (WebCore::InternalSettings::webAnimationsCSSIntegrationEnabled):
75         (WebCore::InternalSettings::cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted.
76         * testing/InternalSettings.h:
77         * testing/InternalSettings.idl:
78         * testing/Internals.cpp:
79         (WebCore::Internals::numberOfActiveAnimations const):
80         (WebCore::Internals::animationsAreSuspended const):
81         (WebCore::Internals::animationsInterval const):
82         (WebCore::Internals::suspendAnimations const):
83         (WebCore::Internals::resumeAnimations const):
84
85 2018-05-15  David Kilzer  <ddkilzer@apple.com>
86
87         Fix -Wreturn-std-move warnings in WebKit found by new clang compiler
88         <https://webkit.org/b/185621>
89
90         Reviewed by Youenn Fablet.
91
92         Fix warnings like the following:
93
94             In file included from DerivedSources/WebCore/unified-sources/UnifiedSource139.cpp:5:
95             ./Modules/mediastream/PeerConnectionBackend.cpp:412:16: error: local variable 'sdp' will be copied despite being returned by name [-Werror,-Wreturn-std-move]
96                     return sdp;
97                            ^~~
98             ./Modules/mediastream/PeerConnectionBackend.cpp:412:16: note: call 'std::move' explicitly to avoid copying
99                     return sdp;
100                            ^~~
101                            std::move(sdp)
102             1 error generated.
103
104         * Modules/mediastream/PeerConnectionBackend.cpp:
105         (WebCore::PeerConnectionBackend::filterSDP const):
106         * accessibility/AccessibilityObject.cpp:
107         (WebCore::rangeClosestToRange):
108         * bindings/js/JSDOMConvertSequences.h:
109         (WebCore::Detail::GenericSequenceConverter::convert):
110         (WebCore::Detail::NumericSequenceConverter::convertArray):
111         * bindings/js/JSDOMConvertStrings.cpp:
112         (WebCore::stringToByteString):
113         (WebCore::stringToUSVString):
114         - Use WTFMove() in return statements to fix the warnings.
115
116 2018-05-14  Dean Jackson  <dino@apple.com>
117
118         Download and present System Preview
119         https://bugs.webkit.org/show_bug.cgi?id=185459
120         <rdar://problem/40079228>
121
122         Reviewed by Tim Horton.
123
124         If an <a> is a system preview, tell the resource request about it.
125
126         * html/HTMLAnchorElement.cpp:
127         (WebCore::HTMLAnchorElement::handleClick):
128
129 2018-05-15  Antti Koivisto  <antti@apple.com>
130
131         animation-play-state: paused causes very high cpu load because of style invalidation loop
132         https://bugs.webkit.org/show_bug.cgi?id=182436
133         <rdar://problem/37182562>
134
135         Reviewed by Dean Jackson.
136
137         Test: animations/animation-playstate-paused-style-resolution.html
138
139         If the style of an element with 'animation-play-state: paused' is recomputed so it stays
140         paused we would enter zero-duration animation timer loop.
141
142         * page/animation/AnimationBase.cpp:
143         (WebCore::AnimationBase::updateStateMachine):
144
145         Don't move to AnimationState::PausedWaitResponse unless we get AnimationStateInput::StyleAvailable
146         (matching the comments). Otherwise just stay in the existing paused state.
147
148         Remove AnimationStateInput::StartAnimation from assertion as the case can't happen.
149
150 2018-05-14  Youenn Fablet  <youenn@apple.com>
151
152         readableStreamDefaultControllerError should return early if stream is not readable
153         https://bugs.webkit.org/show_bug.cgi?id=185602
154
155         Reviewed by Chris Dumez.
156
157         Return early if stream is not readable in @readableStreamDefaultControllerError.
158         Update call sites to no longer check for ReadableStream state.
159         Covered by unflaked and rebased tests.
160
161         * Modules/streams/ReadableStreamDefaultController.js:
162         (error):
163         * Modules/streams/ReadableStreamInternals.js:
164         (readableStreamDefaultControllerError):
165         (readableStreamDefaultControllerCallPullIfNeeded):
166
167 2018-05-14  Zalan Bujtas  <zalan@apple.com>
168
169         [LFC] Implement width computation for non-replaced block level inflow elements.
170         https://bugs.webkit.org/show_bug.cgi?id=185641
171
172         Reviewed by Sam Weinig.
173
174         Block level inflow elements participate in block formatting context.
175
176         * layout/FormattingContext.cpp:
177         (WebCore::Layout::FormattingContext::computeWidth const):
178         * layout/FormattingContext.h:
179         * layout/blockformatting/BlockFormattingContext.cpp:
180         (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const):
181         * layout/blockformatting/BlockFormattingContext.h:
182         * layout/inlineformatting/InlineFormattingContext.cpp:
183         (WebCore::Layout::InlineFormattingContext::computeInFlowWidth const):
184         * layout/inlineformatting/InlineFormattingContext.h:
185
186 2018-05-14  Wenson Hsieh  <wenson_hsieh@apple.com>
187
188         Unreviewed, fix the iOS build after r231779
189
190         Also address a minor in-person review comment by returning "extrazoom" instead of the empty string.
191
192         * page/DisabledAdaptations.cpp:
193         (WebCore::extraZoomModeAdaptationName):
194
195 2018-05-14  Zalan Bujtas  <zalan@apple.com>
196
197         [LFC] FormattingContext:computeOutOfFlowNonReplacedHeight/Width should use the computed margins/paddings/borders
198         https://bugs.webkit.org/show_bug.cgi?id=185633
199
200         Reviewed by Sam Weinig.
201
202         By the time we start computing height and width, DisplayBox should already have the computed values for margin/padding/border.
203
204         * layout/FormattingContext.cpp:
205         (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const):
206         (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const):
207         * layout/displaytree/DisplayBox.h:
208         (WebCore::Display::Box::paddingTop const):
209         (WebCore::Display::Box::paddingLeft const):
210         (WebCore::Display::Box::paddingBottom const):
211         (WebCore::Display::Box::paddingRight const):
212         (WebCore::Display::Box::borderTop const):
213         (WebCore::Display::Box::borderLeft const):
214         (WebCore::Display::Box::borderBottom const):
215         (WebCore::Display::Box::borderRight const):
216
217 2018-05-14  Wenson Hsieh  <wenson_hsieh@apple.com>
218
219         [Extra zoom mode] Google search results are excessively zoomed in
220         https://bugs.webkit.org/show_bug.cgi?id=185347
221         <rdar://problem/39999778>
222
223         Reviewed by Tim Horton.
224
225         It turns out that basing minimum layout size and shrink-to-fit behaviors off of the `shrink-to-fit` viewport
226         argument poses compatibility risks with web pages that already specify `shrink-to-fit` to opt out of default
227         viewport shrinking behaviors in 1/3 multitasking mode on iPad.
228
229         One way to resolve this is to introduce a new viewport meta content attribute to disable viewport heuristics in
230         extra zoom mode. However, combined shrink-to-fit and minimum device width behaviors are difficult to describe
231         using a single backwards-compatible viewport meta content attribute, and the need to suppress the default
232         behavior of `shrink-to-fit=no` if such an attribute is not disabled further muddles our viewport story.
233
234         After some internal deliberation, we’ve decided to experiment with a new meta tag named "disabled-adaptations".
235         The content of this meta tag is a comma-separated list of adaptation names; if an adaptation name matches a
236         known adaptation type (for instance, extra zoom mode), we disable the class of behaviors used to adapt web
237         content. The first and only known adaptation type is extra zoom mode, which affects `shrink-to-fit` and layout
238         size adjustments.
239
240         See per-method changes below for more details.
241
242         Test: fast/viewport/extrazoom/viewport-disable-extra-zoom-adaptations.html
243
244         * Sources.txt:
245         * WebCore.xcodeproj/project.pbxproj:
246         * dom/Document.cpp:
247         (WebCore::Document::processDisabledAdaptations):
248         * dom/Document.h:
249         (WebCore::Document::disabledAdaptations const):
250
251         Add disabled adaptations to Document. Changes to disabled adaptations are not propagated if the parsed disabled
252         adaptation types don't change; upon changing adaptation types, notify the client to adjust for the new disabled
253         adaptations (currently, this only affects the viewport configuration).
254
255         * dom/ViewportArguments.h:
256         * html/HTMLMetaElement.cpp:
257         (WebCore::HTMLMetaElement::process):
258         * html/parser/HTMLPreloadScanner.cpp:
259         (WebCore::TokenPreloadScanner::StartTagScanner::StartTagScanner):
260         (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes):
261         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
262         * loader/FrameLoader.cpp:
263         (WebCore::FrameLoader::commitProvisionalLoad):
264
265         Restore the set of disabled adaptations when restoring a page from the cache.
266
267         * page/Chrome.cpp:
268         (WebCore::Chrome::dispatchDisabledAdaptationsDidChange const):
269         * page/Chrome.h:
270         * page/ChromeClient.h:
271
272         Add plumbing for changes to the set of disabled adaptations.
273
274         * page/DisabledAdaptations.cpp: Added.
275         (WebCore::extraZoomModeAdaptationName):
276         * page/DisabledAdaptations.h: Added.
277
278         Introduce a header containing a new enum for the extra zoom mode adaptation, as well as a helper function to
279         return the extra zoom mode adaptation name.
280
281         * page/Page.cpp:
282         (WebCore::Page::disabledAdaptations const):
283
284         Returns the mainframe's set of adaptations to disable.
285
286         * page/Page.h:
287         * page/RemoteFrame.h:
288         * page/RuntimeEnabledFeatures.h:
289         (WebCore::RuntimeEnabledFeatures::setDisabledAdaptationsMetaTagEnabled):
290         (WebCore::RuntimeEnabledFeatures::disabledAdaptationsMetaTagEnabled const):
291
292         Add a new runtime feature to gate handling the "disabled-adaptations" meta tag.
293
294         * page/ViewportConfiguration.cpp:
295         (WebCore::shouldOverrideShrinkToFitArgument):
296         (WebCore::needsUpdateAfterChangingDisabledAdaptations):
297         (WebCore::ViewportConfiguration::setDisabledAdaptations):
298         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit const):
299
300         Consult whether or not extra zoom mode adaptations are disabled, instead of the shrink-to-fit attribute value.
301
302         (WebCore::ViewportConfiguration::updateConfiguration):
303         * page/ViewportConfiguration.h:
304
305         Add an OptionSet of disabled adaptation types to ViewportConfiguration. Updates to the adaptation type are
306         propagated to the ViewportConfiguration from Document, through the ChromeClient and the client layer (refer to
307         changes in WebKit). Once the OptionSet is changed, we recompute the viewport configuration only if needed by the
308         platform.
309
310         (WebCore::ViewportConfiguration::viewLayoutSize const):
311         (WebCore::ViewportConfiguration::disabledAdaptations const):
312         * page/WindowFeatures.cpp:
313         (WebCore::parseDisabledAdaptations):
314         * page/WindowFeatures.h:
315
316         Add a new helper to parse the meta content of a "disabled-adaptations" tag as an OptionSet of disabled
317         adaptation types. The string is parsed by first splitting on the comma character, and then iterating over lower
318         case, whitespace-stripped tokens to look for known adaptation names. So far, only extra zoom mode is supported.
319
320         * testing/Internals.cpp:
321         (WebCore::Internals::extraZoomModeAdaptationName const):
322         * testing/Internals.h:
323         * testing/Internals.idl:
324
325         Expose the extra zoom mode adaptation name to the DOM, only when running layout tests.
326
327 2018-05-14  Joanmarie Diggs  <jdiggs@igalia.com>
328
329         AX: Listbox and Combobox roles embedded in labels should participate in name calculation
330         https://bugs.webkit.org/show_bug.cgi?id=185521
331
332         Reviewed by Chris Fleizach.
333
334         Take selected children into account when computing the name in accessibleNameForNode.
335         Add ListBox to the roles for which accessibleNameDerivesFromContent returns false so
336         that native select elements with size > 1 are treated the same way as ARIA listbox.
337         Also add ListBox to the roles which are treated as controls when used in ARIA. Finally,
338         prevent labels which contain unrelated controls from being used as an AXTitleUIElement.
339         This causes us to build a string from the label and its descendants, ensuring the latter
340         participate in the name calculation.
341
342         Test: accessibility/text-alternative-calculation-from-listbox.html
343
344         * accessibility/AccessibilityLabel.cpp:
345         (WebCore::childrenContainUnrelatedControls):
346         (WebCore::AccessibilityLabel::containsUnrelatedControls const):
347         * accessibility/AccessibilityLabel.h:
348         * accessibility/AccessibilityNodeObject.cpp:
349         (WebCore::accessibleNameForNode):
350         * accessibility/AccessibilityObject.cpp:
351         (WebCore::AccessibilityObject::accessibleNameDerivesFromContent const):
352         (WebCore::AccessibilityObject::isARIAControl):
353         * accessibility/AccessibilityRenderObject.cpp:
354         (WebCore::AccessibilityRenderObject::exposesTitleUIElement const):
355         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
356
357 2018-05-14  Antoine Quint  <graouts@apple.com>
358
359         [Web Animations] Tests using the new animation engine may crash under WebCore::FrameView::didDestroyRenderTree when using internals methods
360         https://bugs.webkit.org/show_bug.cgi?id=185612
361         <rdar://problem/39579344>
362
363         Reviewed by Dean Jackson.
364
365         Add a new internals.pseudoElement() method to obtain a pseudo element matching a given pseudo-id. This is necessary to be able to move off
366         internals.pauseTransitionAtTimeOnPseudoElement() and internals.pauseAnimationAtTimeOnPseudoElement() for Web Animations testing.
367
368         * testing/Internals.cpp:
369         (WebCore::Internals::pseudoElement):
370         * testing/Internals.h:
371         * testing/Internals.idl:
372
373 2018-05-14  Antoine Quint  <graouts@apple.com>
374
375         REGRESSION (r230574): Interrupted hardware transitions don't behave correctly
376         https://bugs.webkit.org/show_bug.cgi?id=185299
377         <rdar://problem/39630230>
378
379         Reviewed by Simon Fraser.
380
381         In r230574, the fix for webkit.org/b/184518, we changed the processing order in GraphicsLayerCA::updateAnimations() to first
382         process m_uncomittedAnimations and then m_animationsToProcess, so we are guaranteed animations exist before we attempt to pause
383         or seek them. This broke interrupting and resuming hardware animations (such as an interrupted CSS Transition or an animation
384         running in a non-visible tab) since a pause operation recorded _before_ an animation was added would be paused anyway since
385         the animation was now first added, and then paused. The fix is simply to clear any pending AnimationProcessingAction for a
386         newly-uncommitted animation.
387
388         Test: transitions/interrupted-transition-hardware.html
389
390         * platform/graphics/ca/GraphicsLayerCA.cpp:
391         (WebCore::GraphicsLayerCA::createAnimationFromKeyframes):
392         (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
393         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
394         * platform/graphics/ca/GraphicsLayerCA.h:
395         (WebCore::GraphicsLayerCA::LayerPropertyAnimation::LayerPropertyAnimation):
396
397 2018-05-14  Thibault Saunier  <tsaunier@igalia.com>
398
399         [GStreamer] Fix style issue in MediaPlayerPrivateGStreamerBase
400         https://bugs.webkit.org/show_bug.cgi?id=185510
401
402         Reviewed by Philippe Normand.
403
404         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:629:  More than one command on the same line  [whitespace/newline] [4]
405         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:684:  More than one command on the same line  [whitespace/newline] [4]
406         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:807:  More than one command on the same line  [whitespace/newline] [4]
407
408         Indentation and style issue fixed only.
409
410         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
411         (WebCore::MediaPlayerPrivateGStreamerBase::volumeChangedCallback):
412         (WebCore::MediaPlayerPrivateGStreamerBase::muteChangedCallback):
413         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
414
415 2018-05-14  Zalan Bujtas  <zalan@apple.com>
416
417         [LFC] Implement height computation for non-replaced out of flow elements.
418         https://bugs.webkit.org/show_bug.cgi?id=185585
419
420         Reviewed by Antti Koivisto.
421
422         * layout/FormattingContext.cpp:
423         (WebCore::Layout::FormattingContext::computeHeight const):
424         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
425         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
426         (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const):
427         (WebCore::Layout::FormattingContext::computeHeightForBlockFormattingContextRootWithAutoHeight const):
428         * layout/FormattingContext.h:
429         * layout/blockformatting/BlockFormattingContext.h:
430         * layout/displaytree/DisplayBox.h:
431
432 2018-05-14  Manuel Rego Casasnovas  <rego@igalia.com>
433
434         Renaming of overrides in LayoutBox
435         https://bugs.webkit.org/show_bug.cgi?id=185609
436
437         Reviewed by Javier Fernandez.
438
439         The names of the methods for the overrides were not consistent,
440         this patch fixes it by using the same structure in all the cases.
441
442         No new tests, no change of behavior.
443
444         * rendering/GridLayoutFunctions.cpp:
445         (WebCore::GridLayoutFunctions::hasOverrideContainingBlockContentSizeForChild):
446         * rendering/GridTrackSizingAlgorithm.cpp:
447         (WebCore::GridTrackSizingAlgorithmStrategy::logicalHeightForChild const):
448         * rendering/RenderBlock.cpp:
449         (WebCore::RenderBlock::computeChildPreferredLogicalWidths const):
450         (WebCore::RenderBlock::availableLogicalHeightForPercentageComputation const):
451         * rendering/RenderBlockFlow.cpp:
452         (WebCore::RenderBlockFlow::fitBorderToLinesIfNeeded):
453         * rendering/RenderBlockLineLayout.cpp:
454         (WebCore::RenderBlockFlow::updateRubyForJustifiedText):
455         * rendering/RenderBox.cpp:
456         (WebCore::RenderBox::willBeDestroyed):
457         (WebCore::RenderBox::hasOverrideContentLogicalHeight const):
458         (WebCore::RenderBox::hasOverrideContentLogicalWidth const):
459         (WebCore::RenderBox::setOverrideContentLogicalHeight):
460         (WebCore::RenderBox::setOverrideContentLogicalWidth):
461         (WebCore::RenderBox::clearOverrideContentLogicalHeight):
462         (WebCore::RenderBox::clearOverrideContentLogicalWidth):
463         (WebCore::RenderBox::clearOverrideContentSize):
464         (WebCore::RenderBox::overrideContentLogicalWidth const):
465         (WebCore::RenderBox::overrideContentLogicalHeight const):
466         (WebCore::RenderBox::overrideContainingBlockContentLogicalWidth const):
467         (WebCore::RenderBox::overrideContainingBlockContentLogicalHeight const):
468         (WebCore::RenderBox::hasOverrideContainingBlockContentLogicalWidth const):
469         (WebCore::RenderBox::hasOverrideContainingBlockContentLogicalHeight const):
470         (WebCore::RenderBox::setOverrideContainingBlockContentLogicalWidth):
471         (WebCore::RenderBox::setOverrideContainingBlockContentLogicalHeight):
472         (WebCore::RenderBox::clearOverrideContainingBlockContentSize):
473         (WebCore::RenderBox::clearOverrideContainingBlockContentLogicalHeight):
474         (WebCore::RenderBox::containingBlockLogicalWidthForContent const):
475         (WebCore::RenderBox::containingBlockLogicalHeightForContent const):
476         (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight const):
477         (WebCore::RenderBox::computeLogicalWidthInFragment const):
478         (WebCore::RenderBox::computeLogicalHeight const):
479         (WebCore::RenderBox::computePercentageLogicalHeight const):
480         (WebCore::RenderBox::computeReplacedLogicalHeightUsing const):
481         (WebCore::RenderBox::availableLogicalHeightUsing const):
482         (WebCore::RenderBox::containingBlockLogicalWidthForPositioned const):
483         (WebCore::RenderBox::containingBlockLogicalHeightForPositioned const):
484         * rendering/RenderBox.h:
485         * rendering/RenderBoxModelObject.cpp:
486         (WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight const):
487         * rendering/RenderDeprecatedFlexibleBox.cpp:
488         (WebCore::contentWidthForChild):
489         (WebCore::contentHeightForChild):
490         (WebCore::gatherFlexChildrenInfo):
491         (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
492         (WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox):
493         (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
494         (WebCore::RenderDeprecatedFlexibleBox::clearLineClamp):
495         * rendering/RenderFlexibleBox.cpp:
496         (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild):
497         (WebCore::RenderFlexibleBox::crossSizeForPercentageResolution):
498         (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution):
499         (WebCore::RenderFlexibleBox::constructFlexItem):
500         (WebCore::RenderFlexibleBox::setOverrideMainAxisContentSizeForChild):
501         (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild):
502         * rendering/RenderFullScreen.cpp:
503         (WebCore::RenderFullScreen::unwrapRenderer):
504         * rendering/RenderGrid.cpp:
505         (WebCore::RenderGrid::layoutBlock):
506         (WebCore::RenderGrid::layoutGridItems):
507         (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
508         * rendering/RenderRubyBase.cpp:
509         (WebCore::RenderRubyBase::adjustInlineDirectionLineBounds const):
510         * rendering/RenderTableCell.cpp:
511         (WebCore::RenderTableCell::setOverrideContentLogicalHeightFromRowHeight):
512         * rendering/RenderTableCell.h:
513         * rendering/RenderTableSection.cpp:
514         (WebCore::RenderTableSection::calcRowLogicalHeight):
515         (WebCore::RenderTableSection::relayoutCellIfFlexed):
516
517 2018-05-14  Zalan Bujtas  <zalan@apple.com>
518
519         [LFC] Implement width computation for non-replaced out of flow elements.
520         https://bugs.webkit.org/show_bug.cgi?id=185598
521
522         Reviewed by Antti Koivisto.
523
524         * layout/FormattingContext.cpp:
525         (WebCore::Layout::FormattingContext::computeWidth const):
526         (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const):
527         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
528         (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const):
529         (WebCore::Layout::FormattingContext::shrinkToFitWidth const):
530         * layout/FormattingContext.h:
531         * layout/blockformatting/BlockFormattingContext.cpp:
532         (WebCore::Layout::BlockFormattingContext::layout const):
533         * layout/displaytree/DisplayBox.h:
534
535 2018-05-14  Zan Dobersek  <zdobersek@igalia.com>
536
537         Drop the m_compositorTexture member variable in TextureMapperGC3DPlatformLayer.
538         It's not used at all inside the class or outside it.
539
540         Rubber-stamped by Michael Catanzaro.
541
542         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
543
544 2018-05-14  Zan Dobersek  <zdobersek@igalia.com>
545
546         [GTK] REGRESSION(r231170) Build broken with Clang 5.0
547         https://bugs.webkit.org/show_bug.cgi?id=185198
548
549         Reviewed by Michael Catanzaro.
550
551         Avoid gperf files using the register keyword which has been made
552         reserved and as such unusable in C++17.
553
554         * css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
555         * css/makeSelectorPseudoElementsMap.py:
556         * css/makeprop.pl:
557         * css/makevalues.pl:
558         * platform/ColorData.gperf:
559         * platform/ReferrerPolicy.h: With std::optional forward declaration
560         gone, explicitly include the WTF Optional.h header.
561         * platform/Theme.h: Ditto.
562         * platform/network/create-http-header-name-table:
563
564 2018-05-14  Commit Queue  <commit-queue@webkit.org>
565
566         Unreviewed, rolling out r219515.
567         https://bugs.webkit.org/show_bug.cgi?id=185603
568
569         It sometimes makes AudioUnitInitialize call to fail in
570         CoreAudioCaptureSource (Requested by youenn on #webkit).
571
572         Reverted changeset:
573
574         "Remove CoreAudioCaptureSource speaker configuration"
575         https://bugs.webkit.org/show_bug.cgi?id=174512
576         https://trac.webkit.org/changeset/219515
577
578 2018-05-13  Dirk Schulze  <krit@webkit.org>
579
580         Implement SVGGeometryElement's isPointInFill and isPointInStroke
581         https://bugs.webkit.org/show_bug.cgi?id=185580
582
583         Reviewed by Antti Koivisto.
584
585         Implement isPointInFill and isPointInStroke methods for
586         SVGGeometryElement interface from SVG2.
587
588         https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement
589
590         Tests: svg/dom/SVGGeometry-isPointInFill.xhtml
591                svg/dom/SVGGeometry-isPointInStroke.xhtml
592
593         * rendering/svg/RenderSVGEllipse.cpp:
594         (WebCore::RenderSVGEllipse::shapeDependentStrokeContains): Flag
595                 to switch between local and "global" coordinate space for hit testing.
596         * rendering/svg/RenderSVGEllipse.h:
597         * rendering/svg/RenderSVGPath.cpp:
598         (WebCore::RenderSVGPath::shapeDependentStrokeContains): Flag
599                 to switch between local and "global" coordinate space for hit testing.
600         * rendering/svg/RenderSVGPath.h:
601         * rendering/svg/RenderSVGRect.cpp:
602         (WebCore::RenderSVGRect::shapeDependentStrokeContains): Flag
603                 to switch between local and "global" coordinate space for hit testing.
604         * rendering/svg/RenderSVGRect.h:
605         * rendering/svg/RenderSVGShape.cpp:
606         (WebCore::RenderSVGShape::shapeDependentStrokeContains): Flag
607                 to switch between local and "global" coordinate space for hit testing.
608         (WebCore::RenderSVGShape::isPointInFill): Take the winding rule given by
609                 `fill-rule` to test if a given point is in the fill area of a path.
610         (WebCore::RenderSVGShape::isPointInStroke): Take stroke properties into
611                 account to check if a point is on top of the stroke area.
612         * rendering/svg/RenderSVGShape.h:
613         * svg/SVGGeometryElement.cpp:
614         (WebCore::SVGGeometryElement::isPointInFill):
615         (WebCore::SVGGeometryElement::isPointInStroke):
616         (WebCore::SVGGeometryElement::createElementRenderer): Deleted. This is getting implemented
617                 by inheriting classes. No need to create RenderSVGPath here.
618         * svg/SVGGeometryElement.h:
619         * svg/SVGGeometryElement.idl:
620
621 2018-05-12  Zalan Bujtas  <zalan@apple.com>
622
623         Use WeakPtr for m_enclosingPaginationLayer in RenderLayer
624         https://bugs.webkit.org/show_bug.cgi?id=185566
625         <rdar://problem/36486052>
626
627         Reviewed by Simon Fraser.
628
629         Since RenderLayer does not own the enclosing pagination layout, it should
630         construct a weak pointer instead of holding on to a raw pointer.
631
632         Unable to create a reliably reproducible test case.
633
634         * page/mac/EventHandlerMac.mm:
635         (WebCore::scrollableAreaForEventTarget):
636         (WebCore::scrollableAreaForContainerNode):
637         (WebCore::EventHandler::platformPrepareForWheelEvents):
638         * platform/ScrollableArea.h:
639         (WebCore::ScrollableArea::weakPtrFactory const):
640         (WebCore::ScrollableArea::createWeakPtr): Deleted.
641         * rendering/RenderLayer.cpp:
642         (WebCore::RenderLayer::RenderLayer):
643         (WebCore::RenderLayer::updatePagination):
644         * rendering/RenderLayer.h:
645
646 2018-05-11  Daniel Bates  <dabates@apple.com>
647
648         X-Frame-Options: SAMEORIGIN needs to check all ancestor frames
649         https://bugs.webkit.org/show_bug.cgi?id=185567
650         <rdar://problem/40175008>
651
652         Reviewed by Brent Fulgham.
653
654         Change the behavior of "X-Frame-Options: SAMEORIGIN" to ensure that all ancestors frames
655         are same-origin with the document that delivered this header. This prevents an intermediary
656         malicious frame from clickjacking a child frame whose document is same-origin with the top-
657         level frame. It also makes the behavior of X-Frame-Options in WebKit more closely match
658         the behavior of X-Frame-Options in other browsers, including Chrome and Firefox.
659         
660         Currently a document delivered with "X-Frame-Options: SAMEORIGIN" must only be same-origin
661         with the top-level frame's document in order to be displayed. This prevents clickjacking by
662         a malicious page that embeds a page delivered with "X-Frame-Options: SAMEORIGIN". However,
663         it does not protect against clickjacking of the "X-Frame-Options: SAMEORIGIN" page (victim)
664         if embedded by an intermediate malicious iframe, say a "rogue ad", that was embedded in a
665         document same origin with the victim page. We should protect against such attacks. 
666
667         Tests: http/tests/security/XFrameOptions/x-frame-options-ancestors-same-origin-allow.html
668                http/tests/security/XFrameOptions/x-frame-options-ancestors-same-origin-deny.html
669
670         * loader/FrameLoader.cpp:
671         (WebCore::FrameLoader::shouldInterruptLoadForXFrameOptions):
672
673 2018-05-11  Daniel Bates  <dabates@apple.com>
674
675         [iOS] Text decoration of dragged content does not paint with opacity
676         https://bugs.webkit.org/show_bug.cgi?id=185551
677         <rdar://problem/40166867>
678
679         Reviewed by Wenson Hsieh.
680
681         Respect alpha when painting the text decoration for dragged content.
682
683         * rendering/InlineTextBox.cpp:
684         (WebCore::InlineTextBox::MarkedTextStyle::areDecorationMarkedTextStylesEqual): Consider alpha when
685         comparing decoration styles for equality so that we do not coalesce styles with differing alpha.
686         (WebCore::InlineTextBox::paintMarkedTextDecoration): Respect alpha when painting dragged content.
687
688 2018-05-11  Nan Wang  <n_wang@apple.com>
689
690         AX: In role=dialog elements with aria-modal=true VoiceOver iOS/macOS can't manually focus or read dialog paragraph description text inside the modal.
691         https://bugs.webkit.org/show_bug.cgi?id=185219
692         <rdar://problem/39920009>
693
694         Reviewed by Chris Fleizach.
695
696         The text node descendants of a modal dialog are ignored. Fixed it by using AccessibilityObject's 
697         node() to determine if it's the descendant of the modal dialog node.
698
699         Test: accessibility/aria-modal-text-descendants.html
700
701         * accessibility/AccessibilityObject.cpp:
702         (WebCore::AccessibilityObject::isModalDescendant const):
703
704 2018-05-11  Ryosuke Niwa  <rniwa@webkit.org>
705
706         Tapping after CSS-based table casues an infinite loop in wordRangeFromPosition
707         https://bugs.webkit.org/show_bug.cgi?id=185465
708         <rdar://problem/35263057>
709
710         Reviewed by Antti Koivisto.
711
712         The bug was caused by TextIterator not emitting a line break when exiting a CSS-based table when an element
713         with `display: table-row` has an invisible text node. Specifically, TextIterator::exitNode is never called on
714         an element with `table-cell: row` when m_node is a text node with whitespaces which appears after an element
715         with `display: table-cell`.
716
717         For example, for a tree structure like:
718         table-row (R)
719           table-cell (C)
720             "text" (1)
721           " " (2)
722         Getting out of (C) would result in moving onto (2) without generating a line break for (R).
723
724         When this happens in nextBoundary as it tries to find the end of the last word in the table cell, we end up
725         finding the end of the document as the end of the word. As a result, nextWordBoundaryInDirection, the caller
726         of nextBoundary, ends up infinite looping between the positon at the end of the document and the position
727         immediately before the last word in the last table cell when it traverses words backwards.
728
729         This patch fixes the hang by addressing this root cause in TextIterator. Namely, TextIterator now generates
730         a line break when exiting a block while walking up ancestors in TextIterator::advance().
731
732         Tests: editing/selection/tapping-in-table-at-end-of-document.html
733                editing/text-iterator/table-at-end-of-document.html
734
735         * editing/TextIterator.cpp:
736         (WebCore::TextIterator::advance): Fixed the bug.
737         (WebCore::shouldEmitNewlineAfterNode): Do generate a new line at the end of a document when we're trying to
738         generate every visible poitions even there are no renderers beyond this point. e.g. a position inside the
739         last cell of a table at the end of a document hits this condition.
740         (WebCore::shouldEmitExtraNewlineForNode): Don't emit a line break when the render box's height is 0px
741         to avoid generating many empty lines for empty paragraph and header elements (this function is used to generate
742         a blank line between p's and h1/h2/...'s).
743         (WebCore::TextIterator::exitNode):
744
745 2018-05-11  Dean Jackson  <dino@apple.com>
746
747         System preview badge doesn't show on <picture> elements
748         https://bugs.webkit.org/show_bug.cgi?id=185559
749         <rdar://problem/40150066>
750
751         Reviewed by Tim Horton.
752
753         We should also identify <img>s that are the child of a <picture>
754         contained inside the appropriate <a> element.
755
756         Tested internally, since the badge is platform specific.
757
758         * html/HTMLImageElement.cpp:
759         (WebCore::HTMLImageElement::isSystemPreviewImage const): Add logic
760         to look for <picture> parents.
761
762 2018-05-11  Chris Dumez  <cdumez@apple.com>
763
764         REGRESSION (async policy delegate): Revoking an object URL immediately after triggering download breaks file download
765         https://bugs.webkit.org/show_bug.cgi?id=185531
766         <rdar://problem/39909589>
767
768         Reviewed by Geoffrey Garen.
769
770         Whenever we start an asynchronous navigation policy decision for a blob URL, create a temporary
771         blob URL pointing to the same data, and update the request's URL. This way, if the page's JS revokes
772         the URL during the policy decision, the load will still succeed.
773
774         Test: fast/dom/HTMLAnchorElement/anchor-file-blob-download-then-revoke.html
775
776         * loader/DocumentLoader.cpp:
777         (WebCore::DocumentLoader::willSendRequest):
778         * loader/FrameLoader.cpp:
779         (WebCore::FrameLoader::loadURL):
780         (WebCore::FrameLoader::load):
781         (WebCore::FrameLoader::loadPostRequest):
782         * loader/PolicyChecker.cpp:
783         (WebCore::PolicyChecker::extendBlobURLLifetimeIfNecessary const):
784         (WebCore::PolicyChecker::checkNavigationPolicy):
785         (WebCore::PolicyChecker::checkNewWindowPolicy):
786         * loader/PolicyChecker.h:
787
788 2018-05-11  Antti Koivisto  <antti@apple.com>
789
790         LinkLoader fails to remove CachedResourceClient in some cases
791         https://bugs.webkit.org/show_bug.cgi?id=185553
792         <rdar://problem/36879656>
793
794         Reviewed by Geoffrey Garen.
795
796         Test: http/tests/preload/link-preload-client-remove.html
797
798         * loader/LinkLoader.cpp:
799         (WebCore::LinkLoader::loadLink):
800
801         If there is a link preload already in progress, we fail to clear the client for the ongoing load.
802         This may leave the CachedResource client map in a bad state.
803
804 2018-05-11  Charles Vazac  <cvazac@gmail.com>
805
806         Runtime feature flag for Server-Timing
807         https://bugs.webkit.org/show_bug.cgi?id=184758
808
809         Reviewed by Youenn Fablet.
810
811         * Source/WebCore/CMakeLists.txt: Added reference to PerformanceServerTiming.idl.
812         * Source/WebCore/DerivedSources.make: Added reference to PerformanceServerTiming.idl.
813         * Source/WebCore/Sources.txt: Added reference to PerformanceServerTiming.cpp and JSPerformanceServerTiming.cpp.
814         * Source/WebCore/WebCore.xcodeproj/project.pbxproj: Added references to PerformanceServerTiming.cpp, PerformanceServerTiming.h, and PerformanceServerTiming.idl.
815         * Source/WebCore/bindings/js/WebCoreBuiltinNames.h: Added PerformanceServerTiming.
816         * Source/WebCore/page/PerformanceResourceTiming.h: Added serverTiming member.
817         * Source/WebCore/page/PerformanceResourceTiming.idl: Added serverTiming attribute.
818         * Source/WebCore/page/PerformanceServerTiming.cpp: Added.
819         * Source/WebCore/page/PerformanceServerTiming.h: Added.
820         * Source/WebCore/page/PerformanceServerTiming.idl: Added.
821
822 2018-05-11  Brady Eidson  <beidson@apple.com>
823
824         Make sure history navigations reuse the existing process when necessary.
825         <rdar://problem/39746516> and https://bugs.webkit.org/show_bug.cgi?id=185532
826
827         Reviewed by Ryosuke Niwa.
828
829         Covered by new API tests.
830
831         In WebCore-land, make sure *all* NavigationActions to a back/forward item are tagged with
832         the item identifier.
833
834         * history/HistoryItem.cpp:
835         (WebCore::HistoryItem::HistoryItem):
836         (WebCore::HistoryItem::logString const):
837         * history/HistoryItem.h:
838
839         * loader/FrameLoader.cpp:
840         (WebCore::FrameLoader::loadDifferentDocumentItem):
841
842         * loader/NavigationAction.cpp:
843         (WebCore::NavigationAction::setTargetBackForwardItem):
844
845         * loader/NavigationAction.h:
846         (WebCore::NavigationAction::targetBackForwardItemIdentifier const):
847
848 2018-05-11  Yacine Bandou  <yacine.bandou_ext@softathome.com>
849
850         [EME][GStreamer] Handle the protection event in MediaPlayerPrivate
851         https://bugs.webkit.org/show_bug.cgi?id=185535
852
853         Reviewed by Xabier Rodriguez-Calvar.
854
855         This patch is based on this calvaris's commit
856         https://github.com/WebPlatformForEmbedded/WPEWebKit/commit/d966168b0d2b65f9ca9415426e26d3752c78b03e
857
858         It adds a handler for the protection event in MediaPalyerPrivateGStreamerBase, it extracts the InitData from the event
859         and sends the encrypted event to JS via HTMLMediaElement.
860         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
861         (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered):
862         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
863         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
864         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h: Add a new type InitData.
865
866 2018-05-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
867
868         [Curl] Make the cipher suites, the signing algorithms and the curve lists configurable.
869         https://bugs.webkit.org/show_bug.cgi?id=185139
870
871         Add interface to configure the cipher suites, the signing algorithms and the curve lists 
872         used by OpenSSL and libcurl to exchange, to sign or to verify keys.
873
874         Reviewed by Youenn Fablet.
875
876         No new tests in public. Have tested internally.
877
878         * platform/network/curl/CurlContext.cpp:
879         (WebCore::CurlHandle::setSslCipherList):
880         * platform/network/curl/CurlContext.h:
881         * platform/network/curl/CurlRequest.cpp:
882         (WebCore::CurlRequest::setupTransfer):
883         (WebCore::CurlRequest::willSetupSslCtx):
884         * platform/network/curl/CurlSSLHandle.cpp:
885         (WebCore::CurlSSLHandle::getCACertPathEnv):
886         * platform/network/curl/CurlSSLHandle.h:
887         (WebCore::CurlSSLHandle::getCipherList const):
888         (WebCore::CurlSSLHandle::getSignatureAlgorithmsList const):
889         (WebCore::CurlSSLHandle::getCurvesList const):
890         (WebCore::CurlSSLHandle::setCipherList):
891         (WebCore::CurlSSLHandle::setSignatureAlgorithmsList):
892         (WebCore::CurlSSLHandle::setCurvesList):
893         (WebCore::CurlSSLHandle::getCACertPath const):
894         (WebCore::CurlSSLHandle::setCACertPath):
895         * platform/network/curl/CurlSSLVerifier.cpp:
896         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
897
898 2018-05-10  Daniel Bates  <dabates@apple.com>
899
900         Use PlatformStrategies to switch between WebKit and WebKitLegacy checking of CSP frame-ancestors and X-Frame-Options
901         https://bugs.webkit.org/show_bug.cgi?id=185412
902
903         Reviewed by Ryosuke Niwa.
904
905         Consolidate the knowledge on how to determine whether security checks were performed on a ResourceResponse
906         into LoaderStrategy::havePerformedSecurityChecks() (default implementation returns false) and query it
907         to determine whether CSP frame-ancestors and X-Frame-Options need to be checked for a ResourceResponse.
908
909         Additionally, rename LoaderStrategy::isDoingLoadingSecurityChecks() to shouldPerformSecurityChecks()
910         for consistency with havePerformedSecurityChecks(). Querying shouldPerformSecurityChecks() answers the
911         question of whether the loader strategy is responsible for performing security checks when building up
912         a ResourceRequest to have the loader strategy load. And LoaderStrategy::havePerformedSecurityChecks()
913         is used to determine whether the loader strategy performed these security checks for a given ResourceResponse.
914
915         * inspector/agents/InspectorNetworkAgent.cpp:
916         (WebCore::InspectorNetworkAgent::didReceiveResponse):
917         (WebCore::InspectorNetworkAgent::didFinishLoading):
918         (WebCore::isResponseProbablyComingFromNetworkProcess): Deleted.
919         * loader/DocumentLoader.cpp:
920         (WebCore::DocumentLoader::responseReceived):
921         * loader/DocumentThreadableLoader.cpp:
922         (WebCore::shouldPerformSecurityChecks):
923         (WebCore::DocumentThreadableLoader::shouldSetHTTPHeadersToKeep const):
924         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
925         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
926         (WebCore::DocumentThreadableLoader::redirectReceived):
927         (WebCore::DocumentThreadableLoader::didFail):
928         (WebCore::DocumentThreadableLoader::loadRequest):
929         (WebCore::isDoingSecurityChecksInNetworkProcess): Deleted.
930         (WebCore::isResponseComingFromNetworkProcess): Deleted.
931         * loader/LoaderStrategy.cpp:
932         * loader/LoaderStrategy.h:
933         * page/Settings.yaml: Remove setting networkProcessCSPFrameAncestorsCheckingEnabled as we now make
934         use of the loader strategy to determine whether to perform CSP frame-ancestors and X-Frame-Options
935         checking in DocumentLoader.
936         * platform/network/ResourceResponseBase.h:
937         (WebCore::ResourceResponseBase::setSource): Added an ASSERT to catch the programming error of setting
938         source to ResourceResponse::Source::Unknown. This source type represents an uninitialized ResourceResponse.
939
940 2018-05-10  Tim Horton  <timothy_horton@apple.com>
941
942         Lookup sometimes shows a second yellow highlight on top of WebKit's TextIndicator
943         https://bugs.webkit.org/show_bug.cgi?id=185538
944         <rdar://problem/38817825>
945
946         Reviewed by Sam Weinig.
947
948         * editing/mac/DictionaryLookup.mm:
949         (WebCore::showPopupOrCreateAnimationController):
950         Options can be nil, in which case we can't mutableCopy it and add
951         LUTermOptionDisableSearchTermIndicator. Instead, create a new dictionary,
952         and add the items from options, if it's not nil.
953
954 2018-05-10  Matt Baker  <mattbaker@apple.com>
955
956         Web Inspector: ASSERT_NOT_REACHED in PageDebuggerAgent::didAddEventListener when page adds attribute event listener
957         https://bugs.webkit.org/show_bug.cgi?id=181580
958         <rdar://problem/36461309>
959
960         Reviewed by Brian Burg.
961
962         EventTarget should pass newly added EventListeners to InspectorInstrumentation,
963         instead of PageDebuggerAgent assuming the last item in the EventListenerVector
964         is the most recently added listener. This assumption does not hold when
965         the new listener replaces an existing listener.
966
967         * dom/EventTarget.cpp:
968         (WebCore::EventTarget::addEventListener):
969         (WebCore::EventTarget::setAttributeEventListener):
970
971         * inspector/InspectorInstrumentation.cpp:
972         (WebCore::InspectorInstrumentation::didAddEventListenerImpl):
973
974         * inspector/InspectorInstrumentation.h:
975         (WebCore::InspectorInstrumentation::didAddEventListener):
976
977         * inspector/agents/page/PageDebuggerAgent.cpp:
978         (WebCore::PageDebuggerAgent::didAddEventListener):
979         * inspector/agents/page/PageDebuggerAgent.h:
980
981 2018-05-10  Chris Dumez  <cdumez@apple.com>
982
983         'Cross-Origin-Options header implementation follow-up
984         https://bugs.webkit.org/show_bug.cgi?id=185520
985
986         Reviewed by Ryosuke Niwa.
987
988         * dom/Document.cpp:
989         * dom/Document.h:
990         * loader/FrameLoader.cpp:
991         (WebCore::FrameLoader::didBeginDocument):
992         Using isNull() check is sufficient here as the header parsing
993         function will do the right thing when passed the empty string.
994         Also set the options directly on the window instead of the
995         document. The window is guaranteed to have been constructed
996         by then because didBeginDocument() is called DocumentWriter::begin()
997         which calls Document::createDOMWindow() or Document::takeDOMWindowFrom().
998
999         * page/AbstractDOMWindow.cpp:
1000         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
1001         * page/AbstractDOMWindow.h:
1002         * page/DOMWindow.cpp:
1003         (WebCore::DOMWindow::DOMWindow):
1004         (WebCore::DOMWindow::didSecureTransitionTo):
1005         * page/RemoteDOMWindow.cpp:
1006         (WebCore::RemoteDOMWindow::RemoteDOMWindow):
1007         * page/RemoteDOMWindow.h:
1008         CrossOriginOptions are now stored only on the Window, not the Document.
1009
1010         * platform/network/HTTPParsers.cpp:
1011         (WebCore::parseCrossOriginOptionsHeader):
1012         Drop strippedHeader local variable as it is not strictly needed.
1013
1014 2018-05-10  Tim Horton  <timothy_horton@apple.com>
1015
1016         Fix the build after r231393
1017         https://bugs.webkit.org/show_bug.cgi?id=185519
1018         <rdar://problem/40131741>
1019
1020         Reviewed by Simon Fraser.
1021
1022         * Configurations/WebCore.xcconfig:
1023
1024 2018-05-10  Eric Carlson  <eric.carlson@apple.com>
1025
1026         Log missing cues correctly
1027         https://bugs.webkit.org/show_bug.cgi?id=185499
1028         <rdar://problem/40113821>
1029
1030         Reviewed by Daniel Bates.
1031
1032         No new tests, tested manually.
1033
1034         * html/track/InbandGenericTextTrack.cpp:
1035         (WebCore::InbandGenericTextTrack::removeGenericCue): Log the cue we searched for, not
1036         the NULL cue.
1037
1038 2018-05-10  Zalan Bujtas  <zalan@apple.com>
1039
1040         [LFC] Implement height computation for non-replaced inflow elements.
1041         https://bugs.webkit.org/show_bug.cgi?id=185474
1042
1043         Reviewed by Antti Koivisto.
1044
1045         Initial implementation. Does not cover all the cases.
1046
1047         * layout/FormattingContext.cpp:
1048         (WebCore::Layout::FormattingContext::computeHeight const):
1049         * layout/FormattingContext.h:
1050         * layout/blockformatting/BlockFormattingContext.cpp:
1051         (WebCore::Layout::BlockFormattingContext::layout const):
1052         (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const):
1053         (WebCore::Layout::BlockFormattingContext::computeInFlowNonReplacedHeight const):
1054         * layout/blockformatting/BlockFormattingContext.h:
1055         * layout/blockformatting/BlockMarginCollapse.cpp:
1056         (WebCore::Layout::collapsedMarginBottomFromLastChild):
1057         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent):
1058         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParentMarginBottom):
1059         (WebCore::Layout::isMarginBottomCollapsedWithParent): Deleted.
1060         * layout/blockformatting/BlockMarginCollapse.h:
1061         * layout/inlineformatting/InlineFormattingContext.cpp:
1062         (WebCore::Layout::InlineFormattingContext::computeInFlowHeight const):
1063         * layout/inlineformatting/InlineFormattingContext.h:
1064         * layout/layouttree/LayoutBox.cpp:
1065         (WebCore::Layout::Box::isReplaced const):
1066         * layout/layouttree/LayoutBox.h:
1067
1068 2018-05-10  Thibault Saunier  <tsaunier@igalia.com>
1069
1070         [GTK] Implement ImageBuffer::toBGRAData
1071         https://bugs.webkit.org/show_bug.cgi?id=185511
1072
1073         Reviewed by Michael Catanzaro.
1074
1075         This was never implemented but will be required for the MediaStream API
1076         tests.
1077
1078         * platform/graphics/ImageBuffer.cpp:
1079         (WebCore::ImageBuffer::toBGRAData const):
1080         * platform/graphics/cg/ImageBufferCG.cpp:
1081         (WebCore::ImageBuffer::toBGRAData const):
1082         * platform/graphics/gtk/ImageBufferGtk.cpp:
1083         (WebCore::ImageBuffer::toBGRAData const):
1084
1085 2018-05-10  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1086
1087         [EME][GStreamer] Add a handler for GStreamer protection event
1088         https://bugs.webkit.org/show_bug.cgi?id=185245
1089
1090         Reviewed by Xabier Rodriguez-Calvar.
1091
1092         Qtdemux sends the protection event when encountered a new PSSH box (encrypted content).
1093
1094         The Decryptor is moved from AppendPipeline to PlaybackPipeline (see https://bugs.webkit.org/show_bug.cgi?id=181855),
1095         thus the protection event is no longer handled because the Decryptor is not in the same pipeline as qtdemux.
1096
1097         AppendPipeline: httpsrc-->qtdemux-->appsink
1098         PlaybackPipeline: appsrc-->parser--> decryptor-->decoder-->sink
1099
1100         This patch attaches a probe to the sink pad of the appsink in the appendPipeline in order to
1101         catch and manage the protection event.
1102
1103         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1104         (WebCore::AppendPipeline::AppendPipeline):
1105         (WebCore::AppendPipeline::~AppendPipeline):
1106         (WebCore::appendPipelineAppsinkPadEventProbe):
1107         * platform/graphics/gstreamer/mse/AppendPipeline.h:
1108         (WebCore::AppendPipeline::playerPrivate):
1109
1110 2018-05-10  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1111
1112         [EME][GStreamer] Move the decryptor from AppendPipeline to PlaybackPipeline.
1113         https://bugs.webkit.org/show_bug.cgi?id=181855
1114
1115         Reviewed by Xabier Rodriguez-Calvar.
1116
1117         The goal of this move is to handle the limitation of SVP (Secure Video Path) memory size.
1118
1119         When the decryptor is in the AppendPipeline and we use SVP, we buffer in MediaSource queue
1120         the decrypted GstBuffers that are in SVP memory.
1121         This behavior cause an out-of-memory error, because we are limited in SVP memory size.
1122
1123         By moving the decryptor in PlaybackPipeline, we avoid to buffer the decrypted GstBuffers
1124         which use the SVP memory and we buffer the encrypted GstBuffers that are in system memory.
1125
1126         This new architecture also allows to start the buffering before obtaining the DRM license
1127         and it makes easier to manage dynamic change of the license or Key.
1128
1129         The decryptor is auto plugged by GStreamer playbin in PlaybackPipeline.
1130
1131         SVP: Secure Video Path also named trusted or protected video path, it is a memory which is
1132         protected by a hardware access control engine, it is not accessible to other unauthorised
1133         software or hardware components.
1134
1135         Tests:
1136             media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html
1137             media/encrypted-media/clearKey/clearKey-cenc-video-playback-mse.html
1138
1139         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
1140         (webkitMediaCommonEncryptionDecryptSinkEventHandler):
1141         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1142         (WebCore::dumpAppendState):
1143         (WebCore::AppendPipeline::AppendPipeline):
1144         (WebCore::AppendPipeline::handleNeedContextSyncMessage):
1145         (WebCore::AppendPipeline::handleAppsrcNeedDataReceived):
1146         (WebCore::AppendPipeline::setAppendState):
1147         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
1148         (WebCore::AppendPipeline::appsinkNewSample):
1149         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
1150         (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
1151         (WebCore::appendPipelineElementMessageCallback): Deleted.
1152         (WebCore::AppendPipeline::handleElementMessage): Deleted.
1153         (WebCore::AppendPipeline::dispatchPendingDecryptionStructure): Deleted.
1154         (WebCore::AppendPipeline::dispatchDecryptionStructure): Deleted.
1155         * platform/graphics/gstreamer/mse/AppendPipeline.h:
1156         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1157         (WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance):
1158         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
1159
1160 2018-05-09  Nan Wang  <n_wang@apple.com>
1161
1162         AX: VoiceOver iframe scrolling focus jumping bug
1163         https://bugs.webkit.org/show_bug.cgi?id=176615
1164         <rdar://problem/34333067>
1165
1166         Reviewed by Chris Fleizach.
1167
1168         Scrolling to make elements visible is not working correctly for elements inside an
1169         offscreen iframe. Fixed it by using RenderLayer::scrollRectToVisible() to handle
1170         scrolling more properly.
1171
1172         Test: accessibility/scroll-to-make-visible-iframe-offscreen.html
1173
1174         * accessibility/AccessibilityObject.cpp:
1175         (WebCore::AccessibilityObject::scrollToMakeVisible const):
1176
1177 2018-05-09  Joanmarie Diggs  <jdiggs@igalia.com>
1178
1179         AX: accessibleNameForNode should simplify whitespace when using innerText
1180         https://bugs.webkit.org/show_bug.cgi?id=185498
1181
1182         Reviewed by Chris Fleizach.
1183
1184         Test: accessibility/text-alternative-calculation-from-unrendered-table.html
1185
1186         Call simplifyWhiteSpace() before returning the innerText value.
1187
1188         * accessibility/AccessibilityNodeObject.cpp:
1189         (WebCore::accessibleNameForNode):
1190
1191 2018-05-09  Chris Dumez  <cdumez@apple.com>
1192
1193         Add initial support for 'Cross-Origin-Options' HTTP response header
1194         https://bugs.webkit.org/show_bug.cgi?id=184996
1195         <rdar://problem/39664620>
1196
1197         Reviewed by Geoff Garen.
1198
1199         Add initial support for 'Cross-Origin-Options' HTTP response header behind an experimental
1200         feature flag, on by default. When the HTTP server services this HTTP response header for a
1201         main resource, we'll set these options on the corresponding Document. This will impact the
1202         behavior of the Document's associated Window API when cross-origin.
1203
1204         The HTTP header has 3 possible values:
1205         - allow: This is the default. Regular cross-origin Window API is available.
1206         - allow-postmessage: Only postMessage() is available on a cross-origin window, trying to
1207           access anything else will throw a SecurityError.
1208         - deny: Trying to do anything with a cross-origin window will throw a SecurityError.
1209
1210         The header has no effect when accessing same origin windows.
1211
1212         Note that on cross-origin access from Window A to Window B, we check the cross-origin
1213         options for both Window A and Window B and use the lowest common denominator as effective
1214         cross-origin options for the access. So if Window A has 'Cross-Origin-Options: deny' and
1215         tries to call postMessage() on Window B which has 'Cross-Origin-Options: allow-postmessage',
1216         we will throw a SecurityError. This is because Window A's more restrictive options (deny)
1217         apply.
1218
1219         Tests: http/wpt/cross-origin-options/allow-postmessage-from-deny.html
1220                http/wpt/cross-origin-options/allow-postmessage.html
1221                http/wpt/cross-origin-options/cross-origin-options-header.html
1222
1223         * bindings/js/JSDOMBindingSecurity.cpp:
1224         (WebCore::BindingSecurity::shouldAllowAccessToDOMWindowGivenMinimumCrossOriginOptions):
1225         * bindings/js/JSDOMBindingSecurity.h:
1226         * bindings/js/JSDOMWindowCustom.cpp:
1227         (WebCore::effectiveCrossOriginOptionsForAccess):
1228         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
1229         (WebCore::JSDOMWindow::getOwnPropertySlot):
1230         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
1231         (WebCore::addCrossOriginWindowPropertyNames):
1232         (WebCore::addScopedChildrenIndexes):
1233         (WebCore::addCrossOriginWindowOwnPropertyNames):
1234         (WebCore::JSDOMWindow::getOwnPropertyNames):
1235         * bindings/js/JSDOMWindowCustom.h:
1236         * bindings/js/JSRemoteDOMWindowCustom.cpp:
1237         (WebCore::JSRemoteDOMWindow::getOwnPropertySlot):
1238         (WebCore::JSRemoteDOMWindow::getOwnPropertySlotByIndex):
1239         (WebCore::JSRemoteDOMWindow::getOwnPropertyNames):
1240         * bindings/scripts/CodeGeneratorJS.pm:
1241         (GenerateAttributeGetterBodyDefinition):
1242         (GetCrossOriginsOptionsFromExtendedAttributeValue):
1243         (GenerateAttributeSetterBodyDefinition):
1244         (GenerateOperationBodyDefinition):
1245         * bindings/scripts/IDLAttributes.json:
1246         * dom/Document.cpp:
1247         (WebCore::Document::setCrossOriginOptions):
1248         * dom/Document.h:
1249         (WebCore::Document::crossOriginOptions const):
1250         * loader/FrameLoader.cpp:
1251         (WebCore::FrameLoader::didBeginDocument):
1252         * page/AbstractDOMWindow.cpp:
1253         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
1254         * page/AbstractDOMWindow.h:
1255         (WebCore::AbstractDOMWindow::crossOriginOptions):
1256         (WebCore::AbstractDOMWindow::setCrossOriginOptions):
1257         * page/DOMWindow.cpp:
1258         (WebCore::DOMWindow::DOMWindow):
1259         (WebCore::DOMWindow::didSecureTransitionTo):
1260         * page/DOMWindow.idl:
1261         * page/Frame.h:
1262         * page/RemoteDOMWindow.cpp:
1263         (WebCore::RemoteDOMWindow::RemoteDOMWindow):
1264         * page/RemoteDOMWindow.h:
1265         * page/Settings.yaml:
1266         * platform/network/HTTPHeaderNames.in:
1267         * platform/network/HTTPParsers.cpp:
1268         (WebCore::parseCrossOriginOptionsHeader):
1269         * platform/network/HTTPParsers.h:
1270
1271 2018-05-09  Ryosuke Niwa  <rniwa@webkit.org>
1272
1273         Release assert in TreeScopeOrderedMap::remove via HTMLImageElement::removedFromAncestor
1274         https://bugs.webkit.org/show_bug.cgi?id=185493
1275
1276         Reviewed by Brent Fulgham.
1277
1278         Fixed the bug that HTMLImageElement::removedFromAncestor and HTMLMapElement::removedFromAncestor
1279         were calling removeImageElementByUsemap on the document instead of the shadow tree from which it was removed.
1280
1281         Test: fast/images/imagemap-in-shadow-tree-removed.html
1282
1283         * html/HTMLImageElement.cpp:
1284         (WebCore::HTMLImageElement::removedFromAncestor):
1285         * html/HTMLMapElement.cpp:
1286         (WebCore::HTMLMapElement::removedFromAncestor):
1287
1288 2018-05-09  Joanmarie Diggs  <jdiggs@igalia.com>
1289
1290         AX: Hidden nodes which are not directly referenced should not participate name/description from content
1291         https://bugs.webkit.org/show_bug.cgi?id=185478
1292
1293         Reviewed by Chris Fleizach.
1294
1295         Add a check to AccessibilityNodeObject::textUnderElement() and return early
1296         if the node is hidden, not referenced by aria-labelledby or aria-describedby,
1297         not an HTMLLabelElement, and not fallback content for an HTMLCanvasElement.
1298
1299         Test: accessibility/text-alternative-calculation-hidden-nodes.html
1300
1301         * accessibility/AccessibilityNodeObject.cpp:
1302         (WebCore::AccessibilityNodeObject::textUnderElement const):
1303
1304 2018-05-09  Eric Carlson  <eric.carlson@apple.com>
1305
1306         Update MediaSession to use release logging
1307         https://bugs.webkit.org/show_bug.cgi?id=185376
1308         <rdar://problem/40022203>
1309
1310         Reviewed by Youenn Fablet.
1311
1312         No new tests, tested manually.
1313
1314         * Modules/mediastream/MediaStream.h: hostingDocument() doesn't need to return a const Document.
1315         * Modules/webaudio/AudioContext.cpp:
1316         (WebCore::AudioContext::hostingDocument const): Ditto.
1317         * Modules/webaudio/AudioContext.h:
1318
1319         * html/HTMLMediaElement.h: Ditto.
1320
1321         * html/MediaElementSession.cpp:
1322         (WebCore::MediaElementSession::MediaElementSession):
1323         (WebCore::MediaElementSession::addBehaviorRestriction):
1324         (WebCore::MediaElementSession::removeBehaviorRestriction):
1325         (WebCore::MediaElementSession::dataLoadingPermitted const):
1326         (WebCore::MediaElementSession::fullscreenPermitted const):
1327         (WebCore::MediaElementSession::pageAllowsDataLoading const):
1328         (WebCore::MediaElementSession::pageAllowsPlaybackAfterResuming const):
1329         (WebCore::MediaElementSession::canShowControlsManager const):
1330         (WebCore::MediaElementSession::showPlaybackTargetPicker):
1331         (WebCore::MediaElementSession::hasWirelessPlaybackTargets const):
1332         (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled const):
1333         (WebCore::MediaElementSession::setWirelessVideoPlaybackDisabled):
1334         (WebCore::MediaElementSession::setHasPlaybackTargetAvailabilityListeners):
1335         (WebCore::MediaElementSession::externalOutputDeviceAvailableDidChange):
1336         (WebCore::MediaElementSession::setShouldPlayToPlaybackTarget):
1337         (WebCore::MediaElementSession::mediaEngineUpdated):
1338         (WebCore::MediaElementSession::willLog const): Deleted.
1339         (WebCore::MediaElementSession::logger const): Deleted.
1340         (WebCore::MediaElementSession::logIdentifier const): Deleted.
1341         (WebCore::MediaElementSession::logChannel const): Deleted.
1342         * html/MediaElementSession.h:
1343
1344         * platform/audio/PlatformMediaSession.cpp:
1345         (WebCore::nextLogIdentifier):
1346         (WebCore::convertEnumerationToString):
1347         (WebCore::PlatformMediaSession::PlatformMediaSession):
1348         (WebCore::PlatformMediaSession::setState):
1349         (WebCore::PlatformMediaSession::beginInterruption):
1350         (WebCore::PlatformMediaSession::endInterruption):
1351         (WebCore::PlatformMediaSession::clientWillBeginAutoplaying):
1352         (WebCore::PlatformMediaSession::clientWillPausePlayback):
1353         (WebCore::PlatformMediaSession::pauseSession):
1354         (WebCore::PlatformMediaSession::stopSession):
1355         (WebCore::PlatformMediaSession::clientDataBufferingTimerFired):
1356         (WebCore::PlatformMediaSession::logChannel const):
1357         (WebCore::stateName): Deleted.
1358         (WebCore::interruptionName): Deleted.
1359         * platform/audio/PlatformMediaSession.h:
1360         (WTF::LogArgument<WebCore::PlatformMediaSession::State>::toString):
1361         (WTF::LogArgument<WebCore::PlatformMediaSession::InterruptionType>::toString):
1362
1363 2018-05-09  Thibault Saunier  <tsaunier@igalia.com>
1364
1365         [GStreamer] Never call updateTracks if running on legacy pipeline
1366         https://bugs.webkit.org/show_bug.cgi?id=184581
1367
1368         This makes sure failling code path is never reached in the conditions where it should not have been reached.
1369
1370         Reviewed by Philippe Normand.
1371
1372         Re enables all tests that were disabled after fixing.
1373
1374         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1375         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
1376
1377 2018-05-09  Daniel Bates  <dabates@apple.com>
1378
1379         REGRESSION (r231479): http/tests/appcache/x-frame-options-prevents-framing.php is timing out
1380         https://bugs.webkit.org/show_bug.cgi?id=185443
1381         <rdar://problem/40100660>
1382
1383         Reviewed by Andy Estes.
1384
1385         Following r231479 when using WebKit2 and Restricted HTTP Response Access is enabled (enabled in
1386         WebKitTestRunner) we only check the CSP frame-ancestors directive and X-Frame-Options in
1387         NetworkProcess. We need to check these security requirements in WebContent process whenever
1388         we are performing a substitute data load, such as for app cache, as these loads do not go
1389         through NetworkProcess.
1390
1391         * loader/DocumentLoader.cpp:
1392         (WebCore::DocumentLoader::responseReceived):
1393
1394 2018-05-09  Justin Fan  <justin_fan@apple.com>
1395
1396         Hooked up ASTC support in WebGL; requires OpenGL ES 3 context to work. 
1397         https://bugs.webkit.org/show_bug.cgi?id=185272
1398         <rdar://problem/15745737>
1399
1400         Reviewed by Dean Jackson.
1401
1402         Also added in Khronos' ASTC test from version 1.0.4 beta of their conformance test suite,
1403         although again, this requires OpenGL ES 3 context for WebKit to detect proper support.
1404
1405         Test: fast/canvas/webgl/webgl-compressed-texture-astc.html
1406
1407         * DerivedSources.make:
1408         * Sources.txt:
1409         * WebCore.xcodeproj/project.pbxproj:
1410         * bindings/js/JSDOMConvertWebGL.cpp:
1411         (WebCore::convertToJSValue):
1412         * html/canvas/WebGL2RenderingContext.cpp:
1413         (WebCore::WebGL2RenderingContext::getExtension):
1414         (WebCore::WebGL2RenderingContext::getSupportedExtensions):
1415         * html/canvas/WebGLCompressedTextureASTC.cpp: Added.
1416         (WebCore::WebGLCompressedTextureASTC::WebGLCompressedTextureASTC):
1417         (WebCore::WebGLCompressedTextureASTC::getName const):
1418         (WebCore::WebGLCompressedTextureASTC::supported):
1419         (WebCore::WebGLCompressedTextureASTC::getSupportedProfiles):
1420         * html/canvas/WebGLCompressedTextureASTC.h: Added.
1421         * html/canvas/WebGLCompressedTextureASTC.idl: Added.
1422         * html/canvas/WebGLExtension.h:
1423         * html/canvas/WebGLRenderingContext.cpp:
1424         (WebCore::WebGLRenderingContext::getExtension):
1425         (WebCore::WebGLRenderingContext::getSupportedExtensions):
1426         * html/canvas/WebGLRenderingContextBase.cpp:
1427         (WebCore::WebGLRenderingContextBase::validateCompressedTexFuncData):
1428         (WebCore::WebGLRenderingContextBase::validateCompressedTexDimensions):
1429         * html/canvas/WebGLRenderingContextBase.h:
1430         * platform/graphics/Extensions3D.h:
1431
1432 2018-05-09  Youenn Fablet  <youenn@apple.com>
1433
1434         Allow WebResourceLoader to cancel a load served from a service worker
1435         https://bugs.webkit.org/show_bug.cgi?id=185274
1436
1437         Reviewed by Chris Dumez.
1438
1439         Add support for cancelling a fetch from WebProcess to service worker process.
1440         Use FetchIdentifier instead of uint64_t.
1441
1442         * Modules/fetch/FetchIdentifier.h: Added.
1443         * WebCore.xcodeproj/project.pbxproj:
1444         * workers/service/context/ServiceWorkerFetch.h:
1445         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1446         (WebCore::ServiceWorkerThreadProxy::startFetch):
1447         (WebCore::ServiceWorkerThreadProxy::cancelFetch):
1448         * workers/service/context/ServiceWorkerThreadProxy.h:
1449
1450 2018-05-09  Thibault Saunier  <tsaunier@igalia.com>
1451
1452         [GStreamer] Fix style issue in MediaPlayerPrivateGStreamer
1453         https://bugs.webkit.org/show_bug.cgi?id=185479
1454
1455         Reviewed by Philippe Normand.
1456
1457         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:114:  Multi line control clauses should use braces.  [whitespace/braces] [4]
1458         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:194:  Multi line control clauses should use braces.  [whitespace/braces] [4]
1459         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:398:  One line control clauses should not use braces.  [whitespace/braces] [4]
1460         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:440:  One line control clauses should not use braces.  [whitespace/braces] [4]
1461         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:806:  More than one command on the same line  [whitespace/newline] [4]
1462         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:869:  More than one command on the same line  [whitespace/newline] [4]
1463         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:880:  More than one command on the same line  [whitespace/newline] [4]
1464         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:940:  More than one command on the same line  [whitespace/newline] [4]
1465         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1102:  Multi line control clauses should use braces.  [whitespace/braces] [4]
1466         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1109:  Multi line control clauses should use braces.  [whitespace/braces] [4]
1467
1468         Indentation and style issue fixed only.
1469
1470         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1471         (WebCore::MediaPlayerPrivateGStreamer::registerMediaEngine):
1472         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
1473         (WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
1474         (WebCore::MediaPlayerPrivateGStreamer::play):
1475         (WebCore::MediaPlayerPrivateGStreamer::videoChangedCallback):
1476         (WebCore::MediaPlayerPrivateGStreamer::videoSinkCapsChangedCallback):
1477         (WebCore::MediaPlayerPrivateGStreamer::audioChangedCallback):
1478         (WebCore::MediaPlayerPrivateGStreamer::textChangedCallback):
1479         (WebCore::MediaPlayerPrivateGStreamer::buffered const):
1480         (WebCore::MediaPlayerPrivateGStreamer::loadNextLocation):
1481
1482 2018-05-09  Daniel Bates  <dabates@apple.com>
1483
1484         REGRESSION (r231479): com.apple.WebCore crash in WebCore::DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied()
1485         https://bugs.webkit.org/show_bug.cgi?id=185475
1486         <rdar://problem/40093853>
1487
1488         Reviewed by Andy Estes.
1489
1490         DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() must extends its lifetime
1491         until completion as dispatching a DOM load event at the associated frame can cause JavaScript execution
1492         that can do anything, including destroying the loader that dispatched the event.
1493
1494         Following r231479 DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() is now
1495         invoked by both DocumentLoader::responseReceived() and WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied().
1496         The latter only can happen when using WebKit2 and the experimental feature Restricted HTTP Response Access
1497         is enabled (RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess()). Unlike DocumentLoader::responseReceived()
1498         WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() does not take out a ref
1499         on the DocumentLoader before invoking DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied().
1500         Therefore, DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() can cause its
1501         own destruction as a result of dispatching a DOM load event at the frame. We should take out a ref on
1502         the DocumentLoader when executing DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied().
1503
1504         * loader/DocumentLoader.cpp:
1505         (WebCore::DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied):
1506
1507 2018-05-09  Tim Horton  <timothy_horton@apple.com>
1508
1509         Fix the build by ignoring some deprecation warnings
1510
1511         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1512         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
1513
1514 2018-05-09  Michael Catanzaro  <mcatanzaro@igalia.com>
1515
1516         [WPE] Build cleanly with GCC 8 and ICU 60
1517         https://bugs.webkit.org/show_bug.cgi?id=185462
1518
1519         Reviewed by Carlos Alberto Lopez Perez.
1520
1521         * PlatformGTK.cmake: Include directories are in the wrong place.
1522         * accessibility/AXObjectCache.cpp: Silence -Wclass-memaccess problems and leave warnings.
1523         (WebCore::AXObjectCache::startOrEndTextMarkerDataForRange):
1524         (WebCore::AXObjectCache::textMarkerDataForCharacterOffset):
1525         (WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
1526         (WebCore::AXObjectCache::textMarkerDataForFirstPositionInTextControl):
1527         * css/CSSFontFace.cpp: Silence -Wfallthrough
1528         (WebCore::CSSFontFace::fontLoadTiming const):
1529         * css/CSSSelectorList.cpp: Silence -Wclass-memaccess, this one is intentional.
1530         (WebCore::CSSSelectorList::adoptSelectorVector):
1531         * editing/TextIterator.cpp: Silence ICU deprecation warnings.
1532         * platform/Length.h:
1533         (WebCore::Length::operator=): More -Wclass-memaccess, looks benign.
1534         * platform/graphics/Gradient.cpp:
1535         (WebCore::Gradient::hash const): -Wclass-memaccess again. Leave a warning.
1536         * platform/graphics/SurrogatePairAwareTextIterator.cpp: Silence ICU deprecation warnings.
1537         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
1538         (WebCore::FontCascade::fontForCombiningCharacterSequence const): Silence ICU deprecation.
1539         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
1540         (WebCore::FontCustomPlatformData::FontCustomPlatformData): Silence -Wcast-function-type.
1541         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
1542         (WebCore::Font::canRenderCombiningCharacterSequence const): Silence ICU deprecation.
1543         * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp:
1544         (gstAllocatorFastMallocMemUnmap): Fix -Wcast-function-type.
1545         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1546         (WebCore::MediaPlayerPrivateGStreamer::updateTracks): Fix bad printf.
1547         (WebCore::MediaPlayerPrivateGStreamer::enableTrack): Another bad printf.
1548         (WebCore::findHLSQueue): Fix -Wcast-function-type.
1549         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1550         (webKitMediaClearKeyDecryptorDecrypt): Fix another bad printf.
1551         * platform/network/soup/SocketStreamHandleImplSoup.cpp: Silence -Wcast-function-type.
1552         (WebCore::SocketStreamHandleImpl::beginWaitingForSocketWritability):
1553         * platform/text/TextEncoding.cpp: Silence ICU deprecration.
1554
1555 2018-05-08  Simon Fraser  <simon.fraser@apple.com>
1556
1557         SVG lighting colors need to be converted into linearSRGB
1558         https://bugs.webkit.org/show_bug.cgi?id=181196
1559
1560         Reviewed by Darin Adler.
1561
1562         Address post-commit comments. Don't make a Color that contains linearRGB components,
1563         but use FloatComponents instead. Since these FloatComponents are in the 0-1 range,
1564         FELighting::setPixelInternal() needs to multiply by 255 since the output pixels are
1565         8-bit 0-255.
1566         
1567         Change linearToSRGBColorComponent() and sRGBToLinearColorComponent() to do math in
1568         floats without promoting to doubles.
1569
1570         * platform/graphics/ColorUtilities.cpp:
1571         (WebCore::FloatComponents::FloatComponents):
1572         (WebCore::linearToSRGBColorComponent):
1573         (WebCore::sRGBToLinearColorComponent):
1574         (WebCore::sRGBColorToLinearComponents):
1575         (WebCore::linearToSRGBColor): Deleted.
1576         (WebCore::sRGBToLinearColor): Deleted.
1577         * platform/graphics/ColorUtilities.h:
1578         * platform/graphics/filters/FELighting.cpp:
1579         (WebCore::FELighting::setPixelInternal):
1580         (WebCore::FELighting::drawLighting):
1581
1582 2018-05-09  Timothy Hatcher  <timothy@apple.com>
1583
1584         Use StyleColor::Options in more places.
1585
1586         https://bugs.webkit.org/show_bug.cgi?id=185458
1587         rdar://problem/39853798
1588
1589         Add UseDefaultAppearance to StyleColor::Options, to avoid passing yet another
1590         boolean on some of these functions.
1591
1592         Reviewed by Tim Horton.
1593
1594         * css/MediaQueryEvaluator.cpp:
1595         * css/StyleColor.h:
1596         * dom/Document.cpp:
1597         (WebCore::Document::useDefaultAppearance const):
1598         (WebCore::Document::styleColorOptions const):
1599         * dom/Document.h:
1600         * platform/Theme.cpp:
1601         (WebCore::Theme::paint):
1602         * platform/Theme.h:
1603         * platform/mac/LocalDefaultSystemAppearance.h:
1604         * platform/mac/LocalDefaultSystemAppearance.mm:
1605         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
1606         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
1607         * platform/mac/ThemeMac.h:
1608         * platform/mac/ThemeMac.mm:
1609         (WebCore::paintToggleButton):
1610         (WebCore::paintButton):
1611         (WebCore::ThemeMac::ensuredView):
1612         (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
1613         (WebCore::ThemeMac::paint):
1614         (-[WebCoreThemeView initWithUseSystemAppearance:]): Deleted.
1615         * platform/wpe/ThemeWPE.cpp:
1616         (WebCore::ThemeWPE::paint):
1617         * platform/wpe/ThemeWPE.h:
1618         * rendering/RenderListBox.cpp:
1619         (WebCore::RenderListBox::paintItemBackground):
1620         * rendering/RenderTheme.cpp:
1621         (WebCore::RenderTheme::paint):
1622         (WebCore::RenderTheme::inactiveListBoxSelectionBackgroundColor const):
1623         (WebCore::RenderTheme::platformInactiveListBoxSelectionBackgroundColor const):
1624         * rendering/RenderTheme.h:
1625         * rendering/RenderThemeGtk.cpp:
1626         (WebCore::RenderThemeGtk::platformInactiveListBoxSelectionBackgroundColor const):
1627         * rendering/RenderThemeGtk.h:
1628         * rendering/RenderThemeMac.h:
1629         * rendering/RenderThemeMac.mm:
1630         (WebCore::RenderThemeMac::documentViewFor const):
1631         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
1632         (WebCore::RenderThemeMac::systemColor const):
1633         (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
1634         (WebCore::RenderThemeMac::paintSliderThumb):
1635
1636 2018-05-09  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1637
1638         [EME][GStreamer] Crash when the mediaKeys are created before loading the media in debug conf
1639         https://bugs.webkit.org/show_bug.cgi?id=185244
1640
1641         Reviewed by Xabier Rodriguez-Calvar.
1642
1643         The function "MediaPlayerPrivateGStreamerBase::cdmInstanceAttached" is expected to be called once,
1644         so there is an ASSERT(!m_cdmInstance).
1645         But when the MediaKeys are created before loading the media, the cdminstance is created and attached
1646         to the MediaPlayerPrivate via "MediaPlayerPrivateGStreamerBase::cdmInstanceAttached" before loading
1647         the media, then when the media is loading, the function "MediaPlayerPrivateGStreamerBase::cdmInstanceAttached"
1648         will be called several times via the function "mediaEngineWasUpdated" wich is called for each change
1649         in the MediaElement state, thus the WebProcess crashes in the ASSERT(!m_cdmInstance).
1650
1651         This commit avoid the crash by replacing the assert with a simple check.
1652
1653         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1654         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached):
1655         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached):
1656
1657 2018-05-09  Antti Koivisto  <antti@apple.com>
1658
1659         Add OptionSet::operator& and operator bool
1660         https://bugs.webkit.org/show_bug.cgi?id=185306
1661
1662         Reviewed by Anders Carlsson.
1663
1664         Use it in a few places.
1665
1666         * loader/FrameLoader.cpp:
1667         (WebCore::FrameLoader::reload):
1668         * rendering/RenderLayerCompositor.cpp:
1669         (WebCore::RenderLayerCompositor::logReasonsForCompositing):
1670         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
1671
1672 2018-05-08  Dean Jackson  <dino@apple.com>
1673
1674         Disable system preview link fetching
1675         https://bugs.webkit.org/show_bug.cgi?id=185463
1676
1677         Reviewed by Jon Lee.
1678
1679         Temporarily disable system preview detection when a link
1680         is clicked.
1681
1682         * html/HTMLAnchorElement.cpp:
1683         (WebCore::HTMLAnchorElement::handleClick):
1684
1685 2018-05-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1686
1687         Unreviewed, fix the internal iOS build
1688
1689         Add a missing import statement in an implementation file.
1690
1691         * editing/cocoa/WebContentReaderCocoa.mm:
1692
1693 2018-05-08  Ryan Haddad  <ryanhaddad@apple.com>
1694
1695         Unreviewed, rolling out r231486.
1696
1697         Caused service worker LayoutTest failures on macOS Debug WK2.
1698
1699         Reverted changeset:
1700
1701         "Allow WebResourceLoader to cancel a load served from a
1702         service worker"
1703         https://bugs.webkit.org/show_bug.cgi?id=185274
1704         https://trac.webkit.org/changeset/231486
1705
1706 2018-05-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1707
1708         Consolidate WebContentReaderIOS and WebContentReaderMac into WebContentReaderCocoa
1709         https://bugs.webkit.org/show_bug.cgi?id=185340
1710
1711         Reviewed by Tim Horton.
1712
1713         WebContentReader::readURL is currently the only method implemented separately in iOS and macOS platform
1714         WebContentReader files. The implementation across macOS and iOS is nearly identical (with some exceptions with
1715         the way iOS handles file URLs and plain text editing), so we can merge these into a single method
1716         WebContentReaderCocoa and delete WebContentReaderIOS and WebContentReaderMac.
1717
1718         This also has the added bonus of fixing a latent bug in WebContentReaderMac, wherein URLs written to the
1719         pasteboard using -[NSPasteboard writeObjects:] are currently pasted as empty anchor elements. In this case, the
1720         link title isn't made explicit, so the `title` passed in to WebContentReader::readURL is empty. On iOS, we have
1721         code to fall back to pasting the absolute string of the URL if the title is empty, but on macOS, we'll just use
1722         this empty string as the title of the anchor.
1723
1724         Test: PasteMixedContent.PasteURLWrittenToPasteboardUsingWriteObjects
1725
1726         * SourcesCocoa.txt:
1727         * WebCore.xcodeproj/project.pbxproj:
1728         * editing/cocoa/WebContentReaderCocoa.mm:
1729         (WebCore::WebContentReader::readURL):
1730         * editing/ios/WebContentReaderIOS.mm: Removed.
1731         * editing/mac/WebContentReaderMac.mm: Removed.
1732
1733 2018-05-08  Zalan Bujtas  <zalan@apple.com>
1734
1735         [Simple line layout] Cache run resolver.
1736         https://bugs.webkit.org/show_bug.cgi?id=185411
1737
1738         Reviewed by Antti Koivisto.
1739
1740         This patch caches the run resolver on the [SimpleLine]Layout object. 
1741         In certain cases, when the block container has thousands of elements (foobar1<br>foobar2<br>.....foobar9999<br>),
1742         constructing the resolver (and its dependencies) in a repeating fashion could hang the WebProcess.
1743
1744         Covered by existing tests.
1745
1746         * rendering/SimpleLineLayout.cpp:
1747         (WebCore::SimpleLineLayout::create):
1748         (WebCore::SimpleLineLayout::Layout::create):
1749         (WebCore::SimpleLineLayout::Layout::Layout):
1750         * rendering/SimpleLineLayout.h:
1751         (WebCore::SimpleLineLayout::Layout::runResolver const):
1752         * rendering/SimpleLineLayoutFunctions.cpp:
1753         (WebCore::SimpleLineLayout::paintFlow):
1754         (WebCore::SimpleLineLayout::hitTestFlow):
1755         (WebCore::SimpleLineLayout::collectFlowOverflow):
1756         (WebCore::SimpleLineLayout::computeBoundingBox):
1757         (WebCore::SimpleLineLayout::computeFirstRunLocation):
1758         (WebCore::SimpleLineLayout::collectAbsoluteRects):
1759         (WebCore::SimpleLineLayout::collectAbsoluteQuads):
1760         (WebCore::SimpleLineLayout::textOffsetForPoint):
1761         (WebCore::SimpleLineLayout::collectAbsoluteQuadsForRange):
1762         (WebCore::SimpleLineLayout::generateLineBoxTree):
1763         * rendering/SimpleLineLayoutResolver.cpp:
1764         (WebCore::SimpleLineLayout::LineResolver::LineResolver):
1765         * rendering/SimpleLineLayoutResolver.h:
1766         (WebCore::SimpleLineLayout::lineResolver):
1767
1768 2018-05-08  Brent Fulgham  <bfulgham@apple.com>
1769
1770         Switch some RELEASE_ASSERTS to plain debug ASSERTS in PlatformScreenMac.mm
1771         https://bugs.webkit.org/show_bug.cgi?id=185451
1772         <rdar://problem/39620348>
1773
1774         Reviewed by Zalan Bujtas.
1775
1776         Change a set of RELEASE_ASSERTS used to prevent accessing NSScreen related functions in the
1777         PlatformScreenMac implementation to less expensive Debug ASSERTS.
1778
1779         No change in behavior.
1780
1781         * platform/mac/PlatformScreenMac.mm:
1782         (WebCore::screenHasInvertedColors):
1783         (WebCore::screenDepth):
1784         (WebCore::screenDepthPerComponent):
1785         (WebCore::screenRectForDisplay):
1786         (WebCore::screenRect):
1787         (WebCore::screenAvailableRect):
1788         (WebCore::screenColorSpace):
1789         (WebCore::screenSupportsExtendedColor):
1790
1791 2018-05-08  Daniel Bates  <dabates@apple.com>
1792
1793         Resign Strong Password appearance when text field value changes
1794         https://bugs.webkit.org/show_bug.cgi?id=185433
1795         <rdar://problem/39958508>
1796
1797         Reviewed by Ryosuke Niwa.
1798
1799         Remove the Strong Password decoration when the text field's value changes to avoid interfering
1800         with web sites that allow a person to clear the password field.
1801
1802         Tests: fast/forms/auto-fill-button/auto-fill-strong-password-button-when-maxlength-changes.html
1803                fast/forms/auto-fill-button/auto-fill-strong-password-button-when-minlength-changes.html
1804                fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes.html
1805
1806         * html/HTMLInputElement.cpp:
1807         (WebCore::HTMLInputElement::resignStrongPasswordAppearance): Extracted from HTMLInputElement::updateType().
1808         (WebCore::HTMLInputElement::updateType): Extract out logic to resign the Strong Password appearance
1809         into a function that can be shared by this function and HTMLInputElement::setValue().
1810         (WebCore::HTMLInputElement::setValue): Resign the Strong Password appearance if this field was
1811         changed programmatically (i.e. no DOM change event was dispatched).
1812         * html/HTMLInputElement.h:
1813
1814 2018-05-08  Jer Noble  <jer.noble@apple.com>
1815
1816         Unreviewed build fix; add missing function definition.
1817
1818         * html/HTMLMediaElement.h:
1819         (WebCore::HTMLMediaElement::didPassCORSAccessCheck const):
1820
1821 2018-05-08  Jer Noble  <jer.noble@apple.com>
1822
1823         Mute MediaElementSourceNode when tainted.
1824         https://bugs.webkit.org/show_bug.cgi?id=184866
1825
1826         Reviewed by Eric Carlson.
1827
1828         Test: http/tests/security/webaudio-render-remote-audio-blocked-no-crossorigin.html
1829
1830         * Modules/webaudio/AudioContext.cpp:
1831         (WebCore::AudioContext::wouldTaintOrigin const):
1832         * Modules/webaudio/AudioContext.h:
1833         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
1834         (WebCore::MediaElementAudioSourceNode::setFormat):
1835         (WebCore::MediaElementAudioSourceNode::wouldTaintOrigin):
1836         (WebCore::MediaElementAudioSourceNode::process):
1837         * Modules/webaudio/MediaElementAudioSourceNode.h:
1838
1839 2018-05-08  Eric Carlson  <eric.carlson@apple.com>
1840
1841         Log rtcstats as JSON
1842         https://bugs.webkit.org/show_bug.cgi?id=185437
1843         <rdar://problem/40065332>
1844
1845         Reviewed by Youenn Fablet.
1846
1847         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1848         (WebCore::RTCStatsLogger::RTCStatsLogger): Create a wrapper class so we don't have to add a
1849         toJSONString method to libwebrtc.
1850         (WebCore::RTCStatsLogger::toJSONString const): Log stats as JSON.
1851         (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered): Don't use the LOGIDENTIFIER macro because
1852         it doesn't work well inside of a lambda.
1853         (WTF::LogArgument<WebCore::RTCStatsLogger>::toString): Move into .cpp file because it is only
1854         used here.
1855         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
1856         (WTF::LogArgument<webrtc::RTCStats>::toString): Deleted. Move to .cpp file.
1857
1858 2018-05-08  Dean Jackson  <dino@apple.com>
1859
1860         System Preview links should trigger a download
1861         https://bugs.webkit.org/show_bug.cgi?id=185439
1862         <rdar://problem/40065545>
1863
1864         Reviewed by Jon Lee.
1865
1866         Add a new field to FrameLoadRequest, which then is copied
1867         into ResourceRequest, identifying if the link clicked
1868         is a system preview.
1869
1870         * html/HTMLAnchorElement.cpp:
1871         (WebCore::HTMLAnchorElement::handleClick): Look for isSystemPreviewLink().
1872         * loader/FrameLoadRequest.cpp:
1873         (WebCore::FrameLoadRequest::FrameLoadRequest):
1874         * loader/FrameLoadRequest.h: New property.
1875         (WebCore::FrameLoadRequest::FrameLoadRequest):
1876         (WebCore::FrameLoadRequest::isSystemPreview const):
1877         * loader/FrameLoader.cpp:
1878         (WebCore::FrameLoader::urlSelected):
1879         (WebCore::FrameLoader::loadURL):
1880         * loader/FrameLoader.h:
1881         * platform/network/ResourceRequestBase.cpp:
1882         (WebCore::ResourceRequestBase::isSystemPreview const):
1883         (WebCore::ResourceRequestBase::setSystemPreview):
1884         * platform/network/ResourceRequestBase.h:
1885
1886 2018-05-08  Commit Queue  <commit-queue@webkit.org>
1887
1888         Unreviewed, rolling out r231491.
1889         https://bugs.webkit.org/show_bug.cgi?id=185434
1890
1891         Setting the Created key on a cookie does not work yet, due a
1892         bug in CFNetwork (Requested by ggaren on #webkit).
1893
1894         Reverted changeset:
1895
1896         "[WKHTTPCookieStore getAllCookies] returns inconsistent
1897         creation time"
1898         https://bugs.webkit.org/show_bug.cgi?id=185041
1899         https://trac.webkit.org/changeset/231491
1900
1901 2018-05-08  Sihui Liu  <sihui_liu@apple.com>
1902
1903         [WKHTTPCookieStore getAllCookies] returns inconsistent creation time
1904         https://bugs.webkit.org/show_bug.cgi?id=185041
1905         <rdar://problem/34684214>
1906
1907         Reviewed by Geoffrey Garen.
1908
1909         Set creationtime property when creating Cookie object to keep consistency after conversion.
1910
1911         New API test: WebKit.WKHTTPCookieStoreCreationTime.
1912
1913         * platform/network/cocoa/CookieCocoa.mm:
1914         (WebCore::Cookie::operator NSHTTPCookie * const):
1915
1916 2018-05-08  Eric Carlson  <eric.carlson@apple.com>
1917
1918         Text track cue logging should include cue text
1919         https://bugs.webkit.org/show_bug.cgi?id=185353
1920         <rdar://problem/40003565>
1921
1922         Reviewed by Brent Fulgham.
1923
1924         No new tests, tested manually.
1925
1926         * html/track/VTTCue.cpp:
1927         (WebCore::VTTCue::toJSON const):
1928         * platform/graphics/InbandTextTrackPrivateClient.h:
1929         (WebCore::GenericCueData::toJSONString const):
1930         * platform/graphics/iso/ISOVTTCue.cpp:
1931         (WebCore::ISOWebVTTCue::toJSONString const):
1932
1933 2018-05-08  Sam Weinig  <sam@webkit.org>
1934
1935         More cleanup of XMLHttpRequestUpload
1936         https://bugs.webkit.org/show_bug.cgi?id=185409
1937
1938         Reviewed by Alex Christensen.
1939
1940         - Remove unneeded #includes
1941         - Rename m_xmlHttpRequest to m_request
1942         - Make some overloaded some methods private, and mark them as final rather
1943           than override.
1944
1945         * xml/XMLHttpRequestUpload.cpp:
1946         (WebCore::XMLHttpRequestUpload::XMLHttpRequestUpload):
1947         * xml/XMLHttpRequestUpload.h:
1948
1949 2018-05-08  Zalan Bujtas  <zalan@apple.com>
1950
1951         [LFC] Start using BlockMarginCollapse
1952         https://bugs.webkit.org/show_bug.cgi?id=185424
1953
1954         Reviewed by Antti Koivisto.
1955
1956         BlockMarginCollapse could be all static.
1957
1958         * layout/blockformatting/BlockFormattingContext.cpp:
1959         (WebCore::Layout::BlockFormattingContext::marginTop const):
1960         (WebCore::Layout::BlockFormattingContext::marginBottom const):
1961         * layout/blockformatting/BlockMarginCollapse.cpp:
1962         (WebCore::Layout::isMarginTopCollapsedWithSibling):
1963         (WebCore::Layout::isMarginBottomCollapsedWithSibling):
1964         (WebCore::Layout::isMarginTopCollapsedWithParent):
1965         (WebCore::Layout::isMarginBottomCollapsedWithParent):
1966         (WebCore::Layout::collapsedMarginTopFromFirstChild):
1967         (WebCore::Layout::collapsedMarginBottomFromLastChild):
1968         (WebCore::Layout::nonCollapsedMarginTop):
1969         (WebCore::Layout::nonCollapsedMarginBottom):
1970         (WebCore::Layout::BlockMarginCollapse::marginTop):
1971         (WebCore::Layout::BlockMarginCollapse::marginBottom):
1972         (WebCore::Layout::BlockMarginCollapse::BlockMarginCollapse): Deleted.
1973         (WebCore::Layout::BlockMarginCollapse::marginTop const): Deleted.
1974         (WebCore::Layout::BlockMarginCollapse::marginBottom const): Deleted.
1975         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithSibling const): Deleted.
1976         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithSibling const): Deleted.
1977         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParent const): Deleted.
1978         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent const): Deleted.
1979         (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginTop const): Deleted.
1980         (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginBottom const): Deleted.
1981         (WebCore::Layout::BlockMarginCollapse::collapsedMarginTopFromFirstChild const): Deleted.
1982         (WebCore::Layout::BlockMarginCollapse::collapsedMarginBottomFromLastChild const): Deleted.
1983         (WebCore::Layout::BlockMarginCollapse::hasAdjoiningMarginTopAndBottom const): Deleted.
1984         * layout/blockformatting/BlockMarginCollapse.h:
1985
1986 2018-05-08  Youenn Fablet  <youenn@apple.com>
1987
1988         Allow WebResourceLoader to cancel a load served from a service worker
1989         https://bugs.webkit.org/show_bug.cgi?id=185274
1990
1991         Reviewed by Chris Dumez.
1992
1993         Add support for cancelling a fetch from WebProcess to service worker process.
1994         Use FetchIdentifier instead of uint64_t.
1995
1996         * Modules/fetch/FetchIdentifier.h: Added.
1997         * WebCore.xcodeproj/project.pbxproj:
1998         * workers/service/context/ServiceWorkerFetch.h:
1999         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2000         (WebCore::ServiceWorkerThreadProxy::startFetch):
2001         (WebCore::ServiceWorkerThreadProxy::cancelFetch):
2002         * workers/service/context/ServiceWorkerThreadProxy.h:
2003
2004 2018-05-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
2005
2006         feTurbulence is not rendered correctly on Retina display
2007         https://bugs.webkit.org/show_bug.cgi?id=183798
2008
2009         Reviewed by Simon Fraser.
2010
2011         On 2x display the feTurbulence filter creates a scaled ImageBuffer but
2012         processes only the unscaled size. This is a remaining work of r168577 and
2013         is very similar to what was done for the feMorphology filter in r188271.
2014
2015         Test: fast/hidpi/filters-turbulence.html
2016
2017         * platform/graphics/filters/FETurbulence.cpp:
2018         (WebCore::FETurbulence::fillRegion const):
2019         (WebCore::FETurbulence::platformApplySoftware):
2020
2021 2018-05-07  Zalan Bujtas  <zalan@apple.com>
2022
2023         [LFC] Add FormattingContext::layoutOutOfFlowDescendants implementation
2024         https://bugs.webkit.org/show_bug.cgi?id=185377
2025
2026         Reviewed by Antti Koivisto.
2027
2028         Also, remove FormattingContext's m_layoutContext member and pass it in to ::layout() instead.
2029         In theory LayoutContext is needed only during ::layout() call. 
2030
2031         * layout/FormattingContext.cpp:
2032         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
2033         * layout/FormattingContext.h:
2034         (WebCore::Layout::FormattingContext::layoutContext const):
2035         * layout/LayoutContext.cpp:
2036         (WebCore::Layout::LayoutContext::updateLayout):
2037         * layout/blockformatting/BlockFormattingContext.cpp:
2038         (WebCore::Layout::BlockFormattingContext::layout const):
2039         * layout/blockformatting/BlockFormattingContext.h:
2040         * layout/inlineformatting/InlineFormattingContext.cpp:
2041         (WebCore::Layout::InlineFormattingContext::layout const):
2042         * layout/inlineformatting/InlineFormattingContext.h:
2043
2044 2018-05-07  Daniel Bates  <dabates@apple.com>
2045
2046         Check X-Frame-Options and CSP frame-ancestors in network process
2047         https://bugs.webkit.org/show_bug.cgi?id=185410
2048         <rdar://problem/37733934>
2049
2050         Reviewed by Ryosuke Niwa.
2051
2052         * WebCore.xcodeproj/project.pbxproj: Make PingLoader.h a private header so that we can include it in WebKit.
2053         * loader/DocumentLoader.cpp:
2054         (WebCore::DocumentLoader::responseReceived): Only check CSP frame-ancestors and X-Frame-Options here if
2055         we are not checking them in the NetworkProcess and HTTP response access is restricted. I code is otherwise kept
2056         unchanged. There may be opportunities to clean this code up more and share more of it. We should look into this
2057         in subsequent bugs.
2058         * loader/DocumentLoader.h: Change visibility of stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() from
2059         private to public and export it so that we can call it from the WebKit.
2060         * loader/PingLoader.h:
2061         * page/Settings.yaml: Add a new setting called networkProcessCSPFrameAncestorsCheckingEnabled (defaults: false)
2062         and is hardcoded in WebPage.cpp to be enabled. This setting is used to determine if we will be using the NetworkProcess.
2063         Ideally we wouldn't have this setting and just key off RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess().
2064         However RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess() is always enabled in WebKit Legacy
2065         at the time of writing (why?). And, strangely, RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess()
2066         is conditionally enabled in WebKit. For now, we add a new setting, networkProcessCSPFrameAncestorsCheckingEnabled,
2067         to determine if CSP checking should be performed in NetworkProcess. For checking to actually happen in NetworkProcess
2068         and not in DocumentLoader::responseReceived() RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess()
2069         will also need to be enabled.
2070         * page/csp/ContentSecurityPolicy.cpp:
2071         (WebCore::ContentSecurityPolicy::allowFrameAncestors const): Added a variant that takes a vector of ancestor origins.
2072         * page/csp/ContentSecurityPolicy.h:
2073         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
2074         (WebCore::checkFrameAncestors): Ditto.
2075         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFrameAncestorOrigins const): Ditto.
2076         * page/csp/ContentSecurityPolicyDirectiveList.h: Export constructor so that we can invoke it from NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions().
2077         * page/csp/ContentSecurityPolicyResponseHeaders.h:
2078         * platform/network/HTTPParsers.h: Export XFrameOptionsDisposition() so that we can use in WebKit.
2079
2080 2018-05-07  Daniel Bates  <dabates@apple.com>
2081
2082         Abstract logic to log console messages and send CSP violation reports into a client
2083         https://bugs.webkit.org/show_bug.cgi?id=185393
2084         <rdar://problem/40036053>
2085
2086         Reviewed by Brent Fulgham.
2087
2088         First pass at adding infrastructure to supporting CSP reporting from NetworkProcess and workers.
2089         Replaces the existing ContentSecurityPolicy constructor that takes a Frame with one that
2090         takes a ContentSecurityPolicyClient to delegate to for logging and sending reports. We will look
2091         to remove ContentSecurityPolicy constructor that takes a ScriptExecutionContext in a follow up.
2092
2093         Standardize on instantiating a ContentSecurityPolicy with the full URL to resource that it protects
2094         instead of taking only the SecurityOrigin of this URL. By taking the full URL the ContentSecurityPolicy
2095         object is now capable of resolving a relative report URL without needing a Document/ScriptExecutionContext.
2096
2097         We are underutilizing the CSPInfo struct and ContentSecurityPolicyClient::willSendCSPViolationReport()
2098         delegate callback in this patch. We will make use of this functionality in a subsequent patch to
2099         support collecting script state (e.g. source line number) when reporting CSP violations in worker
2100         threads. We also no longer go through the unnecessary motions to try to collect script state for a
2101         frame-ancestors violation (since DocumentLoader extends ContentSecurityPolicyClient and does not
2102         implement ContentSecurityPolicyClient::willSendCSPViolationReport()). The frame-ancestors directive
2103         is checked before a document is parsed and executes script; => there will never be any script state
2104         to collect; => it is not necessary to try to collect it as we currently do.
2105
2106         * Sources.txt: Add file ContentSecurityPolicyClient.cpp. See the remarks for ContentSecurityPolicyClient.cpp
2107         below on why we have this file.
2108         * WebCore.xcodeproj/project.pbxproj: Add files ContentSecurityPolicyClient.{h, cpp}.
2109         * dom/Document.cpp:
2110         (WebCore::Document::initSecurityContext): Pass the URL of the protected document.
2111         * loader/DocumentLoader.cpp:
2112         (WebCore::DocumentLoader::responseReceived): Ditto.
2113         (WebCore::DocumentLoader::addConsoleMessage): Added.
2114         (WebCore::DocumentLoader::sendCSPViolationReport): Added.
2115         (WebCore::DocumentLoader::dispatchSecurityPolicyViolationEvent): Added.
2116         * loader/DocumentLoader.h:
2117         * loader/FrameLoaderClient.h: Fix typo in comment.
2118         * loader/WorkerThreadableLoader.cpp:
2119         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): Pass the URL of the worker script.
2120         * page/csp/ContentSecurityPolicy.cpp:
2121         (WebCore::ContentSecurityPolicy::ContentSecurityPolicy): Added overload that takes a URL&& and an optional
2122         ContentSecurityPolicyClient*.
2123         (WebCore::ContentSecurityPolicy::deprecatedURLForReporting const): Extracted and simplified stripURLForUseInReport()
2124         into this member function.
2125         (WebCore::ContentSecurityPolicy::reportViolation const): Modified to make use of the client, if we have
2126         one and removed code for handling a ContentSecurityPolicy that was instantiated with a Frame.
2127         (WebCore::ContentSecurityPolicy::logToConsole const): Ditto.
2128         (WebCore::stripURLForUseInReport): Deleted; incorporated into ContentSecurityPolicy::deprecatedURLForReporting().
2129         * page/csp/ContentSecurityPolicy.h:
2130         * page/csp/ContentSecurityPolicyClient.cpp: Added. This file exists so that we can define the virtual
2131         destructor out-of-line and export this abstract class so as to avoid the need for the vtable to be
2132         defined in the translation unit of each derived class.
2133         * page/csp/ContentSecurityPolicyClient.h: Added.
2134         * page/csp/ContentSecurityPolicySource.cpp:
2135         (WebCore::ContentSecurityPolicySource::operator SecurityOriginData const): Added.
2136         * page/csp/ContentSecurityPolicySource.h:
2137         * workers/WorkerGlobalScope.cpp:
2138         (WebCore::WorkerGlobalScope::WorkerGlobalScope): Instantiate the ContentSecurityPolicy object with the
2139         URL of the worker script.
2140
2141 2018-05-07  Simon Fraser  <simon.fraser@apple.com>
2142
2143         CSS filters which reference SVG filters fail to respect the "color-interpolation-filters" of the filter
2144         https://bugs.webkit.org/show_bug.cgi?id=185343
2145
2146         Reviewed by Dean Jackson.
2147
2148         Test: css3/filters/color-interpolation-filters.html
2149         
2150         When applying CSS reference filters, apply the value of "color-interpolation-filters" for the
2151         referenced filter effect element, just as we do for SVG filters.
2152
2153         * rendering/FilterEffectRenderer.cpp:
2154         (WebCore::FilterEffectRenderer::buildReferenceFilter):
2155
2156 2018-05-07  Daniel Bates  <dabates@apple.com>
2157
2158         CSP status-code incorrect for document blocked due to violation of its frame-ancestors directive
2159         https://bugs.webkit.org/show_bug.cgi?id=185366
2160         <rdar://problem/40035116>
2161
2162         Reviewed by Brent Fulgham.
2163
2164         Fixes an issue where the status-code in the sent CSP report for an HTTP document blocked because
2165         its frame-ancestors directive was violated would be the status code of the previously loaded
2166         document in the frame. If the previously loaded document was about:blank then this would be 0.
2167
2168         Currently whenever we send a CSP report we ask the document's loader (Document::loader()) for the
2169         HTTP status code for the last response. Document::loader() returns the loader for the last committed
2170         document its frame. For a frame-ancestors violation, a CSP report is sent before the document
2171         that had the frame-ancestors directive has been committed and after it has been associate with a frame.
2172         As a result we are in are in a transient transition state for the frame and hence the last response
2173         for new document's loader (Document::loader()) is actually the last response of the previously loaded
2174         document in the frame. Instead we need to take care to tell CSP about the HTTP status code for the
2175         response associated with the document the CSP came from.
2176
2177         * dom/Document.cpp:
2178         (WebCore::Document::processHttpEquiv):
2179         (WebCore::Document::initSecurityContext):
2180         Pass the HTTP status code to CSP.
2181
2182         * page/csp/ContentSecurityPolicy.cpp:
2183         (WebCore::ContentSecurityPolicy::copyStateFrom):
2184         (WebCore::ContentSecurityPolicy::responseHeaders const):
2185         (WebCore::ContentSecurityPolicy::didReceiveHeaders):
2186         (WebCore::ContentSecurityPolicy::didReceiveHeader):
2187         (WebCore::ContentSecurityPolicy::reportViolation const):
2188         * page/csp/ContentSecurityPolicy.h:
2189         Modify existing functions to take the HTTP status code, store it in a instance variable,
2190         and reference this variable when reporting a violation.
2191
2192         * page/csp/ContentSecurityPolicyResponseHeaders.cpp:
2193         (WebCore::ContentSecurityPolicyResponseHeaders::ContentSecurityPolicyResponseHeaders):
2194         (WebCore::ContentSecurityPolicyResponseHeaders::isolatedCopy const):
2195         * page/csp/ContentSecurityPolicyResponseHeaders.h:
2196         (WebCore::ContentSecurityPolicyResponseHeaders::encode const):
2197         (WebCore::ContentSecurityPolicyResponseHeaders::decode):
2198         Store the HTTP status code along with the response headers.
2199
2200 2018-05-07  Daniel Bates  <dabates@apple.com>
2201
2202         CSP referrer incorrect for document blocked due to violation of its frame-ancestors directive
2203         https://bugs.webkit.org/show_bug.cgi?id=185380
2204
2205         Reviewed by Brent Fulgham.
2206
2207         Similar to <https://bugs.webkit.org/show_bug.cgi?id=185366>, fixes an issue where the referrer
2208         in the sent CSP report for an HTTP document blocked because its frame-ancestors directive was
2209         violated would be the referrer of the previously loaded document in the frame.
2210
2211         Currently whenever we send a CSP report we ask the document's loader (Document::loader()) for
2212         the referrer for the last request. Document::loader() returns the loader for the last committed
2213         document in its frame. For a frame-ancestors violation, a CSP report is sent before the document
2214         that had the frame-ancestors directive has been committed and after it has been associate with a
2215         frame. As a result we are in a transient transition state for the frame and hence the last request
2216         for the new document's loader (Document::loader()) is actually the last request of the previously
2217         loaded document in the frame. Instead we need to take care to tell CSP about the referrer for the
2218         request associated with the document the CSP came from.
2219
2220         * loader/DocumentLoader.cpp:
2221         (WebCore::DocumentLoader::responseReceived):
2222
2223 2018-05-07  Brent Fulgham  <bfulgham@apple.com>
2224
2225         Add experimental feature to prompt for Storage Access API use
2226         https://bugs.webkit.org/show_bug.cgi?id=185335
2227         <rdar://problem/39994649>
2228
2229         Reviewed by Alex Christensen and Youenn Fablet.
2230
2231         Create a new experimental feature that gates the ability of WebKit clients to prompt the user when
2232         Storage Access API is invoked.
2233
2234         Currently this feature doesn't have any user-visible impact.
2235
2236         * page/RuntimeEnabledFeatures.h:
2237         (WebCore::RuntimeEnabledFeatures::setStorageAccessPromptsEnabled):
2238         (WebCore::RuntimeEnabledFeatures::storageAccessPromptsEnabled const):
2239         * testing/InternalSettings.cpp:
2240         (WebCore::InternalSettings::Backup::Backup):
2241         (WebCore::InternalSettings::Backup::restoreTo):
2242         (WebCore::InternalSettings::setStorageAccessPromptsEnabled):
2243         * testing/InternalSettings.h:
2244         * testing/InternalSettings.idl:
2245
2246 2018-05-07  Chris Dumez  <cdumez@apple.com>
2247
2248         Stop using an iframe's id as fallback if its name attribute is not set
2249         https://bugs.webkit.org/show_bug.cgi?id=11388
2250
2251         Reviewed by Geoff Garen.
2252
2253         WebKit had logic to use an iframe's id as fallback name when its name
2254         content attribute is not set. This behavior was not standard and did not
2255         match other browsers:
2256         - https://html.spec.whatwg.org/#attr-iframe-name
2257
2258         Gecko / Trident never behaved this way. Blink was aligned with us until
2259         they started to match the specification in:
2260         - https://bugs.chromium.org/p/chromium/issues/detail?id=347169
2261
2262         This WebKit quirk was causing some Web-compatibility issues because it
2263         would affect the behavior of Window's name property getter when trying
2264         to look up an iframe by id. Because of Window's named property getter
2265         behavior [1], we would return the frame's contentWindow instead of the
2266         iframe element itself.
2267
2268         [1] https://html.spec.whatwg.org/multipage/window-object.html#named-access-on-the-window-object
2269
2270         Test: fast/dom/Window/named-getter-frame-id.html
2271
2272         * html/HTMLFrameElementBase.cpp:
2273         (WebCore::HTMLFrameElementBase::openURL):
2274         (WebCore::HTMLFrameElementBase::parseAttribute):
2275         (WebCore::HTMLFrameElementBase::didFinishInsertingNode):
2276         * html/HTMLFrameElementBase.h:
2277
2278 2018-05-07  Chris Dumez  <cdumez@apple.com>
2279
2280         ASSERT(!childItemWithTarget(child->target())) is hit in HistoryItem::addChildItem()
2281         https://bugs.webkit.org/show_bug.cgi?id=185322
2282
2283         Reviewed by Geoff Garen.
2284
2285         We generate unique names for Frame to be used in HistoryItem. Those names not only
2286         need to be unique, they also need to be repeatable to avoid layout tests flakiness
2287         and for things like restoring form state from a HistoryItem.
2288
2289         The previously generated frame names were relying on the Frame's index among a
2290         parent Frame's children. The issue was that we could end up with duplicate names
2291         because one could insert a Frame *before* an existing one. This is because the code
2292         would not take care of updating existing Frames' unique name on frame tree mutation.
2293
2294         Updating frame tree names on mutation would be inefficient and is also not necessary.
2295         The approach chosen in this patch is to stop using the Frame's index and instead rely
2296         on an increasing counter stored on the top-frame's FrameTree. To make the names
2297         repeatable, we reset the counter on page navigation.
2298
2299         * page/Frame.cpp:
2300         (WebCore::Frame::setDocument):
2301         * page/FrameTree.cpp:
2302         (WebCore::FrameTree::uniqueChildName const):
2303         (WebCore::FrameTree::generateUniqueName const):
2304         * page/FrameTree.h:
2305         (WebCore::FrameTree::resetFrameIdentifiers):
2306
2307 2018-05-07  Yacine Bandou  <yacine.bandou_ext@softathome.com>
2308
2309         [EME][GStreamer] Fix wrong subsample parsing on r227067
2310         https://bugs.webkit.org/show_bug.cgi?id=185382
2311
2312         Reviewed by Philippe Normand.
2313
2314         The initialization of sampleIndex should be moved outside of the loop.
2315         Without this patch we will have a bad log and the check of the subsample
2316         count will be useless.
2317
2318         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
2319         (webKitMediaClearKeyDecryptorDecrypt):
2320
2321 2018-05-07  Daniel Bates  <dabates@apple.com>
2322
2323         CSP should be passed the referrer
2324         https://bugs.webkit.org/show_bug.cgi?id=185367
2325
2326         Reviewed by Per Arne Vollan.
2327
2328         As a step towards formalizing a CSP delegate object and removing the dependencies
2329         on ScriptExecutionContext and Frame, we should pass the document's referrer directly
2330         instead of indirectly obtaining it from the ScriptExecutionContext or Frame used
2331         to instantiate the ContentSecurityPolicy object.
2332
2333         * dom/Document.cpp:
2334         (WebCore::Document::processHttpEquiv): Pass the document's referrer.
2335         (WebCore::Document::initSecurityContext): Ditto.
2336         (WebCore::Document::applyQuickLookSandbox): Ditto.
2337         * loader/DocumentLoader.cpp:
2338         (WebCore::DocumentLoader::responseReceived): Ditto.
2339         * loader/FrameLoader.cpp:
2340         (WebCore::FrameLoader::didBeginDocument): Ditto.
2341         * page/csp/ContentSecurityPolicy.cpp:
2342         (WebCore::ContentSecurityPolicy::copyStateFrom): We pass a null string for the referrer
2343         to didReceiveHeader() as a placeholder since it requires the referrer be given to it. We
2344         fix up the referrer (m_referrer) after copying all the policy headers.
2345         (WebCore::ContentSecurityPolicy::didReceiveHeaders): Ditto.
2346         (WebCore::ContentSecurityPolicy::didReceiveHeader): Modified to take a referrer and WTFMove()s
2347         it into an instance variable (m_referrer).
2348         (WebCore::ContentSecurityPolicy::reportViolation const): Modified to use the stored referrer.
2349         * page/csp/ContentSecurityPolicy.h:
2350         * workers/WorkerGlobalScope.cpp:
2351         (WebCore::WorkerGlobalScope::applyContentSecurityPolicyResponseHeaders): Pass a null string
2352         for the referrer as a worker does not have a referrer.
2353
2354 2018-05-07  Daniel Bates  <dabates@apple.com>
2355
2356         CSP should only notify Inspector to pause the debugger on the first policy to violate a directive
2357         https://bugs.webkit.org/show_bug.cgi?id=185364
2358
2359         Reviewed by Brent Fulgham.
2360
2361         Notify Web Inspector that a script was blocked on the first enforced CSP policy that it
2362         violates.
2363
2364         A page can have more than one enforced Content Security Policy. Currently for inline
2365         scripts, inline event handlers, JavaScript URLs, and eval() that are blocked by CSP
2366         we notify Web Inspector that it was blocked for each CSP policy that blocked it. When
2367         Web Inspector is notified it pauses script execution. It does not seem very meaningful
2368         to pause script execution on the same script for each CSP policy that blocked it.
2369         Therefore, only tell Web Inspector that a script was blocked for the first enforced CSP
2370         policy that blocked it.
2371
2372         * page/csp/ContentSecurityPolicy.cpp:
2373         (WebCore::ContentSecurityPolicy::allowJavaScriptURLs const):
2374         (WebCore::ContentSecurityPolicy::allowInlineEventHandlers const):
2375         (WebCore::ContentSecurityPolicy::allowInlineScript const):
2376         (WebCore::ContentSecurityPolicy::allowEval const):
2377
2378 2018-05-07  Daniel Bates  <dabates@apple.com>
2379
2380         Substitute CrossOriginPreflightResultCache::clear() for CrossOriginPreflightResultCache::empty()
2381         https://bugs.webkit.org/show_bug.cgi?id=185170
2382
2383         Reviewed by Per Arne Vollan.
2384
2385         Rename CrossOriginPreflightResultCache::empty() to CrossOriginPreflightResultCache::clear() make
2386         it consistent with the terminology we use in WebKit to signify a function that clears a collection.
2387         A member function named "empty" is expected to return an instance of a class in its "empty state".
2388         For example, StringImpl::empty() returns a StringImpl instance that represents the empty string.
2389         However CrossOriginPreflightResultCache::empty() clears out the cache in-place. We should rename
2390         this function to better describe its purpose.
2391
2392         * loader/CrossOriginPreflightResultCache.cpp:
2393         (WebCore::CrossOriginPreflightResultCache::clear):
2394         (WebCore::CrossOriginPreflightResultCache::empty): Deleted.
2395         * loader/CrossOriginPreflightResultCache.h:
2396
2397 2018-05-06  Dean Jackson  <dino@apple.com>
2398
2399         WebGL: Reset simulated values after validation fails
2400         https://bugs.webkit.org/show_bug.cgi?id=185363
2401         <rdar://problem/39733417>
2402
2403         Reviewed by Anders Carlsson.
2404
2405         While fixing a previous bug, I forgot to reset some values
2406         when validation fails. This caused a bug where a subsequent
2407         invalid call might use those values and escape detection.
2408
2409         Test: fast/canvas/webgl/index-validation-with-subsequent-draws.html
2410
2411         * html/canvas/WebGLRenderingContextBase.cpp:
2412         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Reset the
2413         sizes when validation fails.
2414         * html/canvas/WebGLRenderingContextBase.h:
2415
2416 2018-05-07  Ms2ger  <Ms2ger@igalia.com>
2417
2418         Support negative sw/sh values in createImageBitmap().
2419         https://bugs.webkit.org/show_bug.cgi?id=184449
2420
2421         Reviewed by Dean Jackson.
2422
2423         Tests: LayoutTests/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html
2424                LayoutTests/http/wpt/2dcontext/imagebitmap/createImageBitmap.html
2425
2426         * html/ImageBitmap.cpp:
2427         (WebCore::ImageBitmap::createPromise): handle negative values per spec.
2428
2429 2018-05-07  Brian Burg  <bburg@apple.com>
2430
2431         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
2432         https://bugs.webkit.org/show_bug.cgi?id=184861
2433         <rdar://problem/39153768>
2434
2435         Reviewed by Timothy Hatcher.
2436
2437         Notify the client of the current connection count whenever a frontend connects or disconnects.
2438
2439         Covered by new API test.
2440
2441         * inspector/InspectorClient.h:
2442         (WebCore::InspectorClient::frontendCountChanged):
2443         * inspector/InspectorController.cpp:
2444         (WebCore::InspectorController::connectFrontend):
2445         (WebCore::InspectorController::disconnectFrontend):
2446         (WebCore::InspectorController::disconnectAllFrontends):
2447         * inspector/InspectorController.h:
2448
2449 2018-05-07  Eric Carlson  <eric.carlson@apple.com>
2450
2451         Text track cue logging should include cue text
2452         https://bugs.webkit.org/show_bug.cgi?id=185353
2453         <rdar://problem/40003565>
2454
2455         Reviewed by Youenn Fablet.
2456
2457         No new tests, tested manually.
2458
2459         * html/track/VTTCue.cpp:
2460         (WebCore::VTTCue::toJSONString const): Use toJSON.
2461         (WebCore::VTTCue::toJSON const): New.
2462         * html/track/VTTCue.h:
2463
2464         * platform/graphics/InbandTextTrackPrivateClient.h:
2465         (WebCore::GenericCueData::toJSONString const): Log m_content.
2466
2467         * platform/graphics/iso/ISOVTTCue.cpp:
2468         (WebCore::ISOWebVTTCue::toJSONString const): Log m_cueText.
2469
2470 2018-05-06  Zalan Bujtas  <zalan@apple.com>
2471
2472         [LFC] Add assertions for stale Display::Box geometry
2473         https://bugs.webkit.org/show_bug.cgi?id=185357
2474
2475         Reviewed by Antti Koivisto.
2476
2477         Ensure that we don't access stale geometry of other boxes during layout.
2478         For example, in order to layout a block child we need the containing block's content box top/left and width (but not the height)
2479
2480         * layout/displaytree/DisplayBox.h:
2481         (WebCore::Display::Box::invalidateTop):
2482         (WebCore::Display::Box::invalidateLeft):
2483         (WebCore::Display::Box::invalidateWidth):
2484         (WebCore::Display::Box::invalidateHeight):
2485         (WebCore::Display::Box::hasValidPosition const):
2486         (WebCore::Display::Box::hasValidSize const):
2487         (WebCore::Display::Box::hasValidGeometry const):
2488         (WebCore::Display::Box::invalidatePosition):
2489         (WebCore::Display::Box::invalidateSize):
2490         (WebCore::Display::Box::setHasValidPosition):
2491         (WebCore::Display::Box::setHasValidSize):
2492         (WebCore::Display::Box::setHasValidGeometry):
2493         (WebCore::Display::Box::rect const):
2494         (WebCore::Display::Box::top const):
2495         (WebCore::Display::Box::left const):
2496         (WebCore::Display::Box::bottom const):
2497         (WebCore::Display::Box::right const):
2498         (WebCore::Display::Box::topLeft const):
2499         (WebCore::Display::Box::bottomRight const):
2500         (WebCore::Display::Box::size const):
2501         (WebCore::Display::Box::width const):
2502         (WebCore::Display::Box::height const):
2503         (WebCore::Display::Box::setRect):
2504         (WebCore::Display::Box::setTopLeft):
2505         (WebCore::Display::Box::setTop):
2506         (WebCore::Display::Box::setLeft):
2507         (WebCore::Display::Box::setSize):
2508         (WebCore::Display::Box::setWidth):
2509         (WebCore::Display::Box::setHeight):
2510
2511 2018-05-06  Zalan Bujtas  <zalan@apple.com>
2512
2513         [LFC] Add BlockFormattingContext::computeStaticPosition
2514         https://bugs.webkit.org/show_bug.cgi?id=185352
2515
2516         Reviewed by Antti Koivisto.
2517
2518         This is the core logic for positioning inflow boxes in a block formatting context (very naive though).
2519
2520         * layout/blockformatting/BlockFormattingContext.cpp:
2521         (WebCore::Layout::BlockFormattingContext::computeStaticPosition const):
2522         * layout/displaytree/DisplayBox.h:
2523
2524 2018-05-05  Sam Weinig  <sam@webkit.org>
2525
2526         Cleanup XMLHttpRequestUpload a little
2527         https://bugs.webkit.org/show_bug.cgi?id=185344
2528
2529         Reviewed by Yusuke Suzuki.
2530
2531         * bindings/js/JSXMLHttpRequestCustom.cpp:
2532         (WebCore::JSXMLHttpRequest::visitAdditionalChildren):
2533         Use auto to reduce redundancy.
2534
2535         * xml/XMLHttpRequest.cpp:
2536         (WebCore::XMLHttpRequest::upload):
2537         * xml/XMLHttpRequest.h:
2538         Switch upload() to return a reference.
2539         
2540         * xml/XMLHttpRequestUpload.cpp:
2541         (WebCore::XMLHttpRequestUpload::XMLHttpRequestUpload):
2542         (WebCore::XMLHttpRequestUpload::dispatchProgressEvent):
2543         * xml/XMLHttpRequestUpload.h:
2544         Cleanup formatting, modernize and switch XMLHttpRequest member from a pointer
2545         to a reference.
2546
2547 2018-05-05  Dean Jackson  <dino@apple.com>
2548
2549         Draw a drop-shadow behind the system preview badge
2550         https://bugs.webkit.org/show_bug.cgi?id=185356
2551         <rdar://problem/40004936>
2552
2553         Reviewed by Wenson Hsieh.
2554
2555         Draw a very subtle drop-shadow under the system
2556         preview badge so that it is more visible on a pure
2557         white background.
2558
2559         I also moved some code around to make it more clear
2560         and improved comments.
2561
2562         * rendering/RenderThemeIOS.mm:
2563         (WebCore::RenderThemeIOS::paintSystemPreviewBadge):
2564
2565 2018-05-04  Wenson Hsieh  <wenson_hsieh@apple.com>
2566
2567         [iOS] Multiple links in Mail are dropped in a single line, and are difficult to tell apart
2568         https://bugs.webkit.org/show_bug.cgi?id=185289
2569         <rdar://problem/35756912>
2570
2571         Reviewed by Tim Horton and Darin Adler.
2572
2573         When inserting multiple URLs as individual items in a single drop, we currently separate each item with a space
2574         (see r217284). However, it still seems difficult to tell dropped links apart. This patch makes some slight
2575         tweaks to WebContentReader::readURL so that it inserts line breaks before dropped URLs, if the dropped URL isn't
2576         the first item to be inserted in the resulting document fragment.
2577
2578         Augments existing API tests in DataInteractionTests.
2579
2580         * editing/ios/WebContentReaderIOS.mm:
2581
2582         Additionally remove some extraneous header imports from this implementation file.
2583
2584         (WebCore::WebContentReader::readURL):
2585
2586 2018-05-02  Dean Jackson  <dino@apple.com>
2587
2588         Use IOSurfaces for CoreImage operations where possible
2589         https://bugs.webkit.org/show_bug.cgi?id=185230
2590         <rdar://problem/39926929>
2591
2592         Reviewed by Jon Lee.
2593
2594         On iOS hardware, we can use IOSurfaces as a rendering destination
2595         for CoreImage, which means we're keeping data on the GPU
2596         for rendering.
2597
2598         As a drive-by fix, I used a convenience method for Gaussian blurs.
2599
2600         * rendering/RenderThemeIOS.mm:
2601         (WebCore::RenderThemeIOS::paintSystemPreviewBadge):
2602
2603 2018-05-04  Tim Horton  <timothy_horton@apple.com>
2604
2605         Shift to a lower-level framework for simplifying URLs
2606         https://bugs.webkit.org/show_bug.cgi?id=185334
2607
2608         Reviewed by Dan Bernstein.
2609
2610         * Configurations/WebCore.xcconfig:
2611         * platform/mac/DragImageMac.mm:
2612         (WebCore::LinkImageLayout::LinkImageLayout):
2613
2614 2018-05-03  Ryosuke Niwa  <rniwa@webkit.org>
2615
2616         Release assert in ScriptController::canExecuteScripts via HTMLMediaElement::~HTMLMediaElement()
2617         https://bugs.webkit.org/show_bug.cgi?id=185288
2618
2619         Reviewed by Jer Noble.
2620
2621         The crash is caused by HTMLMediaElement::~HTMLMediaElement canceling the resource load via CachedResource
2622         which ends up calling FrameLoader::checkCompleted() and fire load event on the document synchronously.
2623         Speculatively fix the crash by scheduling the check instead.
2624
2625         In long term, ResourceLoader::cancel should never fire load event synchronously: webkit.org/b/185284.
2626
2627         Unfortunately, no new tests since I can't get MediaResource to get destructed at the right time.
2628
2629         * html/HTMLMediaElement.cpp:
2630         (WebCore::HTMLMediaElement::isRunningDestructor): Added to detect this specific case.
2631         (WebCore::HTMLMediaElementDestructorScope): Added.
2632         (WebCore::HTMLMediaElementDestructorScope::HTMLMediaElementDestructorScope): Added.
2633         (WebCore::HTMLMediaElementDestructorScope::~HTMLMediaElementDestructorScope): Added.
2634         (WebCore::HTMLMediaElement::~HTMLMediaElement): Instantiate HTMLMediaElement.
2635         * html/HTMLMediaElement.h:
2636         * loader/FrameLoader.cpp:
2637         (WebCore::FrameLoader::checkCompleted): Call scheduleCheckCompleted instead of synchronously calling
2638         checkCompleted if we're in the middle of destructing a HTMLMediaElement.
2639
2640 2018-05-04  Ryosuke Niwa  <rniwa@webkit.org>
2641
2642         Rename DocumentOrderedMap to TreeScopeOrderedMap
2643         https://bugs.webkit.org/show_bug.cgi?id=185290
2644
2645         Reviewed by Zalan Bujtas.
2646
2647         Renamed the class since it's almost always a mistake to use this class as a member variable of Document.
2648
2649         * Sources.txt:
2650         * WebCore.xcodeproj/project.pbxproj:
2651         * dom/MouseRelatedEvent.cpp: Include the forgotten DOMWindow.h. Unified build files bit us here.
2652         * dom/TreeScope.cpp:
2653         (WebCore::TreeScope::addElementById):
2654         (WebCore::TreeScope::addElementByName):
2655         (WebCore::TreeScope::addImageMap):
2656         (WebCore::TreeScope::addImageElementByUsemap):
2657         (WebCore::TreeScope::labelElementForId):
2658         * dom/TreeScope.h:
2659         * dom/TreeScopeOrderedMap.cpp: Renamed from DocumentOrderedMap.cpp
2660         * dom/TreeScopeOrderedMap.h: Renamed from DocumentOrderedMap.h
2661         * html/HTMLDocument.h:
2662
2663 2018-05-04  Don Olmstead  <don.olmstead@sony.com>
2664
2665         [Win][WebKit] Fix forwarding headers for Windows build
2666         https://bugs.webkit.org/show_bug.cgi?id=184412
2667
2668         Reviewed by Alex Christensen.
2669
2670         No new tests. No change in behavior.
2671
2672         * PlatformWin.cmake:
2673
2674 2018-05-04  Zalan Bujtas  <zalan@apple.com>
2675
2676         [Simple line layout] Add support for line layout box generation with multiple text renderers.
2677         https://bugs.webkit.org/show_bug.cgi?id=185276
2678
2679         Reviewed by Antti Koivisto.
2680
2681         Covered by existing tests.
2682
2683         * rendering/SimpleLineLayoutFunctions.cpp:
2684         (WebCore::SimpleLineLayout::canUseForLineBoxTree):
2685         (WebCore::SimpleLineLayout::generateLineBoxTree):
2686         * rendering/SimpleLineLayoutResolver.cpp:
2687         (WebCore::SimpleLineLayout::RunResolver::Run::renderer const):
2688         (WebCore::SimpleLineLayout::RunResolver::Run::localStart const):
2689         (WebCore::SimpleLineLayout::RunResolver::Run::localEnd const):
2690         * rendering/SimpleLineLayoutResolver.h:
2691
2692 2018-05-04  Timothy Hatcher  <timothy@apple.com>
2693
2694         Deprecate legacy WebView and friends
2695         https://bugs.webkit.org/show_bug.cgi?id=185279
2696         rdar://problem/33268700
2697
2698         Reviewed by Tim Horton.
2699
2700         * Configurations/WebCore.xcconfig:
2701         Added BUILDING_WEBKIT define to disable the deprecation macros.
2702         * bridge/objc/WebScriptObject.h:
2703         Added deprecation macros to WebScriptObject and WebUndefined.
2704         * platform/cocoa/WebKitAvailability.h:
2705         Added more macros and a way to disable deprecation warnings for
2706         WebKit build and in clients like Safari.
2707
2708 2018-05-04  Eric Carlson  <eric.carlson@apple.com>
2709
2710         Log media time range as JSON
2711         https://bugs.webkit.org/show_bug.cgi?id=185321
2712         <rdar://problem/39986746>
2713
2714         Reviewed by Youenn Fablet.
2715
2716         No new tests, tested manually.
2717
2718         * html/HTMLMediaElement.cpp:
2719         (WebCore::HTMLMediaElement::addPlayedRange): Log as time range.
2720         (WebCore::HTMLMediaElement::visibilityStateChanged): Cleanup.
2721
2722         * platform/graphics/MediaPlayer.h:
2723         (WTF::LogArgument<MediaTime>::toString):
2724         (WTF::LogArgument<MediaTimeRange>::toString):
2725
2726         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
2727         (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Log error as time range.
2728
2729 2018-05-04  Zalan Bujtas  <zalan@apple.com>
2730
2731         Use the containing block to compute the pagination gap when the container is inline.
2732         https://bugs.webkit.org/show_bug.cgi?id=184724
2733         <rdar://problem/39521800>
2734
2735         Reviewed by Simon Fraser.
2736
2737         Test: fast/overflow/page-overflow-with-inline-body-crash.html
2738
2739         * page/FrameView.cpp:
2740         (WebCore::FrameView::applyPaginationToViewport):
2741
2742 2018-05-04  Tim Horton  <timothy_horton@apple.com>
2743
2744         Don't use GSFont* in minimal simulator mode
2745         https://bugs.webkit.org/show_bug.cgi?id=185320
2746         <rdar://problem/39734478>
2747
2748         Reviewed by Beth Dakin.
2749
2750         * page/cocoa/MemoryReleaseCocoa.mm:
2751         (WebCore::platformReleaseMemory):
2752
2753 2018-05-04  Chris Dumez  <cdumez@apple.com>
2754
2755         Unreviewed, rolling out r231331.
2756
2757         Caused a few tests to assert
2758
2759         Reverted changeset:
2760
2761         "Stop using an iframe's id as fallback if its name attribute
2762         is not set"
2763         https://bugs.webkit.org/show_bug.cgi?id=11388
2764         https://trac.webkit.org/changeset/231331
2765
2766 2018-05-04  Youenn Fablet  <youenn@apple.com>
2767
2768         Use more references in updateTracksOfType
2769         https://bugs.webkit.org/show_bug.cgi?id=185305
2770
2771         Reviewed by Eric Carlson.
2772
2773         No change of behavior.
2774
2775         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2776         (WebCore::updateTracksOfType):
2777         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
2778
2779 2018-05-04  Myles C. Maxfield  <mmaxfield@apple.com>
2780
2781         Text shaping in the simple path is flipped in the y direction
2782         https://bugs.webkit.org/show_bug.cgi?id=185062
2783         <rdar://problem/39778678>
2784
2785         Reviewed by Simon Fraser.
2786
2787         Shaping in our simple codepath occurs in an "increasing-y-goes-up" coordinate system, but our painting
2788         code uses an "increasing-y-goes-down" coordinate system. We weren't fixing up the coordinate systems
2789         because we never noticed. This is because the simple codepath is only designed for kerning and ligatures,
2790         neither of which move glyphs vertically in the common case.
2791
2792         Test: fast/text/vertical-displacement-simple-codepath.html
2793
2794         * platform/graphics/Font.cpp:
2795         (WebCore::Font::applyTransforms const):
2796         * platform/graphics/WidthIterator.cpp:
2797         (WebCore::WidthIterator::applyFontTransforms):
2798
2799 2018-05-04  Chris Nardi  <cnardi@chromium.org>
2800
2801         Serialize all URLs with double-quotes per CSSOM spec
2802         https://bugs.webkit.org/show_bug.cgi?id=184935
2803
2804         Reviewed by Antti Koivisto.
2805
2806         According to https://drafts.csswg.org/cssom/#serialize-a-url, all URLs should be serialized as strings,
2807         which means they should have double quotes around the text of the URL. Update our implementation to match
2808         this (and Firefox/Chrome). Also remove isCSSTokenizerURL() as this method is no longer needed.
2809
2810         Tests: Many LayoutTests updated to use double quotes.
2811
2812         * css/CSSMarkup.cpp:
2813         (WebCore::serializeString): Remove FIXME as this was already fixed in a previous patch.
2814         (WebCore::serializeURL): Remove FIXME and update implementation.
2815
2816 2018-05-04  Youenn Fablet  <youenn@apple.com>
2817
2818         LayoutTests/fast/mediastream/change-tracks-media-stream-being-played.html is crashing after r231304
2819         https://bugs.webkit.org/show_bug.cgi?id=185303
2820
2821         Reviewed by Eric Carlson.
2822
2823         We need to stop observing the audio track like we do for video track once we are no longer interested in it.
2824         Covered by test no longer crashing.
2825
2826         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2827         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
2828
2829 2018-05-04  Zalan Bujtas  <zalan@apple.com>
2830
2831         [LFC] Set the invalidation root as the result of style change.
2832         https://bugs.webkit.org/show_bug.cgi?id=185301
2833
2834         Reviewed by Antti Koivisto.
2835
2836         Compute/propagate the update type on the ancestor chain and return the invalidation root
2837         so that LayoutContext could use it as the entry point for the next layout frame.
2838
2839         * layout/LayoutContext.cpp:
2840         (WebCore::Layout::LayoutContext::updateLayout):
2841         (WebCore::Layout::LayoutContext::styleChanged):
2842         * layout/LayoutContext.h: order is not important.
2843         * layout/blockformatting/BlockInvalidation.cpp:
2844         (WebCore::Layout::invalidationStopsAtFormattingContextBoundary):
2845         (WebCore::Layout::computeUpdateType):
2846         (WebCore::Layout::computeUpdateTypeForAncestor):
2847         (WebCore::Layout::BlockInvalidation::invalidate):
2848         * layout/blockformatting/BlockInvalidation.h:
2849         * layout/inlineformatting/InlineInvalidation.cpp:
2850         (WebCore::Layout::InlineInvalidation::invalidate):
2851         * layout/inlineformatting/InlineInvalidation.h:
2852
2853 2018-05-04  Youenn Fablet  <youenn@apple.com>
2854
2855         PeerConnection should have its connectionState closed even if doing gathering
2856         https://bugs.webkit.org/show_bug.cgi?id=185267
2857
2858         Reviewed by Darin Adler.
2859
2860         Test: webrtc/addICECandidate-closed.html
2861
2862         In case m_iceConnectionState is closed, m_connectionState should also be set to closed
2863         and RTCPeerConnection should be closed so as to reject any other call.
2864
2865         * Modules/mediastream/RTCPeerConnection.cpp:
2866         (WebCore::RTCPeerConnection::close):
2867         (WebCore::RTCPeerConnection::updateConnectionState):
2868
2869 2018-05-04  Yacine Bandou  <yacine.bandou_ext@softathome.com>
2870
2871         [MSE][GStreamer] Delete properly the stream from the WebKitMediaSource
2872         https://bugs.webkit.org/show_bug.cgi?id=185242
2873
2874         Reviewed by Xabier Rodriguez-Calvar.
2875
2876         When the sourceBuffer is removed from mediasource, the appropriate stream is not
2877         properly deleted from WebKitMediaSource, because the appsrc and parser elements
2878         of the stream are not removed from the WebKitMediaSource bin.
2879
2880         This patch avoids the regression of r231089, see https://bugs.webkit.org/show_bug.cgi?id=185071
2881
2882         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
2883         (webKitMediaSrcFreeStream):
2884
2885 2018-05-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2886
2887         [GTK] Epiphany (GNOME Web) says "Error downloading: Service Unavailable." when trying to download an image from discogs.com
2888         https://bugs.webkit.org/show_bug.cgi?id=174730
2889
2890         Reviewed by Michael Catanzaro.
2891
2892         Export ResourceRequestBase::hasHTTPHeaderField().
2893
2894         * platform/network/ResourceRequestBase.h:
2895
2896 2018-05-03  Yusuke Suzuki  <utatane.tea@gmail.com>
2897
2898         Use subprocess.call instead of os.system to handle path with spaces
2899         https://bugs.webkit.org/show_bug.cgi?id=185291
2900
2901         Reviewed by Darin Adler.
2902
2903         If gperf path includes spaces, these python scripts fail to execute gperf.
2904         We use subprocess module instead of os.system to invoke gperf.
2905
2906         * css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
2907         * css/makeSelectorPseudoElementsMap.py:
2908         * platform/network/create-http-header-name-table:
2909
2910 2018-05-03  Yusuke Suzuki  <utatane.tea@gmail.com>
2911
2912         Unreviewed, attempt to fix WinCairo build failure
2913         https://bugs.webkit.org/show_bug.cgi?id=185218
2914
2915         * platform/text/win/LocaleWin.cpp:
2916         (WebCore::LocaleWin::getLocaleInfoString):
2917
2918 2018-05-03  Filip Pizlo  <fpizlo@apple.com>
2919
2920         Strings should not be allocated in a gigacage
2921         https://bugs.webkit.org/show_bug.cgi?id=185218
2922
2923         Reviewed by Saam Barati.
2924
2925         No new tests because no new behavior.
2926
2927         * Modules/indexeddb/server/IDBSerialization.cpp:
2928         (WebCore::decodeKey):
2929         * bindings/js/SerializedScriptValue.cpp:
2930         (WebCore::CloneDeserializer::readString):
2931         * html/canvas/CanvasRenderingContext2D.cpp:
2932         (WebCore::normalizeSpaces):
2933         * html/parser/HTMLTreeBuilder.cpp:
2934         (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeRemainingWhitespace):
2935         * platform/URLParser.cpp:
2936         (WebCore::percentEncodeByte):
2937         (WebCore::serializeURLEncodedForm):
2938         (WebCore::URLParser::serialize):
2939         * platform/URLParser.h:
2940         * platform/graphics/FourCC.cpp:
2941         (WebCore::FourCC::toString const):
2942         * platform/graphics/ca/GraphicsLayerCA.cpp:
2943         (WebCore::GraphicsLayerCA::ReplicaState::cloneID const):
2944         * platform/text/LocaleICU.cpp:
2945         (WebCore::LocaleICU::decimalSymbol):
2946         (WebCore::LocaleICU::decimalTextAttribute):
2947         (WebCore::getDateFormatPattern):
2948         (WebCore::LocaleICU::createLabelVector):
2949         (WebCore::getFormatForSkeleton):
2950         * platform/win/FileSystemWin.cpp:
2951         (WebCore::FileSystem::getFinalPathName):
2952         (WebCore::FileSystem::pathByAppendingComponent):
2953         (WebCore::FileSystem::storageDirectory):
2954
2955 2018-05-02  Brent Fulgham  <bfulgham@apple.com>
2956
2957         Widgets should hold a WeakPtr to their parents
2958         https://bugs.webkit.org/show_bug.cgi?id=185239
2959         <rdar://problem/39741250>
2960
2961         Reviewed by Zalan Bujtas.
2962
2963         * platform/ScrollView.h:
2964         (WebCore::ScrollView::weakPtrFactory): Added.
2965         * platform/Widget.cpp:
2966         (WebCore::Widget::init): Don't perform an unnecessary assignment.
2967         (WebCore::Widget::setParent): Grab a WeakPtr to the parent ScrollView.
2968         * platform/Widget.h:
2969         (WebCore::Widget::parent const): Change type to a WeakPtr.
2970
2971 2018-05-03  Yusuke Suzuki  <utatane.tea@gmail.com>
2972
2973         Use pointer instead of std::optional<T&>
2974         https://bugs.webkit.org/show_bug.cgi?id=185186
2975
2976         Reviewed by Alex Christensen.
2977
2978         std::optional<T&> is not accepted in C++17 spec.
2979         In this patch, we replace it with T*, which is well-aligned to
2980         WebKit's convention.
2981
2982         * Modules/mediastream/RTCPeerConnection.cpp:
2983         (WebCore::iceServersFromConfiguration):
2984         (WebCore::RTCPeerConnection::initializeConfiguration):
2985         (WebCore::RTCPeerConnection::setConfiguration):
2986         * css/parser/CSSParser.cpp:
2987         (WebCore::CSSParser::parseSystemColor):
2988         * css/parser/CSSParser.h:
2989         * dom/DatasetDOMStringMap.cpp:
2990         (WebCore::DatasetDOMStringMap::item const):
2991         (WebCore::DatasetDOMStringMap::namedItem const):
2992         (WebCore:: const): Deleted.
2993         * dom/DatasetDOMStringMap.h:
2994         * dom/Element.cpp:
2995         (WebCore::Element::insertAdjacentHTML):
2996         * dom/Element.h:
2997         * html/canvas/CanvasStyle.cpp:
2998         (WebCore::parseColor):
2999         * inspector/DOMEditor.cpp:
3000         * platform/network/curl/CurlFormDataStream.cpp:
3001         (WebCore::CurlFormDataStream::getPostData):
3002         (): Deleted.
3003         * platform/network/curl/CurlFormDataStream.h:
3004         * platform/network/curl/CurlRequest.cpp:
3005         (WebCore::CurlRequest::setupPOST):
3006         * testing/MockCDMFactory.cpp:
3007         (WebCore::MockCDMFactory::keysForSessionWithID const):
3008         (WebCore::MockCDMInstance::updateLicense):
3009         (WebCore:: const): Deleted.
3010         * testing/MockCDMFactory.h:
3011
3012 2018-05-03  Chris Dumez  <cdumez@apple.com>
3013
3014         Stop using an iframe's id as fallback if its name attribute is not set
3015         https://bugs.webkit.org/show_bug.cgi?id=11388
3016
3017         Reviewed by Geoff Garen.
3018
3019         WebKit had logic to use an iframe's id as fallback name when its name
3020         content attribute is not set. This behavior was not standard and did not
3021         match other browsers:
3022         - https://html.spec.whatwg.org/#attr-iframe-name
3023
3024         Gecko / Trident never behaved this way. Blink was aligned with us until
3025         they started to match the specification in:
3026         - https://bugs.chromium.org/p/chromium/issues/detail?id=347169
3027
3028         This WebKit quirk was causing some Web-compatibility issues because it
3029         would affect the behavior of Window's name property getter when trying
3030         to look up an iframe by id. Because of Window's named property getter
3031         behavior [1], we would return the frame's contentWindow instead of the
3032         iframe element itself.
3033
3034         [1] https://html.spec.whatwg.org/multipage/window-object.html#named-access-on-the-window-object
3035
3036         Test: fast/dom/Window/named-getter-frame-id.html
3037
3038         * html/HTMLFrameElementBase.cpp:
3039         (WebCore::HTMLFrameElementBase::openURL):
3040         (WebCore::HTMLFrameElementBase::parseAttribute):
3041         (WebCore::HTMLFrameElementBase::didFinishInsertingNode):
3042         * html/HTMLFrameElementBase.h:
3043
3044 2018-05-03  Eric Carlson  <eric.carlson@apple.com>
3045
3046         [iOS] Internal text and audio tracks not in fullscreen menu
3047         https://bugs.webkit.org/show_bug.cgi?id=185268
3048         <rdar://problem/38673440>
3049
3050         Reviewed by Jer Noble.
3051
3052         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
3053         (WebCore::PlaybackSessionModelMediaElement::setMediaElement): 'addtrack' and 'removetrack'
3054         events are fired at the track lists, not the media element.
3055
3056 2018-05-03  Ryosuke Niwa  <rniwa@webkit.org>
3057
3058         Using image map inside a shadow tree results hits a release assert in DocumentOrderedMap::add
3059         https://bugs.webkit.org/show_bug.cgi?id=185238
3060
3061         Reviewed by Antti Koivisto.
3062
3063         The bug was caused by DocumentOrderedMap for the image elements with usemap being stored in Document
3064         even if those image elements were in a shadow tree. Fixed the bug by moving the map to TreeScope.
3065
3066         Test: fast/images/imagemap-in-nested-shadow-tree.html
3067               fast/images/imagemap-in-shadow-tree.html
3068
3069         * dom/Document.cpp:
3070         (WebCore::Document::addImageElementByUsemap): Moved to TreeScope.
3071         (WebCore::Document::removeImageElementByUsemap): Ditto.
3072         (WebCore::Document::imageElementByUsemap const): Ditto.
3073         * dom/Document.h:
3074         * dom/TreeScope.cpp:
3075         (WebCore::TreeScope::destroyTreeScopeData): Clear m_imagesByUsemap as well as m_elementsByName.
3076         (WebCore::TreeScope::getImageMap const): Removed the code to parse usemap. RenderImage::imageMap()
3077         which used to call this function with the raw value of the usemap content attribute now calls it
3078         via HTMLImageElement::associatedMapElement(), which uses the parsed usemap.
3079         (WebCore::TreeScope::addImageElementByUsemap): Moved from Document.
3080         (WebCore::TreeScope::removeImageElementByUsemap): Ditto.
3081         (WebCore::TreeScope::imageElementByUsemap const): Ditto.
3082         * dom/TreeScope.h:
3083         * html/HTMLImageElement.cpp:
3084         (WebCore::HTMLImageElement::parseAttribute):
3085         (WebCore::HTMLImageElement::insertedIntoAncestor): This image element can be associated with a map element
3086         if it's connected to a document.
3087         (WebCore::HTMLImageElement::removedFromAncestor):
3088         (WebCore::HTMLImageElement::associatedMapElement const):
3089         * html/HTMLImageElement.h:
3090         * html/HTMLMapElement.cpp:
3091         (WebCore::HTMLMapElement::imageElement):
3092         * rendering/RenderImage.cpp:
3093         (WebCore::RenderImage::imageMap const):
3094
3095 2018-05-03  Justin Fan  <justin_fan@apple.com>
3096
3097         [WebGL] Add runtime flag for enabling ASTC support in WebGL
3098         https://bugs.webkit.org/show_bug.cgi?id=184840
3099
3100         Reviewed by Myles C. Maxfield.
3101
3102         Added runtime flag for ASTC support in WebGL, to turn on/off when extension is implemented.
3103
3104         * page/RuntimeEnabledFeatures.h:
3105         (WebCore::RuntimeEnabledFeatures::setWebGLCompressedTextureASTCSupportEnabled):
3106         (WebCore::RuntimeEnabledFeatures::webGLCompressedTextureASTCSupportEnabled const):
3107
3108 2018-05-03  Chris Nardi  <cnardi@chromium.org>
3109
3110         Remove [NoInterfaceObject] from DOMRectList
3111         https://bugs.webkit.org/show_bug.cgi?id=185255
3112
3113         Reviewed by Chris Dumez.
3114
3115         In https://github.com/w3c/fxtf-drafts/issues/233, [NoInterfaceObject] was removed
3116         from DOMRectList. Remove it from our implementation to match the spec, as well as
3117         Chrome and Firefox.
3118
3119         Updated web platform tests IDL test for the Geometry spec.
3120
3121         * dom/DOMRectList.idl:
3122
3123 2018-05-03  Chris Dumez  <cdumez@apple.com>
3124
3125         REGRESSION(iOS 11.3): Crashes in TimerBase::~TimerBase() in Tencent x5gamehelper
3126         https://bugs.webkit.org/show_bug.cgi?id=185073
3127         <rdar://problem/39821223>
3128
3129         Reviewed by Alexey Proskuryakov.
3130
3131         The following changes were made:
3132         - Make sure SocketStream callbacks are always scheduled on the right runloop:
3133           WebThreadRunLoop() on WebKitLegacy iOS, loaderRunLoop() on Windows and
3134           main runloop otherwise.
3135         - When the SocketStream callbacks are called, unconditionally call callOnMainThreadAndWait()
3136           before calling methods on the SocketStream client. Previously, this code path
3137           was specific to Windows but there is no reason to have platform-specific code here.
3138           callOnMainThreadAndWait() calls the function right away if we're already on the main
3139           thread, which will be the case on other platform than Windows.
3140
3141         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
3142         (WebCore::callbacksRunLoop):
3143         (WebCore::callbacksRunLoopMode):
3144         (WebCore::SocketStreamHandleImpl::scheduleStreams):
3145         (WebCore::SocketStreamHandleImpl::pacExecutionCallback):
3146         (WebCore::SocketStreamHandleImpl::executePACFileURL):
3147         (WebCore::SocketStreamHandleImpl::removePACRunLoopSource):
3148         (WebCore::SocketStreamHandleImpl::readStreamCallback):
3149         (WebCore::SocketStreamHandleImpl::writeStreamCallback):
3150         (WebCore::SocketStreamHandleImpl::platformClose):
3151
3152 2018-05-03  Zalan Bujtas  <zalan@apple.com>
3153
3154         [LFC] Enable multiple layout roots for incremental layout.
3155         https://bugs.webkit.org/show_bug.cgi?id=185185
3156
3157         Reviewed by Antti Koivisto.
3158
3159         With certain type of style changes, we can stop the box invalidation at the formatting context boundary.
3160         When multiple boxes need updating in different formatting contexts, instead of marking the parent containing block chain all
3161         the way up to a common ancestor, we could just work with a list of layout entry points per layout frame.
3162
3163         * layout/FormattingState.h:
3164         * layout/LayoutContext.cpp:
3165         (WebCore::Layout::LayoutContext::updateLayout):
3166         (WebCore::Layout::LayoutContext::addLayoutEntryPoint):
3167         * layout/LayoutContext.h:
3168
3169 2018-05-03  Zalan Bujtas  <zalan@apple.com>
3170
3171         [LFC] Box invalidation logic should go to dedicated classes.
3172         https://bugs.webkit.org/show_bug.cgi?id=185249
3173
3174         Reviewed by Antti Koivisto.
3175
3176         Each formatting context can initiate a different type of invalidation when
3177         style attribute changes in a box.
3178
3179         * Sources.txt:
3180         * WebCore.xcodeproj/project.pbxproj:
3181         * layout/FormattingState.cpp:
3182         (WebCore::Layout::FormattingState::FormattingState):
3183         * layout/FormattingState.h:
3184         (WebCore::Layout::FormattingState::isBlockFormattingState const):
3185         (WebCore::Layout::FormattingState::isInlineFormattingState const):
3186         * layout/LayoutContext.cpp:
3187         (WebCore::Layout::LayoutContext::styleChanged):
3188         (WebCore::Layout::LayoutContext::markNeedsUpdate):
3189         * layout/LayoutContext.h:
3190         * layout/blockformatting/BlockFormattingState.cpp:
3191         (WebCore::Layout::BlockFormattingState::BlockFormattingState):
3192         * layout/blockformatting/BlockFormattingState.h:
3193         * layout/blockformatting/BlockInvalidation.cpp: Copied from Source/WebCore/layout/blockformatting/BlockFormattingState.cpp.
3194         (WebCore::Layout::BlockInvalidation::invalidate):
3195         * layout/blockformatting/BlockInvalidation.h: Copied from Source/WebCore/layout/inlineformatting/InlineFormattingState.h.
3196         * layout/inlineformatting/InlineFormattingState.cpp:
3197         (WebCore::Layout::InlineFormattingState::InlineFormattingState):
3198         * layout/inlineformatting/InlineFormattingState.h:
3199         * layout/inlineformatting/InlineInvalidation.cpp: Copied from Source/WebCore/layout/inlineformatting/InlineFormattingState.cpp.
3200         (WebCore::Layout::InlineInvalidation::invalidate):
3201         * layout/inlineformatting/InlineInvalidation.h: Copied from Source/WebCore/layout/blockformatting/BlockFormattingState.h.
3202
3203 2018-05-03  Michael Catanzaro  <mcatanzaro@igalia.com>
3204
3205         WebKit should send fake macOS user agent to docs.google.com
3206         https://bugs.webkit.org/show_bug.cgi?id=185165
3207
3208         Reviewed by Carlos Garcia Campos.
3209
3210         * platform/UserAgentQuirks.cpp:
3211         (WebCore::urlRequiresMacintoshPlatform):
3212         (WebCore::urlRequiresLinuxDesktopPlatform):
3213
3214 2018-05-03  Commit Queue  <commit-queue@webkit.org>
3215
3216         Unreviewed, rolling out r231223 and r231288.
3217         https://bugs.webkit.org/show_bug.cgi?id=185256
3218
3219         The change in r231223 breaks internal builds, and r231288 is a
3220         dependent change. (Requested by ryanhaddad on #webkit).
3221
3222         Reverted changesets:
3223
3224         "Use default std::optional if it is provided"
3225         https://bugs.webkit.org/show_bug.cgi?id=185159
3226         https://trac.webkit.org/changeset/231223
3227
3228         "Use pointer instead of
3229         std::optional<std::reference_wrapper<>>"
3230         https://bugs.webkit.org/show_bug.cgi?id=185186
3231         https://trac.webkit.org/changeset/231288
3232
3233 2018-05-03  Ryan Haddad  <ryanhaddad@apple.com>
3234
3235         Unreviewed, rolling out r231253.
3236
3237         The API test added with this change is crashing on the bots.
3238
3239         Reverted changeset:
3240
3241         "Web Inspector: opt out of process swap on navigation if a Web
3242         Inspector frontend is connected"
3243         https://bugs.webkit.org/show_bug.cgi?id=184861
3244         https://trac.webkit.org/changeset/231253
3245
3246 2018-05-03  Youenn Fablet  <youenn@apple.com>
3247
3248         A MediaStream being played should allow removing some of its tracks
3249         https://bugs.webkit.org/show_bug.cgi?id=185233
3250
3251         Reviewed by Eric Carlson.
3252
3253         Update the tracks out of the for loop.
3254         Test: fast/mediastream/change-tracks-media-stream-being-played.html
3255
3256         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3257         (WebCore::updateTracksOfType):
3258
3259 2018-05-03  Miguel Gomez  <magomez@igalia.com>
3260
3261         WebCore::TextureMapperLayer object used after freed
3262         https://bugs.webkit.org/show_bug.cgi?id=184729
3263
3264         Reviewed by Michael Catanzaro.
3265
3266         Replace the raw pointers with WeakPtr for effectTarget, maskLayer and replicaLayer
3267         inside TextureMapperLayer.
3268
3269         * platform/graphics/texmap/TextureMapperLayer.cpp:
3270         (WebCore::TextureMapperLayer::~TextureMapperLayer):
3271         (WebCore::TextureMapperLayer::setMaskLayer):
3272         (WebCore::TextureMapperLayer::setReplicaLayer):
3273         * platform/graphics/texmap/TextureMapperLayer.h:
3274
3275 2018-05-03  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3276
3277         [Curl] Add OpenSSL/LibreSSL multi-threading support
3278         https://bugs.webkit.org/show_bug.cgi?id=185138
3279
3280         The older OpenSSL manual says the locking_function and threadid_function should
3281         be set when use it in multi-threading environment. This applies to LibreSSL also.
3282         https://www.openssl.org/docs/man1.0.2/crypto/threads.html
3283
3284         For unix and other similar os, the default threadId_function implementation is
3285         good enough. We'll set custom callback only for Windows OS.
3286
3287         Note it's not required for OpenSSL 1.1.0 and after.
3288         https://www.openssl.org/blog/blog/2017/02/21/threads/
3289
3290         Reviewed by Per Arne Vollan.
3291
3292         * platform/network/curl/CurlSSLHandle.cpp:
3293         (WebCore::CurlSSLHandle::CurlSSLHandle):
3294         (WebCore::CurlSSLHandle::ThreadSupport::ThreadSupport):
3295         (WebCore::CurlSSLHandle::ThreadSupport::lockingCallback):
3296         (WebCore::CurlSSLHandle::ThreadSupport::threadIdCallback):
3297         * platform/network/curl/CurlSSLHandle.h:
3298         (WebCore::CurlSSLHandle::ThreadSupport::setup):
3299         (WebCore::CurlSSLHandle::ThreadSupport::singleton):
3300         (WebCore::CurlSSLHandle::ThreadSupport::lock):
3301         (WebCore::CurlSSLHandle::ThreadSupport::unlock):
3302
3303 2018-05-02  Ryosuke Niwa  <rniwa@webkit.org>
3304
3305         Remove superfluous check for a null attribute value check in Element::removeAttributeInternal
3306         https://bugs.webkit.org/show_bug.cgi?id=185227
3307
3308         Reviewed by Chris Dumez.
3309
3310         Removed the check. The attribute value string can never be null.
3311
3312         * dom/Element.cpp:
3313         (WebCore::Element::removeAttributeInternal):
3314
3315 2018-05-02  Zalan Bujtas  <zalan@apple.com>
3316
3317         [LFC] Implement LayoutContext::createDisplayBox
3318         https://bugs.webkit.org/show_bug.cgi?id=185158
3319
3320         Reviewed by Antti Koivisto.
3321
3322         Now compute*() functions take both the const layout and the corresponding non-const display boxes.
3323         Display boxes are owned by the LayoutContext and they don't form a tree structure (only implicitly through the layout tree).
3324         (This might need to change in the future if we decide to arrange them in some sort of painting order)
3325
3326         * layout/FloatingContext.cpp:
3327         (WebCore::Layout::FloatingContext::computePosition):
3328         * layout/FloatingContext.h:
3329         * layout/FormattingContext.cpp:
3330         (WebCore::Layout::FormattingContext::computeStaticPosition const):
3331         (WebCore::Layout::FormattingContext::computeInFlowPositionedPosition const):
3332         (WebCore::Layout::FormattingContext::computeOutOfFlowPosition const):
3333         (WebCore::Layout::FormattingContext::computeWidth const):
3334         (WebCore::Layout::FormattingContext::computeHeight const):
3335         (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const):
3336         (WebCore::Layout::FormattingContext::computeFloatingWidth const):
3337         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
3338         (WebCore::Layout::FormattingContext::computeFloatingHeight const):
3339         * layout/FormattingContext.h:
3340         * layout/LayoutContext.cpp:
3341         (WebCore::Layout::LayoutContext::createDisplayBox):
3342         * layout/LayoutContext.h:
3343         (WebCore::Layout::LayoutContext::displayBoxForLayoutBox const):
3344         * layout/blockformatting/BlockFormattingContext.cpp:
3345         (WebCore::Layout::BlockFormattingContext::layout const):
3346         (WebCore::Layout::BlockFormattingContext::computeStaticPosition const):
3347         (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const):
3348         (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const):
3349         * layout/blockformatting/BlockFormattingContext.h:
3350         * layout/displaytree/DisplayBox.h:
3351         (WebCore::Display::Box::parent const): Deleted.
3352         (WebCore::Display::Box::nextSibling const): Deleted.
3353         (WebCore::Display::Box::previousSibling const): Deleted.
3354         (WebCore::Display::Box::firstChild const): Deleted.
3355         (WebCore::Display::Box::lastChild const): Deleted.
3356         (WebCore::Display::Box::setParent): Deleted.
3357         (WebCore::Display::Box::setNextSibling): Deleted.
3358         (WebCore::Display::Box::setPreviousSibling): Deleted.
3359         (WebCore::Display::Box::setFirstChild): Deleted.
3360         (WebCore::Display::Box::setLastChild): Deleted.
3361         (): Deleted.
3362         * layout/inlineformatting/InlineFormattingContext.cpp:
3363         (WebCore::Layout::InlineFormattingContext::computeInFlowWidth const):
3364         (WebCore::Layout::InlineFormattingContext::computeInFlowHeight const):
3365         * layout/inlineformatting/InlineFormattingContext.h:
3366
3367 2018-05-02  Said Abou-Hallawa  <sabouhallawa@apple.com>
3368
3369         Hiding then showing an <object> of type image makes the underlaying image disappear
3370         https://bugs.webkit.org/show_bug.cgi?id=185216
3371         <rdar://problem/39055630>
3372
3373         Reviewed by Youenn Fablet.
3374
3375         Ensure the HTMLPlugInImageElement updates the RenderImageResource of its
3376         RenderImage with the CachedImage of its ImageLoader when the RenderImage
3377         is recreated.
3378
3379         Test: fast/images/object-image-hide-show.html
3380
3381         * html/HTMLPlugInImageElement.cpp:
3382         (WebCore::HTMLPlugInImageElement::didAttachRenderers):
3383         This is very similar to what we do in HTMLImageElement::didAttachRenderers().
3384
3385
3386 2018-05-02  Brent Fulgham  <bfulgham@apple.com>
3387
3388         Use RetainPtr for form input type
3389         https://bugs.webkit.org/show_bug.cgi?id=185210
3390         <rdar://problem/39734040>
3391
3392         Reviewed by Ryosuke Niwa.
3393
3394         Refactor our HTMLInputElement class to store its InputType member as a RefPtr.
3395
3396         Test: fast/forms/access-key-mutation-2.html.
3397
3398         * html/HTMLInputElement.cpp:
3399         (WebCore::HTMLInputElement::HTMLInputElement):
3400         (WebCore::HTMLInputElement::didAddUserAgentShadowRoot):
3401         (WebCore::HTMLInputElement::accessKeyAction):
3402         (WebCore::HTMLInputElement::parseAttribute):
3403         (WebCore::HTMLInputElement::appendFormData):
3404         * html/HTMLInputElement.h:
3405         * html/InputType.cpp:
3406         (WebCore::createInputType):
3407         (WebCore::InputType::create):
3408         (WebCore::InputType::createText):
3409         * html/InputType.h:
3410
3411 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
3412
3413         Use pointer instead of std::optional<std::reference_wrapper<>>
3414         https://bugs.webkit.org/show_bug.cgi?id=185186
3415
3416         Reviewed by Alex Christensen.
3417
3418         std::optional<T&> is not accepted in C++17 spec. So we replaced it
3419         with std::optional<std::reference_wrapper<T>>.
3420
3421         In this patch, we replace it with T*, which is well-aligned to
3422         WebKit's convention.
3423
3424         * Modules/mediastream/RTCPeerConnection.cpp:
3425         (WebCore::iceServersFromConfiguration):
3426         (WebCore::RTCPeerConnection::initializeConfiguration):
3427         (WebCore::RTCPeerConnection::setConfiguration):
3428         * css/parser/CSSParser.cpp:
3429         (WebCore::CSSParser::parseSystemColor):
3430         * css/parser/CSSParser.h:
3431         * dom/DatasetDOMStringMap.cpp:
3432         (WebCore::DatasetDOMStringMap::item const):
3433         (WebCore::DatasetDOMStringMap::namedItem const):
3434         * dom/DatasetDOMStringMap.h:
3435         * dom/Element.cpp:
3436         (WebCore::Element::insertAdjacentHTML):
3437         * dom/Element.h:
3438         * html/canvas/CanvasStyle.cpp:
3439         (WebCore::parseColor):
3440         * inspector/DOMEditor.cpp:
3441         * platform/network/curl/CurlFormDataStream.cpp:
3442         (WebCore::CurlFormDataStream::getPostData):
3443         * platform/network/curl/CurlFormDataStream.h:
3444         * platform/network/curl/CurlRequest.cpp:
3445         (WebCore::CurlRequest::setupPOST):
3446         * testing/MockCDMFactory.cpp:
3447         (WebCore::MockCDMFactory::keysForSessionWithID const):
3448         (WebCore::MockCDMInstance::updateLicense):
3449         * testing/MockCDMFactory.h:
3450
3451 2018-05-02  Keith Rollin  <krollin@apple.com>
3452
3453         Add facility for tracking times and results of page and resource loading
3454         https://bugs.webkit.org/show_bug.cgi?id=184838
3455         <rdar://problem/36548974>
3456
3457         Reviewed by Brent Fulgham.
3458
3459         Update FrameProgressTracker to send the necessary page load start/stop
3460         signals so that we can track the entire page load at a network level.
3461         Add an empty override of the pure virtual
3462         LoaderStrategy::pageLoadCompleted method.
3463
3464         No new tests. There is no testable effect from these changes. On
3465         Cocoa, measurable changes take place in another (non-WebKit) process.
3466         On non-Cocoa systems, this facility is currently disabled.
3467
3468         * loader/FrameLoader.cpp:
3469         (WebCore::FrameLoader::FrameProgressTracker::progressCompleted):
3470         * loader/LoaderStrategy.h:
3471
3472 2018-05-02  Aditya Keerthi  <akeerthi@apple.com>
3473
3474         Can't copy and paste URLs that have no title into Mail (macOS)
3475         https://bugs.webkit.org/show_bug.cgi?id=185205
3476         <rdar://problem/36352406>
3477
3478         Reviewed by Tim Horton.
3479
3480         The pasteboardURL generated has an empty title for URLs without titles. Currently, the pasteboardURL.title is being saved to the pasteboard.
3481
3482         To fix the error, we check whether the title is empty and instead save the lastPathComponent to the pasteboard. This matches current behavior as the fallback title.
3483
3484         Augmented WebKitLegacy.ContextMenuCanCopyURL test
3485
3486         * platform/mac/PasteboardMac.mm:
3487         (WebCore::writeURLForTypes):
3488
3489 2018-05-01  Ryosuke Niwa  <rniwa@webkit.org>
3490
3491         REGRESSION(r225868): Release assert when removing an SVGUseElement from Document::m_svgUseElements
3492         https://bugs.webkit.org/show_bug.cgi?id=182188
3493         <rdar://problem/36689240>
3494
3495         Reviewed by Antti Koivisto.
3496
3497         Fixed the crash by removing up the release assert.
3498
3499         The crash is likely caused by re-entrancy to Document::resolveStyle during SVGUseElement::updateShadowTree.
3500         Because Document::resolveStyle invokes updateShadowTree on SVG use elements in Document::m_svgUseElements
3501         without clearing the map, the nested call to resolveStyle ends up calling updateShadowTree() for all elements
3502         in m_svgUseElements and removing them all from the map. When the stack frame eventually comes back to the outer
3503         invocation of Document::resolveStyle, updateShadowTree gets invoked for the second time on SVG use elements
3504         whose shadow tree had already been updated within the inner invocation to updateShadowTree, and release-asserts.
3505
3506         There is an alternative fix: avoid calling updateShadowTree on a svg element when shadowTreeNeedsUpdate returns
3507         true on the element in resolveStyle. However, removing the release assert is a sure way to fix the crash so
3508         this patch opts for that fix instead especially since we don't have any reproducible test case for this crash.
3509
3510         This release assertion was added in r225868 as a cautious measure to catch any use-after-frees of SVGUseElement's
3511         since m_svgUseElements stored raw pointes to SVG use elements but this crash is not an indicative of any UAF,
3512         and there is no evidence that r225868 has led to new UAFs even after five months.
3513
3514         No new tests. I couldn't find a way to trigger a nested style update inside SVGUseElement::updateShadowTree.
3515
3516         * dom/Document.cpp:
3517         (WebCore::Document::removeSVGUseElement):
3518
3519 2018-05-02  Dirk Schulze  <dschulze@chromium.org>
3520
3521         getCharNumAtPosition should take DOMPointInit as argument
3522         https://bugs.webkit.org/show_bug.cgi?id=184695
3523
3524         Reviewed by Antti Koivisto.
3525
3526         Extend existing tests for getCharNumAtPosition.
3527
3528         * svg/SVGTextContentElement.cpp:
3529         (WebCore::SVGTextContentElement::getCharNumAtPosition):
3530         * svg/SVGTextContentElement.h:
3531         * svg/SVGTextContentElement.idl: Use DOMPointInit argument.
3532
3533 2018-05-02  Youenn Fablet  <youenn@apple.com>
3534
3535         Use NetworkLoadChecker for navigation loads
3536         https://bugs.webkit.org/show_bug.cgi?id=184892
3537         <rdar://problem/39652686>
3538
3539         Reviewed by Chris Dumez.
3540
3541         Sanitize headers according response tainting.
3542         If tainting is basic, it means same origin load in which case we only filter Cookie related headers.
3543         If tainting is Opaque, we filter all uncommon headers.
3544         If tainting is CORS, we filter all uncommon headers except the one explicitely allowed by CORS headers.
3545         Covered by updated test.
3546
3547         * platform/network/ResourceResponseBase.cpp:
3548         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting):
3549         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFields):
3550         * platform/network/ResourceResponseBase.h:
3551
3552 2018-05-02  Myles C. Maxfield  <mmaxfield@apple.com>
3553
3554         Collection fragment identifiers don't use PostScript names
3555         https://bugs.webkit.org/show_bug.cgi?id=184624
3556         <rdar://problem/39432089>
3557
3558         Reviewed by Simon Fraser.
3559
3560         In a previous version of the CSS Fonts spec, there was text saying that items in font collections
3561         should be 1-indexed (so the first item would be MyFonts.ttc#1). However, this is unfortunate because
3562         inserting an item into the middle of a collection would throw off all content that uses the file.
3563         Instead, the spec has since changed to use PostScript names (so the content instead would say
3564         MyFonts.ttc#MyFont-Regular).
3565
3566         Test: fast/text/font-collection.html
3567
3568         * css/CSSFontFaceSource.cpp:
3569         (WebCore::CSSFontFaceSource::load):
3570         * loader/cache/CachedFont.cpp:
3571         (WebCore::CachedFont::calculateItemInCollection const):
3572         (WebCore::CachedFont::ensureCustomFontData):
3573         (WebCore::CachedFont::createCustomFontData):
3574         (WebCore::CachedFont::calculateIndex const): Deleted.
3575         * loader/cache/CachedFont.h:
3576         * platform/graphics/mac/FontCustomPlatformData.cpp:
3577         (WebCore::createFontCustomPlatformData):
3578         * platform/graphics/mac/FontCustomPlatformData.h:
3579
3580 2018-05-02  Brian Burg  <bburg@apple.com>
3581
3582         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
3583         https://bugs.webkit.org/show_bug.cgi?id=184861
3584         <rdar://problem/39153768>
3585
3586         Reviewed by Ryosuke Niwa.
3587
3588         Notify the client of the current connection count whenever a frontend connects or disconnects.
3589
3590         Covered by new API test.
3591
3592         * inspector/InspectorClient.h:
3593         (WebCore::InspectorClient::frontendCountChanged):
3594         * inspector/InspectorController.cpp:
3595         (WebCore::InspectorController::connectFrontend):
3596         (WebCore::InspectorController::disconnectFrontend):
3597         (WebCore::InspectorController::disconnectAllFrontends):
3598         * inspector/InspectorController.h:
3599
3600 2018-05-02  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3601
3602         [GStreamer] Remove unneeded include of gstgldisplay_wayland.h after r228866 and r229022
3603         https://bugs.webkit.org/show_bug.cgi?id=185207
3604
3605         Reviewed by Michael Catanzaro.
3606
3607         Remove unneeded include of gstgldisplay_wayland.h
3608
3609         No new tests, no change in behaviour.
3610
3611         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3612
3613 2018-05-02  Chris Dumez  <cdumez@apple.com>
3614
3615         document.open() event listener removal is not immediate
3616         https://bugs.webkit.org/show_bug.cgi?id=185191
3617
3618         Reviewed by Darin Adler.
3619
3620         We need to make sure we set the 'wasremoved' flag on RegisteredEventListeners
3621         whenever they get removed from the EventListenerMap. We were doing so correctly
3622         in EventListenerMap:remove() but not EventListenerMap::clear(). This patch
3623         updates clear() accordingly.
3624
3625         The reason we need to set this flag is that RegisteredEventListeners is RefCounted
3626         and EventTarget::fireEventListeners() may be currently running and calling
3627         each listener one by one, holding a reference to all listener of a given event.
3628
3629         Test: fast/dom/Document/document-open-removes-all-listeners.html
3630
3631         * dom/EventListenerMap.cpp:
3632         (WebCore::EventListenerMap::clear):
3633
3634 2018-05-02  Zalan Bujtas <zalan@apple.com>
3635
3636         Use WeakPtr in GridCell
3637         https://bugs.webkit.org/show_bug.cgi?id=185180
3638         <rdar://problem/39432165>
3639
3640         Reviewed by Antti Koivisto.
3641
3642         Since GridCell does not own the renderers, it should
3643         construct weak pointers.
3644
3645         Unable to create a reliably reproducible test case.
3646
3647         * rendering/Grid.cpp:
3648         (WebCore::Grid::insert):
3649         (WebCore::GridIterator::nextGridItem):
3650         * rendering/Grid.h:
3651         * rendering/RenderGrid.cpp:
3652         (WebCore::RenderGrid::firstLineBaseline const):
3653
3654 2018-05-02  Eric Carlson  <eric.carlson@apple.com>
3655
3656         [iOS] Provide audio route information when invoking AirPlay picker
3657         https://bugs.webkit.org/show_bug.cgi?id=185199
3658         <rdar://problem/39853103>
3659
3660         Reviewed by Jer Noble.
3661
3662         No new tests, this requires a specific hardware setup.
3663
3664         * dom/Document.cpp:
3665         (WebCore::Document::showPlaybackTargetPicker): Pass route sharing policy and routing context UID.
3666         * dom/Document.h:
3667
3668         * html/MediaElementSession.cpp:
3669         (WebCore::MediaElementSession::showPlaybackTargetPicker): Ditto.
3670
3671         * loader/EmptyClients.h:
3672         * page/ChromeClient.h:
3673
3674         * page/Page.cpp:
3675         (WebCore::Page::showPlaybackTargetPicker): Ditto.
3676         * page/Page.h:
3677
3678         * platform/audio/AudioSession.cpp:
3679         (WebCore::AudioSession::routeSharingPolicy const): Empty implementation for non-iOS ports.
3680         (WebCore::routingContextUID const): Ditto.
3681         * platform/audio/AudioSession.h:
3682
3683         * platform/audio/ios/AudioSessionIOS.mm:
3684         (WebCore::AudioSession::routeSharingPolicy const): Return the route sharing policy.
3685         (WebCore::AudioSession::routingContextUID const): Return the route context UID.
3686
3687 2018-05-02  Dean Jackson  <dino@apple.com>
3688
3689         Draw SystemPreview badge to specification on iOS
3690         https://bugs.webkit.org/show_bug.cgi?id=185203
3691         <rdar://problem/39908855>
3692
3693         Reviewed by Tim Horton.
3694
3695         Use CoreImage to render a badge with a blurred background,
3696         at particular sizes.
3697
3698         This will be tested internally while we're getting artwork
3699         from WebKitAdditions.
3700
3701         * Configurations/WebCore.xcconfig: Link against CoreImage.
3702         * rendering/RenderThemeIOS.h:
3703         * rendering/RenderThemeIOS.mm:
3704         (WebCore::RenderThemeIOS::paintSystemPreviewBadge): New function
3705         in the iOS platform RenderTheme that draws the system preview.
3706
3707 2018-05-01  Brent Fulgham  <bfulgham@apple.com>
3708
3709         Prevent Debug ASSERT when changing forms
3710         https://bugs.webkit.org/show_bug.cgi?id=185173
3711         <rdar://problem/39738669>
3712
3713         Reviewed by Ryosuke Niwa.
3714
3715         Form submission could trigger a debug assertion during validation when
3716         a form is changed during an input submission. Fix this by cleaning up
3717         the event handling logic and make it more consistent with modern WebKit
3718         coding style.
3719
3720         Test: fast/forms/form-submission-crash-3.html
3721
3722         * html/HTMLButtonElement.cpp:
3723         (WebCore::HTMLButtonElement::defaultEventHandler): Make sure layout runs before
3724         attempting to perform event handling.
3725         * html/HTMLFormElement.cpp:
3726         (WebCore::HTMLFormElement::reportValidity): Ditto.
3727         (WebCore::HTMLFormElement::validateInteractively): Remove call to perform layout here,
3728         since we expect this to happen earlier in the layout pass. Add an assertion that the
3729         tree is not dirty.
3730         * html/ImageInputType.cpp:
3731         (WebCore::ImageInputType::handleDOMActivateEvent): Make sure layout runs before
3732         attempting to perform event handling.
3733         * html/SubmitInputType.cpp:
3734         (WebCore::SubmitInputType::handleDOMActivateEvent): Ditto.
3735
3736 2018-05-02  Jer Noble  <jer.noble@apple.com>
3737
3738         Unreviewed; address review comments made before landing r231231.
3739
3740         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3741         (VideoFullscreenControllerContext::volume const):
3742
3743 2018-05-02  Jer Noble  <jer.noble@apple.com>
3744
3745         Pipe volume through PlaybackSessionManager/Proxy.
3746         https://bugs.webkit.org/show_bug.cgi?id=185182
3747
3748         Reviewed by Eric Carlson.
3749
3750         Add support for the volume property to PlaybackSessionModel, and all its clients.
3751
3752         * platform/cocoa/PlaybackSessionModel.h:
3753         (WebCore::PlaybackSessionModelClient::volumeChanged):
3754         * platform/cocoa/PlaybackSessionModelMediaElement.h:
3755         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
3756         (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
3757         (WebCore::PlaybackSessionModelMediaElement::setVolume):
3758         (WebCore::PlaybackSessionModelMediaElement::volume const):
3759         * platform/ios/PlaybackSessionInterfaceAVKit.h:
3760         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
3761         (WebCore::PlaybackSessionInterfaceAVKit::volumeChanged):
3762         * platform/ios/WebAVPlayerController.h:
3763         * platform/ios/WebAVPlayerController.mm:
3764         (-[WebAVPlayerController volume]):
3765         (-[WebAVPlayerController setVolume:]):
3766         (-[WebAVPlayerController volumeChanged:]):
3767         (-[WebAVPlayerController resetMediaState]):
3768         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3769         (VideoFullscreenControllerContext::volumeChanged):
3770         (VideoFullscreenControllerContext::volume const):
3771         (VideoFullscreenControllerContext::setVolume):
3772
3773 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
3774
3775         Unreviewed, fix build in WinCairo
3776         https://bugs.webkit.org/show_bug.cgi?id=185169
3777
3778         * bindings/js/JSDOMWindowBase.cpp:
3779         (WebCore::JSDOMWindowBase::instantiateStreaming):
3780         * bindings/js/JSDOMWindowBase.h:
3781
3782 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
3783
3784         Use default std::optional if it is provided
3785         https://bugs.webkit.org/show_bug.cgi?id=185159
3786
3787         Reviewed by JF Bastien.
3788
3789         * Modules/mediastream/RTCPeerConnection.cpp:
3790         (WebCore::iceServersFromConfiguration):
3791         (WebCore::RTCPeerConnection::setConfiguration):
3792         * css/parser/CSSParser.cpp:
3793         (WebCore::CSSParser::parseSystemColor):
3794         * css/parser/CSSParser.h:
3795         * dom/DatasetDOMStringMap.cpp:
3796         (WebCore::DatasetDOMStringMap::item const):
3797         (WebCore::DatasetDOMStringMap::namedItem const):
3798         (WebCore:: const): Deleted.
3799         * dom/DatasetDOMStringMap.h:
3800         * dom/Element.cpp:
3801         (WebCore::Element::insertAdjacentHTML):
3802         * dom/Element.h:
3803         * inspector/DOMEditor.cpp:
3804         * platform/network/curl/CurlFormDataStream.cpp:
3805         (WebCore::CurlFormDataStream::getPostData):
3806         (): Deleted.
3807         * platform/network/curl/CurlFormDataStream.h:
3808         * testing/MockCDMFactory.cpp:
3809         (WebCore::MockCDMFactory::keysForSessionWithID const):
3810         (WebCore::MockCDMInstance::updateLicense):
3811         (WebCore:: const): Deleted.
3812         * testing/MockCDMFactory.h:
3813
3814 2018-05-01  Chris Dumez  <cdumez@apple.com>
3815
3816         Add release assertions in CFNetwork's SocketStreamHandleImpl to help debug a threading issue
3817         https://bugs.webkit.org/show_bug.cgi?id=185181
3818
3819         Reviewed by Geoffrey Garen.
3820
3821         Add release assertions in CFNetwork's SocketStreamHandleImpl to help debug a threading issue
3822         on iOS WebKitLegacy (Bug 185073). It appears readStreamCallback() can get called on the UIThread,
3823         which should not be possible if scheduleStreams() was called on the WebThread, as it is supposed
3824         to. The new release assertion in scheduleStreams() should tell us if somebody is calling it from
3825         the UIthread instead of the WebThread on iOS WebKitLegacy.
3826
3827         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
3828         (WebCore::SocketStreamHandleImpl::scheduleStreams):
3829         (WebCore::SocketStreamHandleImpl::readStreamCallback):
3830
3831 2018-05-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3832
3833         Unreviewed, remove an unused variable in RuntimeEnabledFeatures.h
3834
3835         * page/RuntimeEnabledFeatures.h:
3836
3837 2018-05-01  Oleksandr Skachkov  <gskachkov@gmail.com>
3838
3839         Fix build error after r231194
3840         https://bugs.webkit.org/show_bug.cgi?id=185169
3841
3842         Reviewed by JF Bastien.
3843
3844         Prevent compile error in iOS Simulator debug build
3845         by tagging function
3846
3847         * bindings/js/JSDOMWindowBase.cpp:
3848         (WebCore::JSDOMWindowBase::compileStreaming):
3849         (WebCore::JSDOMWindowBase::instantiateStreaming):
3850
3851 2018-05-01  Oleksandr Skachkov  <gskachkov@gmail.com>
3852
3853         WebAssembly: add support for stream APIs - JavaScript API
3854         https://bugs.webkit.org/show_bug.cgi?id=183442
3855
3856         Reviewed by Yusuke Suzuki and JF Bastien.
3857
3858         Add WebAssembly streaming API to WebCore.
3859
3860         * Configurations/FeatureDefines.xcconfig:
3861         * bindings/js/JSDOMWindowBase.cpp:
3862         (WebCore::tryAllocate):
3863         (WebCore::isResponseCorrect):
3864         (WebCore::handleResponseOnStreamingAction):
3865         (WebCore::JSDOMWindowBase::compileStreaming):
3866         (WebCore::JSDOMWindowBase::instantiateStreaming):
3867         * bindings/js/JSDOMWindowBase.h:
3868         * bindings/js/JSRemoteDOMWindowBase.cpp:
3869         * bindings/js/JSWorkerGlobalScopeBase.cpp:
3870
3871 2018-04-30  Myles C. Maxfield  <mmaxfield@apple.com>
3872
3873         Improve the performance of FontCascadeDescription's effectiveFamilies
3874         https://bugs.webkit.org/show_bug.cgi?id=184720
3875         <rdar://problem/38970927>
3876
3877         Reviewed by Simon Fraser.
3878
3879         The page that had the performance problem renders many different Chinese characters in system-ui
3880         with only a small number of individual fonts. It turns out we were calling into the system-ui
3881         machinery for each character in order to opportunistically start loading data URLs (see also:
3882         https://bugs.webkit.org/show_bug.cgi?id=175845). These data URLS will never represent the system
3883         font, so we don't need to invoke the system-ui machinery at all.
3884
3885         This patch makes a 92x performance improvement on the associated performance test. This test is
3886         designed to test Chinese text rendered with system-ui.
3887
3888         Performance test: Layout/system-ui.html
3889
3890         * platform/graphics/FontCascadeFonts.cpp:
3891         (WebCore::opportunisticallyStartFontDataURLLoading):
3892
3893 2018-04-30  Jer Noble  <jer.noble@apple.com>
3894
3895         <img src=mp4> does not display on ios despite Accept: video/* advertisement
3896         https://bugs.webkit.org/show_bug.cgi?id=185029
3897         <rdar://problem/39771989>
3898
3899         Reviewed by Eric Carlson.
3900
3901         Returning "NO" from resourceLoader:shouldWaitForLoadingOfResource: signals that the load failed,
3902         even if the resource request is successfully fulfilled prior to the return. Always return YES in
3903         the case that loading succeeded.
3904
3905         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
3906         (-[WebCoreSharedBufferResourceLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]):
3907
3908 2018-04-30  Zalan Bujtas  <zalan@apple.com>
3909
3910         REGRESSION(r230914) Selecting text on this apple.com page makes it vanish
3911         https://bugs.webkit.org/show_bug.cgi?id=185142
3912         <rdar://problem/39821446>
3913
3914         Reviewed by Simon Fraser.
3915
3916         Set the overflow rect on the inline textbox when needed.
3917
3918         Test: fast/text/simple-line-layout-selection-with-overflow.html
3919
3920         * rendering/SimpleLineLayoutFunctions.cpp:
3921         (WebCore::SimpleLineLayout::initializeInlineTextBox):
3922         (WebCore::SimpleLineLayout::generateLineBoxTree):
3923         (WebCore::SimpleLineLayout::initializeInlineBox): Deleted.
3924
3925 2018-04-30  JF Bastien  <jfbastien@apple.com>
3926
3927         Use some C++17 features
3928         https://bugs.webkit.org/show_bug.cgi?id=185135
3929
3930         Reviewed by Alex Christensen.
3931
3932         As discussed here [0] let's move WebKit to a subset of C++17. We
3933         now require GCC 6 [1] which means that, according to [2] we can
3934         use the following C++17 language features (I removed some
3935         uninteresting ones):
3936
3937          - New auto rules for direct-list-initialization
3938          - static_assert with no message
3939          - typename in a template template parameter
3940          - Nested namespace definition
3941          - Attributes for namespaces and enumerators
3942          - u8 character literals
3943          - Allow constant evaluation for all non-type template arguments
3944          - Fold Expressions
3945          - Unary fold expressions and empty parameter packs
3946          - __has_include in preprocessor conditional
3947          - Differing begin and end types in range-based for
3948          - Improving std::pair and std::tuple
3949
3950         Consult the Tony Tables [3] to see before / after examples.
3951
3952         Of course we can use any library feature if we're willing to
3953         import them to WTF (and they don't require language support).
3954
3955
3956           [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html
3957           [1]: https://trac.webkit.org/changeset/231152/webkit
3958           [2]: https://en.cppreference.com/w/cpp/compiler_support
3959           [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md
3960
3961         * DerivedSources.make:
3962         * platform/URLParser.cpp: work around an odd GCC 6 bug with class
3963           static value as a template parameter.
3964         (WebCore::URLParser::percentDecode):
3965         (WebCore::URLParser::domainToASCII):
3966         (WebCore::URLParser::hasForbiddenHostCodePoint):
3967         (WebCore::URLParser::parseHostAndPort):
3968         * platform/URLParser.h:
3969
3970 2018-04-30  Wenson Hsieh  <wenson_hsieh@apple.com>
3971
3972         [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width
3973         https://bugs.webkit.org/show_bug.cgi?id=185132
3974         <rdar://problem/39834562>
3975
3976         Reviewed by Tim Horton.
3977
3978         Removes the `min-device-width` attribute added in r231095. Instead, we key this behavior off of the
3979         `shrink-to-fit` attribute introduced for multitasking on iPad, such that `shrink-to-fit=no` achieves the same
3980         behavior as `min-device-width=0` in extra zoom mode. See comments below for more detail.
3981
3982         Adjusted an existing layout test: fast/viewport/extrazoom/viewport-change-min-device-width.html.
3983
3984         * dom/ViewportArguments.cpp:
3985         (WebCore::setViewportFeature):
3986         (WebCore::operator<<):
3987         * dom/ViewportArguments.h:
3988