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